From d286096124b0e2dc3b6e1117dd026c9957e8298c Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 9 Feb 2022 22:59:04 +0000 Subject: [PATCH] CodeGen from PR 17740 in Azure/azure-rest-api-specs Merge d19bf794cbb6f5f591e54846276b5a4cb3703273 into 9673e2239f4f8257b2e916df2d15e1ef41c5bfd1 --- eng/versioning/version_client.txt | 1 + pom.xml | 1 + .../CHANGELOG.md | 8 + .../README.md | 105 ++ .../SAMPLE.md | 610 ++++++ .../pom.xml | 58 + .../ManagementGroupsManager.java | 307 +++ .../fluent/EntitiesClient.java | 78 + .../HierarchySettingsOperationsClient.java | 150 ++ .../ManagementGroupSubscriptionsClient.java | 132 ++ .../fluent/ManagementGroupsApi.java | 81 + .../fluent/ManagementGroupsClient.java | 312 ++++ .../fluent/OperationsClient.java | 36 + .../fluent/ResourceProvidersClient.java | 87 + .../AzureAsyncOperationResultsInner.java | 156 ++ .../CheckNameAvailabilityResultInner.java | 84 + .../CreateManagementGroupProperties.java | 120 ++ .../CreateOrUpdateSettingsProperties.java | 96 + .../fluent/models/DescendantInfoInner.java | 141 ++ .../models/DescendantInfoProperties.java | 80 + .../models/EntityHierarchyItemProperties.java | 108 ++ .../fluent/models/EntityInfoInner.java | 332 ++++ .../fluent/models/EntityInfoProperties.java | 302 +++ .../fluent/models/HierarchySettingsInner.java | 127 ++ .../models/HierarchySettingsListInner.java | 70 + .../models/HierarchySettingsProperties.java | 125 ++ .../models/ManagementGroupInfoInner.java | 139 ++ .../models/ManagementGroupInfoProperties.java | 79 + .../fluent/models/ManagementGroupInner.java | 140 ++ .../models/ManagementGroupProperties.java | 140 ++ .../fluent/models/OperationInner.java | 69 + ...SubscriptionUnderManagementGroupInner.java | 138 ++ ...riptionUnderManagementGroupProperties.java | 135 ++ .../TenantBackfillStatusResultInner.java | 57 + .../fluent/models/package-info.java | 10 + .../managementgroups/fluent/package-info.java | 10 + .../AzureAsyncOperationResultsImpl.java | 53 + .../CheckNameAvailabilityResultImpl.java | 42 + .../implementation/DescendantInfoImpl.java | 50 + .../implementation/EntitiesClientImpl.java | 558 ++++++ .../implementation/EntitiesImpl.java | 61 + .../implementation/EntityInfoImpl.java | 95 + .../implementation/HierarchySettingsImpl.java | 53 + .../HierarchySettingsListImpl.java | 45 + ...HierarchySettingsOperationsClientImpl.java | 736 ++++++++ .../HierarchySettingsOperationsImpl.java | 141 ++ .../implementation/ManagementGroupImpl.java | 66 + .../ManagementGroupInfoImpl.java | 49 + ...anagementGroupSubscriptionsClientImpl.java | 882 +++++++++ .../ManagementGroupSubscriptionsImpl.java | 109 ++ .../ManagementGroupsApiBuilder.java | 129 ++ .../ManagementGroupsApiImpl.java | 348 ++++ .../ManagementGroupsClientImpl.java | 1650 +++++++++++++++++ .../implementation/ManagementGroupsImpl.java | 184 ++ .../implementation/OperationImpl.java | 37 + .../implementation/OperationsClientImpl.java | 273 +++ .../implementation/OperationsImpl.java | 47 + .../ResourceProvidersClientImpl.java | 406 ++++ .../implementation/ResourceProvidersImpl.java | 112 ++ .../SubscriptionUnderManagementGroupImpl.java | 58 + .../TenantBackfillStatusResultImpl.java | 38 + .../implementation/Utils.java | 204 ++ .../implementation/package-info.java | 10 + .../models/AzureAsyncOperationResults.java | 62 + .../models/CheckNameAvailabilityRequest.java | 76 + .../models/CheckNameAvailabilityResult.java | 44 + .../CreateManagementGroupChildInfo.java | 108 ++ .../models/CreateManagementGroupDetails.java | 99 + .../models/CreateManagementGroupRequest.java | 139 ++ .../models/CreateOrUpdateSettingsRequest.java | 103 + .../models/CreateParentGroupInfo.java | 83 + .../models/DescendantInfo.java | 55 + .../models/DescendantListResult.java | 70 + .../models/DescendantParentGroupInfo.java | 53 + .../managementgroups/models/Entities.java | 71 + .../models/EntityHierarchyItem.java | 114 ++ .../managementgroups/models/EntityInfo.java | 114 ++ .../models/EntityListResult.java | 85 + .../models/EntityParentGroupInfo.java | 53 + .../models/EntitySearchType.java | 43 + .../models/EntityViewParameterType.java | 40 + .../models/HierarchySettings.java | 66 + .../models/HierarchySettingsInfo.java | 175 ++ .../models/HierarchySettingsList.java | 32 + .../models/HierarchySettingsOperations.java | 135 ++ .../ListSubscriptionUnderManagementGroup.java | 70 + .../models/ManagementGroup.java | 68 + .../models/ManagementGroupChildInfo.java | 165 ++ .../models/ManagementGroupChildType.java | 35 + .../models/ManagementGroupDetails.java | 221 +++ .../models/ManagementGroupExpandType.java | 37 + .../models/ManagementGroupInfo.java | 54 + .../models/ManagementGroupListResult.java | 70 + .../models/ManagementGroupPathElement.java | 76 + .../models/ManagementGroupSubscriptions.java | 121 ++ .../models/ManagementGroups.java | 217 +++ ...ManagementGroupsCreateOrUpdateHeaders.java | 76 + ...anagementGroupsCreateOrUpdateResponse.java | 38 + .../models/ManagementGroupsDeleteHeaders.java | 76 + .../ManagementGroupsDeleteResponse.java | 38 + .../managementgroups/models/Operation.java | 31 + .../models/OperationDisplayProperties.java | 84 + .../models/OperationListResult.java | 60 + .../managementgroups/models/Operations.java | 31 + .../models/ParentGroupInfo.java | 105 ++ .../models/PatchManagementGroupRequest.java | 80 + .../managementgroups/models/Permissions.java | 40 + .../managementgroups/models/Reason.java | 47 + .../models/ResourceProviders.java | 76 + .../managementgroups/models/Status.java | 59 + .../SubscriptionUnderManagementGroup.java | 68 + .../models/TenantBackfillStatusResult.java | 32 + .../managementgroups/models/Type.java | 44 + .../managementgroups/models/package-info.java | 10 + .../managementgroups/package-info.java | 10 + .../src/main/java/module-info.java | 19 + .../generated/EntitiesListSamples.java | 22 + ...ettingsOperationCreateOrUpdateSamples.java | 30 + ...erarchySettingsOperationDeleteSamples.java | 22 + .../HierarchySettingsOperationGetSamples.java | 22 + ...HierarchySettingsOperationListSamples.java | 22 + ...erarchySettingsOperationUpdateSamples.java | 30 + ...gementGroupSubscriptionsCreateSamples.java | 25 + ...gementGroupSubscriptionsDeleteSamples.java | 25 + ...upSubscriptionsGetSubscriptionSamples.java | 25 + ...scriptionsUnderManagementGroupSamples.java | 23 + ...ManagementGroupsCreateOrUpdateSamples.java | 37 + .../ManagementGroupsDeleteSamples.java | 23 + ...ManagementGroupsGetDescendantsSamples.java | 22 + .../generated/ManagementGroupsGetSamples.java | 109 ++ .../ManagementGroupsListSamples.java | 23 + .../ManagementGroupsUpdateSamples.java | 32 + .../generated/OperationsListSamples.java | 22 + ...eProviderCheckNameAvailabilitySamples.java | 31 + ...rceProviderStartTenantBackfillSamples.java | 22 + ...ceProviderTenantBackfillStatusSamples.java | 23 + sdk/managementgroups/ci.yml | 39 + sdk/managementgroups/pom.xml | 53 + 138 files changed, 15720 insertions(+) create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/CHANGELOG.md create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/README.md create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/SAMPLE.md create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/pom.xml create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/ManagementGroupsManager.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/EntitiesClient.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/HierarchySettingsOperationsClient.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/ManagementGroupSubscriptionsClient.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/ManagementGroupsApi.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/ManagementGroupsClient.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/OperationsClient.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/ResourceProvidersClient.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/AzureAsyncOperationResultsInner.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/CheckNameAvailabilityResultInner.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/CreateManagementGroupProperties.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/CreateOrUpdateSettingsProperties.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/DescendantInfoInner.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/DescendantInfoProperties.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/EntityHierarchyItemProperties.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/EntityInfoInner.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/EntityInfoProperties.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/HierarchySettingsInner.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/HierarchySettingsListInner.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/HierarchySettingsProperties.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/ManagementGroupInfoInner.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/ManagementGroupInfoProperties.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/ManagementGroupInner.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/ManagementGroupProperties.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/OperationInner.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/SubscriptionUnderManagementGroupInner.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/SubscriptionUnderManagementGroupProperties.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/TenantBackfillStatusResultInner.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/package-info.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/package-info.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/AzureAsyncOperationResultsImpl.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/CheckNameAvailabilityResultImpl.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/DescendantInfoImpl.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/EntitiesClientImpl.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/EntitiesImpl.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/EntityInfoImpl.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/HierarchySettingsImpl.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/HierarchySettingsListImpl.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/HierarchySettingsOperationsClientImpl.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/HierarchySettingsOperationsImpl.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupImpl.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupInfoImpl.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupSubscriptionsClientImpl.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupSubscriptionsImpl.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupsApiBuilder.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupsApiImpl.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupsClientImpl.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupsImpl.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/OperationImpl.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/OperationsClientImpl.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/OperationsImpl.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ResourceProvidersClientImpl.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ResourceProvidersImpl.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/SubscriptionUnderManagementGroupImpl.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/TenantBackfillStatusResultImpl.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/Utils.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/package-info.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/AzureAsyncOperationResults.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/CheckNameAvailabilityRequest.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/CheckNameAvailabilityResult.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/CreateManagementGroupChildInfo.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/CreateManagementGroupDetails.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/CreateManagementGroupRequest.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/CreateOrUpdateSettingsRequest.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/CreateParentGroupInfo.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/DescendantInfo.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/DescendantListResult.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/DescendantParentGroupInfo.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/Entities.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/EntityHierarchyItem.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/EntityInfo.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/EntityListResult.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/EntityParentGroupInfo.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/EntitySearchType.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/EntityViewParameterType.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/HierarchySettings.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/HierarchySettingsInfo.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/HierarchySettingsList.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/HierarchySettingsOperations.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ListSubscriptionUnderManagementGroup.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ManagementGroup.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ManagementGroupChildInfo.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ManagementGroupChildType.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ManagementGroupDetails.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ManagementGroupExpandType.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ManagementGroupInfo.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ManagementGroupListResult.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ManagementGroupPathElement.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ManagementGroupSubscriptions.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ManagementGroups.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ManagementGroupsCreateOrUpdateHeaders.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ManagementGroupsCreateOrUpdateResponse.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ManagementGroupsDeleteHeaders.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ManagementGroupsDeleteResponse.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/Operation.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/OperationDisplayProperties.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/OperationListResult.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/Operations.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ParentGroupInfo.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/PatchManagementGroupRequest.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/Permissions.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/Reason.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ResourceProviders.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/Status.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/SubscriptionUnderManagementGroup.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/TenantBackfillStatusResult.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/Type.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/package-info.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/package-info.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/module-info.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/EntitiesListSamples.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/HierarchySettingsOperationCreateOrUpdateSamples.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/HierarchySettingsOperationDeleteSamples.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/HierarchySettingsOperationGetSamples.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/HierarchySettingsOperationListSamples.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/HierarchySettingsOperationUpdateSamples.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ManagementGroupSubscriptionsCreateSamples.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ManagementGroupSubscriptionsDeleteSamples.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ManagementGroupSubscriptionsGetSubscriptionSamples.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ManagementGroupSubscriptionsGetSubscriptionsUnderManagementGroupSamples.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ManagementGroupsCreateOrUpdateSamples.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ManagementGroupsDeleteSamples.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ManagementGroupsGetDescendantsSamples.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ManagementGroupsGetSamples.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ManagementGroupsListSamples.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ManagementGroupsUpdateSamples.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/OperationsListSamples.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ResourceProviderCheckNameAvailabilitySamples.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ResourceProviderStartTenantBackfillSamples.java create mode 100644 sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ResourceProviderTenantBackfillStatusSamples.java create mode 100644 sdk/managementgroups/ci.yml create mode 100644 sdk/managementgroups/pom.xml diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index b1b11d5d990a..4adad63d7339 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -335,6 +335,7 @@ com.azure.resourcemanager:azure-resourcemanager-automanage;1.0.0-beta.1;1.0.0-be com.azure.resourcemanager:azure-resourcemanager-edgeorder;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-securityinsights;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-oep;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.0.0 # Unreleased dependencies: Copy the entry from above, prepend "unreleased_" and remove the current diff --git a/pom.xml b/pom.xml index 621fa3aedede..748d044d2092 100644 --- a/pom.xml +++ b/pom.xml @@ -926,6 +926,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..71935002f849 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 1.0.0-beta.1 (2022-02-09) + +- 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..43eea24c3e19 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/README.md @@ -0,0 +1,105 @@ +# Azure Resource Manager ManagementGroups client library for Java + +Azure Resource Manager ManagementGroups client library for Java. + +This package contains Microsoft Azure SDK for ManagementGroups Management SDK. The Azure Management Groups API enables consolidation of multiple +subscriptions/resources into an organizational hierarchy and centrally +manage access control, policies, alerting and reporting for those resources. +. Package tag package-2021-04. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## We'd love to hear your feedback + +We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better. + +If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together. + +Thank you in advance for your collaboration. We really appreciate your time! + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-managementgroups;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-managementgroups + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Include the recommended packages + +Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client. + +[Azure Identity][azure_identity] package and [Azure Core Netty HTTP][azure_core_http_netty] package provide the default implementation. + +### Authentication + +By default, Azure Active Directory token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, `azure` client can be authenticated by following code: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +ManagementGroupsManager manager = ManagementGroupsManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. + +See [Authentication][authenticate] for more options. + +## Key concepts + +See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. + +## Examples + +[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](https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/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 diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/SAMPLE.md b/sdk/managementgroups/azure-resourcemanager-managementgroups/SAMPLE.md new file mode 100644 index 000000000000..aa27b83b778a --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/SAMPLE.md @@ -0,0 +1,610 @@ +# 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 +import com.azure.core.util.Context; + +/** 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, Context.NONE); + } +} +``` + +### HierarchySettingsOperation_CreateOrUpdate + +```java +import com.azure.core.util.Context; +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"), + Context.NONE); + } +} +``` + +### HierarchySettingsOperation_Delete + +```java +import com.azure.core.util.Context; + +/** 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", Context.NONE); + } +} +``` + +### HierarchySettingsOperation_Get + +```java +import com.azure.core.util.Context; + +/** 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", Context.NONE); + } +} +``` + +### HierarchySettingsOperation_List + +```java +import com.azure.core.util.Context; + +/** 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", Context.NONE); + } +} +``` + +### HierarchySettingsOperation_Update + +```java +import com.azure.core.util.Context; +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"), + Context.NONE); + } +} +``` + +### ManagementGroupSubscriptions_Create + +```java +import com.azure.core.util.Context; + +/** 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", Context.NONE); + } +} +``` + +### ManagementGroupSubscriptions_Delete + +```java +import com.azure.core.util.Context; + +/** 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", Context.NONE); + } +} +``` + +### ManagementGroupSubscriptions_GetSubscription + +```java +import com.azure.core.util.Context; + +/** 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", Context.NONE); + } +} +``` + +### ManagementGroupSubscriptions_GetSubscriptionsUnderManagementGroup + +```java +import com.azure.core.util.Context; + +/** 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, Context.NONE); + } +} +``` + +### ManagementGroups_CreateOrUpdate + +```java +import com.azure.core.util.Context; +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", + Context.NONE); + } +} +``` + +### ManagementGroups_Delete + +```java +import com.azure.core.util.Context; + +/** 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", Context.NONE); + } +} +``` + +### ManagementGroups_Get + +```java +import com.azure.core.util.Context; +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", + 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", + 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", + 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", 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", + Context.NONE); + } +} +``` + +### ManagementGroups_GetDescendants + +```java +import com.azure.core.util.Context; + +/** 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, Context.NONE); + } +} +``` + +### ManagementGroups_List + +```java +import com.azure.core.util.Context; + +/** 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, Context.NONE); + } +} +``` + +### ManagementGroups_Update + +```java +import com.azure.core.util.Context; +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", + Context.NONE); + } +} +``` + +### Operations_List + +```java +import com.azure.core.util.Context; + +/** 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(Context.NONE); + } +} +``` + +### ResourceProvider_CheckNameAvailability + +```java +import com.azure.core.util.Context; +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), + Context.NONE); + } +} +``` + +### ResourceProvider_StartTenantBackfill + +```java +import com.azure.core.util.Context; + +/** 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(Context.NONE); + } +} +``` + +### ResourceProvider_TenantBackfillStatus + +```java +import com.azure.core.util.Context; + +/** 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(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..227890a89189 --- /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.25.0 + + + com.azure + azure-core-management + 1.5.2 + + + 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..3d861cfbf2e9 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/ManagementGroupsManager.java @@ -0,0 +1,307 @@ +// 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.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.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); + } + + /** + * Gets a Configurable instance that can be used to create ManagementGroupsManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new ManagementGroupsManager.Configurable(); + } + + /** The Configurable allowing configurations to be set. */ + public static final class Configurable { + private final ClientLogger logger = new ClientLogger(Configurable.class); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * 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 default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = Objects.requireNonNull(defaultPollInterval, "'retryPolicy' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw logger.logExceptionAsError(new IllegalArgumentException("'httpPipeline' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of ManagementGroups service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the ManagementGroups service API instance. + */ + public ManagementGroupsManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder + .append("azsdk-java") + .append("-") + .append("com.azure.resourcemanager.managementgroups") + .append("/") + .append("1.0.0-beta.1"); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder + .append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + 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); + } + } + + /** @return Resource collection API of ManagementGroups. */ + public ManagementGroups managementGroups() { + if (this.managementGroups == null) { + this.managementGroups = new ManagementGroupsImpl(clientObject.getManagementGroups(), this); + } + return managementGroups; + } + + /** @return Resource collection API of ManagementGroupSubscriptions. */ + public ManagementGroupSubscriptions managementGroupSubscriptions() { + if (this.managementGroupSubscriptions == null) { + this.managementGroupSubscriptions = + new ManagementGroupSubscriptionsImpl(clientObject.getManagementGroupSubscriptions(), this); + } + return managementGroupSubscriptions; + } + + /** @return Resource collection API of HierarchySettingsOperations. */ + public HierarchySettingsOperations hierarchySettingsOperations() { + if (this.hierarchySettingsOperations == null) { + this.hierarchySettingsOperations = + new HierarchySettingsOperationsImpl(clientObject.getHierarchySettingsOperations(), this); + } + return hierarchySettingsOperations; + } + + /** @return Resource collection API of Operations. */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** @return Resource collection API of ResourceProviders. */ + public ResourceProviders resourceProviders() { + if (this.resourceProviders == null) { + this.resourceProviders = new ResourceProvidersImpl(clientObject.getResourceProviders(), this); + } + return resourceProviders; + } + + /** @return Resource collection API of Entities. */ + public Entities entities() { + if (this.entities == null) { + this.entities = new EntitiesImpl(clientObject.getEntities(), this); + } + return entities; + } + + /** + * @return Wrapped service client ManagementGroupsApi providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + */ + public ManagementGroupsApi serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/EntitiesClient.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/EntitiesClient.java new file mode 100644 index 000000000000..79116d10e496 --- /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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List all entities (Management Groups, Subscriptions, etc.) for the authenticated user. + * + * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a + * previous response contains a nextLink element, the value of the nextLink element will include a token + * parameter that specifies a starting point to use for subsequent calls. + * @param skip Number of entities to skip over when retrieving results. Passing this in will override $skipToken. + * @param top Number of elements to return when retrieving results. Passing this in will override $skipToken. + * @param select This parameter specifies the fields to include in the response. Can include any combination of + * Name,DisplayName,Type,ParentDisplayNameChain,ParentChain, e.g. + * '$select=Name,DisplayName,Type,ParentDisplayNameChain,ParentNameChain'. When specified the $select parameter + * can override select in $skipToken. + * @param search The $search parameter is used in conjunction with the $filter parameter to return three different + * outputs depending on the parameter passed in. With $search=AllowedParents the API will return the entity info + * of all groups that the requested entity will be able to reparent to as determined by the user's permissions. + * With $search=AllowedChildren the API will return the entity info of all entities that can be added as + * children of the requested entity. With $search=ParentAndFirstLevelChildren the API will return the parent and + * first level of children that the user has either direct access to or indirect access via one of their + * descendants. With $search=ParentOnly the API will return only the group if the user has access to at least + * one of the descendants of the group. With $search=ChildrenOnly the API will return only the first level of + * children of the group entity info specified in $filter. The user must have direct access to the children + * entities or one of it's descendants for it to show up in the results. + * @param filter The filter parameter allows you to filter on the the name or display name fields. You can check for + * equality on the name field (e.g. name eq '{entityName}') and you can check for substrings on either the name + * or display name fields(e.g. contains(name, '{substringToSearch}'), contains(displayName, + * '{substringToSearch')). Note that the '{entityName}' and '{substringToSearch}' fields are checked case + * insensitively. + * @param view The view parameter allows clients to filter the type of data that is returned by the getEntities + * call. + * @param groupName A filter which allows the get entities call to focus on a particular group (i.e. "$filter=name + * eq 'groupName'"). + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to view entities. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String skiptoken, + Integer skip, + Integer top, + String select, + EntitySearchType search, + String filter, + EntityViewParameterType view, + String groupName, + String cacheControl, + Context context); +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/HierarchySettingsOperationsClient.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/HierarchySettingsOperationsClient.java new file mode 100644 index 000000000000..9d19ab0266c6 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/HierarchySettingsOperationsClient.java @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.managementgroups.fluent.models.HierarchySettingsInner; +import com.azure.resourcemanager.managementgroups.fluent.models.HierarchySettingsListInner; +import com.azure.resourcemanager.managementgroups.models.CreateOrUpdateSettingsRequest; + +/** An instance of this class provides access to all the operations defined in HierarchySettingsOperationsClient. */ +public interface HierarchySettingsOperationsClient { + /** + * Gets all the hierarchy settings defined at the Management Group level. Settings can only be set on the root + * Management Group of the hierarchy. + * + * @param groupId Management Group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the hierarchy settings defined at the Management Group level. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + HierarchySettingsListInner list(String groupId); + + /** + * Gets all the hierarchy settings defined at the Management Group level. Settings can only be set on the root + * Management Group of the hierarchy. + * + * @param groupId Management Group ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the hierarchy settings defined at the Management Group level along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listWithResponse(String groupId, Context context); + + /** + * Gets the hierarchy settings defined at the Management Group level. Settings can only be set on the root + * Management Group of the hierarchy. + * + * @param groupId Management Group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the hierarchy settings defined at the Management Group level. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + HierarchySettingsInner get(String groupId); + + /** + * Gets the hierarchy settings defined at the Management Group level. Settings can only be set on the root + * Management Group of the hierarchy. + * + * @param groupId Management Group ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the hierarchy settings defined at the Management Group level along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String groupId, Context context); + + /** + * Creates or updates the hierarchy settings defined at the Management Group level. + * + * @param groupId Management Group ID. + * @param createTenantSettingsRequest Tenant level settings request parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return settings defined at the Management Group scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + HierarchySettingsInner createOrUpdate(String groupId, CreateOrUpdateSettingsRequest createTenantSettingsRequest); + + /** + * Creates or updates the hierarchy settings defined at the Management Group level. + * + * @param groupId Management Group ID. + * @param createTenantSettingsRequest Tenant level settings request parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return settings defined at the Management Group scope along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String groupId, CreateOrUpdateSettingsRequest createTenantSettingsRequest, Context context); + + /** + * Updates the hierarchy settings defined at the Management Group level. + * + * @param groupId Management Group ID. + * @param createTenantSettingsRequest Tenant level settings request parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return settings defined at the Management Group scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + HierarchySettingsInner update(String groupId, CreateOrUpdateSettingsRequest createTenantSettingsRequest); + + /** + * Updates the hierarchy settings defined at the Management Group level. + * + * @param groupId Management Group ID. + * @param createTenantSettingsRequest Tenant level settings request parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return settings defined at the Management Group scope along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String groupId, CreateOrUpdateSettingsRequest createTenantSettingsRequest, Context context); + + /** + * Deletes the hierarchy settings defined at the Management Group level. + * + * @param groupId Management Group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String groupId); + + /** + * Deletes the hierarchy settings defined at the Management Group level. + * + * @param groupId Management Group ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String groupId, Context context); +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/ManagementGroupSubscriptionsClient.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/ManagementGroupSubscriptionsClient.java new file mode 100644 index 000000000000..cdb0a83a78b3 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/ManagementGroupSubscriptionsClient.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.managementgroups.fluent.models.SubscriptionUnderManagementGroupInner; + +/** An instance of this class provides access to all the operations defined in ManagementGroupSubscriptionsClient. */ +public interface ManagementGroupSubscriptionsClient { + /** + * Associates existing subscription with the management group. + * + * @param groupId Management Group ID. + * @param subscriptionId Subscription ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of subscription under management group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SubscriptionUnderManagementGroupInner create(String groupId, String subscriptionId); + + /** + * Associates existing subscription with the management group. + * + * @param groupId Management Group ID. + * @param subscriptionId Subscription ID. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of subscription under management group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse( + String groupId, String subscriptionId, String cacheControl, Context context); + + /** + * De-associates subscription from the management group. + * + * @param groupId Management Group ID. + * @param subscriptionId Subscription ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String groupId, String subscriptionId); + + /** + * De-associates subscription from the management group. + * + * @param groupId Management Group ID. + * @param subscriptionId Subscription ID. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String groupId, String subscriptionId, String cacheControl, Context context); + + /** + * Retrieves details about given subscription which is associated with the management group. + * + * @param groupId Management Group ID. + * @param subscriptionId Subscription ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of subscription under management group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SubscriptionUnderManagementGroupInner getSubscription(String groupId, String subscriptionId); + + /** + * Retrieves details about given subscription which is associated with the management group. + * + * @param groupId Management Group ID. + * @param subscriptionId Subscription ID. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of subscription under management group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getSubscriptionWithResponse( + String groupId, String subscriptionId, String cacheControl, Context context); + + /** + * Retrieves details about all subscriptions which are associated with the management group. + * + * @param groupId Management Group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of all subscriptions under management group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable getSubscriptionsUnderManagementGroup(String groupId); + + /** + * Retrieves details about all subscriptions which are associated with the management group. + * + * @param groupId Management Group ID. + * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a + * previous response contains a nextLink element, the value of the nextLink element will include a token + * parameter that specifies a starting point to use for subsequent calls. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of all subscriptions under management group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable getSubscriptionsUnderManagementGroup( + String groupId, String skiptoken, Context context); +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/ManagementGroupsApi.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/ManagementGroupsApi.java new file mode 100644 index 000000000000..1f902bbe8809 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/ManagementGroupsApi.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for ManagementGroupsApi class. */ +public interface ManagementGroupsApi { + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the ManagementGroupsClient object to access its operations. + * + * @return the ManagementGroupsClient object. + */ + ManagementGroupsClient getManagementGroups(); + + /** + * Gets the ManagementGroupSubscriptionsClient object to access its operations. + * + * @return the ManagementGroupSubscriptionsClient object. + */ + ManagementGroupSubscriptionsClient getManagementGroupSubscriptions(); + + /** + * Gets the HierarchySettingsOperationsClient object to access its operations. + * + * @return the HierarchySettingsOperationsClient object. + */ + HierarchySettingsOperationsClient getHierarchySettingsOperations(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the ResourceProvidersClient object to access its operations. + * + * @return the ResourceProvidersClient object. + */ + ResourceProvidersClient getResourceProviders(); + + /** + * Gets the EntitiesClient object to access its operations. + * + * @return the EntitiesClient object. + */ + EntitiesClient getEntities(); +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/ManagementGroupsClient.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/ManagementGroupsClient.java new file mode 100644 index 000000000000..26660a838c14 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/ManagementGroupsClient.java @@ -0,0 +1,312 @@ +// 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; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ManagementGroupsClient. */ +public interface ManagementGroupsClient { + /** + * List management groups for the authenticated user. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to list management groups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List management groups for the authenticated user. + * + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a + * previous response contains a nextLink element, the value of the nextLink element will include a token + * parameter that specifies a starting point to use for subsequent calls. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to list management groups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String cacheControl, String skiptoken, Context context); + + /** + * Get the details of the management group. + * + * @param groupId Management Group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the management group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagementGroupInner get(String groupId); + + /** + * Get the details of the management group. + * + * @param groupId Management Group ID. + * @param expand The $expand=children query string parameter allows clients to request inclusion of children in the + * response payload. $expand=path includes the path from the root group to the current group. $expand=ancestors + * includes the ancestor Ids of the current group. + * @param recurse The $recurse=true query string parameter allows clients to request inclusion of entire hierarchy + * in the response payload. Note that $expand=children must be passed up if $recurse is set to true. + * @param filter A filter which allows the exclusion of subscriptions from results (i.e. '$filter=children.childType + * ne Subscription'). + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the management group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String groupId, + ManagementGroupExpandType expand, + Boolean recurse, + String filter, + String cacheControl, + Context context); + + /** + * Create or update a management group. If a management group is already created and a subsequent create request is + * issued with different properties, the management group properties will be updated. + * + * @param groupId Management Group ID. + * @param createManagementGroupRequest Management group creation parameters. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the management group details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagementGroupInner> beginCreateOrUpdate( + String groupId, CreateManagementGroupRequest createManagementGroupRequest, String cacheControl); + + /** + * Create or update a management group. If a management group is already created and a subsequent create request is + * issued with different properties, the management group properties will be updated. + * + * @param groupId Management Group ID. + * @param createManagementGroupRequest Management group creation parameters. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the management group details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagementGroupInner> beginCreateOrUpdate( + String groupId, + CreateManagementGroupRequest createManagementGroupRequest, + String cacheControl, + Context context); + + /** + * Create or update a management group. If a management group is already created and a subsequent create request is + * issued with different properties, the management group properties will be updated. + * + * @param groupId Management Group ID. + * @param createManagementGroupRequest Management group creation parameters. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the management group details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagementGroupInner createOrUpdate( + String groupId, CreateManagementGroupRequest createManagementGroupRequest, String cacheControl); + + /** + * Create or update a management group. If a management group is already created and a subsequent create request is + * issued with different properties, the management group properties will be updated. + * + * @param groupId Management Group ID. + * @param createManagementGroupRequest Management group creation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the management group details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagementGroupInner createOrUpdate(String groupId, CreateManagementGroupRequest createManagementGroupRequest); + + /** + * Create or update a management group. If a management group is already created and a subsequent create request is + * issued with different properties, the management group properties will be updated. + * + * @param groupId Management Group ID. + * @param createManagementGroupRequest Management group creation parameters. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the management group details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagementGroupInner createOrUpdate( + String groupId, + CreateManagementGroupRequest createManagementGroupRequest, + String cacheControl, + Context context); + + /** + * Update a management group. + * + * @param groupId Management Group ID. + * @param patchGroupRequest Management group patch parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the management group details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagementGroupInner update(String groupId, PatchManagementGroupRequest patchGroupRequest); + + /** + * Update a management group. + * + * @param groupId Management Group ID. + * @param patchGroupRequest Management group patch parameters. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the management group details along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String groupId, PatchManagementGroupRequest patchGroupRequest, String cacheControl, Context context); + + /** + * Delete management group. If a management group contains child resources, the request will fail. + * + * @param groupId Management Group ID. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the results of Azure-AsyncOperation along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, AzureAsyncOperationResultsInner> beginDelete( + String groupId, String cacheControl); + + /** + * Delete management group. If a management group contains child resources, the request will fail. + * + * @param groupId Management Group ID. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the results of Azure-AsyncOperation along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, AzureAsyncOperationResultsInner> beginDelete( + String groupId, String cacheControl, Context context); + + /** + * Delete management group. If a management group contains child resources, the request will fail. + * + * @param groupId Management Group ID. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the results of Azure-AsyncOperation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AzureAsyncOperationResultsInner delete(String groupId, String cacheControl); + + /** + * Delete management group. If a management group contains child resources, the request will fail. + * + * @param groupId Management Group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the results of Azure-AsyncOperation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AzureAsyncOperationResultsInner delete(String groupId); + + /** + * Delete management group. If a management group contains child resources, the request will fail. + * + * @param groupId Management Group ID. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the results of Azure-AsyncOperation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AzureAsyncOperationResultsInner delete(String groupId, String cacheControl, Context context); + + /** + * List all entities that descend from a management group. + * + * @param groupId Management Group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to view descendants. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable getDescendants(String groupId); + + /** + * List all entities that descend from a management group. + * + * @param groupId Management Group ID. + * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a + * previous response contains a nextLink element, the value of the nextLink element will include a token + * parameter that specifies a starting point to use for subsequent calls. + * @param top Number of elements to return when retrieving results. Passing this in will override $skipToken. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to view descendants. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable getDescendants(String groupId, String skiptoken, Integer top, Context context); +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/OperationsClient.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/OperationsClient.java new file mode 100644 index 000000000000..b206ffc6d1bf --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/OperationsClient.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.managementgroups.fluent.models.OperationInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * Lists all of the available Management REST API operations. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to list Microsoft.Management operations. + */ + @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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/ResourceProvidersClient.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/ResourceProvidersClient.java new file mode 100644 index 000000000000..d3d82c1e3e56 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/ResourceProvidersClient.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.managementgroups.fluent.models.CheckNameAvailabilityResultInner; +import com.azure.resourcemanager.managementgroups.fluent.models.TenantBackfillStatusResultInner; +import com.azure.resourcemanager.managementgroups.models.CheckNameAvailabilityRequest; + +/** An instance of this class provides access to all the operations defined in ResourceProvidersClient. */ +public interface ResourceProvidersClient { + /** + * Checks if the specified management group name is valid and unique. + * + * @param checkNameAvailabilityRequest Management group name availability check parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to check management group name availability. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CheckNameAvailabilityResultInner checkNameAvailability(CheckNameAvailabilityRequest checkNameAvailabilityRequest); + + /** + * Checks if the specified management group name is valid and unique. + * + * @param checkNameAvailabilityRequest Management group name availability check parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to check management group name availability along with {@link + * Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response checkNameAvailabilityWithResponse( + CheckNameAvailabilityRequest checkNameAvailabilityRequest, Context context); + + /** + * Starts backfilling subscriptions for the Tenant. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the tenant backfill status. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TenantBackfillStatusResultInner startTenantBackfill(); + + /** + * Starts backfilling subscriptions for the Tenant. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the tenant backfill status along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response startTenantBackfillWithResponse(Context context); + + /** + * Gets tenant backfill status. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return tenant backfill status. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TenantBackfillStatusResultInner tenantBackfillStatus(); + + /** + * Gets tenant backfill status. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return tenant backfill status along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response tenantBackfillStatusWithResponse(Context context); +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/AzureAsyncOperationResultsInner.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/AzureAsyncOperationResultsInner.java new file mode 100644 index 000000000000..f980d72c449f --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/AzureAsyncOperationResultsInner.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The results of Azure-AsyncOperation. */ +@Fluent +public final class AzureAsyncOperationResultsInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AzureAsyncOperationResultsInner.class); + + /* + * The fully qualified ID for the management group. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * The type of the resource. For example, + * Microsoft.Management/managementGroups + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * The name of the management group. For example, + * 00000000-0000-0000-0000-000000000000 + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The current status of the asynchronous operation performed . For + * example, Running, Succeeded, Failed + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /* + * The generic properties of a management group. + */ + @JsonProperty(value = "properties") + private ManagementGroupInfoProperties innerProperties; + + /** + * Get the id property: The fully qualified ID for the management group. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the type property: The type of the resource. For example, Microsoft.Management/managementGroups. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the management group. For example, 00000000-0000-0000-0000-000000000000. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the status property: The current status of the asynchronous operation performed . For example, Running, + * Succeeded, Failed. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Get the innerProperties property: The generic properties of a management group. + * + * @return the innerProperties value. + */ + private ManagementGroupInfoProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the tenantId property: The AAD Tenant ID associated with the management group. For example, + * 00000000-0000-0000-0000-000000000000. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.innerProperties() == null ? null : this.innerProperties().tenantId(); + } + + /** + * Set the tenantId property: The AAD Tenant ID associated with the management group. For example, + * 00000000-0000-0000-0000-000000000000. + * + * @param tenantId the tenantId value to set. + * @return the AzureAsyncOperationResultsInner object itself. + */ + public AzureAsyncOperationResultsInner withTenantId(String tenantId) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagementGroupInfoProperties(); + } + this.innerProperties().withTenantId(tenantId); + return this; + } + + /** + * Get the displayName property: The friendly name of the management group. + * + * @return the displayName value. + */ + public String displayName() { + return this.innerProperties() == null ? null : this.innerProperties().displayName(); + } + + /** + * Set the displayName property: The friendly name of the management group. + * + * @param displayName the displayName value to set. + * @return the AzureAsyncOperationResultsInner object itself. + */ + public AzureAsyncOperationResultsInner withDisplayName(String displayName) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagementGroupInfoProperties(); + } + this.innerProperties().withDisplayName(displayName); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/CheckNameAvailabilityResultInner.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/CheckNameAvailabilityResultInner.java new file mode 100644 index 000000000000..53081df324d0 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/CheckNameAvailabilityResultInner.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.managementgroups.models.Reason; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes the result of the request to check management group name availability. */ +@Immutable +public final class CheckNameAvailabilityResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CheckNameAvailabilityResultInner.class); + + /* + * Required. True indicates name is valid and available. False indicates + * the name is invalid, unavailable, or both. + */ + @JsonProperty(value = "nameAvailable", access = JsonProperty.Access.WRITE_ONLY) + private Boolean nameAvailable; + + /* + * Required if nameAvailable == false. Invalid indicates the name provided + * does not match the resource provider's naming requirements (incorrect + * length, unsupported characters, etc.) AlreadyExists indicates that the + * name is already in use and is therefore unavailable. + */ + @JsonProperty(value = "reason", access = JsonProperty.Access.WRITE_ONLY) + private Reason reason; + + /* + * Required if nameAvailable == false. Localized. If reason == invalid, + * provide the user with the reason why the given name is invalid, and + * provide the resource naming requirements so that the user can select a + * valid name. If reason == AlreadyExists, explain that is already in use, + * and direct them to select a different name. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * Get the nameAvailable property: Required. True indicates name is valid and available. False indicates the name is + * invalid, unavailable, or both. + * + * @return the nameAvailable value. + */ + public Boolean nameAvailable() { + return this.nameAvailable; + } + + /** + * Get the reason property: Required if nameAvailable == false. Invalid indicates the name provided does not match + * the resource provider's naming requirements (incorrect length, unsupported characters, etc.) AlreadyExists + * indicates that the name is already in use and is therefore unavailable. + * + * @return the reason value. + */ + public Reason reason() { + return this.reason; + } + + /** + * Get the message property: Required if nameAvailable == false. Localized. If reason == invalid, provide the user + * with the reason why the given name is invalid, and provide the resource naming requirements so that the user can + * select a valid name. If reason == AlreadyExists, explain that is already in use, and direct them to select a + * different name. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/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..9308edc2113c --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/CreateManagementGroupProperties.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.managementgroups.models.CreateManagementGroupChildInfo; +import com.azure.resourcemanager.managementgroups.models.CreateManagementGroupDetails; +import com.fasterxml.jackson.annotation.JsonIgnore; +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 { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CreateManagementGroupProperties.class); + + /* + * The AAD Tenant ID associated with the management group. For example, + * 00000000-0000-0000-0000-000000000000 + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /* + * The friendly name of the management group. If no value is passed then + * this field will be set to the groupId. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /* + * The details of a management group used during creation. + */ + @JsonProperty(value = "details") + private CreateManagementGroupDetails details; + + /* + * The list of children. + */ + @JsonProperty(value = "children", access = JsonProperty.Access.WRITE_ONLY) + private List children; + + /** + * Get the tenantId property: The AAD Tenant ID associated with the management group. For example, + * 00000000-0000-0000-0000-000000000000. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the displayName property: The friendly name of the management group. If no value is passed then this field + * will be set to the groupId. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The friendly name of the management group. If no value is passed then this field + * will be set to the groupId. + * + * @param displayName the displayName value to set. + * @return the CreateManagementGroupProperties object itself. + */ + public CreateManagementGroupProperties withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the details property: The details of a management group used during creation. + * + * @return the details value. + */ + public CreateManagementGroupDetails details() { + return this.details; + } + + /** + * Set the details property: The details of a management group used during creation. + * + * @param details the details value to set. + * @return the CreateManagementGroupProperties object itself. + */ + public CreateManagementGroupProperties withDetails(CreateManagementGroupDetails details) { + this.details = details; + return this; + } + + /** + * Get the children property: The list of children. + * + * @return the children value. + */ + public List children() { + return this.children; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (details() != null) { + details().validate(); + } + if (children() != null) { + children().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/CreateOrUpdateSettingsProperties.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/CreateOrUpdateSettingsProperties.java new file mode 100644 index 000000000000..fb5c061f0f01 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/CreateOrUpdateSettingsProperties.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of the request to create or update Management Group settings. */ +@Fluent +public final class CreateOrUpdateSettingsProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CreateOrUpdateSettingsProperties.class); + + /* + * Indicates whether RBAC access is required upon group creation under the + * root Management Group. If set to true, user will require + * Microsoft.Management/managementGroups/write action on the root + * Management Group scope in order to create new Groups directly under the + * root. This will prevent new users from creating new Management Groups, + * unless they are given access. + */ + @JsonProperty(value = "requireAuthorizationForGroupCreation") + private Boolean requireAuthorizationForGroupCreation; + + /* + * Settings that sets the default Management Group under which new + * subscriptions get added in this tenant. For example, + * /providers/Microsoft.Management/managementGroups/defaultGroup + */ + @JsonProperty(value = "defaultManagementGroup") + private String defaultManagementGroup; + + /** + * Get the requireAuthorizationForGroupCreation property: Indicates whether RBAC access is required upon group + * creation under the root Management Group. If set to true, user will require + * Microsoft.Management/managementGroups/write action on the root Management Group scope in order to create new + * Groups directly under the root. This will prevent new users from creating new Management Groups, unless they are + * given access. + * + * @return the requireAuthorizationForGroupCreation value. + */ + public Boolean requireAuthorizationForGroupCreation() { + return this.requireAuthorizationForGroupCreation; + } + + /** + * Set the requireAuthorizationForGroupCreation property: Indicates whether RBAC access is required upon group + * creation under the root Management Group. If set to true, user will require + * Microsoft.Management/managementGroups/write action on the root Management Group scope in order to create new + * Groups directly under the root. This will prevent new users from creating new Management Groups, unless they are + * given access. + * + * @param requireAuthorizationForGroupCreation the requireAuthorizationForGroupCreation value to set. + * @return the CreateOrUpdateSettingsProperties object itself. + */ + public CreateOrUpdateSettingsProperties withRequireAuthorizationForGroupCreation( + Boolean requireAuthorizationForGroupCreation) { + this.requireAuthorizationForGroupCreation = requireAuthorizationForGroupCreation; + return this; + } + + /** + * Get the defaultManagementGroup property: Settings that sets the default Management Group under which new + * subscriptions get added in this tenant. For example, + * /providers/Microsoft.Management/managementGroups/defaultGroup. + * + * @return the defaultManagementGroup value. + */ + public String defaultManagementGroup() { + return this.defaultManagementGroup; + } + + /** + * Set the defaultManagementGroup property: Settings that sets the default Management Group under which new + * subscriptions get added in this tenant. For example, + * /providers/Microsoft.Management/managementGroups/defaultGroup. + * + * @param defaultManagementGroup the defaultManagementGroup value to set. + * @return the CreateOrUpdateSettingsProperties object itself. + */ + public CreateOrUpdateSettingsProperties withDefaultManagementGroup(String defaultManagementGroup) { + this.defaultManagementGroup = defaultManagementGroup; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/DescendantInfoInner.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/DescendantInfoInner.java new file mode 100644 index 000000000000..f6a6620b9be5 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/DescendantInfoInner.java @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.managementgroups.models.DescendantParentGroupInfo; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The descendant. */ +@Fluent +public final class DescendantInfoInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DescendantInfoInner.class); + + /* + * The fully qualified ID for the descendant. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + * or /subscriptions/0000000-0000-0000-0000-000000000000 + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * The type of the resource. For example, + * Microsoft.Management/managementGroups or /subscriptions + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * The name of the descendant. For example, + * 00000000-0000-0000-0000-000000000000 + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The generic properties of an descendant. + */ + @JsonProperty(value = "properties") + private DescendantInfoProperties innerProperties; + + /** + * Get the id property: The fully qualified ID for the descendant. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 or + * /subscriptions/0000000-0000-0000-0000-000000000000. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the type property: The type of the resource. For example, Microsoft.Management/managementGroups or + * /subscriptions. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the descendant. For example, 00000000-0000-0000-0000-000000000000. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the innerProperties property: The generic properties of an descendant. + * + * @return the innerProperties value. + */ + private DescendantInfoProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the displayName property: The friendly name of the management group. + * + * @return the displayName value. + */ + public String displayName() { + return this.innerProperties() == null ? null : this.innerProperties().displayName(); + } + + /** + * Set the displayName property: The friendly name of the management group. + * + * @param displayName the displayName value to set. + * @return the DescendantInfoInner object itself. + */ + public DescendantInfoInner withDisplayName(String displayName) { + if (this.innerProperties() == null) { + this.innerProperties = new DescendantInfoProperties(); + } + this.innerProperties().withDisplayName(displayName); + return this; + } + + /** + * Get the parent property: The ID of the parent management group. + * + * @return the parent value. + */ + public DescendantParentGroupInfo parent() { + return this.innerProperties() == null ? null : this.innerProperties().parent(); + } + + /** + * Set the parent property: The ID of the parent management group. + * + * @param parent the parent value to set. + * @return the DescendantInfoInner object itself. + */ + public DescendantInfoInner withParent(DescendantParentGroupInfo parent) { + if (this.innerProperties() == null) { + this.innerProperties = new DescendantInfoProperties(); + } + this.innerProperties().withParent(parent); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/DescendantInfoProperties.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/DescendantInfoProperties.java new file mode 100644 index 000000000000..9b82cf908891 --- /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.core.util.logging.ClientLogger; +import com.azure.resourcemanager.managementgroups.models.DescendantParentGroupInfo; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The generic properties of an descendant. */ +@Fluent +public final class DescendantInfoProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DescendantInfoProperties.class); + + /* + * The friendly name of the management group. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /* + * The ID of the parent management group. + */ + @JsonProperty(value = "parent") + private DescendantParentGroupInfo parent; + + /** + * Get the displayName property: The friendly name of the management group. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The friendly name of the management group. + * + * @param displayName the displayName value to set. + * @return the DescendantInfoProperties object itself. + */ + public DescendantInfoProperties withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the parent property: The ID of the parent management group. + * + * @return the parent value. + */ + public DescendantParentGroupInfo parent() { + return this.parent; + } + + /** + * Set the parent property: The ID of the parent management group. + * + * @param parent the parent value to set. + * @return the DescendantInfoProperties object itself. + */ + public DescendantInfoProperties withParent(DescendantParentGroupInfo parent) { + this.parent = parent; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (parent() != null) { + parent().validate(); + } + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/EntityHierarchyItemProperties.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/EntityHierarchyItemProperties.java new file mode 100644 index 000000000000..8c3ed2dcf4eb --- /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.core.util.logging.ClientLogger; +import com.azure.resourcemanager.managementgroups.models.EntityHierarchyItem; +import com.azure.resourcemanager.managementgroups.models.Permissions; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The generic properties of a management group. */ +@Fluent +public final class EntityHierarchyItemProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EntityHierarchyItemProperties.class); + + /* + * The friendly name of the management group. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /* + * The users specific permissions to this item. + */ + @JsonProperty(value = "permissions") + private Permissions permissions; + + /* + * The list of children. + */ + @JsonProperty(value = "children") + private List children; + + /** + * Get the displayName property: The friendly name of the management group. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The friendly name of the management group. + * + * @param displayName the displayName value to set. + * @return the EntityHierarchyItemProperties object itself. + */ + public EntityHierarchyItemProperties withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the permissions property: The users specific permissions to this item. + * + * @return the permissions value. + */ + public Permissions permissions() { + return this.permissions; + } + + /** + * Set the permissions property: The users specific permissions to this item. + * + * @param permissions the permissions value to set. + * @return the EntityHierarchyItemProperties object itself. + */ + public EntityHierarchyItemProperties withPermissions(Permissions permissions) { + this.permissions = permissions; + return this; + } + + /** + * Get the children property: The list of children. + * + * @return the children value. + */ + public List children() { + return this.children; + } + + /** + * Set the children property: The list of children. + * + * @param children the children value to set. + * @return the EntityHierarchyItemProperties object itself. + */ + public EntityHierarchyItemProperties withChildren(List children) { + this.children = children; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (children() != null) { + children().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/EntityInfoInner.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/EntityInfoInner.java new file mode 100644 index 000000000000..c1eb5761bb61 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/EntityInfoInner.java @@ -0,0 +1,332 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.managementgroups.models.EntityParentGroupInfo; +import com.azure.resourcemanager.managementgroups.models.Permissions; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The entity. */ +@Fluent +public final class EntityInfoInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EntityInfoInner.class); + + /* + * The fully qualified ID for the entity. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * The type of the resource. For example, + * Microsoft.Management/managementGroups + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * The name of the entity. For example, + * 00000000-0000-0000-0000-000000000000 + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The generic properties of an entity. + */ + @JsonProperty(value = "properties") + private EntityInfoProperties innerProperties; + + /** + * Get the id property: The fully qualified ID for the entity. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the type property: The type of the resource. For example, Microsoft.Management/managementGroups. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the entity. For example, 00000000-0000-0000-0000-000000000000. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the innerProperties property: The generic properties of an entity. + * + * @return the innerProperties value. + */ + private EntityInfoProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the tenantId property: The AAD Tenant ID associated with the entity. For example, + * 00000000-0000-0000-0000-000000000000. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.innerProperties() == null ? null : this.innerProperties().tenantId(); + } + + /** + * Set the tenantId property: The AAD Tenant ID associated with the entity. For example, + * 00000000-0000-0000-0000-000000000000. + * + * @param tenantId the tenantId value to set. + * @return the EntityInfoInner object itself. + */ + public EntityInfoInner withTenantId(String tenantId) { + if (this.innerProperties() == null) { + this.innerProperties = new EntityInfoProperties(); + } + this.innerProperties().withTenantId(tenantId); + return this; + } + + /** + * Get the displayName property: The friendly name of the management group. + * + * @return the displayName value. + */ + public String displayName() { + return this.innerProperties() == null ? null : this.innerProperties().displayName(); + } + + /** + * Set the displayName property: The friendly name of the management group. + * + * @param displayName the displayName value to set. + * @return the EntityInfoInner object itself. + */ + public EntityInfoInner withDisplayName(String displayName) { + if (this.innerProperties() == null) { + this.innerProperties = new EntityInfoProperties(); + } + this.innerProperties().withDisplayName(displayName); + return this; + } + + /** + * Get the parent property: (Optional) The ID of the parent management group. + * + * @return the parent value. + */ + public EntityParentGroupInfo parent() { + return this.innerProperties() == null ? null : this.innerProperties().parent(); + } + + /** + * Set the parent property: (Optional) The ID of the parent management group. + * + * @param parent the parent value to set. + * @return the EntityInfoInner object itself. + */ + public EntityInfoInner withParent(EntityParentGroupInfo parent) { + if (this.innerProperties() == null) { + this.innerProperties = new EntityInfoProperties(); + } + this.innerProperties().withParent(parent); + return this; + } + + /** + * Get the permissions property: The users specific permissions to this item. + * + * @return the permissions value. + */ + public Permissions permissions() { + return this.innerProperties() == null ? null : this.innerProperties().permissions(); + } + + /** + * Set the permissions property: The users specific permissions to this item. + * + * @param permissions the permissions value to set. + * @return the EntityInfoInner object itself. + */ + public EntityInfoInner withPermissions(Permissions permissions) { + if (this.innerProperties() == null) { + this.innerProperties = new EntityInfoProperties(); + } + this.innerProperties().withPermissions(permissions); + return this; + } + + /** + * Get the inheritedPermissions property: The users specific permissions to this item. + * + * @return the inheritedPermissions value. + */ + public Permissions inheritedPermissions() { + return this.innerProperties() == null ? null : this.innerProperties().inheritedPermissions(); + } + + /** + * Set the inheritedPermissions property: The users specific permissions to this item. + * + * @param inheritedPermissions the inheritedPermissions value to set. + * @return the EntityInfoInner object itself. + */ + public EntityInfoInner withInheritedPermissions(Permissions inheritedPermissions) { + if (this.innerProperties() == null) { + this.innerProperties = new EntityInfoProperties(); + } + this.innerProperties().withInheritedPermissions(inheritedPermissions); + return this; + } + + /** + * Get the numberOfDescendants property: Number of Descendants. + * + * @return the numberOfDescendants value. + */ + public Integer numberOfDescendants() { + return this.innerProperties() == null ? null : this.innerProperties().numberOfDescendants(); + } + + /** + * Set the numberOfDescendants property: Number of Descendants. + * + * @param numberOfDescendants the numberOfDescendants value to set. + * @return the EntityInfoInner object itself. + */ + public EntityInfoInner withNumberOfDescendants(Integer numberOfDescendants) { + if (this.innerProperties() == null) { + this.innerProperties = new EntityInfoProperties(); + } + this.innerProperties().withNumberOfDescendants(numberOfDescendants); + return this; + } + + /** + * Get the numberOfChildren property: Number of Children Number of children is the number of Groups and + * Subscriptions that are exactly one level underneath the current Group. + * + * @return the numberOfChildren value. + */ + public Integer numberOfChildren() { + return this.innerProperties() == null ? null : this.innerProperties().numberOfChildren(); + } + + /** + * Set the numberOfChildren property: Number of Children Number of children is the number of Groups and + * Subscriptions that are exactly one level underneath the current Group. + * + * @param numberOfChildren the numberOfChildren value to set. + * @return the EntityInfoInner object itself. + */ + public EntityInfoInner withNumberOfChildren(Integer numberOfChildren) { + if (this.innerProperties() == null) { + this.innerProperties = new EntityInfoProperties(); + } + this.innerProperties().withNumberOfChildren(numberOfChildren); + return this; + } + + /** + * Get the numberOfChildGroups property: Number of Child Groups Number of children is the number of Groups that are + * exactly one level underneath the current Group. + * + * @return the numberOfChildGroups value. + */ + public Integer numberOfChildGroups() { + return this.innerProperties() == null ? null : this.innerProperties().numberOfChildGroups(); + } + + /** + * Set the numberOfChildGroups property: Number of Child Groups Number of children is the number of Groups that are + * exactly one level underneath the current Group. + * + * @param numberOfChildGroups the numberOfChildGroups value to set. + * @return the EntityInfoInner object itself. + */ + public EntityInfoInner withNumberOfChildGroups(Integer numberOfChildGroups) { + if (this.innerProperties() == null) { + this.innerProperties = new EntityInfoProperties(); + } + this.innerProperties().withNumberOfChildGroups(numberOfChildGroups); + return this; + } + + /** + * Get the parentDisplayNameChain property: The parent display name chain from the root group to the immediate + * parent. + * + * @return the parentDisplayNameChain value. + */ + public List parentDisplayNameChain() { + return this.innerProperties() == null ? null : this.innerProperties().parentDisplayNameChain(); + } + + /** + * Set the parentDisplayNameChain property: The parent display name chain from the root group to the immediate + * parent. + * + * @param parentDisplayNameChain the parentDisplayNameChain value to set. + * @return the EntityInfoInner object itself. + */ + public EntityInfoInner withParentDisplayNameChain(List parentDisplayNameChain) { + if (this.innerProperties() == null) { + this.innerProperties = new EntityInfoProperties(); + } + this.innerProperties().withParentDisplayNameChain(parentDisplayNameChain); + return this; + } + + /** + * Get the parentNameChain property: The parent name chain from the root group to the immediate parent. + * + * @return the parentNameChain value. + */ + public List parentNameChain() { + return this.innerProperties() == null ? null : this.innerProperties().parentNameChain(); + } + + /** + * Set the parentNameChain property: The parent name chain from the root group to the immediate parent. + * + * @param parentNameChain the parentNameChain value to set. + * @return the EntityInfoInner object itself. + */ + public EntityInfoInner withParentNameChain(List parentNameChain) { + if (this.innerProperties() == null) { + this.innerProperties = new EntityInfoProperties(); + } + this.innerProperties().withParentNameChain(parentNameChain); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/EntityInfoProperties.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/EntityInfoProperties.java new file mode 100644 index 000000000000..5be3d6708e75 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/EntityInfoProperties.java @@ -0,0 +1,302 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.managementgroups.models.EntityParentGroupInfo; +import com.azure.resourcemanager.managementgroups.models.Permissions; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The generic properties of an entity. */ +@Fluent +public final class EntityInfoProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EntityInfoProperties.class); + + /* + * The AAD Tenant ID associated with the entity. For example, + * 00000000-0000-0000-0000-000000000000 + */ + @JsonProperty(value = "tenantId") + private String tenantId; + + /* + * The friendly name of the management group. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /* + * (Optional) The ID of the parent management group. + */ + @JsonProperty(value = "parent") + private EntityParentGroupInfo parent; + + /* + * The users specific permissions to this item. + */ + @JsonProperty(value = "permissions") + private Permissions permissions; + + /* + * The users specific permissions to this item. + */ + @JsonProperty(value = "inheritedPermissions") + private Permissions inheritedPermissions; + + /* + * Number of Descendants + */ + @JsonProperty(value = "numberOfDescendants") + private Integer numberOfDescendants; + + /* + * Number of Children Number of children is the number of Groups and + * Subscriptions that are exactly one level underneath the current Group. + */ + @JsonProperty(value = "numberOfChildren") + private Integer numberOfChildren; + + /* + * Number of Child Groups Number of children is the number of Groups that + * are exactly one level underneath the current Group. + */ + @JsonProperty(value = "numberOfChildGroups") + private Integer numberOfChildGroups; + + /* + * The parent display name chain from the root group to the immediate + * parent + */ + @JsonProperty(value = "parentDisplayNameChain") + private List parentDisplayNameChain; + + /* + * The parent name chain from the root group to the immediate parent + */ + @JsonProperty(value = "parentNameChain") + private List parentNameChain; + + /** + * Get the tenantId property: The AAD Tenant ID associated with the entity. For example, + * 00000000-0000-0000-0000-000000000000. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Set the tenantId property: The AAD Tenant ID associated with the entity. For example, + * 00000000-0000-0000-0000-000000000000. + * + * @param tenantId the tenantId value to set. + * @return the EntityInfoProperties object itself. + */ + public EntityInfoProperties withTenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Get the displayName property: The friendly name of the management group. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The friendly name of the management group. + * + * @param displayName the displayName value to set. + * @return the EntityInfoProperties object itself. + */ + public EntityInfoProperties withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the parent property: (Optional) The ID of the parent management group. + * + * @return the parent value. + */ + public EntityParentGroupInfo parent() { + return this.parent; + } + + /** + * Set the parent property: (Optional) The ID of the parent management group. + * + * @param parent the parent value to set. + * @return the EntityInfoProperties object itself. + */ + public EntityInfoProperties withParent(EntityParentGroupInfo parent) { + this.parent = parent; + return this; + } + + /** + * Get the permissions property: The users specific permissions to this item. + * + * @return the permissions value. + */ + public Permissions permissions() { + return this.permissions; + } + + /** + * Set the permissions property: The users specific permissions to this item. + * + * @param permissions the permissions value to set. + * @return the EntityInfoProperties object itself. + */ + public EntityInfoProperties withPermissions(Permissions permissions) { + this.permissions = permissions; + return this; + } + + /** + * Get the inheritedPermissions property: The users specific permissions to this item. + * + * @return the inheritedPermissions value. + */ + public Permissions inheritedPermissions() { + return this.inheritedPermissions; + } + + /** + * Set the inheritedPermissions property: The users specific permissions to this item. + * + * @param inheritedPermissions the inheritedPermissions value to set. + * @return the EntityInfoProperties object itself. + */ + public EntityInfoProperties withInheritedPermissions(Permissions inheritedPermissions) { + this.inheritedPermissions = inheritedPermissions; + return this; + } + + /** + * Get the numberOfDescendants property: Number of Descendants. + * + * @return the numberOfDescendants value. + */ + public Integer numberOfDescendants() { + return this.numberOfDescendants; + } + + /** + * Set the numberOfDescendants property: Number of Descendants. + * + * @param numberOfDescendants the numberOfDescendants value to set. + * @return the EntityInfoProperties object itself. + */ + public EntityInfoProperties withNumberOfDescendants(Integer numberOfDescendants) { + this.numberOfDescendants = numberOfDescendants; + return this; + } + + /** + * Get the numberOfChildren property: Number of Children Number of children is the number of Groups and + * Subscriptions that are exactly one level underneath the current Group. + * + * @return the numberOfChildren value. + */ + public Integer numberOfChildren() { + return this.numberOfChildren; + } + + /** + * Set the numberOfChildren property: Number of Children Number of children is the number of Groups and + * Subscriptions that are exactly one level underneath the current Group. + * + * @param numberOfChildren the numberOfChildren value to set. + * @return the EntityInfoProperties object itself. + */ + public EntityInfoProperties withNumberOfChildren(Integer numberOfChildren) { + this.numberOfChildren = numberOfChildren; + return this; + } + + /** + * Get the numberOfChildGroups property: Number of Child Groups Number of children is the number of Groups that are + * exactly one level underneath the current Group. + * + * @return the numberOfChildGroups value. + */ + public Integer numberOfChildGroups() { + return this.numberOfChildGroups; + } + + /** + * Set the numberOfChildGroups property: Number of Child Groups Number of children is the number of Groups that are + * exactly one level underneath the current Group. + * + * @param numberOfChildGroups the numberOfChildGroups value to set. + * @return the EntityInfoProperties object itself. + */ + public EntityInfoProperties withNumberOfChildGroups(Integer numberOfChildGroups) { + this.numberOfChildGroups = numberOfChildGroups; + return this; + } + + /** + * Get the parentDisplayNameChain property: The parent display name chain from the root group to the immediate + * parent. + * + * @return the parentDisplayNameChain value. + */ + public List parentDisplayNameChain() { + return this.parentDisplayNameChain; + } + + /** + * Set the parentDisplayNameChain property: The parent display name chain from the root group to the immediate + * parent. + * + * @param parentDisplayNameChain the parentDisplayNameChain value to set. + * @return the EntityInfoProperties object itself. + */ + public EntityInfoProperties withParentDisplayNameChain(List parentDisplayNameChain) { + this.parentDisplayNameChain = parentDisplayNameChain; + return this; + } + + /** + * Get the parentNameChain property: The parent name chain from the root group to the immediate parent. + * + * @return the parentNameChain value. + */ + public List parentNameChain() { + return this.parentNameChain; + } + + /** + * Set the parentNameChain property: The parent name chain from the root group to the immediate parent. + * + * @param parentNameChain the parentNameChain value to set. + * @return the EntityInfoProperties object itself. + */ + public EntityInfoProperties withParentNameChain(List parentNameChain) { + this.parentNameChain = parentNameChain; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (parent() != null) { + parent().validate(); + } + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/HierarchySettingsInner.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/HierarchySettingsInner.java new file mode 100644 index 000000000000..17a5444c50a7 --- /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.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Settings defined at the Management Group scope. */ +@Fluent +public final class HierarchySettingsInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(HierarchySettingsInner.class); + + /* + * The generic properties of hierarchy settings. + */ + @JsonProperty(value = "properties") + private HierarchySettingsProperties innerProperties; + + /** + * Get the innerProperties property: The generic properties of hierarchy settings. + * + * @return the innerProperties value. + */ + private HierarchySettingsProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the tenantId property: The AAD Tenant ID associated with the hierarchy settings. For example, + * 00000000-0000-0000-0000-000000000000. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.innerProperties() == null ? null : this.innerProperties().tenantId(); + } + + /** + * Set the tenantId property: The AAD Tenant ID associated with the hierarchy settings. For example, + * 00000000-0000-0000-0000-000000000000. + * + * @param tenantId the tenantId value to set. + * @return the HierarchySettingsInner object itself. + */ + public HierarchySettingsInner withTenantId(String tenantId) { + if (this.innerProperties() == null) { + this.innerProperties = new HierarchySettingsProperties(); + } + this.innerProperties().withTenantId(tenantId); + return this; + } + + /** + * Get the requireAuthorizationForGroupCreation property: Indicates whether RBAC access is required upon group + * creation under the root Management Group. If set to true, user will require + * Microsoft.Management/managementGroups/write action on the root Management Group scope in order to create new + * Groups directly under the root. This will prevent new users from creating new Management Groups, unless they are + * given access. + * + * @return the requireAuthorizationForGroupCreation value. + */ + public Boolean requireAuthorizationForGroupCreation() { + return this.innerProperties() == null ? null : this.innerProperties().requireAuthorizationForGroupCreation(); + } + + /** + * Set the requireAuthorizationForGroupCreation property: Indicates whether RBAC access is required upon group + * creation under the root Management Group. If set to true, user will require + * Microsoft.Management/managementGroups/write action on the root Management Group scope in order to create new + * Groups directly under the root. This will prevent new users from creating new Management Groups, unless they are + * given access. + * + * @param requireAuthorizationForGroupCreation the requireAuthorizationForGroupCreation value to set. + * @return the HierarchySettingsInner object itself. + */ + public HierarchySettingsInner withRequireAuthorizationForGroupCreation( + Boolean requireAuthorizationForGroupCreation) { + if (this.innerProperties() == null) { + this.innerProperties = new HierarchySettingsProperties(); + } + this.innerProperties().withRequireAuthorizationForGroupCreation(requireAuthorizationForGroupCreation); + return this; + } + + /** + * Get the defaultManagementGroup property: Settings that sets the default Management Group under which new + * subscriptions get added in this tenant. For example, + * /providers/Microsoft.Management/managementGroups/defaultGroup. + * + * @return the defaultManagementGroup value. + */ + public String defaultManagementGroup() { + return this.innerProperties() == null ? null : this.innerProperties().defaultManagementGroup(); + } + + /** + * Set the defaultManagementGroup property: Settings that sets the default Management Group under which new + * subscriptions get added in this tenant. For example, + * /providers/Microsoft.Management/managementGroups/defaultGroup. + * + * @param defaultManagementGroup the defaultManagementGroup value to set. + * @return the HierarchySettingsInner object itself. + */ + public HierarchySettingsInner withDefaultManagementGroup(String defaultManagementGroup) { + if (this.innerProperties() == null) { + this.innerProperties = new HierarchySettingsProperties(); + } + this.innerProperties().withDefaultManagementGroup(defaultManagementGroup); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/HierarchySettingsListInner.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/HierarchySettingsListInner.java new file mode 100644 index 000000000000..f36a56be0349 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/HierarchySettingsListInner.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.managementgroups.models.HierarchySettingsInfo; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Lists all hierarchy settings. */ +@Fluent +public final class HierarchySettingsListInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(HierarchySettingsListInner.class); + + /* + * The list of hierarchy settings. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URL to use for getting the next set of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The list of hierarchy settings. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of hierarchy settings. + * + * @param value the value value to set. + * @return the HierarchySettingsListInner object itself. + */ + public HierarchySettingsListInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URL to use for getting the next set of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/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..eae76ac90694 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/HierarchySettingsProperties.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The generic properties of hierarchy settings. */ +@Fluent +public final class HierarchySettingsProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(HierarchySettingsProperties.class); + + /* + * The AAD Tenant ID associated with the hierarchy settings. For example, + * 00000000-0000-0000-0000-000000000000 + */ + @JsonProperty(value = "tenantId") + private String tenantId; + + /* + * Indicates whether RBAC access is required upon group creation under the + * root Management Group. If set to true, user will require + * Microsoft.Management/managementGroups/write action on the root + * Management Group scope in order to create new Groups directly under the + * root. This will prevent new users from creating new Management Groups, + * unless they are given access. + */ + @JsonProperty(value = "requireAuthorizationForGroupCreation") + private Boolean requireAuthorizationForGroupCreation; + + /* + * Settings that sets the default Management Group under which new + * subscriptions get added in this tenant. For example, + * /providers/Microsoft.Management/managementGroups/defaultGroup + */ + @JsonProperty(value = "defaultManagementGroup") + private String defaultManagementGroup; + + /** + * Get the tenantId property: The AAD Tenant ID associated with the hierarchy settings. For example, + * 00000000-0000-0000-0000-000000000000. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Set the tenantId property: The AAD Tenant ID associated with the hierarchy settings. For example, + * 00000000-0000-0000-0000-000000000000. + * + * @param tenantId the tenantId value to set. + * @return the HierarchySettingsProperties object itself. + */ + public HierarchySettingsProperties withTenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Get the requireAuthorizationForGroupCreation property: Indicates whether RBAC access is required upon group + * creation under the root Management Group. If set to true, user will require + * Microsoft.Management/managementGroups/write action on the root Management Group scope in order to create new + * Groups directly under the root. This will prevent new users from creating new Management Groups, unless they are + * given access. + * + * @return the requireAuthorizationForGroupCreation value. + */ + public Boolean requireAuthorizationForGroupCreation() { + return this.requireAuthorizationForGroupCreation; + } + + /** + * Set the requireAuthorizationForGroupCreation property: Indicates whether RBAC access is required upon group + * creation under the root Management Group. If set to true, user will require + * Microsoft.Management/managementGroups/write action on the root Management Group scope in order to create new + * Groups directly under the root. This will prevent new users from creating new Management Groups, unless they are + * given access. + * + * @param requireAuthorizationForGroupCreation the requireAuthorizationForGroupCreation value to set. + * @return the HierarchySettingsProperties object itself. + */ + public HierarchySettingsProperties withRequireAuthorizationForGroupCreation( + Boolean requireAuthorizationForGroupCreation) { + this.requireAuthorizationForGroupCreation = requireAuthorizationForGroupCreation; + return this; + } + + /** + * Get the defaultManagementGroup property: Settings that sets the default Management Group under which new + * subscriptions get added in this tenant. For example, + * /providers/Microsoft.Management/managementGroups/defaultGroup. + * + * @return the defaultManagementGroup value. + */ + public String defaultManagementGroup() { + return this.defaultManagementGroup; + } + + /** + * Set the defaultManagementGroup property: Settings that sets the default Management Group under which new + * subscriptions get added in this tenant. For example, + * /providers/Microsoft.Management/managementGroups/defaultGroup. + * + * @param defaultManagementGroup the defaultManagementGroup value to set. + * @return the HierarchySettingsProperties object itself. + */ + public HierarchySettingsProperties withDefaultManagementGroup(String defaultManagementGroup) { + this.defaultManagementGroup = defaultManagementGroup; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/ManagementGroupInfoInner.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/ManagementGroupInfoInner.java new file mode 100644 index 000000000000..05b6a2e8a5ca --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/ManagementGroupInfoInner.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.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The management group resource. */ +@Fluent +public final class ManagementGroupInfoInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagementGroupInfoInner.class); + + /* + * The fully qualified ID for the management group. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * The type of the resource. For example, + * Microsoft.Management/managementGroups + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * The name of the management group. For example, + * 00000000-0000-0000-0000-000000000000 + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The generic properties of a management group. + */ + @JsonProperty(value = "properties") + private ManagementGroupInfoProperties innerProperties; + + /** + * Get the id property: The fully qualified ID for the management group. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the type property: The type of the resource. For example, Microsoft.Management/managementGroups. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the management group. For example, 00000000-0000-0000-0000-000000000000. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the innerProperties property: The generic properties of a management group. + * + * @return the innerProperties value. + */ + private ManagementGroupInfoProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the tenantId property: The AAD Tenant ID associated with the management group. For example, + * 00000000-0000-0000-0000-000000000000. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.innerProperties() == null ? null : this.innerProperties().tenantId(); + } + + /** + * Set the tenantId property: The AAD Tenant ID associated with the management group. For example, + * 00000000-0000-0000-0000-000000000000. + * + * @param tenantId the tenantId value to set. + * @return the ManagementGroupInfoInner object itself. + */ + public ManagementGroupInfoInner withTenantId(String tenantId) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagementGroupInfoProperties(); + } + this.innerProperties().withTenantId(tenantId); + return this; + } + + /** + * Get the displayName property: The friendly name of the management group. + * + * @return the displayName value. + */ + public String displayName() { + return this.innerProperties() == null ? null : this.innerProperties().displayName(); + } + + /** + * Set the displayName property: The friendly name of the management group. + * + * @param displayName the displayName value to set. + * @return the ManagementGroupInfoInner object itself. + */ + public ManagementGroupInfoInner withDisplayName(String displayName) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagementGroupInfoProperties(); + } + this.innerProperties().withDisplayName(displayName); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/ManagementGroupInfoProperties.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/ManagementGroupInfoProperties.java new file mode 100644 index 000000000000..ba320afe9ebe --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/ManagementGroupInfoProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The generic properties of a management group. */ +@Fluent +public final class ManagementGroupInfoProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagementGroupInfoProperties.class); + + /* + * The AAD Tenant ID associated with the management group. For example, + * 00000000-0000-0000-0000-000000000000 + */ + @JsonProperty(value = "tenantId") + private String tenantId; + + /* + * The friendly name of the management group. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * Get the tenantId property: The AAD Tenant ID associated with the management group. For example, + * 00000000-0000-0000-0000-000000000000. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Set the tenantId property: The AAD Tenant ID associated with the management group. For example, + * 00000000-0000-0000-0000-000000000000. + * + * @param tenantId the tenantId value to set. + * @return the ManagementGroupInfoProperties object itself. + */ + public ManagementGroupInfoProperties withTenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Get the displayName property: The friendly name of the management group. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The friendly name of the management group. + * + * @param displayName the displayName value to set. + * @return the ManagementGroupInfoProperties object itself. + */ + public ManagementGroupInfoProperties withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/ManagementGroupInner.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/ManagementGroupInner.java new file mode 100644 index 000000000000..7e1cdd435a0d --- /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.core.util.logging.ClientLogger; +import com.azure.resourcemanager.managementgroups.models.ManagementGroupChildInfo; +import com.azure.resourcemanager.managementgroups.models.ManagementGroupDetails; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The management group details. */ +@Fluent +public final class ManagementGroupInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagementGroupInner.class); + + /* + * The generic properties of a management group. + */ + @JsonProperty(value = "properties") + private ManagementGroupProperties innerProperties; + + /** + * Get the innerProperties property: The generic properties of a management group. + * + * @return the innerProperties value. + */ + private ManagementGroupProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the tenantId property: The AAD Tenant ID associated with the management group. For example, + * 00000000-0000-0000-0000-000000000000. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.innerProperties() == null ? null : this.innerProperties().tenantId(); + } + + /** + * Set the tenantId property: The AAD Tenant ID associated with the management group. For example, + * 00000000-0000-0000-0000-000000000000. + * + * @param tenantId the tenantId value to set. + * @return the ManagementGroupInner object itself. + */ + public ManagementGroupInner withTenantId(String tenantId) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagementGroupProperties(); + } + this.innerProperties().withTenantId(tenantId); + return this; + } + + /** + * Get the displayName property: The friendly name of the management group. + * + * @return the displayName value. + */ + public String displayName() { + return this.innerProperties() == null ? null : this.innerProperties().displayName(); + } + + /** + * Set the displayName property: The friendly name of the management group. + * + * @param displayName the displayName value to set. + * @return the ManagementGroupInner object itself. + */ + public ManagementGroupInner withDisplayName(String displayName) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagementGroupProperties(); + } + this.innerProperties().withDisplayName(displayName); + return this; + } + + /** + * Get the details property: The details of a management group. + * + * @return the details value. + */ + public ManagementGroupDetails details() { + return this.innerProperties() == null ? null : this.innerProperties().details(); + } + + /** + * Set the details property: The details of a management group. + * + * @param details the details value to set. + * @return the ManagementGroupInner object itself. + */ + public ManagementGroupInner withDetails(ManagementGroupDetails details) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagementGroupProperties(); + } + this.innerProperties().withDetails(details); + return this; + } + + /** + * Get the children property: The list of children. + * + * @return the children value. + */ + public List children() { + return this.innerProperties() == null ? null : this.innerProperties().children(); + } + + /** + * Set the children property: The list of children. + * + * @param children the children value to set. + * @return the ManagementGroupInner object itself. + */ + public ManagementGroupInner withChildren(List children) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagementGroupProperties(); + } + this.innerProperties().withChildren(children); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/ManagementGroupProperties.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/ManagementGroupProperties.java new file mode 100644 index 000000000000..29885ca80440 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/ManagementGroupProperties.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.util.logging.ClientLogger; +import com.azure.resourcemanager.managementgroups.models.ManagementGroupChildInfo; +import com.azure.resourcemanager.managementgroups.models.ManagementGroupDetails; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The generic properties of a management group. */ +@Fluent +public final class ManagementGroupProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagementGroupProperties.class); + + /* + * The AAD Tenant ID associated with the management group. For example, + * 00000000-0000-0000-0000-000000000000 + */ + @JsonProperty(value = "tenantId") + private String tenantId; + + /* + * The friendly name of the management group. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /* + * The details of a management group. + */ + @JsonProperty(value = "details") + private ManagementGroupDetails details; + + /* + * The list of children. + */ + @JsonProperty(value = "children") + private List children; + + /** + * Get the tenantId property: The AAD Tenant ID associated with the management group. For example, + * 00000000-0000-0000-0000-000000000000. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Set the tenantId property: The AAD Tenant ID associated with the management group. For example, + * 00000000-0000-0000-0000-000000000000. + * + * @param tenantId the tenantId value to set. + * @return the ManagementGroupProperties object itself. + */ + public ManagementGroupProperties withTenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Get the displayName property: The friendly name of the management group. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The friendly name of the management group. + * + * @param displayName the displayName value to set. + * @return the ManagementGroupProperties object itself. + */ + public ManagementGroupProperties withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the details property: The details of a management group. + * + * @return the details value. + */ + public ManagementGroupDetails details() { + return this.details; + } + + /** + * Set the details property: The details of a management group. + * + * @param details the details value to set. + * @return the ManagementGroupProperties object itself. + */ + public ManagementGroupProperties withDetails(ManagementGroupDetails details) { + this.details = details; + return this; + } + + /** + * Get the children property: The list of children. + * + * @return the children value. + */ + public List children() { + return this.children; + } + + /** + * Set the children property: The list of children. + * + * @param children the children value to set. + * @return the ManagementGroupProperties object itself. + */ + public ManagementGroupProperties withChildren(List children) { + this.children = children; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (details() != null) { + details().validate(); + } + if (children() != null) { + children().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/OperationInner.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/OperationInner.java new file mode 100644 index 000000000000..9f87c381a1b9 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/OperationInner.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.managementgroups.models.OperationDisplayProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Operation supported by the Microsoft.Management resource provider. */ +@Fluent +public final class OperationInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationInner.class); + + /* + * Operation name: {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The object that represents the operation. + */ + @JsonProperty(value = "display") + private OperationDisplayProperties display; + + /** + * Get the name property: Operation name: {provider}/{resource}/{operation}. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the display property: The object that represents the operation. + * + * @return the display value. + */ + public OperationDisplayProperties display() { + return this.display; + } + + /** + * Set the display property: The object that represents the operation. + * + * @param display the display value to set. + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplayProperties display) { + this.display = display; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/SubscriptionUnderManagementGroupInner.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/SubscriptionUnderManagementGroupInner.java new file mode 100644 index 000000000000..5e0bd6eafa3f --- /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.core.util.logging.ClientLogger; +import com.azure.resourcemanager.managementgroups.models.DescendantParentGroupInfo; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The details of subscription under management group. */ +@Fluent +public final class SubscriptionUnderManagementGroupInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SubscriptionUnderManagementGroupInner.class); + + /* + * The generic properties of subscription under a management group. + */ + @JsonProperty(value = "properties") + private SubscriptionUnderManagementGroupProperties innerProperties; + + /** + * Get the innerProperties property: The generic properties of subscription under a management group. + * + * @return the innerProperties value. + */ + private SubscriptionUnderManagementGroupProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the tenant property: The AAD Tenant ID associated with the subscription. For example, + * 00000000-0000-0000-0000-000000000000. + * + * @return the tenant value. + */ + public String tenant() { + return this.innerProperties() == null ? null : this.innerProperties().tenant(); + } + + /** + * Set the tenant property: The AAD Tenant ID associated with the subscription. For example, + * 00000000-0000-0000-0000-000000000000. + * + * @param tenant the tenant value to set. + * @return the SubscriptionUnderManagementGroupInner object itself. + */ + public SubscriptionUnderManagementGroupInner withTenant(String tenant) { + if (this.innerProperties() == null) { + this.innerProperties = new SubscriptionUnderManagementGroupProperties(); + } + this.innerProperties().withTenant(tenant); + return this; + } + + /** + * Get the displayName property: The friendly name of the subscription. + * + * @return the displayName value. + */ + public String displayName() { + return this.innerProperties() == null ? null : this.innerProperties().displayName(); + } + + /** + * Set the displayName property: The friendly name of the subscription. + * + * @param displayName the displayName value to set. + * @return the SubscriptionUnderManagementGroupInner object itself. + */ + public SubscriptionUnderManagementGroupInner withDisplayName(String displayName) { + if (this.innerProperties() == null) { + this.innerProperties = new SubscriptionUnderManagementGroupProperties(); + } + this.innerProperties().withDisplayName(displayName); + return this; + } + + /** + * Get the parent property: The ID of the parent management group. + * + * @return the parent value. + */ + public DescendantParentGroupInfo parent() { + return this.innerProperties() == null ? null : this.innerProperties().parent(); + } + + /** + * Set the parent property: The ID of the parent management group. + * + * @param parent the parent value to set. + * @return the SubscriptionUnderManagementGroupInner object itself. + */ + public SubscriptionUnderManagementGroupInner withParent(DescendantParentGroupInfo parent) { + if (this.innerProperties() == null) { + this.innerProperties = new SubscriptionUnderManagementGroupProperties(); + } + this.innerProperties().withParent(parent); + return this; + } + + /** + * Get the state property: The state of the subscription. + * + * @return the state value. + */ + public String state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Set the state property: The state of the subscription. + * + * @param state the state value to set. + * @return the SubscriptionUnderManagementGroupInner object itself. + */ + public SubscriptionUnderManagementGroupInner withState(String state) { + if (this.innerProperties() == null) { + this.innerProperties = new SubscriptionUnderManagementGroupProperties(); + } + this.innerProperties().withState(state); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/SubscriptionUnderManagementGroupProperties.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/SubscriptionUnderManagementGroupProperties.java new file mode 100644 index 000000000000..6a11182e6d22 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/SubscriptionUnderManagementGroupProperties.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.managementgroups.models.DescendantParentGroupInfo; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The generic properties of subscription under a management group. */ +@Fluent +public final class SubscriptionUnderManagementGroupProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SubscriptionUnderManagementGroupProperties.class); + + /* + * The AAD Tenant ID associated with the subscription. For example, + * 00000000-0000-0000-0000-000000000000 + */ + @JsonProperty(value = "tenant") + private String tenant; + + /* + * The friendly name of the subscription. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /* + * The ID of the parent management group. + */ + @JsonProperty(value = "parent") + private DescendantParentGroupInfo parent; + + /* + * The state of the subscription. + */ + @JsonProperty(value = "state") + private String state; + + /** + * Get the tenant property: The AAD Tenant ID associated with the subscription. For example, + * 00000000-0000-0000-0000-000000000000. + * + * @return the tenant value. + */ + public String tenant() { + return this.tenant; + } + + /** + * Set the tenant property: The AAD Tenant ID associated with the subscription. For example, + * 00000000-0000-0000-0000-000000000000. + * + * @param tenant the tenant value to set. + * @return the SubscriptionUnderManagementGroupProperties object itself. + */ + public SubscriptionUnderManagementGroupProperties withTenant(String tenant) { + this.tenant = tenant; + return this; + } + + /** + * Get the displayName property: The friendly name of the subscription. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The friendly name of the subscription. + * + * @param displayName the displayName value to set. + * @return the SubscriptionUnderManagementGroupProperties object itself. + */ + public SubscriptionUnderManagementGroupProperties withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the parent property: The ID of the parent management group. + * + * @return the parent value. + */ + public DescendantParentGroupInfo parent() { + return this.parent; + } + + /** + * Set the parent property: The ID of the parent management group. + * + * @param parent the parent value to set. + * @return the SubscriptionUnderManagementGroupProperties object itself. + */ + public SubscriptionUnderManagementGroupProperties withParent(DescendantParentGroupInfo parent) { + this.parent = parent; + return this; + } + + /** + * Get the state property: The state of the subscription. + * + * @return the state value. + */ + public String state() { + return this.state; + } + + /** + * Set the state property: The state of the subscription. + * + * @param state the state value to set. + * @return the SubscriptionUnderManagementGroupProperties object itself. + */ + public SubscriptionUnderManagementGroupProperties withState(String state) { + this.state = state; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (parent() != null) { + parent().validate(); + } + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/TenantBackfillStatusResultInner.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/TenantBackfillStatusResultInner.java new file mode 100644 index 000000000000..ebe015201874 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/TenantBackfillStatusResultInner.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.managementgroups.models.Status; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The tenant backfill status. */ +@Immutable +public final class TenantBackfillStatusResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TenantBackfillStatusResultInner.class); + + /* + * The AAD Tenant ID associated with the management group. For example, + * 00000000-0000-0000-0000-000000000000 + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /* + * The status of the Tenant Backfill + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private Status status; + + /** + * Get the tenantId property: The AAD Tenant ID associated with the management group. For example, + * 00000000-0000-0000-0000-000000000000. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the status property: The status of the Tenant Backfill. + * + * @return the status value. + */ + public Status status() { + return this.status; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/package-info.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/package-info.java new file mode 100644 index 000000000000..5b25f5ab9f57 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/models/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the inner data models for ManagementGroupsApi. The Azure Management Groups API enables + * consolidation of multiple subscriptions/resources into an organizational hierarchy and centrally manage access + * control, policies, alerting and reporting for those resources. + */ +package com.azure.resourcemanager.managementgroups.fluent.models; diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/package-info.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/package-info.java new file mode 100644 index 000000000000..2909a5acb010 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/fluent/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the service clients for ManagementGroupsApi. The Azure Management Groups API enables consolidation + * of multiple subscriptions/resources into an organizational hierarchy and centrally manage access control, policies, + * alerting and reporting for those resources. + */ +package com.azure.resourcemanager.managementgroups.fluent; diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/AzureAsyncOperationResultsImpl.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/AzureAsyncOperationResultsImpl.java new file mode 100644 index 000000000000..5ff1ad0b0290 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/AzureAsyncOperationResultsImpl.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.implementation; + +import com.azure.resourcemanager.managementgroups.fluent.models.AzureAsyncOperationResultsInner; +import com.azure.resourcemanager.managementgroups.models.AzureAsyncOperationResults; + +public final class AzureAsyncOperationResultsImpl implements AzureAsyncOperationResults { + private AzureAsyncOperationResultsInner innerObject; + + private final com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager; + + AzureAsyncOperationResultsImpl( + AzureAsyncOperationResultsInner innerObject, + com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String type() { + return this.innerModel().type(); + } + + public String name() { + return this.innerModel().name(); + } + + public String status() { + return this.innerModel().status(); + } + + public String tenantId() { + return this.innerModel().tenantId(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public AzureAsyncOperationResultsInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/CheckNameAvailabilityResultImpl.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/CheckNameAvailabilityResultImpl.java new file mode 100644 index 000000000000..5efb9a2e70fe --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/CheckNameAvailabilityResultImpl.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.implementation; + +import com.azure.resourcemanager.managementgroups.fluent.models.CheckNameAvailabilityResultInner; +import com.azure.resourcemanager.managementgroups.models.CheckNameAvailabilityResult; +import com.azure.resourcemanager.managementgroups.models.Reason; + +public final class CheckNameAvailabilityResultImpl implements CheckNameAvailabilityResult { + private CheckNameAvailabilityResultInner innerObject; + + private final com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager; + + CheckNameAvailabilityResultImpl( + CheckNameAvailabilityResultInner innerObject, + com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public Boolean nameAvailable() { + return this.innerModel().nameAvailable(); + } + + public Reason reason() { + return this.innerModel().reason(); + } + + public String message() { + return this.innerModel().message(); + } + + public CheckNameAvailabilityResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/DescendantInfoImpl.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/DescendantInfoImpl.java new file mode 100644 index 000000000000..b36cb664a6bb --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/DescendantInfoImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.implementation; + +import com.azure.resourcemanager.managementgroups.fluent.models.DescendantInfoInner; +import com.azure.resourcemanager.managementgroups.models.DescendantInfo; +import com.azure.resourcemanager.managementgroups.models.DescendantParentGroupInfo; + +public final class DescendantInfoImpl implements DescendantInfo { + private DescendantInfoInner innerObject; + + private final com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager; + + DescendantInfoImpl( + DescendantInfoInner innerObject, + com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String type() { + return this.innerModel().type(); + } + + public String name() { + return this.innerModel().name(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public DescendantParentGroupInfo parent() { + return this.innerModel().parent(); + } + + public DescendantInfoInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/EntitiesClientImpl.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/EntitiesClientImpl.java new file mode 100644 index 000000000000..b6f4cf90be72 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/EntitiesClientImpl.java @@ -0,0 +1,558 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.managementgroups.fluent.EntitiesClient; +import com.azure.resourcemanager.managementgroups.fluent.models.EntityInfoInner; +import com.azure.resourcemanager.managementgroups.models.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 { + private final ClientLogger logger = new ClientLogger(EntitiesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final EntitiesService service; + + /** The service client containing this operation class. */ + private final ManagementGroupsApiImpl client; + + /** + * Initializes an instance of EntitiesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + EntitiesClientImpl(ManagementGroupsApiImpl client) { + this.service = RestProxy.create(EntitiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ManagementGroupsApiEntities to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ManagementGroupsApiE") + private interface EntitiesService { + @Headers({"Content-Type: application/json"}) + @Post("/providers/Microsoft.Management/getEntities") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @QueryParam("$skiptoken") String skiptoken, + @QueryParam("$skip") Integer skip, + @QueryParam("$top") Integer top, + @QueryParam("$select") String select, + @QueryParam("$search") 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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String skiptoken, + Integer skip, + Integer top, + String select, + EntitySearchType search, + String filter, + EntityViewParameterType view, + String groupName, + String cacheControl, + Context context) { + return new PagedIterable<>( + listAsync(skiptoken, skip, top, select, search, filter, view, groupName, cacheControl, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to view entities along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, String cacheControl) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listNext(nextLink, this.client.getEndpoint(), cacheControl, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to view entities along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync( + String nextLink, String cacheControl, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), cacheControl, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/EntitiesImpl.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/EntitiesImpl.java new file mode 100644 index 000000000000..d41c511df778 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/EntitiesImpl.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.managementgroups.fluent.EntitiesClient; +import com.azure.resourcemanager.managementgroups.fluent.models.EntityInfoInner; +import com.azure.resourcemanager.managementgroups.models.Entities; +import com.azure.resourcemanager.managementgroups.models.EntityInfo; +import com.azure.resourcemanager.managementgroups.models.EntitySearchType; +import com.azure.resourcemanager.managementgroups.models.EntityViewParameterType; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class EntitiesImpl implements Entities { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EntitiesImpl.class); + + private final EntitiesClient innerClient; + + private final com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager; + + public EntitiesImpl( + EntitiesClient innerClient, com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new EntityInfoImpl(inner1, this.manager())); + } + + public PagedIterable list( + String skiptoken, + Integer skip, + Integer top, + String select, + 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..945036224578 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/HierarchySettingsOperationsClientImpl.java @@ -0,0 +1,736 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.managementgroups.fluent.HierarchySettingsOperationsClient; +import com.azure.resourcemanager.managementgroups.fluent.models.HierarchySettingsInner; +import com.azure.resourcemanager.managementgroups.fluent.models.HierarchySettingsListInner; +import com.azure.resourcemanager.managementgroups.models.CreateOrUpdateSettingsRequest; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in HierarchySettingsOperationsClient. */ +public final class HierarchySettingsOperationsClientImpl implements HierarchySettingsOperationsClient { + private final ClientLogger logger = new ClientLogger(HierarchySettingsOperationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final HierarchySettingsOperationsService service; + + /** The service client containing this operation class. */ + private final ManagementGroupsApiImpl client; + + /** + * Initializes an instance of HierarchySettingsOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + HierarchySettingsOperationsClientImpl(ManagementGroupsApiImpl client) { + this.service = + RestProxy + .create( + HierarchySettingsOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ManagementGroupsApiHierarchySettingsOperations to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ManagementGroupsApiH") + private interface HierarchySettingsOperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Management/managementGroups/{groupId}/settings") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("groupId") String groupId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Management/managementGroups/{groupId}/settings/default") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("groupId") String groupId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put("/providers/Microsoft.Management/managementGroups/{groupId}/settings/default") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("groupId") String groupId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") CreateOrUpdateSettingsRequest createTenantSettingsRequest, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch("/providers/Microsoft.Management/managementGroups/{groupId}/settings/default") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("groupId") String groupId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") CreateOrUpdateSettingsRequest createTenantSettingsRequest, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete("/providers/Microsoft.Management/managementGroups/{groupId}/settings/default") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("groupId") String groupId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets all the hierarchy settings defined at the Management Group level. Settings can only be set on the root + * Management Group of the hierarchy. + * + * @param groupId Management Group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the hierarchy settings defined at the Management Group level 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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets all the hierarchy settings defined at the Management Group level. Settings can only be set on the root + * Management Group of the hierarchy. + * + * @param groupId Management Group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the hierarchy settings defined at the Management Group level. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public HierarchySettingsListInner list(String groupId) { + return listAsync(groupId).block(); + } + + /** + * Gets all the hierarchy settings defined at the Management Group level. Settings can only be set on the root + * Management Group of the hierarchy. + * + * @param groupId Management Group ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the hierarchy settings defined at the Management Group level along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse(String groupId, Context context) { + return listWithResponseAsync(groupId, context).block(); + } + + /** + * Gets the hierarchy settings defined at the Management Group level. Settings can only be set on the root + * Management Group of the hierarchy. + * + * @param groupId Management Group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the hierarchy settings defined at the Management Group level along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String groupId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service.get(this.client.getEndpoint(), groupId, this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the hierarchy settings defined at the Management Group level. Settings can only be set on the root + * Management Group of the hierarchy. + * + * @param groupId Management Group ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the hierarchy settings defined at the Management Group level along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String groupId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), groupId, this.client.getApiVersion(), accept, context); + } + + /** + * Gets the hierarchy settings defined at the Management Group level. Settings can only be set on the root + * Management Group of the hierarchy. + * + * @param groupId Management Group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the hierarchy settings defined at the Management Group level on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String groupId) { + return getWithResponseAsync(groupId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the hierarchy settings defined at the Management Group level. Settings can only be set on the root + * Management Group of the hierarchy. + * + * @param groupId Management Group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the hierarchy settings defined at the Management Group level. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public HierarchySettingsInner get(String groupId) { + return getAsync(groupId).block(); + } + + /** + * Gets the hierarchy settings defined at the Management Group level. Settings can only be set on the root + * Management Group of the hierarchy. + * + * @param groupId Management Group ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the hierarchy settings defined at the Management Group level along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String groupId, Context context) { + return getWithResponseAsync(groupId, context).block(); + } + + /** + * Creates or updates the hierarchy settings defined at the Management Group level. + * + * @param groupId Management Group ID. + * @param createTenantSettingsRequest Tenant level settings request parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return settings defined at the Management Group scope along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String groupId, CreateOrUpdateSettingsRequest createTenantSettingsRequest) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + if (createTenantSettingsRequest == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createTenantSettingsRequest is required and cannot be null.")); + } else { + createTenantSettingsRequest.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + groupId, + this.client.getApiVersion(), + createTenantSettingsRequest, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates the hierarchy settings defined at the Management Group level. + * + * @param groupId Management Group ID. + * @param createTenantSettingsRequest Tenant level settings request parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return settings defined at the Management Group scope along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String groupId, CreateOrUpdateSettingsRequest createTenantSettingsRequest, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + if (createTenantSettingsRequest == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createTenantSettingsRequest is required and cannot be null.")); + } else { + createTenantSettingsRequest.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + groupId, + this.client.getApiVersion(), + createTenantSettingsRequest, + accept, + context); + } + + /** + * Creates or updates the hierarchy settings defined at the Management Group level. + * + * @param groupId Management Group ID. + * @param createTenantSettingsRequest Tenant level settings request parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return settings defined at the Management Group scope on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String groupId, CreateOrUpdateSettingsRequest createTenantSettingsRequest) { + return createOrUpdateWithResponseAsync(groupId, createTenantSettingsRequest) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates or updates the hierarchy settings defined at the Management Group level. + * + * @param groupId Management Group ID. + * @param createTenantSettingsRequest Tenant level settings request parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return settings defined at the Management Group scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public HierarchySettingsInner createOrUpdate( + String groupId, CreateOrUpdateSettingsRequest createTenantSettingsRequest) { + return createOrUpdateAsync(groupId, createTenantSettingsRequest).block(); + } + + /** + * Creates or updates the hierarchy settings defined at the Management Group level. + * + * @param groupId Management Group ID. + * @param createTenantSettingsRequest Tenant level settings request parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return settings defined at the Management Group scope along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String groupId, CreateOrUpdateSettingsRequest createTenantSettingsRequest, Context context) { + return createOrUpdateWithResponseAsync(groupId, createTenantSettingsRequest, context).block(); + } + + /** + * Updates the hierarchy settings defined at the Management Group level. + * + * @param groupId Management Group ID. + * @param createTenantSettingsRequest Tenant level settings request parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return settings defined at the Management Group scope along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String groupId, CreateOrUpdateSettingsRequest createTenantSettingsRequest) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + if (createTenantSettingsRequest == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createTenantSettingsRequest is required and cannot be null.")); + } else { + createTenantSettingsRequest.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + groupId, + this.client.getApiVersion(), + createTenantSettingsRequest, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates the hierarchy settings defined at the Management Group level. + * + * @param groupId Management Group ID. + * @param createTenantSettingsRequest Tenant level settings request parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return settings defined at the Management Group scope along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String groupId, CreateOrUpdateSettingsRequest createTenantSettingsRequest, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + if (createTenantSettingsRequest == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createTenantSettingsRequest is required and cannot be null.")); + } else { + createTenantSettingsRequest.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + groupId, + this.client.getApiVersion(), + createTenantSettingsRequest, + accept, + context); + } + + /** + * Updates the hierarchy settings defined at the Management Group level. + * + * @param groupId Management Group ID. + * @param createTenantSettingsRequest Tenant level settings request parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return settings defined at the Management Group scope on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String groupId, CreateOrUpdateSettingsRequest createTenantSettingsRequest) { + return updateWithResponseAsync(groupId, createTenantSettingsRequest) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Updates the hierarchy settings defined at the Management Group level. + * + * @param groupId Management Group ID. + * @param createTenantSettingsRequest Tenant level settings request parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return settings defined at the Management Group scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public HierarchySettingsInner update(String groupId, CreateOrUpdateSettingsRequest createTenantSettingsRequest) { + return updateAsync(groupId, createTenantSettingsRequest).block(); + } + + /** + * Updates the hierarchy settings defined at the Management Group level. + * + * @param groupId Management Group ID. + * @param createTenantSettingsRequest Tenant level settings request parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return settings defined at the Management Group scope along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String groupId, CreateOrUpdateSettingsRequest createTenantSettingsRequest, Context context) { + return updateWithResponseAsync(groupId, createTenantSettingsRequest, context).block(); + } + + /** + * Deletes the hierarchy settings defined at the Management Group level. + * + * @param groupId Management Group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String groupId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service.delete(this.client.getEndpoint(), groupId, this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the hierarchy settings defined at the Management Group level. + * + * @param groupId Management Group ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String groupId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), groupId, this.client.getApiVersion(), accept, context); + } + + /** + * Deletes the hierarchy settings defined at the Management Group level. + * + * @param groupId Management Group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String groupId) { + return deleteWithResponseAsync(groupId).flatMap((Response res) -> Mono.empty()); + } + + /** + * Deletes the hierarchy settings defined at the Management Group level. + * + * @param groupId Management Group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String groupId) { + deleteAsync(groupId).block(); + } + + /** + * Deletes the hierarchy settings defined at the Management Group level. + * + * @param groupId Management Group ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String groupId, Context context) { + return deleteWithResponseAsync(groupId, context).block(); + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/HierarchySettingsOperationsImpl.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/HierarchySettingsOperationsImpl.java new file mode 100644 index 000000000000..0f00e3642b1a --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/HierarchySettingsOperationsImpl.java @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.managementgroups.fluent.HierarchySettingsOperationsClient; +import com.azure.resourcemanager.managementgroups.fluent.models.HierarchySettingsInner; +import com.azure.resourcemanager.managementgroups.fluent.models.HierarchySettingsListInner; +import com.azure.resourcemanager.managementgroups.models.CreateOrUpdateSettingsRequest; +import com.azure.resourcemanager.managementgroups.models.HierarchySettings; +import com.azure.resourcemanager.managementgroups.models.HierarchySettingsList; +import com.azure.resourcemanager.managementgroups.models.HierarchySettingsOperations; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class HierarchySettingsOperationsImpl implements HierarchySettingsOperations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(HierarchySettingsOperationsImpl.class); + + private final HierarchySettingsOperationsClient innerClient; + + private final com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager; + + public HierarchySettingsOperationsImpl( + HierarchySettingsOperationsClient innerClient, + com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public HierarchySettingsList list(String groupId) { + HierarchySettingsListInner inner = this.serviceClient().list(groupId); + if (inner != null) { + return new HierarchySettingsListImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listWithResponse(String groupId, Context context) { + Response inner = this.serviceClient().listWithResponse(groupId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new HierarchySettingsListImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public HierarchySettings get(String groupId) { + HierarchySettingsInner inner = this.serviceClient().get(groupId); + if (inner != null) { + return new HierarchySettingsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String groupId, Context context) { + Response inner = this.serviceClient().getWithResponse(groupId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new HierarchySettingsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public HierarchySettings createOrUpdate(String groupId, CreateOrUpdateSettingsRequest createTenantSettingsRequest) { + HierarchySettingsInner inner = this.serviceClient().createOrUpdate(groupId, createTenantSettingsRequest); + if (inner != null) { + return new HierarchySettingsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response createOrUpdateWithResponse( + String groupId, CreateOrUpdateSettingsRequest createTenantSettingsRequest, Context context) { + Response inner = + this.serviceClient().createOrUpdateWithResponse(groupId, createTenantSettingsRequest, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new HierarchySettingsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public HierarchySettings update(String groupId, CreateOrUpdateSettingsRequest createTenantSettingsRequest) { + HierarchySettingsInner inner = this.serviceClient().update(groupId, createTenantSettingsRequest); + if (inner != null) { + return new HierarchySettingsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response updateWithResponse( + String groupId, CreateOrUpdateSettingsRequest createTenantSettingsRequest, Context context) { + Response inner = + this.serviceClient().updateWithResponse(groupId, createTenantSettingsRequest, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new HierarchySettingsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String groupId) { + this.serviceClient().delete(groupId); + } + + public Response deleteWithResponse(String groupId, Context context) { + return this.serviceClient().deleteWithResponse(groupId, context); + } + + private HierarchySettingsOperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupImpl.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupImpl.java new file mode 100644 index 000000000000..9aabedc0bca5 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupImpl.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.implementation; + +import com.azure.resourcemanager.managementgroups.fluent.models.ManagementGroupInner; +import com.azure.resourcemanager.managementgroups.models.ManagementGroup; +import com.azure.resourcemanager.managementgroups.models.ManagementGroupChildInfo; +import com.azure.resourcemanager.managementgroups.models.ManagementGroupDetails; +import java.util.Collections; +import java.util.List; + +public final class ManagementGroupImpl implements ManagementGroup { + private ManagementGroupInner innerObject; + + private final com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager; + + ManagementGroupImpl( + ManagementGroupInner innerObject, + com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String tenantId() { + return this.innerModel().tenantId(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public ManagementGroupDetails details() { + return this.innerModel().details(); + } + + public List children() { + List inner = this.innerModel().children(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ManagementGroupInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupInfoImpl.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupInfoImpl.java new file mode 100644 index 000000000000..2850fc7e8cae --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupInfoImpl.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.implementation; + +import com.azure.resourcemanager.managementgroups.fluent.models.ManagementGroupInfoInner; +import com.azure.resourcemanager.managementgroups.models.ManagementGroupInfo; + +public final class ManagementGroupInfoImpl implements ManagementGroupInfo { + private ManagementGroupInfoInner innerObject; + + private final com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager; + + ManagementGroupInfoImpl( + ManagementGroupInfoInner innerObject, + com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String type() { + return this.innerModel().type(); + } + + public String name() { + return this.innerModel().name(); + } + + public String tenantId() { + return this.innerModel().tenantId(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public ManagementGroupInfoInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupSubscriptionsClientImpl.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupSubscriptionsClientImpl.java new file mode 100644 index 000000000000..41932af06aae --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupSubscriptionsClientImpl.java @@ -0,0 +1,882 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.implementation; + +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.managementgroups.fluent.ManagementGroupSubscriptionsClient; +import com.azure.resourcemanager.managementgroups.fluent.models.SubscriptionUnderManagementGroupInner; +import com.azure.resourcemanager.managementgroups.models.ListSubscriptionUnderManagementGroup; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ManagementGroupSubscriptionsClient. */ +public final class ManagementGroupSubscriptionsClientImpl implements ManagementGroupSubscriptionsClient { + private final ClientLogger logger = new ClientLogger(ManagementGroupSubscriptionsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ManagementGroupSubscriptionsService service; + + /** The service client containing this operation class. */ + private final ManagementGroupsApiImpl client; + + /** + * Initializes an instance of ManagementGroupSubscriptionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagementGroupSubscriptionsClientImpl(ManagementGroupsApiImpl client) { + this.service = + RestProxy + .create( + ManagementGroupSubscriptionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ManagementGroupsApiManagementGroupSubscriptions to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ManagementGroupsApiM") + private interface ManagementGroupSubscriptionsService { + @Headers({"Content-Type: application/json"}) + @Put("/providers/Microsoft.Management/managementGroups/{groupId}/subscriptions/{subscriptionId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create( + @HostParam("$host") String endpoint, + @PathParam("groupId") String groupId, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Cache-Control") String cacheControl, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete("/providers/Microsoft.Management/managementGroups/{groupId}/subscriptions/{subscriptionId}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("groupId") String groupId, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Cache-Control") String cacheControl, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Management/managementGroups/{groupId}/subscriptions/{subscriptionId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getSubscription( + @HostParam("$host") String endpoint, + @PathParam("groupId") String groupId, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Cache-Control") String cacheControl, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Management/managementGroups/{groupId}/subscriptions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getSubscriptionsUnderManagementGroup( + @HostParam("$host") String endpoint, + @PathParam("groupId") String groupId, + @QueryParam("api-version") String apiVersion, + @QueryParam("$skiptoken") String skiptoken, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getSubscriptionsUnderManagementGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Associates existing subscription with the management group. + * + * @param groupId Management Group ID. + * @param subscriptionId Subscription ID. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of subscription under management group along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String groupId, String subscriptionId, String cacheControl) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + groupId, + subscriptionId, + this.client.getApiVersion(), + cacheControl, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Associates existing subscription with the management group. + * + * @param groupId Management Group ID. + * @param subscriptionId Subscription ID. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of subscription under management group along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String groupId, String subscriptionId, String cacheControl, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + groupId, + subscriptionId, + this.client.getApiVersion(), + cacheControl, + accept, + context); + } + + /** + * Associates existing subscription with the management group. + * + * @param groupId Management Group ID. + * @param subscriptionId Subscription ID. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of subscription under management group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String groupId, String subscriptionId, String cacheControl) { + return createWithResponseAsync(groupId, subscriptionId, cacheControl) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Associates existing subscription with the management group. + * + * @param groupId Management Group ID. + * @param subscriptionId Subscription ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of subscription under management group 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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Associates existing subscription with the management group. + * + * @param groupId Management Group ID. + * @param subscriptionId Subscription ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of subscription under management group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SubscriptionUnderManagementGroupInner create(String groupId, String subscriptionId) { + final String cacheControl = null; + return createAsync(groupId, subscriptionId, cacheControl).block(); + } + + /** + * Associates existing subscription with the management group. + * + * @param groupId Management Group ID. + * @param subscriptionId Subscription ID. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of subscription under management group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse( + String groupId, String subscriptionId, String cacheControl, Context context) { + return createWithResponseAsync(groupId, subscriptionId, cacheControl, context).block(); + } + + /** + * De-associates subscription from the management group. + * + * @param groupId Management Group ID. + * @param subscriptionId Subscription ID. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String groupId, String subscriptionId, String cacheControl) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + groupId, + subscriptionId, + this.client.getApiVersion(), + cacheControl, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * De-associates subscription from the management group. + * + * @param groupId Management Group ID. + * @param subscriptionId Subscription ID. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String groupId, String subscriptionId, String cacheControl, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + groupId, + subscriptionId, + this.client.getApiVersion(), + cacheControl, + accept, + context); + } + + /** + * De-associates subscription from the management group. + * + * @param groupId Management Group ID. + * @param subscriptionId Subscription ID. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String groupId, String subscriptionId, String cacheControl) { + return deleteWithResponseAsync(groupId, subscriptionId, cacheControl) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * De-associates subscription from the management group. + * + * @param groupId Management Group ID. + * @param subscriptionId Subscription ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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((Response res) -> Mono.empty()); + } + + /** + * De-associates subscription from the management group. + * + * @param groupId Management Group ID. + * @param subscriptionId Subscription ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String groupId, String subscriptionId) { + final String cacheControl = null; + deleteAsync(groupId, subscriptionId, cacheControl).block(); + } + + /** + * De-associates subscription from the management group. + * + * @param groupId Management Group ID. + * @param subscriptionId Subscription ID. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String groupId, String subscriptionId, String cacheControl, Context context) { + return deleteWithResponseAsync(groupId, subscriptionId, cacheControl, context).block(); + } + + /** + * Retrieves details about given subscription which is associated with the management group. + * + * @param groupId Management Group ID. + * @param subscriptionId Subscription ID. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of subscription under management group along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getSubscriptionWithResponseAsync( + String groupId, String subscriptionId, String cacheControl) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getSubscription( + this.client.getEndpoint(), + groupId, + subscriptionId, + this.client.getApiVersion(), + cacheControl, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves details about given subscription which is associated with the management group. + * + * @param groupId Management Group ID. + * @param subscriptionId Subscription ID. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of subscription under management group along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getSubscriptionWithResponseAsync( + String groupId, String subscriptionId, String cacheControl, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getSubscription( + this.client.getEndpoint(), + groupId, + subscriptionId, + this.client.getApiVersion(), + cacheControl, + accept, + context); + } + + /** + * Retrieves details about given subscription which is associated with the management group. + * + * @param groupId Management Group ID. + * @param subscriptionId Subscription ID. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of subscription under management group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getSubscriptionAsync( + String groupId, String subscriptionId, String cacheControl) { + return getSubscriptionWithResponseAsync(groupId, subscriptionId, cacheControl) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Retrieves details about given subscription which is associated with the management group. + * + * @param groupId Management Group ID. + * @param subscriptionId Subscription ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of subscription under management group 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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Retrieves details about given subscription which is associated with the management group. + * + * @param groupId Management Group ID. + * @param subscriptionId Subscription ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of subscription under management group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SubscriptionUnderManagementGroupInner getSubscription(String groupId, String subscriptionId) { + final String cacheControl = null; + return getSubscriptionAsync(groupId, subscriptionId, cacheControl).block(); + } + + /** + * Retrieves details about given subscription which is associated with the management group. + * + * @param groupId Management Group ID. + * @param subscriptionId Subscription ID. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of subscription under management group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getSubscriptionWithResponse( + String groupId, String subscriptionId, String cacheControl, Context context) { + return getSubscriptionWithResponseAsync(groupId, subscriptionId, cacheControl, context).block(); + } + + /** + * Retrieves details about all subscriptions which are associated with the management group. + * + * @param groupId Management Group ID. + * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a + * previous response contains a nextLink element, the value of the nextLink element will include a token + * parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of all subscriptions under management group along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + getSubscriptionsUnderManagementGroupSinglePageAsync(String groupId, String skiptoken) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getSubscriptionsUnderManagementGroup( + this.client.getEndpoint(), + groupId, + this.client.getApiVersion(), + skiptoken, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves details about all subscriptions which are associated with the management group. + * + * @param groupId Management Group ID. + * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a + * previous response contains a nextLink element, the value of the nextLink element will include a token + * parameter that specifies a starting point to use for subsequent calls. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of all subscriptions under management group along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + getSubscriptionsUnderManagementGroupSinglePageAsync(String groupId, String skiptoken, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getSubscriptionsUnderManagementGroup( + this.client.getEndpoint(), groupId, this.client.getApiVersion(), skiptoken, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Retrieves details about all subscriptions which are associated with the management group. + * + * @param groupId Management Group ID. + * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a + * previous response contains a nextLink element, the value of the nextLink element will include a token + * parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of all subscriptions under management group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux getSubscriptionsUnderManagementGroupAsync( + String groupId, String skiptoken) { + return new PagedFlux<>( + () -> getSubscriptionsUnderManagementGroupSinglePageAsync(groupId, skiptoken), + nextLink -> getSubscriptionsUnderManagementGroupNextSinglePageAsync(nextLink)); + } + + /** + * Retrieves details about all subscriptions which are associated with the management group. + * + * @param groupId Management Group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of all subscriptions under management group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux getSubscriptionsUnderManagementGroupAsync(String groupId) { + final String skiptoken = null; + return new PagedFlux<>( + () -> getSubscriptionsUnderManagementGroupSinglePageAsync(groupId, skiptoken), + nextLink -> getSubscriptionsUnderManagementGroupNextSinglePageAsync(nextLink)); + } + + /** + * Retrieves details about all subscriptions which are associated with the management group. + * + * @param groupId Management Group ID. + * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a + * previous response contains a nextLink element, the value of the nextLink element will include a token + * parameter that specifies a starting point to use for subsequent calls. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of all subscriptions under management group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux getSubscriptionsUnderManagementGroupAsync( + String groupId, String skiptoken, Context context) { + return new PagedFlux<>( + () -> getSubscriptionsUnderManagementGroupSinglePageAsync(groupId, skiptoken, context), + nextLink -> getSubscriptionsUnderManagementGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Retrieves details about all subscriptions which are associated with the management group. + * + * @param groupId Management Group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of all subscriptions under management group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getSubscriptionsUnderManagementGroup(String groupId) { + final String skiptoken = null; + return new PagedIterable<>(getSubscriptionsUnderManagementGroupAsync(groupId, skiptoken)); + } + + /** + * Retrieves details about all subscriptions which are associated with the management group. + * + * @param groupId Management Group ID. + * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a + * previous response contains a nextLink element, the value of the nextLink element will include a token + * parameter that specifies a starting point to use for subsequent calls. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of all subscriptions under management group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getSubscriptionsUnderManagementGroup( + String groupId, String skiptoken, Context context) { + return new PagedIterable<>(getSubscriptionsUnderManagementGroupAsync(groupId, skiptoken, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of all subscriptions under management group along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + getSubscriptionsUnderManagementGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getSubscriptionsUnderManagementGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of all subscriptions under management group along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + getSubscriptionsUnderManagementGroupNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getSubscriptionsUnderManagementGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupSubscriptionsImpl.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupSubscriptionsImpl.java new file mode 100644 index 000000000000..f02542a5f7ca --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupSubscriptionsImpl.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.managementgroups.fluent.ManagementGroupSubscriptionsClient; +import com.azure.resourcemanager.managementgroups.fluent.models.SubscriptionUnderManagementGroupInner; +import com.azure.resourcemanager.managementgroups.models.ManagementGroupSubscriptions; +import com.azure.resourcemanager.managementgroups.models.SubscriptionUnderManagementGroup; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ManagementGroupSubscriptionsImpl implements ManagementGroupSubscriptions { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagementGroupSubscriptionsImpl.class); + + private final ManagementGroupSubscriptionsClient innerClient; + + private final com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager; + + public ManagementGroupSubscriptionsImpl( + ManagementGroupSubscriptionsClient innerClient, + com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public SubscriptionUnderManagementGroup create(String groupId, String subscriptionId) { + SubscriptionUnderManagementGroupInner inner = this.serviceClient().create(groupId, subscriptionId); + if (inner != null) { + return new SubscriptionUnderManagementGroupImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response createWithResponse( + String groupId, String subscriptionId, String cacheControl, Context context) { + Response inner = + this.serviceClient().createWithResponse(groupId, subscriptionId, cacheControl, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SubscriptionUnderManagementGroupImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String groupId, String subscriptionId) { + this.serviceClient().delete(groupId, subscriptionId); + } + + public Response deleteWithResponse( + String groupId, String subscriptionId, String cacheControl, Context context) { + return this.serviceClient().deleteWithResponse(groupId, subscriptionId, cacheControl, context); + } + + public SubscriptionUnderManagementGroup getSubscription(String groupId, String subscriptionId) { + SubscriptionUnderManagementGroupInner inner = this.serviceClient().getSubscription(groupId, subscriptionId); + if (inner != null) { + return new SubscriptionUnderManagementGroupImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getSubscriptionWithResponse( + String groupId, String subscriptionId, String cacheControl, Context context) { + Response inner = + this.serviceClient().getSubscriptionWithResponse(groupId, subscriptionId, cacheControl, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SubscriptionUnderManagementGroupImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable getSubscriptionsUnderManagementGroup(String groupId) { + PagedIterable inner = + this.serviceClient().getSubscriptionsUnderManagementGroup(groupId); + return Utils.mapPage(inner, inner1 -> new SubscriptionUnderManagementGroupImpl(inner1, this.manager())); + } + + public PagedIterable getSubscriptionsUnderManagementGroup( + String groupId, String skiptoken, Context context) { + PagedIterable inner = + this.serviceClient().getSubscriptionsUnderManagementGroup(groupId, skiptoken, context); + return Utils.mapPage(inner, inner1 -> new SubscriptionUnderManagementGroupImpl(inner1, this.manager())); + } + + private ManagementGroupSubscriptionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupsApiBuilder.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupsApiBuilder.java new file mode 100644 index 000000000000..2bdcc603bc0b --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupsApiBuilder.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.implementation; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.CookiePolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.Duration; + +/** A builder for creating a new instance of the ManagementGroupsApiImpl type. */ +@ServiceClientBuilder(serviceClients = {ManagementGroupsApiImpl.class}) +public final class ManagementGroupsApiBuilder { + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the ManagementGroupsApiBuilder. + */ + public ManagementGroupsApiBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the ManagementGroupsApiBuilder. + */ + public ManagementGroupsApiBuilder environment(AzureEnvironment environment) { + this.environment = environment; + return this; + } + + /* + * The default poll interval for long-running operation + */ + private Duration defaultPollInterval; + + /** + * Sets The default poll interval for long-running operation. + * + * @param defaultPollInterval the defaultPollInterval value. + * @return the ManagementGroupsApiBuilder. + */ + public ManagementGroupsApiBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + return this; + } + + /* + * The HTTP pipeline to send requests through + */ + private HttpPipeline pipeline; + + /** + * Sets The HTTP pipeline to send requests through. + * + * @param pipeline the pipeline value. + * @return the ManagementGroupsApiBuilder. + */ + public ManagementGroupsApiBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The serializer to serialize an object into a string + */ + private SerializerAdapter serializerAdapter; + + /** + * Sets The serializer to serialize an object into a string. + * + * @param serializerAdapter the serializerAdapter value. + * @return the ManagementGroupsApiBuilder. + */ + public ManagementGroupsApiBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of ManagementGroupsApiImpl with the provided parameters. + * + * @return an instance of ManagementGroupsApiImpl. + */ + public ManagementGroupsApiImpl buildClient() { + if (endpoint == null) { + this.endpoint = "https://management.azure.com"; + } + if (environment == null) { + this.environment = AzureEnvironment.AZURE; + } + if (defaultPollInterval == null) { + this.defaultPollInterval = Duration.ofSeconds(30); + } + if (pipeline == null) { + this.pipeline = + new HttpPipelineBuilder() + .policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy()) + .build(); + } + if (serializerAdapter == null) { + this.serializerAdapter = SerializerFactory.createDefaultManagementSerializerAdapter(); + } + ManagementGroupsApiImpl client = + new ManagementGroupsApiImpl(pipeline, serializerAdapter, defaultPollInterval, environment, endpoint); + return client; + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupsApiImpl.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupsApiImpl.java new file mode 100644 index 000000000000..b388c83ccd53 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupsApiImpl.java @@ -0,0 +1,348 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.managementgroups.fluent.EntitiesClient; +import com.azure.resourcemanager.managementgroups.fluent.HierarchySettingsOperationsClient; +import com.azure.resourcemanager.managementgroups.fluent.ManagementGroupSubscriptionsClient; +import com.azure.resourcemanager.managementgroups.fluent.ManagementGroupsApi; +import com.azure.resourcemanager.managementgroups.fluent.ManagementGroupsClient; +import com.azure.resourcemanager.managementgroups.fluent.OperationsClient; +import com.azure.resourcemanager.managementgroups.fluent.ResourceProvidersClient; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import java.util.Map; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the ManagementGroupsApiImpl type. */ +@ServiceClient(builder = ManagementGroupsApiBuilder.class) +public final class ManagementGroupsApiImpl implements ManagementGroupsApi { + private final ClientLogger logger = new ClientLogger(ManagementGroupsApiImpl.class); + + /** server parameter. */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** Api Version. */ + private final String apiVersion; + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** The HTTP pipeline to send requests through. */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** The serializer to serialize an object into a string. */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** The default poll interval for long-running operation. */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** The ManagementGroupsClient object to access its operations. */ + private final ManagementGroupsClient managementGroups; + + /** + * Gets the ManagementGroupsClient object to access its operations. + * + * @return the ManagementGroupsClient object. + */ + public ManagementGroupsClient getManagementGroups() { + return this.managementGroups; + } + + /** The ManagementGroupSubscriptionsClient object to access its operations. */ + private final ManagementGroupSubscriptionsClient managementGroupSubscriptions; + + /** + * Gets the ManagementGroupSubscriptionsClient object to access its operations. + * + * @return the ManagementGroupSubscriptionsClient object. + */ + public ManagementGroupSubscriptionsClient getManagementGroupSubscriptions() { + return this.managementGroupSubscriptions; + } + + /** The HierarchySettingsOperationsClient object to access its operations. */ + private final HierarchySettingsOperationsClient hierarchySettingsOperations; + + /** + * Gets the HierarchySettingsOperationsClient object to access its operations. + * + * @return the HierarchySettingsOperationsClient object. + */ + public HierarchySettingsOperationsClient getHierarchySettingsOperations() { + return this.hierarchySettingsOperations; + } + + /** The OperationsClient object to access its operations. */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** The ResourceProvidersClient object to access its operations. */ + private final ResourceProvidersClient resourceProviders; + + /** + * Gets the ResourceProvidersClient object to access its operations. + * + * @return the ResourceProvidersClient object. + */ + public ResourceProvidersClient getResourceProviders() { + return this.resourceProviders; + } + + /** The EntitiesClient object to access its operations. */ + private final EntitiesClient entities; + + /** + * Gets the EntitiesClient object to access its operations. + * + * @return the EntitiesClient object. + */ + public EntitiesClient getEntities() { + return this.entities; + } + + /** + * Initializes an instance of ManagementGroupsApi client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param endpoint server parameter. + */ + ManagementGroupsApiImpl( + HttpPipeline httpPipeline, + SerializerAdapter serializerAdapter, + Duration defaultPollInterval, + AzureEnvironment environment, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.endpoint = endpoint; + this.apiVersion = "2021-04-01"; + this.managementGroups = new ManagementGroupsClientImpl(this); + this.managementGroupSubscriptions = new ManagementGroupSubscriptionsClientImpl(this); + this.hierarchySettingsOperations = new HierarchySettingsOperationsClientImpl(this); + this.operations = new OperationsClientImpl(this); + this.resourceProviders = new ResourceProvidersClientImpl(this); + this.entities = new EntitiesClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + for (Map.Entry entry : this.getContext().getValues().entrySet()) { + context = context.addData(entry.getKey(), entry.getValue()); + } + return 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)); + } + } +} 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..09701c112bb8 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupsClientImpl.java @@ -0,0 +1,1650 @@ +// 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.logging.ClientLogger; +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 { + private final ClientLogger logger = new ClientLogger(ManagementGroupsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ManagementGroupsService service; + + /** The service client containing this operation class. */ + private final ManagementGroupsApiImpl client; + + /** + * Initializes an instance of ManagementGroupsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagementGroupsClientImpl(ManagementGroupsApiImpl client) { + this.service = + RestProxy.create(ManagementGroupsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ManagementGroupsApiManagementGroups to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ManagementGroupsApiM") + private interface ManagementGroupsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Management/managementGroups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Cache-Control") String cacheControl, + @QueryParam("$skiptoken") String skiptoken, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Management/managementGroups/{groupId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("groupId") String groupId, + @QueryParam("api-version") String apiVersion, + @QueryParam("$expand") ManagementGroupExpandType expand, + @QueryParam("$recurse") Boolean recurse, + @QueryParam("$filter") String filter, + @HeaderParam("Cache-Control") String cacheControl, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put("/providers/Microsoft.Management/managementGroups/{groupId}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("groupId") String groupId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Cache-Control") String cacheControl, + @BodyParam("application/json") CreateManagementGroupRequest createManagementGroupRequest, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch("/providers/Microsoft.Management/managementGroups/{groupId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("groupId") String groupId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Cache-Control") String cacheControl, + @BodyParam("application/json") PatchManagementGroupRequest patchGroupRequest, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete("/providers/Microsoft.Management/managementGroups/{groupId}") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("groupId") String groupId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Cache-Control") String cacheControl, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Management/managementGroups/{groupId}/descendants") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getDescendants( + @HostParam("$host") String endpoint, + @PathParam("groupId") String groupId, + @QueryParam("api-version") String apiVersion, + @QueryParam("$skiptoken") String skiptoken, + @QueryParam("$top") Integer top, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Cache-Control") String cacheControl, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getDescendantsNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List management groups for the authenticated user. + * + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a + * previous response contains a nextLink element, the value of the nextLink element will include a token + * parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to list management groups along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String cacheControl, String skiptoken) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + cacheControl, + skiptoken, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List management groups for the authenticated user. + * + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a + * previous response contains a nextLink element, the value of the nextLink element will include a token + * parameter that specifies a starting point to use for subsequent calls. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to list management groups along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String cacheControl, String skiptoken, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), cacheControl, skiptoken, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List management groups for the authenticated user. + * + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a + * previous response contains a nextLink element, the value of the nextLink element will include a token + * parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to list management groups. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String cacheControl, String skiptoken, Context context) { + return new PagedIterable<>(listAsync(cacheControl, skiptoken, context)); + } + + /** + * Get the details of the management group. + * + * @param groupId Management Group ID. + * @param expand The $expand=children query string parameter allows clients to request inclusion of children in the + * response payload. $expand=path includes the path from the root group to the current group. $expand=ancestors + * includes the ancestor Ids of the current group. + * @param recurse The $recurse=true query string parameter allows clients to request inclusion of entire hierarchy + * in the response payload. Note that $expand=children must be passed up if $recurse is set to true. + * @param filter A filter which allows the exclusion of subscriptions from results (i.e. '$filter=children.childType + * ne Subscription'). + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the management group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String groupId, ManagementGroupExpandType expand, Boolean recurse, String filter, String cacheControl) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + groupId, + this.client.getApiVersion(), + expand, + recurse, + filter, + cacheControl, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the details of the management group. + * + * @param groupId Management Group ID. + * @param expand The $expand=children query string parameter allows clients to request inclusion of children in the + * response payload. $expand=path includes the path from the root group to the current group. $expand=ancestors + * includes the ancestor Ids of the current group. + * @param recurse The $recurse=true query string parameter allows clients to request inclusion of entire hierarchy + * in the response payload. Note that $expand=children must be passed up if $recurse is set to true. + * @param filter A filter which allows the exclusion of subscriptions from results (i.e. '$filter=children.childType + * ne Subscription'). + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the management group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String groupId, + ManagementGroupExpandType expand, + Boolean recurse, + String filter, + String cacheControl, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + groupId, + this.client.getApiVersion(), + expand, + recurse, + filter, + cacheControl, + accept, + context); + } + + /** + * Get the details of the management group. + * + * @param groupId Management Group ID. + * @param expand The $expand=children query string parameter allows clients to request inclusion of children in the + * response payload. $expand=path includes the path from the root group to the current group. $expand=ancestors + * includes the ancestor Ids of the current group. + * @param recurse The $recurse=true query string parameter allows clients to request inclusion of entire hierarchy + * in the response payload. Note that $expand=children must be passed up if $recurse is set to true. + * @param filter A filter which allows the exclusion of subscriptions from results (i.e. '$filter=children.childType + * ne Subscription'). + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the management group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String groupId, ManagementGroupExpandType expand, Boolean recurse, String filter, String cacheControl) { + return getWithResponseAsync(groupId, expand, recurse, filter, cacheControl) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get the details of the management group. + * + * @param groupId Management Group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the management group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagementGroupInner get(String groupId) { + final ManagementGroupExpandType expand = null; + final Boolean recurse = null; + final String filter = null; + final String cacheControl = null; + return getAsync(groupId, expand, recurse, filter, cacheControl).block(); + } + + /** + * Get the details of the management group. + * + * @param groupId Management Group ID. + * @param expand The $expand=children query string parameter allows clients to request inclusion of children in the + * response payload. $expand=path includes the path from the root group to the current group. $expand=ancestors + * includes the ancestor Ids of the current group. + * @param recurse The $recurse=true query string parameter allows clients to request inclusion of entire hierarchy + * in the response payload. Note that $expand=children must be passed up if $recurse is set to true. + * @param filter A filter which allows the exclusion of subscriptions from results (i.e. '$filter=children.childType + * ne Subscription'). + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the management group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String groupId, + ManagementGroupExpandType expand, + Boolean recurse, + String filter, + String cacheControl, + Context context) { + return getWithResponseAsync(groupId, expand, recurse, filter, cacheControl, context).block(); + } + + /** + * Create or update a management group. If a management group is already created and a subsequent create request is + * issued with different properties, the management group properties will be updated. + * + * @param groupId Management Group ID. + * @param createManagementGroupRequest Management group creation parameters. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the management group details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String groupId, CreateManagementGroupRequest createManagementGroupRequest, String cacheControl) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + if (createManagementGroupRequest == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createManagementGroupRequest is required and cannot be null.")); + } else { + createManagementGroupRequest.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + groupId, + this.client.getApiVersion(), + cacheControl, + createManagementGroupRequest, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update a management group. If a management group is already created and a subsequent create request is + * issued with different properties, the management group properties will be updated. + * + * @param groupId Management Group ID. + * @param createManagementGroupRequest Management group creation parameters. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the management group details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String groupId, + CreateManagementGroupRequest createManagementGroupRequest, + String cacheControl, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + if (createManagementGroupRequest == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createManagementGroupRequest is required and cannot be null.")); + } else { + createManagementGroupRequest.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + groupId, + this.client.getApiVersion(), + cacheControl, + createManagementGroupRequest, + accept, + context); + } + + /** + * Create or update a management group. If a management group is already created and a subsequent create request is + * issued with different properties, the management group properties will be updated. + * + * @param groupId Management Group ID. + * @param createManagementGroupRequest Management group creation parameters. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the management group details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ManagementGroupInner> beginCreateOrUpdateAsync( + String groupId, CreateManagementGroupRequest createManagementGroupRequest, String cacheControl) { + Mono>> mono = + createOrUpdateWithResponseAsync(groupId, createManagementGroupRequest, cacheControl); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagementGroupInner.class, + ManagementGroupInner.class, + this.client.getContext()); + } + + /** + * Create or update a management group. If a management group is already created and a subsequent create request is + * issued with different properties, the management group properties will be updated. + * + * @param groupId Management Group ID. + * @param createManagementGroupRequest Management group creation parameters. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the management group details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ManagementGroupInner> beginCreateOrUpdateAsync( + String groupId, + CreateManagementGroupRequest createManagementGroupRequest, + String cacheControl, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(groupId, createManagementGroupRequest, cacheControl, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ManagementGroupInner.class, ManagementGroupInner.class, context); + } + + /** + * Create or update a management group. If a management group is already created and a subsequent create request is + * issued with different properties, the management group properties will be updated. + * + * @param groupId Management Group ID. + * @param createManagementGroupRequest Management group creation parameters. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the management group details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ManagementGroupInner> beginCreateOrUpdate( + String groupId, CreateManagementGroupRequest createManagementGroupRequest, String cacheControl) { + return beginCreateOrUpdateAsync(groupId, createManagementGroupRequest, cacheControl).getSyncPoller(); + } + + /** + * Create or update a management group. If a management group is already created and a subsequent create request is + * issued with different properties, the management group properties will be updated. + * + * @param groupId Management Group ID. + * @param createManagementGroupRequest Management group creation parameters. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the management group details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ManagementGroupInner> beginCreateOrUpdate( + String groupId, + CreateManagementGroupRequest createManagementGroupRequest, + String cacheControl, + Context context) { + return beginCreateOrUpdateAsync(groupId, createManagementGroupRequest, cacheControl, context).getSyncPoller(); + } + + /** + * Create or update a management group. If a management group is already created and a subsequent create request is + * issued with different properties, the management group properties will be updated. + * + * @param groupId Management Group ID. + * @param createManagementGroupRequest Management group creation parameters. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the management group details on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String groupId, CreateManagementGroupRequest createManagementGroupRequest, String cacheControl) { + return beginCreateOrUpdateAsync(groupId, createManagementGroupRequest, cacheControl) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a management group. If a management group is already created and a subsequent create request is + * issued with different properties, the management group properties will be updated. + * + * @param groupId Management Group ID. + * @param createManagementGroupRequest Management group creation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the management group details on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String groupId, CreateManagementGroupRequest createManagementGroupRequest) { + final String cacheControl = null; + return beginCreateOrUpdateAsync(groupId, createManagementGroupRequest, cacheControl) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a management group. If a management group is already created and a subsequent create request is + * issued with different properties, the management group properties will be updated. + * + * @param groupId Management Group ID. + * @param createManagementGroupRequest Management group creation parameters. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the management group details on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String groupId, + CreateManagementGroupRequest createManagementGroupRequest, + String cacheControl, + Context context) { + return beginCreateOrUpdateAsync(groupId, createManagementGroupRequest, cacheControl, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a management group. If a management group is already created and a subsequent create request is + * issued with different properties, the management group properties will be updated. + * + * @param groupId Management Group ID. + * @param createManagementGroupRequest Management group creation parameters. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the management group details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagementGroupInner createOrUpdate( + String groupId, CreateManagementGroupRequest createManagementGroupRequest, String cacheControl) { + return createOrUpdateAsync(groupId, createManagementGroupRequest, cacheControl).block(); + } + + /** + * Create or update a management group. If a management group is already created and a subsequent create request is + * issued with different properties, the management group properties will be updated. + * + * @param groupId Management Group ID. + * @param createManagementGroupRequest Management group creation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the management group details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagementGroupInner createOrUpdate( + String groupId, CreateManagementGroupRequest createManagementGroupRequest) { + final String cacheControl = null; + return createOrUpdateAsync(groupId, createManagementGroupRequest, cacheControl).block(); + } + + /** + * Create or update a management group. If a management group is already created and a subsequent create request is + * issued with different properties, the management group properties will be updated. + * + * @param groupId Management Group ID. + * @param createManagementGroupRequest Management group creation parameters. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the management group details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagementGroupInner createOrUpdate( + String groupId, + CreateManagementGroupRequest createManagementGroupRequest, + String cacheControl, + Context context) { + return createOrUpdateAsync(groupId, createManagementGroupRequest, cacheControl, context).block(); + } + + /** + * Update a management group. + * + * @param groupId Management Group ID. + * @param patchGroupRequest Management group patch parameters. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the management group details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String groupId, PatchManagementGroupRequest patchGroupRequest, String cacheControl) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + if (patchGroupRequest == null) { + return Mono + .error(new IllegalArgumentException("Parameter patchGroupRequest is required and cannot be null.")); + } else { + patchGroupRequest.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + groupId, + this.client.getApiVersion(), + cacheControl, + patchGroupRequest, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a management group. + * + * @param groupId Management Group ID. + * @param patchGroupRequest Management group patch parameters. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the management group details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String groupId, PatchManagementGroupRequest patchGroupRequest, String cacheControl, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + if (patchGroupRequest == null) { + return Mono + .error(new IllegalArgumentException("Parameter patchGroupRequest is required and cannot be null.")); + } else { + patchGroupRequest.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + groupId, + this.client.getApiVersion(), + cacheControl, + patchGroupRequest, + accept, + context); + } + + /** + * Update a management group. + * + * @param groupId Management Group ID. + * @param patchGroupRequest Management group patch parameters. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the management group details on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String groupId, PatchManagementGroupRequest patchGroupRequest, String cacheControl) { + return updateWithResponseAsync(groupId, patchGroupRequest, cacheControl) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Update a management group. + * + * @param groupId Management Group ID. + * @param patchGroupRequest Management group patch parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the management group details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagementGroupInner update(String groupId, PatchManagementGroupRequest patchGroupRequest) { + final String cacheControl = null; + return updateAsync(groupId, patchGroupRequest, cacheControl).block(); + } + + /** + * Update a management group. + * + * @param groupId Management Group ID. + * @param patchGroupRequest Management group patch parameters. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the management group details along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String groupId, PatchManagementGroupRequest patchGroupRequest, String cacheControl, Context context) { + return updateWithResponseAsync(groupId, patchGroupRequest, cacheControl, context).block(); + } + + /** + * Delete management group. If a management group contains child resources, the request will fail. + * + * @param groupId Management Group ID. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the results of Azure-AsyncOperation along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String groupId, String cacheControl) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + groupId, + this.client.getApiVersion(), + cacheControl, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete management group. If a management group contains child resources, the request will fail. + * + * @param groupId Management Group ID. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the results of Azure-AsyncOperation along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String groupId, String cacheControl, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete(this.client.getEndpoint(), groupId, this.client.getApiVersion(), cacheControl, accept, context); + } + + /** + * Delete management group. If a management group contains child resources, the request will fail. + * + * @param groupId Management Group ID. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the results of Azure-AsyncOperation along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, AzureAsyncOperationResultsInner> beginDeleteAsync( + String groupId, String cacheControl) { + Mono>> mono = deleteWithResponseAsync(groupId, cacheControl); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + AzureAsyncOperationResultsInner.class, + AzureAsyncOperationResultsInner.class, + this.client.getContext()); + } + + /** + * Delete management group. If a management group contains child resources, the request will fail. + * + * @param groupId Management Group ID. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the results of Azure-AsyncOperation along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, AzureAsyncOperationResultsInner> beginDeleteAsync( + String groupId, String cacheControl, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(groupId, cacheControl, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + AzureAsyncOperationResultsInner.class, + AzureAsyncOperationResultsInner.class, + context); + } + + /** + * Delete management group. If a management group contains child resources, the request will fail. + * + * @param groupId Management Group ID. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the results of Azure-AsyncOperation along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, AzureAsyncOperationResultsInner> beginDelete( + String groupId, String cacheControl) { + return beginDeleteAsync(groupId, cacheControl).getSyncPoller(); + } + + /** + * Delete management group. If a management group contains child resources, the request will fail. + * + * @param groupId Management Group ID. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the results of Azure-AsyncOperation along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, AzureAsyncOperationResultsInner> beginDelete( + String groupId, String cacheControl, Context context) { + return beginDeleteAsync(groupId, cacheControl, context).getSyncPoller(); + } + + /** + * Delete management group. If a management group contains child resources, the request will fail. + * + * @param groupId Management Group ID. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the results of Azure-AsyncOperation on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String groupId, String cacheControl) { + return beginDeleteAsync(groupId, cacheControl).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete management group. If a management group contains child resources, the request will fail. + * + * @param groupId Management Group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the results of Azure-AsyncOperation on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String groupId) { + final String cacheControl = null; + return beginDeleteAsync(groupId, cacheControl).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete management group. If a management group contains child resources, the request will fail. + * + * @param groupId Management Group ID. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the results of Azure-AsyncOperation on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String groupId, String cacheControl, Context context) { + return beginDeleteAsync(groupId, cacheControl, context).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete management group. If a management group contains child resources, the request will fail. + * + * @param groupId Management Group ID. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the results of Azure-AsyncOperation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AzureAsyncOperationResultsInner delete(String groupId, String cacheControl) { + return deleteAsync(groupId, cacheControl).block(); + } + + /** + * Delete management group. If a management group contains child resources, the request will fail. + * + * @param groupId Management Group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the results of Azure-AsyncOperation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AzureAsyncOperationResultsInner delete(String groupId) { + final String cacheControl = null; + return deleteAsync(groupId, cacheControl).block(); + } + + /** + * Delete management group. If a management group contains child resources, the request will fail. + * + * @param groupId Management Group ID. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the results of Azure-AsyncOperation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AzureAsyncOperationResultsInner delete(String groupId, String cacheControl, Context context) { + return deleteAsync(groupId, cacheControl, context).block(); + } + + /** + * List all entities that descend from a management group. + * + * @param groupId Management Group ID. + * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a + * previous response contains a nextLink element, the value of the nextLink element will include a token + * parameter that specifies a starting point to use for subsequent calls. + * @param top Number of elements to return when retrieving results. Passing this in will override $skipToken. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to view descendants along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getDescendantsSinglePageAsync( + String groupId, String skiptoken, Integer top) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getDescendants( + this.client.getEndpoint(), + groupId, + this.client.getApiVersion(), + skiptoken, + top, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List all entities that descend from a management group. + * + * @param groupId Management Group ID. + * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a + * previous response contains a nextLink element, the value of the nextLink element will include a token + * parameter that specifies a starting point to use for subsequent calls. + * @param top Number of elements to return when retrieving results. Passing this in will override $skipToken. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to view descendants along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getDescendantsSinglePageAsync( + String groupId, String skiptoken, Integer top, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getDescendants( + this.client.getEndpoint(), groupId, this.client.getApiVersion(), skiptoken, top, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List all entities that descend from a management group. + * + * @param groupId Management Group ID. + * @param skiptoken Page continuation token is only used if a previous operation returned a partial result. If a + * previous response contains a nextLink element, the value of the nextLink element will include a token + * parameter that specifies a starting point to use for subsequent calls. + * @param top Number of elements to return when retrieving results. Passing this in will override $skipToken. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to view descendants. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getDescendants( + String groupId, String skiptoken, Integer top, Context context) { + return new PagedIterable<>(getDescendantsAsync(groupId, skiptoken, top, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to list management groups along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync( + String nextLink, String cacheControl) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listNext(nextLink, this.client.getEndpoint(), cacheControl, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to list management groups along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync( + String nextLink, String cacheControl, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), cacheControl, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to view descendants along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getDescendantsNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getDescendantsNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to view descendants along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getDescendantsNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getDescendantsNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupsImpl.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupsImpl.java new file mode 100644 index 000000000000..650eec8802d5 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ManagementGroupsImpl.java @@ -0,0 +1,184 @@ +// 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; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ManagementGroupsImpl implements ManagementGroups { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagementGroupsImpl.class); + + private final ManagementGroupsClient innerClient; + + private final com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager; + + public ManagementGroupsImpl( + ManagementGroupsClient innerClient, + com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new ManagementGroupInfoImpl(inner1, this.manager())); + } + + public PagedIterable list(String cacheControl, String skiptoken, Context context) { + PagedIterable inner = this.serviceClient().list(cacheControl, skiptoken, context); + return Utils.mapPage(inner, inner1 -> new ManagementGroupInfoImpl(inner1, this.manager())); + } + + public ManagementGroup get(String groupId) { + ManagementGroupInner inner = this.serviceClient().get(groupId); + if (inner != null) { + return new ManagementGroupImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String groupId, + ManagementGroupExpandType expand, + Boolean recurse, + String filter, + String cacheControl, + Context context) { + Response inner = + this.serviceClient().getWithResponse(groupId, expand, recurse, filter, cacheControl, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ManagementGroupImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ManagementGroup createOrUpdate( + String groupId, CreateManagementGroupRequest createManagementGroupRequest, String cacheControl) { + ManagementGroupInner inner = + this.serviceClient().createOrUpdate(groupId, createManagementGroupRequest, cacheControl); + if (inner != null) { + return new ManagementGroupImpl(inner, this.manager()); + } else { + return null; + } + } + + public ManagementGroup createOrUpdate(String groupId, CreateManagementGroupRequest createManagementGroupRequest) { + ManagementGroupInner inner = this.serviceClient().createOrUpdate(groupId, createManagementGroupRequest); + if (inner != null) { + return new ManagementGroupImpl(inner, this.manager()); + } else { + return null; + } + } + + public ManagementGroup createOrUpdate( + String groupId, + CreateManagementGroupRequest createManagementGroupRequest, + String cacheControl, + Context context) { + ManagementGroupInner inner = + this.serviceClient().createOrUpdate(groupId, createManagementGroupRequest, cacheControl, context); + if (inner != null) { + return new ManagementGroupImpl(inner, this.manager()); + } else { + return null; + } + } + + public ManagementGroup update(String groupId, PatchManagementGroupRequest patchGroupRequest) { + ManagementGroupInner inner = this.serviceClient().update(groupId, patchGroupRequest); + if (inner != null) { + return new ManagementGroupImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response updateWithResponse( + String groupId, PatchManagementGroupRequest patchGroupRequest, String cacheControl, Context context) { + Response inner = + this.serviceClient().updateWithResponse(groupId, patchGroupRequest, cacheControl, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ManagementGroupImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public AzureAsyncOperationResults deleteByResourceGroup(String groupId, String cacheControl) { + AzureAsyncOperationResultsInner inner = this.serviceClient().delete(groupId, cacheControl); + if (inner != null) { + return new AzureAsyncOperationResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public AzureAsyncOperationResults delete(String groupId) { + AzureAsyncOperationResultsInner inner = this.serviceClient().delete(groupId); + if (inner != null) { + return new AzureAsyncOperationResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public AzureAsyncOperationResults delete(String groupId, String cacheControl, Context context) { + AzureAsyncOperationResultsInner inner = this.serviceClient().delete(groupId, cacheControl, context); + if (inner != null) { + return new AzureAsyncOperationResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable getDescendants(String groupId) { + PagedIterable inner = this.serviceClient().getDescendants(groupId); + return Utils.mapPage(inner, inner1 -> new DescendantInfoImpl(inner1, this.manager())); + } + + public PagedIterable getDescendants( + String groupId, String skiptoken, Integer top, Context context) { + PagedIterable inner = + this.serviceClient().getDescendants(groupId, skiptoken, top, context); + return Utils.mapPage(inner, inner1 -> new DescendantInfoImpl(inner1, this.manager())); + } + + private ManagementGroupsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/OperationImpl.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/OperationImpl.java new file mode 100644 index 000000000000..d3dfa3cd4a2e --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/OperationImpl.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managementgroups.implementation; + +import com.azure.resourcemanager.managementgroups.fluent.models.OperationInner; +import com.azure.resourcemanager.managementgroups.models.Operation; +import com.azure.resourcemanager.managementgroups.models.OperationDisplayProperties; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager; + + OperationImpl( + OperationInner innerObject, com.azure.resourcemanager.managementgroups.ManagementGroupsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public OperationDisplayProperties display() { + return this.innerModel().display(); + } + + public OperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.managementgroups.ManagementGroupsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/OperationsClientImpl.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/OperationsClientImpl.java new file mode 100644 index 000000000000..84e8434e4b8c --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/OperationsClientImpl.java @@ -0,0 +1,273 @@ +// 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.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.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 { + private final ClientLogger logger = new ClientLogger(OperationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final OperationsService service; + + /** The service client containing this operation class. */ + private final ManagementGroupsApiImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(ManagementGroupsApiImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ManagementGroupsApiOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ManagementGroupsApiO") + private interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Management/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists all of the available Management REST API operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to list Microsoft.Management operations along with {@link + * PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all of the available Management REST API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to list Microsoft.Management operations along with {@link + * PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all of the available Management REST API operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to list Microsoft.Management operations. + */ + @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. + */ + @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. + */ + @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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to list Microsoft.Management operations along with {@link + * PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> 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 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..f665f03fd08f --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/OperationsImpl.java @@ -0,0 +1,47 @@ +// 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; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class OperationsImpl implements Operations { + @JsonIgnore private 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..3aaefa882743 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ResourceProvidersClientImpl.java @@ -0,0 +1,406 @@ +// 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.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 reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ResourceProvidersClient. */ +public final class ResourceProvidersClientImpl implements ResourceProvidersClient { + private final ClientLogger logger = new ClientLogger(ResourceProvidersClientImpl.class); + + /** 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") + private 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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 checkNameAvailabilityAsync(checkNameAvailabilityRequest).block(); + } + + /** + * 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(); + } + + /** + * 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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 startTenantBackfillAsync().block(); + } + + /** + * 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(); + } + + /** + * 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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 tenantBackfillStatusAsync().block(); + } + + /** + * 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(); + } +} 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..8f7146316cc5 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/implementation/ResourceProvidersImpl.java @@ -0,0 +1,112 @@ +// 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; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ResourceProvidersImpl implements ResourceProviders { + @JsonIgnore private 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 CheckNameAvailabilityResult checkNameAvailability( + CheckNameAvailabilityRequest checkNameAvailabilityRequest) { + CheckNameAvailabilityResultInner inner = + this.serviceClient().checkNameAvailability(checkNameAvailabilityRequest); + if (inner != null) { + return new CheckNameAvailabilityResultImpl(inner, this.manager()); + } else { + return null; + } + } + + 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 TenantBackfillStatusResult startTenantBackfill() { + TenantBackfillStatusResultInner inner = this.serviceClient().startTenantBackfill(); + if (inner != null) { + return new TenantBackfillStatusResultImpl(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 tenantBackfillStatus() { + TenantBackfillStatusResultInner inner = this.serviceClient().tenantBackfillStatus(); + 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; + } + } + + 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..4c478b12f7c0 --- /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.DescendantParentGroupInfo; +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 DescendantParentGroupInfo 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..998074d06c23 --- /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.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Management group name availability check parameters. */ +@Fluent +public final class CheckNameAvailabilityRequest { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CheckNameAvailabilityRequest.class); + + /* + * 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; + + /** + * 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..fef7fabbe6a8 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/CreateManagementGroupChildInfo.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.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +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 { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CreateManagementGroupChildInfo.class); + + /* + * 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; + + /** + * 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..768c52d07fdf --- /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.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The details of a management group used during creation. */ +@Fluent +public final class CreateManagementGroupDetails { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CreateManagementGroupDetails.class); + + /* + * 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; + + /** + * 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..03f4fc8a7347 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/CreateManagementGroupRequest.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.managementgroups.fluent.models.CreateManagementGroupProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Management group creation parameters. */ +@Fluent +public final class CreateManagementGroupRequest extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CreateManagementGroupRequest.class); + + /* + * 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; + + /** + * 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..a12a129af30a --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/CreateOrUpdateSettingsRequest.java @@ -0,0 +1,103 @@ +// 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.util.logging.ClientLogger; +import com.azure.resourcemanager.managementgroups.fluent.models.CreateOrUpdateSettingsProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Parameters for creating or updating Management Group settings. */ +@Fluent +public final class CreateOrUpdateSettingsRequest { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CreateOrUpdateSettingsRequest.class); + + /* + * The properties of the request to create or update Management Group + * settings + */ + @JsonProperty(value = "properties") + private CreateOrUpdateSettingsProperties innerProperties; + + /** + * 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..d865788f16c2 --- /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.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** (Optional) The ID of the parent management group used during creation. */ +@Fluent +public final class CreateParentGroupInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CreateParentGroupInfo.class); + + /* + * 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; + + /** + * 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..3c3719476c3b --- /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.core.util.logging.ClientLogger; +import com.azure.resourcemanager.managementgroups.fluent.models.DescendantInfoInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes the result of the request to view descendants. */ +@Fluent +public final class DescendantListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DescendantListResult.class); + + /* + * 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; + + /** + * 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..592e2ef5c5f7 --- /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.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The ID of the parent management group. */ +@Fluent +public final class DescendantParentGroupInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DescendantParentGroupInfo.class); + + /* + * 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; + + /** + * 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..550696d4486b --- /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. + */ + 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. + */ + 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..6273b4bce0cb --- /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.core.util.logging.ClientLogger; +import com.azure.resourcemanager.managementgroups.fluent.models.EntityHierarchyItemProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +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 { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EntityHierarchyItem.class); + + /* + * The generic properties of a management group. + */ + @JsonProperty(value = "properties") + private EntityHierarchyItemProperties innerProperties; + + /** + * 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..18ceef2fd81e --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/EntityInfo.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.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..b24bada10b0c --- /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.core.util.logging.ClientLogger; +import com.azure.resourcemanager.managementgroups.fluent.models.EntityInfoInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes the result of the request to view entities. */ +@Fluent +public final class EntityListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EntityListResult.class); + + /* + * 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; + + /** + * 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..246ee8c3349b --- /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.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** (Optional) The ID of the parent management group. */ +@Fluent +public final class EntityParentGroupInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EntityParentGroupInfo.class); + + /* + * 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; + + /** + * 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..89118aad5413 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/EntitySearchType.java @@ -0,0 +1,43 @@ +// 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 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); + } + + /** @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..528654f927cf --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/EntityViewParameterType.java @@ -0,0 +1,40 @@ +// 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 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); + } + + /** @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..cbb3800fd3a1 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/HierarchySettingsInfo.java @@ -0,0 +1,175 @@ +// 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.util.logging.ClientLogger; +import com.azure.resourcemanager.managementgroups.fluent.models.HierarchySettingsProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The hierarchy settings resource. */ +@Fluent +public final class HierarchySettingsInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(HierarchySettingsInfo.class); + + /* + * 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; + + /** + * 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..28e992957f5b --- /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. + * @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 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 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); + + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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); +} 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..bcb33c8390b2 --- /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.core.util.logging.ClientLogger; +import com.azure.resourcemanager.managementgroups.fluent.models.SubscriptionUnderManagementGroupInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The details of all subscriptions under management group. */ +@Fluent +public final class ListSubscriptionUnderManagementGroup { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ListSubscriptionUnderManagementGroup.class); + + /* + * 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; + + /** + * 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..94d7569e42f7 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ManagementGroupChildInfo.java @@ -0,0 +1,165 @@ +// 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.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The child information of a management group. */ +@Fluent +public final class ManagementGroupChildInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagementGroupChildInfo.class); + + /* + * 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; + + /** + * 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..138652d0f13b --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ManagementGroupChildType.java @@ -0,0 +1,35 @@ +// 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 ManagementGroupChildType. */ +public final class ManagementGroupChildType extends ExpandableStringEnum { + /** Static value Microsoft.Management/managementGroups for ManagementGroupChildType. */ + public static final ManagementGroupChildType MICROSOFT_MANAGEMENT_MANAGEMENT_GROUPS = + fromString("Microsoft.Management/managementGroups"); + + /** Static value /subscriptions for ManagementGroupChildType. */ + public static final ManagementGroupChildType SUBSCRIPTIONS = fromString("/subscriptions"); + + /** + * Creates or finds a ManagementGroupChildType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ManagementGroupChildType. + */ + @JsonCreator + public static ManagementGroupChildType fromString(String name) { + return fromString(name, ManagementGroupChildType.class); + } + + /** @return known ManagementGroupChildType values. */ + public static Collection values() { + return values(ManagementGroupChildType.class); + } +} 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..2cb91045274b --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ManagementGroupDetails.java @@ -0,0 +1,221 @@ +// 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.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +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 { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagementGroupDetails.class); + + /* + * 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; + + /** + * 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..2cbb79a3dee8 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ManagementGroupExpandType.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.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 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); + } + + /** @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..021eba469dc3 --- /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.core.util.logging.ClientLogger; +import com.azure.resourcemanager.managementgroups.fluent.models.ManagementGroupInfoInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +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 { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagementGroupListResult.class); + + /* + * 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; + + /** + * 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..e242aecad8c8 --- /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.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A path element of a management group ancestors. */ +@Fluent +public final class ManagementGroupPathElement { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagementGroupPathElement.class); + + /* + * The name of the group. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The friendly name of the group. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * 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..04a639452e41 --- /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. + * @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); + + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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 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 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. + */ + 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. + */ + 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..e8949ce5c800 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ManagementGroups.java @@ -0,0 +1,217 @@ +// 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. + */ + 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. + */ + PagedIterable list(String cacheControl, String skiptoken, Context context); + + /** + * Get the details of the management group. + * + * @param groupId Management Group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the management group. + */ + ManagementGroup get(String groupId); + + /** + * Get the details of the management group. + * + * @param groupId Management Group ID. + * @param expand The $expand=children query string parameter allows clients to request inclusion of children in the + * response payload. $expand=path includes the path from the root group to the current group. $expand=ancestors + * includes the ancestor Ids of the current group. + * @param recurse The $recurse=true query string parameter allows clients to request inclusion of entire hierarchy + * in the response payload. Note that $expand=children must be passed up if $recurse is set to true. + * @param filter A filter which allows the exclusion of subscriptions from results (i.e. '$filter=children.childType + * ne Subscription'). + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the management group along with {@link Response}. + */ + Response getWithResponse( + String groupId, + ManagementGroupExpandType expand, + Boolean recurse, + String filter, + String cacheControl, + Context context); + + /** + * Create or update a management group. If a management group is already created and a subsequent create request is + * issued with different properties, the management group properties will be updated. + * + * @param groupId Management Group ID. + * @param createManagementGroupRequest Management group creation parameters. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the management group details. + */ + ManagementGroup createOrUpdate( + String groupId, CreateManagementGroupRequest createManagementGroupRequest, String cacheControl); + + /** + * Create or update a management group. If a management group is already created and a subsequent create request is + * issued with different properties, the management group properties will be updated. + * + * @param groupId Management Group ID. + * @param createManagementGroupRequest Management group creation parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the management group details. + */ + 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. + * @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); + + /** + * 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); + + /** + * Delete management group. If a management group contains child resources, the request will fail. + * + * @param groupId Management Group ID. + * @param cacheControl Indicates whether the request should utilize any caches. Populate the header with 'no-cache' + * value to bypass existing caches. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the results of Azure-AsyncOperation. + */ + AzureAsyncOperationResults deleteByResourceGroup(String groupId, String cacheControl); + + /** + * Delete management group. If a management group contains child resources, the request will fail. + * + * @param groupId Management Group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the results of Azure-AsyncOperation. + */ + AzureAsyncOperationResults 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. + */ + 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. + */ + 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. + */ + 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/ManagementGroupsCreateOrUpdateHeaders.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ManagementGroupsCreateOrUpdateHeaders.java new file mode 100644 index 000000000000..c588bf425003 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ManagementGroupsCreateOrUpdateHeaders.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.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The ManagementGroupsCreateOrUpdateHeaders model. */ +@Fluent +public final class ManagementGroupsCreateOrUpdateHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagementGroupsCreateOrUpdateHeaders.class); + + /* + * The Azure-AsyncOperation property. + */ + @JsonProperty(value = "Azure-AsyncOperation") + private String azureAsyncOperation; + + /* + * The Location property. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Get the azureAsyncOperation property: The Azure-AsyncOperation property. + * + * @return the azureAsyncOperation value. + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set the azureAsyncOperation property: The Azure-AsyncOperation property. + * + * @param azureAsyncOperation the azureAsyncOperation value to set. + * @return the ManagementGroupsCreateOrUpdateHeaders object itself. + */ + public ManagementGroupsCreateOrUpdateHeaders withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + + /** + * Get the location property: The Location property. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The Location property. + * + * @param location the location value to set. + * @return the ManagementGroupsCreateOrUpdateHeaders object itself. + */ + public ManagementGroupsCreateOrUpdateHeaders withLocation(String location) { + this.location = location; + 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/ManagementGroupsCreateOrUpdateResponse.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ManagementGroupsCreateOrUpdateResponse.java new file mode 100644 index 000000000000..477722de4d38 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ManagementGroupsCreateOrUpdateResponse.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.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.managementgroups.fluent.models.ManagementGroupInner; + +/** Contains all response data for the createOrUpdate operation. */ +public final class ManagementGroupsCreateOrUpdateResponse + extends ResponseBase { + /** + * Creates an instance of ManagementGroupsCreateOrUpdateResponse. + * + * @param request the request which resulted in this ManagementGroupsCreateOrUpdateResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public ManagementGroupsCreateOrUpdateResponse( + HttpRequest request, + int statusCode, + HttpHeaders rawHeaders, + ManagementGroupInner value, + ManagementGroupsCreateOrUpdateHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** @return the deserialized response body. */ + @Override + public ManagementGroupInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ManagementGroupsDeleteHeaders.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ManagementGroupsDeleteHeaders.java new file mode 100644 index 000000000000..a3b581e84a0e --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ManagementGroupsDeleteHeaders.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.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The ManagementGroupsDeleteHeaders model. */ +@Fluent +public final class ManagementGroupsDeleteHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagementGroupsDeleteHeaders.class); + + /* + * The Azure-AsyncOperation property. + */ + @JsonProperty(value = "Azure-AsyncOperation") + private String azureAsyncOperation; + + /* + * The Location property. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Get the azureAsyncOperation property: The Azure-AsyncOperation property. + * + * @return the azureAsyncOperation value. + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set the azureAsyncOperation property: The Azure-AsyncOperation property. + * + * @param azureAsyncOperation the azureAsyncOperation value to set. + * @return the ManagementGroupsDeleteHeaders object itself. + */ + public ManagementGroupsDeleteHeaders withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + + /** + * Get the location property: The Location property. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The Location property. + * + * @param location the location value to set. + * @return the ManagementGroupsDeleteHeaders object itself. + */ + public ManagementGroupsDeleteHeaders withLocation(String location) { + this.location = location; + 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/ManagementGroupsDeleteResponse.java b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ManagementGroupsDeleteResponse.java new file mode 100644 index 000000000000..96ec5fe38c42 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/ManagementGroupsDeleteResponse.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.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.managementgroups.fluent.models.AzureAsyncOperationResultsInner; + +/** Contains all response data for the delete operation. */ +public final class ManagementGroupsDeleteResponse + extends ResponseBase { + /** + * Creates an instance of ManagementGroupsDeleteResponse. + * + * @param request the request which resulted in this ManagementGroupsDeleteResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public ManagementGroupsDeleteResponse( + HttpRequest request, + int statusCode, + HttpHeaders rawHeaders, + AzureAsyncOperationResultsInner value, + ManagementGroupsDeleteHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** @return the deserialized response body. */ + @Override + public AzureAsyncOperationResultsInner getValue() { + return super.getValue(); + } +} 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..80b943bc79dd --- /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.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The object that represents the operation. */ +@Immutable +public final class OperationDisplayProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationDisplayProperties.class); + + /* + * 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; + + /** + * 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..f9513ac14cf5 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/OperationListResult.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.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.managementgroups.fluent.models.OperationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +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 { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationListResult.class); + + /* + * 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; + + /** + * 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..963f06f08b13 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/Operations.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.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. + */ + 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. + */ + PagedIterable list(Context context); +} 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..5f7bdf77d31a --- /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.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** (Optional) The ID of the parent management group. */ +@Fluent +public final class ParentGroupInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ParentGroupInfo.class); + + /* + * 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; + + /** + * 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..ed08ad1f0a44 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/PatchManagementGroupRequest.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Management group patch parameters. */ +@Fluent +public final class PatchManagementGroupRequest { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PatchManagementGroupRequest.class); + + /* + * 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; + + /** + * 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..27cb7510c404 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/Permissions.java @@ -0,0 +1,40 @@ +// 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 Permissions. */ +public final class Permissions extends ExpandableStringEnum { + /** Static value noaccess for Permissions. */ + public static final Permissions NOACCESS = fromString("noaccess"); + + /** Static value view for Permissions. */ + public static final Permissions VIEW = fromString("view"); + + /** Static value edit for Permissions. */ + public static final Permissions EDIT = fromString("edit"); + + /** Static value delete for Permissions. */ + public static final Permissions DELETE = fromString("delete"); + + /** + * Creates or finds a Permissions from its string representation. + * + * @param name a name to look for. + * @return the corresponding Permissions. + */ + @JsonCreator + public static Permissions fromString(String name) { + return fromString(name, Permissions.class); + } + + /** @return known Permissions values. */ + public static Collection values() { + return values(Permissions.class); + } +} 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..04f1a56d796e --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/Reason.java @@ -0,0 +1,47 @@ +// 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; + +/** Defines values for Reason. */ +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) { + Reason[] items = Reason.values(); + for (Reason item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @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..33c1337ea365 --- /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. + * @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); + + /** + * 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); + + /** + * 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(); + + /** + * 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); + + /** + * 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(); + + /** + * 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); +} 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..1290f97034ab --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/Status.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.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for Status. */ +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) { + Status[] items = Status.values(); + for (Status item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @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..7eb0a8e6c91b --- /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 of the parent management group. + * + * @return the parent value. + */ + DescendantParentGroupInfo 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..12d87ee69c1d --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/main/java/com/azure/resourcemanager/managementgroups/models/Type.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.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for Type. */ +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) { + Type[] items = Type.values(); + for (Type item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @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..e61b0b44548b --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/EntitiesListSamples.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; + +import com.azure.core.util.Context; + +/** 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, 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..9d4f35445f6c --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/HierarchySettingsOperationCreateOrUpdateSamples.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.core.util.Context; +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"), + 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..4338f5c45c26 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/HierarchySettingsOperationDeleteSamples.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; + +import com.azure.core.util.Context; + +/** 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", 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..97a875df4a03 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/HierarchySettingsOperationGetSamples.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; + +import com.azure.core.util.Context; + +/** 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", 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..0fc95eac0124 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/HierarchySettingsOperationListSamples.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; + +import com.azure.core.util.Context; + +/** 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", 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..6b0f77cd1b9a --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/HierarchySettingsOperationUpdateSamples.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.core.util.Context; +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"), + 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..7ed7c8451dbc --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ManagementGroupSubscriptionsCreateSamples.java @@ -0,0 +1,25 @@ +// 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.core.util.Context; + +/** 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", 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..123bcc05128f --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ManagementGroupSubscriptionsDeleteSamples.java @@ -0,0 +1,25 @@ +// 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.core.util.Context; + +/** 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", 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..e2e3d31dbf9b --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ManagementGroupSubscriptionsGetSubscriptionSamples.java @@ -0,0 +1,25 @@ +// 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.core.util.Context; + +/** 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", 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..cf53f62fac3e --- /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; + +import com.azure.core.util.Context; + +/** 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, 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..dd8419d48d32 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ManagementGroupsCreateOrUpdateSamples.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.generated; + +import com.azure.core.util.Context; +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", + 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..dcc8d1e77d13 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ManagementGroupsDeleteSamples.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; + +import com.azure.core.util.Context; + +/** 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", 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..ed04bae962b2 --- /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; + +import com.azure.core.util.Context; + +/** 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, 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..18f337713487 --- /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.core.util.Context; +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", + 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", + 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", + 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", 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", + 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..44c02fc45152 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ManagementGroupsListSamples.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; + +import com.azure.core.util.Context; + +/** 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, 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..1332fe004a7f --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ManagementGroupsUpdateSamples.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.generated; + +import com.azure.core.util.Context; +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", + 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..6b364b45d4ac --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/OperationsListSamples.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; + +import com.azure.core.util.Context; + +/** 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(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..adf1dee4401c --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ResourceProviderCheckNameAvailabilitySamples.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.core.util.Context; +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), + 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..8a31101139d6 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ResourceProviderStartTenantBackfillSamples.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; + +import com.azure.core.util.Context; + +/** 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(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..c48bfb1f4611 --- /dev/null +++ b/sdk/managementgroups/azure-resourcemanager-managementgroups/src/samples/java/com/azure/resourcemanager/managementgroups/generated/ResourceProviderTenantBackfillStatusSamples.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; + +import com.azure.core.util.Context; + +/** 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(Context.NONE); + } +} diff --git a/sdk/managementgroups/ci.yml b/sdk/managementgroups/ci.yml new file mode 100644 index 000000000000..df0a1175c207 --- /dev/null +++ b/sdk/managementgroups/ci.yml @@ -0,0 +1,39 @@ +# 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 + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: managementgroups + Artifacts: + - name: azure-resourcemanager-managementgroups + groupId: com.azure.resourcemanager + safeName: azureresourcemanagermanagementgroups diff --git a/sdk/managementgroups/pom.xml b/sdk/managementgroups/pom.xml new file mode 100644 index 000000000000..b89b250f96e7 --- /dev/null +++ b/sdk/managementgroups/pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + com.azure + azure-managementgroups-service + pom + 1.0.0 + + + + coverage + + + + + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + + report-aggregate + verify + + report-aggregate + + + ${project.reporting.outputDirectory}/test-coverage + + + + + + + + + default + + true + + + azure-resourcemanager-managementgroups + + + +