diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt
index 1e807795d431..7405809ba5fc 100644
--- a/eng/versioning/version_client.txt
+++ b/eng/versioning/version_client.txt
@@ -285,6 +285,7 @@ com.azure.resourcemanager:azure-resourcemanager-labservices;1.0.0-beta.1;1.0.0-b
com.azure.resourcemanager:azure-resourcemanager-vmwarecloudsimple;1.0.0-beta.1;1.0.0-beta.2
com.azure.resourcemanager:azure-resourcemanager-managedapplications;1.0.0-beta.1;1.0.0-beta.2
com.azure.resourcemanager:azure-resourcemanager-videoanalyzer;1.0.0-beta.1;1.0.0-beta.2
+com.azure.resourcemanager:azure-resourcemanager-managementgroups;1.0.0-beta.1;1.0.0-beta.1
# Unreleased dependencies: Copy the entry from above, prepend "unreleased_" and remove the current
# version. Unreleased dependencies are only valid for dependency versions.
diff --git a/pom.xml b/pom.xml
index f3c7ab9c53b7..e10054086de8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -729,6 +729,7 @@
sdk/machinelearningservicessdk/maintenancesdk/managedapplications
+ sdk/managementgroupssdk/mariadbsdk/marketplaceorderingsdk/mediaservices
diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/CHANGELOG.md b/sdk/managementgroups/azure-resourcemanager-managementgroups/CHANGELOG.md
new file mode 100644
index 000000000000..204c14c8d32f
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/CHANGELOG.md
@@ -0,0 +1,8 @@
+# Release History
+
+## 1.0.0-beta.1 (2021-05-06)
+
+- Azure Resource Manager ManagementGroups client library for Java. This package contains Microsoft Azure SDK for ManagementGroups Management SDK. 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 tag package-2021-04. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt).
diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/README.md b/sdk/managementgroups/azure-resourcemanager-managementgroups/README.md
new file mode 100644
index 000000000000..ab3936e33a75
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/README.md
@@ -0,0 +1,102 @@
+# Azure Resource Manager ManagementGroups client library for Java
+
+Azure Resource Manager ManagementGroups client library for Java.
+
+This package contains Microsoft Azure SDK for ManagementGroups Management SDK. 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 tag package-2021-04. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt).
+
+## We'd love to hear your feedback
+
+We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better.
+
+If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together.
+
+Thank you in advance for your collaboration. We really appreciate your time!
+
+## Documentation
+
+Various documentation is available to help you get started
+
+- [API reference documentation][docs]
+
+## Getting started
+
+### Prerequisites
+
+- [Java Development Kit (JDK)][jdk] with version 8 or above
+- [Azure Subscription][azure_subscription]
+
+### Adding the package to your product
+
+[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-managementgroups;current})
+```xml
+
+ com.azure.resourcemanager
+ azure-resourcemanager-managementgroups
+ 1.0.0-beta.1
+
+```
+[//]: # ({x-version-update-end})
+
+### Include the recommended packages
+
+Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client.
+
+[Azure Identity][azure_identity] package and [Azure Core Netty HTTP][azure_core_http_netty] package provide the default implementation.
+
+### Authentication
+
+By default, Azure Active Directory token authentication depends on correct configure of following environment variables.
+
+- `AZURE_CLIENT_ID` for Azure client ID.
+- `AZURE_TENANT_ID` for Azure tenant ID.
+- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate.
+
+In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`.
+
+With above configuration, `azure` client can be authenticated by following code:
+
+```java
+AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
+TokenCredential credential = new DefaultAzureCredentialBuilder()
+ .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint())
+ .build();
+ManagementGroupsManager manager = ManagementGroupsManager
+ .authenticate(credential, profile);
+```
+
+The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise.
+
+See [Authentication][authenticate] for more options.
+
+## Key concepts
+
+See [API design][design] for general introduction on design and key concepts on Azure Management Libraries.
+
+## Examples
+
+## Troubleshooting
+
+## Next steps
+
+## Contributing
+
+For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/master/CONTRIBUTING.md).
+
+1. Fork it
+1. Create your feature branch (`git checkout -b my-new-feature`)
+1. Commit your changes (`git commit -am 'Add some feature'`)
+1. Push to the branch (`git push origin my-new-feature`)
+1. Create new Pull Request
+
+
+[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS
+[docs]: https://azure.github.io/azure-sdk-for-java/
+[jdk]: https://docs.microsoft.com/java/azure/jdk/
+[azure_subscription]: https://azure.microsoft.com/free/
+[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/identity/azure-identity
+[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/core/azure-core-http-netty
+[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/docs/AUTH.md
+[design]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/docs/DESIGN.md
diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/pom.xml b/sdk/managementgroups/azure-resourcemanager-managementgroups/pom.xml
new file mode 100644
index 000000000000..11c2c6be3a58
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/pom.xml
@@ -0,0 +1,70 @@
+
+ 4.0.0
+
+ com.azure
+ azure-client-sdk-parent
+ 1.7.0
+ ../../parents/azure-client-sdk-parent
+
+
+ com.azure.resourcemanager
+ azure-resourcemanager-managementgroups
+ 1.0.0-beta.1
+ jar
+
+ Microsoft Azure SDK for ManagementGroups Management
+ This package contains Microsoft Azure SDK for ManagementGroups Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. 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 tag package-2021-04.
+ https://github.com/Azure/azure-sdk-for-java
+
+
+
+ The MIT License (MIT)
+ http://opensource.org/licenses/MIT
+ repo
+
+
+
+
+ https://github.com/Azure/azure-sdk-for-java
+ scm:git:git@github.com:Azure/azure-sdk-for-java.git
+ scm:git:git@github.com:Azure/azure-sdk-for-java.git
+ HEAD
+
+
+
+ microsoft
+ Microsoft
+
+
+
+ UTF-8
+
+
+
+
+ com.azure
+ azure-core
+ 1.15.0
+
+
+ com.azure
+ azure-core-management
+ 1.2.1
+
+
+
+
+
+ org.jacoco
+ jacoco-maven-plugin
+ 0.8.5
+
+ true
+
+
+
+
+
diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/ManagementGroupsManager.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/ManagementGroupsManager.java
new file mode 100644
index 000000000000..c747f0264c7a
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/ManagementGroupsManager.java
@@ -0,0 +1,280 @@
+// 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;
+
+import com.azure.core.credential.TokenCredential;
+import com.azure.core.http.HttpClient;
+import com.azure.core.http.HttpPipeline;
+import com.azure.core.http.HttpPipelineBuilder;
+import com.azure.core.http.policy.AddDatePolicy;
+import com.azure.core.http.policy.BearerTokenAuthenticationPolicy;
+import com.azure.core.http.policy.HttpLogOptions;
+import com.azure.core.http.policy.HttpLoggingPolicy;
+import com.azure.core.http.policy.HttpPipelinePolicy;
+import com.azure.core.http.policy.HttpPolicyProviders;
+import com.azure.core.http.policy.RequestIdPolicy;
+import com.azure.core.http.policy.RetryPolicy;
+import com.azure.core.http.policy.UserAgentPolicy;
+import com.azure.core.management.profile.AzureProfile;
+import com.azure.core.util.Configuration;
+import com.azure.core.util.logging.ClientLogger;
+import com.azure.resourcemanager.managementgroups.fluent.ManagementGroupsApi;
+import com.azure.resourcemanager.managementgroups.implementation.EntitiesImpl;
+import com.azure.resourcemanager.managementgroups.implementation.HierarchySettingsOperationsImpl;
+import com.azure.resourcemanager.managementgroups.implementation.ManagementGroupSubscriptionsImpl;
+import com.azure.resourcemanager.managementgroups.implementation.ManagementGroupsApiBuilder;
+import com.azure.resourcemanager.managementgroups.implementation.ManagementGroupsImpl;
+import com.azure.resourcemanager.managementgroups.implementation.OperationsImpl;
+import com.azure.resourcemanager.managementgroups.implementation.ResourceProvidersImpl;
+import com.azure.resourcemanager.managementgroups.models.Entities;
+import com.azure.resourcemanager.managementgroups.models.HierarchySettingsOperations;
+import com.azure.resourcemanager.managementgroups.models.ManagementGroupSubscriptions;
+import com.azure.resourcemanager.managementgroups.models.ManagementGroups;
+import com.azure.resourcemanager.managementgroups.models.Operations;
+import com.azure.resourcemanager.managementgroups.models.ResourceProviders;
+import java.time.Duration;
+import java.time.temporal.ChronoUnit;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * Entry point to ManagementGroupsManager. 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.
+ */
+public final class ManagementGroupsManager {
+ private ManagementGroups managementGroups;
+
+ private ManagementGroupSubscriptions managementGroupSubscriptions;
+
+ private HierarchySettingsOperations hierarchySettingsOperations;
+
+ private Operations operations;
+
+ private ResourceProviders resourceProviders;
+
+ private Entities entities;
+
+ private final ManagementGroupsApi clientObject;
+
+ private ManagementGroupsManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) {
+ Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null.");
+ Objects.requireNonNull(profile, "'profile' cannot be null.");
+ this.clientObject =
+ new ManagementGroupsApiBuilder()
+ .pipeline(httpPipeline)
+ .endpoint(profile.getEnvironment().getResourceManagerEndpoint())
+ .defaultPollInterval(defaultPollInterval)
+ .buildClient();
+ }
+
+ /**
+ * 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 static ManagementGroupsManager authenticate(TokenCredential credential, AzureProfile profile) {
+ Objects.requireNonNull(credential, "'credential' cannot be null.");
+ Objects.requireNonNull(profile, "'profile' cannot be null.");
+ return configure().authenticate(credential, profile);
+ }
+
+ /**
+ * Gets a Configurable instance that can be used to create ManagementGroupsManager with optional configuration.
+ *
+ * @return the Configurable instance allowing configurations.
+ */
+ public static Configurable configure() {
+ return new ManagementGroupsManager.Configurable();
+ }
+
+ /** The Configurable allowing configurations to be set. */
+ public static final class Configurable {
+ private final ClientLogger logger = new ClientLogger(Configurable.class);
+
+ private HttpClient httpClient;
+ private HttpLogOptions httpLogOptions;
+ private final List policies = new ArrayList<>();
+ private RetryPolicy retryPolicy;
+ 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;
+ }
+
+ /**
+ * 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 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, "'retryPolicy' cannot be null.");
+ if (this.defaultPollInterval.isNegative()) {
+ throw logger.logExceptionAsError(new IllegalArgumentException("'httpPipeline' 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 (retryPolicy == null) {
+ retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS);
+ }
+ List policies = new ArrayList<>();
+ policies.add(new UserAgentPolicy(userAgentBuilder.toString()));
+ policies.add(new RequestIdPolicy());
+ HttpPolicyProviders.addBeforeRetryPolicies(policies);
+ policies.add(retryPolicy);
+ policies.add(new AddDatePolicy());
+ policies
+ .add(
+ new BearerTokenAuthenticationPolicy(
+ credential, profile.getEnvironment().getManagementEndpoint() + "/.default"));
+ policies.addAll(this.policies);
+ 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);
+ }
+ }
+
+ /** @return Resource collection API of ManagementGroups. */
+ public ManagementGroups managementGroups() {
+ if (this.managementGroups == null) {
+ this.managementGroups = new ManagementGroupsImpl(clientObject.getManagementGroups(), this);
+ }
+ return managementGroups;
+ }
+
+ /** @return Resource collection API of ManagementGroupSubscriptions. */
+ public ManagementGroupSubscriptions managementGroupSubscriptions() {
+ if (this.managementGroupSubscriptions == null) {
+ this.managementGroupSubscriptions =
+ new ManagementGroupSubscriptionsImpl(clientObject.getManagementGroupSubscriptions(), this);
+ }
+ return managementGroupSubscriptions;
+ }
+
+ /** @return Resource collection API of HierarchySettingsOperations. */
+ public HierarchySettingsOperations hierarchySettingsOperations() {
+ if (this.hierarchySettingsOperations == null) {
+ this.hierarchySettingsOperations =
+ new HierarchySettingsOperationsImpl(clientObject.getHierarchySettingsOperations(), this);
+ }
+ return hierarchySettingsOperations;
+ }
+
+ /** @return Resource collection API of Operations. */
+ public Operations operations() {
+ if (this.operations == null) {
+ this.operations = new OperationsImpl(clientObject.getOperations(), this);
+ }
+ return operations;
+ }
+
+ /** @return Resource collection API of ResourceProviders. */
+ public ResourceProviders resourceProviders() {
+ if (this.resourceProviders == null) {
+ this.resourceProviders = new ResourceProvidersImpl(clientObject.getResourceProviders(), this);
+ }
+ return resourceProviders;
+ }
+
+ /** @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..b6abc61d7e7e
--- /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.EntitiesSearch;
+import com.azure.resourcemanager.managementgroups.models.EntitiesView;
+
+/** 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.
+ */
+ @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.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ PagedIterable list(
+ String skiptoken,
+ Integer skip,
+ Integer top,
+ String select,
+ EntitiesSearch search,
+ String filter,
+ EntitiesView 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..26b89c4fc5ea
--- /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.
+ */
+ @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.
+ */
+ @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.
+ */
+ @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.
+ */
+ @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 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..cd82b6620686
--- /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.
+ */
+ @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 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.
+ */
+ @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.
+ */
+ @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.
+ */
+ @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..9c71771c129c
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/ManagementGroupsClient.java
@@ -0,0 +1,311 @@
+// 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.ManagementGroupsExpand;
+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.
+ */
+ @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.
+ */
+ @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.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ Response getWithResponse(
+ String groupId,
+ ManagementGroupsExpand 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 management group details.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ 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 management group details.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ 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.
+ */
+ @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 results of Azure-AsyncOperation.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ 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 results of Azure-AsyncOperation.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ 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.
+ */
+ @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.
+ */
+ @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..f5e8e42569ce
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/OperationsClient.java
@@ -0,0 +1,36 @@
+// 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.
+ */
+ @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.
+ */
+ @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..e6f57361afee
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/ResourceProvidersClient.java
@@ -0,0 +1,86 @@
+// 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.
+ */
+ @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.
+ */
+ @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.
+ */
+ @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..5aef4fe2811f
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/AzureAsyncOperationResultsInner.java
@@ -0,0 +1,147 @@
+// 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.annotation.JsonFlatten;
+import com.azure.core.util.logging.ClientLogger;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/** The results of Azure-AsyncOperation. */
+@JsonFlatten
+@Fluent
+public class AzureAsyncOperationResultsInner {
+ @JsonIgnore private final ClientLogger logger = new ClientLogger(AzureAsyncOperationResultsInner.class);
+
+ /*
+ * 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 AAD Tenant ID associated with the management group. For example,
+ * 00000000-0000-0000-0000-000000000000
+ */
+ @JsonProperty(value = "properties.tenantId")
+ private String tenantId;
+
+ /*
+ * The friendly name of the management group.
+ */
+ @JsonProperty(value = "properties.displayName")
+ private String displayName;
+
+ /**
+ * 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 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 AzureAsyncOperationResultsInner object itself.
+ */
+ public AzureAsyncOperationResultsInner 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 AzureAsyncOperationResultsInner object itself.
+ */
+ public AzureAsyncOperationResultsInner 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/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..53081df324d0
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/CheckNameAvailabilityResultInner.java
@@ -0,0 +1,84 @@
+// 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.core.util.logging.ClientLogger;
+import com.azure.resourcemanager.managementgroups.models.Reason;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/** Describes the result of the request to check management group name availability. */
+@Immutable
+public final class CheckNameAvailabilityResultInner {
+ @JsonIgnore private final ClientLogger logger = new ClientLogger(CheckNameAvailabilityResultInner.class);
+
+ /*
+ * 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/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..11a25da3faf4
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/DescendantInfoInner.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.annotation.JsonFlatten;
+import com.azure.core.util.logging.ClientLogger;
+import com.azure.resourcemanager.managementgroups.models.DescendantParentGroupInfo;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/** The descendant. */
+@JsonFlatten
+@Fluent
+public class DescendantInfoInner {
+ @JsonIgnore private final ClientLogger logger = new ClientLogger(DescendantInfoInner.class);
+
+ /*
+ * 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 friendly name of the management group.
+ */
+ @JsonProperty(value = "properties.displayName")
+ private String displayName;
+
+ /*
+ * The ID of the parent management group.
+ */
+ @JsonProperty(value = "properties.parent")
+ private DescendantParentGroupInfo parent;
+
+ /**
+ * 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 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 DescendantInfoInner object itself.
+ */
+ public DescendantInfoInner 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 DescendantInfoInner object itself.
+ */
+ public DescendantInfoInner 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/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..546c1565677d
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/EntityInfoInner.java
@@ -0,0 +1,353 @@
+// 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.annotation.JsonFlatten;
+import com.azure.core.util.logging.ClientLogger;
+import com.azure.resourcemanager.managementgroups.models.EntityParentGroupInfo;
+import com.azure.resourcemanager.managementgroups.models.Permissions;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.util.List;
+
+/** The entity. */
+@JsonFlatten
+@Fluent
+public class EntityInfoInner {
+ @JsonIgnore private final ClientLogger logger = new ClientLogger(EntityInfoInner.class);
+
+ /*
+ * 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 AAD Tenant ID associated with the entity. For example,
+ * 00000000-0000-0000-0000-000000000000
+ */
+ @JsonProperty(value = "properties.tenantId")
+ private String tenantId;
+
+ /*
+ * The friendly name of the management group.
+ */
+ @JsonProperty(value = "properties.displayName")
+ private String displayName;
+
+ /*
+ * (Optional) The ID of the parent management group.
+ */
+ @JsonProperty(value = "properties.parent")
+ private EntityParentGroupInfo parent;
+
+ /*
+ * The users specific permissions to this item.
+ */
+ @JsonProperty(value = "properties.permissions")
+ private Permissions permissions;
+
+ /*
+ * The users specific permissions to this item.
+ */
+ @JsonProperty(value = "properties.inheritedPermissions")
+ private Permissions inheritedPermissions;
+
+ /*
+ * Number of Descendants
+ */
+ @JsonProperty(value = "properties.numberOfDescendants")
+ private Integer numberOfDescendants;
+
+ /*
+ * Number of children is the number of Groups and Subscriptions that are
+ * exactly one level underneath the current Group.
+ */
+ @JsonProperty(value = "properties.numberOfChildren")
+ private Integer numberOfChildren;
+
+ /*
+ * Number of children is the number of Groups that are exactly one level
+ * underneath the current Group.
+ */
+ @JsonProperty(value = "properties.numberOfChildGroups")
+ private Integer numberOfChildGroups;
+
+ /*
+ * The parent display name chain from the root group to the immediate
+ * parent
+ */
+ @JsonProperty(value = "properties.parentDisplayNameChain")
+ private List parentDisplayNameChain;
+
+ /*
+ * The parent name chain from the root group to the immediate parent
+ */
+ @JsonProperty(value = "properties.parentNameChain")
+ private List parentNameChain;
+
+ /**
+ * 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 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 EntityInfoInner object itself.
+ */
+ public EntityInfoInner 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 EntityInfoInner object itself.
+ */
+ public EntityInfoInner 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 EntityInfoInner object itself.
+ */
+ public EntityInfoInner 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 EntityInfoInner object itself.
+ */
+ public EntityInfoInner 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 EntityInfoInner object itself.
+ */
+ public EntityInfoInner 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 EntityInfoInner object itself.
+ */
+ public EntityInfoInner withNumberOfDescendants(Integer numberOfDescendants) {
+ this.numberOfDescendants = numberOfDescendants;
+ return this;
+ }
+
+ /**
+ * Get the numberOfChildren property: 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 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) {
+ this.numberOfChildren = numberOfChildren;
+ return this;
+ }
+
+ /**
+ * Get the numberOfChildGroups property: 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 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) {
+ 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 EntityInfoInner object itself.
+ */
+ public EntityInfoInner 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 EntityInfoInner object itself.
+ */
+ public EntityInfoInner 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..c38ea0e5b510
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/HierarchySettingsInner.java
@@ -0,0 +1,128 @@
+// 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.annotation.JsonFlatten;
+import com.azure.core.management.ProxyResource;
+import com.azure.core.util.logging.ClientLogger;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/** Settings defined at the Management Group scope. */
+@JsonFlatten
+@Fluent
+public class HierarchySettingsInner extends ProxyResource {
+ @JsonIgnore private final ClientLogger logger = new ClientLogger(HierarchySettingsInner.class);
+
+ /*
+ * The AAD Tenant ID associated with the hierarchy settings. For example,
+ * 00000000-0000-0000-0000-000000000000
+ */
+ @JsonProperty(value = "properties.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 = "properties.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 = "properties.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 HierarchySettingsInner object itself.
+ */
+ public HierarchySettingsInner 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 HierarchySettingsInner object itself.
+ */
+ public HierarchySettingsInner 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 HierarchySettingsInner object itself.
+ */
+ public HierarchySettingsInner 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/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..f36a56be0349
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/HierarchySettingsListInner.java
@@ -0,0 +1,70 @@
+// 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.util.logging.ClientLogger;
+import com.azure.resourcemanager.managementgroups.models.HierarchySettingsInfo;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.util.List;
+
+/** Lists all hierarchy settings. */
+@Fluent
+public final class HierarchySettingsListInner {
+ @JsonIgnore private final ClientLogger logger = new ClientLogger(HierarchySettingsListInner.class);
+
+ /*
+ * 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/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..b202b81b3882
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/ManagementGroupInfoInner.java
@@ -0,0 +1,130 @@
+// 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.annotation.JsonFlatten;
+import com.azure.core.util.logging.ClientLogger;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/** The management group resource. */
+@JsonFlatten
+@Fluent
+public class ManagementGroupInfoInner {
+ @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagementGroupInfoInner.class);
+
+ /*
+ * 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 AAD Tenant ID associated with the management group. For example,
+ * 00000000-0000-0000-0000-000000000000
+ */
+ @JsonProperty(value = "properties.tenantId")
+ private String tenantId;
+
+ /*
+ * The friendly name of the management group.
+ */
+ @JsonProperty(value = "properties.displayName")
+ private String displayName;
+
+ /**
+ * 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 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 ManagementGroupInfoInner object itself.
+ */
+ public ManagementGroupInfoInner 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 ManagementGroupInfoInner object itself.
+ */
+ public ManagementGroupInfoInner 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..cf017b210bfd
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/ManagementGroupInner.java
@@ -0,0 +1,143 @@
+// 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.annotation.JsonFlatten;
+import com.azure.core.management.ProxyResource;
+import com.azure.core.util.logging.ClientLogger;
+import com.azure.resourcemanager.managementgroups.models.ManagementGroupChildInfo;
+import com.azure.resourcemanager.managementgroups.models.ManagementGroupDetails;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.util.List;
+
+/** The management group details. */
+@JsonFlatten
+@Fluent
+public class ManagementGroupInner extends ProxyResource {
+ @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagementGroupInner.class);
+
+ /*
+ * The AAD Tenant ID associated with the management group. For example,
+ * 00000000-0000-0000-0000-000000000000
+ */
+ @JsonProperty(value = "properties.tenantId")
+ private String tenantId;
+
+ /*
+ * The friendly name of the management group.
+ */
+ @JsonProperty(value = "properties.displayName")
+ private String displayName;
+
+ /*
+ * The details of a management group.
+ */
+ @JsonProperty(value = "properties.details")
+ private ManagementGroupDetails details;
+
+ /*
+ * The list of children.
+ */
+ @JsonProperty(value = "properties.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 ManagementGroupInner object itself.
+ */
+ public ManagementGroupInner 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 ManagementGroupInner object itself.
+ */
+ public ManagementGroupInner 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 ManagementGroupInner object itself.
+ */
+ public ManagementGroupInner 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 ManagementGroupInner object itself.
+ */
+ public ManagementGroupInner 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..9f87c381a1b9
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/OperationInner.java
@@ -0,0 +1,69 @@
+// 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.util.logging.ClientLogger;
+import com.azure.resourcemanager.managementgroups.models.OperationDisplayProperties;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/** Operation supported by the Microsoft.Management resource provider. */
+@Fluent
+public final class OperationInner {
+ @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationInner.class);
+
+ /*
+ * 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..9caad205a1fc
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/SubscriptionUnderManagementGroupInner.java
@@ -0,0 +1,138 @@
+// 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.annotation.JsonFlatten;
+import com.azure.core.management.ProxyResource;
+import com.azure.core.util.logging.ClientLogger;
+import com.azure.resourcemanager.managementgroups.models.DescendantParentGroupInfo;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/** The details of subscription under management group. */
+@JsonFlatten
+@Fluent
+public class SubscriptionUnderManagementGroupInner extends ProxyResource {
+ @JsonIgnore private final ClientLogger logger = new ClientLogger(SubscriptionUnderManagementGroupInner.class);
+
+ /*
+ * The AAD Tenant ID associated with the subscription. For example,
+ * 00000000-0000-0000-0000-000000000000
+ */
+ @JsonProperty(value = "properties.tenant")
+ private String tenant;
+
+ /*
+ * The friendly name of the subscription.
+ */
+ @JsonProperty(value = "properties.displayName")
+ private String displayName;
+
+ /*
+ * The ID of the parent management group.
+ */
+ @JsonProperty(value = "properties.parent")
+ private DescendantParentGroupInfo parent;
+
+ /*
+ * The state of the subscription.
+ */
+ @JsonProperty(value = "properties.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 SubscriptionUnderManagementGroupInner object itself.
+ */
+ public SubscriptionUnderManagementGroupInner 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 SubscriptionUnderManagementGroupInner object itself.
+ */
+ public SubscriptionUnderManagementGroupInner 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 SubscriptionUnderManagementGroupInner object itself.
+ */
+ public SubscriptionUnderManagementGroupInner 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 SubscriptionUnderManagementGroupInner object itself.
+ */
+ public SubscriptionUnderManagementGroupInner 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..ebe015201874
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/TenantBackfillStatusResultInner.java
@@ -0,0 +1,57 @@
+// 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.core.util.logging.ClientLogger;
+import com.azure.resourcemanager.managementgroups.models.Status;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/** The tenant backfill status. */
+@Immutable
+public final class TenantBackfillStatusResultInner {
+ @JsonIgnore private final ClientLogger logger = new ClientLogger(TenantBackfillStatusResultInner.class);
+
+ /*
+ * 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..6975a077ee3f
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/EntitiesClientImpl.java
@@ -0,0 +1,554 @@
+// 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.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.EntitiesSearch;
+import com.azure.resourcemanager.managementgroups.models.EntitiesView;
+import com.azure.resourcemanager.managementgroups.models.EntityListResult;
+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 {
+ private final ClientLogger logger = new ClientLogger(EntitiesClientImpl.class);
+
+ /** 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") EntitiesSearch search,
+ @QueryParam("$filter") String filter,
+ @QueryParam("$view") EntitiesView 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.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono> listSinglePageAsync(
+ String skiptoken,
+ Integer skip,
+ Integer top,
+ String select,
+ EntitiesSearch search,
+ String filter,
+ EntitiesView 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.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono> listSinglePageAsync(
+ String skiptoken,
+ Integer skip,
+ Integer top,
+ String select,
+ EntitiesSearch search,
+ String filter,
+ EntitiesView 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.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ private PagedFlux listAsync(
+ String skiptoken,
+ Integer skip,
+ Integer top,
+ String select,
+ EntitiesSearch search,
+ String filter,
+ EntitiesView 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.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ private PagedFlux listAsync() {
+ final String skiptoken = null;
+ final Integer skip = null;
+ final Integer top = null;
+ final String select = null;
+ final EntitiesSearch search = null;
+ final String filter = null;
+ final EntitiesView 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.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ private PagedFlux listAsync(
+ String skiptoken,
+ Integer skip,
+ Integer top,
+ String select,
+ EntitiesSearch search,
+ String filter,
+ EntitiesView 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.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedIterable list() {
+ final String skiptoken = null;
+ final Integer skip = null;
+ final Integer top = null;
+ final String select = null;
+ final EntitiesSearch search = null;
+ final String filter = null;
+ final EntitiesView 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.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedIterable list(
+ String skiptoken,
+ Integer skip,
+ Integer top,
+ String select,
+ EntitiesSearch search,
+ String filter,
+ EntitiesView 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.
+ */
+ @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.
+ */
+ @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..8358c2e8e648
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/EntitiesImpl.java
@@ -0,0 +1,61 @@
+// 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.EntitiesSearch;
+import com.azure.resourcemanager.managementgroups.models.EntitiesView;
+import com.azure.resourcemanager.managementgroups.models.EntityInfo;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+
+public final class EntitiesImpl implements Entities {
+ @JsonIgnore private 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,
+ EntitiesSearch search,
+ String filter,
+ EntitiesView 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..64a24f1698a4
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/HierarchySettingsOperationsClientImpl.java
@@ -0,0 +1,727 @@
+// 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.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 reactor.core.publisher.Mono;
+
+/** An instance of this class provides access to all the operations defined in HierarchySettingsOperationsClient. */
+public final class HierarchySettingsOperationsClientImpl implements HierarchySettingsOperationsClient {
+ private final ClientLogger logger = new ClientLogger(HierarchySettingsOperationsClientImpl.class);
+
+ /** 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.
+ */
+ @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.
+ */
+ @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.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono listAsync(String groupId) {
+ return listWithResponseAsync(groupId)
+ .flatMap(
+ (Response res) -> {
+ if (res.getValue() != null) {
+ return Mono.just(res.getValue());
+ } else {
+ return Mono.empty();
+ }
+ });
+ }
+
+ /**
+ * 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.
+ */
+ @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.
+ */
+ @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.
+ */
+ @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.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono getAsync(String groupId) {
+ return getWithResponseAsync(groupId)
+ .flatMap(
+ (Response res) -> {
+ if (res.getValue() != null) {
+ return Mono.just(res.getValue());
+ } else {
+ return Mono.empty();
+ }
+ });
+ }
+
+ /**
+ * 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.
+ */
+ @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.
+ */
+ @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.
+ */
+ @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.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono createOrUpdateAsync(
+ String groupId, CreateOrUpdateSettingsRequest createTenantSettingsRequest) {
+ return createOrUpdateWithResponseAsync(groupId, createTenantSettingsRequest)
+ .flatMap(
+ (Response res) -> {
+ if (res.getValue() != null) {
+ return Mono.just(res.getValue());
+ } else {
+ return Mono.empty();
+ }
+ });
+ }
+
+ /**
+ * 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.
+ */
+ @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.
+ */
+ @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.
+ */
+ @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.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono updateAsync(
+ String groupId, CreateOrUpdateSettingsRequest createTenantSettingsRequest) {
+ return updateWithResponseAsync(groupId, createTenantSettingsRequest)
+ .flatMap(
+ (Response res) -> {
+ if (res.getValue() != null) {
+ return Mono.just(res.getValue());
+ } else {
+ return Mono.empty();
+ }
+ });
+ }
+
+ /**
+ * 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.
+ */
+ @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 completion.
+ */
+ @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 completion.
+ */
+ @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 the completion.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono deleteAsync(String groupId) {
+ return deleteWithResponseAsync(groupId).flatMap((Response res) -> 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 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..0f00e3642b1a
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/HierarchySettingsOperationsImpl.java
@@ -0,0 +1,141 @@
+// 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;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+
+public final class HierarchySettingsOperationsImpl implements HierarchySettingsOperations {
+ @JsonIgnore private 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..f43341e229d6
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupSubscriptionsClientImpl.java
@@ -0,0 +1,874 @@
+// 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.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.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 {
+ private final ClientLogger logger = new ClientLogger(ManagementGroupSubscriptionsClientImpl.class);
+
+ /** 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.
+ */
+ @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.
+ */
+ @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.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono createAsync(
+ String groupId, String subscriptionId, String cacheControl) {
+ return createWithResponseAsync(groupId, subscriptionId, cacheControl)
+ .flatMap(
+ (Response res) -> {
+ if (res.getValue() != null) {
+ return Mono.just(res.getValue());
+ } else {
+ return Mono.empty();
+ }
+ });
+ }
+
+ /**
+ * 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)
+ private Mono createAsync(String groupId, String subscriptionId) {
+ final String cacheControl = null;
+ return createWithResponseAsync(groupId, subscriptionId, cacheControl)
+ .flatMap(
+ (Response res) -> {
+ if (res.getValue() != null) {
+ return Mono.just(res.getValue());
+ } else {
+ return Mono.empty();
+ }
+ });
+ }
+
+ /**
+ * 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.
+ */
+ @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 completion.
+ */
+ @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 completion.
+ */
+ @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 the completion.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono deleteAsync(String groupId, String subscriptionId, String cacheControl) {
+ return deleteWithResponseAsync(groupId, subscriptionId, cacheControl)
+ .flatMap((Response res) -> 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 the completion.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono deleteAsync(String groupId, String subscriptionId) {
+ final String cacheControl = null;
+ return deleteWithResponseAsync(groupId, subscriptionId, cacheControl)
+ .flatMap((Response res) -> 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 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.
+ */
+ @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.
+ */
+ @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.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono getSubscriptionAsync(
+ String groupId, String subscriptionId, String cacheControl) {
+ return getSubscriptionWithResponseAsync(groupId, subscriptionId, cacheControl)
+ .flatMap(
+ (Response res) -> {
+ if (res.getValue() != null) {
+ return Mono.just(res.getValue());
+ } else {
+ return Mono.empty();
+ }
+ });
+ }
+
+ /**
+ * 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)
+ private Mono getSubscriptionAsync(String groupId, String subscriptionId) {
+ final String cacheControl = null;
+ return getSubscriptionWithResponseAsync(groupId, subscriptionId, cacheControl)
+ .flatMap(
+ (Response res) -> {
+ if (res.getValue() != null) {
+ return Mono.just(res.getValue());
+ } else {
+ return Mono.empty();
+ }
+ });
+ }
+
+ /**
+ * 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.
+ */
+ @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.
+ */
+ @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.
+ */
+ @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.
+ */
+ @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.
+ */
+ @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.
+ */
+ @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.
+ */
+ @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.
+ */
+ @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.
+ */
+ @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.
+ */
+ @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..f02542a5f7ca
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupSubscriptionsImpl.java
@@ -0,0 +1,109 @@
+// 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;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+
+public final class ManagementGroupSubscriptionsImpl implements ManagementGroupSubscriptions {
+ @JsonIgnore private 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..2bdcc603bc0b
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupsApiBuilder.java
@@ -0,0 +1,129 @@
+// 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.CookiePolicy;
+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 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 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 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 (defaultPollInterval == null) {
+ this.defaultPollInterval = Duration.ofSeconds(30);
+ }
+ if (pipeline == null) {
+ this.pipeline =
+ new HttpPipelineBuilder()
+ .policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy())
+ .build();
+ }
+ 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..b388c83ccd53
--- /dev/null
+++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupsApiImpl.java
@@ -0,0 +1,348 @@
+// 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.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 java.util.Map;
+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 {
+ private final ClientLogger logger = new ClientLogger(ManagementGroupsApiImpl.class);
+
+ /** 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) {
+ for (Map.Entry