scopes = new ArrayList<>();
+ private RetryPolicy retryPolicy;
+ private RetryOptions retryOptions;
+ private Duration defaultPollInterval;
+
+ private Configurable() {
+ }
+
+ /**
+ * Sets the http client.
+ *
+ * @param httpClient the HTTP client.
+ * @return the configurable object itself.
+ */
+ public Configurable withHttpClient(HttpClient httpClient) {
+ this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null.");
+ return this;
+ }
+
+ /**
+ * Sets the logging options to the HTTP pipeline.
+ *
+ * @param httpLogOptions the HTTP log options.
+ * @return the configurable object itself.
+ */
+ public Configurable withLogOptions(HttpLogOptions httpLogOptions) {
+ this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null.");
+ return this;
+ }
+
+ /**
+ * Adds the pipeline policy to the HTTP pipeline.
+ *
+ * @param policy the HTTP pipeline policy.
+ * @return the configurable object itself.
+ */
+ public Configurable withPolicy(HttpPipelinePolicy policy) {
+ this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null."));
+ return this;
+ }
+
+ /**
+ * Adds the scope to permission sets.
+ *
+ * @param scope the scope.
+ * @return the configurable object itself.
+ */
+ public Configurable withScope(String scope) {
+ this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null."));
+ return this;
+ }
+
+ /**
+ * Sets the retry policy to the HTTP pipeline.
+ *
+ * @param retryPolicy the HTTP pipeline retry policy.
+ * @return the configurable object itself.
+ */
+ public Configurable withRetryPolicy(RetryPolicy retryPolicy) {
+ this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null.");
+ return this;
+ }
+
+ /**
+ * Sets the retry options for the HTTP pipeline retry policy.
+ *
+ * This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}.
+ *
+ * @param retryOptions the retry options for the HTTP pipeline retry policy.
+ * @return the configurable object itself.
+ */
+ public Configurable withRetryOptions(RetryOptions retryOptions) {
+ this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null.");
+ return this;
+ }
+
+ /**
+ * Sets the default poll interval, used when service does not provide "Retry-After" header.
+ *
+ * @param defaultPollInterval the default poll interval.
+ * @return the configurable object itself.
+ */
+ public Configurable withDefaultPollInterval(Duration defaultPollInterval) {
+ this.defaultPollInterval =
+ Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null.");
+ if (this.defaultPollInterval.isNegative()) {
+ throw LOGGER
+ .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative"));
+ }
+ return this;
+ }
+
+ /**
+ * Creates an instance of ManagementGroups service API entry point.
+ *
+ * @param credential the credential to use.
+ * @param profile the Azure profile for client.
+ * @return the ManagementGroups service API instance.
+ */
+ public ManagementGroupsManager authenticate(TokenCredential credential, AzureProfile profile) {
+ Objects.requireNonNull(credential, "'credential' cannot be null.");
+ Objects.requireNonNull(profile, "'profile' cannot be null.");
+
+ StringBuilder userAgentBuilder = new StringBuilder();
+ userAgentBuilder
+ .append("azsdk-java")
+ .append("-")
+ .append("com.azure.resourcemanager.managementgroups")
+ .append("/")
+ .append("1.0.0-beta.1");
+ if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) {
+ userAgentBuilder
+ .append(" (")
+ .append(Configuration.getGlobalConfiguration().get("java.version"))
+ .append("; ")
+ .append(Configuration.getGlobalConfiguration().get("os.name"))
+ .append("; ")
+ .append(Configuration.getGlobalConfiguration().get("os.version"))
+ .append("; auto-generated)");
+ } else {
+ userAgentBuilder.append(" (auto-generated)");
+ }
+
+ if (scopes.isEmpty()) {
+ scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default");
+ }
+ if (retryPolicy == null) {
+ if (retryOptions != null) {
+ retryPolicy = new RetryPolicy(retryOptions);
+ } else {
+ retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS);
+ }
+ }
+ List policies = new ArrayList<>();
+ policies.add(new UserAgentPolicy(userAgentBuilder.toString()));
+ policies.add(new AddHeadersFromContextPolicy());
+ policies.add(new RequestIdPolicy());
+ policies
+ .addAll(
+ this
+ .policies
+ .stream()
+ .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL)
+ .collect(Collectors.toList()));
+ HttpPolicyProviders.addBeforeRetryPolicies(policies);
+ policies.add(retryPolicy);
+ policies.add(new AddDatePolicy());
+ policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0])));
+ policies
+ .addAll(
+ this
+ .policies
+ .stream()
+ .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY)
+ .collect(Collectors.toList()));
+ HttpPolicyProviders.addAfterRetryPolicies(policies);
+ policies.add(new HttpLoggingPolicy(httpLogOptions));
+ HttpPipeline httpPipeline =
+ new HttpPipelineBuilder()
+ .httpClient(httpClient)
+ .policies(policies.toArray(new HttpPipelinePolicy[0]))
+ .build();
+ return new ManagementGroupsManager(httpPipeline, profile, defaultPollInterval);
+ }
+ }
+
+ /**
+ * Gets the resource collection API of ManagementGroups.
+ *
+ * @return Resource collection API of ManagementGroups.
+ */
+ public ManagementGroups managementGroups() {
+ if (this.managementGroups == null) {
+ this.managementGroups = new ManagementGroupsImpl(clientObject.getManagementGroups(), this);
+ }
+ return managementGroups;
+ }
+
+ /**
+ * Gets the resource collection API of ManagementGroupSubscriptions.
+ *
+ * @return Resource collection API of ManagementGroupSubscriptions.
+ */
+ public ManagementGroupSubscriptions managementGroupSubscriptions() {
+ if (this.managementGroupSubscriptions == null) {
+ this.managementGroupSubscriptions =
+ new ManagementGroupSubscriptionsImpl(clientObject.getManagementGroupSubscriptions(), this);
+ }
+ return managementGroupSubscriptions;
+ }
+
+ /**
+ * Gets the resource collection API of HierarchySettingsOperations.
+ *
+ * @return Resource collection API of HierarchySettingsOperations.
+ */
+ public HierarchySettingsOperations hierarchySettingsOperations() {
+ if (this.hierarchySettingsOperations == null) {
+ this.hierarchySettingsOperations =
+ new HierarchySettingsOperationsImpl(clientObject.getHierarchySettingsOperations(), this);
+ }
+ return hierarchySettingsOperations;
+ }
+
+ /**
+ * Gets the resource collection API of Operations.
+ *
+ * @return Resource collection API of Operations.
+ */
+ public Operations operations() {
+ if (this.operations == null) {
+ this.operations = new OperationsImpl(clientObject.getOperations(), this);
+ }
+ return operations;
+ }
+
+ /**
+ * Gets the resource collection API of ResourceProviders.
+ *
+ * @return Resource collection API of ResourceProviders.
+ */
+ public ResourceProviders resourceProviders() {
+ if (this.resourceProviders == null) {
+ this.resourceProviders = new ResourceProvidersImpl(clientObject.getResourceProviders(), this);
+ }
+ return resourceProviders;
+ }
+
+ /**
+ * Gets the resource collection API of Entities.
+ *
+ * @return Resource collection API of Entities.
+ */
+ public Entities entities() {
+ if (this.entities == null) {
+ this.entities = new EntitiesImpl(clientObject.getEntities(), this);
+ }
+ return entities;
+ }
+
+ /**
+ * @return Wrapped service client ManagementGroupsApi providing direct access to the underlying auto-generated API
+ * implementation, based on Azure REST API.
+ */
+ public ManagementGroupsApi serviceClient() {
+ return this.clientObject;
+ }
+}
diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/EntitiesClient.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/EntitiesClient.java
new file mode 100644
index 000000000000..b491a3dcb29a
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/EntitiesClient.java
@@ -0,0 +1,78 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.managementgroups.fluent;
+
+import com.azure.core.annotation.ReturnType;
+import com.azure.core.annotation.ServiceMethod;
+import com.azure.core.http.rest.PagedIterable;
+import com.azure.core.util.Context;
+import com.azure.resourcemanager.managementgroups.fluent.models.EntityInfoInner;
+import com.azure.resourcemanager.managementgroups.models.EntitySearchType;
+import com.azure.resourcemanager.managementgroups.models.EntityViewParameterType;
+
+/** An instance of this class provides access to all the operations defined in EntitiesClient. */
+public interface EntitiesClient {
+ /**
+ * List all entities (Management Groups, Subscriptions, etc.) for the authenticated user.
+ *
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return describes the result of the request to view entities as paginated response with {@link PagedIterable}.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ PagedIterable list();
+
+ /**
+ * List all entities (Management Groups, Subscriptions, etc.) for the authenticated user.
+ *
+ * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a
+ * previous response contains a nextLink element, the value of the nextLink element will include a token
+ * parameter that specifies a starting point to use for subsequent calls.
+ * @param skip Number of entities to skip over when retrieving results. Passing this in will override $skipToken.
+ * @param top Number of elements to return when retrieving results. Passing this in will override $skipToken.
+ * @param select This parameter specifies the fields to include in the response. Can include any combination of
+ * Name,DisplayName,Type,ParentDisplayNameChain,ParentChain, e.g.
+ * '$select=Name,DisplayName,Type,ParentDisplayNameChain,ParentNameChain'. When specified the $select parameter
+ * can override select in $skipToken.
+ * @param search The $search parameter is used in conjunction with the $filter parameter to return three different
+ * outputs depending on the parameter passed in. With $search=AllowedParents the API will return the entity info
+ * of all groups that the requested entity will be able to reparent to as determined by the user's permissions.
+ * With $search=AllowedChildren the API will return the entity info of all entities that can be added as
+ * children of the requested entity. With $search=ParentAndFirstLevelChildren the API will return the parent and
+ * first level of children that the user has either direct access to or indirect access via one of their
+ * descendants. With $search=ParentOnly the API will return only the group if the user has access to at least
+ * one of the descendants of the group. With $search=ChildrenOnly the API will return only the first level of
+ * children of the group entity info specified in $filter. The user must have direct access to the children
+ * entities or one of it's descendants for it to show up in the results.
+ * @param filter The filter parameter allows you to filter on the the name or display name fields. You can check for
+ * equality on the name field (e.g. name eq '{entityName}') and you can check for substrings on either the name
+ * or display name fields(e.g. contains(name, '{substringToSearch}'), contains(displayName,
+ * '{substringToSearch')). Note that the '{entityName}' and '{substringToSearch}' fields are checked case
+ * insensitively.
+ * @param view The view parameter allows clients to filter the type of data that is returned by the getEntities
+ * call.
+ * @param groupName A filter which allows the get entities call to focus on a particular group (i.e. "$filter=name
+ * eq 'groupName'").
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return describes the result of the request to view entities as paginated response with {@link PagedIterable}.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ PagedIterable list(
+ String skiptoken,
+ Integer skip,
+ Integer top,
+ String select,
+ EntitySearchType search,
+ String filter,
+ EntityViewParameterType view,
+ String groupName,
+ String cacheControl,
+ Context context);
+}
diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/HierarchySettingsOperationsClient.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/HierarchySettingsOperationsClient.java
new file mode 100644
index 000000000000..9d19ab0266c6
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/HierarchySettingsOperationsClient.java
@@ -0,0 +1,150 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.managementgroups.fluent;
+
+import com.azure.core.annotation.ReturnType;
+import com.azure.core.annotation.ServiceMethod;
+import com.azure.core.http.rest.Response;
+import com.azure.core.util.Context;
+import com.azure.resourcemanager.managementgroups.fluent.models.HierarchySettingsInner;
+import com.azure.resourcemanager.managementgroups.fluent.models.HierarchySettingsListInner;
+import com.azure.resourcemanager.managementgroups.models.CreateOrUpdateSettingsRequest;
+
+/** An instance of this class provides access to all the operations defined in HierarchySettingsOperationsClient. */
+public interface HierarchySettingsOperationsClient {
+ /**
+ * Gets all the hierarchy settings defined at the Management Group level. Settings can only be set on the root
+ * Management Group of the hierarchy.
+ *
+ * @param groupId Management Group ID.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return all the hierarchy settings defined at the Management Group level.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ HierarchySettingsListInner list(String groupId);
+
+ /**
+ * Gets all the hierarchy settings defined at the Management Group level. Settings can only be set on the root
+ * Management Group of the hierarchy.
+ *
+ * @param groupId Management Group ID.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return all the hierarchy settings defined at the Management Group level along with {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ Response listWithResponse(String groupId, Context context);
+
+ /**
+ * Gets the hierarchy settings defined at the Management Group level. Settings can only be set on the root
+ * Management Group of the hierarchy.
+ *
+ * @param groupId Management Group ID.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the hierarchy settings defined at the Management Group level.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ HierarchySettingsInner get(String groupId);
+
+ /**
+ * Gets the hierarchy settings defined at the Management Group level. Settings can only be set on the root
+ * Management Group of the hierarchy.
+ *
+ * @param groupId Management Group ID.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the hierarchy settings defined at the Management Group level along with {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ Response getWithResponse(String groupId, Context context);
+
+ /**
+ * Creates or updates the hierarchy settings defined at the Management Group level.
+ *
+ * @param groupId Management Group ID.
+ * @param createTenantSettingsRequest Tenant level settings request parameter.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return settings defined at the Management Group scope.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ HierarchySettingsInner createOrUpdate(String groupId, CreateOrUpdateSettingsRequest createTenantSettingsRequest);
+
+ /**
+ * Creates or updates the hierarchy settings defined at the Management Group level.
+ *
+ * @param groupId Management Group ID.
+ * @param createTenantSettingsRequest Tenant level settings request parameter.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return settings defined at the Management Group scope along with {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ Response createOrUpdateWithResponse(
+ String groupId, CreateOrUpdateSettingsRequest createTenantSettingsRequest, Context context);
+
+ /**
+ * Updates the hierarchy settings defined at the Management Group level.
+ *
+ * @param groupId Management Group ID.
+ * @param createTenantSettingsRequest Tenant level settings request parameter.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return settings defined at the Management Group scope.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ HierarchySettingsInner update(String groupId, CreateOrUpdateSettingsRequest createTenantSettingsRequest);
+
+ /**
+ * Updates the hierarchy settings defined at the Management Group level.
+ *
+ * @param groupId Management Group ID.
+ * @param createTenantSettingsRequest Tenant level settings request parameter.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return settings defined at the Management Group scope along with {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ Response updateWithResponse(
+ String groupId, CreateOrUpdateSettingsRequest createTenantSettingsRequest, Context context);
+
+ /**
+ * Deletes the hierarchy settings defined at the Management Group level.
+ *
+ * @param groupId Management Group ID.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ void delete(String groupId);
+
+ /**
+ * Deletes the hierarchy settings defined at the Management Group level.
+ *
+ * @param groupId Management Group ID.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ Response deleteWithResponse(String groupId, Context context);
+}
diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/ManagementGroupSubscriptionsClient.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/ManagementGroupSubscriptionsClient.java
new file mode 100644
index 000000000000..61a3ead8c418
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/ManagementGroupSubscriptionsClient.java
@@ -0,0 +1,132 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.managementgroups.fluent;
+
+import com.azure.core.annotation.ReturnType;
+import com.azure.core.annotation.ServiceMethod;
+import com.azure.core.http.rest.PagedIterable;
+import com.azure.core.http.rest.Response;
+import com.azure.core.util.Context;
+import com.azure.resourcemanager.managementgroups.fluent.models.SubscriptionUnderManagementGroupInner;
+
+/** An instance of this class provides access to all the operations defined in ManagementGroupSubscriptionsClient. */
+public interface ManagementGroupSubscriptionsClient {
+ /**
+ * Associates existing subscription with the management group.
+ *
+ * @param groupId Management Group ID.
+ * @param subscriptionId Subscription ID.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the details of subscription under management group.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ SubscriptionUnderManagementGroupInner create(String groupId, String subscriptionId);
+
+ /**
+ * Associates existing subscription with the management group.
+ *
+ * @param groupId Management Group ID.
+ * @param subscriptionId Subscription ID.
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the details of subscription under management group along with {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ Response createWithResponse(
+ String groupId, String subscriptionId, String cacheControl, Context context);
+
+ /**
+ * De-associates subscription from the management group.
+ *
+ * @param groupId Management Group ID.
+ * @param subscriptionId Subscription ID.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ void delete(String groupId, String subscriptionId);
+
+ /**
+ * De-associates subscription from the management group.
+ *
+ * @param groupId Management Group ID.
+ * @param subscriptionId Subscription ID.
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ Response deleteWithResponse(String groupId, String subscriptionId, String cacheControl, Context context);
+
+ /**
+ * Retrieves details about given subscription which is associated with the management group.
+ *
+ * @param groupId Management Group ID.
+ * @param subscriptionId Subscription ID.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the details of subscription under management group.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ SubscriptionUnderManagementGroupInner getSubscription(String groupId, String subscriptionId);
+
+ /**
+ * Retrieves details about given subscription which is associated with the management group.
+ *
+ * @param groupId Management Group ID.
+ * @param subscriptionId Subscription ID.
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the details of subscription under management group along with {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ Response getSubscriptionWithResponse(
+ String groupId, String subscriptionId, String cacheControl, Context context);
+
+ /**
+ * Retrieves details about all subscriptions which are associated with the management group.
+ *
+ * @param groupId Management Group ID.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the details of all subscriptions under management group as paginated response with {@link PagedIterable}.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ PagedIterable getSubscriptionsUnderManagementGroup(String groupId);
+
+ /**
+ * Retrieves details about all subscriptions which are associated with the management group.
+ *
+ * @param groupId Management Group ID.
+ * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a
+ * previous response contains a nextLink element, the value of the nextLink element will include a token
+ * parameter that specifies a starting point to use for subsequent calls.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the details of all subscriptions under management group as paginated response with {@link PagedIterable}.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ PagedIterable getSubscriptionsUnderManagementGroup(
+ String groupId, String skiptoken, Context context);
+}
diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/ManagementGroupsApi.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/ManagementGroupsApi.java
new file mode 100644
index 000000000000..1f902bbe8809
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/ManagementGroupsApi.java
@@ -0,0 +1,81 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.managementgroups.fluent;
+
+import com.azure.core.http.HttpPipeline;
+import java.time.Duration;
+
+/** The interface for ManagementGroupsApi class. */
+public interface ManagementGroupsApi {
+ /**
+ * Gets server parameter.
+ *
+ * @return the endpoint value.
+ */
+ String getEndpoint();
+
+ /**
+ * Gets Api Version.
+ *
+ * @return the apiVersion value.
+ */
+ String getApiVersion();
+
+ /**
+ * Gets The HTTP pipeline to send requests through.
+ *
+ * @return the httpPipeline value.
+ */
+ HttpPipeline getHttpPipeline();
+
+ /**
+ * Gets The default poll interval for long-running operation.
+ *
+ * @return the defaultPollInterval value.
+ */
+ Duration getDefaultPollInterval();
+
+ /**
+ * Gets the ManagementGroupsClient object to access its operations.
+ *
+ * @return the ManagementGroupsClient object.
+ */
+ ManagementGroupsClient getManagementGroups();
+
+ /**
+ * Gets the ManagementGroupSubscriptionsClient object to access its operations.
+ *
+ * @return the ManagementGroupSubscriptionsClient object.
+ */
+ ManagementGroupSubscriptionsClient getManagementGroupSubscriptions();
+
+ /**
+ * Gets the HierarchySettingsOperationsClient object to access its operations.
+ *
+ * @return the HierarchySettingsOperationsClient object.
+ */
+ HierarchySettingsOperationsClient getHierarchySettingsOperations();
+
+ /**
+ * Gets the OperationsClient object to access its operations.
+ *
+ * @return the OperationsClient object.
+ */
+ OperationsClient getOperations();
+
+ /**
+ * Gets the ResourceProvidersClient object to access its operations.
+ *
+ * @return the ResourceProvidersClient object.
+ */
+ ResourceProvidersClient getResourceProviders();
+
+ /**
+ * Gets the EntitiesClient object to access its operations.
+ *
+ * @return the EntitiesClient object.
+ */
+ EntitiesClient getEntities();
+}
diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/ManagementGroupsClient.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/ManagementGroupsClient.java
new file mode 100644
index 000000000000..d6914af19a91
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/ManagementGroupsClient.java
@@ -0,0 +1,313 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.managementgroups.fluent;
+
+import com.azure.core.annotation.ReturnType;
+import com.azure.core.annotation.ServiceMethod;
+import com.azure.core.http.rest.PagedIterable;
+import com.azure.core.http.rest.Response;
+import com.azure.core.management.polling.PollResult;
+import com.azure.core.util.Context;
+import com.azure.core.util.polling.SyncPoller;
+import com.azure.resourcemanager.managementgroups.fluent.models.AzureAsyncOperationResultsInner;
+import com.azure.resourcemanager.managementgroups.fluent.models.DescendantInfoInner;
+import com.azure.resourcemanager.managementgroups.fluent.models.ManagementGroupInfoInner;
+import com.azure.resourcemanager.managementgroups.fluent.models.ManagementGroupInner;
+import com.azure.resourcemanager.managementgroups.models.CreateManagementGroupRequest;
+import com.azure.resourcemanager.managementgroups.models.ManagementGroupExpandType;
+import com.azure.resourcemanager.managementgroups.models.PatchManagementGroupRequest;
+
+/** An instance of this class provides access to all the operations defined in ManagementGroupsClient. */
+public interface ManagementGroupsClient {
+ /**
+ * List management groups for the authenticated user.
+ *
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return describes the result of the request to list management groups as paginated response with {@link
+ * PagedIterable}.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ PagedIterable list();
+
+ /**
+ * List management groups for the authenticated user.
+ *
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a
+ * previous response contains a nextLink element, the value of the nextLink element will include a token
+ * parameter that specifies a starting point to use for subsequent calls.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return describes the result of the request to list management groups as paginated response with {@link
+ * PagedIterable}.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ PagedIterable list(String cacheControl, String skiptoken, Context context);
+
+ /**
+ * Get the details of the management group.
+ *
+ * @param groupId Management Group ID.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the details of the management group.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ ManagementGroupInner get(String groupId);
+
+ /**
+ * Get the details of the management group.
+ *
+ * @param groupId Management Group ID.
+ * @param expand The $expand=children query string parameter allows clients to request inclusion of children in the
+ * response payload. $expand=path includes the path from the root group to the current group. $expand=ancestors
+ * includes the ancestor Ids of the current group.
+ * @param recurse The $recurse=true query string parameter allows clients to request inclusion of entire hierarchy
+ * in the response payload. Note that $expand=children must be passed up if $recurse is set to true.
+ * @param filter A filter which allows the exclusion of subscriptions from results (i.e. '$filter=children.childType
+ * ne Subscription').
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the details of the management group along with {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ Response getWithResponse(
+ String groupId,
+ ManagementGroupExpandType expand,
+ Boolean recurse,
+ String filter,
+ String cacheControl,
+ Context context);
+
+ /**
+ * Create or update a management group. If a management group is already created and a subsequent create request is
+ * issued with different properties, the management group properties will be updated.
+ *
+ * @param groupId Management Group ID.
+ * @param createManagementGroupRequest Management group creation parameters.
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the {@link SyncPoller} for polling of the management group details.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ SyncPoller, ManagementGroupInner> beginCreateOrUpdate(
+ String groupId, CreateManagementGroupRequest createManagementGroupRequest, String cacheControl);
+
+ /**
+ * Create or update a management group. If a management group is already created and a subsequent create request is
+ * issued with different properties, the management group properties will be updated.
+ *
+ * @param groupId Management Group ID.
+ * @param createManagementGroupRequest Management group creation parameters.
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the {@link SyncPoller} for polling of the management group details.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ SyncPoller, ManagementGroupInner> beginCreateOrUpdate(
+ String groupId,
+ CreateManagementGroupRequest createManagementGroupRequest,
+ String cacheControl,
+ Context context);
+
+ /**
+ * Create or update a management group. If a management group is already created and a subsequent create request is
+ * issued with different properties, the management group properties will be updated.
+ *
+ * @param groupId Management Group ID.
+ * @param createManagementGroupRequest Management group creation parameters.
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the management group details.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ ManagementGroupInner createOrUpdate(
+ String groupId, CreateManagementGroupRequest createManagementGroupRequest, String cacheControl);
+
+ /**
+ * Create or update a management group. If a management group is already created and a subsequent create request is
+ * issued with different properties, the management group properties will be updated.
+ *
+ * @param groupId Management Group ID.
+ * @param createManagementGroupRequest Management group creation parameters.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the management group details.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ ManagementGroupInner createOrUpdate(String groupId, CreateManagementGroupRequest createManagementGroupRequest);
+
+ /**
+ * Create or update a management group. If a management group is already created and a subsequent create request is
+ * issued with different properties, the management group properties will be updated.
+ *
+ * @param groupId Management Group ID.
+ * @param createManagementGroupRequest Management group creation parameters.
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the management group details.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ ManagementGroupInner createOrUpdate(
+ String groupId,
+ CreateManagementGroupRequest createManagementGroupRequest,
+ String cacheControl,
+ Context context);
+
+ /**
+ * Update a management group.
+ *
+ * @param groupId Management Group ID.
+ * @param patchGroupRequest Management group patch parameters.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the management group details.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ ManagementGroupInner update(String groupId, PatchManagementGroupRequest patchGroupRequest);
+
+ /**
+ * Update a management group.
+ *
+ * @param groupId Management Group ID.
+ * @param patchGroupRequest Management group patch parameters.
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the management group details along with {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ Response updateWithResponse(
+ String groupId, PatchManagementGroupRequest patchGroupRequest, String cacheControl, Context context);
+
+ /**
+ * Delete management group. If a management group contains child resources, the request will fail.
+ *
+ * @param groupId Management Group ID.
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the {@link SyncPoller} for polling of the results of Azure-AsyncOperation.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ SyncPoller, AzureAsyncOperationResultsInner> beginDelete(
+ String groupId, String cacheControl);
+
+ /**
+ * Delete management group. If a management group contains child resources, the request will fail.
+ *
+ * @param groupId Management Group ID.
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the {@link SyncPoller} for polling of the results of Azure-AsyncOperation.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ SyncPoller, AzureAsyncOperationResultsInner> beginDelete(
+ String groupId, String cacheControl, Context context);
+
+ /**
+ * Delete management group. If a management group contains child resources, the request will fail.
+ *
+ * @param groupId Management Group ID.
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the results of Azure-AsyncOperation.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ AzureAsyncOperationResultsInner delete(String groupId, String cacheControl);
+
+ /**
+ * Delete management group. If a management group contains child resources, the request will fail.
+ *
+ * @param groupId Management Group ID.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the results of Azure-AsyncOperation.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ AzureAsyncOperationResultsInner delete(String groupId);
+
+ /**
+ * Delete management group. If a management group contains child resources, the request will fail.
+ *
+ * @param groupId Management Group ID.
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the results of Azure-AsyncOperation.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ AzureAsyncOperationResultsInner delete(String groupId, String cacheControl, Context context);
+
+ /**
+ * List all entities that descend from a management group.
+ *
+ * @param groupId Management Group ID.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return describes the result of the request to view descendants as paginated response with {@link PagedIterable}.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ PagedIterable getDescendants(String groupId);
+
+ /**
+ * List all entities that descend from a management group.
+ *
+ * @param groupId Management Group ID.
+ * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a
+ * previous response contains a nextLink element, the value of the nextLink element will include a token
+ * parameter that specifies a starting point to use for subsequent calls.
+ * @param top Number of elements to return when retrieving results. Passing this in will override $skipToken.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return describes the result of the request to view descendants as paginated response with {@link PagedIterable}.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ PagedIterable getDescendants(String groupId, String skiptoken, Integer top, Context context);
+}
diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/OperationsClient.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/OperationsClient.java
new file mode 100644
index 000000000000..79c8f8bac816
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/OperationsClient.java
@@ -0,0 +1,38 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.managementgroups.fluent;
+
+import com.azure.core.annotation.ReturnType;
+import com.azure.core.annotation.ServiceMethod;
+import com.azure.core.http.rest.PagedIterable;
+import com.azure.core.util.Context;
+import com.azure.resourcemanager.managementgroups.fluent.models.OperationInner;
+
+/** An instance of this class provides access to all the operations defined in OperationsClient. */
+public interface OperationsClient {
+ /**
+ * Lists all of the available Management REST API operations.
+ *
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return describes the result of the request to list Microsoft.Management operations as paginated response with
+ * {@link PagedIterable}.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ PagedIterable list();
+
+ /**
+ * Lists all of the available Management REST API operations.
+ *
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return describes the result of the request to list Microsoft.Management operations as paginated response with
+ * {@link PagedIterable}.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ PagedIterable list(Context context);
+}
diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/ResourceProvidersClient.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/ResourceProvidersClient.java
new file mode 100644
index 000000000000..d3d82c1e3e56
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/ResourceProvidersClient.java
@@ -0,0 +1,87 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.managementgroups.fluent;
+
+import com.azure.core.annotation.ReturnType;
+import com.azure.core.annotation.ServiceMethod;
+import com.azure.core.http.rest.Response;
+import com.azure.core.util.Context;
+import com.azure.resourcemanager.managementgroups.fluent.models.CheckNameAvailabilityResultInner;
+import com.azure.resourcemanager.managementgroups.fluent.models.TenantBackfillStatusResultInner;
+import com.azure.resourcemanager.managementgroups.models.CheckNameAvailabilityRequest;
+
+/** An instance of this class provides access to all the operations defined in ResourceProvidersClient. */
+public interface ResourceProvidersClient {
+ /**
+ * Checks if the specified management group name is valid and unique.
+ *
+ * @param checkNameAvailabilityRequest Management group name availability check parameters.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return describes the result of the request to check management group name availability.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ CheckNameAvailabilityResultInner checkNameAvailability(CheckNameAvailabilityRequest checkNameAvailabilityRequest);
+
+ /**
+ * Checks if the specified management group name is valid and unique.
+ *
+ * @param checkNameAvailabilityRequest Management group name availability check parameters.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return describes the result of the request to check management group name availability along with {@link
+ * Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ Response checkNameAvailabilityWithResponse(
+ CheckNameAvailabilityRequest checkNameAvailabilityRequest, Context context);
+
+ /**
+ * Starts backfilling subscriptions for the Tenant.
+ *
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the tenant backfill status.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ TenantBackfillStatusResultInner startTenantBackfill();
+
+ /**
+ * Starts backfilling subscriptions for the Tenant.
+ *
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the tenant backfill status along with {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ Response startTenantBackfillWithResponse(Context context);
+
+ /**
+ * Gets tenant backfill status.
+ *
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return tenant backfill status.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ TenantBackfillStatusResultInner tenantBackfillStatus();
+
+ /**
+ * Gets tenant backfill status.
+ *
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return tenant backfill status along with {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ Response tenantBackfillStatusWithResponse(Context context);
+}
diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/AzureAsyncOperationResultsInner.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/AzureAsyncOperationResultsInner.java
new file mode 100644
index 000000000000..76d171cf3b13
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/AzureAsyncOperationResultsInner.java
@@ -0,0 +1,152 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.managementgroups.fluent.models;
+
+import com.azure.core.annotation.Fluent;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/** The results of Azure-AsyncOperation. */
+@Fluent
+public final class AzureAsyncOperationResultsInner {
+ /*
+ * The fully qualified ID for the management group. For example,
+ * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000
+ */
+ @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY)
+ private String id;
+
+ /*
+ * The type of the resource. For example,
+ * Microsoft.Management/managementGroups
+ */
+ @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY)
+ private String type;
+
+ /*
+ * The name of the management group. For example,
+ * 00000000-0000-0000-0000-000000000000
+ */
+ @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY)
+ private String name;
+
+ /*
+ * The current status of the asynchronous operation performed . For
+ * example, Running, Succeeded, Failed
+ */
+ @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY)
+ private String status;
+
+ /*
+ * The generic properties of a management group.
+ */
+ @JsonProperty(value = "properties")
+ private ManagementGroupInfoProperties innerProperties;
+
+ /**
+ * Get the id property: The fully qualified ID for the management group. For example,
+ * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000.
+ *
+ * @return the id value.
+ */
+ public String id() {
+ return this.id;
+ }
+
+ /**
+ * Get the type property: The type of the resource. For example, Microsoft.Management/managementGroups.
+ *
+ * @return the type value.
+ */
+ public String type() {
+ return this.type;
+ }
+
+ /**
+ * Get the name property: The name of the management group. For example, 00000000-0000-0000-0000-000000000000.
+ *
+ * @return the name value.
+ */
+ public String name() {
+ return this.name;
+ }
+
+ /**
+ * Get the status property: The current status of the asynchronous operation performed . For example, Running,
+ * Succeeded, Failed.
+ *
+ * @return the status value.
+ */
+ public String status() {
+ return this.status;
+ }
+
+ /**
+ * Get the innerProperties property: The generic properties of a management group.
+ *
+ * @return the innerProperties value.
+ */
+ private ManagementGroupInfoProperties innerProperties() {
+ return this.innerProperties;
+ }
+
+ /**
+ * Get the tenantId property: The AAD Tenant ID associated with the management group. For example,
+ * 00000000-0000-0000-0000-000000000000.
+ *
+ * @return the tenantId value.
+ */
+ public String tenantId() {
+ return this.innerProperties() == null ? null : this.innerProperties().tenantId();
+ }
+
+ /**
+ * Set the tenantId property: The AAD Tenant ID associated with the management group. For example,
+ * 00000000-0000-0000-0000-000000000000.
+ *
+ * @param tenantId the tenantId value to set.
+ * @return the AzureAsyncOperationResultsInner object itself.
+ */
+ public AzureAsyncOperationResultsInner withTenantId(String tenantId) {
+ if (this.innerProperties() == null) {
+ this.innerProperties = new ManagementGroupInfoProperties();
+ }
+ this.innerProperties().withTenantId(tenantId);
+ return this;
+ }
+
+ /**
+ * Get the displayName property: The friendly name of the management group.
+ *
+ * @return the displayName value.
+ */
+ public String displayName() {
+ return this.innerProperties() == null ? null : this.innerProperties().displayName();
+ }
+
+ /**
+ * Set the displayName property: The friendly name of the management group.
+ *
+ * @param displayName the displayName value to set.
+ * @return the AzureAsyncOperationResultsInner object itself.
+ */
+ public AzureAsyncOperationResultsInner withDisplayName(String displayName) {
+ if (this.innerProperties() == null) {
+ this.innerProperties = new ManagementGroupInfoProperties();
+ }
+ this.innerProperties().withDisplayName(displayName);
+ return this;
+ }
+
+ /**
+ * Validates the instance.
+ *
+ * @throws IllegalArgumentException thrown if the instance is not valid.
+ */
+ public void validate() {
+ if (innerProperties() != null) {
+ innerProperties().validate();
+ }
+ }
+}
diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/CheckNameAvailabilityResultInner.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/CheckNameAvailabilityResultInner.java
new file mode 100644
index 000000000000..233502c98908
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/CheckNameAvailabilityResultInner.java
@@ -0,0 +1,80 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.managementgroups.fluent.models;
+
+import com.azure.core.annotation.Immutable;
+import com.azure.resourcemanager.managementgroups.models.Reason;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/** Describes the result of the request to check management group name availability. */
+@Immutable
+public final class CheckNameAvailabilityResultInner {
+ /*
+ * Required. True indicates name is valid and available. False indicates
+ * the name is invalid, unavailable, or both.
+ */
+ @JsonProperty(value = "nameAvailable", access = JsonProperty.Access.WRITE_ONLY)
+ private Boolean nameAvailable;
+
+ /*
+ * Required if nameAvailable == false. Invalid indicates the name provided
+ * does not match the resource provider's naming requirements (incorrect
+ * length, unsupported characters, etc.) AlreadyExists indicates that the
+ * name is already in use and is therefore unavailable.
+ */
+ @JsonProperty(value = "reason", access = JsonProperty.Access.WRITE_ONLY)
+ private Reason reason;
+
+ /*
+ * Required if nameAvailable == false. Localized. If reason == invalid,
+ * provide the user with the reason why the given name is invalid, and
+ * provide the resource naming requirements so that the user can select a
+ * valid name. If reason == AlreadyExists, explain that is already in use,
+ * and direct them to select a different name.
+ */
+ @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY)
+ private String message;
+
+ /**
+ * Get the nameAvailable property: Required. True indicates name is valid and available. False indicates the name is
+ * invalid, unavailable, or both.
+ *
+ * @return the nameAvailable value.
+ */
+ public Boolean nameAvailable() {
+ return this.nameAvailable;
+ }
+
+ /**
+ * Get the reason property: Required if nameAvailable == false. Invalid indicates the name provided does not match
+ * the resource provider's naming requirements (incorrect length, unsupported characters, etc.) AlreadyExists
+ * indicates that the name is already in use and is therefore unavailable.
+ *
+ * @return the reason value.
+ */
+ public Reason reason() {
+ return this.reason;
+ }
+
+ /**
+ * Get the message property: Required if nameAvailable == false. Localized. If reason == invalid, provide the user
+ * with the reason why the given name is invalid, and provide the resource naming requirements so that the user can
+ * select a valid name. If reason == AlreadyExists, explain that is already in use, and direct them to select a
+ * different name.
+ *
+ * @return the message value.
+ */
+ public String message() {
+ return this.message;
+ }
+
+ /**
+ * Validates the instance.
+ *
+ * @throws IllegalArgumentException thrown if the instance is not valid.
+ */
+ public void validate() {
+ }
+}
diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/CreateManagementGroupProperties.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/CreateManagementGroupProperties.java
new file mode 100644
index 000000000000..a7936bb03d2f
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/CreateManagementGroupProperties.java
@@ -0,0 +1,116 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.managementgroups.fluent.models;
+
+import com.azure.core.annotation.Fluent;
+import com.azure.resourcemanager.managementgroups.models.CreateManagementGroupChildInfo;
+import com.azure.resourcemanager.managementgroups.models.CreateManagementGroupDetails;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.util.List;
+
+/** The generic properties of a management group used during creation. */
+@Fluent
+public final class CreateManagementGroupProperties {
+ /*
+ * The AAD Tenant ID associated with the management group. For example,
+ * 00000000-0000-0000-0000-000000000000
+ */
+ @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY)
+ private String tenantId;
+
+ /*
+ * The friendly name of the management group. If no value is passed then
+ * this field will be set to the groupId.
+ */
+ @JsonProperty(value = "displayName")
+ private String displayName;
+
+ /*
+ * The details of a management group used during creation.
+ */
+ @JsonProperty(value = "details")
+ private CreateManagementGroupDetails details;
+
+ /*
+ * The list of children.
+ */
+ @JsonProperty(value = "children", access = JsonProperty.Access.WRITE_ONLY)
+ private List children;
+
+ /**
+ * Get the tenantId property: The AAD Tenant ID associated with the management group. For example,
+ * 00000000-0000-0000-0000-000000000000.
+ *
+ * @return the tenantId value.
+ */
+ public String tenantId() {
+ return this.tenantId;
+ }
+
+ /**
+ * Get the displayName property: The friendly name of the management group. If no value is passed then this field
+ * will be set to the groupId.
+ *
+ * @return the displayName value.
+ */
+ public String displayName() {
+ return this.displayName;
+ }
+
+ /**
+ * Set the displayName property: The friendly name of the management group. If no value is passed then this field
+ * will be set to the groupId.
+ *
+ * @param displayName the displayName value to set.
+ * @return the CreateManagementGroupProperties object itself.
+ */
+ public CreateManagementGroupProperties withDisplayName(String displayName) {
+ this.displayName = displayName;
+ return this;
+ }
+
+ /**
+ * Get the details property: The details of a management group used during creation.
+ *
+ * @return the details value.
+ */
+ public CreateManagementGroupDetails details() {
+ return this.details;
+ }
+
+ /**
+ * Set the details property: The details of a management group used during creation.
+ *
+ * @param details the details value to set.
+ * @return the CreateManagementGroupProperties object itself.
+ */
+ public CreateManagementGroupProperties withDetails(CreateManagementGroupDetails details) {
+ this.details = details;
+ return this;
+ }
+
+ /**
+ * Get the children property: The list of children.
+ *
+ * @return the children value.
+ */
+ public List children() {
+ return this.children;
+ }
+
+ /**
+ * Validates the instance.
+ *
+ * @throws IllegalArgumentException thrown if the instance is not valid.
+ */
+ public void validate() {
+ if (details() != null) {
+ details().validate();
+ }
+ if (children() != null) {
+ children().forEach(e -> e.validate());
+ }
+ }
+}
diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/CreateOrUpdateSettingsProperties.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/CreateOrUpdateSettingsProperties.java
new file mode 100644
index 000000000000..52a529944902
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/CreateOrUpdateSettingsProperties.java
@@ -0,0 +1,92 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.managementgroups.fluent.models;
+
+import com.azure.core.annotation.Fluent;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/** The properties of the request to create or update Management Group settings. */
+@Fluent
+public final class CreateOrUpdateSettingsProperties {
+ /*
+ * Indicates whether RBAC access is required upon group creation under the
+ * root Management Group. If set to true, user will require
+ * Microsoft.Management/managementGroups/write action on the root
+ * Management Group scope in order to create new Groups directly under the
+ * root. This will prevent new users from creating new Management Groups,
+ * unless they are given access.
+ */
+ @JsonProperty(value = "requireAuthorizationForGroupCreation")
+ private Boolean requireAuthorizationForGroupCreation;
+
+ /*
+ * Settings that sets the default Management Group under which new
+ * subscriptions get added in this tenant. For example,
+ * /providers/Microsoft.Management/managementGroups/defaultGroup
+ */
+ @JsonProperty(value = "defaultManagementGroup")
+ private String defaultManagementGroup;
+
+ /**
+ * Get the requireAuthorizationForGroupCreation property: Indicates whether RBAC access is required upon group
+ * creation under the root Management Group. If set to true, user will require
+ * Microsoft.Management/managementGroups/write action on the root Management Group scope in order to create new
+ * Groups directly under the root. This will prevent new users from creating new Management Groups, unless they are
+ * given access.
+ *
+ * @return the requireAuthorizationForGroupCreation value.
+ */
+ public Boolean requireAuthorizationForGroupCreation() {
+ return this.requireAuthorizationForGroupCreation;
+ }
+
+ /**
+ * Set the requireAuthorizationForGroupCreation property: Indicates whether RBAC access is required upon group
+ * creation under the root Management Group. If set to true, user will require
+ * Microsoft.Management/managementGroups/write action on the root Management Group scope in order to create new
+ * Groups directly under the root. This will prevent new users from creating new Management Groups, unless they are
+ * given access.
+ *
+ * @param requireAuthorizationForGroupCreation the requireAuthorizationForGroupCreation value to set.
+ * @return the CreateOrUpdateSettingsProperties object itself.
+ */
+ public CreateOrUpdateSettingsProperties withRequireAuthorizationForGroupCreation(
+ Boolean requireAuthorizationForGroupCreation) {
+ this.requireAuthorizationForGroupCreation = requireAuthorizationForGroupCreation;
+ return this;
+ }
+
+ /**
+ * Get the defaultManagementGroup property: Settings that sets the default Management Group under which new
+ * subscriptions get added in this tenant. For example,
+ * /providers/Microsoft.Management/managementGroups/defaultGroup.
+ *
+ * @return the defaultManagementGroup value.
+ */
+ public String defaultManagementGroup() {
+ return this.defaultManagementGroup;
+ }
+
+ /**
+ * Set the defaultManagementGroup property: Settings that sets the default Management Group under which new
+ * subscriptions get added in this tenant. For example,
+ * /providers/Microsoft.Management/managementGroups/defaultGroup.
+ *
+ * @param defaultManagementGroup the defaultManagementGroup value to set.
+ * @return the CreateOrUpdateSettingsProperties object itself.
+ */
+ public CreateOrUpdateSettingsProperties withDefaultManagementGroup(String defaultManagementGroup) {
+ this.defaultManagementGroup = defaultManagementGroup;
+ return this;
+ }
+
+ /**
+ * Validates the instance.
+ *
+ * @throws IllegalArgumentException thrown if the instance is not valid.
+ */
+ public void validate() {
+ }
+}
diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/DescendantInfoInner.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/DescendantInfoInner.java
new file mode 100644
index 000000000000..4aea2704f3fd
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/DescendantInfoInner.java
@@ -0,0 +1,137 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.managementgroups.fluent.models;
+
+import com.azure.core.annotation.Fluent;
+import com.azure.resourcemanager.managementgroups.models.DescendantParentGroupInfo;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/** The descendant. */
+@Fluent
+public final class DescendantInfoInner {
+ /*
+ * The fully qualified ID for the descendant. For example,
+ * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000
+ * or /subscriptions/0000000-0000-0000-0000-000000000000
+ */
+ @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY)
+ private String id;
+
+ /*
+ * The type of the resource. For example,
+ * Microsoft.Management/managementGroups or /subscriptions
+ */
+ @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY)
+ private String type;
+
+ /*
+ * The name of the descendant. For example,
+ * 00000000-0000-0000-0000-000000000000
+ */
+ @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY)
+ private String name;
+
+ /*
+ * The generic properties of an descendant.
+ */
+ @JsonProperty(value = "properties")
+ private DescendantInfoProperties innerProperties;
+
+ /**
+ * Get the id property: The fully qualified ID for the descendant. For example,
+ * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 or
+ * /subscriptions/0000000-0000-0000-0000-000000000000.
+ *
+ * @return the id value.
+ */
+ public String id() {
+ return this.id;
+ }
+
+ /**
+ * Get the type property: The type of the resource. For example, Microsoft.Management/managementGroups or
+ * /subscriptions.
+ *
+ * @return the type value.
+ */
+ public String type() {
+ return this.type;
+ }
+
+ /**
+ * Get the name property: The name of the descendant. For example, 00000000-0000-0000-0000-000000000000.
+ *
+ * @return the name value.
+ */
+ public String name() {
+ return this.name;
+ }
+
+ /**
+ * Get the innerProperties property: The generic properties of an descendant.
+ *
+ * @return the innerProperties value.
+ */
+ private DescendantInfoProperties innerProperties() {
+ return this.innerProperties;
+ }
+
+ /**
+ * Get the displayName property: The friendly name of the management group.
+ *
+ * @return the displayName value.
+ */
+ public String displayName() {
+ return this.innerProperties() == null ? null : this.innerProperties().displayName();
+ }
+
+ /**
+ * Set the displayName property: The friendly name of the management group.
+ *
+ * @param displayName the displayName value to set.
+ * @return the DescendantInfoInner object itself.
+ */
+ public DescendantInfoInner withDisplayName(String displayName) {
+ if (this.innerProperties() == null) {
+ this.innerProperties = new DescendantInfoProperties();
+ }
+ this.innerProperties().withDisplayName(displayName);
+ return this;
+ }
+
+ /**
+ * Get the parent property: The ID of the parent management group.
+ *
+ * @return the parent value.
+ */
+ public DescendantParentGroupInfo parent() {
+ return this.innerProperties() == null ? null : this.innerProperties().parent();
+ }
+
+ /**
+ * Set the parent property: The ID of the parent management group.
+ *
+ * @param parent the parent value to set.
+ * @return the DescendantInfoInner object itself.
+ */
+ public DescendantInfoInner withParent(DescendantParentGroupInfo parent) {
+ if (this.innerProperties() == null) {
+ this.innerProperties = new DescendantInfoProperties();
+ }
+ this.innerProperties().withParent(parent);
+ return this;
+ }
+
+ /**
+ * Validates the instance.
+ *
+ * @throws IllegalArgumentException thrown if the instance is not valid.
+ */
+ public void validate() {
+ if (innerProperties() != null) {
+ innerProperties().validate();
+ }
+ }
+}
diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/DescendantInfoProperties.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/DescendantInfoProperties.java
new file mode 100644
index 000000000000..c5eb91afd275
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/DescendantInfoProperties.java
@@ -0,0 +1,76 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.managementgroups.fluent.models;
+
+import com.azure.core.annotation.Fluent;
+import com.azure.resourcemanager.managementgroups.models.DescendantParentGroupInfo;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/** The generic properties of an descendant. */
+@Fluent
+public final class DescendantInfoProperties {
+ /*
+ * The friendly name of the management group.
+ */
+ @JsonProperty(value = "displayName")
+ private String displayName;
+
+ /*
+ * The ID of the parent management group.
+ */
+ @JsonProperty(value = "parent")
+ private DescendantParentGroupInfo parent;
+
+ /**
+ * Get the displayName property: The friendly name of the management group.
+ *
+ * @return the displayName value.
+ */
+ public String displayName() {
+ return this.displayName;
+ }
+
+ /**
+ * Set the displayName property: The friendly name of the management group.
+ *
+ * @param displayName the displayName value to set.
+ * @return the DescendantInfoProperties object itself.
+ */
+ public DescendantInfoProperties withDisplayName(String displayName) {
+ this.displayName = displayName;
+ return this;
+ }
+
+ /**
+ * Get the parent property: The ID of the parent management group.
+ *
+ * @return the parent value.
+ */
+ public DescendantParentGroupInfo parent() {
+ return this.parent;
+ }
+
+ /**
+ * Set the parent property: The ID of the parent management group.
+ *
+ * @param parent the parent value to set.
+ * @return the DescendantInfoProperties object itself.
+ */
+ public DescendantInfoProperties withParent(DescendantParentGroupInfo parent) {
+ this.parent = parent;
+ return this;
+ }
+
+ /**
+ * Validates the instance.
+ *
+ * @throws IllegalArgumentException thrown if the instance is not valid.
+ */
+ public void validate() {
+ if (parent() != null) {
+ parent().validate();
+ }
+ }
+}
diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/EntityHierarchyItemProperties.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/EntityHierarchyItemProperties.java
new file mode 100644
index 000000000000..ad1f6a1d2d88
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/EntityHierarchyItemProperties.java
@@ -0,0 +1,104 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.managementgroups.fluent.models;
+
+import com.azure.core.annotation.Fluent;
+import com.azure.resourcemanager.managementgroups.models.EntityHierarchyItem;
+import com.azure.resourcemanager.managementgroups.models.Permissions;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.util.List;
+
+/** The generic properties of a management group. */
+@Fluent
+public final class EntityHierarchyItemProperties {
+ /*
+ * The friendly name of the management group.
+ */
+ @JsonProperty(value = "displayName")
+ private String displayName;
+
+ /*
+ * The users specific permissions to this item.
+ */
+ @JsonProperty(value = "permissions")
+ private Permissions permissions;
+
+ /*
+ * The list of children.
+ */
+ @JsonProperty(value = "children")
+ private List children;
+
+ /**
+ * Get the displayName property: The friendly name of the management group.
+ *
+ * @return the displayName value.
+ */
+ public String displayName() {
+ return this.displayName;
+ }
+
+ /**
+ * Set the displayName property: The friendly name of the management group.
+ *
+ * @param displayName the displayName value to set.
+ * @return the EntityHierarchyItemProperties object itself.
+ */
+ public EntityHierarchyItemProperties withDisplayName(String displayName) {
+ this.displayName = displayName;
+ return this;
+ }
+
+ /**
+ * Get the permissions property: The users specific permissions to this item.
+ *
+ * @return the permissions value.
+ */
+ public Permissions permissions() {
+ return this.permissions;
+ }
+
+ /**
+ * Set the permissions property: The users specific permissions to this item.
+ *
+ * @param permissions the permissions value to set.
+ * @return the EntityHierarchyItemProperties object itself.
+ */
+ public EntityHierarchyItemProperties withPermissions(Permissions permissions) {
+ this.permissions = permissions;
+ return this;
+ }
+
+ /**
+ * Get the children property: The list of children.
+ *
+ * @return the children value.
+ */
+ public List children() {
+ return this.children;
+ }
+
+ /**
+ * Set the children property: The list of children.
+ *
+ * @param children the children value to set.
+ * @return the EntityHierarchyItemProperties object itself.
+ */
+ public EntityHierarchyItemProperties withChildren(List children) {
+ this.children = children;
+ return this;
+ }
+
+ /**
+ * Validates the instance.
+ *
+ * @throws IllegalArgumentException thrown if the instance is not valid.
+ */
+ public void validate() {
+ if (children() != null) {
+ children().forEach(e -> e.validate());
+ }
+ }
+}
diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/EntityInfoInner.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/EntityInfoInner.java
new file mode 100644
index 000000000000..299fb4d06fca
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/EntityInfoInner.java
@@ -0,0 +1,328 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.managementgroups.fluent.models;
+
+import com.azure.core.annotation.Fluent;
+import com.azure.resourcemanager.managementgroups.models.EntityParentGroupInfo;
+import com.azure.resourcemanager.managementgroups.models.Permissions;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.util.List;
+
+/** The entity. */
+@Fluent
+public final class EntityInfoInner {
+ /*
+ * The fully qualified ID for the entity. For example,
+ * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000
+ */
+ @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY)
+ private String id;
+
+ /*
+ * The type of the resource. For example,
+ * Microsoft.Management/managementGroups
+ */
+ @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY)
+ private String type;
+
+ /*
+ * The name of the entity. For example,
+ * 00000000-0000-0000-0000-000000000000
+ */
+ @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY)
+ private String name;
+
+ /*
+ * The generic properties of an entity.
+ */
+ @JsonProperty(value = "properties")
+ private EntityInfoProperties innerProperties;
+
+ /**
+ * Get the id property: The fully qualified ID for the entity. For example,
+ * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000.
+ *
+ * @return the id value.
+ */
+ public String id() {
+ return this.id;
+ }
+
+ /**
+ * Get the type property: The type of the resource. For example, Microsoft.Management/managementGroups.
+ *
+ * @return the type value.
+ */
+ public String type() {
+ return this.type;
+ }
+
+ /**
+ * Get the name property: The name of the entity. For example, 00000000-0000-0000-0000-000000000000.
+ *
+ * @return the name value.
+ */
+ public String name() {
+ return this.name;
+ }
+
+ /**
+ * Get the innerProperties property: The generic properties of an entity.
+ *
+ * @return the innerProperties value.
+ */
+ private EntityInfoProperties innerProperties() {
+ return this.innerProperties;
+ }
+
+ /**
+ * Get the tenantId property: The AAD Tenant ID associated with the entity. For example,
+ * 00000000-0000-0000-0000-000000000000.
+ *
+ * @return the tenantId value.
+ */
+ public String tenantId() {
+ return this.innerProperties() == null ? null : this.innerProperties().tenantId();
+ }
+
+ /**
+ * Set the tenantId property: The AAD Tenant ID associated with the entity. For example,
+ * 00000000-0000-0000-0000-000000000000.
+ *
+ * @param tenantId the tenantId value to set.
+ * @return the EntityInfoInner object itself.
+ */
+ public EntityInfoInner withTenantId(String tenantId) {
+ if (this.innerProperties() == null) {
+ this.innerProperties = new EntityInfoProperties();
+ }
+ this.innerProperties().withTenantId(tenantId);
+ return this;
+ }
+
+ /**
+ * Get the displayName property: The friendly name of the management group.
+ *
+ * @return the displayName value.
+ */
+ public String displayName() {
+ return this.innerProperties() == null ? null : this.innerProperties().displayName();
+ }
+
+ /**
+ * Set the displayName property: The friendly name of the management group.
+ *
+ * @param displayName the displayName value to set.
+ * @return the EntityInfoInner object itself.
+ */
+ public EntityInfoInner withDisplayName(String displayName) {
+ if (this.innerProperties() == null) {
+ this.innerProperties = new EntityInfoProperties();
+ }
+ this.innerProperties().withDisplayName(displayName);
+ return this;
+ }
+
+ /**
+ * Get the parent property: (Optional) The ID of the parent management group.
+ *
+ * @return the parent value.
+ */
+ public EntityParentGroupInfo parent() {
+ return this.innerProperties() == null ? null : this.innerProperties().parent();
+ }
+
+ /**
+ * Set the parent property: (Optional) The ID of the parent management group.
+ *
+ * @param parent the parent value to set.
+ * @return the EntityInfoInner object itself.
+ */
+ public EntityInfoInner withParent(EntityParentGroupInfo parent) {
+ if (this.innerProperties() == null) {
+ this.innerProperties = new EntityInfoProperties();
+ }
+ this.innerProperties().withParent(parent);
+ return this;
+ }
+
+ /**
+ * Get the permissions property: The users specific permissions to this item.
+ *
+ * @return the permissions value.
+ */
+ public Permissions permissions() {
+ return this.innerProperties() == null ? null : this.innerProperties().permissions();
+ }
+
+ /**
+ * Set the permissions property: The users specific permissions to this item.
+ *
+ * @param permissions the permissions value to set.
+ * @return the EntityInfoInner object itself.
+ */
+ public EntityInfoInner withPermissions(Permissions permissions) {
+ if (this.innerProperties() == null) {
+ this.innerProperties = new EntityInfoProperties();
+ }
+ this.innerProperties().withPermissions(permissions);
+ return this;
+ }
+
+ /**
+ * Get the inheritedPermissions property: The users specific permissions to this item.
+ *
+ * @return the inheritedPermissions value.
+ */
+ public Permissions inheritedPermissions() {
+ return this.innerProperties() == null ? null : this.innerProperties().inheritedPermissions();
+ }
+
+ /**
+ * Set the inheritedPermissions property: The users specific permissions to this item.
+ *
+ * @param inheritedPermissions the inheritedPermissions value to set.
+ * @return the EntityInfoInner object itself.
+ */
+ public EntityInfoInner withInheritedPermissions(Permissions inheritedPermissions) {
+ if (this.innerProperties() == null) {
+ this.innerProperties = new EntityInfoProperties();
+ }
+ this.innerProperties().withInheritedPermissions(inheritedPermissions);
+ return this;
+ }
+
+ /**
+ * Get the numberOfDescendants property: Number of Descendants.
+ *
+ * @return the numberOfDescendants value.
+ */
+ public Integer numberOfDescendants() {
+ return this.innerProperties() == null ? null : this.innerProperties().numberOfDescendants();
+ }
+
+ /**
+ * Set the numberOfDescendants property: Number of Descendants.
+ *
+ * @param numberOfDescendants the numberOfDescendants value to set.
+ * @return the EntityInfoInner object itself.
+ */
+ public EntityInfoInner withNumberOfDescendants(Integer numberOfDescendants) {
+ if (this.innerProperties() == null) {
+ this.innerProperties = new EntityInfoProperties();
+ }
+ this.innerProperties().withNumberOfDescendants(numberOfDescendants);
+ return this;
+ }
+
+ /**
+ * Get the numberOfChildren property: Number of Children Number of children is the number of Groups and
+ * Subscriptions that are exactly one level underneath the current Group.
+ *
+ * @return the numberOfChildren value.
+ */
+ public Integer numberOfChildren() {
+ return this.innerProperties() == null ? null : this.innerProperties().numberOfChildren();
+ }
+
+ /**
+ * Set the numberOfChildren property: Number of Children Number of children is the number of Groups and
+ * Subscriptions that are exactly one level underneath the current Group.
+ *
+ * @param numberOfChildren the numberOfChildren value to set.
+ * @return the EntityInfoInner object itself.
+ */
+ public EntityInfoInner withNumberOfChildren(Integer numberOfChildren) {
+ if (this.innerProperties() == null) {
+ this.innerProperties = new EntityInfoProperties();
+ }
+ this.innerProperties().withNumberOfChildren(numberOfChildren);
+ return this;
+ }
+
+ /**
+ * Get the numberOfChildGroups property: Number of Child Groups Number of children is the number of Groups that are
+ * exactly one level underneath the current Group.
+ *
+ * @return the numberOfChildGroups value.
+ */
+ public Integer numberOfChildGroups() {
+ return this.innerProperties() == null ? null : this.innerProperties().numberOfChildGroups();
+ }
+
+ /**
+ * Set the numberOfChildGroups property: Number of Child Groups Number of children is the number of Groups that are
+ * exactly one level underneath the current Group.
+ *
+ * @param numberOfChildGroups the numberOfChildGroups value to set.
+ * @return the EntityInfoInner object itself.
+ */
+ public EntityInfoInner withNumberOfChildGroups(Integer numberOfChildGroups) {
+ if (this.innerProperties() == null) {
+ this.innerProperties = new EntityInfoProperties();
+ }
+ this.innerProperties().withNumberOfChildGroups(numberOfChildGroups);
+ return this;
+ }
+
+ /**
+ * Get the parentDisplayNameChain property: The parent display name chain from the root group to the immediate
+ * parent.
+ *
+ * @return the parentDisplayNameChain value.
+ */
+ public List parentDisplayNameChain() {
+ return this.innerProperties() == null ? null : this.innerProperties().parentDisplayNameChain();
+ }
+
+ /**
+ * Set the parentDisplayNameChain property: The parent display name chain from the root group to the immediate
+ * parent.
+ *
+ * @param parentDisplayNameChain the parentDisplayNameChain value to set.
+ * @return the EntityInfoInner object itself.
+ */
+ public EntityInfoInner withParentDisplayNameChain(List parentDisplayNameChain) {
+ if (this.innerProperties() == null) {
+ this.innerProperties = new EntityInfoProperties();
+ }
+ this.innerProperties().withParentDisplayNameChain(parentDisplayNameChain);
+ return this;
+ }
+
+ /**
+ * Get the parentNameChain property: The parent name chain from the root group to the immediate parent.
+ *
+ * @return the parentNameChain value.
+ */
+ public List parentNameChain() {
+ return this.innerProperties() == null ? null : this.innerProperties().parentNameChain();
+ }
+
+ /**
+ * Set the parentNameChain property: The parent name chain from the root group to the immediate parent.
+ *
+ * @param parentNameChain the parentNameChain value to set.
+ * @return the EntityInfoInner object itself.
+ */
+ public EntityInfoInner withParentNameChain(List parentNameChain) {
+ if (this.innerProperties() == null) {
+ this.innerProperties = new EntityInfoProperties();
+ }
+ this.innerProperties().withParentNameChain(parentNameChain);
+ return this;
+ }
+
+ /**
+ * Validates the instance.
+ *
+ * @throws IllegalArgumentException thrown if the instance is not valid.
+ */
+ public void validate() {
+ if (innerProperties() != null) {
+ innerProperties().validate();
+ }
+ }
+}
diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/EntityInfoProperties.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/EntityInfoProperties.java
new file mode 100644
index 000000000000..0fccc1d0fc7f
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/EntityInfoProperties.java
@@ -0,0 +1,298 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.managementgroups.fluent.models;
+
+import com.azure.core.annotation.Fluent;
+import com.azure.resourcemanager.managementgroups.models.EntityParentGroupInfo;
+import com.azure.resourcemanager.managementgroups.models.Permissions;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.util.List;
+
+/** The generic properties of an entity. */
+@Fluent
+public final class EntityInfoProperties {
+ /*
+ * The AAD Tenant ID associated with the entity. For example,
+ * 00000000-0000-0000-0000-000000000000
+ */
+ @JsonProperty(value = "tenantId")
+ private String tenantId;
+
+ /*
+ * The friendly name of the management group.
+ */
+ @JsonProperty(value = "displayName")
+ private String displayName;
+
+ /*
+ * (Optional) The ID of the parent management group.
+ */
+ @JsonProperty(value = "parent")
+ private EntityParentGroupInfo parent;
+
+ /*
+ * The users specific permissions to this item.
+ */
+ @JsonProperty(value = "permissions")
+ private Permissions permissions;
+
+ /*
+ * The users specific permissions to this item.
+ */
+ @JsonProperty(value = "inheritedPermissions")
+ private Permissions inheritedPermissions;
+
+ /*
+ * Number of Descendants
+ */
+ @JsonProperty(value = "numberOfDescendants")
+ private Integer numberOfDescendants;
+
+ /*
+ * Number of Children Number of children is the number of Groups and
+ * Subscriptions that are exactly one level underneath the current Group.
+ */
+ @JsonProperty(value = "numberOfChildren")
+ private Integer numberOfChildren;
+
+ /*
+ * Number of Child Groups Number of children is the number of Groups that
+ * are exactly one level underneath the current Group.
+ */
+ @JsonProperty(value = "numberOfChildGroups")
+ private Integer numberOfChildGroups;
+
+ /*
+ * The parent display name chain from the root group to the immediate
+ * parent
+ */
+ @JsonProperty(value = "parentDisplayNameChain")
+ private List parentDisplayNameChain;
+
+ /*
+ * The parent name chain from the root group to the immediate parent
+ */
+ @JsonProperty(value = "parentNameChain")
+ private List parentNameChain;
+
+ /**
+ * Get the tenantId property: The AAD Tenant ID associated with the entity. For example,
+ * 00000000-0000-0000-0000-000000000000.
+ *
+ * @return the tenantId value.
+ */
+ public String tenantId() {
+ return this.tenantId;
+ }
+
+ /**
+ * Set the tenantId property: The AAD Tenant ID associated with the entity. For example,
+ * 00000000-0000-0000-0000-000000000000.
+ *
+ * @param tenantId the tenantId value to set.
+ * @return the EntityInfoProperties object itself.
+ */
+ public EntityInfoProperties withTenantId(String tenantId) {
+ this.tenantId = tenantId;
+ return this;
+ }
+
+ /**
+ * Get the displayName property: The friendly name of the management group.
+ *
+ * @return the displayName value.
+ */
+ public String displayName() {
+ return this.displayName;
+ }
+
+ /**
+ * Set the displayName property: The friendly name of the management group.
+ *
+ * @param displayName the displayName value to set.
+ * @return the EntityInfoProperties object itself.
+ */
+ public EntityInfoProperties withDisplayName(String displayName) {
+ this.displayName = displayName;
+ return this;
+ }
+
+ /**
+ * Get the parent property: (Optional) The ID of the parent management group.
+ *
+ * @return the parent value.
+ */
+ public EntityParentGroupInfo parent() {
+ return this.parent;
+ }
+
+ /**
+ * Set the parent property: (Optional) The ID of the parent management group.
+ *
+ * @param parent the parent value to set.
+ * @return the EntityInfoProperties object itself.
+ */
+ public EntityInfoProperties withParent(EntityParentGroupInfo parent) {
+ this.parent = parent;
+ return this;
+ }
+
+ /**
+ * Get the permissions property: The users specific permissions to this item.
+ *
+ * @return the permissions value.
+ */
+ public Permissions permissions() {
+ return this.permissions;
+ }
+
+ /**
+ * Set the permissions property: The users specific permissions to this item.
+ *
+ * @param permissions the permissions value to set.
+ * @return the EntityInfoProperties object itself.
+ */
+ public EntityInfoProperties withPermissions(Permissions permissions) {
+ this.permissions = permissions;
+ return this;
+ }
+
+ /**
+ * Get the inheritedPermissions property: The users specific permissions to this item.
+ *
+ * @return the inheritedPermissions value.
+ */
+ public Permissions inheritedPermissions() {
+ return this.inheritedPermissions;
+ }
+
+ /**
+ * Set the inheritedPermissions property: The users specific permissions to this item.
+ *
+ * @param inheritedPermissions the inheritedPermissions value to set.
+ * @return the EntityInfoProperties object itself.
+ */
+ public EntityInfoProperties withInheritedPermissions(Permissions inheritedPermissions) {
+ this.inheritedPermissions = inheritedPermissions;
+ return this;
+ }
+
+ /**
+ * Get the numberOfDescendants property: Number of Descendants.
+ *
+ * @return the numberOfDescendants value.
+ */
+ public Integer numberOfDescendants() {
+ return this.numberOfDescendants;
+ }
+
+ /**
+ * Set the numberOfDescendants property: Number of Descendants.
+ *
+ * @param numberOfDescendants the numberOfDescendants value to set.
+ * @return the EntityInfoProperties object itself.
+ */
+ public EntityInfoProperties withNumberOfDescendants(Integer numberOfDescendants) {
+ this.numberOfDescendants = numberOfDescendants;
+ return this;
+ }
+
+ /**
+ * Get the numberOfChildren property: Number of Children Number of children is the number of Groups and
+ * Subscriptions that are exactly one level underneath the current Group.
+ *
+ * @return the numberOfChildren value.
+ */
+ public Integer numberOfChildren() {
+ return this.numberOfChildren;
+ }
+
+ /**
+ * Set the numberOfChildren property: Number of Children Number of children is the number of Groups and
+ * Subscriptions that are exactly one level underneath the current Group.
+ *
+ * @param numberOfChildren the numberOfChildren value to set.
+ * @return the EntityInfoProperties object itself.
+ */
+ public EntityInfoProperties withNumberOfChildren(Integer numberOfChildren) {
+ this.numberOfChildren = numberOfChildren;
+ return this;
+ }
+
+ /**
+ * Get the numberOfChildGroups property: Number of Child Groups Number of children is the number of Groups that are
+ * exactly one level underneath the current Group.
+ *
+ * @return the numberOfChildGroups value.
+ */
+ public Integer numberOfChildGroups() {
+ return this.numberOfChildGroups;
+ }
+
+ /**
+ * Set the numberOfChildGroups property: Number of Child Groups Number of children is the number of Groups that are
+ * exactly one level underneath the current Group.
+ *
+ * @param numberOfChildGroups the numberOfChildGroups value to set.
+ * @return the EntityInfoProperties object itself.
+ */
+ public EntityInfoProperties withNumberOfChildGroups(Integer numberOfChildGroups) {
+ this.numberOfChildGroups = numberOfChildGroups;
+ return this;
+ }
+
+ /**
+ * Get the parentDisplayNameChain property: The parent display name chain from the root group to the immediate
+ * parent.
+ *
+ * @return the parentDisplayNameChain value.
+ */
+ public List parentDisplayNameChain() {
+ return this.parentDisplayNameChain;
+ }
+
+ /**
+ * Set the parentDisplayNameChain property: The parent display name chain from the root group to the immediate
+ * parent.
+ *
+ * @param parentDisplayNameChain the parentDisplayNameChain value to set.
+ * @return the EntityInfoProperties object itself.
+ */
+ public EntityInfoProperties withParentDisplayNameChain(List parentDisplayNameChain) {
+ this.parentDisplayNameChain = parentDisplayNameChain;
+ return this;
+ }
+
+ /**
+ * Get the parentNameChain property: The parent name chain from the root group to the immediate parent.
+ *
+ * @return the parentNameChain value.
+ */
+ public List parentNameChain() {
+ return this.parentNameChain;
+ }
+
+ /**
+ * Set the parentNameChain property: The parent name chain from the root group to the immediate parent.
+ *
+ * @param parentNameChain the parentNameChain value to set.
+ * @return the EntityInfoProperties object itself.
+ */
+ public EntityInfoProperties withParentNameChain(List parentNameChain) {
+ this.parentNameChain = parentNameChain;
+ return this;
+ }
+
+ /**
+ * Validates the instance.
+ *
+ * @throws IllegalArgumentException thrown if the instance is not valid.
+ */
+ public void validate() {
+ if (parent() != null) {
+ parent().validate();
+ }
+ }
+}
diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/HierarchySettingsInner.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/HierarchySettingsInner.java
new file mode 100644
index 000000000000..09985eebb10a
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/HierarchySettingsInner.java
@@ -0,0 +1,123 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.managementgroups.fluent.models;
+
+import com.azure.core.annotation.Fluent;
+import com.azure.core.management.ProxyResource;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/** Settings defined at the Management Group scope. */
+@Fluent
+public final class HierarchySettingsInner extends ProxyResource {
+ /*
+ * The generic properties of hierarchy settings.
+ */
+ @JsonProperty(value = "properties")
+ private HierarchySettingsProperties innerProperties;
+
+ /**
+ * Get the innerProperties property: The generic properties of hierarchy settings.
+ *
+ * @return the innerProperties value.
+ */
+ private HierarchySettingsProperties innerProperties() {
+ return this.innerProperties;
+ }
+
+ /**
+ * Get the tenantId property: The AAD Tenant ID associated with the hierarchy settings. For example,
+ * 00000000-0000-0000-0000-000000000000.
+ *
+ * @return the tenantId value.
+ */
+ public String tenantId() {
+ return this.innerProperties() == null ? null : this.innerProperties().tenantId();
+ }
+
+ /**
+ * Set the tenantId property: The AAD Tenant ID associated with the hierarchy settings. For example,
+ * 00000000-0000-0000-0000-000000000000.
+ *
+ * @param tenantId the tenantId value to set.
+ * @return the HierarchySettingsInner object itself.
+ */
+ public HierarchySettingsInner withTenantId(String tenantId) {
+ if (this.innerProperties() == null) {
+ this.innerProperties = new HierarchySettingsProperties();
+ }
+ this.innerProperties().withTenantId(tenantId);
+ return this;
+ }
+
+ /**
+ * Get the requireAuthorizationForGroupCreation property: Indicates whether RBAC access is required upon group
+ * creation under the root Management Group. If set to true, user will require
+ * Microsoft.Management/managementGroups/write action on the root Management Group scope in order to create new
+ * Groups directly under the root. This will prevent new users from creating new Management Groups, unless they are
+ * given access.
+ *
+ * @return the requireAuthorizationForGroupCreation value.
+ */
+ public Boolean requireAuthorizationForGroupCreation() {
+ return this.innerProperties() == null ? null : this.innerProperties().requireAuthorizationForGroupCreation();
+ }
+
+ /**
+ * Set the requireAuthorizationForGroupCreation property: Indicates whether RBAC access is required upon group
+ * creation under the root Management Group. If set to true, user will require
+ * Microsoft.Management/managementGroups/write action on the root Management Group scope in order to create new
+ * Groups directly under the root. This will prevent new users from creating new Management Groups, unless they are
+ * given access.
+ *
+ * @param requireAuthorizationForGroupCreation the requireAuthorizationForGroupCreation value to set.
+ * @return the HierarchySettingsInner object itself.
+ */
+ public HierarchySettingsInner withRequireAuthorizationForGroupCreation(
+ Boolean requireAuthorizationForGroupCreation) {
+ if (this.innerProperties() == null) {
+ this.innerProperties = new HierarchySettingsProperties();
+ }
+ this.innerProperties().withRequireAuthorizationForGroupCreation(requireAuthorizationForGroupCreation);
+ return this;
+ }
+
+ /**
+ * Get the defaultManagementGroup property: Settings that sets the default Management Group under which new
+ * subscriptions get added in this tenant. For example,
+ * /providers/Microsoft.Management/managementGroups/defaultGroup.
+ *
+ * @return the defaultManagementGroup value.
+ */
+ public String defaultManagementGroup() {
+ return this.innerProperties() == null ? null : this.innerProperties().defaultManagementGroup();
+ }
+
+ /**
+ * Set the defaultManagementGroup property: Settings that sets the default Management Group under which new
+ * subscriptions get added in this tenant. For example,
+ * /providers/Microsoft.Management/managementGroups/defaultGroup.
+ *
+ * @param defaultManagementGroup the defaultManagementGroup value to set.
+ * @return the HierarchySettingsInner object itself.
+ */
+ public HierarchySettingsInner withDefaultManagementGroup(String defaultManagementGroup) {
+ if (this.innerProperties() == null) {
+ this.innerProperties = new HierarchySettingsProperties();
+ }
+ this.innerProperties().withDefaultManagementGroup(defaultManagementGroup);
+ return this;
+ }
+
+ /**
+ * Validates the instance.
+ *
+ * @throws IllegalArgumentException thrown if the instance is not valid.
+ */
+ public void validate() {
+ if (innerProperties() != null) {
+ innerProperties().validate();
+ }
+ }
+}
diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/HierarchySettingsListInner.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/HierarchySettingsListInner.java
new file mode 100644
index 000000000000..05b5a3b46075
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/HierarchySettingsListInner.java
@@ -0,0 +1,66 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.managementgroups.fluent.models;
+
+import com.azure.core.annotation.Fluent;
+import com.azure.resourcemanager.managementgroups.models.HierarchySettingsInfo;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.util.List;
+
+/** Lists all hierarchy settings. */
+@Fluent
+public final class HierarchySettingsListInner {
+ /*
+ * The list of hierarchy settings.
+ */
+ @JsonProperty(value = "value")
+ private List value;
+
+ /*
+ * The URL to use for getting the next set of results.
+ */
+ @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY)
+ private String nextLink;
+
+ /**
+ * Get the value property: The list of hierarchy settings.
+ *
+ * @return the value value.
+ */
+ public List value() {
+ return this.value;
+ }
+
+ /**
+ * Set the value property: The list of hierarchy settings.
+ *
+ * @param value the value value to set.
+ * @return the HierarchySettingsListInner object itself.
+ */
+ public HierarchySettingsListInner withValue(List value) {
+ this.value = value;
+ return this;
+ }
+
+ /**
+ * Get the nextLink property: The URL to use for getting the next set of results.
+ *
+ * @return the nextLink value.
+ */
+ public String nextLink() {
+ return this.nextLink;
+ }
+
+ /**
+ * Validates the instance.
+ *
+ * @throws IllegalArgumentException thrown if the instance is not valid.
+ */
+ public void validate() {
+ if (value() != null) {
+ value().forEach(e -> e.validate());
+ }
+ }
+}
diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/HierarchySettingsProperties.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/HierarchySettingsProperties.java
new file mode 100644
index 000000000000..bb25bc75cd6c
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/HierarchySettingsProperties.java
@@ -0,0 +1,121 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.managementgroups.fluent.models;
+
+import com.azure.core.annotation.Fluent;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/** The generic properties of hierarchy settings. */
+@Fluent
+public final class HierarchySettingsProperties {
+ /*
+ * The AAD Tenant ID associated with the hierarchy settings. For example,
+ * 00000000-0000-0000-0000-000000000000
+ */
+ @JsonProperty(value = "tenantId")
+ private String tenantId;
+
+ /*
+ * Indicates whether RBAC access is required upon group creation under the
+ * root Management Group. If set to true, user will require
+ * Microsoft.Management/managementGroups/write action on the root
+ * Management Group scope in order to create new Groups directly under the
+ * root. This will prevent new users from creating new Management Groups,
+ * unless they are given access.
+ */
+ @JsonProperty(value = "requireAuthorizationForGroupCreation")
+ private Boolean requireAuthorizationForGroupCreation;
+
+ /*
+ * Settings that sets the default Management Group under which new
+ * subscriptions get added in this tenant. For example,
+ * /providers/Microsoft.Management/managementGroups/defaultGroup
+ */
+ @JsonProperty(value = "defaultManagementGroup")
+ private String defaultManagementGroup;
+
+ /**
+ * Get the tenantId property: The AAD Tenant ID associated with the hierarchy settings. For example,
+ * 00000000-0000-0000-0000-000000000000.
+ *
+ * @return the tenantId value.
+ */
+ public String tenantId() {
+ return this.tenantId;
+ }
+
+ /**
+ * Set the tenantId property: The AAD Tenant ID associated with the hierarchy settings. For example,
+ * 00000000-0000-0000-0000-000000000000.
+ *
+ * @param tenantId the tenantId value to set.
+ * @return the HierarchySettingsProperties object itself.
+ */
+ public HierarchySettingsProperties withTenantId(String tenantId) {
+ this.tenantId = tenantId;
+ return this;
+ }
+
+ /**
+ * Get the requireAuthorizationForGroupCreation property: Indicates whether RBAC access is required upon group
+ * creation under the root Management Group. If set to true, user will require
+ * Microsoft.Management/managementGroups/write action on the root Management Group scope in order to create new
+ * Groups directly under the root. This will prevent new users from creating new Management Groups, unless they are
+ * given access.
+ *
+ * @return the requireAuthorizationForGroupCreation value.
+ */
+ public Boolean requireAuthorizationForGroupCreation() {
+ return this.requireAuthorizationForGroupCreation;
+ }
+
+ /**
+ * Set the requireAuthorizationForGroupCreation property: Indicates whether RBAC access is required upon group
+ * creation under the root Management Group. If set to true, user will require
+ * Microsoft.Management/managementGroups/write action on the root Management Group scope in order to create new
+ * Groups directly under the root. This will prevent new users from creating new Management Groups, unless they are
+ * given access.
+ *
+ * @param requireAuthorizationForGroupCreation the requireAuthorizationForGroupCreation value to set.
+ * @return the HierarchySettingsProperties object itself.
+ */
+ public HierarchySettingsProperties withRequireAuthorizationForGroupCreation(
+ Boolean requireAuthorizationForGroupCreation) {
+ this.requireAuthorizationForGroupCreation = requireAuthorizationForGroupCreation;
+ return this;
+ }
+
+ /**
+ * Get the defaultManagementGroup property: Settings that sets the default Management Group under which new
+ * subscriptions get added in this tenant. For example,
+ * /providers/Microsoft.Management/managementGroups/defaultGroup.
+ *
+ * @return the defaultManagementGroup value.
+ */
+ public String defaultManagementGroup() {
+ return this.defaultManagementGroup;
+ }
+
+ /**
+ * Set the defaultManagementGroup property: Settings that sets the default Management Group under which new
+ * subscriptions get added in this tenant. For example,
+ * /providers/Microsoft.Management/managementGroups/defaultGroup.
+ *
+ * @param defaultManagementGroup the defaultManagementGroup value to set.
+ * @return the HierarchySettingsProperties object itself.
+ */
+ public HierarchySettingsProperties withDefaultManagementGroup(String defaultManagementGroup) {
+ this.defaultManagementGroup = defaultManagementGroup;
+ return this;
+ }
+
+ /**
+ * Validates the instance.
+ *
+ * @throws IllegalArgumentException thrown if the instance is not valid.
+ */
+ public void validate() {
+ }
+}
diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/ManagementGroupInfoInner.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/ManagementGroupInfoInner.java
new file mode 100644
index 000000000000..6f6c55a95e62
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/ManagementGroupInfoInner.java
@@ -0,0 +1,135 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.managementgroups.fluent.models;
+
+import com.azure.core.annotation.Fluent;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/** The management group resource. */
+@Fluent
+public final class ManagementGroupInfoInner {
+ /*
+ * The fully qualified ID for the management group. For example,
+ * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000
+ */
+ @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY)
+ private String id;
+
+ /*
+ * The type of the resource. For example,
+ * Microsoft.Management/managementGroups
+ */
+ @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY)
+ private String type;
+
+ /*
+ * The name of the management group. For example,
+ * 00000000-0000-0000-0000-000000000000
+ */
+ @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY)
+ private String name;
+
+ /*
+ * The generic properties of a management group.
+ */
+ @JsonProperty(value = "properties")
+ private ManagementGroupInfoProperties innerProperties;
+
+ /**
+ * Get the id property: The fully qualified ID for the management group. For example,
+ * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000.
+ *
+ * @return the id value.
+ */
+ public String id() {
+ return this.id;
+ }
+
+ /**
+ * Get the type property: The type of the resource. For example, Microsoft.Management/managementGroups.
+ *
+ * @return the type value.
+ */
+ public String type() {
+ return this.type;
+ }
+
+ /**
+ * Get the name property: The name of the management group. For example, 00000000-0000-0000-0000-000000000000.
+ *
+ * @return the name value.
+ */
+ public String name() {
+ return this.name;
+ }
+
+ /**
+ * Get the innerProperties property: The generic properties of a management group.
+ *
+ * @return the innerProperties value.
+ */
+ private ManagementGroupInfoProperties innerProperties() {
+ return this.innerProperties;
+ }
+
+ /**
+ * Get the tenantId property: The AAD Tenant ID associated with the management group. For example,
+ * 00000000-0000-0000-0000-000000000000.
+ *
+ * @return the tenantId value.
+ */
+ public String tenantId() {
+ return this.innerProperties() == null ? null : this.innerProperties().tenantId();
+ }
+
+ /**
+ * Set the tenantId property: The AAD Tenant ID associated with the management group. For example,
+ * 00000000-0000-0000-0000-000000000000.
+ *
+ * @param tenantId the tenantId value to set.
+ * @return the ManagementGroupInfoInner object itself.
+ */
+ public ManagementGroupInfoInner withTenantId(String tenantId) {
+ if (this.innerProperties() == null) {
+ this.innerProperties = new ManagementGroupInfoProperties();
+ }
+ this.innerProperties().withTenantId(tenantId);
+ return this;
+ }
+
+ /**
+ * Get the displayName property: The friendly name of the management group.
+ *
+ * @return the displayName value.
+ */
+ public String displayName() {
+ return this.innerProperties() == null ? null : this.innerProperties().displayName();
+ }
+
+ /**
+ * Set the displayName property: The friendly name of the management group.
+ *
+ * @param displayName the displayName value to set.
+ * @return the ManagementGroupInfoInner object itself.
+ */
+ public ManagementGroupInfoInner withDisplayName(String displayName) {
+ if (this.innerProperties() == null) {
+ this.innerProperties = new ManagementGroupInfoProperties();
+ }
+ this.innerProperties().withDisplayName(displayName);
+ return this;
+ }
+
+ /**
+ * Validates the instance.
+ *
+ * @throws IllegalArgumentException thrown if the instance is not valid.
+ */
+ public void validate() {
+ if (innerProperties() != null) {
+ innerProperties().validate();
+ }
+ }
+}
diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/ManagementGroupInfoProperties.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/ManagementGroupInfoProperties.java
new file mode 100644
index 000000000000..102f1665d16a
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/ManagementGroupInfoProperties.java
@@ -0,0 +1,75 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.managementgroups.fluent.models;
+
+import com.azure.core.annotation.Fluent;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/** The generic properties of a management group. */
+@Fluent
+public final class ManagementGroupInfoProperties {
+ /*
+ * The AAD Tenant ID associated with the management group. For example,
+ * 00000000-0000-0000-0000-000000000000
+ */
+ @JsonProperty(value = "tenantId")
+ private String tenantId;
+
+ /*
+ * The friendly name of the management group.
+ */
+ @JsonProperty(value = "displayName")
+ private String displayName;
+
+ /**
+ * Get the tenantId property: The AAD Tenant ID associated with the management group. For example,
+ * 00000000-0000-0000-0000-000000000000.
+ *
+ * @return the tenantId value.
+ */
+ public String tenantId() {
+ return this.tenantId;
+ }
+
+ /**
+ * Set the tenantId property: The AAD Tenant ID associated with the management group. For example,
+ * 00000000-0000-0000-0000-000000000000.
+ *
+ * @param tenantId the tenantId value to set.
+ * @return the ManagementGroupInfoProperties object itself.
+ */
+ public ManagementGroupInfoProperties withTenantId(String tenantId) {
+ this.tenantId = tenantId;
+ return this;
+ }
+
+ /**
+ * Get the displayName property: The friendly name of the management group.
+ *
+ * @return the displayName value.
+ */
+ public String displayName() {
+ return this.displayName;
+ }
+
+ /**
+ * Set the displayName property: The friendly name of the management group.
+ *
+ * @param displayName the displayName value to set.
+ * @return the ManagementGroupInfoProperties object itself.
+ */
+ public ManagementGroupInfoProperties withDisplayName(String displayName) {
+ this.displayName = displayName;
+ return this;
+ }
+
+ /**
+ * Validates the instance.
+ *
+ * @throws IllegalArgumentException thrown if the instance is not valid.
+ */
+ public void validate() {
+ }
+}
diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/ManagementGroupInner.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/ManagementGroupInner.java
new file mode 100644
index 000000000000..18157e44a68e
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/ManagementGroupInner.java
@@ -0,0 +1,136 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.managementgroups.fluent.models;
+
+import com.azure.core.annotation.Fluent;
+import com.azure.core.management.ProxyResource;
+import com.azure.resourcemanager.managementgroups.models.ManagementGroupChildInfo;
+import com.azure.resourcemanager.managementgroups.models.ManagementGroupDetails;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.util.List;
+
+/** The management group details. */
+@Fluent
+public final class ManagementGroupInner extends ProxyResource {
+ /*
+ * The generic properties of a management group.
+ */
+ @JsonProperty(value = "properties")
+ private ManagementGroupProperties innerProperties;
+
+ /**
+ * Get the innerProperties property: The generic properties of a management group.
+ *
+ * @return the innerProperties value.
+ */
+ private ManagementGroupProperties innerProperties() {
+ return this.innerProperties;
+ }
+
+ /**
+ * Get the tenantId property: The AAD Tenant ID associated with the management group. For example,
+ * 00000000-0000-0000-0000-000000000000.
+ *
+ * @return the tenantId value.
+ */
+ public String tenantId() {
+ return this.innerProperties() == null ? null : this.innerProperties().tenantId();
+ }
+
+ /**
+ * Set the tenantId property: The AAD Tenant ID associated with the management group. For example,
+ * 00000000-0000-0000-0000-000000000000.
+ *
+ * @param tenantId the tenantId value to set.
+ * @return the ManagementGroupInner object itself.
+ */
+ public ManagementGroupInner withTenantId(String tenantId) {
+ if (this.innerProperties() == null) {
+ this.innerProperties = new ManagementGroupProperties();
+ }
+ this.innerProperties().withTenantId(tenantId);
+ return this;
+ }
+
+ /**
+ * Get the displayName property: The friendly name of the management group.
+ *
+ * @return the displayName value.
+ */
+ public String displayName() {
+ return this.innerProperties() == null ? null : this.innerProperties().displayName();
+ }
+
+ /**
+ * Set the displayName property: The friendly name of the management group.
+ *
+ * @param displayName the displayName value to set.
+ * @return the ManagementGroupInner object itself.
+ */
+ public ManagementGroupInner withDisplayName(String displayName) {
+ if (this.innerProperties() == null) {
+ this.innerProperties = new ManagementGroupProperties();
+ }
+ this.innerProperties().withDisplayName(displayName);
+ return this;
+ }
+
+ /**
+ * Get the details property: The details of a management group.
+ *
+ * @return the details value.
+ */
+ public ManagementGroupDetails details() {
+ return this.innerProperties() == null ? null : this.innerProperties().details();
+ }
+
+ /**
+ * Set the details property: The details of a management group.
+ *
+ * @param details the details value to set.
+ * @return the ManagementGroupInner object itself.
+ */
+ public ManagementGroupInner withDetails(ManagementGroupDetails details) {
+ if (this.innerProperties() == null) {
+ this.innerProperties = new ManagementGroupProperties();
+ }
+ this.innerProperties().withDetails(details);
+ return this;
+ }
+
+ /**
+ * Get the children property: The list of children.
+ *
+ * @return the children value.
+ */
+ public List children() {
+ return this.innerProperties() == null ? null : this.innerProperties().children();
+ }
+
+ /**
+ * Set the children property: The list of children.
+ *
+ * @param children the children value to set.
+ * @return the ManagementGroupInner object itself.
+ */
+ public ManagementGroupInner withChildren(List children) {
+ if (this.innerProperties() == null) {
+ this.innerProperties = new ManagementGroupProperties();
+ }
+ this.innerProperties().withChildren(children);
+ return this;
+ }
+
+ /**
+ * Validates the instance.
+ *
+ * @throws IllegalArgumentException thrown if the instance is not valid.
+ */
+ public void validate() {
+ if (innerProperties() != null) {
+ innerProperties().validate();
+ }
+ }
+}
diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/ManagementGroupProperties.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/ManagementGroupProperties.java
new file mode 100644
index 000000000000..1c9a4dbd3f4b
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/ManagementGroupProperties.java
@@ -0,0 +1,136 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.managementgroups.fluent.models;
+
+import com.azure.core.annotation.Fluent;
+import com.azure.resourcemanager.managementgroups.models.ManagementGroupChildInfo;
+import com.azure.resourcemanager.managementgroups.models.ManagementGroupDetails;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.util.List;
+
+/** The generic properties of a management group. */
+@Fluent
+public final class ManagementGroupProperties {
+ /*
+ * The AAD Tenant ID associated with the management group. For example,
+ * 00000000-0000-0000-0000-000000000000
+ */
+ @JsonProperty(value = "tenantId")
+ private String tenantId;
+
+ /*
+ * The friendly name of the management group.
+ */
+ @JsonProperty(value = "displayName")
+ private String displayName;
+
+ /*
+ * The details of a management group.
+ */
+ @JsonProperty(value = "details")
+ private ManagementGroupDetails details;
+
+ /*
+ * The list of children.
+ */
+ @JsonProperty(value = "children")
+ private List children;
+
+ /**
+ * Get the tenantId property: The AAD Tenant ID associated with the management group. For example,
+ * 00000000-0000-0000-0000-000000000000.
+ *
+ * @return the tenantId value.
+ */
+ public String tenantId() {
+ return this.tenantId;
+ }
+
+ /**
+ * Set the tenantId property: The AAD Tenant ID associated with the management group. For example,
+ * 00000000-0000-0000-0000-000000000000.
+ *
+ * @param tenantId the tenantId value to set.
+ * @return the ManagementGroupProperties object itself.
+ */
+ public ManagementGroupProperties withTenantId(String tenantId) {
+ this.tenantId = tenantId;
+ return this;
+ }
+
+ /**
+ * Get the displayName property: The friendly name of the management group.
+ *
+ * @return the displayName value.
+ */
+ public String displayName() {
+ return this.displayName;
+ }
+
+ /**
+ * Set the displayName property: The friendly name of the management group.
+ *
+ * @param displayName the displayName value to set.
+ * @return the ManagementGroupProperties object itself.
+ */
+ public ManagementGroupProperties withDisplayName(String displayName) {
+ this.displayName = displayName;
+ return this;
+ }
+
+ /**
+ * Get the details property: The details of a management group.
+ *
+ * @return the details value.
+ */
+ public ManagementGroupDetails details() {
+ return this.details;
+ }
+
+ /**
+ * Set the details property: The details of a management group.
+ *
+ * @param details the details value to set.
+ * @return the ManagementGroupProperties object itself.
+ */
+ public ManagementGroupProperties withDetails(ManagementGroupDetails details) {
+ this.details = details;
+ return this;
+ }
+
+ /**
+ * Get the children property: The list of children.
+ *
+ * @return the children value.
+ */
+ public List children() {
+ return this.children;
+ }
+
+ /**
+ * Set the children property: The list of children.
+ *
+ * @param children the children value to set.
+ * @return the ManagementGroupProperties object itself.
+ */
+ public ManagementGroupProperties withChildren(List children) {
+ this.children = children;
+ return this;
+ }
+
+ /**
+ * Validates the instance.
+ *
+ * @throws IllegalArgumentException thrown if the instance is not valid.
+ */
+ public void validate() {
+ if (details() != null) {
+ details().validate();
+ }
+ if (children() != null) {
+ children().forEach(e -> e.validate());
+ }
+ }
+}
diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/OperationInner.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/OperationInner.java
new file mode 100644
index 000000000000..e0b6f07d254f
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/OperationInner.java
@@ -0,0 +1,65 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.managementgroups.fluent.models;
+
+import com.azure.core.annotation.Fluent;
+import com.azure.resourcemanager.managementgroups.models.OperationDisplayProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/** Operation supported by the Microsoft.Management resource provider. */
+@Fluent
+public final class OperationInner {
+ /*
+ * Operation name: {provider}/{resource}/{operation}.
+ */
+ @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY)
+ private String name;
+
+ /*
+ * The object that represents the operation.
+ */
+ @JsonProperty(value = "display")
+ private OperationDisplayProperties display;
+
+ /**
+ * Get the name property: Operation name: {provider}/{resource}/{operation}.
+ *
+ * @return the name value.
+ */
+ public String name() {
+ return this.name;
+ }
+
+ /**
+ * Get the display property: The object that represents the operation.
+ *
+ * @return the display value.
+ */
+ public OperationDisplayProperties display() {
+ return this.display;
+ }
+
+ /**
+ * Set the display property: The object that represents the operation.
+ *
+ * @param display the display value to set.
+ * @return the OperationInner object itself.
+ */
+ public OperationInner withDisplay(OperationDisplayProperties display) {
+ this.display = display;
+ return this;
+ }
+
+ /**
+ * Validates the instance.
+ *
+ * @throws IllegalArgumentException thrown if the instance is not valid.
+ */
+ public void validate() {
+ if (display() != null) {
+ display().validate();
+ }
+ }
+}
diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/SubscriptionUnderManagementGroupInner.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/SubscriptionUnderManagementGroupInner.java
new file mode 100644
index 000000000000..936476608929
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/SubscriptionUnderManagementGroupInner.java
@@ -0,0 +1,134 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.managementgroups.fluent.models;
+
+import com.azure.core.annotation.Fluent;
+import com.azure.core.management.ProxyResource;
+import com.azure.resourcemanager.managementgroups.models.DescendantParentGroupInfo;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/** The details of subscription under management group. */
+@Fluent
+public final class SubscriptionUnderManagementGroupInner extends ProxyResource {
+ /*
+ * The generic properties of subscription under a management group.
+ */
+ @JsonProperty(value = "properties")
+ private SubscriptionUnderManagementGroupProperties innerProperties;
+
+ /**
+ * Get the innerProperties property: The generic properties of subscription under a management group.
+ *
+ * @return the innerProperties value.
+ */
+ private SubscriptionUnderManagementGroupProperties innerProperties() {
+ return this.innerProperties;
+ }
+
+ /**
+ * Get the tenant property: The AAD Tenant ID associated with the subscription. For example,
+ * 00000000-0000-0000-0000-000000000000.
+ *
+ * @return the tenant value.
+ */
+ public String tenant() {
+ return this.innerProperties() == null ? null : this.innerProperties().tenant();
+ }
+
+ /**
+ * Set the tenant property: The AAD Tenant ID associated with the subscription. For example,
+ * 00000000-0000-0000-0000-000000000000.
+ *
+ * @param tenant the tenant value to set.
+ * @return the SubscriptionUnderManagementGroupInner object itself.
+ */
+ public SubscriptionUnderManagementGroupInner withTenant(String tenant) {
+ if (this.innerProperties() == null) {
+ this.innerProperties = new SubscriptionUnderManagementGroupProperties();
+ }
+ this.innerProperties().withTenant(tenant);
+ return this;
+ }
+
+ /**
+ * Get the displayName property: The friendly name of the subscription.
+ *
+ * @return the displayName value.
+ */
+ public String displayName() {
+ return this.innerProperties() == null ? null : this.innerProperties().displayName();
+ }
+
+ /**
+ * Set the displayName property: The friendly name of the subscription.
+ *
+ * @param displayName the displayName value to set.
+ * @return the SubscriptionUnderManagementGroupInner object itself.
+ */
+ public SubscriptionUnderManagementGroupInner withDisplayName(String displayName) {
+ if (this.innerProperties() == null) {
+ this.innerProperties = new SubscriptionUnderManagementGroupProperties();
+ }
+ this.innerProperties().withDisplayName(displayName);
+ return this;
+ }
+
+ /**
+ * Get the parent property: The ID of the parent management group.
+ *
+ * @return the parent value.
+ */
+ public DescendantParentGroupInfo parent() {
+ return this.innerProperties() == null ? null : this.innerProperties().parent();
+ }
+
+ /**
+ * Set the parent property: The ID of the parent management group.
+ *
+ * @param parent the parent value to set.
+ * @return the SubscriptionUnderManagementGroupInner object itself.
+ */
+ public SubscriptionUnderManagementGroupInner withParent(DescendantParentGroupInfo parent) {
+ if (this.innerProperties() == null) {
+ this.innerProperties = new SubscriptionUnderManagementGroupProperties();
+ }
+ this.innerProperties().withParent(parent);
+ return this;
+ }
+
+ /**
+ * Get the state property: The state of the subscription.
+ *
+ * @return the state value.
+ */
+ public String state() {
+ return this.innerProperties() == null ? null : this.innerProperties().state();
+ }
+
+ /**
+ * Set the state property: The state of the subscription.
+ *
+ * @param state the state value to set.
+ * @return the SubscriptionUnderManagementGroupInner object itself.
+ */
+ public SubscriptionUnderManagementGroupInner withState(String state) {
+ if (this.innerProperties() == null) {
+ this.innerProperties = new SubscriptionUnderManagementGroupProperties();
+ }
+ this.innerProperties().withState(state);
+ return this;
+ }
+
+ /**
+ * Validates the instance.
+ *
+ * @throws IllegalArgumentException thrown if the instance is not valid.
+ */
+ public void validate() {
+ if (innerProperties() != null) {
+ innerProperties().validate();
+ }
+ }
+}
diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/SubscriptionUnderManagementGroupProperties.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/SubscriptionUnderManagementGroupProperties.java
new file mode 100644
index 000000000000..487488b49764
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/SubscriptionUnderManagementGroupProperties.java
@@ -0,0 +1,131 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.managementgroups.fluent.models;
+
+import com.azure.core.annotation.Fluent;
+import com.azure.resourcemanager.managementgroups.models.DescendantParentGroupInfo;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/** The generic properties of subscription under a management group. */
+@Fluent
+public final class SubscriptionUnderManagementGroupProperties {
+ /*
+ * The AAD Tenant ID associated with the subscription. For example,
+ * 00000000-0000-0000-0000-000000000000
+ */
+ @JsonProperty(value = "tenant")
+ private String tenant;
+
+ /*
+ * The friendly name of the subscription.
+ */
+ @JsonProperty(value = "displayName")
+ private String displayName;
+
+ /*
+ * The ID of the parent management group.
+ */
+ @JsonProperty(value = "parent")
+ private DescendantParentGroupInfo parent;
+
+ /*
+ * The state of the subscription.
+ */
+ @JsonProperty(value = "state")
+ private String state;
+
+ /**
+ * Get the tenant property: The AAD Tenant ID associated with the subscription. For example,
+ * 00000000-0000-0000-0000-000000000000.
+ *
+ * @return the tenant value.
+ */
+ public String tenant() {
+ return this.tenant;
+ }
+
+ /**
+ * Set the tenant property: The AAD Tenant ID associated with the subscription. For example,
+ * 00000000-0000-0000-0000-000000000000.
+ *
+ * @param tenant the tenant value to set.
+ * @return the SubscriptionUnderManagementGroupProperties object itself.
+ */
+ public SubscriptionUnderManagementGroupProperties withTenant(String tenant) {
+ this.tenant = tenant;
+ return this;
+ }
+
+ /**
+ * Get the displayName property: The friendly name of the subscription.
+ *
+ * @return the displayName value.
+ */
+ public String displayName() {
+ return this.displayName;
+ }
+
+ /**
+ * Set the displayName property: The friendly name of the subscription.
+ *
+ * @param displayName the displayName value to set.
+ * @return the SubscriptionUnderManagementGroupProperties object itself.
+ */
+ public SubscriptionUnderManagementGroupProperties withDisplayName(String displayName) {
+ this.displayName = displayName;
+ return this;
+ }
+
+ /**
+ * Get the parent property: The ID of the parent management group.
+ *
+ * @return the parent value.
+ */
+ public DescendantParentGroupInfo parent() {
+ return this.parent;
+ }
+
+ /**
+ * Set the parent property: The ID of the parent management group.
+ *
+ * @param parent the parent value to set.
+ * @return the SubscriptionUnderManagementGroupProperties object itself.
+ */
+ public SubscriptionUnderManagementGroupProperties withParent(DescendantParentGroupInfo parent) {
+ this.parent = parent;
+ return this;
+ }
+
+ /**
+ * Get the state property: The state of the subscription.
+ *
+ * @return the state value.
+ */
+ public String state() {
+ return this.state;
+ }
+
+ /**
+ * Set the state property: The state of the subscription.
+ *
+ * @param state the state value to set.
+ * @return the SubscriptionUnderManagementGroupProperties object itself.
+ */
+ public SubscriptionUnderManagementGroupProperties withState(String state) {
+ this.state = state;
+ return this;
+ }
+
+ /**
+ * Validates the instance.
+ *
+ * @throws IllegalArgumentException thrown if the instance is not valid.
+ */
+ public void validate() {
+ if (parent() != null) {
+ parent().validate();
+ }
+ }
+}
diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/TenantBackfillStatusResultInner.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/TenantBackfillStatusResultInner.java
new file mode 100644
index 000000000000..bc09f0ededf6
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/TenantBackfillStatusResultInner.java
@@ -0,0 +1,53 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.managementgroups.fluent.models;
+
+import com.azure.core.annotation.Immutable;
+import com.azure.resourcemanager.managementgroups.models.Status;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/** The tenant backfill status. */
+@Immutable
+public final class TenantBackfillStatusResultInner {
+ /*
+ * The AAD Tenant ID associated with the management group. For example,
+ * 00000000-0000-0000-0000-000000000000
+ */
+ @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY)
+ private String tenantId;
+
+ /*
+ * The status of the Tenant Backfill
+ */
+ @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY)
+ private Status status;
+
+ /**
+ * Get the tenantId property: The AAD Tenant ID associated with the management group. For example,
+ * 00000000-0000-0000-0000-000000000000.
+ *
+ * @return the tenantId value.
+ */
+ public String tenantId() {
+ return this.tenantId;
+ }
+
+ /**
+ * Get the status property: The status of the Tenant Backfill.
+ *
+ * @return the status value.
+ */
+ public Status status() {
+ return this.status;
+ }
+
+ /**
+ * Validates the instance.
+ *
+ * @throws IllegalArgumentException thrown if the instance is not valid.
+ */
+ public void validate() {
+ }
+}
diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/package-info.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/package-info.java
new file mode 100644
index 000000000000..5b25f5ab9f57
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/package-info.java
@@ -0,0 +1,10 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+/**
+ * Package containing the inner data models for ManagementGroupsApi. The Azure Management Groups API enables
+ * consolidation of multiple subscriptions/resources into an organizational hierarchy and centrally manage access
+ * control, policies, alerting and reporting for those resources.
+ */
+package com.azure.resourcemanager.managementgroups.fluent.models;
diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/package-info.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/package-info.java
new file mode 100644
index 000000000000..2909a5acb010
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/package-info.java
@@ -0,0 +1,10 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+/**
+ * Package containing the service clients for ManagementGroupsApi. The Azure Management Groups API enables consolidation
+ * of multiple subscriptions/resources into an organizational hierarchy and centrally manage access control, policies,
+ * alerting and reporting for those resources.
+ */
+package com.azure.resourcemanager.managementgroups.fluent;
diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/AzureAsyncOperationResultsImpl.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/AzureAsyncOperationResultsImpl.java
new file mode 100644
index 000000000000..5ff1ad0b0290
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/AzureAsyncOperationResultsImpl.java
@@ -0,0 +1,53 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.managementgroups.implementation;
+
+import com.azure.resourcemanager.managementgroups.fluent.models.AzureAsyncOperationResultsInner;
+import com.azure.resourcemanager.managementgroups.models.AzureAsyncOperationResults;
+
+public final class AzureAsyncOperationResultsImpl implements AzureAsyncOperationResults {
+ private AzureAsyncOperationResultsInner innerObject;
+
+ private final com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager;
+
+ AzureAsyncOperationResultsImpl(
+ AzureAsyncOperationResultsInner innerObject,
+ com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager) {
+ this.innerObject = innerObject;
+ this.serviceManager = serviceManager;
+ }
+
+ public String id() {
+ return this.innerModel().id();
+ }
+
+ public String type() {
+ return this.innerModel().type();
+ }
+
+ public String name() {
+ return this.innerModel().name();
+ }
+
+ public String status() {
+ return this.innerModel().status();
+ }
+
+ public String tenantId() {
+ return this.innerModel().tenantId();
+ }
+
+ public String displayName() {
+ return this.innerModel().displayName();
+ }
+
+ public AzureAsyncOperationResultsInner innerModel() {
+ return this.innerObject;
+ }
+
+ private com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager() {
+ return this.serviceManager;
+ }
+}
diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/CheckNameAvailabilityResultImpl.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/CheckNameAvailabilityResultImpl.java
new file mode 100644
index 000000000000..5efb9a2e70fe
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/CheckNameAvailabilityResultImpl.java
@@ -0,0 +1,42 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.managementgroups.implementation;
+
+import com.azure.resourcemanager.managementgroups.fluent.models.CheckNameAvailabilityResultInner;
+import com.azure.resourcemanager.managementgroups.models.CheckNameAvailabilityResult;
+import com.azure.resourcemanager.managementgroups.models.Reason;
+
+public final class CheckNameAvailabilityResultImpl implements CheckNameAvailabilityResult {
+ private CheckNameAvailabilityResultInner innerObject;
+
+ private final com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager;
+
+ CheckNameAvailabilityResultImpl(
+ CheckNameAvailabilityResultInner innerObject,
+ com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager) {
+ this.innerObject = innerObject;
+ this.serviceManager = serviceManager;
+ }
+
+ public Boolean nameAvailable() {
+ return this.innerModel().nameAvailable();
+ }
+
+ public Reason reason() {
+ return this.innerModel().reason();
+ }
+
+ public String message() {
+ return this.innerModel().message();
+ }
+
+ public CheckNameAvailabilityResultInner innerModel() {
+ return this.innerObject;
+ }
+
+ private com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager() {
+ return this.serviceManager;
+ }
+}
diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/DescendantInfoImpl.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/DescendantInfoImpl.java
new file mode 100644
index 000000000000..b36cb664a6bb
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/DescendantInfoImpl.java
@@ -0,0 +1,50 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.managementgroups.implementation;
+
+import com.azure.resourcemanager.managementgroups.fluent.models.DescendantInfoInner;
+import com.azure.resourcemanager.managementgroups.models.DescendantInfo;
+import com.azure.resourcemanager.managementgroups.models.DescendantParentGroupInfo;
+
+public final class DescendantInfoImpl implements DescendantInfo {
+ private DescendantInfoInner innerObject;
+
+ private final com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager;
+
+ DescendantInfoImpl(
+ DescendantInfoInner innerObject,
+ com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager) {
+ this.innerObject = innerObject;
+ this.serviceManager = serviceManager;
+ }
+
+ public String id() {
+ return this.innerModel().id();
+ }
+
+ public String type() {
+ return this.innerModel().type();
+ }
+
+ public String name() {
+ return this.innerModel().name();
+ }
+
+ public String displayName() {
+ return this.innerModel().displayName();
+ }
+
+ public DescendantParentGroupInfo parent() {
+ return this.innerModel().parent();
+ }
+
+ public DescendantInfoInner innerModel() {
+ return this.innerObject;
+ }
+
+ private com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager() {
+ return this.serviceManager;
+ }
+}
diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/EntitiesClientImpl.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/EntitiesClientImpl.java
new file mode 100644
index 000000000000..637d8d43b639
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/EntitiesClientImpl.java
@@ -0,0 +1,555 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.managementgroups.implementation;
+
+import com.azure.core.annotation.ExpectedResponses;
+import com.azure.core.annotation.Get;
+import com.azure.core.annotation.HeaderParam;
+import com.azure.core.annotation.Headers;
+import com.azure.core.annotation.Host;
+import com.azure.core.annotation.HostParam;
+import com.azure.core.annotation.PathParam;
+import com.azure.core.annotation.Post;
+import com.azure.core.annotation.QueryParam;
+import com.azure.core.annotation.ReturnType;
+import com.azure.core.annotation.ServiceInterface;
+import com.azure.core.annotation.ServiceMethod;
+import com.azure.core.annotation.UnexpectedResponseExceptionType;
+import com.azure.core.http.rest.PagedFlux;
+import com.azure.core.http.rest.PagedIterable;
+import com.azure.core.http.rest.PagedResponse;
+import com.azure.core.http.rest.PagedResponseBase;
+import com.azure.core.http.rest.Response;
+import com.azure.core.http.rest.RestProxy;
+import com.azure.core.management.exception.ManagementException;
+import com.azure.core.util.Context;
+import com.azure.core.util.FluxUtil;
+import com.azure.resourcemanager.managementgroups.fluent.EntitiesClient;
+import com.azure.resourcemanager.managementgroups.fluent.models.EntityInfoInner;
+import com.azure.resourcemanager.managementgroups.models.EntityListResult;
+import com.azure.resourcemanager.managementgroups.models.EntitySearchType;
+import com.azure.resourcemanager.managementgroups.models.EntityViewParameterType;
+import reactor.core.publisher.Mono;
+
+/** An instance of this class provides access to all the operations defined in EntitiesClient. */
+public final class EntitiesClientImpl implements EntitiesClient {
+ /** The proxy service used to perform REST calls. */
+ private final EntitiesService service;
+
+ /** The service client containing this operation class. */
+ private final ManagementGroupsApiImpl client;
+
+ /**
+ * Initializes an instance of EntitiesClientImpl.
+ *
+ * @param client the instance of the service client containing this operation class.
+ */
+ EntitiesClientImpl(ManagementGroupsApiImpl client) {
+ this.service = RestProxy.create(EntitiesService.class, client.getHttpPipeline(), client.getSerializerAdapter());
+ this.client = client;
+ }
+
+ /**
+ * The interface defining all the services for ManagementGroupsApiEntities to be used by the proxy service to
+ * perform REST calls.
+ */
+ @Host("{$host}")
+ @ServiceInterface(name = "ManagementGroupsApiE")
+ private interface EntitiesService {
+ @Headers({"Content-Type: application/json"})
+ @Post("/providers/Microsoft.Management/getEntities")
+ @ExpectedResponses({200})
+ @UnexpectedResponseExceptionType(ManagementException.class)
+ Mono> list(
+ @HostParam("$host") String endpoint,
+ @QueryParam("api-version") String apiVersion,
+ @QueryParam("$skiptoken") String skiptoken,
+ @QueryParam("$skip") Integer skip,
+ @QueryParam("$top") Integer top,
+ @QueryParam("$select") String select,
+ @QueryParam("$search") EntitySearchType search,
+ @QueryParam("$filter") String filter,
+ @QueryParam("$view") EntityViewParameterType view,
+ @QueryParam("groupName") String groupName,
+ @HeaderParam("Cache-Control") String cacheControl,
+ @HeaderParam("Accept") String accept,
+ Context context);
+
+ @Headers({"Content-Type: application/json"})
+ @Get("{nextLink}")
+ @ExpectedResponses({200})
+ @UnexpectedResponseExceptionType(ManagementException.class)
+ Mono> listNext(
+ @PathParam(value = "nextLink", encoded = true) String nextLink,
+ @HostParam("$host") String endpoint,
+ @HeaderParam("Cache-Control") String cacheControl,
+ @HeaderParam("Accept") String accept,
+ Context context);
+ }
+
+ /**
+ * List all entities (Management Groups, Subscriptions, etc.) for the authenticated user.
+ *
+ * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a
+ * previous response contains a nextLink element, the value of the nextLink element will include a token
+ * parameter that specifies a starting point to use for subsequent calls.
+ * @param skip Number of entities to skip over when retrieving results. Passing this in will override $skipToken.
+ * @param top Number of elements to return when retrieving results. Passing this in will override $skipToken.
+ * @param select This parameter specifies the fields to include in the response. Can include any combination of
+ * Name,DisplayName,Type,ParentDisplayNameChain,ParentChain, e.g.
+ * '$select=Name,DisplayName,Type,ParentDisplayNameChain,ParentNameChain'. When specified the $select parameter
+ * can override select in $skipToken.
+ * @param search The $search parameter is used in conjunction with the $filter parameter to return three different
+ * outputs depending on the parameter passed in. With $search=AllowedParents the API will return the entity info
+ * of all groups that the requested entity will be able to reparent to as determined by the user's permissions.
+ * With $search=AllowedChildren the API will return the entity info of all entities that can be added as
+ * children of the requested entity. With $search=ParentAndFirstLevelChildren the API will return the parent and
+ * first level of children that the user has either direct access to or indirect access via one of their
+ * descendants. With $search=ParentOnly the API will return only the group if the user has access to at least
+ * one of the descendants of the group. With $search=ChildrenOnly the API will return only the first level of
+ * children of the group entity info specified in $filter. The user must have direct access to the children
+ * entities or one of it's descendants for it to show up in the results.
+ * @param filter The filter parameter allows you to filter on the the name or display name fields. You can check for
+ * equality on the name field (e.g. name eq '{entityName}') and you can check for substrings on either the name
+ * or display name fields(e.g. contains(name, '{substringToSearch}'), contains(displayName,
+ * '{substringToSearch')). Note that the '{entityName}' and '{substringToSearch}' fields are checked case
+ * insensitively.
+ * @param view The view parameter allows clients to filter the type of data that is returned by the getEntities
+ * call.
+ * @param groupName A filter which allows the get entities call to focus on a particular group (i.e. "$filter=name
+ * eq 'groupName'").
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return describes the result of the request to view entities along with {@link PagedResponse} on successful
+ * completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono> listSinglePageAsync(
+ String skiptoken,
+ Integer skip,
+ Integer top,
+ String select,
+ EntitySearchType search,
+ String filter,
+ EntityViewParameterType view,
+ String groupName,
+ String cacheControl) {
+ if (this.client.getEndpoint() == null) {
+ return Mono
+ .error(
+ new IllegalArgumentException(
+ "Parameter this.client.getEndpoint() is required and cannot be null."));
+ }
+ final String accept = "application/json";
+ return FluxUtil
+ .withContext(
+ context ->
+ service
+ .list(
+ this.client.getEndpoint(),
+ this.client.getApiVersion(),
+ skiptoken,
+ skip,
+ top,
+ select,
+ search,
+ filter,
+ view,
+ groupName,
+ cacheControl,
+ accept,
+ context))
+ .>map(
+ res ->
+ new PagedResponseBase<>(
+ res.getRequest(),
+ res.getStatusCode(),
+ res.getHeaders(),
+ res.getValue().value(),
+ res.getValue().nextLink(),
+ null))
+ .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
+ }
+
+ /**
+ * List all entities (Management Groups, Subscriptions, etc.) for the authenticated user.
+ *
+ * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a
+ * previous response contains a nextLink element, the value of the nextLink element will include a token
+ * parameter that specifies a starting point to use for subsequent calls.
+ * @param skip Number of entities to skip over when retrieving results. Passing this in will override $skipToken.
+ * @param top Number of elements to return when retrieving results. Passing this in will override $skipToken.
+ * @param select This parameter specifies the fields to include in the response. Can include any combination of
+ * Name,DisplayName,Type,ParentDisplayNameChain,ParentChain, e.g.
+ * '$select=Name,DisplayName,Type,ParentDisplayNameChain,ParentNameChain'. When specified the $select parameter
+ * can override select in $skipToken.
+ * @param search The $search parameter is used in conjunction with the $filter parameter to return three different
+ * outputs depending on the parameter passed in. With $search=AllowedParents the API will return the entity info
+ * of all groups that the requested entity will be able to reparent to as determined by the user's permissions.
+ * With $search=AllowedChildren the API will return the entity info of all entities that can be added as
+ * children of the requested entity. With $search=ParentAndFirstLevelChildren the API will return the parent and
+ * first level of children that the user has either direct access to or indirect access via one of their
+ * descendants. With $search=ParentOnly the API will return only the group if the user has access to at least
+ * one of the descendants of the group. With $search=ChildrenOnly the API will return only the first level of
+ * children of the group entity info specified in $filter. The user must have direct access to the children
+ * entities or one of it's descendants for it to show up in the results.
+ * @param filter The filter parameter allows you to filter on the the name or display name fields. You can check for
+ * equality on the name field (e.g. name eq '{entityName}') and you can check for substrings on either the name
+ * or display name fields(e.g. contains(name, '{substringToSearch}'), contains(displayName,
+ * '{substringToSearch')). Note that the '{entityName}' and '{substringToSearch}' fields are checked case
+ * insensitively.
+ * @param view The view parameter allows clients to filter the type of data that is returned by the getEntities
+ * call.
+ * @param groupName A filter which allows the get entities call to focus on a particular group (i.e. "$filter=name
+ * eq 'groupName'").
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return describes the result of the request to view entities along with {@link PagedResponse} on successful
+ * completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono> listSinglePageAsync(
+ String skiptoken,
+ Integer skip,
+ Integer top,
+ String select,
+ EntitySearchType search,
+ String filter,
+ EntityViewParameterType view,
+ String groupName,
+ String cacheControl,
+ Context context) {
+ if (this.client.getEndpoint() == null) {
+ return Mono
+ .error(
+ new IllegalArgumentException(
+ "Parameter this.client.getEndpoint() is required and cannot be null."));
+ }
+ final String accept = "application/json";
+ context = this.client.mergeContext(context);
+ return service
+ .list(
+ this.client.getEndpoint(),
+ this.client.getApiVersion(),
+ skiptoken,
+ skip,
+ top,
+ select,
+ search,
+ filter,
+ view,
+ groupName,
+ cacheControl,
+ accept,
+ context)
+ .map(
+ res ->
+ new PagedResponseBase<>(
+ res.getRequest(),
+ res.getStatusCode(),
+ res.getHeaders(),
+ res.getValue().value(),
+ res.getValue().nextLink(),
+ null));
+ }
+
+ /**
+ * List all entities (Management Groups, Subscriptions, etc.) for the authenticated user.
+ *
+ * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a
+ * previous response contains a nextLink element, the value of the nextLink element will include a token
+ * parameter that specifies a starting point to use for subsequent calls.
+ * @param skip Number of entities to skip over when retrieving results. Passing this in will override $skipToken.
+ * @param top Number of elements to return when retrieving results. Passing this in will override $skipToken.
+ * @param select This parameter specifies the fields to include in the response. Can include any combination of
+ * Name,DisplayName,Type,ParentDisplayNameChain,ParentChain, e.g.
+ * '$select=Name,DisplayName,Type,ParentDisplayNameChain,ParentNameChain'. When specified the $select parameter
+ * can override select in $skipToken.
+ * @param search The $search parameter is used in conjunction with the $filter parameter to return three different
+ * outputs depending on the parameter passed in. With $search=AllowedParents the API will return the entity info
+ * of all groups that the requested entity will be able to reparent to as determined by the user's permissions.
+ * With $search=AllowedChildren the API will return the entity info of all entities that can be added as
+ * children of the requested entity. With $search=ParentAndFirstLevelChildren the API will return the parent and
+ * first level of children that the user has either direct access to or indirect access via one of their
+ * descendants. With $search=ParentOnly the API will return only the group if the user has access to at least
+ * one of the descendants of the group. With $search=ChildrenOnly the API will return only the first level of
+ * children of the group entity info specified in $filter. The user must have direct access to the children
+ * entities or one of it's descendants for it to show up in the results.
+ * @param filter The filter parameter allows you to filter on the the name or display name fields. You can check for
+ * equality on the name field (e.g. name eq '{entityName}') and you can check for substrings on either the name
+ * or display name fields(e.g. contains(name, '{substringToSearch}'), contains(displayName,
+ * '{substringToSearch')). Note that the '{entityName}' and '{substringToSearch}' fields are checked case
+ * insensitively.
+ * @param view The view parameter allows clients to filter the type of data that is returned by the getEntities
+ * call.
+ * @param groupName A filter which allows the get entities call to focus on a particular group (i.e. "$filter=name
+ * eq 'groupName'").
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return describes the result of the request to view entities as paginated response with {@link PagedFlux}.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ private PagedFlux listAsync(
+ String skiptoken,
+ Integer skip,
+ Integer top,
+ String select,
+ EntitySearchType search,
+ String filter,
+ EntityViewParameterType view,
+ String groupName,
+ String cacheControl) {
+ return new PagedFlux<>(
+ () -> listSinglePageAsync(skiptoken, skip, top, select, search, filter, view, groupName, cacheControl),
+ nextLink -> listNextSinglePageAsync(nextLink, cacheControl));
+ }
+
+ /**
+ * List all entities (Management Groups, Subscriptions, etc.) for the authenticated user.
+ *
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return describes the result of the request to view entities as paginated response with {@link PagedFlux}.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ private PagedFlux listAsync() {
+ final String skiptoken = null;
+ final Integer skip = null;
+ final Integer top = null;
+ final String select = null;
+ final EntitySearchType search = null;
+ final String filter = null;
+ final EntityViewParameterType view = null;
+ final String groupName = null;
+ final String cacheControl = null;
+ return new PagedFlux<>(
+ () -> listSinglePageAsync(skiptoken, skip, top, select, search, filter, view, groupName, cacheControl),
+ nextLink -> listNextSinglePageAsync(nextLink, cacheControl));
+ }
+
+ /**
+ * List all entities (Management Groups, Subscriptions, etc.) for the authenticated user.
+ *
+ * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a
+ * previous response contains a nextLink element, the value of the nextLink element will include a token
+ * parameter that specifies a starting point to use for subsequent calls.
+ * @param skip Number of entities to skip over when retrieving results. Passing this in will override $skipToken.
+ * @param top Number of elements to return when retrieving results. Passing this in will override $skipToken.
+ * @param select This parameter specifies the fields to include in the response. Can include any combination of
+ * Name,DisplayName,Type,ParentDisplayNameChain,ParentChain, e.g.
+ * '$select=Name,DisplayName,Type,ParentDisplayNameChain,ParentNameChain'. When specified the $select parameter
+ * can override select in $skipToken.
+ * @param search The $search parameter is used in conjunction with the $filter parameter to return three different
+ * outputs depending on the parameter passed in. With $search=AllowedParents the API will return the entity info
+ * of all groups that the requested entity will be able to reparent to as determined by the user's permissions.
+ * With $search=AllowedChildren the API will return the entity info of all entities that can be added as
+ * children of the requested entity. With $search=ParentAndFirstLevelChildren the API will return the parent and
+ * first level of children that the user has either direct access to or indirect access via one of their
+ * descendants. With $search=ParentOnly the API will return only the group if the user has access to at least
+ * one of the descendants of the group. With $search=ChildrenOnly the API will return only the first level of
+ * children of the group entity info specified in $filter. The user must have direct access to the children
+ * entities or one of it's descendants for it to show up in the results.
+ * @param filter The filter parameter allows you to filter on the the name or display name fields. You can check for
+ * equality on the name field (e.g. name eq '{entityName}') and you can check for substrings on either the name
+ * or display name fields(e.g. contains(name, '{substringToSearch}'), contains(displayName,
+ * '{substringToSearch')). Note that the '{entityName}' and '{substringToSearch}' fields are checked case
+ * insensitively.
+ * @param view The view parameter allows clients to filter the type of data that is returned by the getEntities
+ * call.
+ * @param groupName A filter which allows the get entities call to focus on a particular group (i.e. "$filter=name
+ * eq 'groupName'").
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return describes the result of the request to view entities as paginated response with {@link PagedFlux}.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ private PagedFlux listAsync(
+ String skiptoken,
+ Integer skip,
+ Integer top,
+ String select,
+ EntitySearchType search,
+ String filter,
+ EntityViewParameterType view,
+ String groupName,
+ String cacheControl,
+ Context context) {
+ return new PagedFlux<>(
+ () ->
+ listSinglePageAsync(
+ skiptoken, skip, top, select, search, filter, view, groupName, cacheControl, context),
+ nextLink -> listNextSinglePageAsync(nextLink, cacheControl, context));
+ }
+
+ /**
+ * List all entities (Management Groups, Subscriptions, etc.) for the authenticated user.
+ *
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return describes the result of the request to view entities as paginated response with {@link PagedIterable}.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedIterable list() {
+ final String skiptoken = null;
+ final Integer skip = null;
+ final Integer top = null;
+ final String select = null;
+ final EntitySearchType search = null;
+ final String filter = null;
+ final EntityViewParameterType view = null;
+ final String groupName = null;
+ final String cacheControl = null;
+ return new PagedIterable<>(
+ listAsync(skiptoken, skip, top, select, search, filter, view, groupName, cacheControl));
+ }
+
+ /**
+ * List all entities (Management Groups, Subscriptions, etc.) for the authenticated user.
+ *
+ * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a
+ * previous response contains a nextLink element, the value of the nextLink element will include a token
+ * parameter that specifies a starting point to use for subsequent calls.
+ * @param skip Number of entities to skip over when retrieving results. Passing this in will override $skipToken.
+ * @param top Number of elements to return when retrieving results. Passing this in will override $skipToken.
+ * @param select This parameter specifies the fields to include in the response. Can include any combination of
+ * Name,DisplayName,Type,ParentDisplayNameChain,ParentChain, e.g.
+ * '$select=Name,DisplayName,Type,ParentDisplayNameChain,ParentNameChain'. When specified the $select parameter
+ * can override select in $skipToken.
+ * @param search The $search parameter is used in conjunction with the $filter parameter to return three different
+ * outputs depending on the parameter passed in. With $search=AllowedParents the API will return the entity info
+ * of all groups that the requested entity will be able to reparent to as determined by the user's permissions.
+ * With $search=AllowedChildren the API will return the entity info of all entities that can be added as
+ * children of the requested entity. With $search=ParentAndFirstLevelChildren the API will return the parent and
+ * first level of children that the user has either direct access to or indirect access via one of their
+ * descendants. With $search=ParentOnly the API will return only the group if the user has access to at least
+ * one of the descendants of the group. With $search=ChildrenOnly the API will return only the first level of
+ * children of the group entity info specified in $filter. The user must have direct access to the children
+ * entities or one of it's descendants for it to show up in the results.
+ * @param filter The filter parameter allows you to filter on the the name or display name fields. You can check for
+ * equality on the name field (e.g. name eq '{entityName}') and you can check for substrings on either the name
+ * or display name fields(e.g. contains(name, '{substringToSearch}'), contains(displayName,
+ * '{substringToSearch')). Note that the '{entityName}' and '{substringToSearch}' fields are checked case
+ * insensitively.
+ * @param view The view parameter allows clients to filter the type of data that is returned by the getEntities
+ * call.
+ * @param groupName A filter which allows the get entities call to focus on a particular group (i.e. "$filter=name
+ * eq 'groupName'").
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return describes the result of the request to view entities as paginated response with {@link PagedIterable}.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedIterable list(
+ String skiptoken,
+ Integer skip,
+ Integer top,
+ String select,
+ EntitySearchType search,
+ String filter,
+ EntityViewParameterType view,
+ String groupName,
+ String cacheControl,
+ Context context) {
+ return new PagedIterable<>(
+ listAsync(skiptoken, skip, top, select, search, filter, view, groupName, cacheControl, context));
+ }
+
+ /**
+ * Get the next page of items.
+ *
+ * @param nextLink The nextLink parameter.
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return describes the result of the request to view entities along with {@link PagedResponse} on successful
+ * completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono> listNextSinglePageAsync(String nextLink, String cacheControl) {
+ if (nextLink == null) {
+ return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
+ }
+ if (this.client.getEndpoint() == null) {
+ return Mono
+ .error(
+ new IllegalArgumentException(
+ "Parameter this.client.getEndpoint() is required and cannot be null."));
+ }
+ final String accept = "application/json";
+ return FluxUtil
+ .withContext(
+ context -> service.listNext(nextLink, this.client.getEndpoint(), cacheControl, accept, context))
+ .>map(
+ res ->
+ new PagedResponseBase<>(
+ res.getRequest(),
+ res.getStatusCode(),
+ res.getHeaders(),
+ res.getValue().value(),
+ res.getValue().nextLink(),
+ null))
+ .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
+ }
+
+ /**
+ * Get the next page of items.
+ *
+ * @param nextLink The nextLink parameter.
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return describes the result of the request to view entities along with {@link PagedResponse} on successful
+ * completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono> listNextSinglePageAsync(
+ String nextLink, String cacheControl, Context context) {
+ if (nextLink == null) {
+ return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
+ }
+ if (this.client.getEndpoint() == null) {
+ return Mono
+ .error(
+ new IllegalArgumentException(
+ "Parameter this.client.getEndpoint() is required and cannot be null."));
+ }
+ final String accept = "application/json";
+ context = this.client.mergeContext(context);
+ return service
+ .listNext(nextLink, this.client.getEndpoint(), cacheControl, accept, context)
+ .map(
+ res ->
+ new PagedResponseBase<>(
+ res.getRequest(),
+ res.getStatusCode(),
+ res.getHeaders(),
+ res.getValue().value(),
+ res.getValue().nextLink(),
+ null));
+ }
+}
diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/EntitiesImpl.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/EntitiesImpl.java
new file mode 100644
index 000000000000..8dad803b9874
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/EntitiesImpl.java
@@ -0,0 +1,60 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.managementgroups.implementation;
+
+import com.azure.core.http.rest.PagedIterable;
+import com.azure.core.util.Context;
+import com.azure.core.util.logging.ClientLogger;
+import com.azure.resourcemanager.managementgroups.fluent.EntitiesClient;
+import com.azure.resourcemanager.managementgroups.fluent.models.EntityInfoInner;
+import com.azure.resourcemanager.managementgroups.models.Entities;
+import com.azure.resourcemanager.managementgroups.models.EntityInfo;
+import com.azure.resourcemanager.managementgroups.models.EntitySearchType;
+import com.azure.resourcemanager.managementgroups.models.EntityViewParameterType;
+
+public final class EntitiesImpl implements Entities {
+ private static final ClientLogger LOGGER = new ClientLogger(EntitiesImpl.class);
+
+ private final EntitiesClient innerClient;
+
+ private final com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager;
+
+ public EntitiesImpl(
+ EntitiesClient innerClient, com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager) {
+ this.innerClient = innerClient;
+ this.serviceManager = serviceManager;
+ }
+
+ public PagedIterable list() {
+ PagedIterable inner = this.serviceClient().list();
+ return Utils.mapPage(inner, inner1 -> new EntityInfoImpl(inner1, this.manager()));
+ }
+
+ public PagedIterable list(
+ String skiptoken,
+ Integer skip,
+ Integer top,
+ String select,
+ EntitySearchType search,
+ String filter,
+ EntityViewParameterType view,
+ String groupName,
+ String cacheControl,
+ Context context) {
+ PagedIterable inner =
+ this
+ .serviceClient()
+ .list(skiptoken, skip, top, select, search, filter, view, groupName, cacheControl, context);
+ return Utils.mapPage(inner, inner1 -> new EntityInfoImpl(inner1, this.manager()));
+ }
+
+ private EntitiesClient serviceClient() {
+ return this.innerClient;
+ }
+
+ private com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager() {
+ return this.serviceManager;
+ }
+}
diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/EntityInfoImpl.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/EntityInfoImpl.java
new file mode 100644
index 000000000000..a00a7edc1fa1
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/EntityInfoImpl.java
@@ -0,0 +1,95 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.managementgroups.implementation;
+
+import com.azure.resourcemanager.managementgroups.fluent.models.EntityInfoInner;
+import com.azure.resourcemanager.managementgroups.models.EntityInfo;
+import com.azure.resourcemanager.managementgroups.models.EntityParentGroupInfo;
+import com.azure.resourcemanager.managementgroups.models.Permissions;
+import java.util.Collections;
+import java.util.List;
+
+public final class EntityInfoImpl implements EntityInfo {
+ private EntityInfoInner innerObject;
+
+ private final com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager;
+
+ EntityInfoImpl(
+ EntityInfoInner innerObject,
+ com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager) {
+ this.innerObject = innerObject;
+ this.serviceManager = serviceManager;
+ }
+
+ public String id() {
+ return this.innerModel().id();
+ }
+
+ public String type() {
+ return this.innerModel().type();
+ }
+
+ public String name() {
+ return this.innerModel().name();
+ }
+
+ public String tenantId() {
+ return this.innerModel().tenantId();
+ }
+
+ public String displayName() {
+ return this.innerModel().displayName();
+ }
+
+ public EntityParentGroupInfo parent() {
+ return this.innerModel().parent();
+ }
+
+ public Permissions permissions() {
+ return this.innerModel().permissions();
+ }
+
+ public Permissions inheritedPermissions() {
+ return this.innerModel().inheritedPermissions();
+ }
+
+ public Integer numberOfDescendants() {
+ return this.innerModel().numberOfDescendants();
+ }
+
+ public Integer numberOfChildren() {
+ return this.innerModel().numberOfChildren();
+ }
+
+ public Integer numberOfChildGroups() {
+ return this.innerModel().numberOfChildGroups();
+ }
+
+ public List parentDisplayNameChain() {
+ List inner = this.innerModel().parentDisplayNameChain();
+ if (inner != null) {
+ return Collections.unmodifiableList(inner);
+ } else {
+ return Collections.emptyList();
+ }
+ }
+
+ public List parentNameChain() {
+ List inner = this.innerModel().parentNameChain();
+ if (inner != null) {
+ return Collections.unmodifiableList(inner);
+ } else {
+ return Collections.emptyList();
+ }
+ }
+
+ public EntityInfoInner innerModel() {
+ return this.innerObject;
+ }
+
+ private com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager() {
+ return this.serviceManager;
+ }
+}
diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/HierarchySettingsImpl.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/HierarchySettingsImpl.java
new file mode 100644
index 000000000000..07e8225d26b4
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/HierarchySettingsImpl.java
@@ -0,0 +1,53 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.managementgroups.implementation;
+
+import com.azure.resourcemanager.managementgroups.fluent.models.HierarchySettingsInner;
+import com.azure.resourcemanager.managementgroups.models.HierarchySettings;
+
+public final class HierarchySettingsImpl implements HierarchySettings {
+ private HierarchySettingsInner innerObject;
+
+ private final com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager;
+
+ HierarchySettingsImpl(
+ HierarchySettingsInner innerObject,
+ com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager) {
+ this.innerObject = innerObject;
+ this.serviceManager = serviceManager;
+ }
+
+ public String id() {
+ return this.innerModel().id();
+ }
+
+ public String name() {
+ return this.innerModel().name();
+ }
+
+ public String type() {
+ return this.innerModel().type();
+ }
+
+ public String tenantId() {
+ return this.innerModel().tenantId();
+ }
+
+ public Boolean requireAuthorizationForGroupCreation() {
+ return this.innerModel().requireAuthorizationForGroupCreation();
+ }
+
+ public String defaultManagementGroup() {
+ return this.innerModel().defaultManagementGroup();
+ }
+
+ public HierarchySettingsInner innerModel() {
+ return this.innerObject;
+ }
+
+ private com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager() {
+ return this.serviceManager;
+ }
+}
diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/HierarchySettingsListImpl.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/HierarchySettingsListImpl.java
new file mode 100644
index 000000000000..e8cc4040c5c3
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/HierarchySettingsListImpl.java
@@ -0,0 +1,45 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.managementgroups.implementation;
+
+import com.azure.resourcemanager.managementgroups.fluent.models.HierarchySettingsListInner;
+import com.azure.resourcemanager.managementgroups.models.HierarchySettingsInfo;
+import com.azure.resourcemanager.managementgroups.models.HierarchySettingsList;
+import java.util.Collections;
+import java.util.List;
+
+public final class HierarchySettingsListImpl implements HierarchySettingsList {
+ private HierarchySettingsListInner innerObject;
+
+ private final com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager;
+
+ HierarchySettingsListImpl(
+ HierarchySettingsListInner innerObject,
+ com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager) {
+ this.innerObject = innerObject;
+ this.serviceManager = serviceManager;
+ }
+
+ public List value() {
+ List inner = this.innerModel().value();
+ if (inner != null) {
+ return Collections.unmodifiableList(inner);
+ } else {
+ return Collections.emptyList();
+ }
+ }
+
+ public String nextLink() {
+ return this.innerModel().nextLink();
+ }
+
+ public HierarchySettingsListInner innerModel() {
+ return this.innerObject;
+ }
+
+ private com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager() {
+ return this.serviceManager;
+ }
+}
diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/HierarchySettingsOperationsClientImpl.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/HierarchySettingsOperationsClientImpl.java
new file mode 100644
index 000000000000..274db6e9e4e2
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/HierarchySettingsOperationsClientImpl.java
@@ -0,0 +1,703 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.managementgroups.implementation;
+
+import com.azure.core.annotation.BodyParam;
+import com.azure.core.annotation.Delete;
+import com.azure.core.annotation.ExpectedResponses;
+import com.azure.core.annotation.Get;
+import com.azure.core.annotation.HeaderParam;
+import com.azure.core.annotation.Headers;
+import com.azure.core.annotation.Host;
+import com.azure.core.annotation.HostParam;
+import com.azure.core.annotation.Patch;
+import com.azure.core.annotation.PathParam;
+import com.azure.core.annotation.Put;
+import com.azure.core.annotation.QueryParam;
+import com.azure.core.annotation.ReturnType;
+import com.azure.core.annotation.ServiceInterface;
+import com.azure.core.annotation.ServiceMethod;
+import com.azure.core.annotation.UnexpectedResponseExceptionType;
+import com.azure.core.http.rest.Response;
+import com.azure.core.http.rest.RestProxy;
+import com.azure.core.management.exception.ManagementException;
+import com.azure.core.util.Context;
+import com.azure.core.util.FluxUtil;
+import com.azure.resourcemanager.managementgroups.fluent.HierarchySettingsOperationsClient;
+import com.azure.resourcemanager.managementgroups.fluent.models.HierarchySettingsInner;
+import com.azure.resourcemanager.managementgroups.fluent.models.HierarchySettingsListInner;
+import com.azure.resourcemanager.managementgroups.models.CreateOrUpdateSettingsRequest;
+import reactor.core.publisher.Mono;
+
+/** An instance of this class provides access to all the operations defined in HierarchySettingsOperationsClient. */
+public final class HierarchySettingsOperationsClientImpl implements HierarchySettingsOperationsClient {
+ /** The proxy service used to perform REST calls. */
+ private final HierarchySettingsOperationsService service;
+
+ /** The service client containing this operation class. */
+ private final ManagementGroupsApiImpl client;
+
+ /**
+ * Initializes an instance of HierarchySettingsOperationsClientImpl.
+ *
+ * @param client the instance of the service client containing this operation class.
+ */
+ HierarchySettingsOperationsClientImpl(ManagementGroupsApiImpl client) {
+ this.service =
+ RestProxy
+ .create(
+ HierarchySettingsOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter());
+ this.client = client;
+ }
+
+ /**
+ * The interface defining all the services for ManagementGroupsApiHierarchySettingsOperations to be used by the
+ * proxy service to perform REST calls.
+ */
+ @Host("{$host}")
+ @ServiceInterface(name = "ManagementGroupsApiH")
+ private interface HierarchySettingsOperationsService {
+ @Headers({"Content-Type: application/json"})
+ @Get("/providers/Microsoft.Management/managementGroups/{groupId}/settings")
+ @ExpectedResponses({200})
+ @UnexpectedResponseExceptionType(ManagementException.class)
+ Mono> list(
+ @HostParam("$host") String endpoint,
+ @PathParam("groupId") String groupId,
+ @QueryParam("api-version") String apiVersion,
+ @HeaderParam("Accept") String accept,
+ Context context);
+
+ @Headers({"Content-Type: application/json"})
+ @Get("/providers/Microsoft.Management/managementGroups/{groupId}/settings/default")
+ @ExpectedResponses({200})
+ @UnexpectedResponseExceptionType(ManagementException.class)
+ Mono> get(
+ @HostParam("$host") String endpoint,
+ @PathParam("groupId") String groupId,
+ @QueryParam("api-version") String apiVersion,
+ @HeaderParam("Accept") String accept,
+ Context context);
+
+ @Headers({"Content-Type: application/json"})
+ @Put("/providers/Microsoft.Management/managementGroups/{groupId}/settings/default")
+ @ExpectedResponses({200})
+ @UnexpectedResponseExceptionType(ManagementException.class)
+ Mono> createOrUpdate(
+ @HostParam("$host") String endpoint,
+ @PathParam("groupId") String groupId,
+ @QueryParam("api-version") String apiVersion,
+ @BodyParam("application/json") CreateOrUpdateSettingsRequest createTenantSettingsRequest,
+ @HeaderParam("Accept") String accept,
+ Context context);
+
+ @Headers({"Content-Type: application/json"})
+ @Patch("/providers/Microsoft.Management/managementGroups/{groupId}/settings/default")
+ @ExpectedResponses({200})
+ @UnexpectedResponseExceptionType(ManagementException.class)
+ Mono> update(
+ @HostParam("$host") String endpoint,
+ @PathParam("groupId") String groupId,
+ @QueryParam("api-version") String apiVersion,
+ @BodyParam("application/json") CreateOrUpdateSettingsRequest createTenantSettingsRequest,
+ @HeaderParam("Accept") String accept,
+ Context context);
+
+ @Headers({"Content-Type: application/json"})
+ @Delete("/providers/Microsoft.Management/managementGroups/{groupId}/settings/default")
+ @ExpectedResponses({200})
+ @UnexpectedResponseExceptionType(ManagementException.class)
+ Mono> delete(
+ @HostParam("$host") String endpoint,
+ @PathParam("groupId") String groupId,
+ @QueryParam("api-version") String apiVersion,
+ @HeaderParam("Accept") String accept,
+ Context context);
+ }
+
+ /**
+ * Gets all the hierarchy settings defined at the Management Group level. Settings can only be set on the root
+ * Management Group of the hierarchy.
+ *
+ * @param groupId Management Group ID.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return all the hierarchy settings defined at the Management Group level along with {@link Response} on
+ * successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono> listWithResponseAsync(String groupId) {
+ if (this.client.getEndpoint() == null) {
+ return Mono
+ .error(
+ new IllegalArgumentException(
+ "Parameter this.client.getEndpoint() is required and cannot be null."));
+ }
+ if (groupId == null) {
+ return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null."));
+ }
+ final String accept = "application/json";
+ return FluxUtil
+ .withContext(
+ context ->
+ service.list(this.client.getEndpoint(), groupId, this.client.getApiVersion(), accept, context))
+ .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
+ }
+
+ /**
+ * Gets all the hierarchy settings defined at the Management Group level. Settings can only be set on the root
+ * Management Group of the hierarchy.
+ *
+ * @param groupId Management Group ID.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return all the hierarchy settings defined at the Management Group level along with {@link Response} on
+ * successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono> listWithResponseAsync(String groupId, Context context) {
+ if (this.client.getEndpoint() == null) {
+ return Mono
+ .error(
+ new IllegalArgumentException(
+ "Parameter this.client.getEndpoint() is required and cannot be null."));
+ }
+ if (groupId == null) {
+ return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null."));
+ }
+ final String accept = "application/json";
+ context = this.client.mergeContext(context);
+ return service.list(this.client.getEndpoint(), groupId, this.client.getApiVersion(), accept, context);
+ }
+
+ /**
+ * Gets all the hierarchy settings defined at the Management Group level. Settings can only be set on the root
+ * Management Group of the hierarchy.
+ *
+ * @param groupId Management Group ID.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return all the hierarchy settings defined at the Management Group level on successful completion of {@link
+ * Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono listAsync(String groupId) {
+ return listWithResponseAsync(groupId).flatMap(res -> Mono.justOrEmpty(res.getValue()));
+ }
+
+ /**
+ * Gets all the hierarchy settings defined at the Management Group level. Settings can only be set on the root
+ * Management Group of the hierarchy.
+ *
+ * @param groupId Management Group ID.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return all the hierarchy settings defined at the Management Group level.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public HierarchySettingsListInner list(String groupId) {
+ return listAsync(groupId).block();
+ }
+
+ /**
+ * Gets all the hierarchy settings defined at the Management Group level. Settings can only be set on the root
+ * Management Group of the hierarchy.
+ *
+ * @param groupId Management Group ID.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return all the hierarchy settings defined at the Management Group level along with {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response listWithResponse(String groupId, Context context) {
+ return listWithResponseAsync(groupId, context).block();
+ }
+
+ /**
+ * Gets the hierarchy settings defined at the Management Group level. Settings can only be set on the root
+ * Management Group of the hierarchy.
+ *
+ * @param groupId Management Group ID.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the hierarchy settings defined at the Management Group level along with {@link Response} on successful
+ * completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono> getWithResponseAsync(String groupId) {
+ if (this.client.getEndpoint() == null) {
+ return Mono
+ .error(
+ new IllegalArgumentException(
+ "Parameter this.client.getEndpoint() is required and cannot be null."));
+ }
+ if (groupId == null) {
+ return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null."));
+ }
+ final String accept = "application/json";
+ return FluxUtil
+ .withContext(
+ context ->
+ service.get(this.client.getEndpoint(), groupId, this.client.getApiVersion(), accept, context))
+ .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
+ }
+
+ /**
+ * Gets the hierarchy settings defined at the Management Group level. Settings can only be set on the root
+ * Management Group of the hierarchy.
+ *
+ * @param groupId Management Group ID.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the hierarchy settings defined at the Management Group level along with {@link Response} on successful
+ * completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono> getWithResponseAsync(String groupId, Context context) {
+ if (this.client.getEndpoint() == null) {
+ return Mono
+ .error(
+ new IllegalArgumentException(
+ "Parameter this.client.getEndpoint() is required and cannot be null."));
+ }
+ if (groupId == null) {
+ return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null."));
+ }
+ final String accept = "application/json";
+ context = this.client.mergeContext(context);
+ return service.get(this.client.getEndpoint(), groupId, this.client.getApiVersion(), accept, context);
+ }
+
+ /**
+ * Gets the hierarchy settings defined at the Management Group level. Settings can only be set on the root
+ * Management Group of the hierarchy.
+ *
+ * @param groupId Management Group ID.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the hierarchy settings defined at the Management Group level on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono getAsync(String groupId) {
+ return getWithResponseAsync(groupId).flatMap(res -> Mono.justOrEmpty(res.getValue()));
+ }
+
+ /**
+ * Gets the hierarchy settings defined at the Management Group level. Settings can only be set on the root
+ * Management Group of the hierarchy.
+ *
+ * @param groupId Management Group ID.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the hierarchy settings defined at the Management Group level.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public HierarchySettingsInner get(String groupId) {
+ return getAsync(groupId).block();
+ }
+
+ /**
+ * Gets the hierarchy settings defined at the Management Group level. Settings can only be set on the root
+ * Management Group of the hierarchy.
+ *
+ * @param groupId Management Group ID.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the hierarchy settings defined at the Management Group level along with {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response getWithResponse(String groupId, Context context) {
+ return getWithResponseAsync(groupId, context).block();
+ }
+
+ /**
+ * Creates or updates the hierarchy settings defined at the Management Group level.
+ *
+ * @param groupId Management Group ID.
+ * @param createTenantSettingsRequest Tenant level settings request parameter.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return settings defined at the Management Group scope along with {@link Response} on successful completion of
+ * {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono> createOrUpdateWithResponseAsync(
+ String groupId, CreateOrUpdateSettingsRequest createTenantSettingsRequest) {
+ if (this.client.getEndpoint() == null) {
+ return Mono
+ .error(
+ new IllegalArgumentException(
+ "Parameter this.client.getEndpoint() is required and cannot be null."));
+ }
+ if (groupId == null) {
+ return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null."));
+ }
+ if (createTenantSettingsRequest == null) {
+ return Mono
+ .error(
+ new IllegalArgumentException(
+ "Parameter createTenantSettingsRequest is required and cannot be null."));
+ } else {
+ createTenantSettingsRequest.validate();
+ }
+ final String accept = "application/json";
+ return FluxUtil
+ .withContext(
+ context ->
+ service
+ .createOrUpdate(
+ this.client.getEndpoint(),
+ groupId,
+ this.client.getApiVersion(),
+ createTenantSettingsRequest,
+ accept,
+ context))
+ .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
+ }
+
+ /**
+ * Creates or updates the hierarchy settings defined at the Management Group level.
+ *
+ * @param groupId Management Group ID.
+ * @param createTenantSettingsRequest Tenant level settings request parameter.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return settings defined at the Management Group scope along with {@link Response} on successful completion of
+ * {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono> createOrUpdateWithResponseAsync(
+ String groupId, CreateOrUpdateSettingsRequest createTenantSettingsRequest, Context context) {
+ if (this.client.getEndpoint() == null) {
+ return Mono
+ .error(
+ new IllegalArgumentException(
+ "Parameter this.client.getEndpoint() is required and cannot be null."));
+ }
+ if (groupId == null) {
+ return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null."));
+ }
+ if (createTenantSettingsRequest == null) {
+ return Mono
+ .error(
+ new IllegalArgumentException(
+ "Parameter createTenantSettingsRequest is required and cannot be null."));
+ } else {
+ createTenantSettingsRequest.validate();
+ }
+ final String accept = "application/json";
+ context = this.client.mergeContext(context);
+ return service
+ .createOrUpdate(
+ this.client.getEndpoint(),
+ groupId,
+ this.client.getApiVersion(),
+ createTenantSettingsRequest,
+ accept,
+ context);
+ }
+
+ /**
+ * Creates or updates the hierarchy settings defined at the Management Group level.
+ *
+ * @param groupId Management Group ID.
+ * @param createTenantSettingsRequest Tenant level settings request parameter.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return settings defined at the Management Group scope on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono createOrUpdateAsync(
+ String groupId, CreateOrUpdateSettingsRequest createTenantSettingsRequest) {
+ return createOrUpdateWithResponseAsync(groupId, createTenantSettingsRequest)
+ .flatMap(res -> Mono.justOrEmpty(res.getValue()));
+ }
+
+ /**
+ * Creates or updates the hierarchy settings defined at the Management Group level.
+ *
+ * @param groupId Management Group ID.
+ * @param createTenantSettingsRequest Tenant level settings request parameter.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return settings defined at the Management Group scope.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public HierarchySettingsInner createOrUpdate(
+ String groupId, CreateOrUpdateSettingsRequest createTenantSettingsRequest) {
+ return createOrUpdateAsync(groupId, createTenantSettingsRequest).block();
+ }
+
+ /**
+ * Creates or updates the hierarchy settings defined at the Management Group level.
+ *
+ * @param groupId Management Group ID.
+ * @param createTenantSettingsRequest Tenant level settings request parameter.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return settings defined at the Management Group scope along with {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response createOrUpdateWithResponse(
+ String groupId, CreateOrUpdateSettingsRequest createTenantSettingsRequest, Context context) {
+ return createOrUpdateWithResponseAsync(groupId, createTenantSettingsRequest, context).block();
+ }
+
+ /**
+ * Updates the hierarchy settings defined at the Management Group level.
+ *
+ * @param groupId Management Group ID.
+ * @param createTenantSettingsRequest Tenant level settings request parameter.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return settings defined at the Management Group scope along with {@link Response} on successful completion of
+ * {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono> updateWithResponseAsync(
+ String groupId, CreateOrUpdateSettingsRequest createTenantSettingsRequest) {
+ if (this.client.getEndpoint() == null) {
+ return Mono
+ .error(
+ new IllegalArgumentException(
+ "Parameter this.client.getEndpoint() is required and cannot be null."));
+ }
+ if (groupId == null) {
+ return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null."));
+ }
+ if (createTenantSettingsRequest == null) {
+ return Mono
+ .error(
+ new IllegalArgumentException(
+ "Parameter createTenantSettingsRequest is required and cannot be null."));
+ } else {
+ createTenantSettingsRequest.validate();
+ }
+ final String accept = "application/json";
+ return FluxUtil
+ .withContext(
+ context ->
+ service
+ .update(
+ this.client.getEndpoint(),
+ groupId,
+ this.client.getApiVersion(),
+ createTenantSettingsRequest,
+ accept,
+ context))
+ .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
+ }
+
+ /**
+ * Updates the hierarchy settings defined at the Management Group level.
+ *
+ * @param groupId Management Group ID.
+ * @param createTenantSettingsRequest Tenant level settings request parameter.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return settings defined at the Management Group scope along with {@link Response} on successful completion of
+ * {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono> updateWithResponseAsync(
+ String groupId, CreateOrUpdateSettingsRequest createTenantSettingsRequest, Context context) {
+ if (this.client.getEndpoint() == null) {
+ return Mono
+ .error(
+ new IllegalArgumentException(
+ "Parameter this.client.getEndpoint() is required and cannot be null."));
+ }
+ if (groupId == null) {
+ return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null."));
+ }
+ if (createTenantSettingsRequest == null) {
+ return Mono
+ .error(
+ new IllegalArgumentException(
+ "Parameter createTenantSettingsRequest is required and cannot be null."));
+ } else {
+ createTenantSettingsRequest.validate();
+ }
+ final String accept = "application/json";
+ context = this.client.mergeContext(context);
+ return service
+ .update(
+ this.client.getEndpoint(),
+ groupId,
+ this.client.getApiVersion(),
+ createTenantSettingsRequest,
+ accept,
+ context);
+ }
+
+ /**
+ * Updates the hierarchy settings defined at the Management Group level.
+ *
+ * @param groupId Management Group ID.
+ * @param createTenantSettingsRequest Tenant level settings request parameter.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return settings defined at the Management Group scope on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono updateAsync(
+ String groupId, CreateOrUpdateSettingsRequest createTenantSettingsRequest) {
+ return updateWithResponseAsync(groupId, createTenantSettingsRequest)
+ .flatMap(res -> Mono.justOrEmpty(res.getValue()));
+ }
+
+ /**
+ * Updates the hierarchy settings defined at the Management Group level.
+ *
+ * @param groupId Management Group ID.
+ * @param createTenantSettingsRequest Tenant level settings request parameter.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return settings defined at the Management Group scope.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public HierarchySettingsInner update(String groupId, CreateOrUpdateSettingsRequest createTenantSettingsRequest) {
+ return updateAsync(groupId, createTenantSettingsRequest).block();
+ }
+
+ /**
+ * Updates the hierarchy settings defined at the Management Group level.
+ *
+ * @param groupId Management Group ID.
+ * @param createTenantSettingsRequest Tenant level settings request parameter.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return settings defined at the Management Group scope along with {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response updateWithResponse(
+ String groupId, CreateOrUpdateSettingsRequest createTenantSettingsRequest, Context context) {
+ return updateWithResponseAsync(groupId, createTenantSettingsRequest, context).block();
+ }
+
+ /**
+ * Deletes the hierarchy settings defined at the Management Group level.
+ *
+ * @param groupId Management Group ID.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the {@link Response} on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono> deleteWithResponseAsync(String groupId) {
+ if (this.client.getEndpoint() == null) {
+ return Mono
+ .error(
+ new IllegalArgumentException(
+ "Parameter this.client.getEndpoint() is required and cannot be null."));
+ }
+ if (groupId == null) {
+ return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null."));
+ }
+ final String accept = "application/json";
+ return FluxUtil
+ .withContext(
+ context ->
+ service.delete(this.client.getEndpoint(), groupId, this.client.getApiVersion(), accept, context))
+ .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
+ }
+
+ /**
+ * Deletes the hierarchy settings defined at the Management Group level.
+ *
+ * @param groupId Management Group ID.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the {@link Response} on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono> deleteWithResponseAsync(String groupId, Context context) {
+ if (this.client.getEndpoint() == null) {
+ return Mono
+ .error(
+ new IllegalArgumentException(
+ "Parameter this.client.getEndpoint() is required and cannot be null."));
+ }
+ if (groupId == null) {
+ return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null."));
+ }
+ final String accept = "application/json";
+ context = this.client.mergeContext(context);
+ return service.delete(this.client.getEndpoint(), groupId, this.client.getApiVersion(), accept, context);
+ }
+
+ /**
+ * Deletes the hierarchy settings defined at the Management Group level.
+ *
+ * @param groupId Management Group ID.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return A {@link Mono} that completes when a successful response is received.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono deleteAsync(String groupId) {
+ return deleteWithResponseAsync(groupId).flatMap(ignored -> Mono.empty());
+ }
+
+ /**
+ * Deletes the hierarchy settings defined at the Management Group level.
+ *
+ * @param groupId Management Group ID.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public void delete(String groupId) {
+ deleteAsync(groupId).block();
+ }
+
+ /**
+ * Deletes the hierarchy settings defined at the Management Group level.
+ *
+ * @param groupId Management Group ID.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response deleteWithResponse(String groupId, Context context) {
+ return deleteWithResponseAsync(groupId, context).block();
+ }
+}
diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/HierarchySettingsOperationsImpl.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/HierarchySettingsOperationsImpl.java
new file mode 100644
index 000000000000..be4b17cbf3e0
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/HierarchySettingsOperationsImpl.java
@@ -0,0 +1,140 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.managementgroups.implementation;
+
+import com.azure.core.http.rest.Response;
+import com.azure.core.http.rest.SimpleResponse;
+import com.azure.core.util.Context;
+import com.azure.core.util.logging.ClientLogger;
+import com.azure.resourcemanager.managementgroups.fluent.HierarchySettingsOperationsClient;
+import com.azure.resourcemanager.managementgroups.fluent.models.HierarchySettingsInner;
+import com.azure.resourcemanager.managementgroups.fluent.models.HierarchySettingsListInner;
+import com.azure.resourcemanager.managementgroups.models.CreateOrUpdateSettingsRequest;
+import com.azure.resourcemanager.managementgroups.models.HierarchySettings;
+import com.azure.resourcemanager.managementgroups.models.HierarchySettingsList;
+import com.azure.resourcemanager.managementgroups.models.HierarchySettingsOperations;
+
+public final class HierarchySettingsOperationsImpl implements HierarchySettingsOperations {
+ private static final ClientLogger LOGGER = new ClientLogger(HierarchySettingsOperationsImpl.class);
+
+ private final HierarchySettingsOperationsClient innerClient;
+
+ private final com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager;
+
+ public HierarchySettingsOperationsImpl(
+ HierarchySettingsOperationsClient innerClient,
+ com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager) {
+ this.innerClient = innerClient;
+ this.serviceManager = serviceManager;
+ }
+
+ public HierarchySettingsList list(String groupId) {
+ HierarchySettingsListInner inner = this.serviceClient().list(groupId);
+ if (inner != null) {
+ return new HierarchySettingsListImpl(inner, this.manager());
+ } else {
+ return null;
+ }
+ }
+
+ public Response listWithResponse(String groupId, Context context) {
+ Response inner = this.serviceClient().listWithResponse(groupId, context);
+ if (inner != null) {
+ return new SimpleResponse<>(
+ inner.getRequest(),
+ inner.getStatusCode(),
+ inner.getHeaders(),
+ new HierarchySettingsListImpl(inner.getValue(), this.manager()));
+ } else {
+ return null;
+ }
+ }
+
+ public HierarchySettings get(String groupId) {
+ HierarchySettingsInner inner = this.serviceClient().get(groupId);
+ if (inner != null) {
+ return new HierarchySettingsImpl(inner, this.manager());
+ } else {
+ return null;
+ }
+ }
+
+ public Response getWithResponse(String groupId, Context context) {
+ Response inner = this.serviceClient().getWithResponse(groupId, context);
+ if (inner != null) {
+ return new SimpleResponse<>(
+ inner.getRequest(),
+ inner.getStatusCode(),
+ inner.getHeaders(),
+ new HierarchySettingsImpl(inner.getValue(), this.manager()));
+ } else {
+ return null;
+ }
+ }
+
+ public HierarchySettings createOrUpdate(String groupId, CreateOrUpdateSettingsRequest createTenantSettingsRequest) {
+ HierarchySettingsInner inner = this.serviceClient().createOrUpdate(groupId, createTenantSettingsRequest);
+ if (inner != null) {
+ return new HierarchySettingsImpl(inner, this.manager());
+ } else {
+ return null;
+ }
+ }
+
+ public Response createOrUpdateWithResponse(
+ String groupId, CreateOrUpdateSettingsRequest createTenantSettingsRequest, Context context) {
+ Response inner =
+ this.serviceClient().createOrUpdateWithResponse(groupId, createTenantSettingsRequest, context);
+ if (inner != null) {
+ return new SimpleResponse<>(
+ inner.getRequest(),
+ inner.getStatusCode(),
+ inner.getHeaders(),
+ new HierarchySettingsImpl(inner.getValue(), this.manager()));
+ } else {
+ return null;
+ }
+ }
+
+ public HierarchySettings update(String groupId, CreateOrUpdateSettingsRequest createTenantSettingsRequest) {
+ HierarchySettingsInner inner = this.serviceClient().update(groupId, createTenantSettingsRequest);
+ if (inner != null) {
+ return new HierarchySettingsImpl(inner, this.manager());
+ } else {
+ return null;
+ }
+ }
+
+ public Response updateWithResponse(
+ String groupId, CreateOrUpdateSettingsRequest createTenantSettingsRequest, Context context) {
+ Response inner =
+ this.serviceClient().updateWithResponse(groupId, createTenantSettingsRequest, context);
+ if (inner != null) {
+ return new SimpleResponse<>(
+ inner.getRequest(),
+ inner.getStatusCode(),
+ inner.getHeaders(),
+ new HierarchySettingsImpl(inner.getValue(), this.manager()));
+ } else {
+ return null;
+ }
+ }
+
+ public void delete(String groupId) {
+ this.serviceClient().delete(groupId);
+ }
+
+ public Response deleteWithResponse(String groupId, Context context) {
+ return this.serviceClient().deleteWithResponse(groupId, context);
+ }
+
+ private HierarchySettingsOperationsClient serviceClient() {
+ return this.innerClient;
+ }
+
+ private com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager() {
+ return this.serviceManager;
+ }
+}
diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupImpl.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupImpl.java
new file mode 100644
index 000000000000..9aabedc0bca5
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupImpl.java
@@ -0,0 +1,66 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.managementgroups.implementation;
+
+import com.azure.resourcemanager.managementgroups.fluent.models.ManagementGroupInner;
+import com.azure.resourcemanager.managementgroups.models.ManagementGroup;
+import com.azure.resourcemanager.managementgroups.models.ManagementGroupChildInfo;
+import com.azure.resourcemanager.managementgroups.models.ManagementGroupDetails;
+import java.util.Collections;
+import java.util.List;
+
+public final class ManagementGroupImpl implements ManagementGroup {
+ private ManagementGroupInner innerObject;
+
+ private final com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager;
+
+ ManagementGroupImpl(
+ ManagementGroupInner innerObject,
+ com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager) {
+ this.innerObject = innerObject;
+ this.serviceManager = serviceManager;
+ }
+
+ public String id() {
+ return this.innerModel().id();
+ }
+
+ public String name() {
+ return this.innerModel().name();
+ }
+
+ public String type() {
+ return this.innerModel().type();
+ }
+
+ public String tenantId() {
+ return this.innerModel().tenantId();
+ }
+
+ public String displayName() {
+ return this.innerModel().displayName();
+ }
+
+ public ManagementGroupDetails details() {
+ return this.innerModel().details();
+ }
+
+ public List children() {
+ List inner = this.innerModel().children();
+ if (inner != null) {
+ return Collections.unmodifiableList(inner);
+ } else {
+ return Collections.emptyList();
+ }
+ }
+
+ public ManagementGroupInner innerModel() {
+ return this.innerObject;
+ }
+
+ private com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager() {
+ return this.serviceManager;
+ }
+}
diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupInfoImpl.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupInfoImpl.java
new file mode 100644
index 000000000000..2850fc7e8cae
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupInfoImpl.java
@@ -0,0 +1,49 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.managementgroups.implementation;
+
+import com.azure.resourcemanager.managementgroups.fluent.models.ManagementGroupInfoInner;
+import com.azure.resourcemanager.managementgroups.models.ManagementGroupInfo;
+
+public final class ManagementGroupInfoImpl implements ManagementGroupInfo {
+ private ManagementGroupInfoInner innerObject;
+
+ private final com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager;
+
+ ManagementGroupInfoImpl(
+ ManagementGroupInfoInner innerObject,
+ com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager) {
+ this.innerObject = innerObject;
+ this.serviceManager = serviceManager;
+ }
+
+ public String id() {
+ return this.innerModel().id();
+ }
+
+ public String type() {
+ return this.innerModel().type();
+ }
+
+ public String name() {
+ return this.innerModel().name();
+ }
+
+ public String tenantId() {
+ return this.innerModel().tenantId();
+ }
+
+ public String displayName() {
+ return this.innerModel().displayName();
+ }
+
+ public ManagementGroupInfoInner innerModel() {
+ return this.innerObject;
+ }
+
+ private com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager() {
+ return this.serviceManager;
+ }
+}
diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupSubscriptionsClientImpl.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupSubscriptionsClientImpl.java
new file mode 100644
index 000000000000..3cd3dbe4789a
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupSubscriptionsClientImpl.java
@@ -0,0 +1,849 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.managementgroups.implementation;
+
+import com.azure.core.annotation.Delete;
+import com.azure.core.annotation.ExpectedResponses;
+import com.azure.core.annotation.Get;
+import com.azure.core.annotation.HeaderParam;
+import com.azure.core.annotation.Headers;
+import com.azure.core.annotation.Host;
+import com.azure.core.annotation.HostParam;
+import com.azure.core.annotation.PathParam;
+import com.azure.core.annotation.Put;
+import com.azure.core.annotation.QueryParam;
+import com.azure.core.annotation.ReturnType;
+import com.azure.core.annotation.ServiceInterface;
+import com.azure.core.annotation.ServiceMethod;
+import com.azure.core.annotation.UnexpectedResponseExceptionType;
+import com.azure.core.http.rest.PagedFlux;
+import com.azure.core.http.rest.PagedIterable;
+import com.azure.core.http.rest.PagedResponse;
+import com.azure.core.http.rest.PagedResponseBase;
+import com.azure.core.http.rest.Response;
+import com.azure.core.http.rest.RestProxy;
+import com.azure.core.management.exception.ManagementException;
+import com.azure.core.util.Context;
+import com.azure.core.util.FluxUtil;
+import com.azure.resourcemanager.managementgroups.fluent.ManagementGroupSubscriptionsClient;
+import com.azure.resourcemanager.managementgroups.fluent.models.SubscriptionUnderManagementGroupInner;
+import com.azure.resourcemanager.managementgroups.models.ListSubscriptionUnderManagementGroup;
+import reactor.core.publisher.Mono;
+
+/** An instance of this class provides access to all the operations defined in ManagementGroupSubscriptionsClient. */
+public final class ManagementGroupSubscriptionsClientImpl implements ManagementGroupSubscriptionsClient {
+ /** The proxy service used to perform REST calls. */
+ private final ManagementGroupSubscriptionsService service;
+
+ /** The service client containing this operation class. */
+ private final ManagementGroupsApiImpl client;
+
+ /**
+ * Initializes an instance of ManagementGroupSubscriptionsClientImpl.
+ *
+ * @param client the instance of the service client containing this operation class.
+ */
+ ManagementGroupSubscriptionsClientImpl(ManagementGroupsApiImpl client) {
+ this.service =
+ RestProxy
+ .create(
+ ManagementGroupSubscriptionsService.class, client.getHttpPipeline(), client.getSerializerAdapter());
+ this.client = client;
+ }
+
+ /**
+ * The interface defining all the services for ManagementGroupsApiManagementGroupSubscriptions to be used by the
+ * proxy service to perform REST calls.
+ */
+ @Host("{$host}")
+ @ServiceInterface(name = "ManagementGroupsApiM")
+ private interface ManagementGroupSubscriptionsService {
+ @Headers({"Content-Type: application/json"})
+ @Put("/providers/Microsoft.Management/managementGroups/{groupId}/subscriptions/{subscriptionId}")
+ @ExpectedResponses({200})
+ @UnexpectedResponseExceptionType(ManagementException.class)
+ Mono> create(
+ @HostParam("$host") String endpoint,
+ @PathParam("groupId") String groupId,
+ @PathParam("subscriptionId") String subscriptionId,
+ @QueryParam("api-version") String apiVersion,
+ @HeaderParam("Cache-Control") String cacheControl,
+ @HeaderParam("Accept") String accept,
+ Context context);
+
+ @Headers({"Content-Type: application/json"})
+ @Delete("/providers/Microsoft.Management/managementGroups/{groupId}/subscriptions/{subscriptionId}")
+ @ExpectedResponses({200, 204})
+ @UnexpectedResponseExceptionType(ManagementException.class)
+ Mono> delete(
+ @HostParam("$host") String endpoint,
+ @PathParam("groupId") String groupId,
+ @PathParam("subscriptionId") String subscriptionId,
+ @QueryParam("api-version") String apiVersion,
+ @HeaderParam("Cache-Control") String cacheControl,
+ @HeaderParam("Accept") String accept,
+ Context context);
+
+ @Headers({"Content-Type: application/json"})
+ @Get("/providers/Microsoft.Management/managementGroups/{groupId}/subscriptions/{subscriptionId}")
+ @ExpectedResponses({200})
+ @UnexpectedResponseExceptionType(ManagementException.class)
+ Mono> getSubscription(
+ @HostParam("$host") String endpoint,
+ @PathParam("groupId") String groupId,
+ @PathParam("subscriptionId") String subscriptionId,
+ @QueryParam("api-version") String apiVersion,
+ @HeaderParam("Cache-Control") String cacheControl,
+ @HeaderParam("Accept") String accept,
+ Context context);
+
+ @Headers({"Content-Type: application/json"})
+ @Get("/providers/Microsoft.Management/managementGroups/{groupId}/subscriptions")
+ @ExpectedResponses({200})
+ @UnexpectedResponseExceptionType(ManagementException.class)
+ Mono> getSubscriptionsUnderManagementGroup(
+ @HostParam("$host") String endpoint,
+ @PathParam("groupId") String groupId,
+ @QueryParam("api-version") String apiVersion,
+ @QueryParam("$skiptoken") String skiptoken,
+ @HeaderParam("Accept") String accept,
+ Context context);
+
+ @Headers({"Content-Type: application/json"})
+ @Get("{nextLink}")
+ @ExpectedResponses({200})
+ @UnexpectedResponseExceptionType(ManagementException.class)
+ Mono> getSubscriptionsUnderManagementGroupNext(
+ @PathParam(value = "nextLink", encoded = true) String nextLink,
+ @HostParam("$host") String endpoint,
+ @HeaderParam("Accept") String accept,
+ Context context);
+ }
+
+ /**
+ * Associates existing subscription with the management group.
+ *
+ * @param groupId Management Group ID.
+ * @param subscriptionId Subscription ID.
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the details of subscription under management group along with {@link Response} on successful completion
+ * of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono> createWithResponseAsync(
+ String groupId, String subscriptionId, String cacheControl) {
+ if (this.client.getEndpoint() == null) {
+ return Mono
+ .error(
+ new IllegalArgumentException(
+ "Parameter this.client.getEndpoint() is required and cannot be null."));
+ }
+ if (groupId == null) {
+ return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null."));
+ }
+ if (subscriptionId == null) {
+ return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."));
+ }
+ final String accept = "application/json";
+ return FluxUtil
+ .withContext(
+ context ->
+ service
+ .create(
+ this.client.getEndpoint(),
+ groupId,
+ subscriptionId,
+ this.client.getApiVersion(),
+ cacheControl,
+ accept,
+ context))
+ .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
+ }
+
+ /**
+ * Associates existing subscription with the management group.
+ *
+ * @param groupId Management Group ID.
+ * @param subscriptionId Subscription ID.
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the details of subscription under management group along with {@link Response} on successful completion
+ * of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono> createWithResponseAsync(
+ String groupId, String subscriptionId, String cacheControl, Context context) {
+ if (this.client.getEndpoint() == null) {
+ return Mono
+ .error(
+ new IllegalArgumentException(
+ "Parameter this.client.getEndpoint() is required and cannot be null."));
+ }
+ if (groupId == null) {
+ return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null."));
+ }
+ if (subscriptionId == null) {
+ return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."));
+ }
+ final String accept = "application/json";
+ context = this.client.mergeContext(context);
+ return service
+ .create(
+ this.client.getEndpoint(),
+ groupId,
+ subscriptionId,
+ this.client.getApiVersion(),
+ cacheControl,
+ accept,
+ context);
+ }
+
+ /**
+ * Associates existing subscription with the management group.
+ *
+ * @param groupId Management Group ID.
+ * @param subscriptionId Subscription ID.
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the details of subscription under management group on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono createAsync(
+ String groupId, String subscriptionId, String cacheControl) {
+ return createWithResponseAsync(groupId, subscriptionId, cacheControl)
+ .flatMap(res -> Mono.justOrEmpty(res.getValue()));
+ }
+
+ /**
+ * Associates existing subscription with the management group.
+ *
+ * @param groupId Management Group ID.
+ * @param subscriptionId Subscription ID.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the details of subscription under management group on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono createAsync(String groupId, String subscriptionId) {
+ final String cacheControl = null;
+ return createWithResponseAsync(groupId, subscriptionId, cacheControl)
+ .flatMap(res -> Mono.justOrEmpty(res.getValue()));
+ }
+
+ /**
+ * Associates existing subscription with the management group.
+ *
+ * @param groupId Management Group ID.
+ * @param subscriptionId Subscription ID.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the details of subscription under management group.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public SubscriptionUnderManagementGroupInner create(String groupId, String subscriptionId) {
+ final String cacheControl = null;
+ return createAsync(groupId, subscriptionId, cacheControl).block();
+ }
+
+ /**
+ * Associates existing subscription with the management group.
+ *
+ * @param groupId Management Group ID.
+ * @param subscriptionId Subscription ID.
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the details of subscription under management group along with {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response createWithResponse(
+ String groupId, String subscriptionId, String cacheControl, Context context) {
+ return createWithResponseAsync(groupId, subscriptionId, cacheControl, context).block();
+ }
+
+ /**
+ * De-associates subscription from the management group.
+ *
+ * @param groupId Management Group ID.
+ * @param subscriptionId Subscription ID.
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the {@link Response} on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono> deleteWithResponseAsync(String groupId, String subscriptionId, String cacheControl) {
+ if (this.client.getEndpoint() == null) {
+ return Mono
+ .error(
+ new IllegalArgumentException(
+ "Parameter this.client.getEndpoint() is required and cannot be null."));
+ }
+ if (groupId == null) {
+ return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null."));
+ }
+ if (subscriptionId == null) {
+ return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."));
+ }
+ final String accept = "application/json";
+ return FluxUtil
+ .withContext(
+ context ->
+ service
+ .delete(
+ this.client.getEndpoint(),
+ groupId,
+ subscriptionId,
+ this.client.getApiVersion(),
+ cacheControl,
+ accept,
+ context))
+ .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
+ }
+
+ /**
+ * De-associates subscription from the management group.
+ *
+ * @param groupId Management Group ID.
+ * @param subscriptionId Subscription ID.
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the {@link Response} on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono> deleteWithResponseAsync(
+ String groupId, String subscriptionId, String cacheControl, Context context) {
+ if (this.client.getEndpoint() == null) {
+ return Mono
+ .error(
+ new IllegalArgumentException(
+ "Parameter this.client.getEndpoint() is required and cannot be null."));
+ }
+ if (groupId == null) {
+ return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null."));
+ }
+ if (subscriptionId == null) {
+ return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."));
+ }
+ final String accept = "application/json";
+ context = this.client.mergeContext(context);
+ return service
+ .delete(
+ this.client.getEndpoint(),
+ groupId,
+ subscriptionId,
+ this.client.getApiVersion(),
+ cacheControl,
+ accept,
+ context);
+ }
+
+ /**
+ * De-associates subscription from the management group.
+ *
+ * @param groupId Management Group ID.
+ * @param subscriptionId Subscription ID.
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return A {@link Mono} that completes when a successful response is received.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono deleteAsync(String groupId, String subscriptionId, String cacheControl) {
+ return deleteWithResponseAsync(groupId, subscriptionId, cacheControl).flatMap(ignored -> Mono.empty());
+ }
+
+ /**
+ * De-associates subscription from the management group.
+ *
+ * @param groupId Management Group ID.
+ * @param subscriptionId Subscription ID.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return A {@link Mono} that completes when a successful response is received.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono deleteAsync(String groupId, String subscriptionId) {
+ final String cacheControl = null;
+ return deleteWithResponseAsync(groupId, subscriptionId, cacheControl).flatMap(ignored -> Mono.empty());
+ }
+
+ /**
+ * De-associates subscription from the management group.
+ *
+ * @param groupId Management Group ID.
+ * @param subscriptionId Subscription ID.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public void delete(String groupId, String subscriptionId) {
+ final String cacheControl = null;
+ deleteAsync(groupId, subscriptionId, cacheControl).block();
+ }
+
+ /**
+ * De-associates subscription from the management group.
+ *
+ * @param groupId Management Group ID.
+ * @param subscriptionId Subscription ID.
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response deleteWithResponse(
+ String groupId, String subscriptionId, String cacheControl, Context context) {
+ return deleteWithResponseAsync(groupId, subscriptionId, cacheControl, context).block();
+ }
+
+ /**
+ * Retrieves details about given subscription which is associated with the management group.
+ *
+ * @param groupId Management Group ID.
+ * @param subscriptionId Subscription ID.
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the details of subscription under management group along with {@link Response} on successful completion
+ * of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono> getSubscriptionWithResponseAsync(
+ String groupId, String subscriptionId, String cacheControl) {
+ if (this.client.getEndpoint() == null) {
+ return Mono
+ .error(
+ new IllegalArgumentException(
+ "Parameter this.client.getEndpoint() is required and cannot be null."));
+ }
+ if (groupId == null) {
+ return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null."));
+ }
+ if (subscriptionId == null) {
+ return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."));
+ }
+ final String accept = "application/json";
+ return FluxUtil
+ .withContext(
+ context ->
+ service
+ .getSubscription(
+ this.client.getEndpoint(),
+ groupId,
+ subscriptionId,
+ this.client.getApiVersion(),
+ cacheControl,
+ accept,
+ context))
+ .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
+ }
+
+ /**
+ * Retrieves details about given subscription which is associated with the management group.
+ *
+ * @param groupId Management Group ID.
+ * @param subscriptionId Subscription ID.
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the details of subscription under management group along with {@link Response} on successful completion
+ * of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono> getSubscriptionWithResponseAsync(
+ String groupId, String subscriptionId, String cacheControl, Context context) {
+ if (this.client.getEndpoint() == null) {
+ return Mono
+ .error(
+ new IllegalArgumentException(
+ "Parameter this.client.getEndpoint() is required and cannot be null."));
+ }
+ if (groupId == null) {
+ return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null."));
+ }
+ if (subscriptionId == null) {
+ return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."));
+ }
+ final String accept = "application/json";
+ context = this.client.mergeContext(context);
+ return service
+ .getSubscription(
+ this.client.getEndpoint(),
+ groupId,
+ subscriptionId,
+ this.client.getApiVersion(),
+ cacheControl,
+ accept,
+ context);
+ }
+
+ /**
+ * Retrieves details about given subscription which is associated with the management group.
+ *
+ * @param groupId Management Group ID.
+ * @param subscriptionId Subscription ID.
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the details of subscription under management group on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono getSubscriptionAsync(
+ String groupId, String subscriptionId, String cacheControl) {
+ return getSubscriptionWithResponseAsync(groupId, subscriptionId, cacheControl)
+ .flatMap(res -> Mono.justOrEmpty(res.getValue()));
+ }
+
+ /**
+ * Retrieves details about given subscription which is associated with the management group.
+ *
+ * @param groupId Management Group ID.
+ * @param subscriptionId Subscription ID.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the details of subscription under management group on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono getSubscriptionAsync(String groupId, String subscriptionId) {
+ final String cacheControl = null;
+ return getSubscriptionWithResponseAsync(groupId, subscriptionId, cacheControl)
+ .flatMap(res -> Mono.justOrEmpty(res.getValue()));
+ }
+
+ /**
+ * Retrieves details about given subscription which is associated with the management group.
+ *
+ * @param groupId Management Group ID.
+ * @param subscriptionId Subscription ID.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the details of subscription under management group.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public SubscriptionUnderManagementGroupInner getSubscription(String groupId, String subscriptionId) {
+ final String cacheControl = null;
+ return getSubscriptionAsync(groupId, subscriptionId, cacheControl).block();
+ }
+
+ /**
+ * Retrieves details about given subscription which is associated with the management group.
+ *
+ * @param groupId Management Group ID.
+ * @param subscriptionId Subscription ID.
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the details of subscription under management group along with {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response getSubscriptionWithResponse(
+ String groupId, String subscriptionId, String cacheControl, Context context) {
+ return getSubscriptionWithResponseAsync(groupId, subscriptionId, cacheControl, context).block();
+ }
+
+ /**
+ * Retrieves details about all subscriptions which are associated with the management group.
+ *
+ * @param groupId Management Group ID.
+ * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a
+ * previous response contains a nextLink element, the value of the nextLink element will include a token
+ * parameter that specifies a starting point to use for subsequent calls.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the details of all subscriptions under management group along with {@link PagedResponse} on successful
+ * completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono>
+ getSubscriptionsUnderManagementGroupSinglePageAsync(String groupId, String skiptoken) {
+ if (this.client.getEndpoint() == null) {
+ return Mono
+ .error(
+ new IllegalArgumentException(
+ "Parameter this.client.getEndpoint() is required and cannot be null."));
+ }
+ if (groupId == null) {
+ return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null."));
+ }
+ final String accept = "application/json";
+ return FluxUtil
+ .withContext(
+ context ->
+ service
+ .getSubscriptionsUnderManagementGroup(
+ this.client.getEndpoint(),
+ groupId,
+ this.client.getApiVersion(),
+ skiptoken,
+ accept,
+ context))
+ .>map(
+ res ->
+ new PagedResponseBase<>(
+ res.getRequest(),
+ res.getStatusCode(),
+ res.getHeaders(),
+ res.getValue().value(),
+ res.getValue().nextLink(),
+ null))
+ .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
+ }
+
+ /**
+ * Retrieves details about all subscriptions which are associated with the management group.
+ *
+ * @param groupId Management Group ID.
+ * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a
+ * previous response contains a nextLink element, the value of the nextLink element will include a token
+ * parameter that specifies a starting point to use for subsequent calls.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the details of all subscriptions under management group along with {@link PagedResponse} on successful
+ * completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono>
+ getSubscriptionsUnderManagementGroupSinglePageAsync(String groupId, String skiptoken, Context context) {
+ if (this.client.getEndpoint() == null) {
+ return Mono
+ .error(
+ new IllegalArgumentException(
+ "Parameter this.client.getEndpoint() is required and cannot be null."));
+ }
+ if (groupId == null) {
+ return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null."));
+ }
+ final String accept = "application/json";
+ context = this.client.mergeContext(context);
+ return service
+ .getSubscriptionsUnderManagementGroup(
+ this.client.getEndpoint(), groupId, this.client.getApiVersion(), skiptoken, accept, context)
+ .map(
+ res ->
+ new PagedResponseBase<>(
+ res.getRequest(),
+ res.getStatusCode(),
+ res.getHeaders(),
+ res.getValue().value(),
+ res.getValue().nextLink(),
+ null));
+ }
+
+ /**
+ * Retrieves details about all subscriptions which are associated with the management group.
+ *
+ * @param groupId Management Group ID.
+ * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a
+ * previous response contains a nextLink element, the value of the nextLink element will include a token
+ * parameter that specifies a starting point to use for subsequent calls.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the details of all subscriptions under management group as paginated response with {@link PagedFlux}.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ private PagedFlux getSubscriptionsUnderManagementGroupAsync(
+ String groupId, String skiptoken) {
+ return new PagedFlux<>(
+ () -> getSubscriptionsUnderManagementGroupSinglePageAsync(groupId, skiptoken),
+ nextLink -> getSubscriptionsUnderManagementGroupNextSinglePageAsync(nextLink));
+ }
+
+ /**
+ * Retrieves details about all subscriptions which are associated with the management group.
+ *
+ * @param groupId Management Group ID.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the details of all subscriptions under management group as paginated response with {@link PagedFlux}.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ private PagedFlux getSubscriptionsUnderManagementGroupAsync(String groupId) {
+ final String skiptoken = null;
+ return new PagedFlux<>(
+ () -> getSubscriptionsUnderManagementGroupSinglePageAsync(groupId, skiptoken),
+ nextLink -> getSubscriptionsUnderManagementGroupNextSinglePageAsync(nextLink));
+ }
+
+ /**
+ * Retrieves details about all subscriptions which are associated with the management group.
+ *
+ * @param groupId Management Group ID.
+ * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a
+ * previous response contains a nextLink element, the value of the nextLink element will include a token
+ * parameter that specifies a starting point to use for subsequent calls.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the details of all subscriptions under management group as paginated response with {@link PagedFlux}.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ private PagedFlux getSubscriptionsUnderManagementGroupAsync(
+ String groupId, String skiptoken, Context context) {
+ return new PagedFlux<>(
+ () -> getSubscriptionsUnderManagementGroupSinglePageAsync(groupId, skiptoken, context),
+ nextLink -> getSubscriptionsUnderManagementGroupNextSinglePageAsync(nextLink, context));
+ }
+
+ /**
+ * Retrieves details about all subscriptions which are associated with the management group.
+ *
+ * @param groupId Management Group ID.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the details of all subscriptions under management group as paginated response with {@link PagedIterable}.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedIterable getSubscriptionsUnderManagementGroup(String groupId) {
+ final String skiptoken = null;
+ return new PagedIterable<>(getSubscriptionsUnderManagementGroupAsync(groupId, skiptoken));
+ }
+
+ /**
+ * Retrieves details about all subscriptions which are associated with the management group.
+ *
+ * @param groupId Management Group ID.
+ * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a
+ * previous response contains a nextLink element, the value of the nextLink element will include a token
+ * parameter that specifies a starting point to use for subsequent calls.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the details of all subscriptions under management group as paginated response with {@link PagedIterable}.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedIterable getSubscriptionsUnderManagementGroup(
+ String groupId, String skiptoken, Context context) {
+ return new PagedIterable<>(getSubscriptionsUnderManagementGroupAsync(groupId, skiptoken, context));
+ }
+
+ /**
+ * Get the next page of items.
+ *
+ * @param nextLink The nextLink parameter.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the details of all subscriptions under management group along with {@link PagedResponse} on successful
+ * completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono>
+ getSubscriptionsUnderManagementGroupNextSinglePageAsync(String nextLink) {
+ if (nextLink == null) {
+ return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
+ }
+ if (this.client.getEndpoint() == null) {
+ return Mono
+ .error(
+ new IllegalArgumentException(
+ "Parameter this.client.getEndpoint() is required and cannot be null."));
+ }
+ final String accept = "application/json";
+ return FluxUtil
+ .withContext(
+ context ->
+ service
+ .getSubscriptionsUnderManagementGroupNext(nextLink, this.client.getEndpoint(), accept, context))
+ .>map(
+ res ->
+ new PagedResponseBase<>(
+ res.getRequest(),
+ res.getStatusCode(),
+ res.getHeaders(),
+ res.getValue().value(),
+ res.getValue().nextLink(),
+ null))
+ .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
+ }
+
+ /**
+ * Get the next page of items.
+ *
+ * @param nextLink The nextLink parameter.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the details of all subscriptions under management group along with {@link PagedResponse} on successful
+ * completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono>
+ getSubscriptionsUnderManagementGroupNextSinglePageAsync(String nextLink, Context context) {
+ if (nextLink == null) {
+ return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
+ }
+ if (this.client.getEndpoint() == null) {
+ return Mono
+ .error(
+ new IllegalArgumentException(
+ "Parameter this.client.getEndpoint() is required and cannot be null."));
+ }
+ final String accept = "application/json";
+ context = this.client.mergeContext(context);
+ return service
+ .getSubscriptionsUnderManagementGroupNext(nextLink, this.client.getEndpoint(), accept, context)
+ .map(
+ res ->
+ new PagedResponseBase<>(
+ res.getRequest(),
+ res.getStatusCode(),
+ res.getHeaders(),
+ res.getValue().value(),
+ res.getValue().nextLink(),
+ null));
+ }
+}
diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupSubscriptionsImpl.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupSubscriptionsImpl.java
new file mode 100644
index 000000000000..8b13448178a0
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupSubscriptionsImpl.java
@@ -0,0 +1,108 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.managementgroups.implementation;
+
+import com.azure.core.http.rest.PagedIterable;
+import com.azure.core.http.rest.Response;
+import com.azure.core.http.rest.SimpleResponse;
+import com.azure.core.util.Context;
+import com.azure.core.util.logging.ClientLogger;
+import com.azure.resourcemanager.managementgroups.fluent.ManagementGroupSubscriptionsClient;
+import com.azure.resourcemanager.managementgroups.fluent.models.SubscriptionUnderManagementGroupInner;
+import com.azure.resourcemanager.managementgroups.models.ManagementGroupSubscriptions;
+import com.azure.resourcemanager.managementgroups.models.SubscriptionUnderManagementGroup;
+
+public final class ManagementGroupSubscriptionsImpl implements ManagementGroupSubscriptions {
+ private static final ClientLogger LOGGER = new ClientLogger(ManagementGroupSubscriptionsImpl.class);
+
+ private final ManagementGroupSubscriptionsClient innerClient;
+
+ private final com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager;
+
+ public ManagementGroupSubscriptionsImpl(
+ ManagementGroupSubscriptionsClient innerClient,
+ com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager) {
+ this.innerClient = innerClient;
+ this.serviceManager = serviceManager;
+ }
+
+ public SubscriptionUnderManagementGroup create(String groupId, String subscriptionId) {
+ SubscriptionUnderManagementGroupInner inner = this.serviceClient().create(groupId, subscriptionId);
+ if (inner != null) {
+ return new SubscriptionUnderManagementGroupImpl(inner, this.manager());
+ } else {
+ return null;
+ }
+ }
+
+ public Response createWithResponse(
+ String groupId, String subscriptionId, String cacheControl, Context context) {
+ Response inner =
+ this.serviceClient().createWithResponse(groupId, subscriptionId, cacheControl, context);
+ if (inner != null) {
+ return new SimpleResponse<>(
+ inner.getRequest(),
+ inner.getStatusCode(),
+ inner.getHeaders(),
+ new SubscriptionUnderManagementGroupImpl(inner.getValue(), this.manager()));
+ } else {
+ return null;
+ }
+ }
+
+ public void delete(String groupId, String subscriptionId) {
+ this.serviceClient().delete(groupId, subscriptionId);
+ }
+
+ public Response deleteWithResponse(
+ String groupId, String subscriptionId, String cacheControl, Context context) {
+ return this.serviceClient().deleteWithResponse(groupId, subscriptionId, cacheControl, context);
+ }
+
+ public SubscriptionUnderManagementGroup getSubscription(String groupId, String subscriptionId) {
+ SubscriptionUnderManagementGroupInner inner = this.serviceClient().getSubscription(groupId, subscriptionId);
+ if (inner != null) {
+ return new SubscriptionUnderManagementGroupImpl(inner, this.manager());
+ } else {
+ return null;
+ }
+ }
+
+ public Response getSubscriptionWithResponse(
+ String groupId, String subscriptionId, String cacheControl, Context context) {
+ Response inner =
+ this.serviceClient().getSubscriptionWithResponse(groupId, subscriptionId, cacheControl, context);
+ if (inner != null) {
+ return new SimpleResponse<>(
+ inner.getRequest(),
+ inner.getStatusCode(),
+ inner.getHeaders(),
+ new SubscriptionUnderManagementGroupImpl(inner.getValue(), this.manager()));
+ } else {
+ return null;
+ }
+ }
+
+ public PagedIterable getSubscriptionsUnderManagementGroup(String groupId) {
+ PagedIterable inner =
+ this.serviceClient().getSubscriptionsUnderManagementGroup(groupId);
+ return Utils.mapPage(inner, inner1 -> new SubscriptionUnderManagementGroupImpl(inner1, this.manager()));
+ }
+
+ public PagedIterable getSubscriptionsUnderManagementGroup(
+ String groupId, String skiptoken, Context context) {
+ PagedIterable inner =
+ this.serviceClient().getSubscriptionsUnderManagementGroup(groupId, skiptoken, context);
+ return Utils.mapPage(inner, inner1 -> new SubscriptionUnderManagementGroupImpl(inner1, this.manager()));
+ }
+
+ private ManagementGroupSubscriptionsClient serviceClient() {
+ return this.innerClient;
+ }
+
+ private com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager() {
+ return this.serviceManager;
+ }
+}
diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupsApiBuilder.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupsApiBuilder.java
new file mode 100644
index 000000000000..e1d1fb59c548
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupsApiBuilder.java
@@ -0,0 +1,125 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.managementgroups.implementation;
+
+import com.azure.core.annotation.ServiceClientBuilder;
+import com.azure.core.http.HttpPipeline;
+import com.azure.core.http.HttpPipelineBuilder;
+import com.azure.core.http.policy.RetryPolicy;
+import com.azure.core.http.policy.UserAgentPolicy;
+import com.azure.core.management.AzureEnvironment;
+import com.azure.core.management.serializer.SerializerFactory;
+import com.azure.core.util.serializer.SerializerAdapter;
+import java.time.Duration;
+
+/** A builder for creating a new instance of the ManagementGroupsApiImpl type. */
+@ServiceClientBuilder(serviceClients = {ManagementGroupsApiImpl.class})
+public final class ManagementGroupsApiBuilder {
+ /*
+ * server parameter
+ */
+ private String endpoint;
+
+ /**
+ * Sets server parameter.
+ *
+ * @param endpoint the endpoint value.
+ * @return the ManagementGroupsApiBuilder.
+ */
+ public ManagementGroupsApiBuilder endpoint(String endpoint) {
+ this.endpoint = endpoint;
+ return this;
+ }
+
+ /*
+ * The environment to connect to
+ */
+ private AzureEnvironment environment;
+
+ /**
+ * Sets The environment to connect to.
+ *
+ * @param environment the environment value.
+ * @return the ManagementGroupsApiBuilder.
+ */
+ public ManagementGroupsApiBuilder environment(AzureEnvironment environment) {
+ this.environment = environment;
+ return this;
+ }
+
+ /*
+ * The HTTP pipeline to send requests through
+ */
+ private HttpPipeline pipeline;
+
+ /**
+ * Sets The HTTP pipeline to send requests through.
+ *
+ * @param pipeline the pipeline value.
+ * @return the ManagementGroupsApiBuilder.
+ */
+ public ManagementGroupsApiBuilder pipeline(HttpPipeline pipeline) {
+ this.pipeline = pipeline;
+ return this;
+ }
+
+ /*
+ * The default poll interval for long-running operation
+ */
+ private Duration defaultPollInterval;
+
+ /**
+ * Sets The default poll interval for long-running operation.
+ *
+ * @param defaultPollInterval the defaultPollInterval value.
+ * @return the ManagementGroupsApiBuilder.
+ */
+ public ManagementGroupsApiBuilder defaultPollInterval(Duration defaultPollInterval) {
+ this.defaultPollInterval = defaultPollInterval;
+ return this;
+ }
+
+ /*
+ * The serializer to serialize an object into a string
+ */
+ private SerializerAdapter serializerAdapter;
+
+ /**
+ * Sets The serializer to serialize an object into a string.
+ *
+ * @param serializerAdapter the serializerAdapter value.
+ * @return the ManagementGroupsApiBuilder.
+ */
+ public ManagementGroupsApiBuilder serializerAdapter(SerializerAdapter serializerAdapter) {
+ this.serializerAdapter = serializerAdapter;
+ return this;
+ }
+
+ /**
+ * Builds an instance of ManagementGroupsApiImpl with the provided parameters.
+ *
+ * @return an instance of ManagementGroupsApiImpl.
+ */
+ public ManagementGroupsApiImpl buildClient() {
+ if (endpoint == null) {
+ this.endpoint = "https://management.azure.com";
+ }
+ if (environment == null) {
+ this.environment = AzureEnvironment.AZURE;
+ }
+ if (pipeline == null) {
+ this.pipeline = new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build();
+ }
+ if (defaultPollInterval == null) {
+ this.defaultPollInterval = Duration.ofSeconds(30);
+ }
+ if (serializerAdapter == null) {
+ this.serializerAdapter = SerializerFactory.createDefaultManagementSerializerAdapter();
+ }
+ ManagementGroupsApiImpl client =
+ new ManagementGroupsApiImpl(pipeline, serializerAdapter, defaultPollInterval, environment, endpoint);
+ return client;
+ }
+}
diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupsApiImpl.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupsApiImpl.java
new file mode 100644
index 000000000000..7f97efeb38b3
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupsApiImpl.java
@@ -0,0 +1,345 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.managementgroups.implementation;
+
+import com.azure.core.annotation.ServiceClient;
+import com.azure.core.http.HttpHeaders;
+import com.azure.core.http.HttpPipeline;
+import com.azure.core.http.HttpResponse;
+import com.azure.core.http.rest.Response;
+import com.azure.core.management.AzureEnvironment;
+import com.azure.core.management.exception.ManagementError;
+import com.azure.core.management.exception.ManagementException;
+import com.azure.core.management.polling.PollResult;
+import com.azure.core.management.polling.PollerFactory;
+import com.azure.core.util.Context;
+import com.azure.core.util.CoreUtils;
+import com.azure.core.util.logging.ClientLogger;
+import com.azure.core.util.polling.AsyncPollResponse;
+import com.azure.core.util.polling.LongRunningOperationStatus;
+import com.azure.core.util.polling.PollerFlux;
+import com.azure.core.util.serializer.SerializerAdapter;
+import com.azure.core.util.serializer.SerializerEncoding;
+import com.azure.resourcemanager.managementgroups.fluent.EntitiesClient;
+import com.azure.resourcemanager.managementgroups.fluent.HierarchySettingsOperationsClient;
+import com.azure.resourcemanager.managementgroups.fluent.ManagementGroupSubscriptionsClient;
+import com.azure.resourcemanager.managementgroups.fluent.ManagementGroupsApi;
+import com.azure.resourcemanager.managementgroups.fluent.ManagementGroupsClient;
+import com.azure.resourcemanager.managementgroups.fluent.OperationsClient;
+import com.azure.resourcemanager.managementgroups.fluent.ResourceProvidersClient;
+import java.io.IOException;
+import java.lang.reflect.Type;
+import java.nio.ByteBuffer;
+import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
+import java.time.Duration;
+import reactor.core.publisher.Flux;
+import reactor.core.publisher.Mono;
+
+/** Initializes a new instance of the ManagementGroupsApiImpl type. */
+@ServiceClient(builder = ManagementGroupsApiBuilder.class)
+public final class ManagementGroupsApiImpl implements ManagementGroupsApi {
+ /** server parameter. */
+ private final String endpoint;
+
+ /**
+ * Gets server parameter.
+ *
+ * @return the endpoint value.
+ */
+ public String getEndpoint() {
+ return this.endpoint;
+ }
+
+ /** Api Version. */
+ private final String apiVersion;
+
+ /**
+ * Gets Api Version.
+ *
+ * @return the apiVersion value.
+ */
+ public String getApiVersion() {
+ return this.apiVersion;
+ }
+
+ /** The HTTP pipeline to send requests through. */
+ private final HttpPipeline httpPipeline;
+
+ /**
+ * Gets The HTTP pipeline to send requests through.
+ *
+ * @return the httpPipeline value.
+ */
+ public HttpPipeline getHttpPipeline() {
+ return this.httpPipeline;
+ }
+
+ /** The serializer to serialize an object into a string. */
+ private final SerializerAdapter serializerAdapter;
+
+ /**
+ * Gets The serializer to serialize an object into a string.
+ *
+ * @return the serializerAdapter value.
+ */
+ SerializerAdapter getSerializerAdapter() {
+ return this.serializerAdapter;
+ }
+
+ /** The default poll interval for long-running operation. */
+ private final Duration defaultPollInterval;
+
+ /**
+ * Gets The default poll interval for long-running operation.
+ *
+ * @return the defaultPollInterval value.
+ */
+ public Duration getDefaultPollInterval() {
+ return this.defaultPollInterval;
+ }
+
+ /** The ManagementGroupsClient object to access its operations. */
+ private final ManagementGroupsClient managementGroups;
+
+ /**
+ * Gets the ManagementGroupsClient object to access its operations.
+ *
+ * @return the ManagementGroupsClient object.
+ */
+ public ManagementGroupsClient getManagementGroups() {
+ return this.managementGroups;
+ }
+
+ /** The ManagementGroupSubscriptionsClient object to access its operations. */
+ private final ManagementGroupSubscriptionsClient managementGroupSubscriptions;
+
+ /**
+ * Gets the ManagementGroupSubscriptionsClient object to access its operations.
+ *
+ * @return the ManagementGroupSubscriptionsClient object.
+ */
+ public ManagementGroupSubscriptionsClient getManagementGroupSubscriptions() {
+ return this.managementGroupSubscriptions;
+ }
+
+ /** The HierarchySettingsOperationsClient object to access its operations. */
+ private final HierarchySettingsOperationsClient hierarchySettingsOperations;
+
+ /**
+ * Gets the HierarchySettingsOperationsClient object to access its operations.
+ *
+ * @return the HierarchySettingsOperationsClient object.
+ */
+ public HierarchySettingsOperationsClient getHierarchySettingsOperations() {
+ return this.hierarchySettingsOperations;
+ }
+
+ /** The OperationsClient object to access its operations. */
+ private final OperationsClient operations;
+
+ /**
+ * Gets the OperationsClient object to access its operations.
+ *
+ * @return the OperationsClient object.
+ */
+ public OperationsClient getOperations() {
+ return this.operations;
+ }
+
+ /** The ResourceProvidersClient object to access its operations. */
+ private final ResourceProvidersClient resourceProviders;
+
+ /**
+ * Gets the ResourceProvidersClient object to access its operations.
+ *
+ * @return the ResourceProvidersClient object.
+ */
+ public ResourceProvidersClient getResourceProviders() {
+ return this.resourceProviders;
+ }
+
+ /** The EntitiesClient object to access its operations. */
+ private final EntitiesClient entities;
+
+ /**
+ * Gets the EntitiesClient object to access its operations.
+ *
+ * @return the EntitiesClient object.
+ */
+ public EntitiesClient getEntities() {
+ return this.entities;
+ }
+
+ /**
+ * Initializes an instance of ManagementGroupsApi client.
+ *
+ * @param httpPipeline The HTTP pipeline to send requests through.
+ * @param serializerAdapter The serializer to serialize an object into a string.
+ * @param defaultPollInterval The default poll interval for long-running operation.
+ * @param environment The Azure environment.
+ * @param endpoint server parameter.
+ */
+ ManagementGroupsApiImpl(
+ HttpPipeline httpPipeline,
+ SerializerAdapter serializerAdapter,
+ Duration defaultPollInterval,
+ AzureEnvironment environment,
+ String endpoint) {
+ this.httpPipeline = httpPipeline;
+ this.serializerAdapter = serializerAdapter;
+ this.defaultPollInterval = defaultPollInterval;
+ this.endpoint = endpoint;
+ this.apiVersion = "2021-04-01";
+ this.managementGroups = new ManagementGroupsClientImpl(this);
+ this.managementGroupSubscriptions = new ManagementGroupSubscriptionsClientImpl(this);
+ this.hierarchySettingsOperations = new HierarchySettingsOperationsClientImpl(this);
+ this.operations = new OperationsClientImpl(this);
+ this.resourceProviders = new ResourceProvidersClientImpl(this);
+ this.entities = new EntitiesClientImpl(this);
+ }
+
+ /**
+ * Gets default client context.
+ *
+ * @return the default client context.
+ */
+ public Context getContext() {
+ return Context.NONE;
+ }
+
+ /**
+ * Merges default client context with provided context.
+ *
+ * @param context the context to be merged with default client context.
+ * @return the merged context.
+ */
+ public Context mergeContext(Context context) {
+ return CoreUtils.mergeContexts(this.getContext(), context);
+ }
+
+ /**
+ * Gets long running operation result.
+ *
+ * @param activationResponse the response of activation operation.
+ * @param httpPipeline the http pipeline.
+ * @param pollResultType type of poll result.
+ * @param finalResultType type of final result.
+ * @param context the context shared by all requests.
+ * @param type of poll result.
+ * @param type of final result.
+ * @return poller flux for poll result and final result.
+ */
+ public PollerFlux, U> getLroResult(
+ Mono>> activationResponse,
+ HttpPipeline httpPipeline,
+ Type pollResultType,
+ Type finalResultType,
+ Context context) {
+ return PollerFactory
+ .create(
+ serializerAdapter,
+ httpPipeline,
+ pollResultType,
+ finalResultType,
+ defaultPollInterval,
+ activationResponse,
+ context);
+ }
+
+ /**
+ * Gets the final result, or an error, based on last async poll response.
+ *
+ * @param response the last async poll response.
+ * @param type of poll result.
+ * @param type of final result.
+ * @return the final result, or an error.
+ */
+ public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) {
+ if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) {
+ String errorMessage;
+ ManagementError managementError = null;
+ HttpResponse errorResponse = null;
+ PollResult.Error lroError = response.getValue().getError();
+ if (lroError != null) {
+ errorResponse =
+ new HttpResponseImpl(
+ lroError.getResponseStatusCode(), lroError.getResponseHeaders(), lroError.getResponseBody());
+
+ errorMessage = response.getValue().getError().getMessage();
+ String errorBody = response.getValue().getError().getResponseBody();
+ if (errorBody != null) {
+ // try to deserialize error body to ManagementError
+ try {
+ managementError =
+ this
+ .getSerializerAdapter()
+ .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON);
+ if (managementError.getCode() == null || managementError.getMessage() == null) {
+ managementError = null;
+ }
+ } catch (IOException | RuntimeException ioe) {
+ LOGGER.logThrowableAsWarning(ioe);
+ }
+ }
+ } else {
+ // fallback to default error message
+ errorMessage = "Long running operation failed.";
+ }
+ if (managementError == null) {
+ // fallback to default ManagementError
+ managementError = new ManagementError(response.getStatus().toString(), errorMessage);
+ }
+ return Mono.error(new ManagementException(errorMessage, errorResponse, managementError));
+ } else {
+ return response.getFinalResult();
+ }
+ }
+
+ private static final class HttpResponseImpl extends HttpResponse {
+ private final int statusCode;
+
+ private final byte[] responseBody;
+
+ private final HttpHeaders httpHeaders;
+
+ HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) {
+ super(null);
+ this.statusCode = statusCode;
+ this.httpHeaders = httpHeaders;
+ this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8);
+ }
+
+ public int getStatusCode() {
+ return statusCode;
+ }
+
+ public String getHeaderValue(String s) {
+ return httpHeaders.getValue(s);
+ }
+
+ public HttpHeaders getHeaders() {
+ return httpHeaders;
+ }
+
+ public Flux getBody() {
+ return Flux.just(ByteBuffer.wrap(responseBody));
+ }
+
+ public Mono getBodyAsByteArray() {
+ return Mono.just(responseBody);
+ }
+
+ public Mono getBodyAsString() {
+ return Mono.just(new String(responseBody, StandardCharsets.UTF_8));
+ }
+
+ public Mono getBodyAsString(Charset charset) {
+ return Mono.just(new String(responseBody, charset));
+ }
+ }
+
+ private static final ClientLogger LOGGER = new ClientLogger(ManagementGroupsApiImpl.class);
+}
diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupsClientImpl.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupsClientImpl.java
new file mode 100644
index 000000000000..81f8e49d1cba
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupsClientImpl.java
@@ -0,0 +1,1624 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.managementgroups.implementation;
+
+import com.azure.core.annotation.BodyParam;
+import com.azure.core.annotation.Delete;
+import com.azure.core.annotation.ExpectedResponses;
+import com.azure.core.annotation.Get;
+import com.azure.core.annotation.HeaderParam;
+import com.azure.core.annotation.Headers;
+import com.azure.core.annotation.Host;
+import com.azure.core.annotation.HostParam;
+import com.azure.core.annotation.Patch;
+import com.azure.core.annotation.PathParam;
+import com.azure.core.annotation.Put;
+import com.azure.core.annotation.QueryParam;
+import com.azure.core.annotation.ReturnType;
+import com.azure.core.annotation.ServiceInterface;
+import com.azure.core.annotation.ServiceMethod;
+import com.azure.core.annotation.UnexpectedResponseExceptionType;
+import com.azure.core.http.rest.PagedFlux;
+import com.azure.core.http.rest.PagedIterable;
+import com.azure.core.http.rest.PagedResponse;
+import com.azure.core.http.rest.PagedResponseBase;
+import com.azure.core.http.rest.Response;
+import com.azure.core.http.rest.RestProxy;
+import com.azure.core.management.exception.ManagementException;
+import com.azure.core.management.polling.PollResult;
+import com.azure.core.util.Context;
+import com.azure.core.util.FluxUtil;
+import com.azure.core.util.polling.PollerFlux;
+import com.azure.core.util.polling.SyncPoller;
+import com.azure.resourcemanager.managementgroups.fluent.ManagementGroupsClient;
+import com.azure.resourcemanager.managementgroups.fluent.models.AzureAsyncOperationResultsInner;
+import com.azure.resourcemanager.managementgroups.fluent.models.DescendantInfoInner;
+import com.azure.resourcemanager.managementgroups.fluent.models.ManagementGroupInfoInner;
+import com.azure.resourcemanager.managementgroups.fluent.models.ManagementGroupInner;
+import com.azure.resourcemanager.managementgroups.models.CreateManagementGroupRequest;
+import com.azure.resourcemanager.managementgroups.models.DescendantListResult;
+import com.azure.resourcemanager.managementgroups.models.ManagementGroupExpandType;
+import com.azure.resourcemanager.managementgroups.models.ManagementGroupListResult;
+import com.azure.resourcemanager.managementgroups.models.PatchManagementGroupRequest;
+import java.nio.ByteBuffer;
+import reactor.core.publisher.Flux;
+import reactor.core.publisher.Mono;
+
+/** An instance of this class provides access to all the operations defined in ManagementGroupsClient. */
+public final class ManagementGroupsClientImpl implements ManagementGroupsClient {
+ /** The proxy service used to perform REST calls. */
+ private final ManagementGroupsService service;
+
+ /** The service client containing this operation class. */
+ private final ManagementGroupsApiImpl client;
+
+ /**
+ * Initializes an instance of ManagementGroupsClientImpl.
+ *
+ * @param client the instance of the service client containing this operation class.
+ */
+ ManagementGroupsClientImpl(ManagementGroupsApiImpl client) {
+ this.service =
+ RestProxy.create(ManagementGroupsService.class, client.getHttpPipeline(), client.getSerializerAdapter());
+ this.client = client;
+ }
+
+ /**
+ * The interface defining all the services for ManagementGroupsApiManagementGroups to be used by the proxy service
+ * to perform REST calls.
+ */
+ @Host("{$host}")
+ @ServiceInterface(name = "ManagementGroupsApiM")
+ private interface ManagementGroupsService {
+ @Headers({"Content-Type: application/json"})
+ @Get("/providers/Microsoft.Management/managementGroups")
+ @ExpectedResponses({200})
+ @UnexpectedResponseExceptionType(ManagementException.class)
+ Mono> list(
+ @HostParam("$host") String endpoint,
+ @QueryParam("api-version") String apiVersion,
+ @HeaderParam("Cache-Control") String cacheControl,
+ @QueryParam("$skiptoken") String skiptoken,
+ @HeaderParam("Accept") String accept,
+ Context context);
+
+ @Headers({"Content-Type: application/json"})
+ @Get("/providers/Microsoft.Management/managementGroups/{groupId}")
+ @ExpectedResponses({200})
+ @UnexpectedResponseExceptionType(ManagementException.class)
+ Mono> get(
+ @HostParam("$host") String endpoint,
+ @PathParam("groupId") String groupId,
+ @QueryParam("api-version") String apiVersion,
+ @QueryParam("$expand") ManagementGroupExpandType expand,
+ @QueryParam("$recurse") Boolean recurse,
+ @QueryParam("$filter") String filter,
+ @HeaderParam("Cache-Control") String cacheControl,
+ @HeaderParam("Accept") String accept,
+ Context context);
+
+ @Headers({"Content-Type: application/json"})
+ @Put("/providers/Microsoft.Management/managementGroups/{groupId}")
+ @ExpectedResponses({200, 202})
+ @UnexpectedResponseExceptionType(ManagementException.class)
+ Mono>> createOrUpdate(
+ @HostParam("$host") String endpoint,
+ @PathParam("groupId") String groupId,
+ @QueryParam("api-version") String apiVersion,
+ @HeaderParam("Cache-Control") String cacheControl,
+ @BodyParam("application/json") CreateManagementGroupRequest createManagementGroupRequest,
+ @HeaderParam("Accept") String accept,
+ Context context);
+
+ @Headers({"Content-Type: application/json"})
+ @Patch("/providers/Microsoft.Management/managementGroups/{groupId}")
+ @ExpectedResponses({200})
+ @UnexpectedResponseExceptionType(ManagementException.class)
+ Mono> update(
+ @HostParam("$host") String endpoint,
+ @PathParam("groupId") String groupId,
+ @QueryParam("api-version") String apiVersion,
+ @HeaderParam("Cache-Control") String cacheControl,
+ @BodyParam("application/json") PatchManagementGroupRequest patchGroupRequest,
+ @HeaderParam("Accept") String accept,
+ Context context);
+
+ @Headers({"Content-Type: application/json"})
+ @Delete("/providers/Microsoft.Management/managementGroups/{groupId}")
+ @ExpectedResponses({202, 204})
+ @UnexpectedResponseExceptionType(ManagementException.class)
+ Mono>> delete(
+ @HostParam("$host") String endpoint,
+ @PathParam("groupId") String groupId,
+ @QueryParam("api-version") String apiVersion,
+ @HeaderParam("Cache-Control") String cacheControl,
+ @HeaderParam("Accept") String accept,
+ Context context);
+
+ @Headers({"Content-Type: application/json"})
+ @Get("/providers/Microsoft.Management/managementGroups/{groupId}/descendants")
+ @ExpectedResponses({200})
+ @UnexpectedResponseExceptionType(ManagementException.class)
+ Mono> getDescendants(
+ @HostParam("$host") String endpoint,
+ @PathParam("groupId") String groupId,
+ @QueryParam("api-version") String apiVersion,
+ @QueryParam("$skiptoken") String skiptoken,
+ @QueryParam("$top") Integer top,
+ @HeaderParam("Accept") String accept,
+ Context context);
+
+ @Headers({"Content-Type: application/json"})
+ @Get("{nextLink}")
+ @ExpectedResponses({200})
+ @UnexpectedResponseExceptionType(ManagementException.class)
+ Mono> listNext(
+ @PathParam(value = "nextLink", encoded = true) String nextLink,
+ @HostParam("$host") String endpoint,
+ @HeaderParam("Cache-Control") String cacheControl,
+ @HeaderParam("Accept") String accept,
+ Context context);
+
+ @Headers({"Content-Type: application/json"})
+ @Get("{nextLink}")
+ @ExpectedResponses({200})
+ @UnexpectedResponseExceptionType(ManagementException.class)
+ Mono> getDescendantsNext(
+ @PathParam(value = "nextLink", encoded = true) String nextLink,
+ @HostParam("$host") String endpoint,
+ @HeaderParam("Accept") String accept,
+ Context context);
+ }
+
+ /**
+ * List management groups for the authenticated user.
+ *
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a
+ * previous response contains a nextLink element, the value of the nextLink element will include a token
+ * parameter that specifies a starting point to use for subsequent calls.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return describes the result of the request to list management groups along with {@link PagedResponse} on
+ * successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono> listSinglePageAsync(String cacheControl, String skiptoken) {
+ if (this.client.getEndpoint() == null) {
+ return Mono
+ .error(
+ new IllegalArgumentException(
+ "Parameter this.client.getEndpoint() is required and cannot be null."));
+ }
+ final String accept = "application/json";
+ return FluxUtil
+ .withContext(
+ context ->
+ service
+ .list(
+ this.client.getEndpoint(),
+ this.client.getApiVersion(),
+ cacheControl,
+ skiptoken,
+ accept,
+ context))
+ .>map(
+ res ->
+ new PagedResponseBase<>(
+ res.getRequest(),
+ res.getStatusCode(),
+ res.getHeaders(),
+ res.getValue().value(),
+ res.getValue().nextLink(),
+ null))
+ .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
+ }
+
+ /**
+ * List management groups for the authenticated user.
+ *
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a
+ * previous response contains a nextLink element, the value of the nextLink element will include a token
+ * parameter that specifies a starting point to use for subsequent calls.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return describes the result of the request to list management groups along with {@link PagedResponse} on
+ * successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono> listSinglePageAsync(
+ String cacheControl, String skiptoken, Context context) {
+ if (this.client.getEndpoint() == null) {
+ return Mono
+ .error(
+ new IllegalArgumentException(
+ "Parameter this.client.getEndpoint() is required and cannot be null."));
+ }
+ final String accept = "application/json";
+ context = this.client.mergeContext(context);
+ return service
+ .list(this.client.getEndpoint(), this.client.getApiVersion(), cacheControl, skiptoken, accept, context)
+ .map(
+ res ->
+ new PagedResponseBase<>(
+ res.getRequest(),
+ res.getStatusCode(),
+ res.getHeaders(),
+ res.getValue().value(),
+ res.getValue().nextLink(),
+ null));
+ }
+
+ /**
+ * List management groups for the authenticated user.
+ *
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a
+ * previous response contains a nextLink element, the value of the nextLink element will include a token
+ * parameter that specifies a starting point to use for subsequent calls.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return describes the result of the request to list management groups as paginated response with {@link
+ * PagedFlux}.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ private PagedFlux listAsync(String cacheControl, String skiptoken) {
+ return new PagedFlux<>(
+ () -> listSinglePageAsync(cacheControl, skiptoken),
+ nextLink -> listNextSinglePageAsync(nextLink, cacheControl));
+ }
+
+ /**
+ * List management groups for the authenticated user.
+ *
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return describes the result of the request to list management groups as paginated response with {@link
+ * PagedFlux}.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ private PagedFlux listAsync() {
+ final String cacheControl = null;
+ final String skiptoken = null;
+ return new PagedFlux<>(
+ () -> listSinglePageAsync(cacheControl, skiptoken),
+ nextLink -> listNextSinglePageAsync(nextLink, cacheControl));
+ }
+
+ /**
+ * List management groups for the authenticated user.
+ *
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a
+ * previous response contains a nextLink element, the value of the nextLink element will include a token
+ * parameter that specifies a starting point to use for subsequent calls.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return describes the result of the request to list management groups as paginated response with {@link
+ * PagedFlux}.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ private PagedFlux listAsync(String cacheControl, String skiptoken, Context context) {
+ return new PagedFlux<>(
+ () -> listSinglePageAsync(cacheControl, skiptoken, context),
+ nextLink -> listNextSinglePageAsync(nextLink, cacheControl, context));
+ }
+
+ /**
+ * List management groups for the authenticated user.
+ *
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return describes the result of the request to list management groups as paginated response with {@link
+ * PagedIterable}.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedIterable list() {
+ final String cacheControl = null;
+ final String skiptoken = null;
+ return new PagedIterable<>(listAsync(cacheControl, skiptoken));
+ }
+
+ /**
+ * List management groups for the authenticated user.
+ *
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a
+ * previous response contains a nextLink element, the value of the nextLink element will include a token
+ * parameter that specifies a starting point to use for subsequent calls.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return describes the result of the request to list management groups as paginated response with {@link
+ * PagedIterable}.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedIterable list(String cacheControl, String skiptoken, Context context) {
+ return new PagedIterable<>(listAsync(cacheControl, skiptoken, context));
+ }
+
+ /**
+ * Get the details of the management group.
+ *
+ * @param groupId Management Group ID.
+ * @param expand The $expand=children query string parameter allows clients to request inclusion of children in the
+ * response payload. $expand=path includes the path from the root group to the current group. $expand=ancestors
+ * includes the ancestor Ids of the current group.
+ * @param recurse The $recurse=true query string parameter allows clients to request inclusion of entire hierarchy
+ * in the response payload. Note that $expand=children must be passed up if $recurse is set to true.
+ * @param filter A filter which allows the exclusion of subscriptions from results (i.e. '$filter=children.childType
+ * ne Subscription').
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the details of the management group along with {@link Response} on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono> getWithResponseAsync(
+ String groupId, ManagementGroupExpandType expand, Boolean recurse, String filter, String cacheControl) {
+ if (this.client.getEndpoint() == null) {
+ return Mono
+ .error(
+ new IllegalArgumentException(
+ "Parameter this.client.getEndpoint() is required and cannot be null."));
+ }
+ if (groupId == null) {
+ return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null."));
+ }
+ final String accept = "application/json";
+ return FluxUtil
+ .withContext(
+ context ->
+ service
+ .get(
+ this.client.getEndpoint(),
+ groupId,
+ this.client.getApiVersion(),
+ expand,
+ recurse,
+ filter,
+ cacheControl,
+ accept,
+ context))
+ .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
+ }
+
+ /**
+ * Get the details of the management group.
+ *
+ * @param groupId Management Group ID.
+ * @param expand The $expand=children query string parameter allows clients to request inclusion of children in the
+ * response payload. $expand=path includes the path from the root group to the current group. $expand=ancestors
+ * includes the ancestor Ids of the current group.
+ * @param recurse The $recurse=true query string parameter allows clients to request inclusion of entire hierarchy
+ * in the response payload. Note that $expand=children must be passed up if $recurse is set to true.
+ * @param filter A filter which allows the exclusion of subscriptions from results (i.e. '$filter=children.childType
+ * ne Subscription').
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the details of the management group along with {@link Response} on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono> getWithResponseAsync(
+ String groupId,
+ ManagementGroupExpandType expand,
+ Boolean recurse,
+ String filter,
+ String cacheControl,
+ Context context) {
+ if (this.client.getEndpoint() == null) {
+ return Mono
+ .error(
+ new IllegalArgumentException(
+ "Parameter this.client.getEndpoint() is required and cannot be null."));
+ }
+ if (groupId == null) {
+ return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null."));
+ }
+ final String accept = "application/json";
+ context = this.client.mergeContext(context);
+ return service
+ .get(
+ this.client.getEndpoint(),
+ groupId,
+ this.client.getApiVersion(),
+ expand,
+ recurse,
+ filter,
+ cacheControl,
+ accept,
+ context);
+ }
+
+ /**
+ * Get the details of the management group.
+ *
+ * @param groupId Management Group ID.
+ * @param expand The $expand=children query string parameter allows clients to request inclusion of children in the
+ * response payload. $expand=path includes the path from the root group to the current group. $expand=ancestors
+ * includes the ancestor Ids of the current group.
+ * @param recurse The $recurse=true query string parameter allows clients to request inclusion of entire hierarchy
+ * in the response payload. Note that $expand=children must be passed up if $recurse is set to true.
+ * @param filter A filter which allows the exclusion of subscriptions from results (i.e. '$filter=children.childType
+ * ne Subscription').
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the details of the management group on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono getAsync(
+ String groupId, ManagementGroupExpandType expand, Boolean recurse, String filter, String cacheControl) {
+ return getWithResponseAsync(groupId, expand, recurse, filter, cacheControl)
+ .flatMap(res -> Mono.justOrEmpty(res.getValue()));
+ }
+
+ /**
+ * Get the details of the management group.
+ *
+ * @param groupId Management Group ID.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the details of the management group on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono getAsync(String groupId) {
+ final ManagementGroupExpandType expand = null;
+ final Boolean recurse = null;
+ final String filter = null;
+ final String cacheControl = null;
+ return getWithResponseAsync(groupId, expand, recurse, filter, cacheControl)
+ .flatMap(res -> Mono.justOrEmpty(res.getValue()));
+ }
+
+ /**
+ * Get the details of the management group.
+ *
+ * @param groupId Management Group ID.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the details of the management group.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public ManagementGroupInner get(String groupId) {
+ final ManagementGroupExpandType expand = null;
+ final Boolean recurse = null;
+ final String filter = null;
+ final String cacheControl = null;
+ return getAsync(groupId, expand, recurse, filter, cacheControl).block();
+ }
+
+ /**
+ * Get the details of the management group.
+ *
+ * @param groupId Management Group ID.
+ * @param expand The $expand=children query string parameter allows clients to request inclusion of children in the
+ * response payload. $expand=path includes the path from the root group to the current group. $expand=ancestors
+ * includes the ancestor Ids of the current group.
+ * @param recurse The $recurse=true query string parameter allows clients to request inclusion of entire hierarchy
+ * in the response payload. Note that $expand=children must be passed up if $recurse is set to true.
+ * @param filter A filter which allows the exclusion of subscriptions from results (i.e. '$filter=children.childType
+ * ne Subscription').
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the details of the management group along with {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response getWithResponse(
+ String groupId,
+ ManagementGroupExpandType expand,
+ Boolean recurse,
+ String filter,
+ String cacheControl,
+ Context context) {
+ return getWithResponseAsync(groupId, expand, recurse, filter, cacheControl, context).block();
+ }
+
+ /**
+ * Create or update a management group. If a management group is already created and a subsequent create request is
+ * issued with different properties, the management group properties will be updated.
+ *
+ * @param groupId Management Group ID.
+ * @param createManagementGroupRequest Management group creation parameters.
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the management group details along with {@link Response} on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono>> createOrUpdateWithResponseAsync(
+ String groupId, CreateManagementGroupRequest createManagementGroupRequest, String cacheControl) {
+ if (this.client.getEndpoint() == null) {
+ return Mono
+ .error(
+ new IllegalArgumentException(
+ "Parameter this.client.getEndpoint() is required and cannot be null."));
+ }
+ if (groupId == null) {
+ return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null."));
+ }
+ if (createManagementGroupRequest == null) {
+ return Mono
+ .error(
+ new IllegalArgumentException(
+ "Parameter createManagementGroupRequest is required and cannot be null."));
+ } else {
+ createManagementGroupRequest.validate();
+ }
+ final String accept = "application/json";
+ return FluxUtil
+ .withContext(
+ context ->
+ service
+ .createOrUpdate(
+ this.client.getEndpoint(),
+ groupId,
+ this.client.getApiVersion(),
+ cacheControl,
+ createManagementGroupRequest,
+ accept,
+ context))
+ .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
+ }
+
+ /**
+ * Create or update a management group. If a management group is already created and a subsequent create request is
+ * issued with different properties, the management group properties will be updated.
+ *
+ * @param groupId Management Group ID.
+ * @param createManagementGroupRequest Management group creation parameters.
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the management group details along with {@link Response} on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono>> createOrUpdateWithResponseAsync(
+ String groupId,
+ CreateManagementGroupRequest createManagementGroupRequest,
+ String cacheControl,
+ Context context) {
+ if (this.client.getEndpoint() == null) {
+ return Mono
+ .error(
+ new IllegalArgumentException(
+ "Parameter this.client.getEndpoint() is required and cannot be null."));
+ }
+ if (groupId == null) {
+ return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null."));
+ }
+ if (createManagementGroupRequest == null) {
+ return Mono
+ .error(
+ new IllegalArgumentException(
+ "Parameter createManagementGroupRequest is required and cannot be null."));
+ } else {
+ createManagementGroupRequest.validate();
+ }
+ final String accept = "application/json";
+ context = this.client.mergeContext(context);
+ return service
+ .createOrUpdate(
+ this.client.getEndpoint(),
+ groupId,
+ this.client.getApiVersion(),
+ cacheControl,
+ createManagementGroupRequest,
+ accept,
+ context);
+ }
+
+ /**
+ * Create or update a management group. If a management group is already created and a subsequent create request is
+ * issued with different properties, the management group properties will be updated.
+ *
+ * @param groupId Management Group ID.
+ * @param createManagementGroupRequest Management group creation parameters.
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the {@link PollerFlux} for polling of the management group details.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ private PollerFlux, ManagementGroupInner> beginCreateOrUpdateAsync(
+ String groupId, CreateManagementGroupRequest createManagementGroupRequest, String cacheControl) {
+ Mono>> mono =
+ createOrUpdateWithResponseAsync(groupId, createManagementGroupRequest, cacheControl);
+ return this
+ .client
+ .getLroResult(
+ mono,
+ this.client.getHttpPipeline(),
+ ManagementGroupInner.class,
+ ManagementGroupInner.class,
+ this.client.getContext());
+ }
+
+ /**
+ * Create or update a management group. If a management group is already created and a subsequent create request is
+ * issued with different properties, the management group properties will be updated.
+ *
+ * @param groupId Management Group ID.
+ * @param createManagementGroupRequest Management group creation parameters.
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the {@link PollerFlux} for polling of the management group details.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ private PollerFlux, ManagementGroupInner> beginCreateOrUpdateAsync(
+ String groupId,
+ CreateManagementGroupRequest createManagementGroupRequest,
+ String cacheControl,
+ Context context) {
+ context = this.client.mergeContext(context);
+ Mono>> mono =
+ createOrUpdateWithResponseAsync(groupId, createManagementGroupRequest, cacheControl, context);
+ return this
+ .client
+ .getLroResult(
+ mono, this.client.getHttpPipeline(), ManagementGroupInner.class, ManagementGroupInner.class, context);
+ }
+
+ /**
+ * Create or update a management group. If a management group is already created and a subsequent create request is
+ * issued with different properties, the management group properties will be updated.
+ *
+ * @param groupId Management Group ID.
+ * @param createManagementGroupRequest Management group creation parameters.
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the {@link SyncPoller} for polling of the management group details.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ public SyncPoller, ManagementGroupInner> beginCreateOrUpdate(
+ String groupId, CreateManagementGroupRequest createManagementGroupRequest, String cacheControl) {
+ return beginCreateOrUpdateAsync(groupId, createManagementGroupRequest, cacheControl).getSyncPoller();
+ }
+
+ /**
+ * Create or update a management group. If a management group is already created and a subsequent create request is
+ * issued with different properties, the management group properties will be updated.
+ *
+ * @param groupId Management Group ID.
+ * @param createManagementGroupRequest Management group creation parameters.
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the {@link SyncPoller} for polling of the management group details.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ public SyncPoller, ManagementGroupInner> beginCreateOrUpdate(
+ String groupId,
+ CreateManagementGroupRequest createManagementGroupRequest,
+ String cacheControl,
+ Context context) {
+ return beginCreateOrUpdateAsync(groupId, createManagementGroupRequest, cacheControl, context).getSyncPoller();
+ }
+
+ /**
+ * Create or update a management group. If a management group is already created and a subsequent create request is
+ * issued with different properties, the management group properties will be updated.
+ *
+ * @param groupId Management Group ID.
+ * @param createManagementGroupRequest Management group creation parameters.
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the management group details on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono createOrUpdateAsync(
+ String groupId, CreateManagementGroupRequest createManagementGroupRequest, String cacheControl) {
+ return beginCreateOrUpdateAsync(groupId, createManagementGroupRequest, cacheControl)
+ .last()
+ .flatMap(this.client::getLroFinalResultOrError);
+ }
+
+ /**
+ * Create or update a management group. If a management group is already created and a subsequent create request is
+ * issued with different properties, the management group properties will be updated.
+ *
+ * @param groupId Management Group ID.
+ * @param createManagementGroupRequest Management group creation parameters.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the management group details on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono createOrUpdateAsync(
+ String groupId, CreateManagementGroupRequest createManagementGroupRequest) {
+ final String cacheControl = null;
+ return beginCreateOrUpdateAsync(groupId, createManagementGroupRequest, cacheControl)
+ .last()
+ .flatMap(this.client::getLroFinalResultOrError);
+ }
+
+ /**
+ * Create or update a management group. If a management group is already created and a subsequent create request is
+ * issued with different properties, the management group properties will be updated.
+ *
+ * @param groupId Management Group ID.
+ * @param createManagementGroupRequest Management group creation parameters.
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the management group details on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono createOrUpdateAsync(
+ String groupId,
+ CreateManagementGroupRequest createManagementGroupRequest,
+ String cacheControl,
+ Context context) {
+ return beginCreateOrUpdateAsync(groupId, createManagementGroupRequest, cacheControl, context)
+ .last()
+ .flatMap(this.client::getLroFinalResultOrError);
+ }
+
+ /**
+ * Create or update a management group. If a management group is already created and a subsequent create request is
+ * issued with different properties, the management group properties will be updated.
+ *
+ * @param groupId Management Group ID.
+ * @param createManagementGroupRequest Management group creation parameters.
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the management group details.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public ManagementGroupInner createOrUpdate(
+ String groupId, CreateManagementGroupRequest createManagementGroupRequest, String cacheControl) {
+ return createOrUpdateAsync(groupId, createManagementGroupRequest, cacheControl).block();
+ }
+
+ /**
+ * Create or update a management group. If a management group is already created and a subsequent create request is
+ * issued with different properties, the management group properties will be updated.
+ *
+ * @param groupId Management Group ID.
+ * @param createManagementGroupRequest Management group creation parameters.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the management group details.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public ManagementGroupInner createOrUpdate(
+ String groupId, CreateManagementGroupRequest createManagementGroupRequest) {
+ final String cacheControl = null;
+ return createOrUpdateAsync(groupId, createManagementGroupRequest, cacheControl).block();
+ }
+
+ /**
+ * Create or update a management group. If a management group is already created and a subsequent create request is
+ * issued with different properties, the management group properties will be updated.
+ *
+ * @param groupId Management Group ID.
+ * @param createManagementGroupRequest Management group creation parameters.
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the management group details.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public ManagementGroupInner createOrUpdate(
+ String groupId,
+ CreateManagementGroupRequest createManagementGroupRequest,
+ String cacheControl,
+ Context context) {
+ return createOrUpdateAsync(groupId, createManagementGroupRequest, cacheControl, context).block();
+ }
+
+ /**
+ * Update a management group.
+ *
+ * @param groupId Management Group ID.
+ * @param patchGroupRequest Management group patch parameters.
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the management group details along with {@link Response} on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono> updateWithResponseAsync(
+ String groupId, PatchManagementGroupRequest patchGroupRequest, String cacheControl) {
+ if (this.client.getEndpoint() == null) {
+ return Mono
+ .error(
+ new IllegalArgumentException(
+ "Parameter this.client.getEndpoint() is required and cannot be null."));
+ }
+ if (groupId == null) {
+ return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null."));
+ }
+ if (patchGroupRequest == null) {
+ return Mono
+ .error(new IllegalArgumentException("Parameter patchGroupRequest is required and cannot be null."));
+ } else {
+ patchGroupRequest.validate();
+ }
+ final String accept = "application/json";
+ return FluxUtil
+ .withContext(
+ context ->
+ service
+ .update(
+ this.client.getEndpoint(),
+ groupId,
+ this.client.getApiVersion(),
+ cacheControl,
+ patchGroupRequest,
+ accept,
+ context))
+ .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
+ }
+
+ /**
+ * Update a management group.
+ *
+ * @param groupId Management Group ID.
+ * @param patchGroupRequest Management group patch parameters.
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the management group details along with {@link Response} on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono> updateWithResponseAsync(
+ String groupId, PatchManagementGroupRequest patchGroupRequest, String cacheControl, Context context) {
+ if (this.client.getEndpoint() == null) {
+ return Mono
+ .error(
+ new IllegalArgumentException(
+ "Parameter this.client.getEndpoint() is required and cannot be null."));
+ }
+ if (groupId == null) {
+ return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null."));
+ }
+ if (patchGroupRequest == null) {
+ return Mono
+ .error(new IllegalArgumentException("Parameter patchGroupRequest is required and cannot be null."));
+ } else {
+ patchGroupRequest.validate();
+ }
+ final String accept = "application/json";
+ context = this.client.mergeContext(context);
+ return service
+ .update(
+ this.client.getEndpoint(),
+ groupId,
+ this.client.getApiVersion(),
+ cacheControl,
+ patchGroupRequest,
+ accept,
+ context);
+ }
+
+ /**
+ * Update a management group.
+ *
+ * @param groupId Management Group ID.
+ * @param patchGroupRequest Management group patch parameters.
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the management group details on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono updateAsync(
+ String groupId, PatchManagementGroupRequest patchGroupRequest, String cacheControl) {
+ return updateWithResponseAsync(groupId, patchGroupRequest, cacheControl)
+ .flatMap(res -> Mono.justOrEmpty(res.getValue()));
+ }
+
+ /**
+ * Update a management group.
+ *
+ * @param groupId Management Group ID.
+ * @param patchGroupRequest Management group patch parameters.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the management group details on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono updateAsync(String groupId, PatchManagementGroupRequest patchGroupRequest) {
+ final String cacheControl = null;
+ return updateWithResponseAsync(groupId, patchGroupRequest, cacheControl)
+ .flatMap(res -> Mono.justOrEmpty(res.getValue()));
+ }
+
+ /**
+ * Update a management group.
+ *
+ * @param groupId Management Group ID.
+ * @param patchGroupRequest Management group patch parameters.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the management group details.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public ManagementGroupInner update(String groupId, PatchManagementGroupRequest patchGroupRequest) {
+ final String cacheControl = null;
+ return updateAsync(groupId, patchGroupRequest, cacheControl).block();
+ }
+
+ /**
+ * Update a management group.
+ *
+ * @param groupId Management Group ID.
+ * @param patchGroupRequest Management group patch parameters.
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the management group details along with {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response updateWithResponse(
+ String groupId, PatchManagementGroupRequest patchGroupRequest, String cacheControl, Context context) {
+ return updateWithResponseAsync(groupId, patchGroupRequest, cacheControl, context).block();
+ }
+
+ /**
+ * Delete management group. If a management group contains child resources, the request will fail.
+ *
+ * @param groupId Management Group ID.
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the results of Azure-AsyncOperation along with {@link Response} on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono>> deleteWithResponseAsync(String groupId, String cacheControl) {
+ if (this.client.getEndpoint() == null) {
+ return Mono
+ .error(
+ new IllegalArgumentException(
+ "Parameter this.client.getEndpoint() is required and cannot be null."));
+ }
+ if (groupId == null) {
+ return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null."));
+ }
+ final String accept = "application/json";
+ return FluxUtil
+ .withContext(
+ context ->
+ service
+ .delete(
+ this.client.getEndpoint(),
+ groupId,
+ this.client.getApiVersion(),
+ cacheControl,
+ accept,
+ context))
+ .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
+ }
+
+ /**
+ * Delete management group. If a management group contains child resources, the request will fail.
+ *
+ * @param groupId Management Group ID.
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the results of Azure-AsyncOperation along with {@link Response} on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono>> deleteWithResponseAsync(
+ String groupId, String cacheControl, Context context) {
+ if (this.client.getEndpoint() == null) {
+ return Mono
+ .error(
+ new IllegalArgumentException(
+ "Parameter this.client.getEndpoint() is required and cannot be null."));
+ }
+ if (groupId == null) {
+ return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null."));
+ }
+ final String accept = "application/json";
+ context = this.client.mergeContext(context);
+ return service
+ .delete(this.client.getEndpoint(), groupId, this.client.getApiVersion(), cacheControl, accept, context);
+ }
+
+ /**
+ * Delete management group. If a management group contains child resources, the request will fail.
+ *
+ * @param groupId Management Group ID.
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the {@link PollerFlux} for polling of the results of Azure-AsyncOperation.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ private PollerFlux, AzureAsyncOperationResultsInner> beginDeleteAsync(
+ String groupId, String cacheControl) {
+ Mono>> mono = deleteWithResponseAsync(groupId, cacheControl);
+ return this
+ .client
+ .getLroResult(
+ mono,
+ this.client.getHttpPipeline(),
+ AzureAsyncOperationResultsInner.class,
+ AzureAsyncOperationResultsInner.class,
+ this.client.getContext());
+ }
+
+ /**
+ * Delete management group. If a management group contains child resources, the request will fail.
+ *
+ * @param groupId Management Group ID.
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the {@link PollerFlux} for polling of the results of Azure-AsyncOperation.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ private PollerFlux, AzureAsyncOperationResultsInner> beginDeleteAsync(
+ String groupId, String cacheControl, Context context) {
+ context = this.client.mergeContext(context);
+ Mono>> mono = deleteWithResponseAsync(groupId, cacheControl, context);
+ return this
+ .client
+ .getLroResult(
+ mono,
+ this.client.getHttpPipeline(),
+ AzureAsyncOperationResultsInner.class,
+ AzureAsyncOperationResultsInner.class,
+ context);
+ }
+
+ /**
+ * Delete management group. If a management group contains child resources, the request will fail.
+ *
+ * @param groupId Management Group ID.
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the {@link SyncPoller} for polling of the results of Azure-AsyncOperation.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ public SyncPoller, AzureAsyncOperationResultsInner> beginDelete(
+ String groupId, String cacheControl) {
+ return beginDeleteAsync(groupId, cacheControl).getSyncPoller();
+ }
+
+ /**
+ * Delete management group. If a management group contains child resources, the request will fail.
+ *
+ * @param groupId Management Group ID.
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the {@link SyncPoller} for polling of the results of Azure-AsyncOperation.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ public SyncPoller, AzureAsyncOperationResultsInner> beginDelete(
+ String groupId, String cacheControl, Context context) {
+ return beginDeleteAsync(groupId, cacheControl, context).getSyncPoller();
+ }
+
+ /**
+ * Delete management group. If a management group contains child resources, the request will fail.
+ *
+ * @param groupId Management Group ID.
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the results of Azure-AsyncOperation on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono deleteAsync(String groupId, String cacheControl) {
+ return beginDeleteAsync(groupId, cacheControl).last().flatMap(this.client::getLroFinalResultOrError);
+ }
+
+ /**
+ * Delete management group. If a management group contains child resources, the request will fail.
+ *
+ * @param groupId Management Group ID.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the results of Azure-AsyncOperation on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono deleteAsync(String groupId) {
+ final String cacheControl = null;
+ return beginDeleteAsync(groupId, cacheControl).last().flatMap(this.client::getLroFinalResultOrError);
+ }
+
+ /**
+ * Delete management group. If a management group contains child resources, the request will fail.
+ *
+ * @param groupId Management Group ID.
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the results of Azure-AsyncOperation on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono deleteAsync(String groupId, String cacheControl, Context context) {
+ return beginDeleteAsync(groupId, cacheControl, context).last().flatMap(this.client::getLroFinalResultOrError);
+ }
+
+ /**
+ * Delete management group. If a management group contains child resources, the request will fail.
+ *
+ * @param groupId Management Group ID.
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the results of Azure-AsyncOperation.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public AzureAsyncOperationResultsInner delete(String groupId, String cacheControl) {
+ return deleteAsync(groupId, cacheControl).block();
+ }
+
+ /**
+ * Delete management group. If a management group contains child resources, the request will fail.
+ *
+ * @param groupId Management Group ID.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the results of Azure-AsyncOperation.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public AzureAsyncOperationResultsInner delete(String groupId) {
+ final String cacheControl = null;
+ return deleteAsync(groupId, cacheControl).block();
+ }
+
+ /**
+ * Delete management group. If a management group contains child resources, the request will fail.
+ *
+ * @param groupId Management Group ID.
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the results of Azure-AsyncOperation.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public AzureAsyncOperationResultsInner delete(String groupId, String cacheControl, Context context) {
+ return deleteAsync(groupId, cacheControl, context).block();
+ }
+
+ /**
+ * List all entities that descend from a management group.
+ *
+ * @param groupId Management Group ID.
+ * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a
+ * previous response contains a nextLink element, the value of the nextLink element will include a token
+ * parameter that specifies a starting point to use for subsequent calls.
+ * @param top Number of elements to return when retrieving results. Passing this in will override $skipToken.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return describes the result of the request to view descendants along with {@link PagedResponse} on successful
+ * completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono> getDescendantsSinglePageAsync(
+ String groupId, String skiptoken, Integer top) {
+ if (this.client.getEndpoint() == null) {
+ return Mono
+ .error(
+ new IllegalArgumentException(
+ "Parameter this.client.getEndpoint() is required and cannot be null."));
+ }
+ if (groupId == null) {
+ return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null."));
+ }
+ final String accept = "application/json";
+ return FluxUtil
+ .withContext(
+ context ->
+ service
+ .getDescendants(
+ this.client.getEndpoint(),
+ groupId,
+ this.client.getApiVersion(),
+ skiptoken,
+ top,
+ accept,
+ context))
+ .>map(
+ res ->
+ new PagedResponseBase<>(
+ res.getRequest(),
+ res.getStatusCode(),
+ res.getHeaders(),
+ res.getValue().value(),
+ res.getValue().nextLink(),
+ null))
+ .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
+ }
+
+ /**
+ * List all entities that descend from a management group.
+ *
+ * @param groupId Management Group ID.
+ * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a
+ * previous response contains a nextLink element, the value of the nextLink element will include a token
+ * parameter that specifies a starting point to use for subsequent calls.
+ * @param top Number of elements to return when retrieving results. Passing this in will override $skipToken.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return describes the result of the request to view descendants along with {@link PagedResponse} on successful
+ * completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono> getDescendantsSinglePageAsync(
+ String groupId, String skiptoken, Integer top, Context context) {
+ if (this.client.getEndpoint() == null) {
+ return Mono
+ .error(
+ new IllegalArgumentException(
+ "Parameter this.client.getEndpoint() is required and cannot be null."));
+ }
+ if (groupId == null) {
+ return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null."));
+ }
+ final String accept = "application/json";
+ context = this.client.mergeContext(context);
+ return service
+ .getDescendants(
+ this.client.getEndpoint(), groupId, this.client.getApiVersion(), skiptoken, top, accept, context)
+ .map(
+ res ->
+ new PagedResponseBase<>(
+ res.getRequest(),
+ res.getStatusCode(),
+ res.getHeaders(),
+ res.getValue().value(),
+ res.getValue().nextLink(),
+ null));
+ }
+
+ /**
+ * List all entities that descend from a management group.
+ *
+ * @param groupId Management Group ID.
+ * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a
+ * previous response contains a nextLink element, the value of the nextLink element will include a token
+ * parameter that specifies a starting point to use for subsequent calls.
+ * @param top Number of elements to return when retrieving results. Passing this in will override $skipToken.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return describes the result of the request to view descendants as paginated response with {@link PagedFlux}.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ private PagedFlux getDescendantsAsync(String groupId, String skiptoken, Integer top) {
+ return new PagedFlux<>(
+ () -> getDescendantsSinglePageAsync(groupId, skiptoken, top),
+ nextLink -> getDescendantsNextSinglePageAsync(nextLink));
+ }
+
+ /**
+ * List all entities that descend from a management group.
+ *
+ * @param groupId Management Group ID.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return describes the result of the request to view descendants as paginated response with {@link PagedFlux}.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ private PagedFlux getDescendantsAsync(String groupId) {
+ final String skiptoken = null;
+ final Integer top = null;
+ return new PagedFlux<>(
+ () -> getDescendantsSinglePageAsync(groupId, skiptoken, top),
+ nextLink -> getDescendantsNextSinglePageAsync(nextLink));
+ }
+
+ /**
+ * List all entities that descend from a management group.
+ *
+ * @param groupId Management Group ID.
+ * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a
+ * previous response contains a nextLink element, the value of the nextLink element will include a token
+ * parameter that specifies a starting point to use for subsequent calls.
+ * @param top Number of elements to return when retrieving results. Passing this in will override $skipToken.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return describes the result of the request to view descendants as paginated response with {@link PagedFlux}.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ private PagedFlux getDescendantsAsync(
+ String groupId, String skiptoken, Integer top, Context context) {
+ return new PagedFlux<>(
+ () -> getDescendantsSinglePageAsync(groupId, skiptoken, top, context),
+ nextLink -> getDescendantsNextSinglePageAsync(nextLink, context));
+ }
+
+ /**
+ * List all entities that descend from a management group.
+ *
+ * @param groupId Management Group ID.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return describes the result of the request to view descendants as paginated response with {@link PagedIterable}.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedIterable getDescendants(String groupId) {
+ final String skiptoken = null;
+ final Integer top = null;
+ return new PagedIterable<>(getDescendantsAsync(groupId, skiptoken, top));
+ }
+
+ /**
+ * List all entities that descend from a management group.
+ *
+ * @param groupId Management Group ID.
+ * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a
+ * previous response contains a nextLink element, the value of the nextLink element will include a token
+ * parameter that specifies a starting point to use for subsequent calls.
+ * @param top Number of elements to return when retrieving results. Passing this in will override $skipToken.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return describes the result of the request to view descendants as paginated response with {@link PagedIterable}.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedIterable getDescendants(
+ String groupId, String skiptoken, Integer top, Context context) {
+ return new PagedIterable<>(getDescendantsAsync(groupId, skiptoken, top, context));
+ }
+
+ /**
+ * Get the next page of items.
+ *
+ * @param nextLink The nextLink parameter.
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return describes the result of the request to list management groups along with {@link PagedResponse} on
+ * successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono> listNextSinglePageAsync(
+ String nextLink, String cacheControl) {
+ if (nextLink == null) {
+ return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
+ }
+ if (this.client.getEndpoint() == null) {
+ return Mono
+ .error(
+ new IllegalArgumentException(
+ "Parameter this.client.getEndpoint() is required and cannot be null."));
+ }
+ final String accept = "application/json";
+ return FluxUtil
+ .withContext(
+ context -> service.listNext(nextLink, this.client.getEndpoint(), cacheControl, accept, context))
+ .>map(
+ res ->
+ new PagedResponseBase<>(
+ res.getRequest(),
+ res.getStatusCode(),
+ res.getHeaders(),
+ res.getValue().value(),
+ res.getValue().nextLink(),
+ null))
+ .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
+ }
+
+ /**
+ * Get the next page of items.
+ *
+ * @param nextLink The nextLink parameter.
+ * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache'
+ * value to bypass existing caches.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return describes the result of the request to list management groups along with {@link PagedResponse} on
+ * successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono> listNextSinglePageAsync(
+ String nextLink, String cacheControl, Context context) {
+ if (nextLink == null) {
+ return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
+ }
+ if (this.client.getEndpoint() == null) {
+ return Mono
+ .error(
+ new IllegalArgumentException(
+ "Parameter this.client.getEndpoint() is required and cannot be null."));
+ }
+ final String accept = "application/json";
+ context = this.client.mergeContext(context);
+ return service
+ .listNext(nextLink, this.client.getEndpoint(), cacheControl, accept, context)
+ .map(
+ res ->
+ new PagedResponseBase<>(
+ res.getRequest(),
+ res.getStatusCode(),
+ res.getHeaders(),
+ res.getValue().value(),
+ res.getValue().nextLink(),
+ null));
+ }
+
+ /**
+ * Get the next page of items.
+ *
+ * @param nextLink The nextLink parameter.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return describes the result of the request to view descendants along with {@link PagedResponse} on successful
+ * completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono> getDescendantsNextSinglePageAsync(String nextLink) {
+ if (nextLink == null) {
+ return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
+ }
+ if (this.client.getEndpoint() == null) {
+ return Mono
+ .error(
+ new IllegalArgumentException(
+ "Parameter this.client.getEndpoint() is required and cannot be null."));
+ }
+ final String accept = "application/json";
+ return FluxUtil
+ .withContext(context -> service.getDescendantsNext(nextLink, this.client.getEndpoint(), accept, context))
+ .>map(
+ res ->
+ new PagedResponseBase<>(
+ res.getRequest(),
+ res.getStatusCode(),
+ res.getHeaders(),
+ res.getValue().value(),
+ res.getValue().nextLink(),
+ null))
+ .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
+ }
+
+ /**
+ * Get the next page of items.
+ *
+ * @param nextLink The nextLink parameter.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return describes the result of the request to view descendants along with {@link PagedResponse} on successful
+ * completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono> getDescendantsNextSinglePageAsync(
+ String nextLink, Context context) {
+ if (nextLink == null) {
+ return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
+ }
+ if (this.client.getEndpoint() == null) {
+ return Mono
+ .error(
+ new IllegalArgumentException(
+ "Parameter this.client.getEndpoint() is required and cannot be null."));
+ }
+ final String accept = "application/json";
+ context = this.client.mergeContext(context);
+ return service
+ .getDescendantsNext(nextLink, this.client.getEndpoint(), accept, context)
+ .map(
+ res ->
+ new PagedResponseBase<>(
+ res.getRequest(),
+ res.getStatusCode(),
+ res.getHeaders(),
+ res.getValue().value(),
+ res.getValue().nextLink(),
+ null));
+ }
+}
diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupsImpl.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupsImpl.java
new file mode 100644
index 000000000000..e20597bc5052
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupsImpl.java
@@ -0,0 +1,183 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.managementgroups.implementation;
+
+import com.azure.core.http.rest.PagedIterable;
+import com.azure.core.http.rest.Response;
+import com.azure.core.http.rest.SimpleResponse;
+import com.azure.core.util.Context;
+import com.azure.core.util.logging.ClientLogger;
+import com.azure.resourcemanager.managementgroups.fluent.ManagementGroupsClient;
+import com.azure.resourcemanager.managementgroups.fluent.models.AzureAsyncOperationResultsInner;
+import com.azure.resourcemanager.managementgroups.fluent.models.DescendantInfoInner;
+import com.azure.resourcemanager.managementgroups.fluent.models.ManagementGroupInfoInner;
+import com.azure.resourcemanager.managementgroups.fluent.models.ManagementGroupInner;
+import com.azure.resourcemanager.managementgroups.models.AzureAsyncOperationResults;
+import com.azure.resourcemanager.managementgroups.models.CreateManagementGroupRequest;
+import com.azure.resourcemanager.managementgroups.models.DescendantInfo;
+import com.azure.resourcemanager.managementgroups.models.ManagementGroup;
+import com.azure.resourcemanager.managementgroups.models.ManagementGroupExpandType;
+import com.azure.resourcemanager.managementgroups.models.ManagementGroupInfo;
+import com.azure.resourcemanager.managementgroups.models.ManagementGroups;
+import com.azure.resourcemanager.managementgroups.models.PatchManagementGroupRequest;
+
+public final class ManagementGroupsImpl implements ManagementGroups {
+ private static final ClientLogger LOGGER = new ClientLogger(ManagementGroupsImpl.class);
+
+ private final ManagementGroupsClient innerClient;
+
+ private final com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager;
+
+ public ManagementGroupsImpl(
+ ManagementGroupsClient innerClient,
+ com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager) {
+ this.innerClient = innerClient;
+ this.serviceManager = serviceManager;
+ }
+
+ public PagedIterable list() {
+ PagedIterable inner = this.serviceClient().list();
+ return Utils.mapPage(inner, inner1 -> new ManagementGroupInfoImpl(inner1, this.manager()));
+ }
+
+ public PagedIterable list(String cacheControl, String skiptoken, Context context) {
+ PagedIterable inner = this.serviceClient().list(cacheControl, skiptoken, context);
+ return Utils.mapPage(inner, inner1 -> new ManagementGroupInfoImpl(inner1, this.manager()));
+ }
+
+ public ManagementGroup get(String groupId) {
+ ManagementGroupInner inner = this.serviceClient().get(groupId);
+ if (inner != null) {
+ return new ManagementGroupImpl(inner, this.manager());
+ } else {
+ return null;
+ }
+ }
+
+ public Response getWithResponse(
+ String groupId,
+ ManagementGroupExpandType expand,
+ Boolean recurse,
+ String filter,
+ String cacheControl,
+ Context context) {
+ Response inner =
+ this.serviceClient().getWithResponse(groupId, expand, recurse, filter, cacheControl, context);
+ if (inner != null) {
+ return new SimpleResponse<>(
+ inner.getRequest(),
+ inner.getStatusCode(),
+ inner.getHeaders(),
+ new ManagementGroupImpl(inner.getValue(), this.manager()));
+ } else {
+ return null;
+ }
+ }
+
+ public ManagementGroup createOrUpdate(
+ String groupId, CreateManagementGroupRequest createManagementGroupRequest, String cacheControl) {
+ ManagementGroupInner inner =
+ this.serviceClient().createOrUpdate(groupId, createManagementGroupRequest, cacheControl);
+ if (inner != null) {
+ return new ManagementGroupImpl(inner, this.manager());
+ } else {
+ return null;
+ }
+ }
+
+ public ManagementGroup createOrUpdate(String groupId, CreateManagementGroupRequest createManagementGroupRequest) {
+ ManagementGroupInner inner = this.serviceClient().createOrUpdate(groupId, createManagementGroupRequest);
+ if (inner != null) {
+ return new ManagementGroupImpl(inner, this.manager());
+ } else {
+ return null;
+ }
+ }
+
+ public ManagementGroup createOrUpdate(
+ String groupId,
+ CreateManagementGroupRequest createManagementGroupRequest,
+ String cacheControl,
+ Context context) {
+ ManagementGroupInner inner =
+ this.serviceClient().createOrUpdate(groupId, createManagementGroupRequest, cacheControl, context);
+ if (inner != null) {
+ return new ManagementGroupImpl(inner, this.manager());
+ } else {
+ return null;
+ }
+ }
+
+ public ManagementGroup update(String groupId, PatchManagementGroupRequest patchGroupRequest) {
+ ManagementGroupInner inner = this.serviceClient().update(groupId, patchGroupRequest);
+ if (inner != null) {
+ return new ManagementGroupImpl(inner, this.manager());
+ } else {
+ return null;
+ }
+ }
+
+ public Response updateWithResponse(
+ String groupId, PatchManagementGroupRequest patchGroupRequest, String cacheControl, Context context) {
+ Response inner =
+ this.serviceClient().updateWithResponse(groupId, patchGroupRequest, cacheControl, context);
+ if (inner != null) {
+ return new SimpleResponse<>(
+ inner.getRequest(),
+ inner.getStatusCode(),
+ inner.getHeaders(),
+ new ManagementGroupImpl(inner.getValue(), this.manager()));
+ } else {
+ return null;
+ }
+ }
+
+ public AzureAsyncOperationResults deleteByResourceGroup(String groupId, String cacheControl) {
+ AzureAsyncOperationResultsInner inner = this.serviceClient().delete(groupId, cacheControl);
+ if (inner != null) {
+ return new AzureAsyncOperationResultsImpl(inner, this.manager());
+ } else {
+ return null;
+ }
+ }
+
+ public AzureAsyncOperationResults delete(String groupId) {
+ AzureAsyncOperationResultsInner inner = this.serviceClient().delete(groupId);
+ if (inner != null) {
+ return new AzureAsyncOperationResultsImpl(inner, this.manager());
+ } else {
+ return null;
+ }
+ }
+
+ public AzureAsyncOperationResults delete(String groupId, String cacheControl, Context context) {
+ AzureAsyncOperationResultsInner inner = this.serviceClient().delete(groupId, cacheControl, context);
+ if (inner != null) {
+ return new AzureAsyncOperationResultsImpl(inner, this.manager());
+ } else {
+ return null;
+ }
+ }
+
+ public PagedIterable getDescendants(String groupId) {
+ PagedIterable inner = this.serviceClient().getDescendants(groupId);
+ return Utils.mapPage(inner, inner1 -> new DescendantInfoImpl(inner1, this.manager()));
+ }
+
+ public PagedIterable getDescendants(
+ String groupId, String skiptoken, Integer top, Context context) {
+ PagedIterable inner =
+ this.serviceClient().getDescendants(groupId, skiptoken, top, context);
+ return Utils.mapPage(inner, inner1 -> new DescendantInfoImpl(inner1, this.manager()));
+ }
+
+ private ManagementGroupsClient serviceClient() {
+ return this.innerClient;
+ }
+
+ private com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager() {
+ return this.serviceManager;
+ }
+}
diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/OperationImpl.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/OperationImpl.java
new file mode 100644
index 000000000000..d3dfa3cd4a2e
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/OperationImpl.java
@@ -0,0 +1,37 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.managementgroups.implementation;
+
+import com.azure.resourcemanager.managementgroups.fluent.models.OperationInner;
+import com.azure.resourcemanager.managementgroups.models.Operation;
+import com.azure.resourcemanager.managementgroups.models.OperationDisplayProperties;
+
+public final class OperationImpl implements Operation {
+ private OperationInner innerObject;
+
+ private final com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager;
+
+ OperationImpl(
+ OperationInner innerObject, com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager) {
+ this.innerObject = innerObject;
+ this.serviceManager = serviceManager;
+ }
+
+ public String name() {
+ return this.innerModel().name();
+ }
+
+ public OperationDisplayProperties display() {
+ return this.innerModel().display();
+ }
+
+ public OperationInner innerModel() {
+ return this.innerObject;
+ }
+
+ private com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager() {
+ return this.serviceManager;
+ }
+}
diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/OperationsClientImpl.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/OperationsClientImpl.java
new file mode 100644
index 000000000000..5edf553d44c6
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/OperationsClientImpl.java
@@ -0,0 +1,274 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.managementgroups.implementation;
+
+import com.azure.core.annotation.ExpectedResponses;
+import com.azure.core.annotation.Get;
+import com.azure.core.annotation.HeaderParam;
+import com.azure.core.annotation.Headers;
+import com.azure.core.annotation.Host;
+import com.azure.core.annotation.HostParam;
+import com.azure.core.annotation.PathParam;
+import com.azure.core.annotation.QueryParam;
+import com.azure.core.annotation.ReturnType;
+import com.azure.core.annotation.ServiceInterface;
+import com.azure.core.annotation.ServiceMethod;
+import com.azure.core.annotation.UnexpectedResponseExceptionType;
+import com.azure.core.http.rest.PagedFlux;
+import com.azure.core.http.rest.PagedIterable;
+import com.azure.core.http.rest.PagedResponse;
+import com.azure.core.http.rest.PagedResponseBase;
+import com.azure.core.http.rest.Response;
+import com.azure.core.http.rest.RestProxy;
+import com.azure.core.management.exception.ManagementException;
+import com.azure.core.util.Context;
+import com.azure.core.util.FluxUtil;
+import com.azure.resourcemanager.managementgroups.fluent.OperationsClient;
+import com.azure.resourcemanager.managementgroups.fluent.models.OperationInner;
+import com.azure.resourcemanager.managementgroups.models.OperationListResult;
+import reactor.core.publisher.Mono;
+
+/** An instance of this class provides access to all the operations defined in OperationsClient. */
+public final class OperationsClientImpl implements OperationsClient {
+ /** The proxy service used to perform REST calls. */
+ private final OperationsService service;
+
+ /** The service client containing this operation class. */
+ private final ManagementGroupsApiImpl client;
+
+ /**
+ * Initializes an instance of OperationsClientImpl.
+ *
+ * @param client the instance of the service client containing this operation class.
+ */
+ OperationsClientImpl(ManagementGroupsApiImpl client) {
+ this.service =
+ RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter());
+ this.client = client;
+ }
+
+ /**
+ * The interface defining all the services for ManagementGroupsApiOperations to be used by the proxy service to
+ * perform REST calls.
+ */
+ @Host("{$host}")
+ @ServiceInterface(name = "ManagementGroupsApiO")
+ private interface OperationsService {
+ @Headers({"Content-Type: application/json"})
+ @Get("/providers/Microsoft.Management/operations")
+ @ExpectedResponses({200})
+ @UnexpectedResponseExceptionType(ManagementException.class)
+ Mono> list(
+ @HostParam("$host") String endpoint,
+ @QueryParam("api-version") String apiVersion,
+ @HeaderParam("Accept") String accept,
+ Context context);
+
+ @Headers({"Content-Type: application/json"})
+ @Get("{nextLink}")
+ @ExpectedResponses({200})
+ @UnexpectedResponseExceptionType(ManagementException.class)
+ Mono> listNext(
+ @PathParam(value = "nextLink", encoded = true) String nextLink,
+ @HostParam("$host") String endpoint,
+ @HeaderParam("Accept") String accept,
+ Context context);
+ }
+
+ /**
+ * Lists all of the available Management REST API operations.
+ *
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return describes the result of the request to list Microsoft.Management operations along with {@link
+ * PagedResponse} on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono> listSinglePageAsync() {
+ if (this.client.getEndpoint() == null) {
+ return Mono
+ .error(
+ new IllegalArgumentException(
+ "Parameter this.client.getEndpoint() is required and cannot be null."));
+ }
+ final String accept = "application/json";
+ return FluxUtil
+ .withContext(
+ context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context))
+ .>map(
+ res ->
+ new PagedResponseBase<>(
+ res.getRequest(),
+ res.getStatusCode(),
+ res.getHeaders(),
+ res.getValue().value(),
+ res.getValue().nextLink(),
+ null))
+ .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
+ }
+
+ /**
+ * Lists all of the available Management REST API operations.
+ *
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return describes the result of the request to list Microsoft.Management operations along with {@link
+ * PagedResponse} on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono> listSinglePageAsync(Context context) {
+ if (this.client.getEndpoint() == null) {
+ return Mono
+ .error(
+ new IllegalArgumentException(
+ "Parameter this.client.getEndpoint() is required and cannot be null."));
+ }
+ final String accept = "application/json";
+ context = this.client.mergeContext(context);
+ return service
+ .list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)
+ .map(
+ res ->
+ new PagedResponseBase<>(
+ res.getRequest(),
+ res.getStatusCode(),
+ res.getHeaders(),
+ res.getValue().value(),
+ res.getValue().nextLink(),
+ null));
+ }
+
+ /**
+ * Lists all of the available Management REST API operations.
+ *
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return describes the result of the request to list Microsoft.Management operations as paginated response with
+ * {@link PagedFlux}.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ private PagedFlux listAsync() {
+ return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink));
+ }
+
+ /**
+ * Lists all of the available Management REST API operations.
+ *
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return describes the result of the request to list Microsoft.Management operations as paginated response with
+ * {@link PagedFlux}.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ private PagedFlux listAsync(Context context) {
+ return new PagedFlux<>(
+ () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context));
+ }
+
+ /**
+ * Lists all of the available Management REST API operations.
+ *
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return describes the result of the request to list Microsoft.Management operations as paginated response with
+ * {@link PagedIterable}.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedIterable list() {
+ return new PagedIterable<>(listAsync());
+ }
+
+ /**
+ * Lists all of the available Management REST API operations.
+ *
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return describes the result of the request to list Microsoft.Management operations as paginated response with
+ * {@link PagedIterable}.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedIterable list(Context context) {
+ return new PagedIterable<>(listAsync(context));
+ }
+
+ /**
+ * Get the next page of items.
+ *
+ * @param nextLink The nextLink parameter.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return describes the result of the request to list Microsoft.Management operations along with {@link
+ * PagedResponse} on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono