diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 07e70dcafe0c..4a059ccc15b5 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -392,6 +392,7 @@ com.azure.resourcemanager:azure-resourcemanager-appcomplianceautomation;1.0.0-be com.azure.resourcemanager:azure-resourcemanager-servicenetworking;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-recoveryservicessiterecovery;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-billingbenefits;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 com.azure.tools:azure-sdk-archetype;1.0.0;1.2.0-beta.1 com.azure.tools:azure-sdk-build-tool;1.0.0-beta.1;1.0.0-beta.2 diff --git a/pom.xml b/pom.xml index 5081c08637ea..4ccbd22ce16c 100644 --- a/pom.xml +++ b/pom.xml @@ -107,6 +107,7 @@ sdk/machinelearningservices sdk/maintenance sdk/managedapplications + sdk/managementgroups sdk/maps sdk/mariadb sdk/marketplaceordering diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/CHANGELOG.md b/sdk/managementgroups/azure-resourcemanager-managementgroups/CHANGELOG.md new file mode 100644 index 000000000000..c0616fb44317 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 1.0.0-beta.1 (2023-01-20) + +- 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..5479cc55cb0b --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/README.md @@ -0,0 +1,108 @@ +# 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] and [Azure Core Netty HTTP][azure_core_http_netty] packages provide the default implementation. + +### Authentication + +By default, Azure Active Directory token authentication depends on correct configuration of the 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 `AZURE_SUBSCRIPTION_ID` environment variable. + +With above configuration, `azure` client can be authenticated using the 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 + +[Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/managementgroups/azure-resourcemanager-managementgroups/SAMPLE.md) + + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide][cg]. + +This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit . + +When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repositories using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For more information see the [Code of Conduct FAQ][coc_faq] or contact with any additional questions or comments. + + +[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/main/sdk/identity/azure-identity +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md +[cg]: https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md +[coc]: https://opensource.microsoft.com/codeofconduct/ +[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/SAMPLE.md b/sdk/managementgroups/azure-resourcemanager-managementgroups/SAMPLE.md new file mode 100644 index 000000000000..8aaff7561a28 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/SAMPLE.md @@ -0,0 +1,584 @@ +# Code snippets and samples + + +## Entities + +- [List](#entities_list) + +## HierarchySettingsOperation + +- [CreateOrUpdate](#hierarchysettingsoperation_createorupdate) +- [Delete](#hierarchysettingsoperation_delete) +- [Get](#hierarchysettingsoperation_get) +- [List](#hierarchysettingsoperation_list) +- [Update](#hierarchysettingsoperation_update) + +## ManagementGroupSubscriptions + +- [Create](#managementgroupsubscriptions_create) +- [Delete](#managementgroupsubscriptions_delete) +- [GetSubscription](#managementgroupsubscriptions_getsubscription) +- [GetSubscriptionsUnderManagementGroup](#managementgroupsubscriptions_getsubscriptionsundermanagementgroup) + +## ManagementGroups + +- [CreateOrUpdate](#managementgroups_createorupdate) +- [Delete](#managementgroups_delete) +- [Get](#managementgroups_get) +- [GetDescendants](#managementgroups_getdescendants) +- [List](#managementgroups_list) +- [Update](#managementgroups_update) + +## Operations + +- [List](#operations_list) + +## ResourceProvider + +- [CheckNameAvailability](#resourceprovider_checknameavailability) +- [StartTenantBackfill](#resourceprovider_starttenantbackfill) +- [TenantBackfillStatus](#resourceprovider_tenantbackfillstatus) +### Entities_List + +```java +/** Samples for Entities List. */ +public final class EntitiesListSamples { + /* + * x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/GetEntities.json + */ + /** + * Sample code: GetEntities. + * + * @param manager Entry point to ManagementGroupsManager. + */ + public static void getEntities(com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager) { + manager.entities().list(null, null, null, null, null, null, null, null, null, com.azure.core.util.Context.NONE); + } +} +``` + +### HierarchySettingsOperation_CreateOrUpdate + +```java +import com.azure.resourcemanager.managementgroups.models.CreateOrUpdateSettingsRequest; + +/** Samples for HierarchySettingsOperation CreateOrUpdate. */ +public final class HierarchySettingsOperationCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/PutHierarchySettings.json + */ + /** + * Sample code: GetGroupSettings. + * + * @param manager Entry point to ManagementGroupsManager. + */ + public static void getGroupSettings(com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager) { + manager + .hierarchySettingsOperations() + .createOrUpdateWithResponse( + "root", + new CreateOrUpdateSettingsRequest() + .withRequireAuthorizationForGroupCreation(true) + .withDefaultManagementGroup("/providers/Microsoft.Management/managementGroups/DefaultGroup"), + com.azure.core.util.Context.NONE); + } +} +``` + +### HierarchySettingsOperation_Delete + +```java +/** Samples for HierarchySettingsOperation Delete. */ +public final class HierarchySettingsOperationDeleteSamples { + /* + * x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/DeleteHierarchySettings.json + */ + /** + * Sample code: GetGroupSettings. + * + * @param manager Entry point to ManagementGroupsManager. + */ + public static void getGroupSettings(com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager) { + manager.hierarchySettingsOperations().deleteWithResponse("root", com.azure.core.util.Context.NONE); + } +} +``` + +### HierarchySettingsOperation_Get + +```java +/** Samples for HierarchySettingsOperation Get. */ +public final class HierarchySettingsOperationGetSamples { + /* + * x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/GetHierarchySettings.json + */ + /** + * Sample code: GetGroupSettings. + * + * @param manager Entry point to ManagementGroupsManager. + */ + public static void getGroupSettings(com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager) { + manager.hierarchySettingsOperations().getWithResponse("root", com.azure.core.util.Context.NONE); + } +} +``` + +### HierarchySettingsOperation_List + +```java +/** Samples for HierarchySettingsOperation List. */ +public final class HierarchySettingsOperationListSamples { + /* + * x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/ListHierarchySettings.json + */ + /** + * Sample code: ListGroupSettings. + * + * @param manager Entry point to ManagementGroupsManager. + */ + public static void listGroupSettings(com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager) { + manager.hierarchySettingsOperations().listWithResponse("root", com.azure.core.util.Context.NONE); + } +} +``` + +### HierarchySettingsOperation_Update + +```java +import com.azure.resourcemanager.managementgroups.models.CreateOrUpdateSettingsRequest; + +/** Samples for HierarchySettingsOperation Update. */ +public final class HierarchySettingsOperationUpdateSamples { + /* + * x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/PatchHierarchySettings.json + */ + /** + * Sample code: GetGroupSettings. + * + * @param manager Entry point to ManagementGroupsManager. + */ + public static void getGroupSettings(com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager) { + manager + .hierarchySettingsOperations() + .updateWithResponse( + "root", + new CreateOrUpdateSettingsRequest() + .withRequireAuthorizationForGroupCreation(true) + .withDefaultManagementGroup("/providers/Microsoft.Management/managementGroups/DefaultGroup"), + com.azure.core.util.Context.NONE); + } +} +``` + +### ManagementGroupSubscriptions_Create + +```java +/** Samples for ManagementGroupSubscriptions Create. */ +public final class ManagementGroupSubscriptionsCreateSamples { + /* + * x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/AddManagementGroupSubscription.json + */ + /** + * Sample code: AddSubscriptionToManagementGroup. + * + * @param manager Entry point to ManagementGroupsManager. + */ + public static void addSubscriptionToManagementGroup( + com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager) { + manager + .managementGroupSubscriptions() + .createWithResponse( + "Group", "728bcbe4-8d56-4510-86c2-4921b8beefbc", "no-cache", com.azure.core.util.Context.NONE); + } +} +``` + +### ManagementGroupSubscriptions_Delete + +```java +/** Samples for ManagementGroupSubscriptions Delete. */ +public final class ManagementGroupSubscriptionsDeleteSamples { + /* + * x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/RemoveManagementGroupSubscription.json + */ + /** + * Sample code: DeleteSubscriptionFromManagementGroup. + * + * @param manager Entry point to ManagementGroupsManager. + */ + public static void deleteSubscriptionFromManagementGroup( + com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager) { + manager + .managementGroupSubscriptions() + .deleteWithResponse( + "Group", "728bcbe4-8d56-4510-86c2-4921b8beefbc", "no-cache", com.azure.core.util.Context.NONE); + } +} +``` + +### ManagementGroupSubscriptions_GetSubscription + +```java +/** Samples for ManagementGroupSubscriptions GetSubscription. */ +public final class ManagementGroupSubscriptionsGetSubscriptionSamples { + /* + * x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/GetSubscriptionFromManagementGroup.json + */ + /** + * Sample code: GetSubscriptionFromManagementGroup. + * + * @param manager Entry point to ManagementGroupsManager. + */ + public static void getSubscriptionFromManagementGroup( + com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager) { + manager + .managementGroupSubscriptions() + .getSubscriptionWithResponse( + "Group", "728bcbe4-8d56-4510-86c2-4921b8beefbc", "no-cache", com.azure.core.util.Context.NONE); + } +} +``` + +### ManagementGroupSubscriptions_GetSubscriptionsUnderManagementGroup + +```java +/** Samples for ManagementGroupSubscriptions GetSubscriptionsUnderManagementGroup. */ +public final class ManagementGroupSubscriptionsGetSubscriptionsUnderManagementGroupSamples { + /* + * x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/GetAllSubscriptionsFromManagementGroup.json + */ + /** + * Sample code: GetAllSubscriptionsFromManagementGroup. + * + * @param manager Entry point to ManagementGroupsManager. + */ + public static void getAllSubscriptionsFromManagementGroup( + com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager) { + manager + .managementGroupSubscriptions() + .getSubscriptionsUnderManagementGroup("Group", null, com.azure.core.util.Context.NONE); + } +} +``` + +### ManagementGroups_CreateOrUpdate + +```java +import com.azure.resourcemanager.managementgroups.models.CreateManagementGroupDetails; +import com.azure.resourcemanager.managementgroups.models.CreateManagementGroupRequest; +import com.azure.resourcemanager.managementgroups.models.CreateParentGroupInfo; + +/** Samples for ManagementGroups CreateOrUpdate. */ +public final class ManagementGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/PutManagementGroup.json + */ + /** + * Sample code: PutManagementGroup. + * + * @param manager Entry point to ManagementGroupsManager. + */ + public static void putManagementGroup(com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager) { + manager + .managementGroups() + .createOrUpdate( + "ChildGroup", + new CreateManagementGroupRequest() + .withDisplayName("ChildGroup") + .withDetails( + new CreateManagementGroupDetails() + .withParent( + new CreateParentGroupInfo() + .withId("/providers/Microsoft.Management/managementGroups/RootGroup"))), + "no-cache", + com.azure.core.util.Context.NONE); + } +} +``` + +### ManagementGroups_Delete + +```java +/** Samples for ManagementGroups Delete. */ +public final class ManagementGroupsDeleteSamples { + /* + * x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/DeleteManagementGroup.json + */ + /** + * Sample code: DeleteManagementGroup. + * + * @param manager Entry point to ManagementGroupsManager. + */ + public static void deleteManagementGroup( + com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager) { + manager.managementGroups().delete("GroupToDelete", "no-cache", com.azure.core.util.Context.NONE); + } +} +``` + +### ManagementGroups_Get + +```java +import com.azure.resourcemanager.managementgroups.models.ManagementGroupExpandType; + +/** Samples for ManagementGroups Get. */ +public final class ManagementGroupsGetSamples { + /* + * x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/GetManagementGroupWithPath.json + */ + /** + * Sample code: GetManagementGroupWithPath. + * + * @param manager Entry point to ManagementGroupsManager. + */ + public static void getManagementGroupWithPath( + com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager) { + manager + .managementGroups() + .getWithResponse( + "20000000-0001-0000-0000-000000000000", + ManagementGroupExpandType.PATH, + null, + null, + "no-cache", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/GetManagementGroupWithAncestors.json + */ + /** + * Sample code: GetManagementGroupWithAncestors. + * + * @param manager Entry point to ManagementGroupsManager. + */ + public static void getManagementGroupWithAncestors( + com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager) { + manager + .managementGroups() + .getWithResponse( + "20000000-0001-0000-0000-00000000000", + ManagementGroupExpandType.ANCESTORS, + null, + null, + "no-cache", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/GetManagementGroupWithExpand.json + */ + /** + * Sample code: GetManagementGroupWithExpand. + * + * @param manager Entry point to ManagementGroupsManager. + */ + public static void getManagementGroupWithExpand( + com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager) { + manager + .managementGroups() + .getWithResponse( + "20000000-0001-0000-0000-000000000000", + ManagementGroupExpandType.CHILDREN, + null, + null, + "no-cache", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/GetManagementGroup.json + */ + /** + * Sample code: GetManagementGroup. + * + * @param manager Entry point to ManagementGroupsManager. + */ + public static void getManagementGroup(com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager) { + manager + .managementGroups() + .getWithResponse( + "20000000-0001-0000-0000-000000000000", null, null, null, "no-cache", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/GetManagementGroupWithExpandAndRecurse.json + */ + /** + * Sample code: GetManagementGroupsWithExpandAndRecurse. + * + * @param manager Entry point to ManagementGroupsManager. + */ + public static void getManagementGroupsWithExpandAndRecurse( + com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager) { + manager + .managementGroups() + .getWithResponse( + "20000000-0001-0000-0000-000000000000", + ManagementGroupExpandType.CHILDREN, + true, + null, + "no-cache", + com.azure.core.util.Context.NONE); + } +} +``` + +### ManagementGroups_GetDescendants + +```java +/** Samples for ManagementGroups GetDescendants. */ +public final class ManagementGroupsGetDescendantsSamples { + /* + * x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/GetDescendants.json + */ + /** + * Sample code: GetDescendants. + * + * @param manager Entry point to ManagementGroupsManager. + */ + public static void getDescendants(com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager) { + manager + .managementGroups() + .getDescendants("20000000-0000-0000-0000-000000000000", null, null, com.azure.core.util.Context.NONE); + } +} +``` + +### ManagementGroups_List + +```java +/** Samples for ManagementGroups List. */ +public final class ManagementGroupsListSamples { + /* + * x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/ListManagementGroups.json + */ + /** + * Sample code: ListManagementGroups. + * + * @param manager Entry point to ManagementGroupsManager. + */ + public static void listManagementGroups( + com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager) { + manager.managementGroups().list("no-cache", null, com.azure.core.util.Context.NONE); + } +} +``` + +### ManagementGroups_Update + +```java +import com.azure.resourcemanager.managementgroups.models.PatchManagementGroupRequest; + +/** Samples for ManagementGroups Update. */ +public final class ManagementGroupsUpdateSamples { + /* + * x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/PatchManagementGroup.json + */ + /** + * Sample code: PatchManagementGroup. + * + * @param manager Entry point to ManagementGroupsManager. + */ + public static void patchManagementGroup( + com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager) { + manager + .managementGroups() + .updateWithResponse( + "ChildGroup", + new PatchManagementGroupRequest() + .withDisplayName("AlternateDisplayName") + .withParentGroupId("/providers/Microsoft.Management/managementGroups/AlternateRootGroup"), + "no-cache", + com.azure.core.util.Context.NONE); + } +} +``` + +### Operations_List + +```java +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/ListOperations.json + */ + /** + * Sample code: List Operations. + * + * @param manager Entry point to ManagementGroupsManager. + */ + public static void listOperations(com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} +``` + +### ResourceProvider_CheckNameAvailability + +```java +import com.azure.resourcemanager.managementgroups.models.CheckNameAvailabilityRequest; +import com.azure.resourcemanager.managementgroups.models.Type; + +/** Samples for ResourceProvider CheckNameAvailability. */ +public final class ResourceProviderCheckNameAvailabilitySamples { + /* + * x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/CheckManagementGroupNameAvailability.json + */ + /** + * Sample code: CheckManagementGroupNameAvailability. + * + * @param manager Entry point to ManagementGroupsManager. + */ + public static void checkManagementGroupNameAvailability( + com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager) { + manager + .resourceProviders() + .checkNameAvailabilityWithResponse( + new CheckNameAvailabilityRequest() + .withName("nameTocheck") + .withType(Type.MICROSOFT_MANAGEMENT_MANAGEMENT_GROUPS), + com.azure.core.util.Context.NONE); + } +} +``` + +### ResourceProvider_StartTenantBackfill + +```java +/** Samples for ResourceProvider StartTenantBackfill. */ +public final class ResourceProviderStartTenantBackfillSamples { + /* + * x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/StartTenantBackfillRequest.json + */ + /** + * Sample code: StartTenantBackfill. + * + * @param manager Entry point to ManagementGroupsManager. + */ + public static void startTenantBackfill(com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager) { + manager.resourceProviders().startTenantBackfillWithResponse(com.azure.core.util.Context.NONE); + } +} +``` + +### ResourceProvider_TenantBackfillStatus + +```java +/** Samples for ResourceProvider TenantBackfillStatus. */ +public final class ResourceProviderTenantBackfillStatusSamples { + /* + * x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/TenantBackfillStatusRequest.json + */ + /** + * Sample code: TenantBackfillStatus. + * + * @param manager Entry point to ManagementGroupsManager. + */ + public static void tenantBackfillStatus( + com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager) { + manager.resourceProviders().tenantBackfillStatusWithResponse(com.azure.core.util.Context.NONE); + } +} +``` + diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/pom.xml b/sdk/managementgroups/azure-resourcemanager-managementgroups/pom.xml new file mode 100644 index 000000000000..6a0fc98a8ac1 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/pom.xml @@ -0,0 +1,58 @@ + + 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 + true + + + + com.azure + azure-core + 1.35.0 + + + com.azure + azure-core-management + 1.10.0 + + + 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..571516015ef5 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/ManagementGroupsManager.java @@ -0,0 +1,367 @@ +// 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.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +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.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy; +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; +import java.util.stream.Collectors; + +/** + * 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); + } + + /** + * Creates an instance of ManagementGroups service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the ManagementGroups service API instance. + */ + public static ManagementGroupsManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new ManagementGroupsManager(httpPipeline, profile, null); + } + + /** + * 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 static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private RetryOptions retryOptions; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the retry options for the HTTP pipeline retry policy. + * + *

This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. + * + * @param retryOptions the retry options for the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryOptions(RetryOptions retryOptions) { + this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = + Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of ManagementGroups service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the ManagementGroups service API instance. + */ + public ManagementGroupsManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder + .append("azsdk-java") + .append("-") + .append("com.azure.resourcemanager.managementgroups") + .append("/") + .append("1.0.0-beta.1"); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder + .append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + if (retryOptions != null) { + retryPolicy = new RetryPolicy(retryOptions); + } else { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new AddHeadersFromContextPolicy()); + policies.add(new RequestIdPolicy()); + policies + .addAll( + this + .policies + .stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies + .addAll( + this + .policies + .stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new ManagementGroupsManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * Gets the resource collection API of ManagementGroups. + * + * @return Resource collection API of ManagementGroups. + */ + public ManagementGroups managementGroups() { + if (this.managementGroups == null) { + this.managementGroups = new ManagementGroupsImpl(clientObject.getManagementGroups(), this); + } + return managementGroups; + } + + /** + * Gets the resource collection API of ManagementGroupSubscriptions. + * + * @return Resource collection API of ManagementGroupSubscriptions. + */ + public ManagementGroupSubscriptions managementGroupSubscriptions() { + if (this.managementGroupSubscriptions == null) { + this.managementGroupSubscriptions = + new ManagementGroupSubscriptionsImpl(clientObject.getManagementGroupSubscriptions(), this); + } + return managementGroupSubscriptions; + } + + /** + * Gets the resource collection API of HierarchySettingsOperations. + * + * @return Resource collection API of HierarchySettingsOperations. + */ + public HierarchySettingsOperations hierarchySettingsOperations() { + if (this.hierarchySettingsOperations == null) { + this.hierarchySettingsOperations = + new HierarchySettingsOperationsImpl(clientObject.getHierarchySettingsOperations(), this); + } + return hierarchySettingsOperations; + } + + /** + * Gets the resource collection API of Operations. + * + * @return Resource collection API of Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** + * Gets the resource collection API of ResourceProviders. + * + * @return Resource collection API of ResourceProviders. + */ + public ResourceProviders resourceProviders() { + if (this.resourceProviders == null) { + this.resourceProviders = new ResourceProvidersImpl(clientObject.getResourceProviders(), this); + } + return resourceProviders; + } + + /** + * Gets the resource collection API of Entities. + * + * @return Resource collection API of Entities. + */ + public Entities entities() { + if (this.entities == null) { + this.entities = new EntitiesImpl(clientObject.getEntities(), this); + } + return entities; + } + + /** + * @return Wrapped service client ManagementGroupsApi providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + */ + public ManagementGroupsApi serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/EntitiesClient.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/EntitiesClient.java new file mode 100644 index 000000000000..b491a3dcb29a --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/EntitiesClient.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.managementgroups.fluent.models.EntityInfoInner; +import com.azure.resourcemanager.managementgroups.models.EntitySearchType; +import com.azure.resourcemanager.managementgroups.models.EntityViewParameterType; + +/** An instance of this class provides access to all the operations defined in EntitiesClient. */ +public interface EntitiesClient { + /** + * List all entities (Management Groups, Subscriptions, etc.) for the authenticated user. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to view entities as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List all entities (Management Groups, Subscriptions, etc.) for the authenticated user. + * + * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a + * previous response contains a nextLink element, the value of the nextLink element will include a token + * parameter that specifies a starting point to use for subsequent calls. + * @param skip Number of entities to skip over when retrieving results. Passing this in will override $skipToken. + * @param top Number of elements to return when retrieving results. Passing this in will override $skipToken. + * @param select This parameter specifies the fields to include in the response. Can include any combination of + * Name,DisplayName,Type,ParentDisplayNameChain,ParentChain, e.g. + * '$select=Name,DisplayName,Type,ParentDisplayNameChain,ParentNameChain'. When specified the $select parameter + * can override select in $skipToken. + * @param search The $search parameter is used in conjunction with the $filter parameter to return three different + * outputs depending on the parameter passed in. With $search=AllowedParents the API will return the entity info + * of all groups that the requested entity will be able to reparent to as determined by the user's permissions. + * With $search=AllowedChildren the API will return the entity info of all entities that can be added as + * children of the requested entity. With $search=ParentAndFirstLevelChildren the API will return the parent and + * first level of children that the user has either direct access to or indirect access via one of their + * descendants. With $search=ParentOnly the API will return only the group if the user has access to at least + * one of the descendants of the group. With $search=ChildrenOnly the API will return only the first level of + * children of the group entity info specified in $filter. The user must have direct access to the children + * entities or one of it's descendants for it to show up in the results. + * @param filter The filter parameter allows you to filter on the the name or display name fields. You can check for + * equality on the name field (e.g. name eq '{entityName}') and you can check for substrings on either the name + * or display name fields(e.g. contains(name, '{substringToSearch}'), contains(displayName, + * '{substringToSearch')). Note that the '{entityName}' and '{substringToSearch}' fields are checked case + * insensitively. + * @param view The view parameter allows clients to filter the type of data that is returned by the getEntities + * call. + * @param groupName A filter which allows the get entities call to focus on a particular group (i.e. "$filter=name + * eq 'groupName'"). + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to view entities as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String skiptoken, + Integer skip, + Integer top, + String select, + EntitySearchType search, + String filter, + EntityViewParameterType view, + String groupName, + String cacheControl, + Context context); +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/HierarchySettingsOperationsClient.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/HierarchySettingsOperationsClient.java new file mode 100644 index 000000000000..dad7d94d4fc8 --- /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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the hierarchy settings defined at the Management Group level along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listWithResponse(String groupId, Context context); + + /** + * Gets 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 the hierarchy settings defined at the Management Group level. Settings can only be set on the root + * Management Group of the hierarchy. + * + * @param groupId Management Group ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the hierarchy settings defined at the Management Group level along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String groupId, Context context); + + /** + * 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); + + /** + * Creates or updates the hierarchy settings defined at the Management Group level. + * + * @param groupId Management Group ID. + * @param createTenantSettingsRequest Tenant level settings request parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return settings defined at the Management Group scope along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String groupId, CreateOrUpdateSettingsRequest createTenantSettingsRequest, Context context); + + /** + * 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); + + /** + * Updates the hierarchy settings defined at the Management Group level. + * + * @param groupId Management Group ID. + * @param createTenantSettingsRequest Tenant level settings request parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return settings defined at the Management Group scope along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String groupId, CreateOrUpdateSettingsRequest createTenantSettingsRequest, Context context); + + /** + * 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); + + /** + * Deletes the hierarchy settings defined at the Management Group level. + * + * @param groupId Management Group ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String groupId, Context context); + + /** + * 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); +} 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..cd3d1718533a --- /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. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of subscription under management group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse( + String groupId, String subscriptionId, String cacheControl, Context context); + + /** + * 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); + + /** + * De-associates subscription from the management group. + * + * @param groupId Management Group ID. + * @param subscriptionId Subscription ID. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String groupId, String subscriptionId, String cacheControl, Context context); + + /** + * 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); + + /** + * Retrieves details about given subscription which is associated with the management group. + * + * @param groupId Management Group ID. + * @param subscriptionId Subscription ID. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of subscription under management group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getSubscriptionWithResponse( + String groupId, String subscriptionId, String cacheControl, Context context); + + /** + * Retrieves details about 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 all subscriptions which are associated with the management group. + * + * @param groupId Management Group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of all subscriptions under management group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable getSubscriptionsUnderManagementGroup(String groupId); + + /** + * Retrieves details about all subscriptions which are associated with the management group. + * + * @param groupId Management Group ID. + * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a + * previous response contains a nextLink element, the value of the nextLink element will include a token + * parameter that specifies a starting point to use for subsequent calls. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of all subscriptions under management group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable getSubscriptionsUnderManagementGroup( + String groupId, String skiptoken, Context context); +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/ManagementGroupsApi.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/ManagementGroupsApi.java new file mode 100644 index 000000000000..1f902bbe8809 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/ManagementGroupsApi.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for ManagementGroupsApi class. */ +public interface ManagementGroupsApi { + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the ManagementGroupsClient object to access its operations. + * + * @return the ManagementGroupsClient object. + */ + ManagementGroupsClient getManagementGroups(); + + /** + * Gets the ManagementGroupSubscriptionsClient object to access its operations. + * + * @return the ManagementGroupSubscriptionsClient object. + */ + ManagementGroupSubscriptionsClient getManagementGroupSubscriptions(); + + /** + * Gets the HierarchySettingsOperationsClient object to access its operations. + * + * @return the HierarchySettingsOperationsClient object. + */ + HierarchySettingsOperationsClient getHierarchySettingsOperations(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the ResourceProvidersClient object to access its operations. + * + * @return the ResourceProvidersClient object. + */ + ResourceProvidersClient getResourceProviders(); + + /** + * Gets the EntitiesClient object to access its operations. + * + * @return the EntitiesClient object. + */ + EntitiesClient getEntities(); +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/ManagementGroupsClient.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/ManagementGroupsClient.java new file mode 100644 index 000000000000..c404307d1578 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/ManagementGroupsClient.java @@ -0,0 +1,278 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.managementgroups.fluent.models.AzureAsyncOperationResultsInner; +import com.azure.resourcemanager.managementgroups.fluent.models.DescendantInfoInner; +import com.azure.resourcemanager.managementgroups.fluent.models.ManagementGroupInfoInner; +import com.azure.resourcemanager.managementgroups.fluent.models.ManagementGroupInner; +import com.azure.resourcemanager.managementgroups.models.CreateManagementGroupRequest; +import com.azure.resourcemanager.managementgroups.models.ManagementGroupExpandType; +import com.azure.resourcemanager.managementgroups.models.PatchManagementGroupRequest; + +/** An instance of this class provides access to all the operations defined in ManagementGroupsClient. */ +public interface ManagementGroupsClient { + /** + * List management groups for the authenticated user. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to list management groups as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List management groups for the authenticated user. + * + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a + * previous response contains a nextLink element, the value of the nextLink element will include a token + * parameter that specifies a starting point to use for subsequent calls. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to list management groups as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String cacheControl, String skiptoken, Context context); + + /** + * Get the details of the management group. + * + * @param groupId Management Group ID. + * @param expand The $expand=children query string parameter allows clients to request inclusion of children in the + * response payload. $expand=path includes the path from the root group to the current group. $expand=ancestors + * includes the ancestor Ids of the current group. + * @param recurse The $recurse=true query string parameter allows clients to request inclusion of entire hierarchy + * in the response payload. Note that $expand=children must be passed up if $recurse is set to true. + * @param filter A filter which allows the exclusion of subscriptions from results (i.e. '$filter=children.childType + * ne Subscription'). + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the management group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String groupId, + ManagementGroupExpandType expand, + Boolean recurse, + String filter, + String cacheControl, + Context context); + + /** + * 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); + + /** + * 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 {@link SyncPoller} for polling of the management group details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagementGroupInner> beginCreateOrUpdate( + 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 {@link SyncPoller} for polling of the management group details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagementGroupInner> beginCreateOrUpdate( + String groupId, + CreateManagementGroupRequest createManagementGroupRequest, + String cacheControl, + Context context); + + /** + * Create or update a management group. If a management group is already created and a subsequent create request is + * issued with different properties, the management group properties will be updated. + * + * @param groupId Management Group ID. + * @param createManagementGroupRequest Management group creation parameters. + * @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. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the management group details along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String groupId, PatchManagementGroupRequest patchGroupRequest, String cacheControl, Context context); + + /** + * 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); + + /** + * 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 {@link SyncPoller} for polling of the results of Azure-AsyncOperation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, AzureAsyncOperationResultsInner> beginDelete( + 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 {@link SyncPoller} for polling of the results of Azure-AsyncOperation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, AzureAsyncOperationResultsInner> beginDelete( + String groupId, String cacheControl, Context context); + + /** + * Delete management group. If a management group contains child resources, the request will fail. + * + * @param groupId Management Group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the results of Azure-AsyncOperation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AzureAsyncOperationResultsInner delete(String groupId); + + /** + * Delete management group. If a management group contains child resources, the request will fail. + * + * @param groupId Management Group ID. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the results of Azure-AsyncOperation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AzureAsyncOperationResultsInner delete(String groupId, String cacheControl, Context context); + + /** + * List all entities that descend from a management group. + * + * @param groupId Management Group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to view descendants as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable getDescendants(String groupId); + + /** + * List all entities that descend from a management group. + * + * @param groupId Management Group ID. + * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a + * previous response contains a nextLink element, the value of the nextLink element will include a token + * parameter that specifies a starting point to use for subsequent calls. + * @param top Number of elements to return when retrieving results. Passing this in will override $skipToken. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to view descendants as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable getDescendants(String groupId, String skiptoken, Integer top, Context context); +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/OperationsClient.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/OperationsClient.java new file mode 100644 index 000000000000..79c8f8bac816 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/OperationsClient.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.managementgroups.fluent.models.OperationInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * Lists all of the available Management REST API operations. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to list Microsoft.Management operations as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all of the available Management REST API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to list Microsoft.Management operations as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/ResourceProvidersClient.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/ResourceProvidersClient.java new file mode 100644 index 000000000000..f9447d711ef4 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/ResourceProvidersClient.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.managementgroups.fluent.models.CheckNameAvailabilityResultInner; +import com.azure.resourcemanager.managementgroups.fluent.models.TenantBackfillStatusResultInner; +import com.azure.resourcemanager.managementgroups.models.CheckNameAvailabilityRequest; + +/** An instance of this class provides access to all the operations defined in ResourceProvidersClient. */ +public interface ResourceProvidersClient { + /** + * Checks if the specified management group name is valid and unique. + * + * @param checkNameAvailabilityRequest Management group name availability check parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to check management group name availability along with {@link + * Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response checkNameAvailabilityWithResponse( + CheckNameAvailabilityRequest checkNameAvailabilityRequest, Context context); + + /** + * 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); + + /** + * Starts backfilling subscriptions for the Tenant. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the tenant backfill status along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response startTenantBackfillWithResponse(Context context); + + /** + * 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(); + + /** + * Gets tenant backfill status. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return tenant backfill status along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response tenantBackfillStatusWithResponse(Context context); + + /** + * 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(); +} 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..f20551beba45 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/AzureAsyncOperationResultsInner.java @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The results of Azure-AsyncOperation. */ +@Fluent +public final class AzureAsyncOperationResultsInner { + /* + * The fully qualified ID for the management group. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * The type of the resource. For example, Microsoft.Management/managementGroups + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * The name of the management group. For example, 00000000-0000-0000-0000-000000000000 + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The current status of the asynchronous operation performed . For example, Running, Succeeded, Failed + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /* + * The generic properties of a management group. + */ + @JsonProperty(value = "properties") + private ManagementGroupInfoProperties innerProperties; + + /** Creates an instance of AzureAsyncOperationResultsInner class. */ + public AzureAsyncOperationResultsInner() { + } + + /** + * Get the id property: The fully qualified ID for the management group. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the type property: The type of the resource. For example, Microsoft.Management/managementGroups. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the management group. For example, 00000000-0000-0000-0000-000000000000. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the status property: The current status of the asynchronous operation performed . For example, Running, + * Succeeded, Failed. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Get the innerProperties property: The generic properties of a management group. + * + * @return the innerProperties value. + */ + private ManagementGroupInfoProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the tenantId property: The AAD Tenant ID associated with the management group. For example, + * 00000000-0000-0000-0000-000000000000. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.innerProperties() == null ? null : this.innerProperties().tenantId(); + } + + /** + * Set the tenantId property: The AAD Tenant ID associated with the management group. For example, + * 00000000-0000-0000-0000-000000000000. + * + * @param tenantId the tenantId value to set. + * @return the AzureAsyncOperationResultsInner object itself. + */ + public AzureAsyncOperationResultsInner withTenantId(String tenantId) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagementGroupInfoProperties(); + } + this.innerProperties().withTenantId(tenantId); + return this; + } + + /** + * Get the displayName property: The friendly name of the management group. + * + * @return the displayName value. + */ + public String displayName() { + return this.innerProperties() == null ? null : this.innerProperties().displayName(); + } + + /** + * Set the displayName property: The friendly name of the management group. + * + * @param displayName the displayName value to set. + * @return the AzureAsyncOperationResultsInner object itself. + */ + public AzureAsyncOperationResultsInner withDisplayName(String displayName) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagementGroupInfoProperties(); + } + this.innerProperties().withDisplayName(displayName); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/CheckNameAvailabilityResultInner.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/CheckNameAvailabilityResultInner.java new file mode 100644 index 000000000000..80efa689cf1d --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/CheckNameAvailabilityResultInner.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.managementgroups.models.Reason; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes the result of the request to check management group name availability. */ +@Immutable +public final class CheckNameAvailabilityResultInner { + /* + * Required. True indicates name is valid and available. False indicates the name is invalid, unavailable, or both. + */ + @JsonProperty(value = "nameAvailable", access = JsonProperty.Access.WRITE_ONLY) + private Boolean nameAvailable; + + /* + * Required if nameAvailable == false. Invalid indicates the name provided does not match the resource provider's + * naming requirements (incorrect length, unsupported characters, etc.) AlreadyExists indicates that the name is + * already in use and is therefore unavailable. + */ + @JsonProperty(value = "reason", access = JsonProperty.Access.WRITE_ONLY) + private Reason reason; + + /* + * Required if nameAvailable == false. Localized. If reason == invalid, provide the user with the reason why the + * given name is invalid, and provide the resource naming requirements so that the user can select a valid name. If + * reason == AlreadyExists, explain that is already in use, and direct them to select a different name. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** Creates an instance of CheckNameAvailabilityResultInner class. */ + public CheckNameAvailabilityResultInner() { + } + + /** + * Get the nameAvailable property: Required. True indicates name is valid and available. False indicates the name is + * invalid, unavailable, or both. + * + * @return the nameAvailable value. + */ + public Boolean nameAvailable() { + return this.nameAvailable; + } + + /** + * Get the reason property: Required if nameAvailable == false. Invalid indicates the name provided does not match + * the resource provider's naming requirements (incorrect length, unsupported characters, etc.) AlreadyExists + * indicates that the name is already in use and is therefore unavailable. + * + * @return the reason value. + */ + public Reason reason() { + return this.reason; + } + + /** + * Get the message property: Required if nameAvailable == false. Localized. If reason == invalid, provide the user + * with the reason why the given name is invalid, and provide the resource naming requirements so that the user can + * select a valid name. If reason == AlreadyExists, explain that is already in use, and direct them to select a + * different name. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/CreateManagementGroupProperties.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/CreateManagementGroupProperties.java new file mode 100644 index 000000000000..43b0aaf54008 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/CreateManagementGroupProperties.java @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.managementgroups.models.CreateManagementGroupChildInfo; +import com.azure.resourcemanager.managementgroups.models.CreateManagementGroupDetails; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The generic properties of a management group used during creation. */ +@Fluent +public final class CreateManagementGroupProperties { + /* + * The AAD Tenant ID associated with the management group. For example, 00000000-0000-0000-0000-000000000000 + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /* + * The friendly name of the management group. If no value is passed then this field will be set to the groupId. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /* + * The details of a management group used during creation. + */ + @JsonProperty(value = "details") + private CreateManagementGroupDetails details; + + /* + * The list of children. + */ + @JsonProperty(value = "children", access = JsonProperty.Access.WRITE_ONLY) + private List children; + + /** Creates an instance of CreateManagementGroupProperties class. */ + public CreateManagementGroupProperties() { + } + + /** + * Get the tenantId property: The AAD Tenant ID associated with the management group. For example, + * 00000000-0000-0000-0000-000000000000. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the displayName property: The friendly name of the management group. If no value is passed then this field + * will be set to the groupId. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The friendly name of the management group. If no value is passed then this field + * will be set to the groupId. + * + * @param displayName the displayName value to set. + * @return the CreateManagementGroupProperties object itself. + */ + public CreateManagementGroupProperties withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the details property: The details of a management group used during creation. + * + * @return the details value. + */ + public CreateManagementGroupDetails details() { + return this.details; + } + + /** + * Set the details property: The details of a management group used during creation. + * + * @param details the details value to set. + * @return the CreateManagementGroupProperties object itself. + */ + public CreateManagementGroupProperties withDetails(CreateManagementGroupDetails details) { + this.details = details; + return this; + } + + /** + * Get the children property: The list of children. + * + * @return the children value. + */ + public List children() { + return this.children; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (details() != null) { + details().validate(); + } + if (children() != null) { + children().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/CreateOrUpdateSettingsProperties.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/CreateOrUpdateSettingsProperties.java new file mode 100644 index 000000000000..9b96f491043a --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/CreateOrUpdateSettingsProperties.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of the request to create or update Management Group settings. */ +@Fluent +public final class CreateOrUpdateSettingsProperties { + /* + * Indicates whether RBAC access is required upon group creation under the root Management Group. If set to true, + * user will require Microsoft.Management/managementGroups/write action on the root Management Group scope in order + * to create new Groups directly under the root. This will prevent new users from creating new Management Groups, + * unless they are given access. + */ + @JsonProperty(value = "requireAuthorizationForGroupCreation") + private Boolean requireAuthorizationForGroupCreation; + + /* + * Settings that sets the default Management Group under which new subscriptions get added in this tenant. For + * example, /providers/Microsoft.Management/managementGroups/defaultGroup + */ + @JsonProperty(value = "defaultManagementGroup") + private String defaultManagementGroup; + + /** Creates an instance of CreateOrUpdateSettingsProperties class. */ + public CreateOrUpdateSettingsProperties() { + } + + /** + * Get the requireAuthorizationForGroupCreation property: Indicates whether RBAC access is required upon group + * creation under the root Management Group. If set to true, user will require + * Microsoft.Management/managementGroups/write action on the root Management Group scope in order to create new + * Groups directly under the root. This will prevent new users from creating new Management Groups, unless they are + * given access. + * + * @return the requireAuthorizationForGroupCreation value. + */ + public Boolean requireAuthorizationForGroupCreation() { + return this.requireAuthorizationForGroupCreation; + } + + /** + * Set the requireAuthorizationForGroupCreation property: Indicates whether RBAC access is required upon group + * creation under the root Management Group. If set to true, user will require + * Microsoft.Management/managementGroups/write action on the root Management Group scope in order to create new + * Groups directly under the root. This will prevent new users from creating new Management Groups, unless they are + * given access. + * + * @param requireAuthorizationForGroupCreation the requireAuthorizationForGroupCreation value to set. + * @return the CreateOrUpdateSettingsProperties object itself. + */ + public CreateOrUpdateSettingsProperties withRequireAuthorizationForGroupCreation( + Boolean requireAuthorizationForGroupCreation) { + this.requireAuthorizationForGroupCreation = requireAuthorizationForGroupCreation; + return this; + } + + /** + * Get the defaultManagementGroup property: Settings that sets the default Management Group under which new + * subscriptions get added in this tenant. For example, + * /providers/Microsoft.Management/managementGroups/defaultGroup. + * + * @return the defaultManagementGroup value. + */ + public String defaultManagementGroup() { + return this.defaultManagementGroup; + } + + /** + * Set the defaultManagementGroup property: Settings that sets the default Management Group under which new + * subscriptions get added in this tenant. For example, + * /providers/Microsoft.Management/managementGroups/defaultGroup. + * + * @param defaultManagementGroup the defaultManagementGroup value to set. + * @return the CreateOrUpdateSettingsProperties object itself. + */ + public CreateOrUpdateSettingsProperties withDefaultManagementGroup(String defaultManagementGroup) { + this.defaultManagementGroup = defaultManagementGroup; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/DescendantInfoInner.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/DescendantInfoInner.java new file mode 100644 index 000000000000..44e7451ff601 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/DescendantInfoInner.java @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.managementgroups.models.DescendantParentGroupInfo; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The descendant. */ +@Fluent +public final class DescendantInfoInner { + /* + * The fully qualified ID for the descendant. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 or + * /subscriptions/0000000-0000-0000-0000-000000000000 + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * The type of the resource. For example, Microsoft.Management/managementGroups or /subscriptions + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * The name of the descendant. For example, 00000000-0000-0000-0000-000000000000 + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The generic properties of an descendant. + */ + @JsonProperty(value = "properties") + private DescendantInfoProperties innerProperties; + + /** Creates an instance of DescendantInfoInner class. */ + public DescendantInfoInner() { + } + + /** + * Get the id property: The fully qualified ID for the descendant. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 or + * /subscriptions/0000000-0000-0000-0000-000000000000. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the type property: The type of the resource. For example, Microsoft.Management/managementGroups or + * /subscriptions. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the descendant. For example, 00000000-0000-0000-0000-000000000000. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the innerProperties property: The generic properties of an descendant. + * + * @return the innerProperties value. + */ + private DescendantInfoProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the displayName property: The friendly name of the management group. + * + * @return the displayName value. + */ + public String displayName() { + return this.innerProperties() == null ? null : this.innerProperties().displayName(); + } + + /** + * Set the displayName property: The friendly name of the management group. + * + * @param displayName the displayName value to set. + * @return the DescendantInfoInner object itself. + */ + public DescendantInfoInner withDisplayName(String displayName) { + if (this.innerProperties() == null) { + this.innerProperties = new DescendantInfoProperties(); + } + this.innerProperties().withDisplayName(displayName); + return this; + } + + /** + * Get the parent property: The ID of the parent management group. + * + * @return the parent value. + */ + public DescendantParentGroupInfo parent() { + return this.innerProperties() == null ? null : this.innerProperties().parent(); + } + + /** + * Set the parent property: The ID of the parent management group. + * + * @param parent the parent value to set. + * @return the DescendantInfoInner object itself. + */ + public DescendantInfoInner withParent(DescendantParentGroupInfo parent) { + if (this.innerProperties() == null) { + this.innerProperties = new DescendantInfoProperties(); + } + this.innerProperties().withParent(parent); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/DescendantInfoProperties.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/DescendantInfoProperties.java new file mode 100644 index 000000000000..1074c38f4c17 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/DescendantInfoProperties.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.managementgroups.models.DescendantParentGroupInfo; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The generic properties of an descendant. */ +@Fluent +public final class DescendantInfoProperties { + /* + * The friendly name of the management group. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /* + * The ID of the parent management group. + */ + @JsonProperty(value = "parent") + private DescendantParentGroupInfo parent; + + /** Creates an instance of DescendantInfoProperties class. */ + public DescendantInfoProperties() { + } + + /** + * Get the displayName property: The friendly name of the management group. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The friendly name of the management group. + * + * @param displayName the displayName value to set. + * @return the DescendantInfoProperties object itself. + */ + public DescendantInfoProperties withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the parent property: The ID of the parent management group. + * + * @return the parent value. + */ + public DescendantParentGroupInfo parent() { + return this.parent; + } + + /** + * Set the parent property: The ID of the parent management group. + * + * @param parent the parent value to set. + * @return the DescendantInfoProperties object itself. + */ + public DescendantInfoProperties withParent(DescendantParentGroupInfo parent) { + this.parent = parent; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (parent() != null) { + parent().validate(); + } + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/EntityHierarchyItemProperties.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/EntityHierarchyItemProperties.java new file mode 100644 index 000000000000..ceb0219ce85c --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/EntityHierarchyItemProperties.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.managementgroups.models.EntityHierarchyItem; +import com.azure.resourcemanager.managementgroups.models.Permissions; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The generic properties of a management group. */ +@Fluent +public final class EntityHierarchyItemProperties { + /* + * The friendly name of the management group. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /* + * The users specific permissions to this item. + */ + @JsonProperty(value = "permissions") + private Permissions permissions; + + /* + * The list of children. + */ + @JsonProperty(value = "children") + private List children; + + /** Creates an instance of EntityHierarchyItemProperties class. */ + public EntityHierarchyItemProperties() { + } + + /** + * Get the displayName property: The friendly name of the management group. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The friendly name of the management group. + * + * @param displayName the displayName value to set. + * @return the EntityHierarchyItemProperties object itself. + */ + public EntityHierarchyItemProperties withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the permissions property: The users specific permissions to this item. + * + * @return the permissions value. + */ + public Permissions permissions() { + return this.permissions; + } + + /** + * Set the permissions property: The users specific permissions to this item. + * + * @param permissions the permissions value to set. + * @return the EntityHierarchyItemProperties object itself. + */ + public EntityHierarchyItemProperties withPermissions(Permissions permissions) { + this.permissions = permissions; + return this; + } + + /** + * Get the children property: The list of children. + * + * @return the children value. + */ + public List children() { + return this.children; + } + + /** + * Set the children property: The list of children. + * + * @param children the children value to set. + * @return the EntityHierarchyItemProperties object itself. + */ + public EntityHierarchyItemProperties withChildren(List children) { + this.children = children; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (children() != null) { + children().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/EntityInfoInner.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/EntityInfoInner.java new file mode 100644 index 000000000000..dbca0980bef4 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/EntityInfoInner.java @@ -0,0 +1,336 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.managementgroups.models.EntityParentGroupInfo; +import com.azure.resourcemanager.managementgroups.models.Permissions; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The entity. */ +@Fluent +public final class EntityInfoInner { + /* + * The fully qualified ID for the entity. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * The type of the resource. For example, Microsoft.Management/managementGroups + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * The name of the entity. For example, 00000000-0000-0000-0000-000000000000 + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The generic properties of an entity. + */ + @JsonProperty(value = "properties") + private EntityInfoProperties innerProperties; + + /** Creates an instance of EntityInfoInner class. */ + public EntityInfoInner() { + } + + /** + * Get the id property: The fully qualified ID for the entity. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the type property: The type of the resource. For example, Microsoft.Management/managementGroups. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the entity. For example, 00000000-0000-0000-0000-000000000000. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the innerProperties property: The generic properties of an entity. + * + * @return the innerProperties value. + */ + private EntityInfoProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the tenantId property: The AAD Tenant ID associated with the entity. For example, + * 00000000-0000-0000-0000-000000000000. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.innerProperties() == null ? null : this.innerProperties().tenantId(); + } + + /** + * Set the tenantId property: The AAD Tenant ID associated with the entity. For example, + * 00000000-0000-0000-0000-000000000000. + * + * @param tenantId the tenantId value to set. + * @return the EntityInfoInner object itself. + */ + public EntityInfoInner withTenantId(String tenantId) { + if (this.innerProperties() == null) { + this.innerProperties = new EntityInfoProperties(); + } + this.innerProperties().withTenantId(tenantId); + return this; + } + + /** + * Get the displayName property: The friendly name of the management group. + * + * @return the displayName value. + */ + public String displayName() { + return this.innerProperties() == null ? null : this.innerProperties().displayName(); + } + + /** + * Set the displayName property: The friendly name of the management group. + * + * @param displayName the displayName value to set. + * @return the EntityInfoInner object itself. + */ + public EntityInfoInner withDisplayName(String displayName) { + if (this.innerProperties() == null) { + this.innerProperties = new EntityInfoProperties(); + } + this.innerProperties().withDisplayName(displayName); + return this; + } + + /** + * Get the parent property: (Optional) The ID of the parent management group. + * + * @return the parent value. + */ + public EntityParentGroupInfo parent() { + return this.innerProperties() == null ? null : this.innerProperties().parent(); + } + + /** + * Set the parent property: (Optional) The ID of the parent management group. + * + * @param parent the parent value to set. + * @return the EntityInfoInner object itself. + */ + public EntityInfoInner withParent(EntityParentGroupInfo parent) { + if (this.innerProperties() == null) { + this.innerProperties = new EntityInfoProperties(); + } + this.innerProperties().withParent(parent); + return this; + } + + /** + * Get the permissions property: The users specific permissions to this item. + * + * @return the permissions value. + */ + public Permissions permissions() { + return this.innerProperties() == null ? null : this.innerProperties().permissions(); + } + + /** + * Set the permissions property: The users specific permissions to this item. + * + * @param permissions the permissions value to set. + * @return the EntityInfoInner object itself. + */ + public EntityInfoInner withPermissions(Permissions permissions) { + if (this.innerProperties() == null) { + this.innerProperties = new EntityInfoProperties(); + } + this.innerProperties().withPermissions(permissions); + return this; + } + + /** + * Get the inheritedPermissions property: The users specific permissions to this item. + * + * @return the inheritedPermissions value. + */ + public Permissions inheritedPermissions() { + return this.innerProperties() == null ? null : this.innerProperties().inheritedPermissions(); + } + + /** + * Set the inheritedPermissions property: The users specific permissions to this item. + * + * @param inheritedPermissions the inheritedPermissions value to set. + * @return the EntityInfoInner object itself. + */ + public EntityInfoInner withInheritedPermissions(Permissions inheritedPermissions) { + if (this.innerProperties() == null) { + this.innerProperties = new EntityInfoProperties(); + } + this.innerProperties().withInheritedPermissions(inheritedPermissions); + return this; + } + + /** + * Get the numberOfDescendants property: Number of Descendants. + * + * @return the numberOfDescendants value. + */ + public Integer numberOfDescendants() { + return this.innerProperties() == null ? null : this.innerProperties().numberOfDescendants(); + } + + /** + * Set the numberOfDescendants property: Number of Descendants. + * + * @param numberOfDescendants the numberOfDescendants value to set. + * @return the EntityInfoInner object itself. + */ + public EntityInfoInner withNumberOfDescendants(Integer numberOfDescendants) { + if (this.innerProperties() == null) { + this.innerProperties = new EntityInfoProperties(); + } + this.innerProperties().withNumberOfDescendants(numberOfDescendants); + return this; + } + + /** + * Get the numberOfChildren property: Number of Children + * + *

Number of children is the number of Groups and Subscriptions that are exactly one level underneath the current + * Group. + * + * @return the numberOfChildren value. + */ + public Integer numberOfChildren() { + return this.innerProperties() == null ? null : this.innerProperties().numberOfChildren(); + } + + /** + * Set the numberOfChildren property: Number of Children + * + *

Number of children is the number of Groups and Subscriptions that are exactly one level underneath the current + * Group. + * + * @param numberOfChildren the numberOfChildren value to set. + * @return the EntityInfoInner object itself. + */ + public EntityInfoInner withNumberOfChildren(Integer numberOfChildren) { + if (this.innerProperties() == null) { + this.innerProperties = new EntityInfoProperties(); + } + this.innerProperties().withNumberOfChildren(numberOfChildren); + return this; + } + + /** + * Get the numberOfChildGroups property: Number of Child Groups + * + *

Number of children is the number of Groups that are exactly one level underneath the current Group. + * + * @return the numberOfChildGroups value. + */ + public Integer numberOfChildGroups() { + return this.innerProperties() == null ? null : this.innerProperties().numberOfChildGroups(); + } + + /** + * Set the numberOfChildGroups property: Number of Child Groups + * + *

Number of children is the number of Groups that are exactly one level underneath the current Group. + * + * @param numberOfChildGroups the numberOfChildGroups value to set. + * @return the EntityInfoInner object itself. + */ + public EntityInfoInner withNumberOfChildGroups(Integer numberOfChildGroups) { + if (this.innerProperties() == null) { + this.innerProperties = new EntityInfoProperties(); + } + this.innerProperties().withNumberOfChildGroups(numberOfChildGroups); + return this; + } + + /** + * Get the parentDisplayNameChain property: The parent display name chain from the root group to the immediate + * parent. + * + * @return the parentDisplayNameChain value. + */ + public List parentDisplayNameChain() { + return this.innerProperties() == null ? null : this.innerProperties().parentDisplayNameChain(); + } + + /** + * Set the parentDisplayNameChain property: The parent display name chain from the root group to the immediate + * parent. + * + * @param parentDisplayNameChain the parentDisplayNameChain value to set. + * @return the EntityInfoInner object itself. + */ + public EntityInfoInner withParentDisplayNameChain(List parentDisplayNameChain) { + if (this.innerProperties() == null) { + this.innerProperties = new EntityInfoProperties(); + } + this.innerProperties().withParentDisplayNameChain(parentDisplayNameChain); + return this; + } + + /** + * Get the parentNameChain property: The parent name chain from the root group to the immediate parent. + * + * @return the parentNameChain value. + */ + public List parentNameChain() { + return this.innerProperties() == null ? null : this.innerProperties().parentNameChain(); + } + + /** + * Set the parentNameChain property: The parent name chain from the root group to the immediate parent. + * + * @param parentNameChain the parentNameChain value to set. + * @return the EntityInfoInner object itself. + */ + public EntityInfoInner withParentNameChain(List parentNameChain) { + if (this.innerProperties() == null) { + this.innerProperties = new EntityInfoProperties(); + } + this.innerProperties().withParentNameChain(parentNameChain); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/EntityInfoProperties.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/EntityInfoProperties.java new file mode 100644 index 000000000000..7cdd432de0ce --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/EntityInfoProperties.java @@ -0,0 +1,309 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.managementgroups.models.EntityParentGroupInfo; +import com.azure.resourcemanager.managementgroups.models.Permissions; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The generic properties of an entity. */ +@Fluent +public final class EntityInfoProperties { + /* + * The AAD Tenant ID associated with the entity. For example, 00000000-0000-0000-0000-000000000000 + */ + @JsonProperty(value = "tenantId") + private String tenantId; + + /* + * The friendly name of the management group. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /* + * (Optional) The ID of the parent management group. + */ + @JsonProperty(value = "parent") + private EntityParentGroupInfo parent; + + /* + * The users specific permissions to this item. + */ + @JsonProperty(value = "permissions") + private Permissions permissions; + + /* + * The users specific permissions to this item. + */ + @JsonProperty(value = "inheritedPermissions") + private Permissions inheritedPermissions; + + /* + * Number of Descendants + */ + @JsonProperty(value = "numberOfDescendants") + private Integer numberOfDescendants; + + /* + * Number of Children + * + * Number of children is the number of Groups and Subscriptions that are exactly one level underneath the current + * Group. + */ + @JsonProperty(value = "numberOfChildren") + private Integer numberOfChildren; + + /* + * Number of Child Groups + * + * Number of children is the number of Groups that are exactly one level underneath the current Group. + */ + @JsonProperty(value = "numberOfChildGroups") + private Integer numberOfChildGroups; + + /* + * The parent display name chain from the root group to the immediate parent + */ + @JsonProperty(value = "parentDisplayNameChain") + private List parentDisplayNameChain; + + /* + * The parent name chain from the root group to the immediate parent + */ + @JsonProperty(value = "parentNameChain") + private List parentNameChain; + + /** Creates an instance of EntityInfoProperties class. */ + public EntityInfoProperties() { + } + + /** + * Get the tenantId property: The AAD Tenant ID associated with the entity. For example, + * 00000000-0000-0000-0000-000000000000. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Set the tenantId property: The AAD Tenant ID associated with the entity. For example, + * 00000000-0000-0000-0000-000000000000. + * + * @param tenantId the tenantId value to set. + * @return the EntityInfoProperties object itself. + */ + public EntityInfoProperties withTenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Get the displayName property: The friendly name of the management group. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The friendly name of the management group. + * + * @param displayName the displayName value to set. + * @return the EntityInfoProperties object itself. + */ + public EntityInfoProperties withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the parent property: (Optional) The ID of the parent management group. + * + * @return the parent value. + */ + public EntityParentGroupInfo parent() { + return this.parent; + } + + /** + * Set the parent property: (Optional) The ID of the parent management group. + * + * @param parent the parent value to set. + * @return the EntityInfoProperties object itself. + */ + public EntityInfoProperties withParent(EntityParentGroupInfo parent) { + this.parent = parent; + return this; + } + + /** + * Get the permissions property: The users specific permissions to this item. + * + * @return the permissions value. + */ + public Permissions permissions() { + return this.permissions; + } + + /** + * Set the permissions property: The users specific permissions to this item. + * + * @param permissions the permissions value to set. + * @return the EntityInfoProperties object itself. + */ + public EntityInfoProperties withPermissions(Permissions permissions) { + this.permissions = permissions; + return this; + } + + /** + * Get the inheritedPermissions property: The users specific permissions to this item. + * + * @return the inheritedPermissions value. + */ + public Permissions inheritedPermissions() { + return this.inheritedPermissions; + } + + /** + * Set the inheritedPermissions property: The users specific permissions to this item. + * + * @param inheritedPermissions the inheritedPermissions value to set. + * @return the EntityInfoProperties object itself. + */ + public EntityInfoProperties withInheritedPermissions(Permissions inheritedPermissions) { + this.inheritedPermissions = inheritedPermissions; + return this; + } + + /** + * Get the numberOfDescendants property: Number of Descendants. + * + * @return the numberOfDescendants value. + */ + public Integer numberOfDescendants() { + return this.numberOfDescendants; + } + + /** + * Set the numberOfDescendants property: Number of Descendants. + * + * @param numberOfDescendants the numberOfDescendants value to set. + * @return the EntityInfoProperties object itself. + */ + public EntityInfoProperties withNumberOfDescendants(Integer numberOfDescendants) { + this.numberOfDescendants = numberOfDescendants; + return this; + } + + /** + * Get the numberOfChildren property: Number of Children + * + *

Number of children is the number of Groups and Subscriptions that are exactly one level underneath the current + * Group. + * + * @return the numberOfChildren value. + */ + public Integer numberOfChildren() { + return this.numberOfChildren; + } + + /** + * Set the numberOfChildren property: Number of Children + * + *

Number of children is the number of Groups and Subscriptions that are exactly one level underneath the current + * Group. + * + * @param numberOfChildren the numberOfChildren value to set. + * @return the EntityInfoProperties object itself. + */ + public EntityInfoProperties withNumberOfChildren(Integer numberOfChildren) { + this.numberOfChildren = numberOfChildren; + return this; + } + + /** + * Get the numberOfChildGroups property: Number of Child Groups + * + *

Number of children is the number of Groups that are exactly one level underneath the current Group. + * + * @return the numberOfChildGroups value. + */ + public Integer numberOfChildGroups() { + return this.numberOfChildGroups; + } + + /** + * Set the numberOfChildGroups property: Number of Child Groups + * + *

Number of children is the number of Groups that are exactly one level underneath the current Group. + * + * @param numberOfChildGroups the numberOfChildGroups value to set. + * @return the EntityInfoProperties object itself. + */ + public EntityInfoProperties withNumberOfChildGroups(Integer numberOfChildGroups) { + this.numberOfChildGroups = numberOfChildGroups; + return this; + } + + /** + * Get the parentDisplayNameChain property: The parent display name chain from the root group to the immediate + * parent. + * + * @return the parentDisplayNameChain value. + */ + public List parentDisplayNameChain() { + return this.parentDisplayNameChain; + } + + /** + * Set the parentDisplayNameChain property: The parent display name chain from the root group to the immediate + * parent. + * + * @param parentDisplayNameChain the parentDisplayNameChain value to set. + * @return the EntityInfoProperties object itself. + */ + public EntityInfoProperties withParentDisplayNameChain(List parentDisplayNameChain) { + this.parentDisplayNameChain = parentDisplayNameChain; + return this; + } + + /** + * Get the parentNameChain property: The parent name chain from the root group to the immediate parent. + * + * @return the parentNameChain value. + */ + public List parentNameChain() { + return this.parentNameChain; + } + + /** + * Set the parentNameChain property: The parent name chain from the root group to the immediate parent. + * + * @param parentNameChain the parentNameChain value to set. + * @return the EntityInfoProperties object itself. + */ + public EntityInfoProperties withParentNameChain(List parentNameChain) { + this.parentNameChain = parentNameChain; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (parent() != null) { + parent().validate(); + } + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/HierarchySettingsInner.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/HierarchySettingsInner.java new file mode 100644 index 000000000000..9e4317138f42 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/HierarchySettingsInner.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Settings defined at the Management Group scope. */ +@Fluent +public final class HierarchySettingsInner extends ProxyResource { + /* + * The generic properties of hierarchy settings. + */ + @JsonProperty(value = "properties") + private HierarchySettingsProperties innerProperties; + + /** Creates an instance of HierarchySettingsInner class. */ + public HierarchySettingsInner() { + } + + /** + * Get the innerProperties property: The generic properties of hierarchy settings. + * + * @return the innerProperties value. + */ + private HierarchySettingsProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the tenantId property: The AAD Tenant ID associated with the hierarchy settings. For example, + * 00000000-0000-0000-0000-000000000000. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.innerProperties() == null ? null : this.innerProperties().tenantId(); + } + + /** + * Set the tenantId property: The AAD Tenant ID associated with the hierarchy settings. For example, + * 00000000-0000-0000-0000-000000000000. + * + * @param tenantId the tenantId value to set. + * @return the HierarchySettingsInner object itself. + */ + public HierarchySettingsInner withTenantId(String tenantId) { + if (this.innerProperties() == null) { + this.innerProperties = new HierarchySettingsProperties(); + } + this.innerProperties().withTenantId(tenantId); + return this; + } + + /** + * Get the requireAuthorizationForGroupCreation property: Indicates whether RBAC access is required upon group + * creation under the root Management Group. If set to true, user will require + * Microsoft.Management/managementGroups/write action on the root Management Group scope in order to create new + * Groups directly under the root. This will prevent new users from creating new Management Groups, unless they are + * given access. + * + * @return the requireAuthorizationForGroupCreation value. + */ + public Boolean requireAuthorizationForGroupCreation() { + return this.innerProperties() == null ? null : this.innerProperties().requireAuthorizationForGroupCreation(); + } + + /** + * Set the requireAuthorizationForGroupCreation property: Indicates whether RBAC access is required upon group + * creation under the root Management Group. If set to true, user will require + * Microsoft.Management/managementGroups/write action on the root Management Group scope in order to create new + * Groups directly under the root. This will prevent new users from creating new Management Groups, unless they are + * given access. + * + * @param requireAuthorizationForGroupCreation the requireAuthorizationForGroupCreation value to set. + * @return the HierarchySettingsInner object itself. + */ + public HierarchySettingsInner withRequireAuthorizationForGroupCreation( + Boolean requireAuthorizationForGroupCreation) { + if (this.innerProperties() == null) { + this.innerProperties = new HierarchySettingsProperties(); + } + this.innerProperties().withRequireAuthorizationForGroupCreation(requireAuthorizationForGroupCreation); + return this; + } + + /** + * Get the defaultManagementGroup property: Settings that sets the default Management Group under which new + * subscriptions get added in this tenant. For example, + * /providers/Microsoft.Management/managementGroups/defaultGroup. + * + * @return the defaultManagementGroup value. + */ + public String defaultManagementGroup() { + return this.innerProperties() == null ? null : this.innerProperties().defaultManagementGroup(); + } + + /** + * Set the defaultManagementGroup property: Settings that sets the default Management Group under which new + * subscriptions get added in this tenant. For example, + * /providers/Microsoft.Management/managementGroups/defaultGroup. + * + * @param defaultManagementGroup the defaultManagementGroup value to set. + * @return the HierarchySettingsInner object itself. + */ + public HierarchySettingsInner withDefaultManagementGroup(String defaultManagementGroup) { + if (this.innerProperties() == null) { + this.innerProperties = new HierarchySettingsProperties(); + } + this.innerProperties().withDefaultManagementGroup(defaultManagementGroup); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/HierarchySettingsListInner.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/HierarchySettingsListInner.java new file mode 100644 index 000000000000..c1f4b852a3bd --- /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.resourcemanager.managementgroups.models.HierarchySettingsInfo; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Lists all hierarchy settings. */ +@Fluent +public final class HierarchySettingsListInner { + /* + * The list of hierarchy settings. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URL to use for getting the next set of results. + */ + @JsonProperty(value = "@nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of HierarchySettingsListInner class. */ + public HierarchySettingsListInner() { + } + + /** + * Get the value property: The list of hierarchy settings. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of hierarchy settings. + * + * @param value the value value to set. + * @return the HierarchySettingsListInner object itself. + */ + public HierarchySettingsListInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URL to use for getting the next set of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/HierarchySettingsProperties.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/HierarchySettingsProperties.java new file mode 100644 index 000000000000..4ca62d16226e --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/HierarchySettingsProperties.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The generic properties of hierarchy settings. */ +@Fluent +public final class HierarchySettingsProperties { + /* + * The AAD Tenant ID associated with the hierarchy settings. For example, 00000000-0000-0000-0000-000000000000 + */ + @JsonProperty(value = "tenantId") + private String tenantId; + + /* + * Indicates whether RBAC access is required upon group creation under the root Management Group. If set to true, + * user will require Microsoft.Management/managementGroups/write action on the root Management Group scope in order + * to create new Groups directly under the root. This will prevent new users from creating new Management Groups, + * unless they are given access. + */ + @JsonProperty(value = "requireAuthorizationForGroupCreation") + private Boolean requireAuthorizationForGroupCreation; + + /* + * Settings that sets the default Management Group under which new subscriptions get added in this tenant. For + * example, /providers/Microsoft.Management/managementGroups/defaultGroup + */ + @JsonProperty(value = "defaultManagementGroup") + private String defaultManagementGroup; + + /** Creates an instance of HierarchySettingsProperties class. */ + public HierarchySettingsProperties() { + } + + /** + * Get the tenantId property: The AAD Tenant ID associated with the hierarchy settings. For example, + * 00000000-0000-0000-0000-000000000000. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Set the tenantId property: The AAD Tenant ID associated with the hierarchy settings. For example, + * 00000000-0000-0000-0000-000000000000. + * + * @param tenantId the tenantId value to set. + * @return the HierarchySettingsProperties object itself. + */ + public HierarchySettingsProperties withTenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Get the requireAuthorizationForGroupCreation property: Indicates whether RBAC access is required upon group + * creation under the root Management Group. If set to true, user will require + * Microsoft.Management/managementGroups/write action on the root Management Group scope in order to create new + * Groups directly under the root. This will prevent new users from creating new Management Groups, unless they are + * given access. + * + * @return the requireAuthorizationForGroupCreation value. + */ + public Boolean requireAuthorizationForGroupCreation() { + return this.requireAuthorizationForGroupCreation; + } + + /** + * Set the requireAuthorizationForGroupCreation property: Indicates whether RBAC access is required upon group + * creation under the root Management Group. If set to true, user will require + * Microsoft.Management/managementGroups/write action on the root Management Group scope in order to create new + * Groups directly under the root. This will prevent new users from creating new Management Groups, unless they are + * given access. + * + * @param requireAuthorizationForGroupCreation the requireAuthorizationForGroupCreation value to set. + * @return the HierarchySettingsProperties object itself. + */ + public HierarchySettingsProperties withRequireAuthorizationForGroupCreation( + Boolean requireAuthorizationForGroupCreation) { + this.requireAuthorizationForGroupCreation = requireAuthorizationForGroupCreation; + return this; + } + + /** + * Get the defaultManagementGroup property: Settings that sets the default Management Group under which new + * subscriptions get added in this tenant. For example, + * /providers/Microsoft.Management/managementGroups/defaultGroup. + * + * @return the defaultManagementGroup value. + */ + public String defaultManagementGroup() { + return this.defaultManagementGroup; + } + + /** + * Set the defaultManagementGroup property: Settings that sets the default Management Group under which new + * subscriptions get added in this tenant. For example, + * /providers/Microsoft.Management/managementGroups/defaultGroup. + * + * @param defaultManagementGroup the defaultManagementGroup value to set. + * @return the HierarchySettingsProperties object itself. + */ + public HierarchySettingsProperties withDefaultManagementGroup(String defaultManagementGroup) { + this.defaultManagementGroup = defaultManagementGroup; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/ManagementGroupInfoInner.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/ManagementGroupInfoInner.java new file mode 100644 index 000000000000..17867b37419e --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/ManagementGroupInfoInner.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The management group resource. */ +@Fluent +public final class ManagementGroupInfoInner { + /* + * The fully qualified ID for the management group. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * The type of the resource. For example, Microsoft.Management/managementGroups + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * The name of the management group. For example, 00000000-0000-0000-0000-000000000000 + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The generic properties of a management group. + */ + @JsonProperty(value = "properties") + private ManagementGroupInfoProperties innerProperties; + + /** Creates an instance of ManagementGroupInfoInner class. */ + public ManagementGroupInfoInner() { + } + + /** + * Get the id property: The fully qualified ID for the management group. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the type property: The type of the resource. For example, Microsoft.Management/managementGroups. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the management group. For example, 00000000-0000-0000-0000-000000000000. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the innerProperties property: The generic properties of a management group. + * + * @return the innerProperties value. + */ + private ManagementGroupInfoProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the tenantId property: The AAD Tenant ID associated with the management group. For example, + * 00000000-0000-0000-0000-000000000000. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.innerProperties() == null ? null : this.innerProperties().tenantId(); + } + + /** + * Set the tenantId property: The AAD Tenant ID associated with the management group. For example, + * 00000000-0000-0000-0000-000000000000. + * + * @param tenantId the tenantId value to set. + * @return the ManagementGroupInfoInner object itself. + */ + public ManagementGroupInfoInner withTenantId(String tenantId) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagementGroupInfoProperties(); + } + this.innerProperties().withTenantId(tenantId); + return this; + } + + /** + * Get the displayName property: The friendly name of the management group. + * + * @return the displayName value. + */ + public String displayName() { + return this.innerProperties() == null ? null : this.innerProperties().displayName(); + } + + /** + * Set the displayName property: The friendly name of the management group. + * + * @param displayName the displayName value to set. + * @return the ManagementGroupInfoInner object itself. + */ + public ManagementGroupInfoInner withDisplayName(String displayName) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagementGroupInfoProperties(); + } + this.innerProperties().withDisplayName(displayName); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/ManagementGroupInfoProperties.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/ManagementGroupInfoProperties.java new file mode 100644 index 000000000000..a4e45b9be6a4 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/ManagementGroupInfoProperties.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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The generic properties of a management group. */ +@Fluent +public final class ManagementGroupInfoProperties { + /* + * The AAD Tenant ID associated with the management group. For example, 00000000-0000-0000-0000-000000000000 + */ + @JsonProperty(value = "tenantId") + private String tenantId; + + /* + * The friendly name of the management group. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** Creates an instance of ManagementGroupInfoProperties class. */ + public ManagementGroupInfoProperties() { + } + + /** + * Get the tenantId property: The AAD Tenant ID associated with the management group. For example, + * 00000000-0000-0000-0000-000000000000. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Set the tenantId property: The AAD Tenant ID associated with the management group. For example, + * 00000000-0000-0000-0000-000000000000. + * + * @param tenantId the tenantId value to set. + * @return the ManagementGroupInfoProperties object itself. + */ + public ManagementGroupInfoProperties withTenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Get the displayName property: The friendly name of the management group. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The friendly name of the management group. + * + * @param displayName the displayName value to set. + * @return the ManagementGroupInfoProperties object itself. + */ + public ManagementGroupInfoProperties withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/ManagementGroupInner.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/ManagementGroupInner.java new file mode 100644 index 000000000000..f32e91d7eb89 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/ManagementGroupInner.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.managementgroups.models.ManagementGroupChildInfo; +import com.azure.resourcemanager.managementgroups.models.ManagementGroupDetails; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The management group details. */ +@Fluent +public final class ManagementGroupInner extends ProxyResource { + /* + * The generic properties of a management group. + */ + @JsonProperty(value = "properties") + private ManagementGroupProperties innerProperties; + + /** Creates an instance of ManagementGroupInner class. */ + public ManagementGroupInner() { + } + + /** + * Get the innerProperties property: The generic properties of a management group. + * + * @return the innerProperties value. + */ + private ManagementGroupProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the tenantId property: The AAD Tenant ID associated with the management group. For example, + * 00000000-0000-0000-0000-000000000000. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.innerProperties() == null ? null : this.innerProperties().tenantId(); + } + + /** + * Set the tenantId property: The AAD Tenant ID associated with the management group. For example, + * 00000000-0000-0000-0000-000000000000. + * + * @param tenantId the tenantId value to set. + * @return the ManagementGroupInner object itself. + */ + public ManagementGroupInner withTenantId(String tenantId) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagementGroupProperties(); + } + this.innerProperties().withTenantId(tenantId); + return this; + } + + /** + * Get the displayName property: The friendly name of the management group. + * + * @return the displayName value. + */ + public String displayName() { + return this.innerProperties() == null ? null : this.innerProperties().displayName(); + } + + /** + * Set the displayName property: The friendly name of the management group. + * + * @param displayName the displayName value to set. + * @return the ManagementGroupInner object itself. + */ + public ManagementGroupInner withDisplayName(String displayName) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagementGroupProperties(); + } + this.innerProperties().withDisplayName(displayName); + return this; + } + + /** + * Get the details property: The details of a management group. + * + * @return the details value. + */ + public ManagementGroupDetails details() { + return this.innerProperties() == null ? null : this.innerProperties().details(); + } + + /** + * Set the details property: The details of a management group. + * + * @param details the details value to set. + * @return the ManagementGroupInner object itself. + */ + public ManagementGroupInner withDetails(ManagementGroupDetails details) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagementGroupProperties(); + } + this.innerProperties().withDetails(details); + return this; + } + + /** + * Get the children property: The list of children. + * + * @return the children value. + */ + public List children() { + return this.innerProperties() == null ? null : this.innerProperties().children(); + } + + /** + * Set the children property: The list of children. + * + * @param children the children value to set. + * @return the ManagementGroupInner object itself. + */ + public ManagementGroupInner withChildren(List children) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagementGroupProperties(); + } + this.innerProperties().withChildren(children); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/ManagementGroupProperties.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/ManagementGroupProperties.java new file mode 100644 index 000000000000..55caa5871f3d --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/ManagementGroupProperties.java @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.managementgroups.models.ManagementGroupChildInfo; +import com.azure.resourcemanager.managementgroups.models.ManagementGroupDetails; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The generic properties of a management group. */ +@Fluent +public final class ManagementGroupProperties { + /* + * The AAD Tenant ID associated with the management group. For example, 00000000-0000-0000-0000-000000000000 + */ + @JsonProperty(value = "tenantId") + private String tenantId; + + /* + * The friendly name of the management group. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /* + * The details of a management group. + */ + @JsonProperty(value = "details") + private ManagementGroupDetails details; + + /* + * The list of children. + */ + @JsonProperty(value = "children") + private List children; + + /** Creates an instance of ManagementGroupProperties class. */ + public ManagementGroupProperties() { + } + + /** + * Get the tenantId property: The AAD Tenant ID associated with the management group. For example, + * 00000000-0000-0000-0000-000000000000. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Set the tenantId property: The AAD Tenant ID associated with the management group. For example, + * 00000000-0000-0000-0000-000000000000. + * + * @param tenantId the tenantId value to set. + * @return the ManagementGroupProperties object itself. + */ + public ManagementGroupProperties withTenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Get the displayName property: The friendly name of the management group. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The friendly name of the management group. + * + * @param displayName the displayName value to set. + * @return the ManagementGroupProperties object itself. + */ + public ManagementGroupProperties withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the details property: The details of a management group. + * + * @return the details value. + */ + public ManagementGroupDetails details() { + return this.details; + } + + /** + * Set the details property: The details of a management group. + * + * @param details the details value to set. + * @return the ManagementGroupProperties object itself. + */ + public ManagementGroupProperties withDetails(ManagementGroupDetails details) { + this.details = details; + return this; + } + + /** + * Get the children property: The list of children. + * + * @return the children value. + */ + public List children() { + return this.children; + } + + /** + * Set the children property: The list of children. + * + * @param children the children value to set. + * @return the ManagementGroupProperties object itself. + */ + public ManagementGroupProperties withChildren(List children) { + this.children = children; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (details() != null) { + details().validate(); + } + if (children() != null) { + children().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/OperationInner.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/OperationInner.java new file mode 100644 index 000000000000..bd406d5d44bb --- /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.resourcemanager.managementgroups.models.OperationDisplayProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Operation supported by the Microsoft.Management resource provider. */ +@Fluent +public final class OperationInner { + /* + * Operation name: {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The object that represents the operation. + */ + @JsonProperty(value = "display") + private OperationDisplayProperties display; + + /** Creates an instance of OperationInner class. */ + public OperationInner() { + } + + /** + * 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..8f139cb59fd6 --- /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.management.ProxyResource; +import com.azure.resourcemanager.managementgroups.models.ParentGroupBagInfo; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The details of subscription under management group. */ +@Fluent +public final class SubscriptionUnderManagementGroupInner extends ProxyResource { + /* + * The generic properties of subscription under a management group. + */ + @JsonProperty(value = "properties") + private SubscriptionUnderManagementGroupProperties innerProperties; + + /** Creates an instance of SubscriptionUnderManagementGroupInner class. */ + public SubscriptionUnderManagementGroupInner() { + } + + /** + * Get the innerProperties property: The generic properties of subscription under a management group. + * + * @return the innerProperties value. + */ + private SubscriptionUnderManagementGroupProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the tenant property: The AAD Tenant ID associated with the subscription. For example, + * 00000000-0000-0000-0000-000000000000. + * + * @return the tenant value. + */ + public String tenant() { + return this.innerProperties() == null ? null : this.innerProperties().tenant(); + } + + /** + * Set the tenant property: The AAD Tenant ID associated with the subscription. For example, + * 00000000-0000-0000-0000-000000000000. + * + * @param tenant the tenant value to set. + * @return the SubscriptionUnderManagementGroupInner object itself. + */ + public SubscriptionUnderManagementGroupInner withTenant(String tenant) { + if (this.innerProperties() == null) { + this.innerProperties = new SubscriptionUnderManagementGroupProperties(); + } + this.innerProperties().withTenant(tenant); + return this; + } + + /** + * Get the displayName property: The friendly name of the subscription. + * + * @return the displayName value. + */ + public String displayName() { + return this.innerProperties() == null ? null : this.innerProperties().displayName(); + } + + /** + * Set the displayName property: The friendly name of the subscription. + * + * @param displayName the displayName value to set. + * @return the SubscriptionUnderManagementGroupInner object itself. + */ + public SubscriptionUnderManagementGroupInner withDisplayName(String displayName) { + if (this.innerProperties() == null) { + this.innerProperties = new SubscriptionUnderManagementGroupProperties(); + } + this.innerProperties().withDisplayName(displayName); + return this; + } + + /** + * Get the parent property: The ID, name and displayName of the parent management group. + * + * @return the parent value. + */ + public ParentGroupBagInfo parent() { + return this.innerProperties() == null ? null : this.innerProperties().parent(); + } + + /** + * Set the parent property: The ID, name and displayName of the parent management group. + * + * @param parent the parent value to set. + * @return the SubscriptionUnderManagementGroupInner object itself. + */ + public SubscriptionUnderManagementGroupInner withParent(ParentGroupBagInfo parent) { + if (this.innerProperties() == null) { + this.innerProperties = new SubscriptionUnderManagementGroupProperties(); + } + this.innerProperties().withParent(parent); + return this; + } + + /** + * Get the state property: The state of the subscription. + * + * @return the state value. + */ + public String state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Set the state property: The state of the subscription. + * + * @param state the state value to set. + * @return the SubscriptionUnderManagementGroupInner object itself. + */ + public SubscriptionUnderManagementGroupInner withState(String state) { + if (this.innerProperties() == null) { + this.innerProperties = new SubscriptionUnderManagementGroupProperties(); + } + this.innerProperties().withState(state); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/SubscriptionUnderManagementGroupProperties.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/SubscriptionUnderManagementGroupProperties.java new file mode 100644 index 000000000000..451d7bc5205b --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/SubscriptionUnderManagementGroupProperties.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.resourcemanager.managementgroups.models.ParentGroupBagInfo; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The generic properties of subscription under a management group. */ +@Fluent +public final class SubscriptionUnderManagementGroupProperties { + /* + * The AAD Tenant ID associated with the subscription. For example, 00000000-0000-0000-0000-000000000000 + */ + @JsonProperty(value = "tenant") + private String tenant; + + /* + * The friendly name of the subscription. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /* + * The ID, name and displayName of the parent management group. + */ + @JsonProperty(value = "parent") + private ParentGroupBagInfo parent; + + /* + * The state of the subscription. + */ + @JsonProperty(value = "state") + private String state; + + /** Creates an instance of SubscriptionUnderManagementGroupProperties class. */ + public SubscriptionUnderManagementGroupProperties() { + } + + /** + * Get the tenant property: The AAD Tenant ID associated with the subscription. For example, + * 00000000-0000-0000-0000-000000000000. + * + * @return the tenant value. + */ + public String tenant() { + return this.tenant; + } + + /** + * Set the tenant property: The AAD Tenant ID associated with the subscription. For example, + * 00000000-0000-0000-0000-000000000000. + * + * @param tenant the tenant value to set. + * @return the SubscriptionUnderManagementGroupProperties object itself. + */ + public SubscriptionUnderManagementGroupProperties withTenant(String tenant) { + this.tenant = tenant; + return this; + } + + /** + * Get the displayName property: The friendly name of the subscription. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The friendly name of the subscription. + * + * @param displayName the displayName value to set. + * @return the SubscriptionUnderManagementGroupProperties object itself. + */ + public SubscriptionUnderManagementGroupProperties withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the parent property: The ID, name and displayName of the parent management group. + * + * @return the parent value. + */ + public ParentGroupBagInfo parent() { + return this.parent; + } + + /** + * Set the parent property: The ID, name and displayName of the parent management group. + * + * @param parent the parent value to set. + * @return the SubscriptionUnderManagementGroupProperties object itself. + */ + public SubscriptionUnderManagementGroupProperties withParent(ParentGroupBagInfo parent) { + this.parent = parent; + return this; + } + + /** + * Get the state property: The state of the subscription. + * + * @return the state value. + */ + public String state() { + return this.state; + } + + /** + * Set the state property: The state of the subscription. + * + * @param state the state value to set. + * @return the SubscriptionUnderManagementGroupProperties object itself. + */ + public SubscriptionUnderManagementGroupProperties withState(String state) { + this.state = state; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (parent() != null) { + parent().validate(); + } + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/TenantBackfillStatusResultInner.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/TenantBackfillStatusResultInner.java new file mode 100644 index 000000000000..f9e0735f718b --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/TenantBackfillStatusResultInner.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.managementgroups.models.Status; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The tenant backfill status. */ +@Immutable +public final class TenantBackfillStatusResultInner { + /* + * The AAD Tenant ID associated with the management group. For example, 00000000-0000-0000-0000-000000000000 + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /* + * The status of the Tenant Backfill + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private Status status; + + /** Creates an instance of TenantBackfillStatusResultInner class. */ + public TenantBackfillStatusResultInner() { + } + + /** + * 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..59dd751c57d1 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/EntitiesClientImpl.java @@ -0,0 +1,557 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.managementgroups.fluent.EntitiesClient; +import com.azure.resourcemanager.managementgroups.fluent.models.EntityInfoInner; +import com.azure.resourcemanager.managementgroups.models.EntityListResult; +import com.azure.resourcemanager.managementgroups.models.EntitySearchType; +import com.azure.resourcemanager.managementgroups.models.EntityViewParameterType; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in EntitiesClient. */ +public final class EntitiesClientImpl implements EntitiesClient { + /** The proxy service used to perform REST calls. */ + private final EntitiesService service; + + /** The service client containing this operation class. */ + private final ManagementGroupsApiImpl client; + + /** + * Initializes an instance of EntitiesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + EntitiesClientImpl(ManagementGroupsApiImpl client) { + this.service = RestProxy.create(EntitiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ManagementGroupsApiEntities to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ManagementGroupsApiE") + public interface EntitiesService { + @Headers({"Content-Type: application/json"}) + @Post("/providers/Microsoft.Management/getEntities") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @QueryParam("$skiptoken") String skiptoken, + @QueryParam("$skip") Integer skip, + @QueryParam("$top") Integer top, + @QueryParam("$select") String select, + @QueryParam("$search") EntitySearchType search, + @QueryParam("$filter") String filter, + @QueryParam("$view") EntityViewParameterType view, + @QueryParam("groupName") String groupName, + @HeaderParam("Cache-Control") String cacheControl, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Cache-Control") String cacheControl, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List all entities (Management Groups, Subscriptions, etc.) for the authenticated user. + * + * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a + * previous response contains a nextLink element, the value of the nextLink element will include a token + * parameter that specifies a starting point to use for subsequent calls. + * @param skip Number of entities to skip over when retrieving results. Passing this in will override $skipToken. + * @param top Number of elements to return when retrieving results. Passing this in will override $skipToken. + * @param select This parameter specifies the fields to include in the response. Can include any combination of + * Name,DisplayName,Type,ParentDisplayNameChain,ParentChain, e.g. + * '$select=Name,DisplayName,Type,ParentDisplayNameChain,ParentNameChain'. When specified the $select parameter + * can override select in $skipToken. + * @param search The $search parameter is used in conjunction with the $filter parameter to return three different + * outputs depending on the parameter passed in. With $search=AllowedParents the API will return the entity info + * of all groups that the requested entity will be able to reparent to as determined by the user's permissions. + * With $search=AllowedChildren the API will return the entity info of all entities that can be added as + * children of the requested entity. With $search=ParentAndFirstLevelChildren the API will return the parent and + * first level of children that the user has either direct access to or indirect access via one of their + * descendants. With $search=ParentOnly the API will return only the group if the user has access to at least + * one of the descendants of the group. With $search=ChildrenOnly the API will return only the first level of + * children of the group entity info specified in $filter. The user must have direct access to the children + * entities or one of it's descendants for it to show up in the results. + * @param filter The filter parameter allows you to filter on the the name or display name fields. You can check for + * equality on the name field (e.g. name eq '{entityName}') and you can check for substrings on either the name + * or display name fields(e.g. contains(name, '{substringToSearch}'), contains(displayName, + * '{substringToSearch')). Note that the '{entityName}' and '{substringToSearch}' fields are checked case + * insensitively. + * @param view The view parameter allows clients to filter the type of data that is returned by the getEntities + * call. + * @param groupName A filter which allows the get entities call to focus on a particular group (i.e. "$filter=name + * eq 'groupName'"). + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to view entities along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String skiptoken, + Integer skip, + Integer top, + String select, + EntitySearchType search, + String filter, + EntityViewParameterType view, + String groupName, + String cacheControl) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + skiptoken, + skip, + top, + select, + search, + filter, + view, + groupName, + cacheControl, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List all entities (Management Groups, Subscriptions, etc.) for the authenticated user. + * + * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a + * previous response contains a nextLink element, the value of the nextLink element will include a token + * parameter that specifies a starting point to use for subsequent calls. + * @param skip Number of entities to skip over when retrieving results. Passing this in will override $skipToken. + * @param top Number of elements to return when retrieving results. Passing this in will override $skipToken. + * @param select This parameter specifies the fields to include in the response. Can include any combination of + * Name,DisplayName,Type,ParentDisplayNameChain,ParentChain, e.g. + * '$select=Name,DisplayName,Type,ParentDisplayNameChain,ParentNameChain'. When specified the $select parameter + * can override select in $skipToken. + * @param search The $search parameter is used in conjunction with the $filter parameter to return three different + * outputs depending on the parameter passed in. With $search=AllowedParents the API will return the entity info + * of all groups that the requested entity will be able to reparent to as determined by the user's permissions. + * With $search=AllowedChildren the API will return the entity info of all entities that can be added as + * children of the requested entity. With $search=ParentAndFirstLevelChildren the API will return the parent and + * first level of children that the user has either direct access to or indirect access via one of their + * descendants. With $search=ParentOnly the API will return only the group if the user has access to at least + * one of the descendants of the group. With $search=ChildrenOnly the API will return only the first level of + * children of the group entity info specified in $filter. The user must have direct access to the children + * entities or one of it's descendants for it to show up in the results. + * @param filter The filter parameter allows you to filter on the the name or display name fields. You can check for + * equality on the name field (e.g. name eq '{entityName}') and you can check for substrings on either the name + * or display name fields(e.g. contains(name, '{substringToSearch}'), contains(displayName, + * '{substringToSearch')). Note that the '{entityName}' and '{substringToSearch}' fields are checked case + * insensitively. + * @param view The view parameter allows clients to filter the type of data that is returned by the getEntities + * call. + * @param groupName A filter which allows the get entities call to focus on a particular group (i.e. "$filter=name + * eq 'groupName'"). + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to view entities along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String skiptoken, + Integer skip, + Integer top, + String select, + EntitySearchType search, + String filter, + EntityViewParameterType view, + String groupName, + String cacheControl, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + skiptoken, + skip, + top, + select, + search, + filter, + view, + groupName, + cacheControl, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List all entities (Management Groups, Subscriptions, etc.) for the authenticated user. + * + * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a + * previous response contains a nextLink element, the value of the nextLink element will include a token + * parameter that specifies a starting point to use for subsequent calls. + * @param skip Number of entities to skip over when retrieving results. Passing this in will override $skipToken. + * @param top Number of elements to return when retrieving results. Passing this in will override $skipToken. + * @param select This parameter specifies the fields to include in the response. Can include any combination of + * Name,DisplayName,Type,ParentDisplayNameChain,ParentChain, e.g. + * '$select=Name,DisplayName,Type,ParentDisplayNameChain,ParentNameChain'. When specified the $select parameter + * can override select in $skipToken. + * @param search The $search parameter is used in conjunction with the $filter parameter to return three different + * outputs depending on the parameter passed in. With $search=AllowedParents the API will return the entity info + * of all groups that the requested entity will be able to reparent to as determined by the user's permissions. + * With $search=AllowedChildren the API will return the entity info of all entities that can be added as + * children of the requested entity. With $search=ParentAndFirstLevelChildren the API will return the parent and + * first level of children that the user has either direct access to or indirect access via one of their + * descendants. With $search=ParentOnly the API will return only the group if the user has access to at least + * one of the descendants of the group. With $search=ChildrenOnly the API will return only the first level of + * children of the group entity info specified in $filter. The user must have direct access to the children + * entities or one of it's descendants for it to show up in the results. + * @param filter The filter parameter allows you to filter on the the name or display name fields. You can check for + * equality on the name field (e.g. name eq '{entityName}') and you can check for substrings on either the name + * or display name fields(e.g. contains(name, '{substringToSearch}'), contains(displayName, + * '{substringToSearch')). Note that the '{entityName}' and '{substringToSearch}' fields are checked case + * insensitively. + * @param view The view parameter allows clients to filter the type of data that is returned by the getEntities + * call. + * @param groupName A filter which allows the get entities call to focus on a particular group (i.e. "$filter=name + * eq 'groupName'"). + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to view entities as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String skiptoken, + Integer skip, + Integer top, + String select, + EntitySearchType search, + String filter, + EntityViewParameterType view, + String groupName, + String cacheControl) { + return new PagedFlux<>( + () -> listSinglePageAsync(skiptoken, skip, top, select, search, filter, view, groupName, cacheControl), + nextLink -> listNextSinglePageAsync(nextLink, cacheControl)); + } + + /** + * List all entities (Management Groups, Subscriptions, etc.) for the authenticated user. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to view entities as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + final String skiptoken = null; + final Integer skip = null; + final Integer top = null; + final String select = null; + final EntitySearchType search = null; + final String filter = null; + final EntityViewParameterType view = null; + final String groupName = null; + final String cacheControl = null; + return new PagedFlux<>( + () -> listSinglePageAsync(skiptoken, skip, top, select, search, filter, view, groupName, cacheControl), + nextLink -> listNextSinglePageAsync(nextLink, cacheControl)); + } + + /** + * List all entities (Management Groups, Subscriptions, etc.) for the authenticated user. + * + * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a + * previous response contains a nextLink element, the value of the nextLink element will include a token + * parameter that specifies a starting point to use for subsequent calls. + * @param skip Number of entities to skip over when retrieving results. Passing this in will override $skipToken. + * @param top Number of elements to return when retrieving results. Passing this in will override $skipToken. + * @param select This parameter specifies the fields to include in the response. Can include any combination of + * Name,DisplayName,Type,ParentDisplayNameChain,ParentChain, e.g. + * '$select=Name,DisplayName,Type,ParentDisplayNameChain,ParentNameChain'. When specified the $select parameter + * can override select in $skipToken. + * @param search The $search parameter is used in conjunction with the $filter parameter to return three different + * outputs depending on the parameter passed in. With $search=AllowedParents the API will return the entity info + * of all groups that the requested entity will be able to reparent to as determined by the user's permissions. + * With $search=AllowedChildren the API will return the entity info of all entities that can be added as + * children of the requested entity. With $search=ParentAndFirstLevelChildren the API will return the parent and + * first level of children that the user has either direct access to or indirect access via one of their + * descendants. With $search=ParentOnly the API will return only the group if the user has access to at least + * one of the descendants of the group. With $search=ChildrenOnly the API will return only the first level of + * children of the group entity info specified in $filter. The user must have direct access to the children + * entities or one of it's descendants for it to show up in the results. + * @param filter The filter parameter allows you to filter on the the name or display name fields. You can check for + * equality on the name field (e.g. name eq '{entityName}') and you can check for substrings on either the name + * or display name fields(e.g. contains(name, '{substringToSearch}'), contains(displayName, + * '{substringToSearch')). Note that the '{entityName}' and '{substringToSearch}' fields are checked case + * insensitively. + * @param view The view parameter allows clients to filter the type of data that is returned by the getEntities + * call. + * @param groupName A filter which allows the get entities call to focus on a particular group (i.e. "$filter=name + * eq 'groupName'"). + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to view entities as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String skiptoken, + Integer skip, + Integer top, + String select, + EntitySearchType search, + String filter, + EntityViewParameterType view, + String groupName, + String cacheControl, + Context context) { + return new PagedFlux<>( + () -> + listSinglePageAsync( + skiptoken, skip, top, select, search, filter, view, groupName, cacheControl, context), + nextLink -> listNextSinglePageAsync(nextLink, cacheControl, context)); + } + + /** + * List all entities (Management Groups, Subscriptions, etc.) for the authenticated user. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to view entities as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + final String skiptoken = null; + final Integer skip = null; + final Integer top = null; + final String select = null; + final EntitySearchType search = null; + final String filter = null; + final EntityViewParameterType view = null; + final String groupName = null; + final String cacheControl = null; + return new PagedIterable<>( + listAsync(skiptoken, skip, top, select, search, filter, view, groupName, cacheControl)); + } + + /** + * List all entities (Management Groups, Subscriptions, etc.) for the authenticated user. + * + * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a + * previous response contains a nextLink element, the value of the nextLink element will include a token + * parameter that specifies a starting point to use for subsequent calls. + * @param skip Number of entities to skip over when retrieving results. Passing this in will override $skipToken. + * @param top Number of elements to return when retrieving results. Passing this in will override $skipToken. + * @param select This parameter specifies the fields to include in the response. Can include any combination of + * Name,DisplayName,Type,ParentDisplayNameChain,ParentChain, e.g. + * '$select=Name,DisplayName,Type,ParentDisplayNameChain,ParentNameChain'. When specified the $select parameter + * can override select in $skipToken. + * @param search The $search parameter is used in conjunction with the $filter parameter to return three different + * outputs depending on the parameter passed in. With $search=AllowedParents the API will return the entity info + * of all groups that the requested entity will be able to reparent to as determined by the user's permissions. + * With $search=AllowedChildren the API will return the entity info of all entities that can be added as + * children of the requested entity. With $search=ParentAndFirstLevelChildren the API will return the parent and + * first level of children that the user has either direct access to or indirect access via one of their + * descendants. With $search=ParentOnly the API will return only the group if the user has access to at least + * one of the descendants of the group. With $search=ChildrenOnly the API will return only the first level of + * children of the group entity info specified in $filter. The user must have direct access to the children + * entities or one of it's descendants for it to show up in the results. + * @param filter The filter parameter allows you to filter on the the name or display name fields. You can check for + * equality on the name field (e.g. name eq '{entityName}') and you can check for substrings on either the name + * or display name fields(e.g. contains(name, '{substringToSearch}'), contains(displayName, + * '{substringToSearch')). Note that the '{entityName}' and '{substringToSearch}' fields are checked case + * insensitively. + * @param view The view parameter allows clients to filter the type of data that is returned by the getEntities + * call. + * @param groupName A filter which allows the get entities call to focus on a particular group (i.e. "$filter=name + * eq 'groupName'"). + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to view entities as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String skiptoken, + Integer skip, + Integer top, + String select, + EntitySearchType search, + String filter, + EntityViewParameterType view, + String groupName, + String cacheControl, + Context context) { + return new PagedIterable<>( + listAsync(skiptoken, skip, top, select, search, filter, view, groupName, cacheControl, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to view entities along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, String cacheControl) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listNext(nextLink, this.client.getEndpoint(), cacheControl, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to view entities along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync( + String nextLink, String cacheControl, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), cacheControl, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/EntitiesImpl.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/EntitiesImpl.java new file mode 100644 index 000000000000..8dad803b9874 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/EntitiesImpl.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.managementgroups.fluent.EntitiesClient; +import com.azure.resourcemanager.managementgroups.fluent.models.EntityInfoInner; +import com.azure.resourcemanager.managementgroups.models.Entities; +import com.azure.resourcemanager.managementgroups.models.EntityInfo; +import com.azure.resourcemanager.managementgroups.models.EntitySearchType; +import com.azure.resourcemanager.managementgroups.models.EntityViewParameterType; + +public final class EntitiesImpl implements Entities { + private static final ClientLogger LOGGER = new ClientLogger(EntitiesImpl.class); + + private final EntitiesClient innerClient; + + private final com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager; + + public EntitiesImpl( + EntitiesClient innerClient, com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new EntityInfoImpl(inner1, this.manager())); + } + + public PagedIterable list( + String skiptoken, + Integer skip, + Integer top, + String select, + EntitySearchType search, + String filter, + EntityViewParameterType view, + String groupName, + String cacheControl, + Context context) { + PagedIterable inner = + this + .serviceClient() + .list(skiptoken, skip, top, select, search, filter, view, groupName, cacheControl, context); + return Utils.mapPage(inner, inner1 -> new EntityInfoImpl(inner1, this.manager())); + } + + private EntitiesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/EntityInfoImpl.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/EntityInfoImpl.java new file mode 100644 index 000000000000..a00a7edc1fa1 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/EntityInfoImpl.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.implementation; + +import com.azure.resourcemanager.managementgroups.fluent.models.EntityInfoInner; +import com.azure.resourcemanager.managementgroups.models.EntityInfo; +import com.azure.resourcemanager.managementgroups.models.EntityParentGroupInfo; +import com.azure.resourcemanager.managementgroups.models.Permissions; +import java.util.Collections; +import java.util.List; + +public final class EntityInfoImpl implements EntityInfo { + private EntityInfoInner innerObject; + + private final com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager; + + EntityInfoImpl( + EntityInfoInner innerObject, + com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String type() { + return this.innerModel().type(); + } + + public String name() { + return this.innerModel().name(); + } + + public String tenantId() { + return this.innerModel().tenantId(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public EntityParentGroupInfo parent() { + return this.innerModel().parent(); + } + + public Permissions permissions() { + return this.innerModel().permissions(); + } + + public Permissions inheritedPermissions() { + return this.innerModel().inheritedPermissions(); + } + + public Integer numberOfDescendants() { + return this.innerModel().numberOfDescendants(); + } + + public Integer numberOfChildren() { + return this.innerModel().numberOfChildren(); + } + + public Integer numberOfChildGroups() { + return this.innerModel().numberOfChildGroups(); + } + + public List parentDisplayNameChain() { + List inner = this.innerModel().parentDisplayNameChain(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List parentNameChain() { + List inner = this.innerModel().parentNameChain(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public EntityInfoInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/HierarchySettingsImpl.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/HierarchySettingsImpl.java new file mode 100644 index 000000000000..07e8225d26b4 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/HierarchySettingsImpl.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.implementation; + +import com.azure.resourcemanager.managementgroups.fluent.models.HierarchySettingsInner; +import com.azure.resourcemanager.managementgroups.models.HierarchySettings; + +public final class HierarchySettingsImpl implements HierarchySettings { + private HierarchySettingsInner innerObject; + + private final com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager; + + HierarchySettingsImpl( + HierarchySettingsInner innerObject, + com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String tenantId() { + return this.innerModel().tenantId(); + } + + public Boolean requireAuthorizationForGroupCreation() { + return this.innerModel().requireAuthorizationForGroupCreation(); + } + + public String defaultManagementGroup() { + return this.innerModel().defaultManagementGroup(); + } + + public HierarchySettingsInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/HierarchySettingsListImpl.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/HierarchySettingsListImpl.java new file mode 100644 index 000000000000..e8cc4040c5c3 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/HierarchySettingsListImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.implementation; + +import com.azure.resourcemanager.managementgroups.fluent.models.HierarchySettingsListInner; +import com.azure.resourcemanager.managementgroups.models.HierarchySettingsInfo; +import com.azure.resourcemanager.managementgroups.models.HierarchySettingsList; +import java.util.Collections; +import java.util.List; + +public final class HierarchySettingsListImpl implements HierarchySettingsList { + private HierarchySettingsListInner innerObject; + + private final com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager; + + HierarchySettingsListImpl( + HierarchySettingsListInner innerObject, + com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String nextLink() { + return this.innerModel().nextLink(); + } + + public HierarchySettingsListInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/HierarchySettingsOperationsClientImpl.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/HierarchySettingsOperationsClientImpl.java new file mode 100644 index 000000000000..9700afa68253 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/HierarchySettingsOperationsClientImpl.java @@ -0,0 +1,703 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.managementgroups.fluent.HierarchySettingsOperationsClient; +import com.azure.resourcemanager.managementgroups.fluent.models.HierarchySettingsInner; +import com.azure.resourcemanager.managementgroups.fluent.models.HierarchySettingsListInner; +import com.azure.resourcemanager.managementgroups.models.CreateOrUpdateSettingsRequest; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in HierarchySettingsOperationsClient. */ +public final class HierarchySettingsOperationsClientImpl implements HierarchySettingsOperationsClient { + /** The proxy service used to perform REST calls. */ + private final HierarchySettingsOperationsService service; + + /** The service client containing this operation class. */ + private final ManagementGroupsApiImpl client; + + /** + * Initializes an instance of HierarchySettingsOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + HierarchySettingsOperationsClientImpl(ManagementGroupsApiImpl client) { + this.service = + RestProxy + .create( + HierarchySettingsOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ManagementGroupsApiHierarchySettingsOperations to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ManagementGroupsApiH") + public interface HierarchySettingsOperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Management/managementGroups/{groupId}/settings") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("groupId") String groupId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Management/managementGroups/{groupId}/settings/default") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("groupId") String groupId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put("/providers/Microsoft.Management/managementGroups/{groupId}/settings/default") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("groupId") String groupId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") CreateOrUpdateSettingsRequest createTenantSettingsRequest, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch("/providers/Microsoft.Management/managementGroups/{groupId}/settings/default") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("groupId") String groupId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") CreateOrUpdateSettingsRequest createTenantSettingsRequest, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete("/providers/Microsoft.Management/managementGroups/{groupId}/settings/default") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("groupId") String groupId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets all the hierarchy settings defined at the Management Group level. Settings can only be set on the root + * Management Group of the hierarchy. + * + * @param groupId Management Group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the hierarchy settings defined at the Management Group level along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync(String groupId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service.list(this.client.getEndpoint(), groupId, this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets all the hierarchy settings defined at the Management Group level. Settings can only be set on the root + * Management Group of the hierarchy. + * + * @param groupId Management Group ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the hierarchy settings defined at the Management Group level along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync(String groupId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), groupId, this.client.getApiVersion(), accept, context); + } + + /** + * Gets all the hierarchy settings defined at the Management Group level. Settings can only be set on the root + * Management Group of the hierarchy. + * + * @param groupId Management Group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the hierarchy settings defined at the Management Group level on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAsync(String groupId) { + return listWithResponseAsync(groupId).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets all the hierarchy settings defined at the Management Group level. Settings can only be set on the root + * Management Group of the hierarchy. + * + * @param groupId Management Group ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the hierarchy settings defined at the Management Group level along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse(String groupId, Context context) { + return listWithResponseAsync(groupId, context).block(); + } + + /** + * Gets 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 listWithResponse(groupId, Context.NONE).getValue(); + } + + /** + * Gets the hierarchy settings defined at the Management Group level. Settings can only be set on the root + * Management Group of the hierarchy. + * + * @param groupId Management Group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the hierarchy settings defined at the Management Group level along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String groupId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service.get(this.client.getEndpoint(), groupId, this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the hierarchy settings defined at the Management Group level. Settings can only be set on the root + * Management Group of the hierarchy. + * + * @param groupId Management Group ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the hierarchy settings defined at the Management Group level along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String groupId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), groupId, this.client.getApiVersion(), accept, context); + } + + /** + * Gets the hierarchy settings defined at the Management Group level. Settings can only be set on the root + * Management Group of the hierarchy. + * + * @param groupId Management Group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the hierarchy settings defined at the Management Group level on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String groupId) { + return getWithResponseAsync(groupId).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the hierarchy settings defined at the Management Group level. Settings can only be set on the root + * Management Group of the hierarchy. + * + * @param groupId Management Group ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the hierarchy settings defined at the Management Group level along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String groupId, Context context) { + return getWithResponseAsync(groupId, context).block(); + } + + /** + * 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 getWithResponse(groupId, Context.NONE).getValue(); + } + + /** + * Creates or updates the hierarchy settings defined at the Management Group level. + * + * @param groupId Management Group ID. + * @param createTenantSettingsRequest Tenant level settings request parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return settings defined at the Management Group scope along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String groupId, CreateOrUpdateSettingsRequest createTenantSettingsRequest) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + if (createTenantSettingsRequest == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createTenantSettingsRequest is required and cannot be null.")); + } else { + createTenantSettingsRequest.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + groupId, + this.client.getApiVersion(), + createTenantSettingsRequest, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates the hierarchy settings defined at the Management Group level. + * + * @param groupId Management Group ID. + * @param createTenantSettingsRequest Tenant level settings request parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return settings defined at the Management Group scope along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String groupId, CreateOrUpdateSettingsRequest createTenantSettingsRequest, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + if (createTenantSettingsRequest == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createTenantSettingsRequest is required and cannot be null.")); + } else { + createTenantSettingsRequest.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + groupId, + this.client.getApiVersion(), + createTenantSettingsRequest, + accept, + context); + } + + /** + * Creates or updates the hierarchy settings defined at the Management Group level. + * + * @param groupId Management Group ID. + * @param createTenantSettingsRequest Tenant level settings request parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return settings defined at the Management Group scope on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String groupId, CreateOrUpdateSettingsRequest createTenantSettingsRequest) { + return createOrUpdateWithResponseAsync(groupId, createTenantSettingsRequest) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or updates the hierarchy settings defined at the Management Group level. + * + * @param groupId Management Group ID. + * @param createTenantSettingsRequest Tenant level settings request parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return settings defined at the Management Group scope along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String groupId, CreateOrUpdateSettingsRequest createTenantSettingsRequest, Context context) { + return createOrUpdateWithResponseAsync(groupId, createTenantSettingsRequest, context).block(); + } + + /** + * 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 createOrUpdateWithResponse(groupId, createTenantSettingsRequest, Context.NONE).getValue(); + } + + /** + * Updates the hierarchy settings defined at the Management Group level. + * + * @param groupId Management Group ID. + * @param createTenantSettingsRequest Tenant level settings request parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return settings defined at the Management Group scope along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String groupId, CreateOrUpdateSettingsRequest createTenantSettingsRequest) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + if (createTenantSettingsRequest == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createTenantSettingsRequest is required and cannot be null.")); + } else { + createTenantSettingsRequest.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + groupId, + this.client.getApiVersion(), + createTenantSettingsRequest, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates the hierarchy settings defined at the Management Group level. + * + * @param groupId Management Group ID. + * @param createTenantSettingsRequest Tenant level settings request parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return settings defined at the Management Group scope along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String groupId, CreateOrUpdateSettingsRequest createTenantSettingsRequest, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + if (createTenantSettingsRequest == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createTenantSettingsRequest is required and cannot be null.")); + } else { + createTenantSettingsRequest.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + groupId, + this.client.getApiVersion(), + createTenantSettingsRequest, + accept, + context); + } + + /** + * Updates the hierarchy settings defined at the Management Group level. + * + * @param groupId Management Group ID. + * @param createTenantSettingsRequest Tenant level settings request parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return settings defined at the Management Group scope on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String groupId, CreateOrUpdateSettingsRequest createTenantSettingsRequest) { + return updateWithResponseAsync(groupId, createTenantSettingsRequest) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Updates the hierarchy settings defined at the Management Group level. + * + * @param groupId Management Group ID. + * @param createTenantSettingsRequest Tenant level settings request parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return settings defined at the Management Group scope along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String groupId, CreateOrUpdateSettingsRequest createTenantSettingsRequest, Context context) { + return updateWithResponseAsync(groupId, createTenantSettingsRequest, context).block(); + } + + /** + * 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 updateWithResponse(groupId, createTenantSettingsRequest, Context.NONE).getValue(); + } + + /** + * Deletes the hierarchy settings defined at the Management Group level. + * + * @param groupId Management Group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String groupId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service.delete(this.client.getEndpoint(), groupId, this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the hierarchy settings defined at the Management Group level. + * + * @param groupId Management Group ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String groupId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), groupId, this.client.getApiVersion(), accept, context); + } + + /** + * Deletes the hierarchy settings defined at the Management Group level. + * + * @param groupId Management Group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String groupId) { + return deleteWithResponseAsync(groupId).flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes the hierarchy settings defined at the Management Group level. + * + * @param groupId Management Group ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String groupId, Context context) { + return deleteWithResponseAsync(groupId, context).block(); + } + + /** + * 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) { + deleteWithResponse(groupId, Context.NONE); + } +} 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..e6e97ceb563e --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/HierarchySettingsOperationsImpl.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.managementgroups.fluent.HierarchySettingsOperationsClient; +import com.azure.resourcemanager.managementgroups.fluent.models.HierarchySettingsInner; +import com.azure.resourcemanager.managementgroups.fluent.models.HierarchySettingsListInner; +import com.azure.resourcemanager.managementgroups.models.CreateOrUpdateSettingsRequest; +import com.azure.resourcemanager.managementgroups.models.HierarchySettings; +import com.azure.resourcemanager.managementgroups.models.HierarchySettingsList; +import com.azure.resourcemanager.managementgroups.models.HierarchySettingsOperations; + +public final class HierarchySettingsOperationsImpl implements HierarchySettingsOperations { + private static final ClientLogger LOGGER = new ClientLogger(HierarchySettingsOperationsImpl.class); + + private final HierarchySettingsOperationsClient innerClient; + + private final com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager; + + public HierarchySettingsOperationsImpl( + HierarchySettingsOperationsClient innerClient, + com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public 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 HierarchySettingsList list(String groupId) { + HierarchySettingsListInner inner = this.serviceClient().list(groupId); + if (inner != null) { + return new HierarchySettingsListImpl(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 get(String groupId) { + HierarchySettingsInner inner = this.serviceClient().get(groupId); + 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 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 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 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 deleteWithResponse(String groupId, Context context) { + return this.serviceClient().deleteWithResponse(groupId, context); + } + + public void delete(String groupId) { + this.serviceClient().delete(groupId); + } + + 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..1925dd24aef7 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupSubscriptionsClientImpl.java @@ -0,0 +1,796 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.implementation; + +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.managementgroups.fluent.ManagementGroupSubscriptionsClient; +import com.azure.resourcemanager.managementgroups.fluent.models.SubscriptionUnderManagementGroupInner; +import com.azure.resourcemanager.managementgroups.models.ListSubscriptionUnderManagementGroup; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ManagementGroupSubscriptionsClient. */ +public final class ManagementGroupSubscriptionsClientImpl implements ManagementGroupSubscriptionsClient { + /** The proxy service used to perform REST calls. */ + private final ManagementGroupSubscriptionsService service; + + /** The service client containing this operation class. */ + private final ManagementGroupsApiImpl client; + + /** + * Initializes an instance of ManagementGroupSubscriptionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagementGroupSubscriptionsClientImpl(ManagementGroupsApiImpl client) { + this.service = + RestProxy + .create( + ManagementGroupSubscriptionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ManagementGroupsApiManagementGroupSubscriptions to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ManagementGroupsApiM") + public interface ManagementGroupSubscriptionsService { + @Headers({"Content-Type: application/json"}) + @Put("/providers/Microsoft.Management/managementGroups/{groupId}/subscriptions/{subscriptionId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create( + @HostParam("$host") String endpoint, + @PathParam("groupId") String groupId, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Cache-Control") String cacheControl, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete("/providers/Microsoft.Management/managementGroups/{groupId}/subscriptions/{subscriptionId}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("groupId") String groupId, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Cache-Control") String cacheControl, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Management/managementGroups/{groupId}/subscriptions/{subscriptionId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getSubscription( + @HostParam("$host") String endpoint, + @PathParam("groupId") String groupId, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Cache-Control") String cacheControl, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Management/managementGroups/{groupId}/subscriptions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getSubscriptionsUnderManagementGroup( + @HostParam("$host") String endpoint, + @PathParam("groupId") String groupId, + @QueryParam("api-version") String apiVersion, + @QueryParam("$skiptoken") String skiptoken, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getSubscriptionsUnderManagementGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Associates existing subscription with the management group. + * + * @param groupId Management Group ID. + * @param subscriptionId Subscription ID. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of subscription under management group along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String groupId, String subscriptionId, String cacheControl) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + groupId, + subscriptionId, + this.client.getApiVersion(), + cacheControl, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Associates existing subscription with the management group. + * + * @param groupId Management Group ID. + * @param subscriptionId Subscription ID. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of subscription under management group along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String groupId, String subscriptionId, String cacheControl, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + groupId, + subscriptionId, + this.client.getApiVersion(), + cacheControl, + accept, + context); + } + + /** + * Associates existing subscription with the management group. + * + * @param groupId Management Group ID. + * @param subscriptionId Subscription ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of subscription under management group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String groupId, String subscriptionId) { + final String cacheControl = null; + return createWithResponseAsync(groupId, subscriptionId, cacheControl) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Associates existing subscription with the management group. + * + * @param groupId Management Group ID. + * @param subscriptionId Subscription ID. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of subscription under management group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse( + String groupId, String subscriptionId, String cacheControl, Context context) { + return createWithResponseAsync(groupId, subscriptionId, cacheControl, context).block(); + } + + /** + * 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 createWithResponse(groupId, subscriptionId, cacheControl, Context.NONE).getValue(); + } + + /** + * De-associates subscription from the management group. + * + * @param groupId Management Group ID. + * @param subscriptionId Subscription ID. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String groupId, String subscriptionId, String cacheControl) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + groupId, + subscriptionId, + this.client.getApiVersion(), + cacheControl, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * De-associates subscription from the management group. + * + * @param groupId Management Group ID. + * @param subscriptionId Subscription ID. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String groupId, String subscriptionId, String cacheControl, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + groupId, + subscriptionId, + this.client.getApiVersion(), + cacheControl, + accept, + context); + } + + /** + * De-associates subscription from the management group. + * + * @param groupId Management Group ID. + * @param subscriptionId Subscription ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String groupId, String subscriptionId) { + final String cacheControl = null; + return deleteWithResponseAsync(groupId, subscriptionId, cacheControl).flatMap(ignored -> Mono.empty()); + } + + /** + * De-associates subscription from the management group. + * + * @param groupId Management Group ID. + * @param subscriptionId Subscription ID. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String groupId, String subscriptionId, String cacheControl, Context context) { + return deleteWithResponseAsync(groupId, subscriptionId, cacheControl, context).block(); + } + + /** + * 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; + deleteWithResponse(groupId, subscriptionId, cacheControl, Context.NONE); + } + + /** + * Retrieves details about given subscription which is associated with the management group. + * + * @param groupId Management Group ID. + * @param subscriptionId Subscription ID. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of subscription under management group along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getSubscriptionWithResponseAsync( + String groupId, String subscriptionId, String cacheControl) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getSubscription( + this.client.getEndpoint(), + groupId, + subscriptionId, + this.client.getApiVersion(), + cacheControl, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves details about given subscription which is associated with the management group. + * + * @param groupId Management Group ID. + * @param subscriptionId Subscription ID. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of subscription under management group along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getSubscriptionWithResponseAsync( + String groupId, String subscriptionId, String cacheControl, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getSubscription( + this.client.getEndpoint(), + groupId, + subscriptionId, + this.client.getApiVersion(), + cacheControl, + accept, + context); + } + + /** + * Retrieves details about given subscription which is associated with the management group. + * + * @param groupId Management Group ID. + * @param subscriptionId Subscription ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of subscription under management group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getSubscriptionAsync(String groupId, String subscriptionId) { + final String cacheControl = null; + return getSubscriptionWithResponseAsync(groupId, subscriptionId, cacheControl) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Retrieves details about given subscription which is associated with the management group. + * + * @param groupId Management Group ID. + * @param subscriptionId Subscription ID. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of subscription under management group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getSubscriptionWithResponse( + String groupId, String subscriptionId, String cacheControl, Context context) { + return getSubscriptionWithResponseAsync(groupId, subscriptionId, cacheControl, context).block(); + } + + /** + * Retrieves details about 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 getSubscriptionWithResponse(groupId, subscriptionId, cacheControl, Context.NONE).getValue(); + } + + /** + * Retrieves details about all subscriptions which are associated with the management group. + * + * @param groupId Management Group ID. + * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a + * previous response contains a nextLink element, the value of the nextLink element will include a token + * parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of all subscriptions under management group along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + getSubscriptionsUnderManagementGroupSinglePageAsync(String groupId, String skiptoken) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getSubscriptionsUnderManagementGroup( + this.client.getEndpoint(), + groupId, + this.client.getApiVersion(), + skiptoken, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves details about all subscriptions which are associated with the management group. + * + * @param groupId Management Group ID. + * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a + * previous response contains a nextLink element, the value of the nextLink element will include a token + * parameter that specifies a starting point to use for subsequent calls. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of all subscriptions under management group along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + getSubscriptionsUnderManagementGroupSinglePageAsync(String groupId, String skiptoken, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getSubscriptionsUnderManagementGroup( + this.client.getEndpoint(), groupId, this.client.getApiVersion(), skiptoken, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Retrieves details about all subscriptions which are associated with the management group. + * + * @param groupId Management Group ID. + * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a + * previous response contains a nextLink element, the value of the nextLink element will include a token + * parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of all subscriptions under management group as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux getSubscriptionsUnderManagementGroupAsync( + String groupId, String skiptoken) { + return new PagedFlux<>( + () -> getSubscriptionsUnderManagementGroupSinglePageAsync(groupId, skiptoken), + nextLink -> getSubscriptionsUnderManagementGroupNextSinglePageAsync(nextLink)); + } + + /** + * Retrieves details about all subscriptions which are associated with the management group. + * + * @param groupId Management Group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of all subscriptions under management group as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux getSubscriptionsUnderManagementGroupAsync(String groupId) { + final String skiptoken = null; + return new PagedFlux<>( + () -> getSubscriptionsUnderManagementGroupSinglePageAsync(groupId, skiptoken), + nextLink -> getSubscriptionsUnderManagementGroupNextSinglePageAsync(nextLink)); + } + + /** + * Retrieves details about all subscriptions which are associated with the management group. + * + * @param groupId Management Group ID. + * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a + * previous response contains a nextLink element, the value of the nextLink element will include a token + * parameter that specifies a starting point to use for subsequent calls. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of all subscriptions under management group as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux getSubscriptionsUnderManagementGroupAsync( + String groupId, String skiptoken, Context context) { + return new PagedFlux<>( + () -> getSubscriptionsUnderManagementGroupSinglePageAsync(groupId, skiptoken, context), + nextLink -> getSubscriptionsUnderManagementGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Retrieves details about all subscriptions which are associated with the management group. + * + * @param groupId Management Group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of all subscriptions under management group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getSubscriptionsUnderManagementGroup(String groupId) { + final String skiptoken = null; + return new PagedIterable<>(getSubscriptionsUnderManagementGroupAsync(groupId, skiptoken)); + } + + /** + * Retrieves details about all subscriptions which are associated with the management group. + * + * @param groupId Management Group ID. + * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a + * previous response contains a nextLink element, the value of the nextLink element will include a token + * parameter that specifies a starting point to use for subsequent calls. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of all subscriptions under management group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getSubscriptionsUnderManagementGroup( + String groupId, String skiptoken, Context context) { + return new PagedIterable<>(getSubscriptionsUnderManagementGroupAsync(groupId, skiptoken, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of all subscriptions under management group along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + getSubscriptionsUnderManagementGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getSubscriptionsUnderManagementGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of all subscriptions under management group along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + getSubscriptionsUnderManagementGroupNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getSubscriptionsUnderManagementGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupSubscriptionsImpl.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupSubscriptionsImpl.java new file mode 100644 index 000000000000..a046b5199649 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupSubscriptionsImpl.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.managementgroups.fluent.ManagementGroupSubscriptionsClient; +import com.azure.resourcemanager.managementgroups.fluent.models.SubscriptionUnderManagementGroupInner; +import com.azure.resourcemanager.managementgroups.models.ManagementGroupSubscriptions; +import com.azure.resourcemanager.managementgroups.models.SubscriptionUnderManagementGroup; + +public final class ManagementGroupSubscriptionsImpl implements ManagementGroupSubscriptions { + private static final ClientLogger LOGGER = new ClientLogger(ManagementGroupSubscriptionsImpl.class); + + private final ManagementGroupSubscriptionsClient innerClient; + + private final com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager; + + public ManagementGroupSubscriptionsImpl( + ManagementGroupSubscriptionsClient innerClient, + com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public 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 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 deleteWithResponse( + String groupId, String subscriptionId, String cacheControl, Context context) { + return this.serviceClient().deleteWithResponse(groupId, subscriptionId, cacheControl, context); + } + + public void delete(String groupId, String subscriptionId) { + this.serviceClient().delete(groupId, subscriptionId); + } + + 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 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 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..cdec8bd4abc2 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupsApiBuilder.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.implementation; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.Duration; + +/** A builder for creating a new instance of the ManagementGroupsApiImpl type. */ +@ServiceClientBuilder(serviceClients = {ManagementGroupsApiImpl.class}) +public final class ManagementGroupsApiBuilder { + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the ManagementGroupsApiBuilder. + */ + public ManagementGroupsApiBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the ManagementGroupsApiBuilder. + */ + public ManagementGroupsApiBuilder environment(AzureEnvironment environment) { + this.environment = environment; + return this; + } + + /* + * The HTTP pipeline to send requests through + */ + private HttpPipeline pipeline; + + /** + * Sets The HTTP pipeline to send requests through. + * + * @param pipeline the pipeline value. + * @return the ManagementGroupsApiBuilder. + */ + public ManagementGroupsApiBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The default poll interval for long-running operation + */ + private Duration defaultPollInterval; + + /** + * Sets The default poll interval for long-running operation. + * + * @param defaultPollInterval the defaultPollInterval value. + * @return the ManagementGroupsApiBuilder. + */ + public ManagementGroupsApiBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + return this; + } + + /* + * The serializer to serialize an object into a string + */ + private SerializerAdapter serializerAdapter; + + /** + * Sets The serializer to serialize an object into a string. + * + * @param serializerAdapter the serializerAdapter value. + * @return the ManagementGroupsApiBuilder. + */ + public ManagementGroupsApiBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of ManagementGroupsApiImpl with the provided parameters. + * + * @return an instance of ManagementGroupsApiImpl. + */ + public ManagementGroupsApiImpl buildClient() { + String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; + AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; + HttpPipeline localPipeline = + (pipeline != null) + ? pipeline + : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + Duration localDefaultPollInterval = + (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); + SerializerAdapter localSerializerAdapter = + (serializerAdapter != null) + ? serializerAdapter + : SerializerFactory.createDefaultManagementSerializerAdapter(); + ManagementGroupsApiImpl client = + new ManagementGroupsApiImpl( + localPipeline, localSerializerAdapter, localDefaultPollInterval, localEnvironment, localEndpoint); + return client; + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupsApiImpl.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupsApiImpl.java new file mode 100644 index 000000000000..7f97efeb38b3 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupsApiImpl.java @@ -0,0 +1,345 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.managementgroups.fluent.EntitiesClient; +import com.azure.resourcemanager.managementgroups.fluent.HierarchySettingsOperationsClient; +import com.azure.resourcemanager.managementgroups.fluent.ManagementGroupSubscriptionsClient; +import com.azure.resourcemanager.managementgroups.fluent.ManagementGroupsApi; +import com.azure.resourcemanager.managementgroups.fluent.ManagementGroupsClient; +import com.azure.resourcemanager.managementgroups.fluent.OperationsClient; +import com.azure.resourcemanager.managementgroups.fluent.ResourceProvidersClient; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the ManagementGroupsApiImpl type. */ +@ServiceClient(builder = ManagementGroupsApiBuilder.class) +public final class ManagementGroupsApiImpl implements ManagementGroupsApi { + /** server parameter. */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** Api Version. */ + private final String apiVersion; + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** The HTTP pipeline to send requests through. */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** The serializer to serialize an object into a string. */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** The default poll interval for long-running operation. */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** The ManagementGroupsClient object to access its operations. */ + private final ManagementGroupsClient managementGroups; + + /** + * Gets the ManagementGroupsClient object to access its operations. + * + * @return the ManagementGroupsClient object. + */ + public ManagementGroupsClient getManagementGroups() { + return this.managementGroups; + } + + /** The ManagementGroupSubscriptionsClient object to access its operations. */ + private final ManagementGroupSubscriptionsClient managementGroupSubscriptions; + + /** + * Gets the ManagementGroupSubscriptionsClient object to access its operations. + * + * @return the ManagementGroupSubscriptionsClient object. + */ + public ManagementGroupSubscriptionsClient getManagementGroupSubscriptions() { + return this.managementGroupSubscriptions; + } + + /** The HierarchySettingsOperationsClient object to access its operations. */ + private final HierarchySettingsOperationsClient hierarchySettingsOperations; + + /** + * Gets the HierarchySettingsOperationsClient object to access its operations. + * + * @return the HierarchySettingsOperationsClient object. + */ + public HierarchySettingsOperationsClient getHierarchySettingsOperations() { + return this.hierarchySettingsOperations; + } + + /** The OperationsClient object to access its operations. */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** The ResourceProvidersClient object to access its operations. */ + private final ResourceProvidersClient resourceProviders; + + /** + * Gets the ResourceProvidersClient object to access its operations. + * + * @return the ResourceProvidersClient object. + */ + public ResourceProvidersClient getResourceProviders() { + return this.resourceProviders; + } + + /** The EntitiesClient object to access its operations. */ + private final EntitiesClient entities; + + /** + * Gets the EntitiesClient object to access its operations. + * + * @return the EntitiesClient object. + */ + public EntitiesClient getEntities() { + return this.entities; + } + + /** + * Initializes an instance of ManagementGroupsApi client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param endpoint server parameter. + */ + ManagementGroupsApiImpl( + HttpPipeline httpPipeline, + SerializerAdapter serializerAdapter, + Duration defaultPollInterval, + AzureEnvironment environment, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.endpoint = endpoint; + this.apiVersion = "2021-04-01"; + this.managementGroups = new ManagementGroupsClientImpl(this); + this.managementGroupSubscriptions = new ManagementGroupSubscriptionsClientImpl(this); + this.hierarchySettingsOperations = new HierarchySettingsOperationsClientImpl(this); + this.operations = new OperationsClientImpl(this); + this.resourceProviders = new ResourceProvidersClientImpl(this); + this.entities = new EntitiesClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + return CoreUtils.mergeContexts(this.getContext(), context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult( + Mono>> activationResponse, + HttpPipeline httpPipeline, + Type pollResultType, + Type finalResultType, + Context context) { + return PollerFactory + .create( + serializerAdapter, + httpPipeline, + pollResultType, + finalResultType, + defaultPollInterval, + activationResponse, + context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = + new HttpResponseImpl( + lroError.getResponseStatusCode(), lroError.getResponseHeaders(), lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = + this + .getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + LOGGER.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(s); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ManagementGroupsApiImpl.class); +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupsClientImpl.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupsClientImpl.java new file mode 100644 index 000000000000..bbd0ecdfb8b4 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupsClientImpl.java @@ -0,0 +1,1600 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.managementgroups.fluent.ManagementGroupsClient; +import com.azure.resourcemanager.managementgroups.fluent.models.AzureAsyncOperationResultsInner; +import com.azure.resourcemanager.managementgroups.fluent.models.DescendantInfoInner; +import com.azure.resourcemanager.managementgroups.fluent.models.ManagementGroupInfoInner; +import com.azure.resourcemanager.managementgroups.fluent.models.ManagementGroupInner; +import com.azure.resourcemanager.managementgroups.models.CreateManagementGroupRequest; +import com.azure.resourcemanager.managementgroups.models.DescendantListResult; +import com.azure.resourcemanager.managementgroups.models.ManagementGroupExpandType; +import com.azure.resourcemanager.managementgroups.models.ManagementGroupListResult; +import com.azure.resourcemanager.managementgroups.models.PatchManagementGroupRequest; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ManagementGroupsClient. */ +public final class ManagementGroupsClientImpl implements ManagementGroupsClient { + /** The proxy service used to perform REST calls. */ + private final ManagementGroupsService service; + + /** The service client containing this operation class. */ + private final ManagementGroupsApiImpl client; + + /** + * Initializes an instance of ManagementGroupsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagementGroupsClientImpl(ManagementGroupsApiImpl client) { + this.service = + RestProxy.create(ManagementGroupsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ManagementGroupsApiManagementGroups to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ManagementGroupsApiM") + public interface ManagementGroupsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Management/managementGroups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Cache-Control") String cacheControl, + @QueryParam("$skiptoken") String skiptoken, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Management/managementGroups/{groupId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("groupId") String groupId, + @QueryParam("api-version") String apiVersion, + @QueryParam("$expand") ManagementGroupExpandType expand, + @QueryParam("$recurse") Boolean recurse, + @QueryParam("$filter") String filter, + @HeaderParam("Cache-Control") String cacheControl, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put("/providers/Microsoft.Management/managementGroups/{groupId}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("groupId") String groupId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Cache-Control") String cacheControl, + @BodyParam("application/json") CreateManagementGroupRequest createManagementGroupRequest, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch("/providers/Microsoft.Management/managementGroups/{groupId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("groupId") String groupId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Cache-Control") String cacheControl, + @BodyParam("application/json") PatchManagementGroupRequest patchGroupRequest, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete("/providers/Microsoft.Management/managementGroups/{groupId}") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("groupId") String groupId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Cache-Control") String cacheControl, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Management/managementGroups/{groupId}/descendants") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getDescendants( + @HostParam("$host") String endpoint, + @PathParam("groupId") String groupId, + @QueryParam("api-version") String apiVersion, + @QueryParam("$skiptoken") String skiptoken, + @QueryParam("$top") Integer top, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Cache-Control") String cacheControl, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getDescendantsNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List management groups for the authenticated user. + * + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a + * previous response contains a nextLink element, the value of the nextLink element will include a token + * parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to list management groups along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String cacheControl, String skiptoken) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + cacheControl, + skiptoken, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List management groups for the authenticated user. + * + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a + * previous response contains a nextLink element, the value of the nextLink element will include a token + * parameter that specifies a starting point to use for subsequent calls. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to list management groups along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String cacheControl, String skiptoken, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), cacheControl, skiptoken, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List management groups for the authenticated user. + * + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a + * previous response contains a nextLink element, the value of the nextLink element will include a token + * parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to list management groups as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String cacheControl, String skiptoken) { + return new PagedFlux<>( + () -> listSinglePageAsync(cacheControl, skiptoken), + nextLink -> listNextSinglePageAsync(nextLink, cacheControl)); + } + + /** + * List management groups for the authenticated user. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to list management groups as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + final String cacheControl = null; + final String skiptoken = null; + return new PagedFlux<>( + () -> listSinglePageAsync(cacheControl, skiptoken), + nextLink -> listNextSinglePageAsync(nextLink, cacheControl)); + } + + /** + * List management groups for the authenticated user. + * + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a + * previous response contains a nextLink element, the value of the nextLink element will include a token + * parameter that specifies a starting point to use for subsequent calls. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to list management groups as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String cacheControl, String skiptoken, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(cacheControl, skiptoken, context), + nextLink -> listNextSinglePageAsync(nextLink, cacheControl, context)); + } + + /** + * List management groups for the authenticated user. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to list management groups as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + final String cacheControl = null; + final String skiptoken = null; + return new PagedIterable<>(listAsync(cacheControl, skiptoken)); + } + + /** + * List management groups for the authenticated user. + * + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a + * previous response contains a nextLink element, the value of the nextLink element will include a token + * parameter that specifies a starting point to use for subsequent calls. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to list management groups as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String cacheControl, String skiptoken, Context context) { + return new PagedIterable<>(listAsync(cacheControl, skiptoken, context)); + } + + /** + * Get the details of the management group. + * + * @param groupId Management Group ID. + * @param expand The $expand=children query string parameter allows clients to request inclusion of children in the + * response payload. $expand=path includes the path from the root group to the current group. $expand=ancestors + * includes the ancestor Ids of the current group. + * @param recurse The $recurse=true query string parameter allows clients to request inclusion of entire hierarchy + * in the response payload. Note that $expand=children must be passed up if $recurse is set to true. + * @param filter A filter which allows the exclusion of subscriptions from results (i.e. '$filter=children.childType + * ne Subscription'). + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the management group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String groupId, ManagementGroupExpandType expand, Boolean recurse, String filter, String cacheControl) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + groupId, + this.client.getApiVersion(), + expand, + recurse, + filter, + cacheControl, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the details of the management group. + * + * @param groupId Management Group ID. + * @param expand The $expand=children query string parameter allows clients to request inclusion of children in the + * response payload. $expand=path includes the path from the root group to the current group. $expand=ancestors + * includes the ancestor Ids of the current group. + * @param recurse The $recurse=true query string parameter allows clients to request inclusion of entire hierarchy + * in the response payload. Note that $expand=children must be passed up if $recurse is set to true. + * @param filter A filter which allows the exclusion of subscriptions from results (i.e. '$filter=children.childType + * ne Subscription'). + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the management group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String groupId, + ManagementGroupExpandType expand, + Boolean recurse, + String filter, + String cacheControl, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + groupId, + this.client.getApiVersion(), + expand, + recurse, + filter, + cacheControl, + accept, + context); + } + + /** + * Get the details of the management group. + * + * @param groupId Management Group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the management group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String groupId) { + final ManagementGroupExpandType expand = null; + final Boolean recurse = null; + final String filter = null; + final String cacheControl = null; + return getWithResponseAsync(groupId, expand, recurse, filter, cacheControl) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get the details of the management group. + * + * @param groupId Management Group ID. + * @param expand The $expand=children query string parameter allows clients to request inclusion of children in the + * response payload. $expand=path includes the path from the root group to the current group. $expand=ancestors + * includes the ancestor Ids of the current group. + * @param recurse The $recurse=true query string parameter allows clients to request inclusion of entire hierarchy + * in the response payload. Note that $expand=children must be passed up if $recurse is set to true. + * @param filter A filter which allows the exclusion of subscriptions from results (i.e. '$filter=children.childType + * ne Subscription'). + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the management group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String groupId, + ManagementGroupExpandType expand, + Boolean recurse, + String filter, + String cacheControl, + Context context) { + return getWithResponseAsync(groupId, expand, recurse, filter, cacheControl, context).block(); + } + + /** + * Get the details of the management group. + * + * @param groupId Management Group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the management group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagementGroupInner get(String groupId) { + final ManagementGroupExpandType expand = null; + final Boolean recurse = null; + final String filter = null; + final String cacheControl = null; + return getWithResponse(groupId, expand, recurse, filter, cacheControl, Context.NONE).getValue(); + } + + /** + * Create or update a management group. If a management group is already created and a subsequent create request is + * issued with different properties, the management group properties will be updated. + * + * @param groupId Management Group ID. + * @param createManagementGroupRequest Management group creation parameters. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the management group details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String groupId, CreateManagementGroupRequest createManagementGroupRequest, String cacheControl) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + if (createManagementGroupRequest == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createManagementGroupRequest is required and cannot be null.")); + } else { + createManagementGroupRequest.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + groupId, + this.client.getApiVersion(), + cacheControl, + createManagementGroupRequest, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update a management group. If a management group is already created and a subsequent create request is + * issued with different properties, the management group properties will be updated. + * + * @param groupId Management Group ID. + * @param createManagementGroupRequest Management group creation parameters. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the management group details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String groupId, + CreateManagementGroupRequest createManagementGroupRequest, + String cacheControl, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + if (createManagementGroupRequest == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createManagementGroupRequest is required and cannot be null.")); + } else { + createManagementGroupRequest.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + groupId, + this.client.getApiVersion(), + cacheControl, + createManagementGroupRequest, + accept, + context); + } + + /** + * Create or update a management group. If a management group is already created and a subsequent create request is + * issued with different properties, the management group properties will be updated. + * + * @param groupId Management Group ID. + * @param createManagementGroupRequest Management group creation parameters. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the management group details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ManagementGroupInner> beginCreateOrUpdateAsync( + String groupId, CreateManagementGroupRequest createManagementGroupRequest, String cacheControl) { + Mono>> mono = + createOrUpdateWithResponseAsync(groupId, createManagementGroupRequest, cacheControl); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagementGroupInner.class, + ManagementGroupInner.class, + this.client.getContext()); + } + + /** + * Create or update a management group. If a management group is already created and a subsequent create request is + * issued with different properties, the management group properties will be updated. + * + * @param groupId Management Group ID. + * @param createManagementGroupRequest Management group creation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the management group details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ManagementGroupInner> beginCreateOrUpdateAsync( + String groupId, CreateManagementGroupRequest createManagementGroupRequest) { + final String cacheControl = null; + Mono>> mono = + createOrUpdateWithResponseAsync(groupId, createManagementGroupRequest, cacheControl); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagementGroupInner.class, + ManagementGroupInner.class, + this.client.getContext()); + } + + /** + * Create or update a management group. If a management group is already created and a subsequent create request is + * issued with different properties, the management group properties will be updated. + * + * @param groupId Management Group ID. + * @param createManagementGroupRequest Management group creation parameters. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the management group details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ManagementGroupInner> beginCreateOrUpdateAsync( + String groupId, + CreateManagementGroupRequest createManagementGroupRequest, + String cacheControl, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(groupId, createManagementGroupRequest, cacheControl, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ManagementGroupInner.class, ManagementGroupInner.class, context); + } + + /** + * Create or update a management group. If a management group is already created and a subsequent create request is + * issued with different properties, the management group properties will be updated. + * + * @param groupId Management Group ID. + * @param createManagementGroupRequest Management group creation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the management group details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ManagementGroupInner> beginCreateOrUpdate( + String groupId, CreateManagementGroupRequest createManagementGroupRequest) { + final String cacheControl = null; + return this.beginCreateOrUpdateAsync(groupId, createManagementGroupRequest, cacheControl).getSyncPoller(); + } + + /** + * Create or update a management group. If a management group is already created and a subsequent create request is + * issued with different properties, the management group properties will be updated. + * + * @param groupId Management Group ID. + * @param createManagementGroupRequest Management group creation parameters. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the management group details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ManagementGroupInner> beginCreateOrUpdate( + String groupId, + CreateManagementGroupRequest createManagementGroupRequest, + String cacheControl, + Context context) { + return this + .beginCreateOrUpdateAsync(groupId, createManagementGroupRequest, cacheControl, context) + .getSyncPoller(); + } + + /** + * Create or update a management group. If a management group is already created and a subsequent create request is + * issued with different properties, the management group properties will be updated. + * + * @param groupId Management Group ID. + * @param createManagementGroupRequest Management group creation parameters. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the management group details on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String groupId, CreateManagementGroupRequest createManagementGroupRequest, String cacheControl) { + return beginCreateOrUpdateAsync(groupId, createManagementGroupRequest, cacheControl) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a management group. If a management group is already created and a subsequent create request is + * issued with different properties, the management group properties will be updated. + * + * @param groupId Management Group ID. + * @param createManagementGroupRequest Management group creation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the management group details on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String groupId, CreateManagementGroupRequest createManagementGroupRequest) { + final String cacheControl = null; + return beginCreateOrUpdateAsync(groupId, createManagementGroupRequest, cacheControl) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a management group. If a management group is already created and a subsequent create request is + * issued with different properties, the management group properties will be updated. + * + * @param groupId Management Group ID. + * @param createManagementGroupRequest Management group creation parameters. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the management group details on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String groupId, + CreateManagementGroupRequest createManagementGroupRequest, + String cacheControl, + Context context) { + return beginCreateOrUpdateAsync(groupId, createManagementGroupRequest, cacheControl, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a management group. If a management group is already created and a subsequent create request is + * issued with different properties, the management group properties will be updated. + * + * @param groupId Management Group ID. + * @param createManagementGroupRequest Management group creation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the management group details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagementGroupInner createOrUpdate( + String groupId, CreateManagementGroupRequest createManagementGroupRequest) { + final String cacheControl = null; + return createOrUpdateAsync(groupId, createManagementGroupRequest, cacheControl).block(); + } + + /** + * Create or update a management group. If a management group is already created and a subsequent create request is + * issued with different properties, the management group properties will be updated. + * + * @param groupId Management Group ID. + * @param createManagementGroupRequest Management group creation parameters. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the management group details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagementGroupInner createOrUpdate( + String groupId, + CreateManagementGroupRequest createManagementGroupRequest, + String cacheControl, + Context context) { + return createOrUpdateAsync(groupId, createManagementGroupRequest, cacheControl, context).block(); + } + + /** + * Update a management group. + * + * @param groupId Management Group ID. + * @param patchGroupRequest Management group patch parameters. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the management group details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String groupId, PatchManagementGroupRequest patchGroupRequest, String cacheControl) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + if (patchGroupRequest == null) { + return Mono + .error(new IllegalArgumentException("Parameter patchGroupRequest is required and cannot be null.")); + } else { + patchGroupRequest.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + groupId, + this.client.getApiVersion(), + cacheControl, + patchGroupRequest, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a management group. + * + * @param groupId Management Group ID. + * @param patchGroupRequest Management group patch parameters. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the management group details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String groupId, PatchManagementGroupRequest patchGroupRequest, String cacheControl, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + if (patchGroupRequest == null) { + return Mono + .error(new IllegalArgumentException("Parameter patchGroupRequest is required and cannot be null.")); + } else { + patchGroupRequest.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + groupId, + this.client.getApiVersion(), + cacheControl, + patchGroupRequest, + accept, + context); + } + + /** + * Update a management group. + * + * @param groupId Management Group ID. + * @param patchGroupRequest Management group patch parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the management group details on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String groupId, PatchManagementGroupRequest patchGroupRequest) { + final String cacheControl = null; + return updateWithResponseAsync(groupId, patchGroupRequest, cacheControl) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Update a management group. + * + * @param groupId Management Group ID. + * @param patchGroupRequest Management group patch parameters. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the management group details along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String groupId, PatchManagementGroupRequest patchGroupRequest, String cacheControl, Context context) { + return updateWithResponseAsync(groupId, patchGroupRequest, cacheControl, context).block(); + } + + /** + * Update a management group. + * + * @param groupId Management Group ID. + * @param patchGroupRequest Management group patch parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the management group details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagementGroupInner update(String groupId, PatchManagementGroupRequest patchGroupRequest) { + final String cacheControl = null; + return updateWithResponse(groupId, patchGroupRequest, cacheControl, Context.NONE).getValue(); + } + + /** + * Delete management group. If a management group contains child resources, the request will fail. + * + * @param groupId Management Group ID. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the results of Azure-AsyncOperation along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String groupId, String cacheControl) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + groupId, + this.client.getApiVersion(), + cacheControl, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete management group. If a management group contains child resources, the request will fail. + * + * @param groupId Management Group ID. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the results of Azure-AsyncOperation along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String groupId, String cacheControl, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete(this.client.getEndpoint(), groupId, this.client.getApiVersion(), cacheControl, accept, context); + } + + /** + * Delete management group. If a management group contains child resources, the request will fail. + * + * @param groupId Management Group ID. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the results of Azure-AsyncOperation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, AzureAsyncOperationResultsInner> beginDeleteAsync( + String groupId, String cacheControl) { + Mono>> mono = deleteWithResponseAsync(groupId, cacheControl); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + AzureAsyncOperationResultsInner.class, + AzureAsyncOperationResultsInner.class, + this.client.getContext()); + } + + /** + * Delete management group. If a management group contains child resources, the request will fail. + * + * @param groupId Management Group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the results of Azure-AsyncOperation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, AzureAsyncOperationResultsInner> beginDeleteAsync( + String groupId) { + final String cacheControl = null; + Mono>> mono = deleteWithResponseAsync(groupId, cacheControl); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + AzureAsyncOperationResultsInner.class, + AzureAsyncOperationResultsInner.class, + this.client.getContext()); + } + + /** + * Delete management group. If a management group contains child resources, the request will fail. + * + * @param groupId Management Group ID. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the results of Azure-AsyncOperation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, AzureAsyncOperationResultsInner> beginDeleteAsync( + String groupId, String cacheControl, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(groupId, cacheControl, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + AzureAsyncOperationResultsInner.class, + AzureAsyncOperationResultsInner.class, + context); + } + + /** + * Delete management group. If a management group contains child resources, the request will fail. + * + * @param groupId Management Group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the results of Azure-AsyncOperation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, AzureAsyncOperationResultsInner> beginDelete( + String groupId) { + final String cacheControl = null; + return this.beginDeleteAsync(groupId, cacheControl).getSyncPoller(); + } + + /** + * Delete management group. If a management group contains child resources, the request will fail. + * + * @param groupId Management Group ID. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the results of Azure-AsyncOperation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, AzureAsyncOperationResultsInner> beginDelete( + String groupId, String cacheControl, Context context) { + return this.beginDeleteAsync(groupId, cacheControl, context).getSyncPoller(); + } + + /** + * Delete management group. If a management group contains child resources, the request will fail. + * + * @param groupId Management Group ID. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the results of Azure-AsyncOperation on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String groupId, String cacheControl) { + return beginDeleteAsync(groupId, cacheControl).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete management group. If a management group contains child resources, the request will fail. + * + * @param groupId Management Group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the results of Azure-AsyncOperation on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String groupId) { + final String cacheControl = null; + return beginDeleteAsync(groupId, cacheControl).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete management group. If a management group contains child resources, the request will fail. + * + * @param groupId Management Group ID. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the results of Azure-AsyncOperation on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String groupId, String cacheControl, Context context) { + return beginDeleteAsync(groupId, cacheControl, context).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete management group. If a management group contains child resources, the request will fail. + * + * @param groupId Management Group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the results of Azure-AsyncOperation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AzureAsyncOperationResultsInner delete(String groupId) { + final String cacheControl = null; + return deleteAsync(groupId, cacheControl).block(); + } + + /** + * Delete management group. If a management group contains child resources, the request will fail. + * + * @param groupId Management Group ID. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the results of Azure-AsyncOperation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AzureAsyncOperationResultsInner delete(String groupId, String cacheControl, Context context) { + return deleteAsync(groupId, cacheControl, context).block(); + } + + /** + * List all entities that descend from a management group. + * + * @param groupId Management Group ID. + * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a + * previous response contains a nextLink element, the value of the nextLink element will include a token + * parameter that specifies a starting point to use for subsequent calls. + * @param top Number of elements to return when retrieving results. Passing this in will override $skipToken. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to view descendants along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getDescendantsSinglePageAsync( + String groupId, String skiptoken, Integer top) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getDescendants( + this.client.getEndpoint(), + groupId, + this.client.getApiVersion(), + skiptoken, + top, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List all entities that descend from a management group. + * + * @param groupId Management Group ID. + * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a + * previous response contains a nextLink element, the value of the nextLink element will include a token + * parameter that specifies a starting point to use for subsequent calls. + * @param top Number of elements to return when retrieving results. Passing this in will override $skipToken. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to view descendants along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getDescendantsSinglePageAsync( + String groupId, String skiptoken, Integer top, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getDescendants( + this.client.getEndpoint(), groupId, this.client.getApiVersion(), skiptoken, top, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List all entities that descend from a management group. + * + * @param groupId Management Group ID. + * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a + * previous response contains a nextLink element, the value of the nextLink element will include a token + * parameter that specifies a starting point to use for subsequent calls. + * @param top Number of elements to return when retrieving results. Passing this in will override $skipToken. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to view descendants as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux getDescendantsAsync(String groupId, String skiptoken, Integer top) { + return new PagedFlux<>( + () -> getDescendantsSinglePageAsync(groupId, skiptoken, top), + nextLink -> getDescendantsNextSinglePageAsync(nextLink)); + } + + /** + * List all entities that descend from a management group. + * + * @param groupId Management Group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to view descendants as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux getDescendantsAsync(String groupId) { + final String skiptoken = null; + final Integer top = null; + return new PagedFlux<>( + () -> getDescendantsSinglePageAsync(groupId, skiptoken, top), + nextLink -> getDescendantsNextSinglePageAsync(nextLink)); + } + + /** + * List all entities that descend from a management group. + * + * @param groupId Management Group ID. + * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a + * previous response contains a nextLink element, the value of the nextLink element will include a token + * parameter that specifies a starting point to use for subsequent calls. + * @param top Number of elements to return when retrieving results. Passing this in will override $skipToken. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to view descendants as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux getDescendantsAsync( + String groupId, String skiptoken, Integer top, Context context) { + return new PagedFlux<>( + () -> getDescendantsSinglePageAsync(groupId, skiptoken, top, context), + nextLink -> getDescendantsNextSinglePageAsync(nextLink, context)); + } + + /** + * List all entities that descend from a management group. + * + * @param groupId Management Group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to view descendants as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getDescendants(String groupId) { + final String skiptoken = null; + final Integer top = null; + return new PagedIterable<>(getDescendantsAsync(groupId, skiptoken, top)); + } + + /** + * List all entities that descend from a management group. + * + * @param groupId Management Group ID. + * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a + * previous response contains a nextLink element, the value of the nextLink element will include a token + * parameter that specifies a starting point to use for subsequent calls. + * @param top Number of elements to return when retrieving results. Passing this in will override $skipToken. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to view descendants as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getDescendants( + String groupId, String skiptoken, Integer top, Context context) { + return new PagedIterable<>(getDescendantsAsync(groupId, skiptoken, top, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to list management groups along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync( + String nextLink, String cacheControl) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listNext(nextLink, this.client.getEndpoint(), cacheControl, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to list management groups along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync( + String nextLink, String cacheControl, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), cacheControl, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to view descendants along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getDescendantsNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getDescendantsNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to view descendants along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getDescendantsNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getDescendantsNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupsImpl.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupsImpl.java new file mode 100644 index 000000000000..1bb5714c60bc --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupsImpl.java @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.managementgroups.fluent.ManagementGroupsClient; +import com.azure.resourcemanager.managementgroups.fluent.models.AzureAsyncOperationResultsInner; +import com.azure.resourcemanager.managementgroups.fluent.models.DescendantInfoInner; +import com.azure.resourcemanager.managementgroups.fluent.models.ManagementGroupInfoInner; +import com.azure.resourcemanager.managementgroups.fluent.models.ManagementGroupInner; +import com.azure.resourcemanager.managementgroups.models.AzureAsyncOperationResults; +import com.azure.resourcemanager.managementgroups.models.CreateManagementGroupRequest; +import com.azure.resourcemanager.managementgroups.models.DescendantInfo; +import com.azure.resourcemanager.managementgroups.models.ManagementGroup; +import com.azure.resourcemanager.managementgroups.models.ManagementGroupExpandType; +import com.azure.resourcemanager.managementgroups.models.ManagementGroupInfo; +import com.azure.resourcemanager.managementgroups.models.ManagementGroups; +import com.azure.resourcemanager.managementgroups.models.PatchManagementGroupRequest; + +public final class ManagementGroupsImpl implements ManagementGroups { + private static final ClientLogger LOGGER = new ClientLogger(ManagementGroupsImpl.class); + + private final ManagementGroupsClient innerClient; + + private final com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager; + + public ManagementGroupsImpl( + ManagementGroupsClient innerClient, + com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new ManagementGroupInfoImpl(inner1, this.manager())); + } + + public PagedIterable list(String cacheControl, String skiptoken, Context context) { + PagedIterable inner = this.serviceClient().list(cacheControl, skiptoken, context); + return Utils.mapPage(inner, inner1 -> new ManagementGroupInfoImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String groupId, + ManagementGroupExpandType expand, + Boolean recurse, + String filter, + String cacheControl, + Context context) { + Response inner = + this.serviceClient().getWithResponse(groupId, expand, recurse, filter, cacheControl, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ManagementGroupImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ManagementGroup get(String groupId) { + ManagementGroupInner inner = this.serviceClient().get(groupId); + if (inner != null) { + return new ManagementGroupImpl(inner, this.manager()); + } else { + return null; + } + } + + public ManagementGroup createOrUpdate(String groupId, CreateManagementGroupRequest createManagementGroupRequest) { + ManagementGroupInner inner = this.serviceClient().createOrUpdate(groupId, createManagementGroupRequest); + if (inner != null) { + return new ManagementGroupImpl(inner, this.manager()); + } else { + return null; + } + } + + public ManagementGroup createOrUpdate( + String groupId, + CreateManagementGroupRequest createManagementGroupRequest, + String cacheControl, + Context context) { + ManagementGroupInner inner = + this.serviceClient().createOrUpdate(groupId, createManagementGroupRequest, cacheControl, context); + if (inner != null) { + return new ManagementGroupImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response updateWithResponse( + String groupId, PatchManagementGroupRequest patchGroupRequest, String cacheControl, Context context) { + Response inner = + this.serviceClient().updateWithResponse(groupId, patchGroupRequest, cacheControl, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ManagementGroupImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ManagementGroup update(String groupId, PatchManagementGroupRequest patchGroupRequest) { + ManagementGroupInner inner = this.serviceClient().update(groupId, patchGroupRequest); + if (inner != null) { + return new ManagementGroupImpl(inner, this.manager()); + } else { + return null; + } + } + + public AzureAsyncOperationResults deleteByResourceGroup(String groupId) { + AzureAsyncOperationResultsInner inner = this.serviceClient().delete(groupId); + if (inner != null) { + return new AzureAsyncOperationResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public AzureAsyncOperationResults delete(String groupId, String cacheControl, Context context) { + AzureAsyncOperationResultsInner inner = this.serviceClient().delete(groupId, cacheControl, context); + if (inner != null) { + return new AzureAsyncOperationResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable getDescendants(String groupId) { + PagedIterable inner = this.serviceClient().getDescendants(groupId); + return Utils.mapPage(inner, inner1 -> new DescendantInfoImpl(inner1, this.manager())); + } + + public PagedIterable getDescendants( + String groupId, String skiptoken, Integer top, Context context) { + PagedIterable inner = + this.serviceClient().getDescendants(groupId, skiptoken, top, context); + return Utils.mapPage(inner, inner1 -> new DescendantInfoImpl(inner1, this.manager())); + } + + private ManagementGroupsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/OperationImpl.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/OperationImpl.java new file mode 100644 index 000000000000..d3dfa3cd4a2e --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/OperationImpl.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.implementation; + +import com.azure.resourcemanager.managementgroups.fluent.models.OperationInner; +import com.azure.resourcemanager.managementgroups.models.Operation; +import com.azure.resourcemanager.managementgroups.models.OperationDisplayProperties; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager; + + OperationImpl( + OperationInner innerObject, com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public OperationDisplayProperties display() { + return this.innerModel().display(); + } + + public OperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/OperationsClientImpl.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/OperationsClientImpl.java new file mode 100644 index 000000000000..7cd204f80cf6 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/OperationsClientImpl.java @@ -0,0 +1,276 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.managementgroups.fluent.OperationsClient; +import com.azure.resourcemanager.managementgroups.fluent.models.OperationInner; +import com.azure.resourcemanager.managementgroups.models.OperationListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public final class OperationsClientImpl implements OperationsClient { + /** The proxy service used to perform REST calls. */ + private final OperationsService service; + + /** The service client containing this operation class. */ + private final ManagementGroupsApiImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(ManagementGroupsApiImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ManagementGroupsApiOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ManagementGroupsApiO") + public interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Management/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists all of the available Management REST API operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to list Microsoft.Management operations along with {@link + * PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all of the available Management REST API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to list Microsoft.Management operations along with {@link + * PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all of the available Management REST API operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to list Microsoft.Management operations as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the available Management REST API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to list Microsoft.Management operations as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all of the available Management REST API operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to list Microsoft.Management operations as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all of the available Management REST API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to list Microsoft.Management operations as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to list Microsoft.Management operations along with {@link + * PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(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.listNext(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 URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to list Microsoft.Management operations along with {@link + * PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(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 + .listNext(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/OperationsImpl.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/OperationsImpl.java new file mode 100644 index 000000000000..bf81fcdd491a --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/OperationsImpl.java @@ -0,0 +1,46 @@ +// 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.OperationsClient; +import com.azure.resourcemanager.managementgroups.fluent.models.OperationInner; +import com.azure.resourcemanager.managementgroups.models.Operation; +import com.azure.resourcemanager.managementgroups.models.Operations; + +public final class OperationsImpl implements Operations { + private static final ClientLogger LOGGER = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager; + + public OperationsImpl( + OperationsClient 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 OperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + private OperationsClient 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/ResourceProvidersClientImpl.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ResourceProvidersClientImpl.java new file mode 100644 index 000000000000..4395db92da5b --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ResourceProvidersClientImpl.java @@ -0,0 +1,380 @@ +// 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.ExpectedResponses; +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.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.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.managementgroups.fluent.ResourceProvidersClient; +import com.azure.resourcemanager.managementgroups.fluent.models.CheckNameAvailabilityResultInner; +import com.azure.resourcemanager.managementgroups.fluent.models.TenantBackfillStatusResultInner; +import com.azure.resourcemanager.managementgroups.models.CheckNameAvailabilityRequest; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ResourceProvidersClient. */ +public final class ResourceProvidersClientImpl implements ResourceProvidersClient { + /** The proxy service used to perform REST calls. */ + private final ResourceProvidersService service; + + /** The service client containing this operation class. */ + private final ManagementGroupsApiImpl client; + + /** + * Initializes an instance of ResourceProvidersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ResourceProvidersClientImpl(ManagementGroupsApiImpl client) { + this.service = + RestProxy.create(ResourceProvidersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ManagementGroupsApiResourceProviders to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ManagementGroupsApiR") + public interface ResourceProvidersService { + @Headers({"Content-Type: application/json"}) + @Post("/providers/Microsoft.Management/checkNameAvailability") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> checkNameAvailability( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") CheckNameAvailabilityRequest checkNameAvailabilityRequest, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post("/providers/Microsoft.Management/startTenantBackfill") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> startTenantBackfill( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post("/providers/Microsoft.Management/tenantBackfillStatus") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> tenantBackfillStatus( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to check management group name availability along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkNameAvailabilityWithResponseAsync( + CheckNameAvailabilityRequest checkNameAvailabilityRequest) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (checkNameAvailabilityRequest == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter checkNameAvailabilityRequest is required and cannot be null.")); + } else { + checkNameAvailabilityRequest.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .checkNameAvailability( + this.client.getEndpoint(), + this.client.getApiVersion(), + checkNameAvailabilityRequest, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to check management group name availability along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkNameAvailabilityWithResponseAsync( + CheckNameAvailabilityRequest checkNameAvailabilityRequest, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (checkNameAvailabilityRequest == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter checkNameAvailabilityRequest is required and cannot be null.")); + } else { + checkNameAvailabilityRequest.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .checkNameAvailability( + this.client.getEndpoint(), this.client.getApiVersion(), checkNameAvailabilityRequest, accept, context); + } + + /** + * 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 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 on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono checkNameAvailabilityAsync( + CheckNameAvailabilityRequest checkNameAvailabilityRequest) { + return checkNameAvailabilityWithResponseAsync(checkNameAvailabilityRequest) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to check management group name availability along with {@link + * Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response checkNameAvailabilityWithResponse( + CheckNameAvailabilityRequest checkNameAvailabilityRequest, Context context) { + return checkNameAvailabilityWithResponseAsync(checkNameAvailabilityRequest, context).block(); + } + + /** + * 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 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) + public CheckNameAvailabilityResultInner checkNameAvailability( + CheckNameAvailabilityRequest checkNameAvailabilityRequest) { + return checkNameAvailabilityWithResponse(checkNameAvailabilityRequest, Context.NONE).getValue(); + } + + /** + * Starts backfilling subscriptions for the Tenant. + * + * @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 tenant backfill status along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> startTenantBackfillWithResponseAsync() { + 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 + .startTenantBackfill(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Starts backfilling subscriptions for the Tenant. + * + * @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 tenant backfill status along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> startTenantBackfillWithResponseAsync(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.startTenantBackfill(this.client.getEndpoint(), this.client.getApiVersion(), accept, context); + } + + /** + * Starts backfilling subscriptions for the Tenant. + * + * @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 tenant backfill status on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono startTenantBackfillAsync() { + return startTenantBackfillWithResponseAsync().flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Starts backfilling subscriptions for the Tenant. + * + * @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 tenant backfill status along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response startTenantBackfillWithResponse(Context context) { + return startTenantBackfillWithResponseAsync(context).block(); + } + + /** + * Starts backfilling subscriptions for the Tenant. + * + * @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 tenant backfill status. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TenantBackfillStatusResultInner startTenantBackfill() { + return startTenantBackfillWithResponse(Context.NONE).getValue(); + } + + /** + * Gets tenant backfill status. + * + * @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 tenant backfill status along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> tenantBackfillStatusWithResponseAsync() { + 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 + .tenantBackfillStatus(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets tenant backfill status. + * + * @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 tenant backfill status along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> tenantBackfillStatusWithResponseAsync(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.tenantBackfillStatus(this.client.getEndpoint(), this.client.getApiVersion(), accept, context); + } + + /** + * Gets tenant backfill status. + * + * @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 tenant backfill status on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono tenantBackfillStatusAsync() { + return tenantBackfillStatusWithResponseAsync().flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets tenant backfill status. + * + * @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 tenant backfill status along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response tenantBackfillStatusWithResponse(Context context) { + return tenantBackfillStatusWithResponseAsync(context).block(); + } + + /** + * Gets tenant backfill status. + * + * @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 tenant backfill status. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TenantBackfillStatusResultInner tenantBackfillStatus() { + return tenantBackfillStatusWithResponse(Context.NONE).getValue(); + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ResourceProvidersImpl.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ResourceProvidersImpl.java new file mode 100644 index 000000000000..5bf34d878750 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ResourceProvidersImpl.java @@ -0,0 +1,111 @@ +// 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.ResourceProvidersClient; +import com.azure.resourcemanager.managementgroups.fluent.models.CheckNameAvailabilityResultInner; +import com.azure.resourcemanager.managementgroups.fluent.models.TenantBackfillStatusResultInner; +import com.azure.resourcemanager.managementgroups.models.CheckNameAvailabilityRequest; +import com.azure.resourcemanager.managementgroups.models.CheckNameAvailabilityResult; +import com.azure.resourcemanager.managementgroups.models.ResourceProviders; +import com.azure.resourcemanager.managementgroups.models.TenantBackfillStatusResult; + +public final class ResourceProvidersImpl implements ResourceProviders { + private static final ClientLogger LOGGER = new ClientLogger(ResourceProvidersImpl.class); + + private final ResourceProvidersClient innerClient; + + private final com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager; + + public ResourceProvidersImpl( + ResourceProvidersClient innerClient, + com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response checkNameAvailabilityWithResponse( + CheckNameAvailabilityRequest checkNameAvailabilityRequest, Context context) { + Response inner = + this.serviceClient().checkNameAvailabilityWithResponse(checkNameAvailabilityRequest, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CheckNameAvailabilityResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CheckNameAvailabilityResult checkNameAvailability( + CheckNameAvailabilityRequest checkNameAvailabilityRequest) { + CheckNameAvailabilityResultInner inner = + this.serviceClient().checkNameAvailability(checkNameAvailabilityRequest); + if (inner != null) { + return new CheckNameAvailabilityResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response startTenantBackfillWithResponse(Context context) { + Response inner = this.serviceClient().startTenantBackfillWithResponse(context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new TenantBackfillStatusResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public TenantBackfillStatusResult startTenantBackfill() { + TenantBackfillStatusResultInner inner = this.serviceClient().startTenantBackfill(); + if (inner != null) { + return new TenantBackfillStatusResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response tenantBackfillStatusWithResponse(Context context) { + Response inner = + this.serviceClient().tenantBackfillStatusWithResponse(context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new TenantBackfillStatusResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public TenantBackfillStatusResult tenantBackfillStatus() { + TenantBackfillStatusResultInner inner = this.serviceClient().tenantBackfillStatus(); + if (inner != null) { + return new TenantBackfillStatusResultImpl(inner, this.manager()); + } else { + return null; + } + } + + private ResourceProvidersClient 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/SubscriptionUnderManagementGroupImpl.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/SubscriptionUnderManagementGroupImpl.java new file mode 100644 index 000000000000..995ea97f6035 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/SubscriptionUnderManagementGroupImpl.java @@ -0,0 +1,58 @@ +// 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.SubscriptionUnderManagementGroupInner; +import com.azure.resourcemanager.managementgroups.models.ParentGroupBagInfo; +import com.azure.resourcemanager.managementgroups.models.SubscriptionUnderManagementGroup; + +public final class SubscriptionUnderManagementGroupImpl implements SubscriptionUnderManagementGroup { + private SubscriptionUnderManagementGroupInner innerObject; + + private final com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager; + + SubscriptionUnderManagementGroupImpl( + SubscriptionUnderManagementGroupInner 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 tenant() { + return this.innerModel().tenant(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public ParentGroupBagInfo parent() { + return this.innerModel().parent(); + } + + public String state() { + return this.innerModel().state(); + } + + public SubscriptionUnderManagementGroupInner 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/TenantBackfillStatusResultImpl.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/TenantBackfillStatusResultImpl.java new file mode 100644 index 000000000000..6c468d3e729c --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/TenantBackfillStatusResultImpl.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.implementation; + +import com.azure.resourcemanager.managementgroups.fluent.models.TenantBackfillStatusResultInner; +import com.azure.resourcemanager.managementgroups.models.Status; +import com.azure.resourcemanager.managementgroups.models.TenantBackfillStatusResult; + +public final class TenantBackfillStatusResultImpl implements TenantBackfillStatusResult { + private TenantBackfillStatusResultInner innerObject; + + private final com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager; + + TenantBackfillStatusResultImpl( + TenantBackfillStatusResultInner innerObject, + com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String tenantId() { + return this.innerModel().tenantId(); + } + + public Status status() { + return this.innerModel().status(); + } + + public TenantBackfillStatusResultInner 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/Utils.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/Utils.java new file mode 100644 index 000000000000..2ccf7b22230b --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/Utils.java @@ -0,0 +1,204 @@ +// 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.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.util.CoreUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import reactor.core.publisher.Flux; + +final class Utils { + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (segments.size() > 0 && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super( + PagedFlux + .create( + () -> + (continuationToken, pageSize) -> + Flux.fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> + new PagedResponseBase( + page.getRequest(), + page.getStatusCode(), + page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), + page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl, PagedResponse>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl(iterable.iterator(), mapper); + } + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/package-info.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/package-info.java new file mode 100644 index 000000000000..4153d794e87d --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/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 implementations 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.implementation; diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/AzureAsyncOperationResults.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/AzureAsyncOperationResults.java new file mode 100644 index 000000000000..22d26f2767dd --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/AzureAsyncOperationResults.java @@ -0,0 +1,62 @@ +// 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.models; + +import com.azure.resourcemanager.managementgroups.fluent.models.AzureAsyncOperationResultsInner; + +/** An immutable client-side representation of AzureAsyncOperationResults. */ +public interface AzureAsyncOperationResults { + /** + * Gets 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. + */ + String id(); + + /** + * Gets the type property: The type of the resource. For example, Microsoft.Management/managementGroups. + * + * @return the type value. + */ + String type(); + + /** + * Gets the name property: The name of the management group. For example, 00000000-0000-0000-0000-000000000000. + * + * @return the name value. + */ + String name(); + + /** + * Gets the status property: The current status of the asynchronous operation performed . For example, Running, + * Succeeded, Failed. + * + * @return the status value. + */ + String status(); + + /** + * Gets the tenantId property: The AAD Tenant ID associated with the management group. For example, + * 00000000-0000-0000-0000-000000000000. + * + * @return the tenantId value. + */ + String tenantId(); + + /** + * Gets the displayName property: The friendly name of the management group. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the inner com.azure.resourcemanager.managementgroups.fluent.models.AzureAsyncOperationResultsInner object. + * + * @return the inner object. + */ + AzureAsyncOperationResultsInner innerModel(); +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/CheckNameAvailabilityRequest.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/CheckNameAvailabilityRequest.java new file mode 100644 index 000000000000..f8b27f2c2b25 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/CheckNameAvailabilityRequest.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Management group name availability check parameters. */ +@Fluent +public final class CheckNameAvailabilityRequest { + /* + * the name to check for availability + */ + @JsonProperty(value = "name") + private String name; + + /* + * fully qualified resource type which includes provider namespace + */ + @JsonProperty(value = "type") + private Type type; + + /** Creates an instance of CheckNameAvailabilityRequest class. */ + public CheckNameAvailabilityRequest() { + } + + /** + * Get the name property: the name to check for availability. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: the name to check for availability. + * + * @param name the name value to set. + * @return the CheckNameAvailabilityRequest object itself. + */ + public CheckNameAvailabilityRequest withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type property: fully qualified resource type which includes provider namespace. + * + * @return the type value. + */ + public Type type() { + return this.type; + } + + /** + * Set the type property: fully qualified resource type which includes provider namespace. + * + * @param type the type value to set. + * @return the CheckNameAvailabilityRequest object itself. + */ + public CheckNameAvailabilityRequest withType(Type type) { + this.type = type; + 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/models/CheckNameAvailabilityResult.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/CheckNameAvailabilityResult.java new file mode 100644 index 000000000000..da18235dbbe9 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/CheckNameAvailabilityResult.java @@ -0,0 +1,44 @@ +// 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.models; + +import com.azure.resourcemanager.managementgroups.fluent.models.CheckNameAvailabilityResultInner; + +/** An immutable client-side representation of CheckNameAvailabilityResult. */ +public interface CheckNameAvailabilityResult { + /** + * Gets the nameAvailable property: Required. True indicates name is valid and available. False indicates the name + * is invalid, unavailable, or both. + * + * @return the nameAvailable value. + */ + Boolean nameAvailable(); + + /** + * Gets 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. + */ + Reason reason(); + + /** + * Gets 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. + */ + String message(); + + /** + * Gets the inner com.azure.resourcemanager.managementgroups.fluent.models.CheckNameAvailabilityResultInner object. + * + * @return the inner object. + */ + CheckNameAvailabilityResultInner innerModel(); +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/CreateManagementGroupChildInfo.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/CreateManagementGroupChildInfo.java new file mode 100644 index 000000000000..83069c0108f5 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/CreateManagementGroupChildInfo.java @@ -0,0 +1,106 @@ +// 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.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The child information of a management group used during creation. */ +@Immutable +public final class CreateManagementGroupChildInfo { + /* + * The fully qualified resource type which includes provider namespace (e.g. Microsoft.Management/managementGroups) + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private ManagementGroupChildType type; + + /* + * The fully qualified ID for the child resource (management group or subscription). For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * The name of the child entity. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The friendly name of the child resource. + */ + @JsonProperty(value = "displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /* + * The list of children. + */ + @JsonProperty(value = "children", access = JsonProperty.Access.WRITE_ONLY) + private List children; + + /** Creates an instance of CreateManagementGroupChildInfo class. */ + public CreateManagementGroupChildInfo() { + } + + /** + * Get the type property: The fully qualified resource type which includes provider namespace (e.g. + * Microsoft.Management/managementGroups). + * + * @return the type value. + */ + public ManagementGroupChildType type() { + return this.type; + } + + /** + * Get the id property: The fully qualified ID for the child resource (management group or subscription). For + * example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the name property: The name of the child entity. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the displayName property: The friendly name of the child resource. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Get the children property: The list of children. + * + * @return the children value. + */ + public List children() { + return this.children; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (children() != null) { + children().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/CreateManagementGroupDetails.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/CreateManagementGroupDetails.java new file mode 100644 index 000000000000..a34ad834b883 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/CreateManagementGroupDetails.java @@ -0,0 +1,99 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The details of a management group used during creation. */ +@Fluent +public final class CreateManagementGroupDetails { + /* + * The version number of the object. + */ + @JsonProperty(value = "version", access = JsonProperty.Access.WRITE_ONLY) + private Integer version; + + /* + * The date and time when this object was last updated. + */ + @JsonProperty(value = "updatedTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime updatedTime; + + /* + * The identity of the principal or process that updated the object. + */ + @JsonProperty(value = "updatedBy", access = JsonProperty.Access.WRITE_ONLY) + private String updatedBy; + + /* + * (Optional) The ID of the parent management group used during creation. + */ + @JsonProperty(value = "parent") + private CreateParentGroupInfo parent; + + /** Creates an instance of CreateManagementGroupDetails class. */ + public CreateManagementGroupDetails() { + } + + /** + * Get the version property: The version number of the object. + * + * @return the version value. + */ + public Integer version() { + return this.version; + } + + /** + * Get the updatedTime property: The date and time when this object was last updated. + * + * @return the updatedTime value. + */ + public OffsetDateTime updatedTime() { + return this.updatedTime; + } + + /** + * Get the updatedBy property: The identity of the principal or process that updated the object. + * + * @return the updatedBy value. + */ + public String updatedBy() { + return this.updatedBy; + } + + /** + * Get the parent property: (Optional) The ID of the parent management group used during creation. + * + * @return the parent value. + */ + public CreateParentGroupInfo parent() { + return this.parent; + } + + /** + * Set the parent property: (Optional) The ID of the parent management group used during creation. + * + * @param parent the parent value to set. + * @return the CreateManagementGroupDetails object itself. + */ + public CreateManagementGroupDetails withParent(CreateParentGroupInfo 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/models/CreateManagementGroupRequest.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/CreateManagementGroupRequest.java new file mode 100644 index 000000000000..78c1ca83db10 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/CreateManagementGroupRequest.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.managementgroups.fluent.models.CreateManagementGroupProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Management group creation parameters. */ +@Fluent +public final class CreateManagementGroupRequest extends ProxyResource { + /* + * The name of the management group. For example, 00000000-0000-0000-0000-000000000000 + */ + @JsonProperty(value = "name") + private String name; + + /* + * The generic properties of a management group used during creation. + */ + @JsonProperty(value = "properties") + private CreateManagementGroupProperties innerProperties; + + /** Creates an instance of CreateManagementGroupRequest class. */ + public CreateManagementGroupRequest() { + } + + /** + * 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; + } + + /** + * Set the name property: The name of the management group. For example, 00000000-0000-0000-0000-000000000000. + * + * @param name the name value to set. + * @return the CreateManagementGroupRequest object itself. + */ + public CreateManagementGroupRequest withName(String name) { + this.name = name; + return this; + } + + /** + * Get the innerProperties property: The generic properties of a management group used during creation. + * + * @return the innerProperties value. + */ + private CreateManagementGroupProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the tenantId property: The AAD Tenant ID associated with the management group. For example, + * 00000000-0000-0000-0000-000000000000. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.innerProperties() == null ? null : this.innerProperties().tenantId(); + } + + /** + * Get the displayName property: The friendly name of the management group. If no value is passed then this field + * will be set to the groupId. + * + * @return the displayName value. + */ + public String displayName() { + return this.innerProperties() == null ? null : this.innerProperties().displayName(); + } + + /** + * Set the displayName property: The friendly name of the management group. If no value is passed then this field + * will be set to the groupId. + * + * @param displayName the displayName value to set. + * @return the CreateManagementGroupRequest object itself. + */ + public CreateManagementGroupRequest withDisplayName(String displayName) { + if (this.innerProperties() == null) { + this.innerProperties = new CreateManagementGroupProperties(); + } + this.innerProperties().withDisplayName(displayName); + return this; + } + + /** + * Get the details property: The details of a management group used during creation. + * + * @return the details value. + */ + public CreateManagementGroupDetails details() { + return this.innerProperties() == null ? null : this.innerProperties().details(); + } + + /** + * Set the details property: The details of a management group used during creation. + * + * @param details the details value to set. + * @return the CreateManagementGroupRequest object itself. + */ + public CreateManagementGroupRequest withDetails(CreateManagementGroupDetails details) { + if (this.innerProperties() == null) { + this.innerProperties = new CreateManagementGroupProperties(); + } + this.innerProperties().withDetails(details); + return this; + } + + /** + * Get the children property: The list of children. + * + * @return the children value. + */ + public List children() { + return this.innerProperties() == null ? null : this.innerProperties().children(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/CreateOrUpdateSettingsRequest.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/CreateOrUpdateSettingsRequest.java new file mode 100644 index 000000000000..1997cc925d78 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/CreateOrUpdateSettingsRequest.java @@ -0,0 +1,102 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.managementgroups.fluent.models.CreateOrUpdateSettingsProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Parameters for creating or updating Management Group settings. */ +@Fluent +public final class CreateOrUpdateSettingsRequest { + /* + * The properties of the request to create or update Management Group settings + */ + @JsonProperty(value = "properties") + private CreateOrUpdateSettingsProperties innerProperties; + + /** Creates an instance of CreateOrUpdateSettingsRequest class. */ + public CreateOrUpdateSettingsRequest() { + } + + /** + * Get the innerProperties property: The properties of the request to create or update Management Group settings. + * + * @return the innerProperties value. + */ + private CreateOrUpdateSettingsProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the requireAuthorizationForGroupCreation property: Indicates whether RBAC access is required upon group + * creation under the root Management Group. If set to true, user will require + * Microsoft.Management/managementGroups/write action on the root Management Group scope in order to create new + * Groups directly under the root. This will prevent new users from creating new Management Groups, unless they are + * given access. + * + * @return the requireAuthorizationForGroupCreation value. + */ + public Boolean requireAuthorizationForGroupCreation() { + return this.innerProperties() == null ? null : this.innerProperties().requireAuthorizationForGroupCreation(); + } + + /** + * Set the requireAuthorizationForGroupCreation property: Indicates whether RBAC access is required upon group + * creation under the root Management Group. If set to true, user will require + * Microsoft.Management/managementGroups/write action on the root Management Group scope in order to create new + * Groups directly under the root. This will prevent new users from creating new Management Groups, unless they are + * given access. + * + * @param requireAuthorizationForGroupCreation the requireAuthorizationForGroupCreation value to set. + * @return the CreateOrUpdateSettingsRequest object itself. + */ + public CreateOrUpdateSettingsRequest withRequireAuthorizationForGroupCreation( + Boolean requireAuthorizationForGroupCreation) { + if (this.innerProperties() == null) { + this.innerProperties = new CreateOrUpdateSettingsProperties(); + } + this.innerProperties().withRequireAuthorizationForGroupCreation(requireAuthorizationForGroupCreation); + return this; + } + + /** + * Get the defaultManagementGroup property: Settings that sets the default Management Group under which new + * subscriptions get added in this tenant. For example, + * /providers/Microsoft.Management/managementGroups/defaultGroup. + * + * @return the defaultManagementGroup value. + */ + public String defaultManagementGroup() { + return this.innerProperties() == null ? null : this.innerProperties().defaultManagementGroup(); + } + + /** + * Set the defaultManagementGroup property: Settings that sets the default Management Group under which new + * subscriptions get added in this tenant. For example, + * /providers/Microsoft.Management/managementGroups/defaultGroup. + * + * @param defaultManagementGroup the defaultManagementGroup value to set. + * @return the CreateOrUpdateSettingsRequest object itself. + */ + public CreateOrUpdateSettingsRequest withDefaultManagementGroup(String defaultManagementGroup) { + if (this.innerProperties() == null) { + this.innerProperties = new CreateOrUpdateSettingsProperties(); + } + this.innerProperties().withDefaultManagementGroup(defaultManagementGroup); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/CreateParentGroupInfo.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/CreateParentGroupInfo.java new file mode 100644 index 000000000000..489547890804 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/CreateParentGroupInfo.java @@ -0,0 +1,83 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** (Optional) The ID of the parent management group used during creation. */ +@Fluent +public final class CreateParentGroupInfo { + /* + * The fully qualified ID for the parent management group. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + */ + @JsonProperty(value = "id") + private String id; + + /* + * The name of the parent management group + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The friendly name of the parent management group. + */ + @JsonProperty(value = "displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /** Creates an instance of CreateParentGroupInfo class. */ + public CreateParentGroupInfo() { + } + + /** + * Get the id property: The fully qualified ID for the parent management group. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The fully qualified ID for the parent management group. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + * + * @param id the id value to set. + * @return the CreateParentGroupInfo object itself. + */ + public CreateParentGroupInfo withId(String id) { + this.id = id; + return this; + } + + /** + * Get the name property: The name of the parent management group. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the displayName property: The friendly name of the parent management group. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * 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/models/DescendantInfo.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/DescendantInfo.java new file mode 100644 index 000000000000..40b9e190e524 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/DescendantInfo.java @@ -0,0 +1,55 @@ +// 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.models; + +import com.azure.resourcemanager.managementgroups.fluent.models.DescendantInfoInner; + +/** An immutable client-side representation of DescendantInfo. */ +public interface DescendantInfo { + /** + * Gets 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. + */ + String id(); + + /** + * Gets the type property: The type of the resource. For example, Microsoft.Management/managementGroups or + * /subscriptions. + * + * @return the type value. + */ + String type(); + + /** + * Gets the name property: The name of the descendant. For example, 00000000-0000-0000-0000-000000000000. + * + * @return the name value. + */ + String name(); + + /** + * Gets the displayName property: The friendly name of the management group. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the parent property: The ID of the parent management group. + * + * @return the parent value. + */ + DescendantParentGroupInfo parent(); + + /** + * Gets the inner com.azure.resourcemanager.managementgroups.fluent.models.DescendantInfoInner object. + * + * @return the inner object. + */ + DescendantInfoInner innerModel(); +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/DescendantListResult.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/DescendantListResult.java new file mode 100644 index 000000000000..01247230c206 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/DescendantListResult.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.managementgroups.fluent.models.DescendantInfoInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes the result of the request to view descendants. */ +@Fluent +public final class DescendantListResult { + /* + * The list of descendants. + */ + @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; + + /** Creates an instance of DescendantListResult class. */ + public DescendantListResult() { + } + + /** + * Get the value property: The list of descendants. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of descendants. + * + * @param value the value value to set. + * @return the DescendantListResult object itself. + */ + public DescendantListResult 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/models/DescendantParentGroupInfo.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/DescendantParentGroupInfo.java new file mode 100644 index 000000000000..3fda369cf136 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/DescendantParentGroupInfo.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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The ID of the parent management group. */ +@Fluent +public final class DescendantParentGroupInfo { + /* + * The fully qualified ID for the parent management group. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + */ + @JsonProperty(value = "id") + private String id; + + /** Creates an instance of DescendantParentGroupInfo class. */ + public DescendantParentGroupInfo() { + } + + /** + * Get the id property: The fully qualified ID for the parent management group. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The fully qualified ID for the parent management group. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + * + * @param id the id value to set. + * @return the DescendantParentGroupInfo object itself. + */ + public DescendantParentGroupInfo withId(String id) { + this.id = id; + 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/models/Entities.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/Entities.java new file mode 100644 index 000000000000..ebd4c0adbb35 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/Entities.java @@ -0,0 +1,71 @@ +// 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.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Entities. */ +public interface Entities { + /** + * List all entities (Management Groups, Subscriptions, etc.) for the authenticated user. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to view entities as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List all entities (Management Groups, Subscriptions, etc.) for the authenticated user. + * + * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a + * previous response contains a nextLink element, the value of the nextLink element will include a token + * parameter that specifies a starting point to use for subsequent calls. + * @param skip Number of entities to skip over when retrieving results. Passing this in will override $skipToken. + * @param top Number of elements to return when retrieving results. Passing this in will override $skipToken. + * @param select This parameter specifies the fields to include in the response. Can include any combination of + * Name,DisplayName,Type,ParentDisplayNameChain,ParentChain, e.g. + * '$select=Name,DisplayName,Type,ParentDisplayNameChain,ParentNameChain'. When specified the $select parameter + * can override select in $skipToken. + * @param search The $search parameter is used in conjunction with the $filter parameter to return three different + * outputs depending on the parameter passed in. With $search=AllowedParents the API will return the entity info + * of all groups that the requested entity will be able to reparent to as determined by the user's permissions. + * With $search=AllowedChildren the API will return the entity info of all entities that can be added as + * children of the requested entity. With $search=ParentAndFirstLevelChildren the API will return the parent and + * first level of children that the user has either direct access to or indirect access via one of their + * descendants. With $search=ParentOnly the API will return only the group if the user has access to at least + * one of the descendants of the group. With $search=ChildrenOnly the API will return only the first level of + * children of the group entity info specified in $filter. The user must have direct access to the children + * entities or one of it's descendants for it to show up in the results. + * @param filter The filter parameter allows you to filter on the the name or display name fields. You can check for + * equality on the name field (e.g. name eq '{entityName}') and you can check for substrings on either the name + * or display name fields(e.g. contains(name, '{substringToSearch}'), contains(displayName, + * '{substringToSearch')). Note that the '{entityName}' and '{substringToSearch}' fields are checked case + * insensitively. + * @param view The view parameter allows clients to filter the type of data that is returned by the getEntities + * call. + * @param groupName A filter which allows the get entities call to focus on a particular group (i.e. "$filter=name + * eq 'groupName'"). + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to view entities as paginated response with {@link PagedIterable}. + */ + PagedIterable list( + String skiptoken, + Integer skip, + Integer top, + String select, + EntitySearchType search, + String filter, + EntityViewParameterType view, + String groupName, + String cacheControl, + Context context); +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/EntityHierarchyItem.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/EntityHierarchyItem.java new file mode 100644 index 000000000000..5bacfb00564b --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/EntityHierarchyItem.java @@ -0,0 +1,114 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.managementgroups.fluent.models.EntityHierarchyItemProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The management group details for the hierarchy view. */ +@Fluent +public final class EntityHierarchyItem extends ProxyResource { + /* + * The generic properties of a management group. + */ + @JsonProperty(value = "properties") + private EntityHierarchyItemProperties innerProperties; + + /** Creates an instance of EntityHierarchyItem class. */ + public EntityHierarchyItem() { + } + + /** + * Get the innerProperties property: The generic properties of a management group. + * + * @return the innerProperties value. + */ + private EntityHierarchyItemProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the displayName property: The friendly name of the management group. + * + * @return the displayName value. + */ + public String displayName() { + return this.innerProperties() == null ? null : this.innerProperties().displayName(); + } + + /** + * Set the displayName property: The friendly name of the management group. + * + * @param displayName the displayName value to set. + * @return the EntityHierarchyItem object itself. + */ + public EntityHierarchyItem withDisplayName(String displayName) { + if (this.innerProperties() == null) { + this.innerProperties = new EntityHierarchyItemProperties(); + } + this.innerProperties().withDisplayName(displayName); + return this; + } + + /** + * Get the permissions property: The users specific permissions to this item. + * + * @return the permissions value. + */ + public Permissions permissions() { + return this.innerProperties() == null ? null : this.innerProperties().permissions(); + } + + /** + * Set the permissions property: The users specific permissions to this item. + * + * @param permissions the permissions value to set. + * @return the EntityHierarchyItem object itself. + */ + public EntityHierarchyItem withPermissions(Permissions permissions) { + if (this.innerProperties() == null) { + this.innerProperties = new EntityHierarchyItemProperties(); + } + this.innerProperties().withPermissions(permissions); + return this; + } + + /** + * Get the children property: The list of children. + * + * @return the children value. + */ + public List children() { + return this.innerProperties() == null ? null : this.innerProperties().children(); + } + + /** + * Set the children property: The list of children. + * + * @param children the children value to set. + * @return the EntityHierarchyItem object itself. + */ + public EntityHierarchyItem withChildren(List children) { + if (this.innerProperties() == null) { + this.innerProperties = new EntityHierarchyItemProperties(); + } + this.innerProperties().withChildren(children); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/EntityInfo.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/EntityInfo.java new file mode 100644 index 000000000000..310ea8ec7fb7 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/EntityInfo.java @@ -0,0 +1,117 @@ +// 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.models; + +import com.azure.resourcemanager.managementgroups.fluent.models.EntityInfoInner; +import java.util.List; + +/** An immutable client-side representation of EntityInfo. */ +public interface EntityInfo { + /** + * Gets 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. + */ + String id(); + + /** + * Gets the type property: The type of the resource. For example, Microsoft.Management/managementGroups. + * + * @return the type value. + */ + String type(); + + /** + * Gets the name property: The name of the entity. For example, 00000000-0000-0000-0000-000000000000. + * + * @return the name value. + */ + String name(); + + /** + * Gets the tenantId property: The AAD Tenant ID associated with the entity. For example, + * 00000000-0000-0000-0000-000000000000. + * + * @return the tenantId value. + */ + String tenantId(); + + /** + * Gets the displayName property: The friendly name of the management group. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the parent property: (Optional) The ID of the parent management group. + * + * @return the parent value. + */ + EntityParentGroupInfo parent(); + + /** + * Gets the permissions property: The users specific permissions to this item. + * + * @return the permissions value. + */ + Permissions permissions(); + + /** + * Gets the inheritedPermissions property: The users specific permissions to this item. + * + * @return the inheritedPermissions value. + */ + Permissions inheritedPermissions(); + + /** + * Gets the numberOfDescendants property: Number of Descendants. + * + * @return the numberOfDescendants value. + */ + Integer numberOfDescendants(); + + /** + * Gets the numberOfChildren property: Number of Children + * + *

Number of children is the number of Groups and Subscriptions that are exactly one level underneath the current + * Group. + * + * @return the numberOfChildren value. + */ + Integer numberOfChildren(); + + /** + * Gets the numberOfChildGroups property: Number of Child Groups + * + *

Number of children is the number of Groups that are exactly one level underneath the current Group. + * + * @return the numberOfChildGroups value. + */ + Integer numberOfChildGroups(); + + /** + * Gets the parentDisplayNameChain property: The parent display name chain from the root group to the immediate + * parent. + * + * @return the parentDisplayNameChain value. + */ + List parentDisplayNameChain(); + + /** + * Gets the parentNameChain property: The parent name chain from the root group to the immediate parent. + * + * @return the parentNameChain value. + */ + List parentNameChain(); + + /** + * Gets the inner com.azure.resourcemanager.managementgroups.fluent.models.EntityInfoInner object. + * + * @return the inner object. + */ + EntityInfoInner innerModel(); +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/EntityListResult.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/EntityListResult.java new file mode 100644 index 000000000000..eaf667ae61c0 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/EntityListResult.java @@ -0,0 +1,85 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.managementgroups.fluent.models.EntityInfoInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes the result of the request to view entities. */ +@Fluent +public final class EntityListResult { + /* + * The list of entities. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Total count of records that match the filter + */ + @JsonProperty(value = "count", access = JsonProperty.Access.WRITE_ONLY) + private Integer count; + + /* + * The URL to use for getting the next set of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of EntityListResult class. */ + public EntityListResult() { + } + + /** + * Get the value property: The list of entities. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of entities. + * + * @param value the value value to set. + * @return the EntityListResult object itself. + */ + public EntityListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the count property: Total count of records that match the filter. + * + * @return the count value. + */ + public Integer count() { + return this.count; + } + + /** + * 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/models/EntityParentGroupInfo.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/EntityParentGroupInfo.java new file mode 100644 index 000000000000..cd34571c51d0 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/EntityParentGroupInfo.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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** (Optional) The ID of the parent management group. */ +@Fluent +public final class EntityParentGroupInfo { + /* + * The fully qualified ID for the parent management group. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + */ + @JsonProperty(value = "id") + private String id; + + /** Creates an instance of EntityParentGroupInfo class. */ + public EntityParentGroupInfo() { + } + + /** + * Get the id property: The fully qualified ID for the parent management group. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The fully qualified ID for the parent management group. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + * + * @param id the id value to set. + * @return the EntityParentGroupInfo object itself. + */ + public EntityParentGroupInfo withId(String id) { + this.id = id; + 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/models/EntitySearchType.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/EntitySearchType.java new file mode 100644 index 000000000000..5238a479ac7c --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/EntitySearchType.java @@ -0,0 +1,56 @@ +// 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.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for EntitySearchType. */ +public final class EntitySearchType extends ExpandableStringEnum { + /** Static value AllowedParents for EntitySearchType. */ + public static final EntitySearchType ALLOWED_PARENTS = fromString("AllowedParents"); + + /** Static value AllowedChildren for EntitySearchType. */ + public static final EntitySearchType ALLOWED_CHILDREN = fromString("AllowedChildren"); + + /** Static value ParentAndFirstLevelChildren for EntitySearchType. */ + public static final EntitySearchType PARENT_AND_FIRST_LEVEL_CHILDREN = fromString("ParentAndFirstLevelChildren"); + + /** Static value ParentOnly for EntitySearchType. */ + public static final EntitySearchType PARENT_ONLY = fromString("ParentOnly"); + + /** Static value ChildrenOnly for EntitySearchType. */ + public static final EntitySearchType CHILDREN_ONLY = fromString("ChildrenOnly"); + + /** + * Creates a new instance of EntitySearchType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public EntitySearchType() { + } + + /** + * Creates or finds a EntitySearchType from its string representation. + * + * @param name a name to look for. + * @return the corresponding EntitySearchType. + */ + @JsonCreator + public static EntitySearchType fromString(String name) { + return fromString(name, EntitySearchType.class); + } + + /** + * Gets known EntitySearchType values. + * + * @return known EntitySearchType values. + */ + public static Collection values() { + return values(EntitySearchType.class); + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/EntityViewParameterType.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/EntityViewParameterType.java new file mode 100644 index 000000000000..c3d16ebf0a70 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/EntityViewParameterType.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.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for EntityViewParameterType. */ +public final class EntityViewParameterType extends ExpandableStringEnum { + /** Static value FullHierarchy for EntityViewParameterType. */ + public static final EntityViewParameterType FULL_HIERARCHY = fromString("FullHierarchy"); + + /** Static value GroupsOnly for EntityViewParameterType. */ + public static final EntityViewParameterType GROUPS_ONLY = fromString("GroupsOnly"); + + /** Static value SubscriptionsOnly for EntityViewParameterType. */ + public static final EntityViewParameterType SUBSCRIPTIONS_ONLY = fromString("SubscriptionsOnly"); + + /** Static value Audit for EntityViewParameterType. */ + public static final EntityViewParameterType AUDIT = fromString("Audit"); + + /** + * Creates a new instance of EntityViewParameterType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public EntityViewParameterType() { + } + + /** + * Creates or finds a EntityViewParameterType from its string representation. + * + * @param name a name to look for. + * @return the corresponding EntityViewParameterType. + */ + @JsonCreator + public static EntityViewParameterType fromString(String name) { + return fromString(name, EntityViewParameterType.class); + } + + /** + * Gets known EntityViewParameterType values. + * + * @return known EntityViewParameterType values. + */ + public static Collection values() { + return values(EntityViewParameterType.class); + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/HierarchySettings.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/HierarchySettings.java new file mode 100644 index 000000000000..449e8124197b --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/HierarchySettings.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.models; + +import com.azure.resourcemanager.managementgroups.fluent.models.HierarchySettingsInner; + +/** An immutable client-side representation of HierarchySettings. */ +public interface HierarchySettings { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the tenantId property: The AAD Tenant ID associated with the hierarchy settings. For example, + * 00000000-0000-0000-0000-000000000000. + * + * @return the tenantId value. + */ + String tenantId(); + + /** + * Gets 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. + */ + Boolean requireAuthorizationForGroupCreation(); + + /** + * Gets 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. + */ + String defaultManagementGroup(); + + /** + * Gets the inner com.azure.resourcemanager.managementgroups.fluent.models.HierarchySettingsInner object. + * + * @return the inner object. + */ + HierarchySettingsInner innerModel(); +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/HierarchySettingsInfo.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/HierarchySettingsInfo.java new file mode 100644 index 000000000000..43662b9a5b7f --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/HierarchySettingsInfo.java @@ -0,0 +1,174 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.managementgroups.fluent.models.HierarchySettingsProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The hierarchy settings resource. */ +@Fluent +public final class HierarchySettingsInfo { + /* + * The fully qualified ID for the settings object. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000/settings/default. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * The type of the resource. For example, Microsoft.Management/managementGroups/settings. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * The name of the object. In this case, default. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The generic properties of hierarchy settings. + */ + @JsonProperty(value = "properties") + private HierarchySettingsProperties innerProperties; + + /** Creates an instance of HierarchySettingsInfo class. */ + public HierarchySettingsInfo() { + } + + /** + * Get the id property: The fully qualified ID for the settings object. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000/settings/default. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the type property: The type of the resource. For example, Microsoft.Management/managementGroups/settings. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the object. In this case, default. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the innerProperties property: The generic properties of hierarchy settings. + * + * @return the innerProperties value. + */ + private HierarchySettingsProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the tenantId property: The AAD Tenant ID associated with the hierarchy settings. For example, + * 00000000-0000-0000-0000-000000000000. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.innerProperties() == null ? null : this.innerProperties().tenantId(); + } + + /** + * Set the tenantId property: The AAD Tenant ID associated with the hierarchy settings. For example, + * 00000000-0000-0000-0000-000000000000. + * + * @param tenantId the tenantId value to set. + * @return the HierarchySettingsInfo object itself. + */ + public HierarchySettingsInfo withTenantId(String tenantId) { + if (this.innerProperties() == null) { + this.innerProperties = new HierarchySettingsProperties(); + } + this.innerProperties().withTenantId(tenantId); + return this; + } + + /** + * Get the requireAuthorizationForGroupCreation property: Indicates whether RBAC access is required upon group + * creation under the root Management Group. If set to true, user will require + * Microsoft.Management/managementGroups/write action on the root Management Group scope in order to create new + * Groups directly under the root. This will prevent new users from creating new Management Groups, unless they are + * given access. + * + * @return the requireAuthorizationForGroupCreation value. + */ + public Boolean requireAuthorizationForGroupCreation() { + return this.innerProperties() == null ? null : this.innerProperties().requireAuthorizationForGroupCreation(); + } + + /** + * Set the requireAuthorizationForGroupCreation property: Indicates whether RBAC access is required upon group + * creation under the root Management Group. If set to true, user will require + * Microsoft.Management/managementGroups/write action on the root Management Group scope in order to create new + * Groups directly under the root. This will prevent new users from creating new Management Groups, unless they are + * given access. + * + * @param requireAuthorizationForGroupCreation the requireAuthorizationForGroupCreation value to set. + * @return the HierarchySettingsInfo object itself. + */ + public HierarchySettingsInfo withRequireAuthorizationForGroupCreation( + Boolean requireAuthorizationForGroupCreation) { + if (this.innerProperties() == null) { + this.innerProperties = new HierarchySettingsProperties(); + } + this.innerProperties().withRequireAuthorizationForGroupCreation(requireAuthorizationForGroupCreation); + return this; + } + + /** + * Get the defaultManagementGroup property: Settings that sets the default Management Group under which new + * subscriptions get added in this tenant. For example, + * /providers/Microsoft.Management/managementGroups/defaultGroup. + * + * @return the defaultManagementGroup value. + */ + public String defaultManagementGroup() { + return this.innerProperties() == null ? null : this.innerProperties().defaultManagementGroup(); + } + + /** + * Set the defaultManagementGroup property: Settings that sets the default Management Group under which new + * subscriptions get added in this tenant. For example, + * /providers/Microsoft.Management/managementGroups/defaultGroup. + * + * @param defaultManagementGroup the defaultManagementGroup value to set. + * @return the HierarchySettingsInfo object itself. + */ + public HierarchySettingsInfo withDefaultManagementGroup(String defaultManagementGroup) { + if (this.innerProperties() == null) { + this.innerProperties = new HierarchySettingsProperties(); + } + this.innerProperties().withDefaultManagementGroup(defaultManagementGroup); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/HierarchySettingsList.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/HierarchySettingsList.java new file mode 100644 index 000000000000..99d34599bbb8 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/HierarchySettingsList.java @@ -0,0 +1,32 @@ +// 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.models; + +import com.azure.resourcemanager.managementgroups.fluent.models.HierarchySettingsListInner; +import java.util.List; + +/** An immutable client-side representation of HierarchySettingsList. */ +public interface HierarchySettingsList { + /** + * Gets the value property: The list of hierarchy settings. + * + * @return the value value. + */ + List value(); + + /** + * Gets the nextLink property: The URL to use for getting the next set of results. + * + * @return the nextLink value. + */ + String nextLink(); + + /** + * Gets the inner com.azure.resourcemanager.managementgroups.fluent.models.HierarchySettingsListInner object. + * + * @return the inner object. + */ + HierarchySettingsListInner innerModel(); +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/HierarchySettingsOperations.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/HierarchySettingsOperations.java new file mode 100644 index 000000000000..110e2559a3e1 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/HierarchySettingsOperations.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of HierarchySettingsOperations. */ +public interface HierarchySettingsOperations { + /** + * Gets all the hierarchy settings defined at the Management Group level. Settings can only be set on the root + * Management Group of the hierarchy. + * + * @param groupId Management Group ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the hierarchy settings defined at the Management Group level along with {@link Response}. + */ + Response listWithResponse(String groupId, 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 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. + */ + HierarchySettingsList list(String groupId); + + /** + * Gets the hierarchy settings defined at the Management Group level. Settings can only be set on the root + * Management Group of the hierarchy. + * + * @param groupId Management Group ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the hierarchy settings defined at the Management Group level along with {@link Response}. + */ + Response getWithResponse(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. + */ + HierarchySettings get(String groupId); + + /** + * Creates or updates the hierarchy settings defined at the Management Group level. + * + * @param groupId Management Group ID. + * @param createTenantSettingsRequest Tenant level settings request parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return settings defined at the Management Group scope along with {@link Response}. + */ + Response createOrUpdateWithResponse( + String groupId, CreateOrUpdateSettingsRequest createTenantSettingsRequest, 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. + */ + HierarchySettings createOrUpdate(String groupId, CreateOrUpdateSettingsRequest createTenantSettingsRequest); + + /** + * Updates the hierarchy settings defined at the Management Group level. + * + * @param groupId Management Group ID. + * @param createTenantSettingsRequest Tenant level settings request parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return settings defined at the Management Group scope along with {@link Response}. + */ + Response updateWithResponse( + 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. + */ + HierarchySettings update(String groupId, CreateOrUpdateSettingsRequest createTenantSettingsRequest); + + /** + * Deletes the hierarchy settings defined at the Management Group level. + * + * @param groupId Management Group ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse(String groupId, 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. + */ + void delete(String groupId); +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ListSubscriptionUnderManagementGroup.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ListSubscriptionUnderManagementGroup.java new file mode 100644 index 000000000000..dcd232f1e05c --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ListSubscriptionUnderManagementGroup.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.managementgroups.fluent.models.SubscriptionUnderManagementGroupInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The details of all subscriptions under management group. */ +@Fluent +public final class ListSubscriptionUnderManagementGroup { + /* + * The list of subscriptions. + */ + @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; + + /** Creates an instance of ListSubscriptionUnderManagementGroup class. */ + public ListSubscriptionUnderManagementGroup() { + } + + /** + * Get the value property: The list of subscriptions. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of subscriptions. + * + * @param value the value value to set. + * @return the ListSubscriptionUnderManagementGroup object itself. + */ + public ListSubscriptionUnderManagementGroup 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/models/ManagementGroup.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ManagementGroup.java new file mode 100644 index 000000000000..43cad688dc72 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ManagementGroup.java @@ -0,0 +1,68 @@ +// 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.models; + +import com.azure.resourcemanager.managementgroups.fluent.models.ManagementGroupInner; +import java.util.List; + +/** An immutable client-side representation of ManagementGroup. */ +public interface ManagementGroup { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the tenantId property: The AAD Tenant ID associated with the management group. For example, + * 00000000-0000-0000-0000-000000000000. + * + * @return the tenantId value. + */ + String tenantId(); + + /** + * Gets the displayName property: The friendly name of the management group. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the details property: The details of a management group. + * + * @return the details value. + */ + ManagementGroupDetails details(); + + /** + * Gets the children property: The list of children. + * + * @return the children value. + */ + List children(); + + /** + * Gets the inner com.azure.resourcemanager.managementgroups.fluent.models.ManagementGroupInner object. + * + * @return the inner object. + */ + ManagementGroupInner innerModel(); +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ManagementGroupChildInfo.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ManagementGroupChildInfo.java new file mode 100644 index 000000000000..409b1b47a119 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ManagementGroupChildInfo.java @@ -0,0 +1,163 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The child information of a management group. */ +@Fluent +public final class ManagementGroupChildInfo { + /* + * The fully qualified resource type which includes provider namespace (e.g. Microsoft.Management/managementGroups) + */ + @JsonProperty(value = "type") + private ManagementGroupChildType type; + + /* + * The fully qualified ID for the child resource (management group or subscription). For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + */ + @JsonProperty(value = "id") + private String id; + + /* + * The name of the child entity. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The friendly name of the child resource. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /* + * The list of children. + */ + @JsonProperty(value = "children") + private List children; + + /** Creates an instance of ManagementGroupChildInfo class. */ + public ManagementGroupChildInfo() { + } + + /** + * Get the type property: The fully qualified resource type which includes provider namespace (e.g. + * Microsoft.Management/managementGroups). + * + * @return the type value. + */ + public ManagementGroupChildType type() { + return this.type; + } + + /** + * Set the type property: The fully qualified resource type which includes provider namespace (e.g. + * Microsoft.Management/managementGroups). + * + * @param type the type value to set. + * @return the ManagementGroupChildInfo object itself. + */ + public ManagementGroupChildInfo withType(ManagementGroupChildType type) { + this.type = type; + return this; + } + + /** + * Get the id property: The fully qualified ID for the child resource (management group or subscription). For + * example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The fully qualified ID for the child resource (management group or subscription). For + * example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + * + * @param id the id value to set. + * @return the ManagementGroupChildInfo object itself. + */ + public ManagementGroupChildInfo withId(String id) { + this.id = id; + return this; + } + + /** + * Get the name property: The name of the child entity. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the child entity. + * + * @param name the name value to set. + * @return the ManagementGroupChildInfo object itself. + */ + public ManagementGroupChildInfo withName(String name) { + this.name = name; + return this; + } + + /** + * Get the displayName property: The friendly name of the child resource. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The friendly name of the child resource. + * + * @param displayName the displayName value to set. + * @return the ManagementGroupChildInfo object itself. + */ + public ManagementGroupChildInfo withDisplayName(String displayName) { + this.displayName = displayName; + 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 ManagementGroupChildInfo object itself. + */ + public ManagementGroupChildInfo withChildren(List children) { + this.children = children; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (children() != null) { + children().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ManagementGroupChildType.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ManagementGroupChildType.java new file mode 100644 index 000000000000..6b4a30be5d10 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ManagementGroupChildType.java @@ -0,0 +1,51 @@ +// 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.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** The type of child resource. */ +public enum ManagementGroupChildType { + /** Enum value Microsoft.Management/managementGroups. */ + MICROSOFT_MANAGEMENT_MANAGEMENT_GROUPS("Microsoft.Management/managementGroups"), + + /** Enum value /subscriptions. */ + SUBSCRIPTIONS("/subscriptions"); + + /** The actual serialized value for a ManagementGroupChildType instance. */ + private final String value; + + ManagementGroupChildType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ManagementGroupChildType instance. + * + * @param value the serialized value to parse. + * @return the parsed ManagementGroupChildType object, or null if unable to parse. + */ + @JsonCreator + public static ManagementGroupChildType fromString(String value) { + if (value == null) { + return null; + } + ManagementGroupChildType[] items = ManagementGroupChildType.values(); + for (ManagementGroupChildType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ManagementGroupDetails.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ManagementGroupDetails.java new file mode 100644 index 000000000000..e434dd00f54f --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ManagementGroupDetails.java @@ -0,0 +1,220 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** The details of a management group. */ +@Fluent +public final class ManagementGroupDetails { + /* + * The version number of the object. + */ + @JsonProperty(value = "version") + private Integer version; + + /* + * The date and time when this object was last updated. + */ + @JsonProperty(value = "updatedTime") + private OffsetDateTime updatedTime; + + /* + * The identity of the principal or process that updated the object. + */ + @JsonProperty(value = "updatedBy") + private String updatedBy; + + /* + * (Optional) The ID of the parent management group. + */ + @JsonProperty(value = "parent") + private ParentGroupInfo parent; + + /* + * The path from the root to the current group. + */ + @JsonProperty(value = "path") + private List path; + + /* + * The ancestors of the management group. + */ + @JsonProperty(value = "managementGroupAncestors") + private List managementGroupAncestors; + + /* + * The ancestors of the management group displayed in reversed order, from immediate parent to the root. + */ + @JsonProperty(value = "managementGroupAncestorsChain") + private List managementGroupAncestorsChain; + + /** Creates an instance of ManagementGroupDetails class. */ + public ManagementGroupDetails() { + } + + /** + * Get the version property: The version number of the object. + * + * @return the version value. + */ + public Integer version() { + return this.version; + } + + /** + * Set the version property: The version number of the object. + * + * @param version the version value to set. + * @return the ManagementGroupDetails object itself. + */ + public ManagementGroupDetails withVersion(Integer version) { + this.version = version; + return this; + } + + /** + * Get the updatedTime property: The date and time when this object was last updated. + * + * @return the updatedTime value. + */ + public OffsetDateTime updatedTime() { + return this.updatedTime; + } + + /** + * Set the updatedTime property: The date and time when this object was last updated. + * + * @param updatedTime the updatedTime value to set. + * @return the ManagementGroupDetails object itself. + */ + public ManagementGroupDetails withUpdatedTime(OffsetDateTime updatedTime) { + this.updatedTime = updatedTime; + return this; + } + + /** + * Get the updatedBy property: The identity of the principal or process that updated the object. + * + * @return the updatedBy value. + */ + public String updatedBy() { + return this.updatedBy; + } + + /** + * Set the updatedBy property: The identity of the principal or process that updated the object. + * + * @param updatedBy the updatedBy value to set. + * @return the ManagementGroupDetails object itself. + */ + public ManagementGroupDetails withUpdatedBy(String updatedBy) { + this.updatedBy = updatedBy; + return this; + } + + /** + * Get the parent property: (Optional) The ID of the parent management group. + * + * @return the parent value. + */ + public ParentGroupInfo 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 ManagementGroupDetails object itself. + */ + public ManagementGroupDetails withParent(ParentGroupInfo parent) { + this.parent = parent; + return this; + } + + /** + * Get the path property: The path from the root to the current group. + * + * @return the path value. + */ + public List path() { + return this.path; + } + + /** + * Set the path property: The path from the root to the current group. + * + * @param path the path value to set. + * @return the ManagementGroupDetails object itself. + */ + public ManagementGroupDetails withPath(List path) { + this.path = path; + return this; + } + + /** + * Get the managementGroupAncestors property: The ancestors of the management group. + * + * @return the managementGroupAncestors value. + */ + public List managementGroupAncestors() { + return this.managementGroupAncestors; + } + + /** + * Set the managementGroupAncestors property: The ancestors of the management group. + * + * @param managementGroupAncestors the managementGroupAncestors value to set. + * @return the ManagementGroupDetails object itself. + */ + public ManagementGroupDetails withManagementGroupAncestors(List managementGroupAncestors) { + this.managementGroupAncestors = managementGroupAncestors; + return this; + } + + /** + * Get the managementGroupAncestorsChain property: The ancestors of the management group displayed in reversed + * order, from immediate parent to the root. + * + * @return the managementGroupAncestorsChain value. + */ + public List managementGroupAncestorsChain() { + return this.managementGroupAncestorsChain; + } + + /** + * Set the managementGroupAncestorsChain property: The ancestors of the management group displayed in reversed + * order, from immediate parent to the root. + * + * @param managementGroupAncestorsChain the managementGroupAncestorsChain value to set. + * @return the ManagementGroupDetails object itself. + */ + public ManagementGroupDetails withManagementGroupAncestorsChain( + List managementGroupAncestorsChain) { + this.managementGroupAncestorsChain = managementGroupAncestorsChain; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (parent() != null) { + parent().validate(); + } + if (path() != null) { + path().forEach(e -> e.validate()); + } + if (managementGroupAncestorsChain() != null) { + managementGroupAncestorsChain().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ManagementGroupExpandType.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ManagementGroupExpandType.java new file mode 100644 index 000000000000..f32ba38f3155 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ManagementGroupExpandType.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.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ManagementGroupExpandType. */ +public final class ManagementGroupExpandType extends ExpandableStringEnum { + /** Static value children for ManagementGroupExpandType. */ + public static final ManagementGroupExpandType CHILDREN = fromString("children"); + + /** Static value path for ManagementGroupExpandType. */ + public static final ManagementGroupExpandType PATH = fromString("path"); + + /** Static value ancestors for ManagementGroupExpandType. */ + public static final ManagementGroupExpandType ANCESTORS = fromString("ancestors"); + + /** + * Creates a new instance of ManagementGroupExpandType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ManagementGroupExpandType() { + } + + /** + * Creates or finds a ManagementGroupExpandType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ManagementGroupExpandType. + */ + @JsonCreator + public static ManagementGroupExpandType fromString(String name) { + return fromString(name, ManagementGroupExpandType.class); + } + + /** + * Gets known ManagementGroupExpandType values. + * + * @return known ManagementGroupExpandType values. + */ + public static Collection values() { + return values(ManagementGroupExpandType.class); + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ManagementGroupInfo.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ManagementGroupInfo.java new file mode 100644 index 000000000000..6ab2dd37b6b7 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ManagementGroupInfo.java @@ -0,0 +1,54 @@ +// 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.models; + +import com.azure.resourcemanager.managementgroups.fluent.models.ManagementGroupInfoInner; + +/** An immutable client-side representation of ManagementGroupInfo. */ +public interface ManagementGroupInfo { + /** + * Gets 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. + */ + String id(); + + /** + * Gets the type property: The type of the resource. For example, Microsoft.Management/managementGroups. + * + * @return the type value. + */ + String type(); + + /** + * Gets the name property: The name of the management group. For example, 00000000-0000-0000-0000-000000000000. + * + * @return the name value. + */ + String name(); + + /** + * Gets the tenantId property: The AAD Tenant ID associated with the management group. For example, + * 00000000-0000-0000-0000-000000000000. + * + * @return the tenantId value. + */ + String tenantId(); + + /** + * Gets the displayName property: The friendly name of the management group. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the inner com.azure.resourcemanager.managementgroups.fluent.models.ManagementGroupInfoInner object. + * + * @return the inner object. + */ + ManagementGroupInfoInner innerModel(); +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ManagementGroupListResult.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ManagementGroupListResult.java new file mode 100644 index 000000000000..cf683b4f868a --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ManagementGroupListResult.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.managementgroups.fluent.models.ManagementGroupInfoInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes the result of the request to list management groups. */ +@Fluent +public final class ManagementGroupListResult { + /* + * The list of management groups. + */ + @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; + + /** Creates an instance of ManagementGroupListResult class. */ + public ManagementGroupListResult() { + } + + /** + * Get the value property: The list of management groups. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of management groups. + * + * @param value the value value to set. + * @return the ManagementGroupListResult object itself. + */ + public ManagementGroupListResult 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/models/ManagementGroupPathElement.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ManagementGroupPathElement.java new file mode 100644 index 000000000000..d265cc02830f --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ManagementGroupPathElement.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A path element of a management group ancestors. */ +@Fluent +public final class ManagementGroupPathElement { + /* + * The name of the group. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The friendly name of the group. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** Creates an instance of ManagementGroupPathElement class. */ + public ManagementGroupPathElement() { + } + + /** + * Get the name property: The name of the group. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the group. + * + * @param name the name value to set. + * @return the ManagementGroupPathElement object itself. + */ + public ManagementGroupPathElement withName(String name) { + this.name = name; + return this; + } + + /** + * Get the displayName property: The friendly name of the group. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The friendly name of the group. + * + * @param displayName the displayName value to set. + * @return the ManagementGroupPathElement object itself. + */ + public ManagementGroupPathElement 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/models/ManagementGroupSubscriptions.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ManagementGroupSubscriptions.java new file mode 100644 index 000000000000..3cd89d720760 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ManagementGroupSubscriptions.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ManagementGroupSubscriptions. */ +public interface ManagementGroupSubscriptions { + /** + * Associates existing subscription with the management group. + * + * @param groupId Management Group ID. + * @param subscriptionId Subscription ID. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of subscription under management group along with {@link Response}. + */ + Response createWithResponse( + String groupId, String subscriptionId, String cacheControl, Context context); + + /** + * 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. + */ + SubscriptionUnderManagementGroup create(String groupId, String subscriptionId); + + /** + * De-associates subscription from the management group. + * + * @param groupId Management Group ID. + * @param subscriptionId Subscription ID. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse(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. + */ + void delete(String groupId, String subscriptionId); + + /** + * Retrieves details about given subscription which is associated with the management group. + * + * @param groupId Management Group ID. + * @param subscriptionId Subscription ID. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of subscription under management group along with {@link Response}. + */ + Response getSubscriptionWithResponse( + 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. + */ + SubscriptionUnderManagementGroup getSubscription(String groupId, String subscriptionId); + + /** + * Retrieves details about all subscriptions which are associated with the management group. + * + * @param groupId Management Group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of all subscriptions under management group as paginated response with {@link PagedIterable}. + */ + PagedIterable getSubscriptionsUnderManagementGroup(String groupId); + + /** + * Retrieves details about all subscriptions which are associated with the management group. + * + * @param groupId Management Group ID. + * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a + * previous response contains a nextLink element, the value of the nextLink element will include a token + * parameter that specifies a starting point to use for subsequent calls. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of all subscriptions under management group as paginated response with {@link PagedIterable}. + */ + PagedIterable getSubscriptionsUnderManagementGroup( + String groupId, String skiptoken, Context context); +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ManagementGroups.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ManagementGroups.java new file mode 100644 index 000000000000..f9235526cb5c --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ManagementGroups.java @@ -0,0 +1,190 @@ +// 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.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ManagementGroups. */ +public interface ManagementGroups { + /** + * List management groups for the authenticated user. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to list management groups as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list(); + + /** + * List management groups for the authenticated user. + * + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a + * previous response contains a nextLink element, the value of the nextLink element will include a token + * parameter that specifies a starting point to use for subsequent calls. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to list management groups as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list(String cacheControl, String skiptoken, Context context); + + /** + * Get the details of the management group. + * + * @param groupId Management Group ID. + * @param expand The $expand=children query string parameter allows clients to request inclusion of children in the + * response payload. $expand=path includes the path from the root group to the current group. $expand=ancestors + * includes the ancestor Ids of the current group. + * @param recurse The $recurse=true query string parameter allows clients to request inclusion of entire hierarchy + * in the response payload. Note that $expand=children must be passed up if $recurse is set to true. + * @param filter A filter which allows the exclusion of subscriptions from results (i.e. '$filter=children.childType + * ne Subscription'). + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the management group along with {@link Response}. + */ + Response getWithResponse( + String groupId, + ManagementGroupExpandType expand, + Boolean recurse, + String filter, + String cacheControl, + 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. + */ + ManagementGroup get(String groupId); + + /** + * 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. + */ + ManagementGroup 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. + */ + ManagementGroup createOrUpdate( + String groupId, + CreateManagementGroupRequest createManagementGroupRequest, + String cacheControl, + Context context); + + /** + * Update a management group. + * + * @param groupId Management Group ID. + * @param patchGroupRequest Management group patch parameters. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the management group details along with {@link Response}. + */ + Response updateWithResponse( + String groupId, PatchManagementGroupRequest patchGroupRequest, 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. + */ + ManagementGroup update(String groupId, PatchManagementGroupRequest patchGroupRequest); + + /** + * 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. + */ + AzureAsyncOperationResults deleteByResourceGroup(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. + */ + AzureAsyncOperationResults delete(String groupId, String cacheControl, Context context); + + /** + * List all entities that descend from a management group. + * + * @param groupId Management Group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to view descendants as paginated response with {@link PagedIterable}. + */ + PagedIterable getDescendants(String groupId); + + /** + * List all entities that descend from a management group. + * + * @param groupId Management Group ID. + * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a + * previous response contains a nextLink element, the value of the nextLink element will include a token + * parameter that specifies a starting point to use for subsequent calls. + * @param top Number of elements to return when retrieving results. Passing this in will override $skipToken. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to view descendants as paginated response with {@link PagedIterable}. + */ + 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/models/Operation.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/Operation.java new file mode 100644 index 000000000000..35e4f70c1b68 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/Operation.java @@ -0,0 +1,31 @@ +// 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.models; + +import com.azure.resourcemanager.managementgroups.fluent.models.OperationInner; + +/** An immutable client-side representation of Operation. */ +public interface Operation { + /** + * Gets the name property: Operation name: {provider}/{resource}/{operation}. + * + * @return the name value. + */ + String name(); + + /** + * Gets the display property: The object that represents the operation. + * + * @return the display value. + */ + OperationDisplayProperties display(); + + /** + * Gets the inner com.azure.resourcemanager.managementgroups.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/OperationDisplayProperties.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/OperationDisplayProperties.java new file mode 100644 index 000000000000..26db7871c639 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/OperationDisplayProperties.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.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The object that represents the operation. */ +@Immutable +public final class OperationDisplayProperties { + /* + * The name of the provider. + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /* + * The resource on which the operation is performed. + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /* + * The operation that can be performed. + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /* + * Operation description. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** Creates an instance of OperationDisplayProperties class. */ + public OperationDisplayProperties() { + } + + /** + * Get the provider property: The name of the provider. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource property: The resource on which the operation is performed. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Get the operation property: The operation that can be performed. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the description property: Operation description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * 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/models/OperationListResult.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/OperationListResult.java new file mode 100644 index 000000000000..fde9e9ac73a3 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/OperationListResult.java @@ -0,0 +1,59 @@ +// 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.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.managementgroups.fluent.models.OperationInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes the result of the request to list Microsoft.Management operations. */ +@Immutable +public final class OperationListResult { + /* + * List of operations supported by the Microsoft.Management resource provider. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * URL to get the next set of operation list results if there are any. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of OperationListResult class. */ + public OperationListResult() { + } + + /** + * Get the value property: List of operations supported by the Microsoft.Management resource provider. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: URL to get the next set of operation list results if there are any. + * + * @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/models/Operations.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/Operations.java new file mode 100644 index 000000000000..6101c48a99f0 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/Operations.java @@ -0,0 +1,33 @@ +// 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.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +public interface Operations { + /** + * Lists all of the available Management REST API operations. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to list Microsoft.Management operations as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Lists all of the available Management REST API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to list Microsoft.Management operations as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(Context context); +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ParentGroupBagInfo.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ParentGroupBagInfo.java new file mode 100644 index 000000000000..a53761eaa5dd --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ParentGroupBagInfo.java @@ -0,0 +1,107 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The ID, name and displayName of the parent management group. */ +@Fluent +public final class ParentGroupBagInfo { + /* + * The fully qualified ID for the parent management group. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + */ + @JsonProperty(value = "id") + private String id; + + /* + * The name of the parent management group. For example, 00000000-0000-0000-0000-000000000000 + */ + @JsonProperty(value = "name") + private String name; + + /* + * The friendly name of the parent management group. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** Creates an instance of ParentGroupBagInfo class. */ + public ParentGroupBagInfo() { + } + + /** + * Get the id property: The fully qualified ID for the parent management group. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The fully qualified ID for the parent management group. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + * + * @param id the id value to set. + * @return the ParentGroupBagInfo object itself. + */ + public ParentGroupBagInfo withId(String id) { + this.id = id; + return this; + } + + /** + * Get the name property: The name of the parent management group. For example, + * 00000000-0000-0000-0000-000000000000. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the parent management group. For example, + * 00000000-0000-0000-0000-000000000000. + * + * @param name the name value to set. + * @return the ParentGroupBagInfo object itself. + */ + public ParentGroupBagInfo withName(String name) { + this.name = name; + return this; + } + + /** + * Get the displayName property: The friendly name of the parent management group. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The friendly name of the parent management group. + * + * @param displayName the displayName value to set. + * @return the ParentGroupBagInfo object itself. + */ + public ParentGroupBagInfo 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/models/ParentGroupInfo.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ParentGroupInfo.java new file mode 100644 index 000000000000..e9544969ef95 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ParentGroupInfo.java @@ -0,0 +1,105 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** (Optional) The ID of the parent management group. */ +@Fluent +public final class ParentGroupInfo { + /* + * The fully qualified ID for the parent management group. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + */ + @JsonProperty(value = "id") + private String id; + + /* + * The name of the parent management group + */ + @JsonProperty(value = "name") + private String name; + + /* + * The friendly name of the parent management group. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** Creates an instance of ParentGroupInfo class. */ + public ParentGroupInfo() { + } + + /** + * Get the id property: The fully qualified ID for the parent management group. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The fully qualified ID for the parent management group. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + * + * @param id the id value to set. + * @return the ParentGroupInfo object itself. + */ + public ParentGroupInfo withId(String id) { + this.id = id; + return this; + } + + /** + * Get the name property: The name of the parent management group. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the parent management group. + * + * @param name the name value to set. + * @return the ParentGroupInfo object itself. + */ + public ParentGroupInfo withName(String name) { + this.name = name; + return this; + } + + /** + * Get the displayName property: The friendly name of the parent management group. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The friendly name of the parent management group. + * + * @param displayName the displayName value to set. + * @return the ParentGroupInfo object itself. + */ + public ParentGroupInfo 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/models/PatchManagementGroupRequest.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/PatchManagementGroupRequest.java new file mode 100644 index 000000000000..344db7b251ae --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/PatchManagementGroupRequest.java @@ -0,0 +1,79 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Management group patch parameters. */ +@Fluent +public final class PatchManagementGroupRequest { + /* + * The friendly name of the management group. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /* + * (Optional) The fully qualified ID for the parent management group. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + */ + @JsonProperty(value = "parentGroupId") + private String parentGroupId; + + /** Creates an instance of PatchManagementGroupRequest class. */ + public PatchManagementGroupRequest() { + } + + /** + * 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 PatchManagementGroupRequest object itself. + */ + public PatchManagementGroupRequest withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the parentGroupId property: (Optional) The fully qualified ID for the parent management group. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + * + * @return the parentGroupId value. + */ + public String parentGroupId() { + return this.parentGroupId; + } + + /** + * Set the parentGroupId property: (Optional) The fully qualified ID for the parent management group. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + * + * @param parentGroupId the parentGroupId value to set. + * @return the PatchManagementGroupRequest object itself. + */ + public PatchManagementGroupRequest withParentGroupId(String parentGroupId) { + this.parentGroupId = parentGroupId; + 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/models/Permissions.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/Permissions.java new file mode 100644 index 000000000000..bfe8dc9eaafe --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/Permissions.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.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** The users specific permissions to this item. */ +public enum Permissions { + /** Enum value noaccess. */ + NOACCESS("noaccess"), + + /** Enum value view. */ + VIEW("view"), + + /** Enum value edit. */ + EDIT("edit"), + + /** Enum value delete. */ + DELETE("delete"); + + /** The actual serialized value for a Permissions instance. */ + private final String value; + + Permissions(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a Permissions instance. + * + * @param value the serialized value to parse. + * @return the parsed Permissions object, or null if unable to parse. + */ + @JsonCreator + public static Permissions fromString(String value) { + if (value == null) { + return null; + } + Permissions[] items = Permissions.values(); + for (Permissions item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/Reason.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/Reason.java new file mode 100644 index 000000000000..139d74482a1f --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/Reason.java @@ -0,0 +1,55 @@ +// 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.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * 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. + */ +public enum Reason { + /** Enum value Invalid. */ + INVALID("Invalid"), + + /** Enum value AlreadyExists. */ + ALREADY_EXISTS("AlreadyExists"); + + /** The actual serialized value for a Reason instance. */ + private final String value; + + Reason(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a Reason instance. + * + * @param value the serialized value to parse. + * @return the parsed Reason object, or null if unable to parse. + */ + @JsonCreator + public static Reason fromString(String value) { + if (value == null) { + return null; + } + Reason[] items = Reason.values(); + for (Reason item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ResourceProviders.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ResourceProviders.java new file mode 100644 index 000000000000..a1460fa985a9 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ResourceProviders.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ResourceProviders. */ +public interface ResourceProviders { + /** + * Checks if the specified management group name is valid and unique. + * + * @param checkNameAvailabilityRequest Management group name availability check parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to check management group name availability along with {@link + * Response}. + */ + Response checkNameAvailabilityWithResponse( + CheckNameAvailabilityRequest checkNameAvailabilityRequest, Context context); + + /** + * 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. + */ + CheckNameAvailabilityResult checkNameAvailability(CheckNameAvailabilityRequest checkNameAvailabilityRequest); + + /** + * Starts backfilling subscriptions for the Tenant. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the tenant backfill status along with {@link Response}. + */ + Response startTenantBackfillWithResponse(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. + */ + TenantBackfillStatusResult startTenantBackfill(); + + /** + * Gets tenant backfill status. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return tenant backfill status along with {@link Response}. + */ + Response tenantBackfillStatusWithResponse(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. + */ + TenantBackfillStatusResult tenantBackfillStatus(); +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/Status.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/Status.java new file mode 100644 index 000000000000..8fbfc5a4af75 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/Status.java @@ -0,0 +1,63 @@ +// 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.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** The status of the Tenant Backfill. */ +public enum Status { + /** Enum value NotStarted. */ + NOT_STARTED("NotStarted"), + + /** Enum value NotStartedButGroupsExist. */ + NOT_STARTED_BUT_GROUPS_EXIST("NotStartedButGroupsExist"), + + /** Enum value Started. */ + STARTED("Started"), + + /** Enum value Failed. */ + FAILED("Failed"), + + /** Enum value Cancelled. */ + CANCELLED("Cancelled"), + + /** Enum value Completed. */ + COMPLETED("Completed"); + + /** The actual serialized value for a Status instance. */ + private final String value; + + Status(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a Status instance. + * + * @param value the serialized value to parse. + * @return the parsed Status object, or null if unable to parse. + */ + @JsonCreator + public static Status fromString(String value) { + if (value == null) { + return null; + } + Status[] items = Status.values(); + for (Status item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/SubscriptionUnderManagementGroup.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/SubscriptionUnderManagementGroup.java new file mode 100644 index 000000000000..ecb1844cca0f --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/SubscriptionUnderManagementGroup.java @@ -0,0 +1,68 @@ +// 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.models; + +import com.azure.resourcemanager.managementgroups.fluent.models.SubscriptionUnderManagementGroupInner; + +/** An immutable client-side representation of SubscriptionUnderManagementGroup. */ +public interface SubscriptionUnderManagementGroup { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the tenant property: The AAD Tenant ID associated with the subscription. For example, + * 00000000-0000-0000-0000-000000000000. + * + * @return the tenant value. + */ + String tenant(); + + /** + * Gets the displayName property: The friendly name of the subscription. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the parent property: The ID, name and displayName of the parent management group. + * + * @return the parent value. + */ + ParentGroupBagInfo parent(); + + /** + * Gets the state property: The state of the subscription. + * + * @return the state value. + */ + String state(); + + /** + * Gets the inner com.azure.resourcemanager.managementgroups.fluent.models.SubscriptionUnderManagementGroupInner + * object. + * + * @return the inner object. + */ + SubscriptionUnderManagementGroupInner innerModel(); +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/TenantBackfillStatusResult.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/TenantBackfillStatusResult.java new file mode 100644 index 000000000000..280fdbe7ff7d --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/TenantBackfillStatusResult.java @@ -0,0 +1,32 @@ +// 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.models; + +import com.azure.resourcemanager.managementgroups.fluent.models.TenantBackfillStatusResultInner; + +/** An immutable client-side representation of TenantBackfillStatusResult. */ +public interface TenantBackfillStatusResult { + /** + * Gets the tenantId property: The AAD Tenant ID associated with the management group. For example, + * 00000000-0000-0000-0000-000000000000. + * + * @return the tenantId value. + */ + String tenantId(); + + /** + * Gets the status property: The status of the Tenant Backfill. + * + * @return the status value. + */ + Status status(); + + /** + * Gets the inner com.azure.resourcemanager.managementgroups.fluent.models.TenantBackfillStatusResultInner object. + * + * @return the inner object. + */ + TenantBackfillStatusResultInner innerModel(); +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/Type.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/Type.java new file mode 100644 index 000000000000..a33897179ea2 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/Type.java @@ -0,0 +1,48 @@ +// 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.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** fully qualified resource type which includes provider namespace. */ +public enum Type { + /** Enum value Microsoft.Management/managementGroups. */ + MICROSOFT_MANAGEMENT_MANAGEMENT_GROUPS("Microsoft.Management/managementGroups"); + + /** The actual serialized value for a Type instance. */ + private final String value; + + Type(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a Type instance. + * + * @param value the serialized value to parse. + * @return the parsed Type object, or null if unable to parse. + */ + @JsonCreator + public static Type fromString(String value) { + if (value == null) { + return null; + } + Type[] items = Type.values(); + for (Type item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/package-info.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/package-info.java new file mode 100644 index 000000000000..ac239995b734 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/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 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.models; diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/package-info.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/package-info.java new file mode 100644 index 000000000000..8d63ac46fbcf --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/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 classes 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; diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/module-info.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/module-info.java new file mode 100644 index 000000000000..a17fcd493751 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/module-info.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.resourcemanager.managementgroups { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.managementgroups; + exports com.azure.resourcemanager.managementgroups.fluent; + exports com.azure.resourcemanager.managementgroups.fluent.models; + exports com.azure.resourcemanager.managementgroups.models; + + opens com.azure.resourcemanager.managementgroups.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.managementgroups.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/EntitiesListSamples.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/EntitiesListSamples.java new file mode 100644 index 000000000000..d21c7f257cd2 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/EntitiesListSamples.java @@ -0,0 +1,20 @@ +// 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.generated; + +/** Samples for Entities List. */ +public final class EntitiesListSamples { + /* + * x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/GetEntities.json + */ + /** + * Sample code: GetEntities. + * + * @param manager Entry point to ManagementGroupsManager. + */ + public static void getEntities(com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager) { + manager.entities().list(null, null, null, null, null, null, null, null, null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/HierarchySettingsOperationCreateOrUpdateSamples.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/HierarchySettingsOperationCreateOrUpdateSamples.java new file mode 100644 index 000000000000..def58c9f1497 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/HierarchySettingsOperationCreateOrUpdateSamples.java @@ -0,0 +1,29 @@ +// 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.generated; + +import com.azure.resourcemanager.managementgroups.models.CreateOrUpdateSettingsRequest; + +/** Samples for HierarchySettingsOperation CreateOrUpdate. */ +public final class HierarchySettingsOperationCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/PutHierarchySettings.json + */ + /** + * Sample code: GetGroupSettings. + * + * @param manager Entry point to ManagementGroupsManager. + */ + public static void getGroupSettings(com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager) { + manager + .hierarchySettingsOperations() + .createOrUpdateWithResponse( + "root", + new CreateOrUpdateSettingsRequest() + .withRequireAuthorizationForGroupCreation(true) + .withDefaultManagementGroup("/providers/Microsoft.Management/managementGroups/DefaultGroup"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/HierarchySettingsOperationDeleteSamples.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/HierarchySettingsOperationDeleteSamples.java new file mode 100644 index 000000000000..616e0decbc25 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/HierarchySettingsOperationDeleteSamples.java @@ -0,0 +1,20 @@ +// 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.generated; + +/** Samples for HierarchySettingsOperation Delete. */ +public final class HierarchySettingsOperationDeleteSamples { + /* + * x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/DeleteHierarchySettings.json + */ + /** + * Sample code: GetGroupSettings. + * + * @param manager Entry point to ManagementGroupsManager. + */ + public static void getGroupSettings(com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager) { + manager.hierarchySettingsOperations().deleteWithResponse("root", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/HierarchySettingsOperationGetSamples.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/HierarchySettingsOperationGetSamples.java new file mode 100644 index 000000000000..b64714c34f05 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/HierarchySettingsOperationGetSamples.java @@ -0,0 +1,20 @@ +// 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.generated; + +/** Samples for HierarchySettingsOperation Get. */ +public final class HierarchySettingsOperationGetSamples { + /* + * x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/GetHierarchySettings.json + */ + /** + * Sample code: GetGroupSettings. + * + * @param manager Entry point to ManagementGroupsManager. + */ + public static void getGroupSettings(com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager) { + manager.hierarchySettingsOperations().getWithResponse("root", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/HierarchySettingsOperationListSamples.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/HierarchySettingsOperationListSamples.java new file mode 100644 index 000000000000..810b22dbb49f --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/HierarchySettingsOperationListSamples.java @@ -0,0 +1,20 @@ +// 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.generated; + +/** Samples for HierarchySettingsOperation List. */ +public final class HierarchySettingsOperationListSamples { + /* + * x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/ListHierarchySettings.json + */ + /** + * Sample code: ListGroupSettings. + * + * @param manager Entry point to ManagementGroupsManager. + */ + public static void listGroupSettings(com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager) { + manager.hierarchySettingsOperations().listWithResponse("root", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/HierarchySettingsOperationUpdateSamples.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/HierarchySettingsOperationUpdateSamples.java new file mode 100644 index 000000000000..f2f501e30113 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/HierarchySettingsOperationUpdateSamples.java @@ -0,0 +1,29 @@ +// 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.generated; + +import com.azure.resourcemanager.managementgroups.models.CreateOrUpdateSettingsRequest; + +/** Samples for HierarchySettingsOperation Update. */ +public final class HierarchySettingsOperationUpdateSamples { + /* + * x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/PatchHierarchySettings.json + */ + /** + * Sample code: GetGroupSettings. + * + * @param manager Entry point to ManagementGroupsManager. + */ + public static void getGroupSettings(com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager) { + manager + .hierarchySettingsOperations() + .updateWithResponse( + "root", + new CreateOrUpdateSettingsRequest() + .withRequireAuthorizationForGroupCreation(true) + .withDefaultManagementGroup("/providers/Microsoft.Management/managementGroups/DefaultGroup"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ManagementGroupSubscriptionsCreateSamples.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ManagementGroupSubscriptionsCreateSamples.java new file mode 100644 index 000000000000..2b138c85f0fc --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ManagementGroupSubscriptionsCreateSamples.java @@ -0,0 +1,24 @@ +// 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.generated; + +/** Samples for ManagementGroupSubscriptions Create. */ +public final class ManagementGroupSubscriptionsCreateSamples { + /* + * x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/AddManagementGroupSubscription.json + */ + /** + * Sample code: AddSubscriptionToManagementGroup. + * + * @param manager Entry point to ManagementGroupsManager. + */ + public static void addSubscriptionToManagementGroup( + com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager) { + manager + .managementGroupSubscriptions() + .createWithResponse( + "Group", "728bcbe4-8d56-4510-86c2-4921b8beefbc", "no-cache", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ManagementGroupSubscriptionsDeleteSamples.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ManagementGroupSubscriptionsDeleteSamples.java new file mode 100644 index 000000000000..664c265a9d66 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ManagementGroupSubscriptionsDeleteSamples.java @@ -0,0 +1,24 @@ +// 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.generated; + +/** Samples for ManagementGroupSubscriptions Delete. */ +public final class ManagementGroupSubscriptionsDeleteSamples { + /* + * x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/RemoveManagementGroupSubscription.json + */ + /** + * Sample code: DeleteSubscriptionFromManagementGroup. + * + * @param manager Entry point to ManagementGroupsManager. + */ + public static void deleteSubscriptionFromManagementGroup( + com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager) { + manager + .managementGroupSubscriptions() + .deleteWithResponse( + "Group", "728bcbe4-8d56-4510-86c2-4921b8beefbc", "no-cache", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ManagementGroupSubscriptionsGetSubscriptionSamples.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ManagementGroupSubscriptionsGetSubscriptionSamples.java new file mode 100644 index 000000000000..ae0a8150d7e2 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ManagementGroupSubscriptionsGetSubscriptionSamples.java @@ -0,0 +1,24 @@ +// 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.generated; + +/** Samples for ManagementGroupSubscriptions GetSubscription. */ +public final class ManagementGroupSubscriptionsGetSubscriptionSamples { + /* + * x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/GetSubscriptionFromManagementGroup.json + */ + /** + * Sample code: GetSubscriptionFromManagementGroup. + * + * @param manager Entry point to ManagementGroupsManager. + */ + public static void getSubscriptionFromManagementGroup( + com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager) { + manager + .managementGroupSubscriptions() + .getSubscriptionWithResponse( + "Group", "728bcbe4-8d56-4510-86c2-4921b8beefbc", "no-cache", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ManagementGroupSubscriptionsGetSubscriptionsUnderManagementGroupSamples.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ManagementGroupSubscriptionsGetSubscriptionsUnderManagementGroupSamples.java new file mode 100644 index 000000000000..2cf8e0a25f34 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ManagementGroupSubscriptionsGetSubscriptionsUnderManagementGroupSamples.java @@ -0,0 +1,23 @@ +// 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.generated; + +/** Samples for ManagementGroupSubscriptions GetSubscriptionsUnderManagementGroup. */ +public final class ManagementGroupSubscriptionsGetSubscriptionsUnderManagementGroupSamples { + /* + * x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/GetAllSubscriptionsFromManagementGroup.json + */ + /** + * Sample code: GetAllSubscriptionsFromManagementGroup. + * + * @param manager Entry point to ManagementGroupsManager. + */ + public static void getAllSubscriptionsFromManagementGroup( + com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager) { + manager + .managementGroupSubscriptions() + .getSubscriptionsUnderManagementGroup("Group", null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ManagementGroupsCreateOrUpdateSamples.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ManagementGroupsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..54a47c16fba0 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ManagementGroupsCreateOrUpdateSamples.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.generated; + +import com.azure.resourcemanager.managementgroups.models.CreateManagementGroupDetails; +import com.azure.resourcemanager.managementgroups.models.CreateManagementGroupRequest; +import com.azure.resourcemanager.managementgroups.models.CreateParentGroupInfo; + +/** Samples for ManagementGroups CreateOrUpdate. */ +public final class ManagementGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/PutManagementGroup.json + */ + /** + * Sample code: PutManagementGroup. + * + * @param manager Entry point to ManagementGroupsManager. + */ + public static void putManagementGroup(com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager) { + manager + .managementGroups() + .createOrUpdate( + "ChildGroup", + new CreateManagementGroupRequest() + .withDisplayName("ChildGroup") + .withDetails( + new CreateManagementGroupDetails() + .withParent( + new CreateParentGroupInfo() + .withId("/providers/Microsoft.Management/managementGroups/RootGroup"))), + "no-cache", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ManagementGroupsDeleteSamples.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ManagementGroupsDeleteSamples.java new file mode 100644 index 000000000000..2f43e87eabef --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ManagementGroupsDeleteSamples.java @@ -0,0 +1,21 @@ +// 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.generated; + +/** Samples for ManagementGroups Delete. */ +public final class ManagementGroupsDeleteSamples { + /* + * x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/DeleteManagementGroup.json + */ + /** + * Sample code: DeleteManagementGroup. + * + * @param manager Entry point to ManagementGroupsManager. + */ + public static void deleteManagementGroup( + com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager) { + manager.managementGroups().delete("GroupToDelete", "no-cache", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ManagementGroupsGetDescendantsSamples.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ManagementGroupsGetDescendantsSamples.java new file mode 100644 index 000000000000..7f139823ea08 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ManagementGroupsGetDescendantsSamples.java @@ -0,0 +1,22 @@ +// 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.generated; + +/** Samples for ManagementGroups GetDescendants. */ +public final class ManagementGroupsGetDescendantsSamples { + /* + * x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/GetDescendants.json + */ + /** + * Sample code: GetDescendants. + * + * @param manager Entry point to ManagementGroupsManager. + */ + public static void getDescendants(com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager) { + manager + .managementGroups() + .getDescendants("20000000-0000-0000-0000-000000000000", null, null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ManagementGroupsGetSamples.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ManagementGroupsGetSamples.java new file mode 100644 index 000000000000..f2db46921c88 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ManagementGroupsGetSamples.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.generated; + +import com.azure.resourcemanager.managementgroups.models.ManagementGroupExpandType; + +/** Samples for ManagementGroups Get. */ +public final class ManagementGroupsGetSamples { + /* + * x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/GetManagementGroupWithPath.json + */ + /** + * Sample code: GetManagementGroupWithPath. + * + * @param manager Entry point to ManagementGroupsManager. + */ + public static void getManagementGroupWithPath( + com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager) { + manager + .managementGroups() + .getWithResponse( + "20000000-0001-0000-0000-000000000000", + ManagementGroupExpandType.PATH, + null, + null, + "no-cache", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/GetManagementGroupWithAncestors.json + */ + /** + * Sample code: GetManagementGroupWithAncestors. + * + * @param manager Entry point to ManagementGroupsManager. + */ + public static void getManagementGroupWithAncestors( + com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager) { + manager + .managementGroups() + .getWithResponse( + "20000000-0001-0000-0000-00000000000", + ManagementGroupExpandType.ANCESTORS, + null, + null, + "no-cache", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/GetManagementGroupWithExpand.json + */ + /** + * Sample code: GetManagementGroupWithExpand. + * + * @param manager Entry point to ManagementGroupsManager. + */ + public static void getManagementGroupWithExpand( + com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager) { + manager + .managementGroups() + .getWithResponse( + "20000000-0001-0000-0000-000000000000", + ManagementGroupExpandType.CHILDREN, + null, + null, + "no-cache", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/GetManagementGroup.json + */ + /** + * Sample code: GetManagementGroup. + * + * @param manager Entry point to ManagementGroupsManager. + */ + public static void getManagementGroup(com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager) { + manager + .managementGroups() + .getWithResponse( + "20000000-0001-0000-0000-000000000000", null, null, null, "no-cache", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/GetManagementGroupWithExpandAndRecurse.json + */ + /** + * Sample code: GetManagementGroupsWithExpandAndRecurse. + * + * @param manager Entry point to ManagementGroupsManager. + */ + public static void getManagementGroupsWithExpandAndRecurse( + com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager) { + manager + .managementGroups() + .getWithResponse( + "20000000-0001-0000-0000-000000000000", + ManagementGroupExpandType.CHILDREN, + true, + null, + "no-cache", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ManagementGroupsListSamples.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ManagementGroupsListSamples.java new file mode 100644 index 000000000000..b2ef26ad6fdf --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ManagementGroupsListSamples.java @@ -0,0 +1,21 @@ +// 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.generated; + +/** Samples for ManagementGroups List. */ +public final class ManagementGroupsListSamples { + /* + * x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/ListManagementGroups.json + */ + /** + * Sample code: ListManagementGroups. + * + * @param manager Entry point to ManagementGroupsManager. + */ + public static void listManagementGroups( + com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager) { + manager.managementGroups().list("no-cache", null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ManagementGroupsUpdateSamples.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ManagementGroupsUpdateSamples.java new file mode 100644 index 000000000000..40cd6731c67b --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ManagementGroupsUpdateSamples.java @@ -0,0 +1,31 @@ +// 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.generated; + +import com.azure.resourcemanager.managementgroups.models.PatchManagementGroupRequest; + +/** Samples for ManagementGroups Update. */ +public final class ManagementGroupsUpdateSamples { + /* + * x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/PatchManagementGroup.json + */ + /** + * Sample code: PatchManagementGroup. + * + * @param manager Entry point to ManagementGroupsManager. + */ + public static void patchManagementGroup( + com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager) { + manager + .managementGroups() + .updateWithResponse( + "ChildGroup", + new PatchManagementGroupRequest() + .withDisplayName("AlternateDisplayName") + .withParentGroupId("/providers/Microsoft.Management/managementGroups/AlternateRootGroup"), + "no-cache", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/OperationsListSamples.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/OperationsListSamples.java new file mode 100644 index 000000000000..8d7fba02adcf --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/OperationsListSamples.java @@ -0,0 +1,20 @@ +// 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.generated; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/ListOperations.json + */ + /** + * Sample code: List Operations. + * + * @param manager Entry point to ManagementGroupsManager. + */ + public static void listOperations(com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ResourceProviderCheckNameAvailabilitySamples.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ResourceProviderCheckNameAvailabilitySamples.java new file mode 100644 index 000000000000..8596a979a300 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ResourceProviderCheckNameAvailabilitySamples.java @@ -0,0 +1,30 @@ +// 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.generated; + +import com.azure.resourcemanager.managementgroups.models.CheckNameAvailabilityRequest; +import com.azure.resourcemanager.managementgroups.models.Type; + +/** Samples for ResourceProvider CheckNameAvailability. */ +public final class ResourceProviderCheckNameAvailabilitySamples { + /* + * x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/CheckManagementGroupNameAvailability.json + */ + /** + * Sample code: CheckManagementGroupNameAvailability. + * + * @param manager Entry point to ManagementGroupsManager. + */ + public static void checkManagementGroupNameAvailability( + com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager) { + manager + .resourceProviders() + .checkNameAvailabilityWithResponse( + new CheckNameAvailabilityRequest() + .withName("nameTocheck") + .withType(Type.MICROSOFT_MANAGEMENT_MANAGEMENT_GROUPS), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ResourceProviderStartTenantBackfillSamples.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ResourceProviderStartTenantBackfillSamples.java new file mode 100644 index 000000000000..bae874afb136 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ResourceProviderStartTenantBackfillSamples.java @@ -0,0 +1,20 @@ +// 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.generated; + +/** Samples for ResourceProvider StartTenantBackfill. */ +public final class ResourceProviderStartTenantBackfillSamples { + /* + * x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/StartTenantBackfillRequest.json + */ + /** + * Sample code: StartTenantBackfill. + * + * @param manager Entry point to ManagementGroupsManager. + */ + public static void startTenantBackfill(com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager) { + manager.resourceProviders().startTenantBackfillWithResponse(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ResourceProviderTenantBackfillStatusSamples.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ResourceProviderTenantBackfillStatusSamples.java new file mode 100644 index 000000000000..b33ec355bc5d --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ResourceProviderTenantBackfillStatusSamples.java @@ -0,0 +1,21 @@ +// 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.generated; + +/** Samples for ResourceProvider TenantBackfillStatus. */ +public final class ResourceProviderTenantBackfillStatusSamples { + /* + * x-ms-original-file: specification/managementgroups/resource-manager/Microsoft.Management/stable/2021-04-01/examples/TenantBackfillStatusRequest.json + */ + /** + * Sample code: TenantBackfillStatus. + * + * @param manager Entry point to ManagementGroupsManager. + */ + public static void tenantBackfillStatus( + com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager) { + manager.resourceProviders().tenantBackfillStatusWithResponse(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/managementgroups/ci.yml b/sdk/managementgroups/ci.yml new file mode 100644 index 000000000000..c630aa1f9d8e --- /dev/null +++ b/sdk/managementgroups/ci.yml @@ -0,0 +1,47 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/managementgroups/ci.yml + - sdk/managementgroups/azure-resourcemanager-managementgroups/ + exclude: + - sdk/managementgroups/pom.xml + - sdk/managementgroups/azure-resourcemanager-managementgroups/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/managementgroups/ci.yml + - sdk/managementgroups/azure-resourcemanager-managementgroups/ + exclude: + - sdk/managementgroups/pom.xml + - sdk/managementgroups/azure-resourcemanager-managementgroups/pom.xml + +parameters: + - name: release_azureresourcemanagermanagementgroups + displayName: azure-resourcemanager-managementgroups + type: boolean + default: false + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: managementgroups + EnableBatchRelease: true + Artifacts: + - name: azure-resourcemanager-managementgroups + groupId: com.azure.resourcemanager + safeName: azureresourcemanagermanagementgroups + releaseInBatch: ${{ parameters.release_azureresourcemanagermanagementgroups }} diff --git a/sdk/managementgroups/pom.xml b/sdk/managementgroups/pom.xml new file mode 100644 index 000000000000..e570550eec2f --- /dev/null +++ b/sdk/managementgroups/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-managementgroups-service + pom + 1.0.0 + + + azure-resourcemanager-managementgroups + +