From c4f0dd239eadc5a81f2dcffe5d12480e72274c55 Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Thu, 8 Jan 2026 05:41:41 +0000 Subject: [PATCH] [Automation] Generate Fluent Lite from Swagger subscription#package-2021-10 --- .../CHANGELOG.md | 191 +++++- .../README.md | 8 +- .../SAMPLE.md | 261 ++++++-- .../pom.xml | 4 +- .../subscription/SubscriptionManager.java | 57 +- .../subscription/fluent/AliasClient.java | 60 +- ...Client.java => BillingAccountsClient.java} | 29 +- .../subscription/fluent/OperationsClient.java | 20 +- .../fluent/SubscriptionClient.java | 28 +- .../fluent/SubscriptionOperationsClient.java | 78 +-- .../fluent/SubscriptionPoliciesClient.java | 88 +++ .../fluent/SubscriptionsClient.java | 152 ++++- .../AcceptOwnershipStatusResponseInner.java | 220 +++++++ .../BillingAccountPoliciesResponseInner.java | 168 +++++ ...java => GetTenantPolicyResponseInner.java} | 63 +- .../fluent/models/LocationInner.java | 163 ----- .../fluent/models/OperationInner.java | 153 +++++ .../models/OperationListResultInner.java | 128 ---- ... => SubscriptionAliasListResultInner.java} | 33 +- .../SubscriptionAliasResponseInner.java | 168 +++++ .../SubscriptionCreationResultInner.java | 96 +++ .../fluent/models/SubscriptionInner.java | 241 ------- .../models/TenantIdDescriptionInner.java | 212 ------- ...=> AcceptOwnershipStatusResponseImpl.java} | 48 +- .../implementation/AliasClientImpl.java | 375 ++++++----- .../implementation/AliasImpl.java | 44 +- .../BillingAccountPoliciesResponseImpl.java | 50 ++ .../BillingAccountsClientImpl.java | 160 +++++ .../implementation/BillingAccountsImpl.java | 56 ++ ....java => GetTenantPolicyResponseImpl.java} | 21 +- .../implementation/LocationImpl.java | 51 -- ...ListResultImpl.java => OperationImpl.java} | 31 +- .../implementation/OperationsClientImpl.java | 187 +++++- .../implementation/OperationsImpl.java | 28 +- ...a => SubscriptionAliasListResultImpl.java} | 22 +- .../SubscriptionAliasResponseImpl.java | 50 ++ .../SubscriptionClientImpl.java | 83 ++- .../SubscriptionCreationResultImpl.java | 32 + .../SubscriptionOperationsClientImpl.java | 327 ++-------- .../SubscriptionOperationsImpl.java | 62 +- .../SubscriptionPoliciesClientImpl.java | 474 ++++++++++++++ .../SubscriptionPoliciesImpl.java | 88 +++ .../SubscriptionsClientImpl.java | 587 ++++++++++++------ .../implementation/SubscriptionsImpl.java | 100 ++- .../TenantIdDescriptionImpl.java | 64 -- .../implementation/TenantsClientImpl.java | 226 ------- .../implementation/TenantsImpl.java | 45 -- .../subscription/models/AcceptOwnership.java | 56 ++ .../models/AcceptOwnershipRequest.java | 96 +++ .../AcceptOwnershipRequestProperties.java | 161 +++++ .../models/AcceptOwnershipStatusResponse.java | 69 ++ .../subscription/models/Alias.java | 44 +- .../BillingAccountPoliciesResponse.java | 55 ++ ...lingAccountPoliciesResponseProperties.java | 131 ++++ .../{Tenants.java => BillingAccounts.java} | 23 +- .../models/GetTenantPolicyListResponse.java | 104 ++++ ...onse.java => GetTenantPolicyResponse.java} | 22 +- .../subscription/models/Location.java | 62 -- .../models/LocationListResult.java | 99 --- .../subscription/models/Operation.java | 110 +--- .../subscription/models/OperationDisplay.java | 28 + .../models/OperationListResult.java | 114 +++- .../subscription/models/Operations.java | 14 +- .../subscription/models/Provisioning.java | 56 ++ .../subscription/models/PutAliasRequest.java | 9 +- .../PutAliasRequestAdditionalProperties.java | 181 ++++++ .../models/PutAliasRequestProperties.java | 57 +- .../models/PutAliasResponseProperties.java | 111 ---- .../PutTenantPolicyRequestProperties.java | 161 +++++ .../models/ServiceTenantResponse.java | 121 ++++ .../subscription/models/SpendingLimit.java | 61 -- .../subscription/models/Subscription.java | 79 --- ....java => SubscriptionAliasListResult.java} | 12 +- .../models/SubscriptionAliasResponse.java | 55 ++ .../SubscriptionAliasResponseProperties.java | 384 ++++++++++++ .../models/SubscriptionCreationResult.java | 27 + .../models/SubscriptionListResult.java | 127 ---- .../models/SubscriptionOperations.java | 66 +- .../SubscriptionOperationsGetHeaders.java | 89 +++ .../SubscriptionOperationsGetResponse.java | 40 ++ .../models/SubscriptionPolicies.java | 130 ++-- .../models/SubscriptionState.java | 71 --- .../subscription/models/Subscriptions.java | 100 ++- .../models/TenantIdDescription.java | 84 --- .../subscription/models/TenantListResult.java | 136 ---- .../subscription/models/TenantPolicy.java | 174 ++++++ .../proxy-config.json | 2 +- ...re-resourcemanager-subscription.properties | 1 + .../generated/AliasCreateSamples.java | 25 +- .../generated/AliasDeleteSamples.java | 2 +- .../generated/AliasGetSamples.java | 2 +- .../generated/AliasListSamples.java | 6 +- .../BillingAccountGetPolicySamples.java | 24 + .../generated/OperationsListSamples.java | 4 +- .../SubscriptionAcceptOwnershipSamples.java | 46 ++ ...scriptionAcceptOwnershipStatusSamples.java | 26 + ...es.java => SubscriptionCancelSamples.java} | 8 +- ...es.java => SubscriptionEnableSamples.java} | 8 +- ...a => SubscriptionOperationGetSamples.java} | 16 +- ...PolicyAddUpdatePolicyForTenantSamples.java | 34 + ...ptionPolicyGetPolicyForTenantSamples.java} | 13 +- ...ptionPolicyListPolicyForTenantSamples.java | 24 + ...es.java => SubscriptionRenameSamples.java} | 8 +- .../SubscriptionsListLocationsSamples.java | 23 - .../generated/TenantsListSamples.java | 23 - ...AcceptOwnershipRequestPropertiesTests.java | 46 ++ .../AcceptOwnershipRequestTests.java | 48 ++ ...ceptOwnershipStatusResponseInnerTests.java | 47 ++ .../generated/AliasCreateMockTests.java | 50 +- .../AliasDeleteWithResponseMockTests.java | 6 +- .../AliasGetWithResponseMockTests.java | 20 +- .../AliasListWithResponseMockTests.java | 11 +- ...lingAccountPoliciesResponseInnerTests.java | 38 ++ ...ccountPoliciesResponsePropertiesTests.java | 36 ++ ...ccountsGetPolicyWithResponseMockTests.java | 41 ++ .../CanceledSubscriptionIdInnerTests.java | 2 +- .../EnabledSubscriptionIdInnerTests.java | 4 +- .../GetTenantPolicyListResponseTests.java | 23 + .../GetTenantPolicyResponseInnerTests.java | 40 ++ .../generated/LocationInnerTests.java | 23 - .../generated/LocationListResultTests.java | 26 - .../generated/OperationDisplayTests.java | 26 +- .../generated/OperationInnerTests.java | 42 ++ .../OperationListResultInnerTests.java | 49 -- .../generated/OperationListResultTests.java | 48 ++ .../generated/OperationTests.java | 36 -- .../generated/OperationsListMockTests.java | 43 ++ .../OperationsListWithResponseMockTests.java | 42 -- .../PutAliasListResultInnerTests.java | 23 - ...AliasRequestAdditionalPropertiesTests.java | 50 ++ .../PutAliasRequestPropertiesTests.java | 59 +- .../generated/PutAliasRequestTests.java | 59 +- .../generated/PutAliasResponseInnerTests.java | 29 - .../PutAliasResponsePropertiesTests.java | 28 - ...PutTenantPolicyRequestPropertiesTests.java | 37 ++ .../RenamedSubscriptionIdInnerTests.java | 2 +- .../generated/ServiceTenantResponseTests.java | 27 + ...SubscriptionAliasListResultInnerTests.java | 23 + .../SubscriptionAliasResponseInnerTests.java | 68 ++ ...scriptionAliasResponsePropertiesTests.java | 66 ++ .../SubscriptionCreationResultInnerTests.java | 26 + .../generated/SubscriptionNameTests.java | 8 +- ...onOperationsGetWithResponseMockTests.java} | 21 +- ...ePolicyForTenantWithResponseMockTests.java | 52 ++ ...tPolicyForTenantWithResponseMockTests.java | 43 ++ ...nPoliciesListPolicyForTenantMockTests.java | 43 ++ .../generated/SubscriptionPoliciesTests.java | 23 - ...tOwnershipStatusWithResponseMockTests.java | 41 ++ ...criptionsCancelWithResponseMockTests.java} | 13 +- ...criptionsEnableWithResponseMockTests.java} | 13 +- ...criptionsRenameWithResponseMockTests.java} | 12 +- .../generated/TenantPolicyTests.java | 37 ++ 152 files changed, 7253 insertions(+), 3943 deletions(-) rename sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/{TenantsClient.java => BillingAccountsClient.java} (54%) create mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/SubscriptionPoliciesClient.java create mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/models/AcceptOwnershipStatusResponseInner.java create mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/models/BillingAccountPoliciesResponseInner.java rename sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/models/{PutAliasResponseInner.java => GetTenantPolicyResponseInner.java} (57%) delete mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/models/LocationInner.java create mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/models/OperationInner.java delete mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/models/OperationListResultInner.java rename sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/models/{PutAliasListResultInner.java => SubscriptionAliasListResultInner.java} (61%) create mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/models/SubscriptionAliasResponseInner.java create mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/models/SubscriptionCreationResultInner.java delete mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/models/SubscriptionInner.java delete mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/models/TenantIdDescriptionInner.java rename sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/{SubscriptionImpl.java => AcceptOwnershipStatusResponseImpl.java} (53%) create mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/BillingAccountPoliciesResponseImpl.java create mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/BillingAccountsClientImpl.java create mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/BillingAccountsImpl.java rename sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/{PutAliasResponseImpl.java => GetTenantPolicyResponseImpl.java} (58%) delete mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/LocationImpl.java rename sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/{OperationListResultImpl.java => OperationImpl.java} (52%) rename sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/{PutAliasListResultImpl.java => SubscriptionAliasListResultImpl.java} (54%) create mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/SubscriptionAliasResponseImpl.java create mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/SubscriptionCreationResultImpl.java create mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/SubscriptionPoliciesClientImpl.java create mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/SubscriptionPoliciesImpl.java delete mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/TenantIdDescriptionImpl.java delete mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/TenantsClientImpl.java delete mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/TenantsImpl.java create mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/AcceptOwnership.java create mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/AcceptOwnershipRequest.java create mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/AcceptOwnershipRequestProperties.java create mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/AcceptOwnershipStatusResponse.java create mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/BillingAccountPoliciesResponse.java create mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/BillingAccountPoliciesResponseProperties.java rename sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/{Tenants.java => BillingAccounts.java} (57%) create mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/GetTenantPolicyListResponse.java rename sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/{PutAliasResponse.java => GetTenantPolicyResponse.java} (56%) delete mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/Location.java delete mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/LocationListResult.java create mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/Provisioning.java create mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/PutAliasRequestAdditionalProperties.java delete mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/PutAliasResponseProperties.java create mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/PutTenantPolicyRequestProperties.java create mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/ServiceTenantResponse.java delete mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/SpendingLimit.java delete mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/Subscription.java rename sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/{PutAliasListResult.java => SubscriptionAliasListResult.java} (63%) create mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/SubscriptionAliasResponse.java create mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/SubscriptionAliasResponseProperties.java create mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/SubscriptionCreationResult.java delete mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/SubscriptionListResult.java create mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/SubscriptionOperationsGetHeaders.java create mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/SubscriptionOperationsGetResponse.java delete mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/SubscriptionState.java delete mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/TenantIdDescription.java delete mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/TenantListResult.java create mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/TenantPolicy.java create mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/main/resources/azure-resourcemanager-subscription.properties create mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/BillingAccountGetPolicySamples.java create mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/SubscriptionAcceptOwnershipSamples.java create mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/SubscriptionAcceptOwnershipStatusSamples.java rename sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/{SubscriptionOperationCancelSamples.java => SubscriptionCancelSamples.java} (77%) rename sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/{SubscriptionOperationEnableSamples.java => SubscriptionEnableSamples.java} (77%) rename sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/{SubscriptionsListSamples.java => SubscriptionOperationGetSamples.java} (50%) create mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/SubscriptionPolicyAddUpdatePolicyForTenantSamples.java rename sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/{SubscriptionsGetSamples.java => SubscriptionPolicyGetPolicyForTenantSamples.java} (55%) create mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/SubscriptionPolicyListPolicyForTenantSamples.java rename sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/{SubscriptionOperationRenameSamples.java => SubscriptionRenameSamples.java} (80%) delete mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/SubscriptionsListLocationsSamples.java delete mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/TenantsListSamples.java create mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/AcceptOwnershipRequestPropertiesTests.java create mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/AcceptOwnershipRequestTests.java create mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/AcceptOwnershipStatusResponseInnerTests.java create mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/BillingAccountPoliciesResponseInnerTests.java create mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/BillingAccountPoliciesResponsePropertiesTests.java create mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/BillingAccountsGetPolicyWithResponseMockTests.java create mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/GetTenantPolicyListResponseTests.java create mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/GetTenantPolicyResponseInnerTests.java delete mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/LocationInnerTests.java delete mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/LocationListResultTests.java create mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/OperationInnerTests.java delete mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/OperationListResultInnerTests.java create mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/OperationListResultTests.java delete mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/OperationTests.java create mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/OperationsListMockTests.java delete mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/OperationsListWithResponseMockTests.java delete mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/PutAliasListResultInnerTests.java create mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/PutAliasRequestAdditionalPropertiesTests.java delete mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/PutAliasResponseInnerTests.java delete mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/PutAliasResponsePropertiesTests.java create mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/PutTenantPolicyRequestPropertiesTests.java create mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/ServiceTenantResponseTests.java create mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionAliasListResultInnerTests.java create mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionAliasResponseInnerTests.java create mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionAliasResponsePropertiesTests.java create mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionCreationResultInnerTests.java rename sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/{SubscriptionsListLocationsMockTests.java => SubscriptionOperationsGetWithResponseMockTests.java} (58%) create mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionPoliciesAddUpdatePolicyForTenantWithResponseMockTests.java create mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionPoliciesGetPolicyForTenantWithResponseMockTests.java create mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionPoliciesListPolicyForTenantMockTests.java delete mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionPoliciesTests.java create mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionsAcceptOwnershipStatusWithResponseMockTests.java rename sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/{SubscriptionOperationsCancelWithResponseMockTests.java => SubscriptionsCancelWithResponseMockTests.java} (72%) rename sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/{SubscriptionOperationsEnableWithResponseMockTests.java => SubscriptionsEnableWithResponseMockTests.java} (72%) rename sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/{SubscriptionOperationsRenameWithResponseMockTests.java => SubscriptionsRenameWithResponseMockTests.java} (74%) create mode 100644 sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/TenantPolicyTests.java diff --git a/sdk/subscription/azure-resourcemanager-subscription/CHANGELOG.md b/sdk/subscription/azure-resourcemanager-subscription/CHANGELOG.md index 24adf4386ed8..b6b70e770f28 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/CHANGELOG.md +++ b/sdk/subscription/azure-resourcemanager-subscription/CHANGELOG.md @@ -1,14 +1,197 @@ # Release History -## 1.1.0-beta.1 (Unreleased) +## 1.1.0-beta.1 (2026-01-08) -### Features Added +- Azure Resource Manager Subscription client library for Java. This package contains Microsoft Azure SDK for Subscription Management SDK. The subscription client. Package tag package-2021-10. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ### Breaking Changes -### Bugs Fixed +#### `models.PutAliasResponse` was removed -### Other Changes +#### `models.TenantIdDescription` was removed + +#### `models.Subscription` was removed + +#### `models.PutAliasListResult` was removed + +#### `models.SubscriptionState` was removed + +#### `models.Tenants` was removed + +#### `models.SpendingLimit` was removed + +#### `models.SubscriptionListResult` was removed + +#### `models.LocationListResult` was removed + +#### `models.TenantListResult` was removed + +#### `models.PutAliasResponseProperties` was removed + +#### `models.Location` was removed + +#### `models.Operation` was modified + +* `Operation()` was removed +* `validate()` was removed +* `withDisplay(models.OperationDisplay)` was removed +* `models.OperationDisplay display()` -> `models.OperationDisplay display()` +* `withName(java.lang.String)` was removed +* `java.lang.String name()` -> `java.lang.String name()` +* `fromJson(com.azure.json.JsonReader)` was removed +* `toJson(com.azure.json.JsonWriter)` was removed + +#### `models.Subscriptions` was modified + +* `listLocations(java.lang.String,com.azure.core.util.Context)` was removed +* `list()` was removed +* `get(java.lang.String)` was removed +* `list(com.azure.core.util.Context)` was removed +* `getWithResponse(java.lang.String,com.azure.core.util.Context)` was removed +* `listLocations(java.lang.String)` was removed + +#### `models.Alias` was modified + +* `models.PutAliasResponse create(java.lang.String,models.PutAliasRequest)` -> `models.SubscriptionAliasResponse create(java.lang.String,models.PutAliasRequest)` +* `models.PutAliasResponse get(java.lang.String)` -> `models.SubscriptionAliasResponse get(java.lang.String)` +* `models.PutAliasListResult list()` -> `models.SubscriptionAliasListResult list()` +* `models.PutAliasResponse create(java.lang.String,models.PutAliasRequest,com.azure.core.util.Context)` -> `models.SubscriptionAliasResponse create(java.lang.String,models.PutAliasRequest,com.azure.core.util.Context)` + +#### `models.Operations` was modified + +* `listWithResponse(com.azure.core.util.Context)` was removed +* `models.OperationListResult list()` -> `com.azure.core.http.rest.PagedIterable list()` + +#### `models.SubscriptionPolicies` was modified + +* `SubscriptionPolicies()` was removed +* `locationPlacementId()` was removed +* `toJson(com.azure.json.JsonWriter)` was removed +* `validate()` was removed +* `quotaId()` was removed +* `spendingLimit()` was removed +* `fromJson(com.azure.json.JsonReader)` was removed + +#### `models.OperationListResult` was modified + +* `java.lang.String nextLink()` -> `java.lang.String nextLink()` +* `java.util.List value()` -> `java.util.List value()` +* `innerModel()` was removed + +#### `SubscriptionManager` was modified + +* `tenants()` was removed + +#### `models.SubscriptionOperations` was modified + +* `cancelWithResponse(java.lang.String,com.azure.core.util.Context)` was removed +* `rename(java.lang.String,models.SubscriptionName)` was removed +* `enable(java.lang.String)` was removed +* `enableWithResponse(java.lang.String,com.azure.core.util.Context)` was removed +* `cancel(java.lang.String)` was removed +* `renameWithResponse(java.lang.String,models.SubscriptionName,com.azure.core.util.Context)` was removed + +### Features Added + +* `models.TenantPolicy` was added + +* `models.GetTenantPolicyResponse` was added + +* `models.BillingAccountPoliciesResponse` was added + +* `models.ServiceTenantResponse` was added + +* `models.AcceptOwnershipRequest` was added + +* `models.SubscriptionAliasResponseProperties` was added + +* `models.PutAliasRequestAdditionalProperties` was added + +* `models.AcceptOwnershipRequestProperties` was added + +* `models.SubscriptionOperationsGetHeaders` was added + +* `models.SubscriptionAliasResponse` was added + +* `models.SubscriptionAliasListResult` was added + +* `models.GetTenantPolicyListResponse` was added + +* `models.BillingAccounts` was added + +* `models.SubscriptionOperationsGetResponse` was added + +* `models.BillingAccountPoliciesResponseProperties` was added + +* `models.PutTenantPolicyRequestProperties` was added + +* `models.SubscriptionCreationResult` was added + +* `models.Provisioning` was added + +* `models.AcceptOwnershipStatusResponse` was added + +* `models.AcceptOwnership` was added + +#### `models.Operation` was modified + +* `innerModel()` was added +* `isDataAction()` was added + +#### `models.PutAliasRequestProperties` was modified + +* `withAdditionalProperties(models.PutAliasRequestAdditionalProperties)` was added +* `additionalProperties()` was added + +#### `models.Subscriptions` was modified + +* `cancel(java.lang.String)` was added +* `enable(java.lang.String)` was added +* `acceptOwnershipStatus(java.lang.String)` was added +* `enableWithResponse(java.lang.String,com.azure.core.util.Context)` was added +* `renameWithResponse(java.lang.String,models.SubscriptionName,com.azure.core.util.Context)` was added +* `cancelWithResponse(java.lang.String,com.azure.core.util.Context)` was added +* `acceptOwnershipStatusWithResponse(java.lang.String,com.azure.core.util.Context)` was added +* `rename(java.lang.String,models.SubscriptionName)` was added +* `acceptOwnership(java.lang.String,models.AcceptOwnershipRequest,com.azure.core.util.Context)` was added +* `acceptOwnership(java.lang.String,models.AcceptOwnershipRequest)` was added + +#### `models.Operations` was modified + +* `list(com.azure.core.util.Context)` was added + +#### `models.OperationDisplay` was modified + +* `description()` was added +* `withDescription(java.lang.String)` was added + +#### `models.SubscriptionPolicies` was modified + +* `getPolicyForTenant()` was added +* `addUpdatePolicyForTenant(models.PutTenantPolicyRequestProperties)` was added +* `listPolicyForTenant()` was added +* `addUpdatePolicyForTenantWithResponse(models.PutTenantPolicyRequestProperties,com.azure.core.util.Context)` was added +* `listPolicyForTenant(com.azure.core.util.Context)` was added +* `getPolicyForTenantWithResponse(com.azure.core.util.Context)` was added + +#### `models.OperationListResult` was modified + +* `OperationListResult()` was added +* `toJson(com.azure.json.JsonWriter)` was added +* `validate()` was added +* `withNextLink(java.lang.String)` was added +* `fromJson(com.azure.json.JsonReader)` was added +* `withValue(java.util.List)` was added + +#### `SubscriptionManager` was modified + +* `billingAccounts()` was added +* `subscriptionPolicies()` was added + +#### `models.SubscriptionOperations` was modified + +* `getWithResponse(java.lang.String,com.azure.core.util.Context)` was added +* `get(java.lang.String)` was added ## 1.0.0 (2024-12-25) diff --git a/sdk/subscription/azure-resourcemanager-subscription/README.md b/sdk/subscription/azure-resourcemanager-subscription/README.md index 9737d6f43586..0dbf29a378d0 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/README.md +++ b/sdk/subscription/azure-resourcemanager-subscription/README.md @@ -2,7 +2,7 @@ Azure Resource Manager Subscription client library for Java. -This package contains Microsoft Azure SDK for Subscription Management SDK. The subscription client. Package tag package-2020-09. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +This package contains Microsoft Azure SDK for Subscription Management SDK. The subscription client. Package tag package-2021-10. 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 @@ -52,7 +52,7 @@ Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment Assuming the use of the `DefaultAzureCredential` credential class, the client can be authenticated using the following code: ```java -AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +AzureProfile profile = new AzureProfile(AzureCloud.AZURE_PUBLIC_CLOUD); TokenCredential credential = new DefaultAzureCredentialBuilder() .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) .build(); @@ -60,7 +60,7 @@ SubscriptionManager manager = SubscriptionManager .authenticate(credential, profile); ``` -The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. +The sample code assumes global Azure. Please change the `AzureCloud.AZURE_PUBLIC_CLOUD` variable if otherwise. See [Authentication][authenticate] for more options. @@ -100,5 +100,3 @@ This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For m [cg]: https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md [coc]: https://opensource.microsoft.com/codeofconduct/ [coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ - - diff --git a/sdk/subscription/azure-resourcemanager-subscription/SAMPLE.md b/sdk/subscription/azure-resourcemanager-subscription/SAMPLE.md index b56981995cd6..df78d86dbb86 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/SAMPLE.md +++ b/sdk/subscription/azure-resourcemanager-subscription/SAMPLE.md @@ -8,31 +8,40 @@ - [Get](#alias_get) - [List](#alias_list) +## BillingAccount + +- [GetPolicy](#billingaccount_getpolicy) + ## Operations - [List](#operations_list) -## SubscriptionOperation +## Subscription -- [Cancel](#subscriptionoperation_cancel) -- [Enable](#subscriptionoperation_enable) -- [Rename](#subscriptionoperation_rename) +- [AcceptOwnership](#subscription_acceptownership) +- [AcceptOwnershipStatus](#subscription_acceptownershipstatus) +- [Cancel](#subscription_cancel) +- [Enable](#subscription_enable) +- [Rename](#subscription_rename) -## Subscriptions +## SubscriptionOperation -- [Get](#subscriptions_get) -- [List](#subscriptions_list) -- [ListLocations](#subscriptions_listlocations) +- [Get](#subscriptionoperation_get) -## Tenants +## SubscriptionPolicy -- [List](#tenants_list) +- [AddUpdatePolicyForTenant](#subscriptionpolicy_addupdatepolicyfortenant) +- [GetPolicyForTenant](#subscriptionpolicy_getpolicyfortenant) +- [ListPolicyForTenant](#subscriptionpolicy_listpolicyfortenant) ### Alias_Create ```java import com.azure.resourcemanager.subscription.models.PutAliasRequest; +import com.azure.resourcemanager.subscription.models.PutAliasRequestAdditionalProperties; import com.azure.resourcemanager.subscription.models.PutAliasRequestProperties; import com.azure.resourcemanager.subscription.models.Workload; +import java.util.HashMap; +import java.util.Map; /** * Samples for Alias Create. @@ -40,7 +49,7 @@ import com.azure.resourcemanager.subscription.models.Workload; public final class AliasCreateSamples { /* * x-ms-original-file: - * specification/subscription/resource-manager/Microsoft.Subscription/stable/2020-09-01/examples/createAlias.json + * specification/subscription/resource-manager/Microsoft.Subscription/stable/2021-10-01/examples/createAlias.json */ /** * Sample code: CreateAlias. @@ -50,12 +59,28 @@ public final class AliasCreateSamples { public static void createAlias(com.azure.resourcemanager.subscription.SubscriptionManager manager) { manager.alias() .create("aliasForNewSub", new PutAliasRequest().withProperties(new PutAliasRequestProperties() - .withDisplayName("Contoso MCA subscription") + .withDisplayName("Test Subscription") .withWorkload(Workload.PRODUCTION) .withBillingScope( - "/providers/Microsoft.Billing/billingAccounts/e879cf0f-2b4d-5431-109a-f72fc9868693:024cabf4-7321-4cf9-be59-df0c77ca51de_2019-05-31/billingProfiles/PE2Q-NOIT-BG7-TGB/invoiceSections/MTT4-OBS7-PJA-TGB")), + "/billingAccounts/af6231a7-7f8d-4fcc-a993-dd8466108d07:c663dac6-a9a5-405a-8938-cd903e12ab5b_2019_05_31/billingProfiles/QWDQ-QWHI-AUW-SJDO-DJH/invoiceSections/FEUF-EUHE-ISJ-SKDW-DJH") + .withAdditionalProperties(new PutAliasRequestAdditionalProperties() + .withSubscriptionTenantId("66f6e4d6-07dc-4aea-94ea-e12d3026a3c8") + .withSubscriptionOwnerId("f09b39eb-c496-482c-9ab9-afd799572f4c") + .withTags(mapOf("tag1", "Messi", "tag2", "Ronaldo", "tag3", "Lebron")))), com.azure.core.util.Context.NONE); } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } } ``` @@ -68,7 +93,7 @@ public final class AliasCreateSamples { public final class AliasDeleteSamples { /* * x-ms-original-file: - * specification/subscription/resource-manager/Microsoft.Subscription/stable/2020-09-01/examples/deleteAlias.json + * specification/subscription/resource-manager/Microsoft.Subscription/stable/2021-10-01/examples/deleteAlias.json */ /** * Sample code: DeleteAlias. @@ -90,7 +115,7 @@ public final class AliasDeleteSamples { public final class AliasGetSamples { /* * x-ms-original-file: - * specification/subscription/resource-manager/Microsoft.Subscription/stable/2020-09-01/examples/getAlias.json + * specification/subscription/resource-manager/Microsoft.Subscription/stable/2021-10-01/examples/getAlias.json */ /** * Sample code: GetAlias. @@ -112,19 +137,42 @@ public final class AliasGetSamples { public final class AliasListSamples { /* * x-ms-original-file: - * specification/subscription/resource-manager/Microsoft.Subscription/stable/2020-09-01/examples/listAlias.json + * specification/subscription/resource-manager/Microsoft.Subscription/stable/2021-10-01/examples/listAlias.json */ /** - * Sample code: GetAlias. + * Sample code: ListAlias. * * @param manager Entry point to SubscriptionManager. */ - public static void getAlias(com.azure.resourcemanager.subscription.SubscriptionManager manager) { + public static void listAlias(com.azure.resourcemanager.subscription.SubscriptionManager manager) { manager.alias().listWithResponse(com.azure.core.util.Context.NONE); } } ``` +### BillingAccount_GetPolicy + +```java +/** + * Samples for BillingAccount GetPolicy. + */ +public final class BillingAccountGetPolicySamples { + /* + * x-ms-original-file: + * specification/subscription/resource-manager/Microsoft.Subscription/stable/2021-10-01/examples/ + * getBillingAccountPolicy.json + */ + /** + * Sample code: GetBillingAccountPolicy. + * + * @param manager Entry point to SubscriptionManager. + */ + public static void getBillingAccountPolicy(com.azure.resourcemanager.subscription.SubscriptionManager manager) { + manager.billingAccounts().getPolicyWithResponse("testBillingAccountId", com.azure.core.util.Context.NONE); + } +} +``` + ### Operations_List ```java @@ -134,7 +182,7 @@ public final class AliasListSamples { public final class OperationsListSamples { /* * x-ms-original-file: - * specification/subscription/resource-manager/Microsoft.Subscription/stable/2020-09-01/examples/getOperations.json + * specification/subscription/resource-manager/Microsoft.Subscription/stable/2021-10-01/examples/getOperations.json */ /** * Sample code: getOperations. @@ -142,21 +190,91 @@ public final class OperationsListSamples { * @param manager Entry point to SubscriptionManager. */ public static void getOperations(com.azure.resourcemanager.subscription.SubscriptionManager manager) { - manager.operations().listWithResponse(com.azure.core.util.Context.NONE); + manager.operations().list(com.azure.core.util.Context.NONE); + } +} +``` + +### Subscription_AcceptOwnership + +```java +import com.azure.resourcemanager.subscription.models.AcceptOwnershipRequest; +import com.azure.resourcemanager.subscription.models.AcceptOwnershipRequestProperties; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Subscription AcceptOwnership. + */ +public final class SubscriptionAcceptOwnershipSamples { + /* + * x-ms-original-file: + * specification/subscription/resource-manager/Microsoft.Subscription/stable/2021-10-01/examples/ + * acceptSubscriptionOwnership.json + */ + /** + * Sample code: AcceptOwnership. + * + * @param manager Entry point to SubscriptionManager. + */ + public static void acceptOwnership(com.azure.resourcemanager.subscription.SubscriptionManager manager) { + manager.subscriptions() + .acceptOwnership("291bba3f-e0a5-47bc-a099-3bdcb2a50a05", + new AcceptOwnershipRequest() + .withProperties(new AcceptOwnershipRequestProperties().withDisplayName("Test Subscription") + .withTags(mapOf("tag1", "Messi", "tag2", "Ronaldo", "tag3", "Lebron"))), + com.azure.core.util.Context.NONE); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### Subscription_AcceptOwnershipStatus + +```java +/** + * Samples for Subscription AcceptOwnershipStatus. + */ +public final class SubscriptionAcceptOwnershipStatusSamples { + /* + * x-ms-original-file: + * specification/subscription/resource-manager/Microsoft.Subscription/stable/2021-10-01/examples/ + * acceptOwnershipStatus.json + */ + /** + * Sample code: AcceptOwnershipStatus. + * + * @param manager Entry point to SubscriptionManager. + */ + public static void acceptOwnershipStatus(com.azure.resourcemanager.subscription.SubscriptionManager manager) { + manager.subscriptions() + .acceptOwnershipStatusWithResponse("291bba3f-e0a5-47bc-a099-3bdcb2a50a05", + com.azure.core.util.Context.NONE); } } ``` -### SubscriptionOperation_Cancel +### Subscription_Cancel ```java /** - * Samples for SubscriptionOperation Cancel. + * Samples for Subscription Cancel. */ -public final class SubscriptionOperationCancelSamples { +public final class SubscriptionCancelSamples { /* * x-ms-original-file: - * specification/subscription/resource-manager/Microsoft.Subscription/stable/2020-09-01/examples/cancelSubscription. + * specification/subscription/resource-manager/Microsoft.Subscription/stable/2021-10-01/examples/cancelSubscription. * json */ /** @@ -165,22 +283,22 @@ public final class SubscriptionOperationCancelSamples { * @param manager Entry point to SubscriptionManager. */ public static void cancelSubscription(com.azure.resourcemanager.subscription.SubscriptionManager manager) { - manager.subscriptionOperations() + manager.subscriptions() .cancelWithResponse("83aa47df-e3e9-49ff-877b-94304bf3d3ad", com.azure.core.util.Context.NONE); } } ``` -### SubscriptionOperation_Enable +### Subscription_Enable ```java /** - * Samples for SubscriptionOperation Enable. + * Samples for Subscription Enable. */ -public final class SubscriptionOperationEnableSamples { +public final class SubscriptionEnableSamples { /* * x-ms-original-file: - * specification/subscription/resource-manager/Microsoft.Subscription/stable/2020-09-01/examples/enableSubscription. + * specification/subscription/resource-manager/Microsoft.Subscription/stable/2021-10-01/examples/enableSubscription. * json */ /** @@ -189,24 +307,24 @@ public final class SubscriptionOperationEnableSamples { * @param manager Entry point to SubscriptionManager. */ public static void enableSubscription(com.azure.resourcemanager.subscription.SubscriptionManager manager) { - manager.subscriptionOperations() + manager.subscriptions() .enableWithResponse("7948bcee-488c-47ce-941c-38e20ede803d", com.azure.core.util.Context.NONE); } } ``` -### SubscriptionOperation_Rename +### Subscription_Rename ```java import com.azure.resourcemanager.subscription.models.SubscriptionName; /** - * Samples for SubscriptionOperation Rename. + * Samples for Subscription Rename. */ -public final class SubscriptionOperationRenameSamples { +public final class SubscriptionRenameSamples { /* * x-ms-original-file: - * specification/subscription/resource-manager/Microsoft.Subscription/stable/2020-09-01/examples/renameSubscription. + * specification/subscription/resource-manager/Microsoft.Subscription/stable/2021-10-01/examples/renameSubscription. * json */ /** @@ -215,100 +333,113 @@ public final class SubscriptionOperationRenameSamples { * @param manager Entry point to SubscriptionManager. */ public static void renameSubscription(com.azure.resourcemanager.subscription.SubscriptionManager manager) { - manager.subscriptionOperations() + manager.subscriptions() .renameWithResponse("83aa47df-e3e9-49ff-877b-94304bf3d3ad", new SubscriptionName().withSubscriptionName("Test Sub"), com.azure.core.util.Context.NONE); } } ``` -### Subscriptions_Get +### SubscriptionOperation_Get ```java /** - * Samples for Subscriptions Get. + * Samples for SubscriptionOperation Get. */ -public final class SubscriptionsGetSamples { +public final class SubscriptionOperationGetSamples { /* * x-ms-original-file: - * specification/subscription/resource-manager/Microsoft.Subscription/stable/2016-06-01/examples/getSubscription. - * json + * specification/subscription/resource-manager/Microsoft.Subscription/stable/2021-10-01/examples/ + * getSubscriptionOperation.json */ /** - * Sample code: getSubscription. + * Sample code: getPendingSubscriptionOperations. * * @param manager Entry point to SubscriptionManager. */ - public static void getSubscription(com.azure.resourcemanager.subscription.SubscriptionManager manager) { - manager.subscriptions() - .getWithResponse("83aa47df-e3e9-49ff-877b-94304bf3d3ad", com.azure.core.util.Context.NONE); + public static void + getPendingSubscriptionOperations(com.azure.resourcemanager.subscription.SubscriptionManager manager) { + manager.subscriptionOperations() + .getWithResponse("e4b8d068-f574-462a-a76f-6fa0afc613c9", com.azure.core.util.Context.NONE); } } ``` -### Subscriptions_List +### SubscriptionPolicy_AddUpdatePolicyForTenant ```java +import com.azure.resourcemanager.subscription.models.PutTenantPolicyRequestProperties; +import java.util.Arrays; +import java.util.UUID; + /** - * Samples for Subscriptions List. + * Samples for SubscriptionPolicy AddUpdatePolicyForTenant. */ -public final class SubscriptionsListSamples { +public final class SubscriptionPolicyAddUpdatePolicyForTenantSamples { /* * x-ms-original-file: - * specification/subscription/resource-manager/Microsoft.Subscription/stable/2016-06-01/examples/listSubscriptions. + * specification/subscription/resource-manager/Microsoft.Subscription/stable/2021-10-01/examples/changeTenantPolicy. * json */ /** - * Sample code: listSubscriptions. + * Sample code: TenantPolicy. * * @param manager Entry point to SubscriptionManager. */ - public static void listSubscriptions(com.azure.resourcemanager.subscription.SubscriptionManager manager) { - manager.subscriptions().list(com.azure.core.util.Context.NONE); + public static void tenantPolicy(com.azure.resourcemanager.subscription.SubscriptionManager manager) { + manager.subscriptionPolicies() + .addUpdatePolicyForTenantWithResponse( + new PutTenantPolicyRequestProperties().withBlockSubscriptionsLeavingTenant(true) + .withBlockSubscriptionsIntoTenant(true) + .withExemptedPrincipals(Arrays.asList(UUID.fromString("e879cf0f-2b4d-5431-109a-f72fc9868693"), + UUID.fromString("9792da87-c97b-410d-a97d-27021ba09ce6"))), + com.azure.core.util.Context.NONE); } } ``` -### Subscriptions_ListLocations +### SubscriptionPolicy_GetPolicyForTenant ```java /** - * Samples for Subscriptions ListLocations. + * Samples for SubscriptionPolicy GetPolicyForTenant. */ -public final class SubscriptionsListLocationsSamples { +public final class SubscriptionPolicyGetPolicyForTenantSamples { /* * x-ms-original-file: - * specification/subscription/resource-manager/Microsoft.Subscription/stable/2016-06-01/examples/listLocations.json + * specification/subscription/resource-manager/Microsoft.Subscription/stable/2021-10-01/examples/getTenantPolicy. + * json */ /** - * Sample code: listLocations. + * Sample code: getTenantPolicy. * * @param manager Entry point to SubscriptionManager. */ - public static void listLocations(com.azure.resourcemanager.subscription.SubscriptionManager manager) { - manager.subscriptions().listLocations("83aa47df-e3e9-49ff-877b-94304bf3d3ad", com.azure.core.util.Context.NONE); + public static void getTenantPolicy(com.azure.resourcemanager.subscription.SubscriptionManager manager) { + manager.subscriptionPolicies().getPolicyForTenantWithResponse(com.azure.core.util.Context.NONE); } } ``` -### Tenants_List +### SubscriptionPolicy_ListPolicyForTenant ```java /** - * Samples for Tenants List. + * Samples for SubscriptionPolicy ListPolicyForTenant. */ -public final class TenantsListSamples { +public final class SubscriptionPolicyListPolicyForTenantSamples { /* * x-ms-original-file: - * specification/subscription/resource-manager/Microsoft.Subscription/stable/2016-06-01/examples/listTenants.json + * specification/subscription/resource-manager/Microsoft.Subscription/stable/2021-10-01/examples/getTenantPolicyList + * .json */ /** - * Sample code: listTenants. + * Sample code: getTenantPolicyList. * * @param manager Entry point to SubscriptionManager. */ - public static void listTenants(com.azure.resourcemanager.subscription.SubscriptionManager manager) { - manager.tenants().list(com.azure.core.util.Context.NONE); + public static void getTenantPolicyList(com.azure.resourcemanager.subscription.SubscriptionManager manager) { + manager.subscriptionPolicies().listPolicyForTenant(com.azure.core.util.Context.NONE); } } ``` diff --git a/sdk/subscription/azure-resourcemanager-subscription/pom.xml b/sdk/subscription/azure-resourcemanager-subscription/pom.xml index 7b29e6dabdd4..1206ee1d1745 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/pom.xml +++ b/sdk/subscription/azure-resourcemanager-subscription/pom.xml @@ -18,7 +18,7 @@ jar Microsoft Azure SDK for Subscription Management - This package contains Microsoft Azure SDK for Subscription Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. The subscription client. Package tag package-2020-09. + This package contains Microsoft Azure SDK for Subscription Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. The subscription client. Package tag package-2021-10. https://github.com/Azure/azure-sdk-for-java @@ -45,7 +45,7 @@ UTF-8 0 0 - false + true diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/SubscriptionManager.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/SubscriptionManager.java index 13fc94c42623..b2d2c3cb127f 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/SubscriptionManager.java +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/SubscriptionManager.java @@ -22,23 +22,27 @@ import com.azure.core.http.policy.UserAgentPolicy; import com.azure.core.management.profile.AzureProfile; import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.subscription.fluent.SubscriptionClient; import com.azure.resourcemanager.subscription.implementation.AliasImpl; +import com.azure.resourcemanager.subscription.implementation.BillingAccountsImpl; import com.azure.resourcemanager.subscription.implementation.OperationsImpl; import com.azure.resourcemanager.subscription.implementation.SubscriptionClientBuilder; import com.azure.resourcemanager.subscription.implementation.SubscriptionOperationsImpl; +import com.azure.resourcemanager.subscription.implementation.SubscriptionPoliciesImpl; import com.azure.resourcemanager.subscription.implementation.SubscriptionsImpl; -import com.azure.resourcemanager.subscription.implementation.TenantsImpl; import com.azure.resourcemanager.subscription.models.Alias; +import com.azure.resourcemanager.subscription.models.BillingAccounts; import com.azure.resourcemanager.subscription.models.Operations; import com.azure.resourcemanager.subscription.models.SubscriptionOperations; +import com.azure.resourcemanager.subscription.models.SubscriptionPolicies; import com.azure.resourcemanager.subscription.models.Subscriptions; -import com.azure.resourcemanager.subscription.models.Tenants; import java.time.Duration; import java.time.temporal.ChronoUnit; import java.util.ArrayList; import java.util.List; +import java.util.Map; import java.util.Objects; import java.util.stream.Collectors; @@ -49,14 +53,16 @@ public final class SubscriptionManager { private Subscriptions subscriptions; - private Tenants tenants; - private SubscriptionOperations subscriptionOperations; private Operations operations; private Alias alias; + private SubscriptionPolicies subscriptionPolicies; + + private BillingAccounts billingAccounts; + private final SubscriptionClient clientObject; private SubscriptionManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { @@ -108,6 +114,9 @@ public static Configurable configure() { */ public static final class Configurable { private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + private static final String SDK_VERSION = "version"; + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-resourcemanager-subscription.properties"); private HttpClient httpClient; private HttpLogOptions httpLogOptions; @@ -215,12 +224,14 @@ public SubscriptionManager authenticate(TokenCredential credential, AzureProfile Objects.requireNonNull(credential, "'credential' cannot be null."); Objects.requireNonNull(profile, "'profile' cannot be null."); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + StringBuilder userAgentBuilder = new StringBuilder(); userAgentBuilder.append("azsdk-java") .append("-") .append("com.azure.resourcemanager.subscription") .append("/") - .append("1.0.0"); + .append(clientVersion); if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { userAgentBuilder.append(" (") .append(Configuration.getGlobalConfiguration().get("java.version")) @@ -278,18 +289,6 @@ public Subscriptions subscriptions() { return subscriptions; } - /** - * Gets the resource collection API of Tenants. - * - * @return Resource collection API of Tenants. - */ - public Tenants tenants() { - if (this.tenants == null) { - this.tenants = new TenantsImpl(clientObject.getTenants(), this); - } - return tenants; - } - /** * Gets the resource collection API of SubscriptionOperations. * @@ -327,6 +326,30 @@ public Alias alias() { return alias; } + /** + * Gets the resource collection API of SubscriptionPolicies. + * + * @return Resource collection API of SubscriptionPolicies. + */ + public SubscriptionPolicies subscriptionPolicies() { + if (this.subscriptionPolicies == null) { + this.subscriptionPolicies = new SubscriptionPoliciesImpl(clientObject.getSubscriptionPolicies(), this); + } + return subscriptionPolicies; + } + + /** + * Gets the resource collection API of BillingAccounts. + * + * @return Resource collection API of BillingAccounts. + */ + public BillingAccounts billingAccounts() { + if (this.billingAccounts == null) { + this.billingAccounts = new BillingAccountsImpl(clientObject.getBillingAccounts(), this); + } + return billingAccounts; + } + /** * Gets wrapped service client SubscriptionClient providing direct access to the underlying auto-generated API * implementation, based on Azure REST API. diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/AliasClient.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/AliasClient.java index f3020133bb53..fa2efdd10c4a 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/AliasClient.java +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/AliasClient.java @@ -10,8 +10,8 @@ import com.azure.core.management.polling.PollResult; import com.azure.core.util.Context; import com.azure.core.util.polling.SyncPoller; -import com.azure.resourcemanager.subscription.fluent.models.PutAliasListResultInner; -import com.azure.resourcemanager.subscription.fluent.models.PutAliasResponseInner; +import com.azure.resourcemanager.subscription.fluent.models.SubscriptionAliasListResultInner; +import com.azure.resourcemanager.subscription.fluent.models.SubscriptionAliasResponseInner; import com.azure.resourcemanager.subscription.models.PutAliasRequest; /** @@ -21,8 +21,8 @@ public interface AliasClient { /** * Create Alias Subscription. * - * @param aliasName Name for this subscription creation request also known as alias. Note that this is not the same - * as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. + * @param aliasName AliasName is the name for the subscription creation request. Note that this is not the same as + * subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. * @param body The body parameter. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -30,14 +30,14 @@ public interface AliasClient { * @return the {@link SyncPoller} for polling of subscription Information with the alias. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, PutAliasResponseInner> beginCreate(String aliasName, + SyncPoller, SubscriptionAliasResponseInner> beginCreate(String aliasName, PutAliasRequest body); /** * Create Alias Subscription. * - * @param aliasName Name for this subscription creation request also known as alias. Note that this is not the same - * as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. + * @param aliasName AliasName is the name for the subscription creation request. Note that this is not the same as + * subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. * @param body The body parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -46,14 +46,14 @@ SyncPoller, PutAliasResponseInner> beginCreate * @return the {@link SyncPoller} for polling of subscription Information with the alias. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, PutAliasResponseInner> beginCreate(String aliasName, + SyncPoller, SubscriptionAliasResponseInner> beginCreate(String aliasName, PutAliasRequest body, Context context); /** * Create Alias Subscription. * - * @param aliasName Name for this subscription creation request also known as alias. Note that this is not the same - * as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. + * @param aliasName AliasName is the name for the subscription creation request. Note that this is not the same as + * subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. * @param body The body parameter. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -61,13 +61,13 @@ SyncPoller, PutAliasResponseInner> beginCreate * @return subscription Information with the alias. */ @ServiceMethod(returns = ReturnType.SINGLE) - PutAliasResponseInner create(String aliasName, PutAliasRequest body); + SubscriptionAliasResponseInner create(String aliasName, PutAliasRequest body); /** * Create Alias Subscription. * - * @param aliasName Name for this subscription creation request also known as alias. Note that this is not the same - * as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. + * @param aliasName AliasName is the name for the subscription creation request. Note that this is not the same as + * subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. * @param body The body parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -76,13 +76,13 @@ SyncPoller, PutAliasResponseInner> beginCreate * @return subscription Information with the alias. */ @ServiceMethod(returns = ReturnType.SINGLE) - PutAliasResponseInner create(String aliasName, PutAliasRequest body, Context context); + SubscriptionAliasResponseInner create(String aliasName, PutAliasRequest body, Context context); /** * Get Alias Subscription. * - * @param aliasName Name for this subscription creation request also known as alias. Note that this is not the same - * as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. + * @param aliasName AliasName is the name for the subscription creation request. Note that this is not the same as + * subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. * @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. @@ -90,26 +90,26 @@ SyncPoller, PutAliasResponseInner> beginCreate * @return alias Subscription along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response getWithResponse(String aliasName, Context context); + Response getWithResponse(String aliasName, Context context); /** * Get Alias Subscription. * - * @param aliasName Name for this subscription creation request also known as alias. Note that this is not the same - * as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. + * @param aliasName AliasName is the name for the subscription creation request. Note that this is not the same as + * subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. * @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 alias Subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - PutAliasResponseInner get(String aliasName); + SubscriptionAliasResponseInner get(String aliasName); /** * Delete Alias. * - * @param aliasName Name for this subscription creation request also known as alias. Note that this is not the same - * as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. + * @param aliasName AliasName is the name for the subscription creation request. Note that this is not the same as + * subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. * @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. @@ -122,8 +122,8 @@ SyncPoller, PutAliasResponseInner> beginCreate /** * Delete Alias. * - * @param aliasName Name for this subscription creation request also known as alias. Note that this is not the same - * as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. + * @param aliasName AliasName is the name for the subscription creation request. Note that this is not the same as + * subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. * @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. @@ -132,24 +132,24 @@ SyncPoller, PutAliasResponseInner> beginCreate void delete(String aliasName); /** - * Get Alias Subscription. + * List Alias Subscription. * * @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 alias Subscription along with {@link Response}. + * @return the list of aliases along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response listWithResponse(Context context); + Response listWithResponse(Context context); /** - * Get Alias Subscription. + * List Alias Subscription. * * @throws com.azure.core.management.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 alias Subscription. + * @return the list of aliases. */ @ServiceMethod(returns = ReturnType.SINGLE) - PutAliasListResultInner list(); + SubscriptionAliasListResultInner list(); } diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/TenantsClient.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/BillingAccountsClient.java similarity index 54% rename from sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/TenantsClient.java rename to sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/BillingAccountsClient.java index fe3c73cd0cfc..36cd72914c31 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/TenantsClient.java +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/BillingAccountsClient.java @@ -6,33 +6,36 @@ 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.subscription.fluent.models.TenantIdDescriptionInner; +import com.azure.resourcemanager.subscription.fluent.models.BillingAccountPoliciesResponseInner; /** - * An instance of this class provides access to all the operations defined in TenantsClient. + * An instance of this class provides access to all the operations defined in BillingAccountsClient. */ -public interface TenantsClient { +public interface BillingAccountsClient { /** - * Gets the tenants for your account. + * Get Billing Account Policy. * + * @param billingAccountId Billing Account 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 tenants for your account as paginated response with {@link PagedIterable}. + * @return billing Account Policy along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(); + @ServiceMethod(returns = ReturnType.SINGLE) + Response getPolicyWithResponse(String billingAccountId, Context context); /** - * Gets the tenants for your account. + * Get Billing Account Policy. * - * @param context The context to associate with this operation. + * @param billingAccountId Billing Account 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 tenants for your account as paginated response with {@link PagedIterable}. + * @return billing Account Policy. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(Context context); + @ServiceMethod(returns = ReturnType.SINGLE) + BillingAccountPoliciesResponseInner getPolicy(String billingAccountId); } diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/OperationsClient.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/OperationsClient.java index 4eb3edc9cf0d..d18d26715ebd 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/OperationsClient.java +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/OperationsClient.java @@ -6,9 +6,9 @@ import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; -import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.PagedIterable; import com.azure.core.util.Context; -import com.azure.resourcemanager.subscription.fluent.models.OperationListResultInner; +import com.azure.resourcemanager.subscription.fluent.models.OperationInner; /** * An instance of this class provides access to all the operations defined in OperationsClient. @@ -17,22 +17,22 @@ public interface OperationsClient { /** * Lists all of the available Microsoft.Subscription 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 result of the request to list operations along with {@link Response}. + * @return result of the request to list operations as paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response listWithResponse(Context context); + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); /** * Lists all of the available Microsoft.Subscription 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 result of the request to list operations. + * @return result of the request to list operations as paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - OperationListResultInner list(); + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); } diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/SubscriptionClient.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/SubscriptionClient.java index 746fe0655fb0..ebcb68105949 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/SubscriptionClient.java +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/SubscriptionClient.java @@ -18,6 +18,13 @@ public interface SubscriptionClient { */ String getEndpoint(); + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + String getApiVersion(); + /** * Gets The HTTP pipeline to send requests through. * @@ -39,13 +46,6 @@ public interface SubscriptionClient { */ SubscriptionsClient getSubscriptions(); - /** - * Gets the TenantsClient object to access its operations. - * - * @return the TenantsClient object. - */ - TenantsClient getTenants(); - /** * Gets the SubscriptionOperationsClient object to access its operations. * @@ -66,4 +66,18 @@ public interface SubscriptionClient { * @return the AliasClient object. */ AliasClient getAlias(); + + /** + * Gets the SubscriptionPoliciesClient object to access its operations. + * + * @return the SubscriptionPoliciesClient object. + */ + SubscriptionPoliciesClient getSubscriptionPolicies(); + + /** + * Gets the BillingAccountsClient object to access its operations. + * + * @return the BillingAccountsClient object. + */ + BillingAccountsClient getBillingAccounts(); } diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/SubscriptionOperationsClient.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/SubscriptionOperationsClient.java index ed34132e6193..55b5f17b50b0 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/SubscriptionOperationsClient.java +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/SubscriptionOperationsClient.java @@ -6,92 +6,38 @@ 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.subscription.fluent.models.CanceledSubscriptionIdInner; -import com.azure.resourcemanager.subscription.fluent.models.EnabledSubscriptionIdInner; -import com.azure.resourcemanager.subscription.fluent.models.RenamedSubscriptionIdInner; -import com.azure.resourcemanager.subscription.models.SubscriptionName; +import com.azure.resourcemanager.subscription.fluent.models.SubscriptionCreationResultInner; +import com.azure.resourcemanager.subscription.models.SubscriptionOperationsGetResponse; /** * An instance of this class provides access to all the operations defined in SubscriptionOperationsClient. */ public interface SubscriptionOperationsClient { /** - * The operation to cancel a subscription. + * Get the status of the pending Microsoft.Subscription API operations. * - * @param subscriptionId Subscription Id. + * @param operationId The operation ID, which can be found from the Location field in the generate recommendation + * response header. * @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 ID of the canceled subscription along with {@link Response}. + * @return the status of the pending Microsoft.Subscription API operations. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response cancelWithResponse(String subscriptionId, Context context); + SubscriptionOperationsGetResponse getWithResponse(String operationId, Context context); /** - * The operation to cancel a subscription. + * Get the status of the pending Microsoft.Subscription API operations. * - * @param subscriptionId Subscription Id. + * @param operationId The operation ID, which can be found from the Location field in the generate recommendation + * response header. * @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 ID of the canceled subscription. + * @return the status of the pending Microsoft.Subscription API operations. */ @ServiceMethod(returns = ReturnType.SINGLE) - CanceledSubscriptionIdInner cancel(String subscriptionId); - - /** - * The operation to rename a subscription. - * - * @param subscriptionId Subscription Id. - * @param body Subscription Name. - * @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 ID of the subscriptions that is being renamed along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response renameWithResponse(String subscriptionId, SubscriptionName body, - Context context); - - /** - * The operation to rename a subscription. - * - * @param subscriptionId Subscription Id. - * @param body Subscription Name. - * @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 ID of the subscriptions that is being renamed. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - RenamedSubscriptionIdInner rename(String subscriptionId, SubscriptionName body); - - /** - * The operation to enable a subscription. - * - * @param subscriptionId Subscription 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 ID of the subscriptions that is being enabled along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response enableWithResponse(String subscriptionId, Context context); - - /** - * The operation to enable a subscription. - * - * @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 ID of the subscriptions that is being enabled. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - EnabledSubscriptionIdInner enable(String subscriptionId); + SubscriptionCreationResultInner get(String operationId); } diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/SubscriptionPoliciesClient.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/SubscriptionPoliciesClient.java new file mode 100644 index 000000000000..d5ffc591a01b --- /dev/null +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/SubscriptionPoliciesClient.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.subscription.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.subscription.fluent.models.GetTenantPolicyResponseInner; +import com.azure.resourcemanager.subscription.models.PutTenantPolicyRequestProperties; + +/** + * An instance of this class provides access to all the operations defined in SubscriptionPoliciesClient. + */ +public interface SubscriptionPoliciesClient { + /** + * Create or Update Subscription tenant policy for user's tenant. + * + * @param body The body 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 tenant policy Information along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response addUpdatePolicyForTenantWithResponse(PutTenantPolicyRequestProperties body, + Context context); + + /** + * Create or Update Subscription tenant policy for user's tenant. + * + * @param body The body 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 tenant policy Information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GetTenantPolicyResponseInner addUpdatePolicyForTenant(PutTenantPolicyRequestProperties body); + + /** + * Get the subscription tenant policy for the user's 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 subscription tenant policy for the user's tenant along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getPolicyForTenantWithResponse(Context context); + + /** + * Get the subscription tenant policy for the user's 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 subscription tenant policy for the user's tenant. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GetTenantPolicyResponseInner getPolicyForTenant(); + + /** + * Get the subscription tenant policy for the user's 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 subscription tenant policy for the user's tenant as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listPolicyForTenant(); + + /** + * Get the subscription tenant policy for the user's 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 subscription tenant policy for the user's tenant as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listPolicyForTenant(Context context); +} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/SubscriptionsClient.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/SubscriptionsClient.java index 1767d103d02f..bb383985a909 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/SubscriptionsClient.java +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/SubscriptionsClient.java @@ -6,91 +6,175 @@ 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.resourcemanager.subscription.fluent.models.LocationInner; -import com.azure.resourcemanager.subscription.fluent.models.SubscriptionInner; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.subscription.fluent.models.AcceptOwnershipStatusResponseInner; +import com.azure.resourcemanager.subscription.fluent.models.CanceledSubscriptionIdInner; +import com.azure.resourcemanager.subscription.fluent.models.EnabledSubscriptionIdInner; +import com.azure.resourcemanager.subscription.fluent.models.RenamedSubscriptionIdInner; +import com.azure.resourcemanager.subscription.models.AcceptOwnershipRequest; +import com.azure.resourcemanager.subscription.models.SubscriptionName; /** * An instance of this class provides access to all the operations defined in SubscriptionsClient. */ public interface SubscriptionsClient { /** - * Gets all available geo-locations. + * The operation to cancel a subscription. * - * This operation provides all the locations that are available for resource providers; however, each resource - * provider may support a subset of this list. - * - * @param subscriptionId The ID of the target subscription. + * @param subscriptionId Subscription 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 location list operation response as paginated response with {@link PagedIterable}. + * @return the ID of the canceled subscription along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listLocations(String subscriptionId); + @ServiceMethod(returns = ReturnType.SINGLE) + Response cancelWithResponse(String subscriptionId, Context context); /** - * Gets all available geo-locations. + * The operation to cancel a subscription. * - * This operation provides all the locations that are available for resource providers; however, each resource - * provider may support a subset of this list. + * @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 ID of the canceled subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CanceledSubscriptionIdInner cancel(String subscriptionId); + + /** + * The operation to rename a subscription. * - * @param subscriptionId The ID of the target subscription. + * @param subscriptionId Subscription Id. + * @param body Subscription Name. * @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 location list operation response as paginated response with {@link PagedIterable}. + * @return the ID of the subscriptions that is being renamed along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listLocations(String subscriptionId, Context context); + @ServiceMethod(returns = ReturnType.SINGLE) + Response renameWithResponse(String subscriptionId, SubscriptionName body, + Context context); /** - * Gets details about a specified subscription. + * The operation to rename a subscription. * - * @param subscriptionId The ID of the target subscription. + * @param subscriptionId Subscription Id. + * @param body Subscription Name. + * @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 ID of the subscriptions that is being renamed. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RenamedSubscriptionIdInner rename(String subscriptionId, SubscriptionName body); + + /** + * The operation to enable a subscription. + * + * @param subscriptionId Subscription 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 details about a specified subscription along with {@link Response}. + * @return the ID of the subscriptions that is being enabled along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response enableWithResponse(String subscriptionId, Context context); + + /** + * The operation to enable a subscription. + * + * @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 ID of the subscriptions that is being enabled. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response getWithResponse(String subscriptionId, Context context); + EnabledSubscriptionIdInner enable(String subscriptionId); /** - * Gets details about a specified subscription. + * Accept subscription ownership. * - * @param subscriptionId The ID of the target subscription. + * @param subscriptionId Subscription Id. + * @param body The body 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 the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginAcceptOwnership(String subscriptionId, AcceptOwnershipRequest body); + + /** + * Accept subscription ownership. + * + * @param subscriptionId Subscription Id. + * @param body The body 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 the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginAcceptOwnership(String subscriptionId, AcceptOwnershipRequest body, + Context context); + + /** + * Accept subscription ownership. + * + * @param subscriptionId Subscription Id. + * @param body The body 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 details about a specified subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - SubscriptionInner get(String subscriptionId); + void acceptOwnership(String subscriptionId, AcceptOwnershipRequest body); /** - * Gets all subscriptions for a tenant. + * Accept subscription ownership. * + * @param subscriptionId Subscription Id. + * @param body The body 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 all subscriptions for a tenant as paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(); + @ServiceMethod(returns = ReturnType.SINGLE) + void acceptOwnership(String subscriptionId, AcceptOwnershipRequest body, Context context); /** - * Gets all subscriptions for a tenant. + * Accept subscription ownership status. * + * @param subscriptionId Subscription 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 subscriptions for a tenant as paginated response with {@link PagedIterable}. + * @return subscription Accept Ownership Response along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(Context context); + @ServiceMethod(returns = ReturnType.SINGLE) + Response acceptOwnershipStatusWithResponse(String subscriptionId, + Context context); + + /** + * Accept subscription ownership status. + * + * @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 subscription Accept Ownership Response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AcceptOwnershipStatusResponseInner acceptOwnershipStatus(String subscriptionId); } diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/models/AcceptOwnershipStatusResponseInner.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/models/AcceptOwnershipStatusResponseInner.java new file mode 100644 index 000000000000..7f80877e3513 --- /dev/null +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/models/AcceptOwnershipStatusResponseInner.java @@ -0,0 +1,220 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.subscription.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.subscription.models.AcceptOwnership; +import com.azure.resourcemanager.subscription.models.Provisioning; +import java.io.IOException; +import java.util.Map; + +/** + * Subscription Accept Ownership Response. + */ +@Fluent +public final class AcceptOwnershipStatusResponseInner implements JsonSerializable { + /* + * Newly created subscription Id. + */ + private String subscriptionId; + + /* + * The accept ownership state of the resource. + */ + private AcceptOwnership acceptOwnershipState; + + /* + * The provisioning state of the resource. + */ + private Provisioning provisioningState; + + /* + * UPN of the billing owner + */ + private String billingOwner; + + /* + * Tenant Id of the subscription + */ + private String subscriptionTenantId; + + /* + * The display name of the subscription. + */ + private String displayName; + + /* + * Tags for the subscription + */ + private Map tags; + + /** + * Creates an instance of AcceptOwnershipStatusResponseInner class. + */ + public AcceptOwnershipStatusResponseInner() { + } + + /** + * Get the subscriptionId property: Newly created subscription Id. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Get the acceptOwnershipState property: The accept ownership state of the resource. + * + * @return the acceptOwnershipState value. + */ + public AcceptOwnership acceptOwnershipState() { + return this.acceptOwnershipState; + } + + /** + * Get the provisioningState property: The provisioning state of the resource. + * + * @return the provisioningState value. + */ + public Provisioning provisioningState() { + return this.provisioningState; + } + + /** + * Get the billingOwner property: UPN of the billing owner. + * + * @return the billingOwner value. + */ + public String billingOwner() { + return this.billingOwner; + } + + /** + * Get the subscriptionTenantId property: Tenant Id of the subscription. + * + * @return the subscriptionTenantId value. + */ + public String subscriptionTenantId() { + return this.subscriptionTenantId; + } + + /** + * Set the subscriptionTenantId property: Tenant Id of the subscription. + * + * @param subscriptionTenantId the subscriptionTenantId value to set. + * @return the AcceptOwnershipStatusResponseInner object itself. + */ + public AcceptOwnershipStatusResponseInner withSubscriptionTenantId(String subscriptionTenantId) { + this.subscriptionTenantId = subscriptionTenantId; + return this; + } + + /** + * Get the displayName property: The display name of the subscription. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The display name of the subscription. + * + * @param displayName the displayName value to set. + * @return the AcceptOwnershipStatusResponseInner object itself. + */ + public AcceptOwnershipStatusResponseInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the tags property: Tags for the subscription. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Tags for the subscription. + * + * @param tags the tags value to set. + * @return the AcceptOwnershipStatusResponseInner object itself. + */ + public AcceptOwnershipStatusResponseInner withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("subscriptionTenantId", this.subscriptionTenantId); + jsonWriter.writeStringField("displayName", this.displayName); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AcceptOwnershipStatusResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AcceptOwnershipStatusResponseInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AcceptOwnershipStatusResponseInner. + */ + public static AcceptOwnershipStatusResponseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AcceptOwnershipStatusResponseInner deserializedAcceptOwnershipStatusResponseInner + = new AcceptOwnershipStatusResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("subscriptionId".equals(fieldName)) { + deserializedAcceptOwnershipStatusResponseInner.subscriptionId = reader.getString(); + } else if ("acceptOwnershipState".equals(fieldName)) { + deserializedAcceptOwnershipStatusResponseInner.acceptOwnershipState + = AcceptOwnership.fromString(reader.getString()); + } else if ("provisioningState".equals(fieldName)) { + deserializedAcceptOwnershipStatusResponseInner.provisioningState + = Provisioning.fromString(reader.getString()); + } else if ("billingOwner".equals(fieldName)) { + deserializedAcceptOwnershipStatusResponseInner.billingOwner = reader.getString(); + } else if ("subscriptionTenantId".equals(fieldName)) { + deserializedAcceptOwnershipStatusResponseInner.subscriptionTenantId = reader.getString(); + } else if ("displayName".equals(fieldName)) { + deserializedAcceptOwnershipStatusResponseInner.displayName = reader.getString(); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedAcceptOwnershipStatusResponseInner.tags = tags; + } else { + reader.skipChildren(); + } + } + + return deserializedAcceptOwnershipStatusResponseInner; + }); + } +} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/models/BillingAccountPoliciesResponseInner.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/models/BillingAccountPoliciesResponseInner.java new file mode 100644 index 000000000000..a6b49d63e428 --- /dev/null +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/models/BillingAccountPoliciesResponseInner.java @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.subscription.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.subscription.models.BillingAccountPoliciesResponseProperties; +import java.io.IOException; + +/** + * Billing account policies information. + */ +@Fluent +public final class BillingAccountPoliciesResponseInner extends ProxyResource { + /* + * Billing account policies response properties. + */ + private BillingAccountPoliciesResponseProperties properties; + + /* + * Metadata pertaining to creation and last modification of the resource. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of BillingAccountPoliciesResponseInner class. + */ + public BillingAccountPoliciesResponseInner() { + } + + /** + * Get the properties property: Billing account policies response properties. + * + * @return the properties value. + */ + public BillingAccountPoliciesResponseProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Billing account policies response properties. + * + * @param properties the properties value to set. + * @return the BillingAccountPoliciesResponseInner object itself. + */ + public BillingAccountPoliciesResponseInner withProperties(BillingAccountPoliciesResponseProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BillingAccountPoliciesResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BillingAccountPoliciesResponseInner if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the BillingAccountPoliciesResponseInner. + */ + public static BillingAccountPoliciesResponseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BillingAccountPoliciesResponseInner deserializedBillingAccountPoliciesResponseInner + = new BillingAccountPoliciesResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedBillingAccountPoliciesResponseInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedBillingAccountPoliciesResponseInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedBillingAccountPoliciesResponseInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedBillingAccountPoliciesResponseInner.properties + = BillingAccountPoliciesResponseProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedBillingAccountPoliciesResponseInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedBillingAccountPoliciesResponseInner; + }); + } +} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/models/PutAliasResponseInner.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/models/GetTenantPolicyResponseInner.java similarity index 57% rename from sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/models/PutAliasResponseInner.java rename to sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/models/GetTenantPolicyResponseInner.java index a63a78bed1cb..e9d3e0d05646 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/models/PutAliasResponseInner.java +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/models/GetTenantPolicyResponseInner.java @@ -6,21 +6,27 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; import com.azure.json.JsonReader; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; -import com.azure.resourcemanager.subscription.models.PutAliasResponseProperties; +import com.azure.resourcemanager.subscription.models.TenantPolicy; import java.io.IOException; /** - * Subscription Information with the alias. + * Tenant policy Information. */ @Fluent -public final class PutAliasResponseInner extends ProxyResource { +public final class GetTenantPolicyResponseInner extends ProxyResource { /* - * Put Alias response properties. + * Tenant policy properties. */ - private PutAliasResponseProperties properties; + private TenantPolicy properties; + + /* + * Metadata pertaining to creation and last modification of the resource. + */ + private SystemData systemData; /* * The type of the resource. @@ -38,31 +44,40 @@ public final class PutAliasResponseInner extends ProxyResource { private String id; /** - * Creates an instance of PutAliasResponseInner class. + * Creates an instance of GetTenantPolicyResponseInner class. */ - public PutAliasResponseInner() { + public GetTenantPolicyResponseInner() { } /** - * Get the properties property: Put Alias response properties. + * Get the properties property: Tenant policy properties. * * @return the properties value. */ - public PutAliasResponseProperties properties() { + public TenantPolicy properties() { return this.properties; } /** - * Set the properties property: Put Alias response properties. + * Set the properties property: Tenant policy properties. * * @param properties the properties value to set. - * @return the PutAliasResponseInner object itself. + * @return the GetTenantPolicyResponseInner object itself. */ - public PutAliasResponseInner withProperties(PutAliasResponseProperties properties) { + public GetTenantPolicyResponseInner withProperties(TenantPolicy properties) { this.properties = properties; return this; } + /** + * Get the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + /** * Get the type property: The type of the resource. * @@ -115,35 +130,37 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { } /** - * Reads an instance of PutAliasResponseInner from the JsonReader. + * Reads an instance of GetTenantPolicyResponseInner from the JsonReader. * * @param jsonReader The JsonReader being read. - * @return An instance of PutAliasResponseInner if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. + * @return An instance of GetTenantPolicyResponseInner if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the PutAliasResponseInner. + * @throws IOException If an error occurs while reading the GetTenantPolicyResponseInner. */ - public static PutAliasResponseInner fromJson(JsonReader jsonReader) throws IOException { + public static GetTenantPolicyResponseInner fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { - PutAliasResponseInner deserializedPutAliasResponseInner = new PutAliasResponseInner(); + GetTenantPolicyResponseInner deserializedGetTenantPolicyResponseInner = new GetTenantPolicyResponseInner(); while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); if ("id".equals(fieldName)) { - deserializedPutAliasResponseInner.id = reader.getString(); + deserializedGetTenantPolicyResponseInner.id = reader.getString(); } else if ("name".equals(fieldName)) { - deserializedPutAliasResponseInner.name = reader.getString(); + deserializedGetTenantPolicyResponseInner.name = reader.getString(); } else if ("type".equals(fieldName)) { - deserializedPutAliasResponseInner.type = reader.getString(); + deserializedGetTenantPolicyResponseInner.type = reader.getString(); } else if ("properties".equals(fieldName)) { - deserializedPutAliasResponseInner.properties = PutAliasResponseProperties.fromJson(reader); + deserializedGetTenantPolicyResponseInner.properties = TenantPolicy.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedGetTenantPolicyResponseInner.systemData = SystemData.fromJson(reader); } else { reader.skipChildren(); } } - return deserializedPutAliasResponseInner; + return deserializedGetTenantPolicyResponseInner; }); } } diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/models/LocationInner.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/models/LocationInner.java deleted file mode 100644 index f5760a3873e7..000000000000 --- a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/models/LocationInner.java +++ /dev/null @@ -1,163 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.subscription.fluent.models; - -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Location information. - */ -@Immutable -public final class LocationInner implements JsonSerializable { - /* - * The fully qualified ID of the location. For example, - * /subscriptions/00000000-0000-0000-0000-000000000000/locations/westus. - */ - private String id; - - /* - * The subscription ID. - */ - private String subscriptionId; - - /* - * The location name. - */ - private String name; - - /* - * The display name of the location. - */ - private String displayName; - - /* - * The latitude of the location. - */ - private String latitude; - - /* - * The longitude of the location. - */ - private String longitude; - - /** - * Creates an instance of LocationInner class. - */ - public LocationInner() { - } - - /** - * Get the id property: The fully qualified ID of the location. For example, - * /subscriptions/00000000-0000-0000-0000-000000000000/locations/westus. - * - * @return the id value. - */ - public String id() { - return this.id; - } - - /** - * Get the subscriptionId property: The subscription ID. - * - * @return the subscriptionId value. - */ - public String subscriptionId() { - return this.subscriptionId; - } - - /** - * Get the name property: The location name. - * - * @return the name value. - */ - public String name() { - return this.name; - } - - /** - * Get the displayName property: The display name of the location. - * - * @return the displayName value. - */ - public String displayName() { - return this.displayName; - } - - /** - * Get the latitude property: The latitude of the location. - * - * @return the latitude value. - */ - public String latitude() { - return this.latitude; - } - - /** - * Get the longitude property: The longitude of the location. - * - * @return the longitude value. - */ - public String longitude() { - return this.longitude; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of LocationInner from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of LocationInner if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IOException If an error occurs while reading the LocationInner. - */ - public static LocationInner fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - LocationInner deserializedLocationInner = new LocationInner(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - deserializedLocationInner.id = reader.getString(); - } else if ("subscriptionId".equals(fieldName)) { - deserializedLocationInner.subscriptionId = reader.getString(); - } else if ("name".equals(fieldName)) { - deserializedLocationInner.name = reader.getString(); - } else if ("displayName".equals(fieldName)) { - deserializedLocationInner.displayName = reader.getString(); - } else if ("latitude".equals(fieldName)) { - deserializedLocationInner.latitude = reader.getString(); - } else if ("longitude".equals(fieldName)) { - deserializedLocationInner.longitude = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedLocationInner; - }); - } -} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/models/OperationInner.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/models/OperationInner.java new file mode 100644 index 000000000000..3ba00de90f0e --- /dev/null +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/models/OperationInner.java @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.subscription.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.subscription.models.OperationDisplay; +import java.io.IOException; + +/** + * REST API operation. + */ +@Fluent +public final class OperationInner implements JsonSerializable { + /* + * Operation name: {provider}/{resource}/{operation} + */ + private String name; + + /* + * Indicates whether the operation is a data action + */ + private Boolean isDataAction; + + /* + * The object that represents the operation. + */ + private OperationDisplay display; + + /** + * Creates an instance of OperationInner class. + */ + public OperationInner() { + } + + /** + * Get the name property: Operation name: {provider}/{resource}/{operation}. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Operation name: {provider}/{resource}/{operation}. + * + * @param name the name value to set. + * @return the OperationInner object itself. + */ + public OperationInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the isDataAction property: Indicates whether the operation is a data action. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Set the isDataAction property: Indicates whether the operation is a data action. + * + * @param isDataAction the isDataAction value to set. + * @return the OperationInner object itself. + */ + public OperationInner withIsDataAction(Boolean isDataAction) { + this.isDataAction = isDataAction; + return this; + } + + /** + * Get the display property: The object that represents the operation. + * + * @return the display value. + */ + public OperationDisplay 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(OperationDisplay 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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeBooleanField("isDataAction", this.isDataAction); + jsonWriter.writeJsonField("display", this.display); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationInner. + */ + public static OperationInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationInner deserializedOperationInner = new OperationInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedOperationInner.name = reader.getString(); + } else if ("isDataAction".equals(fieldName)) { + deserializedOperationInner.isDataAction = reader.getNullable(JsonReader::getBoolean); + } else if ("display".equals(fieldName)) { + deserializedOperationInner.display = OperationDisplay.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationInner; + }); + } +} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/models/OperationListResultInner.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/models/OperationListResultInner.java deleted file mode 100644 index 40cf17134c89..000000000000 --- a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/models/OperationListResultInner.java +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.subscription.fluent.models; - -import com.azure.core.annotation.Fluent; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import com.azure.resourcemanager.subscription.models.Operation; -import java.io.IOException; -import java.util.List; - -/** - * Result of the request to list operations. It contains a list of operations and a URL link to get the next set of - * results. - */ -@Fluent -public final class OperationListResultInner implements JsonSerializable { - /* - * List of operations. - */ - private List value; - - /* - * URL to get the next set of operation list results if there are any. - */ - private String nextLink; - - /** - * Creates an instance of OperationListResultInner class. - */ - public OperationListResultInner() { - } - - /** - * Get the value property: List of operations. - * - * @return the value value. - */ - public List value() { - return this.value; - } - - /** - * Set the value property: List of operations. - * - * @param value the value value to set. - * @return the OperationListResultInner object itself. - */ - public OperationListResultInner withValue(List value) { - this.value = value; - return this; - } - - /** - * 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; - } - - /** - * Set the nextLink property: URL to get the next set of operation list results if there are any. - * - * @param nextLink the nextLink value to set. - * @return the OperationListResultInner object itself. - */ - public OperationListResultInner withNextLink(String nextLink) { - this.nextLink = nextLink; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (value() != null) { - value().forEach(e -> e.validate()); - } - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); - jsonWriter.writeStringField("nextLink", this.nextLink); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of OperationListResultInner from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of OperationListResultInner if the JsonReader was pointing to an instance of it, or null if - * it was pointing to JSON null. - * @throws IOException If an error occurs while reading the OperationListResultInner. - */ - public static OperationListResultInner fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - OperationListResultInner deserializedOperationListResultInner = new OperationListResultInner(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("value".equals(fieldName)) { - List value = reader.readArray(reader1 -> Operation.fromJson(reader1)); - deserializedOperationListResultInner.value = value; - } else if ("nextLink".equals(fieldName)) { - deserializedOperationListResultInner.nextLink = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedOperationListResultInner; - }); - } -} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/models/PutAliasListResultInner.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/models/SubscriptionAliasListResultInner.java similarity index 61% rename from sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/models/PutAliasListResultInner.java rename to sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/models/SubscriptionAliasListResultInner.java index 7b30a6ab3152..74e68bf602b8 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/models/PutAliasListResultInner.java +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/models/SubscriptionAliasListResultInner.java @@ -16,11 +16,11 @@ * The list of aliases. */ @Immutable -public final class PutAliasListResultInner implements JsonSerializable { +public final class SubscriptionAliasListResultInner implements JsonSerializable { /* * The list of alias. */ - private List value; + private List value; /* * The link (url) to the next page of results. @@ -28,9 +28,9 @@ public final class PutAliasListResultInner implements JsonSerializable value() { + public List value() { return this.value; } @@ -72,32 +72,33 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { } /** - * Reads an instance of PutAliasListResultInner from the JsonReader. + * Reads an instance of SubscriptionAliasListResultInner from the JsonReader. * * @param jsonReader The JsonReader being read. - * @return An instance of PutAliasListResultInner if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IOException If an error occurs while reading the PutAliasListResultInner. + * @return An instance of SubscriptionAliasListResultInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SubscriptionAliasListResultInner. */ - public static PutAliasListResultInner fromJson(JsonReader jsonReader) throws IOException { + public static SubscriptionAliasListResultInner fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { - PutAliasListResultInner deserializedPutAliasListResultInner = new PutAliasListResultInner(); + SubscriptionAliasListResultInner deserializedSubscriptionAliasListResultInner + = new SubscriptionAliasListResultInner(); while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); if ("value".equals(fieldName)) { - List value - = reader.readArray(reader1 -> PutAliasResponseInner.fromJson(reader1)); - deserializedPutAliasListResultInner.value = value; + List value + = reader.readArray(reader1 -> SubscriptionAliasResponseInner.fromJson(reader1)); + deserializedSubscriptionAliasListResultInner.value = value; } else if ("nextLink".equals(fieldName)) { - deserializedPutAliasListResultInner.nextLink = reader.getString(); + deserializedSubscriptionAliasListResultInner.nextLink = reader.getString(); } else { reader.skipChildren(); } } - return deserializedPutAliasListResultInner; + return deserializedSubscriptionAliasListResultInner; }); } } diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/models/SubscriptionAliasResponseInner.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/models/SubscriptionAliasResponseInner.java new file mode 100644 index 000000000000..f8d6b9f28517 --- /dev/null +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/models/SubscriptionAliasResponseInner.java @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.subscription.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.subscription.models.SubscriptionAliasResponseProperties; +import java.io.IOException; + +/** + * Subscription Information with the alias. + */ +@Fluent +public final class SubscriptionAliasResponseInner extends ProxyResource { + /* + * Subscription Alias response properties. + */ + private SubscriptionAliasResponseProperties properties; + + /* + * Metadata pertaining to creation and last modification of the resource. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of SubscriptionAliasResponseInner class. + */ + public SubscriptionAliasResponseInner() { + } + + /** + * Get the properties property: Subscription Alias response properties. + * + * @return the properties value. + */ + public SubscriptionAliasResponseProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Subscription Alias response properties. + * + * @param properties the properties value to set. + * @return the SubscriptionAliasResponseInner object itself. + */ + public SubscriptionAliasResponseInner withProperties(SubscriptionAliasResponseProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SubscriptionAliasResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SubscriptionAliasResponseInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SubscriptionAliasResponseInner. + */ + public static SubscriptionAliasResponseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SubscriptionAliasResponseInner deserializedSubscriptionAliasResponseInner + = new SubscriptionAliasResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSubscriptionAliasResponseInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSubscriptionAliasResponseInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSubscriptionAliasResponseInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedSubscriptionAliasResponseInner.properties + = SubscriptionAliasResponseProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedSubscriptionAliasResponseInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSubscriptionAliasResponseInner; + }); + } +} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/models/SubscriptionCreationResultInner.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/models/SubscriptionCreationResultInner.java new file mode 100644 index 000000000000..3b30a00d9c16 --- /dev/null +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/models/SubscriptionCreationResultInner.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.subscription.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The created subscription object. + */ +@Fluent +public final class SubscriptionCreationResultInner implements JsonSerializable { + /* + * The link to the new subscription. Use this link to check the status of subscription creation operation. + */ + private String subscriptionLink; + + /** + * Creates an instance of SubscriptionCreationResultInner class. + */ + public SubscriptionCreationResultInner() { + } + + /** + * Get the subscriptionLink property: The link to the new subscription. Use this link to check the status of + * subscription creation operation. + * + * @return the subscriptionLink value. + */ + public String subscriptionLink() { + return this.subscriptionLink; + } + + /** + * Set the subscriptionLink property: The link to the new subscription. Use this link to check the status of + * subscription creation operation. + * + * @param subscriptionLink the subscriptionLink value to set. + * @return the SubscriptionCreationResultInner object itself. + */ + public SubscriptionCreationResultInner withSubscriptionLink(String subscriptionLink) { + this.subscriptionLink = subscriptionLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("subscriptionLink", this.subscriptionLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SubscriptionCreationResultInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SubscriptionCreationResultInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SubscriptionCreationResultInner. + */ + public static SubscriptionCreationResultInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SubscriptionCreationResultInner deserializedSubscriptionCreationResultInner + = new SubscriptionCreationResultInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("subscriptionLink".equals(fieldName)) { + deserializedSubscriptionCreationResultInner.subscriptionLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSubscriptionCreationResultInner; + }); + } +} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/models/SubscriptionInner.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/models/SubscriptionInner.java deleted file mode 100644 index f27f11ea2ce1..000000000000 --- a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/models/SubscriptionInner.java +++ /dev/null @@ -1,241 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.subscription.fluent.models; - -import com.azure.core.annotation.Fluent; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import com.azure.resourcemanager.subscription.models.SubscriptionPolicies; -import com.azure.resourcemanager.subscription.models.SubscriptionState; -import java.io.IOException; -import java.util.Map; - -/** - * Subscription information. - */ -@Fluent -public final class SubscriptionInner implements JsonSerializable { - /* - * The fully qualified ID for the subscription. For example, /subscriptions/00000000-0000-0000-0000-000000000000. - */ - private String id; - - /* - * The subscription ID. - */ - private String subscriptionId; - - /* - * The subscription display name. - */ - private String displayName; - - /* - * The subscription state. Possible values are Enabled, Warned, PastDue, Disabled, and Deleted. - */ - private SubscriptionState state; - - /* - * The tenant ID. For example, 00000000-0000-0000-0000-000000000000. - */ - private String tenantId; - - /* - * Tags for the subscription - */ - private Map tags; - - /* - * The subscription policies. - */ - private SubscriptionPolicies subscriptionPolicies; - - /* - * The authorization source of the request. Valid values are one or more combinations of Legacy, RoleBased, - * Bypassed, Direct and Management. For example, 'Legacy, RoleBased'. - */ - private String authorizationSource; - - /** - * Creates an instance of SubscriptionInner class. - */ - public SubscriptionInner() { - } - - /** - * Get the id property: The fully qualified ID for the subscription. For example, - * /subscriptions/00000000-0000-0000-0000-000000000000. - * - * @return the id value. - */ - public String id() { - return this.id; - } - - /** - * Get the subscriptionId property: The subscription ID. - * - * @return the subscriptionId value. - */ - public String subscriptionId() { - return this.subscriptionId; - } - - /** - * Get the displayName property: The subscription display name. - * - * @return the displayName value. - */ - public String displayName() { - return this.displayName; - } - - /** - * Get the state property: The subscription state. Possible values are Enabled, Warned, PastDue, Disabled, and - * Deleted. - * - * @return the state value. - */ - public SubscriptionState state() { - return this.state; - } - - /** - * Get the tenantId property: The tenant ID. For example, 00000000-0000-0000-0000-000000000000. - * - * @return the tenantId value. - */ - public String tenantId() { - return this.tenantId; - } - - /** - * Get the tags property: Tags for the subscription. - * - * @return the tags value. - */ - public Map tags() { - return this.tags; - } - - /** - * Set the tags property: Tags for the subscription. - * - * @param tags the tags value to set. - * @return the SubscriptionInner object itself. - */ - public SubscriptionInner withTags(Map tags) { - this.tags = tags; - return this; - } - - /** - * Get the subscriptionPolicies property: The subscription policies. - * - * @return the subscriptionPolicies value. - */ - public SubscriptionPolicies subscriptionPolicies() { - return this.subscriptionPolicies; - } - - /** - * Set the subscriptionPolicies property: The subscription policies. - * - * @param subscriptionPolicies the subscriptionPolicies value to set. - * @return the SubscriptionInner object itself. - */ - public SubscriptionInner withSubscriptionPolicies(SubscriptionPolicies subscriptionPolicies) { - this.subscriptionPolicies = subscriptionPolicies; - return this; - } - - /** - * Get the authorizationSource property: The authorization source of the request. Valid values are one or more - * combinations of Legacy, RoleBased, Bypassed, Direct and Management. For example, 'Legacy, RoleBased'. - * - * @return the authorizationSource value. - */ - public String authorizationSource() { - return this.authorizationSource; - } - - /** - * Set the authorizationSource property: The authorization source of the request. Valid values are one or more - * combinations of Legacy, RoleBased, Bypassed, Direct and Management. For example, 'Legacy, RoleBased'. - * - * @param authorizationSource the authorizationSource value to set. - * @return the SubscriptionInner object itself. - */ - public SubscriptionInner withAuthorizationSource(String authorizationSource) { - this.authorizationSource = authorizationSource; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (subscriptionPolicies() != null) { - subscriptionPolicies().validate(); - } - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); - jsonWriter.writeJsonField("subscriptionPolicies", this.subscriptionPolicies); - jsonWriter.writeStringField("authorizationSource", this.authorizationSource); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SubscriptionInner from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SubscriptionInner if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IOException If an error occurs while reading the SubscriptionInner. - */ - public static SubscriptionInner fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - SubscriptionInner deserializedSubscriptionInner = new SubscriptionInner(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - deserializedSubscriptionInner.id = reader.getString(); - } else if ("subscriptionId".equals(fieldName)) { - deserializedSubscriptionInner.subscriptionId = reader.getString(); - } else if ("displayName".equals(fieldName)) { - deserializedSubscriptionInner.displayName = reader.getString(); - } else if ("state".equals(fieldName)) { - deserializedSubscriptionInner.state = SubscriptionState.fromString(reader.getString()); - } else if ("tenantId".equals(fieldName)) { - deserializedSubscriptionInner.tenantId = reader.getString(); - } else if ("tags".equals(fieldName)) { - Map tags = reader.readMap(reader1 -> reader1.getString()); - deserializedSubscriptionInner.tags = tags; - } else if ("subscriptionPolicies".equals(fieldName)) { - deserializedSubscriptionInner.subscriptionPolicies = SubscriptionPolicies.fromJson(reader); - } else if ("authorizationSource".equals(fieldName)) { - deserializedSubscriptionInner.authorizationSource = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedSubscriptionInner; - }); - } -} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/models/TenantIdDescriptionInner.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/models/TenantIdDescriptionInner.java deleted file mode 100644 index f093f2d501d5..000000000000 --- a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/fluent/models/TenantIdDescriptionInner.java +++ /dev/null @@ -1,212 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.subscription.fluent.models; - -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Tenant Id information. - */ -@Immutable -public final class TenantIdDescriptionInner implements JsonSerializable { - /* - * The fully qualified ID of the tenant. For example, /tenants/00000000-0000-0000-0000-000000000000. - */ - private String id; - - /* - * The tenant ID. For example, 00000000-0000-0000-0000-000000000000. - */ - private String tenantId; - - /* - * The category of the tenant. Possible values are - * TenantCategoryHome,TenantCategoryProjectedBy,TenantCategoryManagedBy - */ - private String tenantCategory; - - /* - * The country/region name of the address for the tenant. - */ - private String country; - - /* - * The Country/region abbreviation for the tenant. - */ - private String countryCode; - - /* - * The display name of the tenant. - */ - private String displayName; - - /* - * The list of domains for the tenant. - */ - private String domains; - - /* - * The default domain for the tenant. - */ - private String defaultDomain; - - /* - * The tenant type. Only available for Home tenant category. - */ - private String tenantType; - - /** - * Creates an instance of TenantIdDescriptionInner class. - */ - public TenantIdDescriptionInner() { - } - - /** - * Get the id property: The fully qualified ID of the tenant. For example, - * /tenants/00000000-0000-0000-0000-000000000000. - * - * @return the id value. - */ - public String id() { - return this.id; - } - - /** - * Get the tenantId property: The tenant ID. For example, 00000000-0000-0000-0000-000000000000. - * - * @return the tenantId value. - */ - public String tenantId() { - return this.tenantId; - } - - /** - * Get the tenantCategory property: The category of the tenant. Possible values are - * TenantCategoryHome,TenantCategoryProjectedBy,TenantCategoryManagedBy. - * - * @return the tenantCategory value. - */ - public String tenantCategory() { - return this.tenantCategory; - } - - /** - * Get the country property: The country/region name of the address for the tenant. - * - * @return the country value. - */ - public String country() { - return this.country; - } - - /** - * Get the countryCode property: The Country/region abbreviation for the tenant. - * - * @return the countryCode value. - */ - public String countryCode() { - return this.countryCode; - } - - /** - * Get the displayName property: The display name of the tenant. - * - * @return the displayName value. - */ - public String displayName() { - return this.displayName; - } - - /** - * Get the domains property: The list of domains for the tenant. - * - * @return the domains value. - */ - public String domains() { - return this.domains; - } - - /** - * Get the defaultDomain property: The default domain for the tenant. - * - * @return the defaultDomain value. - */ - public String defaultDomain() { - return this.defaultDomain; - } - - /** - * Get the tenantType property: The tenant type. Only available for Home tenant category. - * - * @return the tenantType value. - */ - public String tenantType() { - return this.tenantType; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of TenantIdDescriptionInner from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of TenantIdDescriptionInner if the JsonReader was pointing to an instance of it, or null if - * it was pointing to JSON null. - * @throws IOException If an error occurs while reading the TenantIdDescriptionInner. - */ - public static TenantIdDescriptionInner fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - TenantIdDescriptionInner deserializedTenantIdDescriptionInner = new TenantIdDescriptionInner(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - deserializedTenantIdDescriptionInner.id = reader.getString(); - } else if ("tenantId".equals(fieldName)) { - deserializedTenantIdDescriptionInner.tenantId = reader.getString(); - } else if ("tenantCategory".equals(fieldName)) { - deserializedTenantIdDescriptionInner.tenantCategory = reader.getString(); - } else if ("country".equals(fieldName)) { - deserializedTenantIdDescriptionInner.country = reader.getString(); - } else if ("countryCode".equals(fieldName)) { - deserializedTenantIdDescriptionInner.countryCode = reader.getString(); - } else if ("displayName".equals(fieldName)) { - deserializedTenantIdDescriptionInner.displayName = reader.getString(); - } else if ("domains".equals(fieldName)) { - deserializedTenantIdDescriptionInner.domains = reader.getString(); - } else if ("defaultDomain".equals(fieldName)) { - deserializedTenantIdDescriptionInner.defaultDomain = reader.getString(); - } else if ("tenantType".equals(fieldName)) { - deserializedTenantIdDescriptionInner.tenantType = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedTenantIdDescriptionInner; - }); - } -} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/SubscriptionImpl.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/AcceptOwnershipStatusResponseImpl.java similarity index 53% rename from sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/SubscriptionImpl.java rename to sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/AcceptOwnershipStatusResponseImpl.java index a13038a95430..d45c9c459360 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/SubscriptionImpl.java +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/AcceptOwnershipStatusResponseImpl.java @@ -4,42 +4,46 @@ package com.azure.resourcemanager.subscription.implementation; -import com.azure.resourcemanager.subscription.fluent.models.SubscriptionInner; -import com.azure.resourcemanager.subscription.models.Subscription; -import com.azure.resourcemanager.subscription.models.SubscriptionPolicies; -import com.azure.resourcemanager.subscription.models.SubscriptionState; +import com.azure.resourcemanager.subscription.fluent.models.AcceptOwnershipStatusResponseInner; +import com.azure.resourcemanager.subscription.models.AcceptOwnership; +import com.azure.resourcemanager.subscription.models.AcceptOwnershipStatusResponse; +import com.azure.resourcemanager.subscription.models.Provisioning; import java.util.Collections; import java.util.Map; -public final class SubscriptionImpl implements Subscription { - private SubscriptionInner innerObject; +public final class AcceptOwnershipStatusResponseImpl implements AcceptOwnershipStatusResponse { + private AcceptOwnershipStatusResponseInner innerObject; private final com.azure.resourcemanager.subscription.SubscriptionManager serviceManager; - SubscriptionImpl(SubscriptionInner innerObject, + AcceptOwnershipStatusResponseImpl(AcceptOwnershipStatusResponseInner innerObject, com.azure.resourcemanager.subscription.SubscriptionManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; } - public String id() { - return this.innerModel().id(); - } - public String subscriptionId() { return this.innerModel().subscriptionId(); } - public String displayName() { - return this.innerModel().displayName(); + public AcceptOwnership acceptOwnershipState() { + return this.innerModel().acceptOwnershipState(); + } + + public Provisioning provisioningState() { + return this.innerModel().provisioningState(); + } + + public String billingOwner() { + return this.innerModel().billingOwner(); } - public SubscriptionState state() { - return this.innerModel().state(); + public String subscriptionTenantId() { + return this.innerModel().subscriptionTenantId(); } - public String tenantId() { - return this.innerModel().tenantId(); + public String displayName() { + return this.innerModel().displayName(); } public Map tags() { @@ -51,15 +55,7 @@ public Map tags() { } } - public SubscriptionPolicies subscriptionPolicies() { - return this.innerModel().subscriptionPolicies(); - } - - public String authorizationSource() { - return this.innerModel().authorizationSource(); - } - - public SubscriptionInner innerModel() { + public AcceptOwnershipStatusResponseInner innerModel() { return this.innerObject; } diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/AliasClientImpl.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/AliasClientImpl.java index c3be5eebfd89..e03fc5c143f7 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/AliasClientImpl.java +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/AliasClientImpl.java @@ -23,13 +23,15 @@ 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.BinaryData; 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.subscription.fluent.AliasClient; -import com.azure.resourcemanager.subscription.fluent.models.PutAliasListResultInner; -import com.azure.resourcemanager.subscription.fluent.models.PutAliasResponseInner; +import com.azure.resourcemanager.subscription.fluent.models.SubscriptionAliasListResultInner; +import com.azure.resourcemanager.subscription.fluent.models.SubscriptionAliasResponseInner; import com.azure.resourcemanager.subscription.models.PutAliasRequest; import java.nio.ByteBuffer; import reactor.core.publisher.Flux; @@ -64,7 +66,7 @@ public final class AliasClientImpl implements AliasClient { * REST calls. */ @Host("{$host}") - @ServiceInterface(name = "SubscriptionClientAl") + @ServiceInterface(name = "SubscriptionClientAlias") public interface AliasService { @Headers({ "Content-Type: application/json" }) @Put("/providers/Microsoft.Subscription/aliases/{aliasName}") @@ -74,11 +76,27 @@ Mono>> create(@HostParam("$host") String endpoint, @PathParam("aliasName") String aliasName, @QueryParam("api-version") String apiVersion, @BodyParam("application/json") PutAliasRequest body, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Put("/providers/Microsoft.Subscription/aliases/{aliasName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createSync(@HostParam("$host") String endpoint, @PathParam("aliasName") String aliasName, + @QueryParam("api-version") String apiVersion, @BodyParam("application/json") PutAliasRequest body, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Subscription/aliases/{aliasName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> get(@HostParam("$host") String endpoint, + Mono> get(@HostParam("$host") String endpoint, + @PathParam("aliasName") String aliasName, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Subscription/aliases/{aliasName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") String endpoint, @PathParam("aliasName") String aliasName, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); @@ -89,19 +107,33 @@ Mono> get(@HostParam("$host") String endpoint, Mono> delete(@HostParam("$host") String endpoint, @PathParam("aliasName") String aliasName, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Delete("/providers/Microsoft.Subscription/aliases/{aliasName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("$host") String endpoint, @PathParam("aliasName") String aliasName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Subscription/aliases") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list(@HostParam("$host") String endpoint, + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Subscription/aliases") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); } /** * Create Alias Subscription. * - * @param aliasName Name for this subscription creation request also known as alias. Note that this is not the same - * as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. + * @param aliasName AliasName is the name for the subscription creation request. Note that this is not the same as + * subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. * @param body The body parameter. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -123,94 +155,103 @@ private Mono>> createWithResponseAsync(String aliasNam } else { body.validate(); } - final String apiVersion = "2020-09-01"; final String accept = "application/json"; return FluxUtil - .withContext( - context -> service.create(this.client.getEndpoint(), aliasName, apiVersion, body, accept, context)) + .withContext(context -> service.create(this.client.getEndpoint(), aliasName, this.client.getApiVersion(), + body, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Create Alias Subscription. * - * @param aliasName Name for this subscription creation request also known as alias. Note that this is not the same - * as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. + * @param aliasName AliasName is the name for the subscription creation request. Note that this is not the same as + * subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. * @param body The body 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 subscription Information with the alias along with {@link Response} on successful completion of - * {@link Mono}. + * @return subscription Information with the alias along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> createWithResponseAsync(String aliasName, PutAliasRequest body, - Context context) { + private Response createWithResponse(String aliasName, PutAliasRequest body) { if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (aliasName == null) { - return Mono.error(new IllegalArgumentException("Parameter aliasName is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter aliasName is required and cannot be null.")); } if (body == null) { - return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + throw LOGGER.atError().log(new IllegalArgumentException("Parameter body is required and cannot be null.")); } else { body.validate(); } - final String apiVersion = "2020-09-01"; final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.create(this.client.getEndpoint(), aliasName, apiVersion, body, accept, context); + return service.createSync(this.client.getEndpoint(), aliasName, this.client.getApiVersion(), body, accept, + Context.NONE); } /** * Create Alias Subscription. * - * @param aliasName Name for this subscription creation request also known as alias. Note that this is not the same - * as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. + * @param aliasName AliasName is the name for the subscription creation request. Note that this is not the same as + * subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. * @param body The body 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 {@link PollerFlux} for polling of subscription Information with the alias. + * @return subscription Information with the alias along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, PutAliasResponseInner> beginCreateAsync(String aliasName, - PutAliasRequest body) { - Mono>> mono = createWithResponseAsync(aliasName, body); - return this.client.getLroResult(mono, - this.client.getHttpPipeline(), PutAliasResponseInner.class, PutAliasResponseInner.class, - this.client.getContext()); + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createWithResponse(String aliasName, PutAliasRequest body, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (aliasName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter aliasName is required and cannot be null.")); + } + if (body == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return service.createSync(this.client.getEndpoint(), aliasName, this.client.getApiVersion(), body, accept, + context); } /** * Create Alias Subscription. * - * @param aliasName Name for this subscription creation request also known as alias. Note that this is not the same - * as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. + * @param aliasName AliasName is the name for the subscription creation request. Note that this is not the same as + * subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. * @param body The body 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 {@link PollerFlux} for polling of subscription Information with the alias. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, PutAliasResponseInner> beginCreateAsync(String aliasName, - PutAliasRequest body, Context context) { - context = this.client.mergeContext(context); - Mono>> mono = createWithResponseAsync(aliasName, body, context); - return this.client.getLroResult(mono, - this.client.getHttpPipeline(), PutAliasResponseInner.class, PutAliasResponseInner.class, context); + private PollerFlux, SubscriptionAliasResponseInner> + beginCreateAsync(String aliasName, PutAliasRequest body) { + Mono>> mono = createWithResponseAsync(aliasName, body); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), SubscriptionAliasResponseInner.class, SubscriptionAliasResponseInner.class, + this.client.getContext()); } /** * Create Alias Subscription. * - * @param aliasName Name for this subscription creation request also known as alias. Note that this is not the same - * as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. + * @param aliasName AliasName is the name for the subscription creation request. Note that this is not the same as + * subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. * @param body The body parameter. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -218,16 +259,18 @@ private PollerFlux, PutAliasResponseInner> beg * @return the {@link SyncPoller} for polling of subscription Information with the alias. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, PutAliasResponseInner> beginCreate(String aliasName, - PutAliasRequest body) { - return this.beginCreateAsync(aliasName, body).getSyncPoller(); + public SyncPoller, SubscriptionAliasResponseInner> + beginCreate(String aliasName, PutAliasRequest body) { + Response response = createWithResponse(aliasName, body); + return this.client.getLroResult(response, + SubscriptionAliasResponseInner.class, SubscriptionAliasResponseInner.class, Context.NONE); } /** * Create Alias Subscription. * - * @param aliasName Name for this subscription creation request also known as alias. Note that this is not the same - * as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. + * @param aliasName AliasName is the name for the subscription creation request. Note that this is not the same as + * subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. * @param body The body parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -236,16 +279,18 @@ public SyncPoller, PutAliasResponseInner> begi * @return the {@link SyncPoller} for polling of subscription Information with the alias. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, PutAliasResponseInner> beginCreate(String aliasName, - PutAliasRequest body, Context context) { - return this.beginCreateAsync(aliasName, body, context).getSyncPoller(); + public SyncPoller, SubscriptionAliasResponseInner> + beginCreate(String aliasName, PutAliasRequest body, Context context) { + Response response = createWithResponse(aliasName, body, context); + return this.client.getLroResult(response, + SubscriptionAliasResponseInner.class, SubscriptionAliasResponseInner.class, context); } /** * Create Alias Subscription. * - * @param aliasName Name for this subscription creation request also known as alias. Note that this is not the same - * as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. + * @param aliasName AliasName is the name for the subscription creation request. Note that this is not the same as + * subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. * @param body The body parameter. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -253,32 +298,15 @@ public SyncPoller, PutAliasResponseInner> begi * @return subscription Information with the alias on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createAsync(String aliasName, PutAliasRequest body) { + private Mono createAsync(String aliasName, PutAliasRequest body) { return beginCreateAsync(aliasName, body).last().flatMap(this.client::getLroFinalResultOrError); } /** * Create Alias Subscription. * - * @param aliasName Name for this subscription creation request also known as alias. Note that this is not the same - * as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. - * @param body The body 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 subscription Information with the alias on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createAsync(String aliasName, PutAliasRequest body, Context context) { - return beginCreateAsync(aliasName, body, context).last().flatMap(this.client::getLroFinalResultOrError); - } - - /** - * Create Alias Subscription. - * - * @param aliasName Name for this subscription creation request also known as alias. Note that this is not the same - * as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. + * @param aliasName AliasName is the name for the subscription creation request. Note that this is not the same as + * subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. * @param body The body parameter. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -286,15 +314,15 @@ private Mono createAsync(String aliasName, PutAliasReques * @return subscription Information with the alias. */ @ServiceMethod(returns = ReturnType.SINGLE) - public PutAliasResponseInner create(String aliasName, PutAliasRequest body) { - return createAsync(aliasName, body).block(); + public SubscriptionAliasResponseInner create(String aliasName, PutAliasRequest body) { + return beginCreate(aliasName, body).getFinalResult(); } /** * Create Alias Subscription. * - * @param aliasName Name for this subscription creation request also known as alias. Note that this is not the same - * as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. + * @param aliasName AliasName is the name for the subscription creation request. Note that this is not the same as + * subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. * @param body The body parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -303,22 +331,22 @@ public PutAliasResponseInner create(String aliasName, PutAliasRequest body) { * @return subscription Information with the alias. */ @ServiceMethod(returns = ReturnType.SINGLE) - public PutAliasResponseInner create(String aliasName, PutAliasRequest body, Context context) { - return createAsync(aliasName, body, context).block(); + public SubscriptionAliasResponseInner create(String aliasName, PutAliasRequest body, Context context) { + return beginCreate(aliasName, body, context).getFinalResult(); } /** * Get Alias Subscription. * - * @param aliasName Name for this subscription creation request also known as alias. Note that this is not the same - * as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. + * @param aliasName AliasName is the name for the subscription creation request. Note that this is not the same as + * subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return alias Subscription along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String aliasName) { + private Mono> getWithResponseAsync(String aliasName) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -326,59 +354,32 @@ private Mono> getWithResponseAsync(String aliasN if (aliasName == null) { return Mono.error(new IllegalArgumentException("Parameter aliasName is required and cannot be null.")); } - final String apiVersion = "2020-09-01"; final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.get(this.client.getEndpoint(), aliasName, apiVersion, accept, context)) + return FluxUtil.withContext( + context -> service.get(this.client.getEndpoint(), aliasName, this.client.getApiVersion(), accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Get Alias Subscription. * - * @param aliasName Name for this subscription creation request also known as alias. Note that this is not the same - * as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. - * @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 alias Subscription along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String aliasName, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (aliasName == null) { - return Mono.error(new IllegalArgumentException("Parameter aliasName is required and cannot be null.")); - } - final String apiVersion = "2020-09-01"; - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.get(this.client.getEndpoint(), aliasName, apiVersion, accept, context); - } - - /** - * Get Alias Subscription. - * - * @param aliasName Name for this subscription creation request also known as alias. Note that this is not the same - * as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. + * @param aliasName AliasName is the name for the subscription creation request. Note that this is not the same as + * subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return alias Subscription on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getAsync(String aliasName) { + private Mono getAsync(String aliasName) { return getWithResponseAsync(aliasName).flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * Get Alias Subscription. * - * @param aliasName Name for this subscription creation request also known as alias. Note that this is not the same - * as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. + * @param aliasName AliasName is the name for the subscription creation request. Note that this is not the same as + * subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. * @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. @@ -386,30 +387,40 @@ private Mono getAsync(String aliasName) { * @return alias Subscription along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(String aliasName, Context context) { - return getWithResponseAsync(aliasName, context).block(); + public Response getWithResponse(String aliasName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (aliasName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter aliasName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), aliasName, this.client.getApiVersion(), accept, context); } /** * Get Alias Subscription. * - * @param aliasName Name for this subscription creation request also known as alias. Note that this is not the same - * as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. + * @param aliasName AliasName is the name for the subscription creation request. Note that this is not the same as + * subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return alias Subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public PutAliasResponseInner get(String aliasName) { + public SubscriptionAliasResponseInner get(String aliasName) { return getWithResponse(aliasName, Context.NONE).getValue(); } /** * Delete Alias. * - * @param aliasName Name for this subscription creation request also known as alias. Note that this is not the same - * as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. + * @param aliasName AliasName is the name for the subscription creation request. Note that this is not the same as + * subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -424,44 +435,18 @@ private Mono> deleteWithResponseAsync(String aliasName) { if (aliasName == null) { return Mono.error(new IllegalArgumentException("Parameter aliasName is required and cannot be null.")); } - final String apiVersion = "2020-09-01"; final String accept = "application/json"; return FluxUtil - .withContext(context -> service.delete(this.client.getEndpoint(), aliasName, apiVersion, accept, context)) + .withContext(context -> service.delete(this.client.getEndpoint(), aliasName, this.client.getApiVersion(), + accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Delete Alias. * - * @param aliasName Name for this subscription creation request also known as alias. Note that this is not the same - * as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. - * @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 aliasName, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (aliasName == null) { - return Mono.error(new IllegalArgumentException("Parameter aliasName is required and cannot be null.")); - } - final String apiVersion = "2020-09-01"; - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.delete(this.client.getEndpoint(), aliasName, apiVersion, accept, context); - } - - /** - * Delete Alias. - * - * @param aliasName Name for this subscription creation request also known as alias. Note that this is not the same - * as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. + * @param aliasName AliasName is the name for the subscription creation request. Note that this is not the same as + * subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -475,8 +460,8 @@ private Mono deleteAsync(String aliasName) { /** * Delete Alias. * - * @param aliasName Name for this subscription creation request also known as alias. Note that this is not the same - * as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. + * @param aliasName AliasName is the name for the subscription creation request. Note that this is not the same as + * subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. * @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. @@ -485,14 +470,24 @@ private Mono deleteAsync(String aliasName) { */ @ServiceMethod(returns = ReturnType.SINGLE) public Response deleteWithResponse(String aliasName, Context context) { - return deleteWithResponseAsync(aliasName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (aliasName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter aliasName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.deleteSync(this.client.getEndpoint(), aliasName, this.client.getApiVersion(), accept, context); } /** * Delete Alias. * - * @param aliasName Name for this subscription creation request also known as alias. Note that this is not the same - * as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. + * @param aliasName AliasName is the name for the subscription creation request. Note that this is not the same as + * subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -503,80 +498,68 @@ public void delete(String aliasName) { } /** - * Get Alias Subscription. + * List Alias Subscription. * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return alias Subscription along with {@link Response} on successful completion of {@link Mono}. + * @return the list of aliases along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listWithResponseAsync() { + private Mono> listWithResponseAsync() { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } - final String apiVersion = "2020-09-01"; final String accept = "application/json"; - return FluxUtil.withContext(context -> service.list(this.client.getEndpoint(), apiVersion, accept, context)) + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Get Alias Subscription. - * - * @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 alias Subscription along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listWithResponseAsync(Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String apiVersion = "2020-09-01"; - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.list(this.client.getEndpoint(), apiVersion, accept, context); - } - - /** - * Get Alias Subscription. + * List Alias Subscription. * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return alias Subscription on successful completion of {@link Mono}. + * @return the list of aliases on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono listAsync() { + private Mono listAsync() { return listWithResponseAsync().flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** - * Get Alias Subscription. + * List Alias Subscription. * * @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 alias Subscription along with {@link Response}. + * @return the list of aliases along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response listWithResponse(Context context) { - return listWithResponseAsync(context).block(); + public Response listWithResponse(Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), accept, context); } /** - * Get Alias Subscription. + * List Alias Subscription. * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return alias Subscription. + * @return the list of aliases. */ @ServiceMethod(returns = ReturnType.SINGLE) - public PutAliasListResultInner list() { + public SubscriptionAliasListResultInner list() { return listWithResponse(Context.NONE).getValue(); } + + private static final ClientLogger LOGGER = new ClientLogger(AliasClientImpl.class); } diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/AliasImpl.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/AliasImpl.java index 342bbe61a17a..e967e3d21d85 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/AliasImpl.java +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/AliasImpl.java @@ -9,12 +9,12 @@ import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.subscription.fluent.AliasClient; -import com.azure.resourcemanager.subscription.fluent.models.PutAliasListResultInner; -import com.azure.resourcemanager.subscription.fluent.models.PutAliasResponseInner; +import com.azure.resourcemanager.subscription.fluent.models.SubscriptionAliasListResultInner; +import com.azure.resourcemanager.subscription.fluent.models.SubscriptionAliasResponseInner; import com.azure.resourcemanager.subscription.models.Alias; -import com.azure.resourcemanager.subscription.models.PutAliasListResult; import com.azure.resourcemanager.subscription.models.PutAliasRequest; -import com.azure.resourcemanager.subscription.models.PutAliasResponse; +import com.azure.resourcemanager.subscription.models.SubscriptionAliasListResult; +import com.azure.resourcemanager.subscription.models.SubscriptionAliasResponse; public final class AliasImpl implements Alias { private static final ClientLogger LOGGER = new ClientLogger(AliasImpl.class); @@ -29,38 +29,38 @@ public AliasImpl(AliasClient innerClient, this.serviceManager = serviceManager; } - public PutAliasResponse create(String aliasName, PutAliasRequest body) { - PutAliasResponseInner inner = this.serviceClient().create(aliasName, body); + public SubscriptionAliasResponse create(String aliasName, PutAliasRequest body) { + SubscriptionAliasResponseInner inner = this.serviceClient().create(aliasName, body); if (inner != null) { - return new PutAliasResponseImpl(inner, this.manager()); + return new SubscriptionAliasResponseImpl(inner, this.manager()); } else { return null; } } - public PutAliasResponse create(String aliasName, PutAliasRequest body, Context context) { - PutAliasResponseInner inner = this.serviceClient().create(aliasName, body, context); + public SubscriptionAliasResponse create(String aliasName, PutAliasRequest body, Context context) { + SubscriptionAliasResponseInner inner = this.serviceClient().create(aliasName, body, context); if (inner != null) { - return new PutAliasResponseImpl(inner, this.manager()); + return new SubscriptionAliasResponseImpl(inner, this.manager()); } else { return null; } } - public Response getWithResponse(String aliasName, Context context) { - Response inner = this.serviceClient().getWithResponse(aliasName, context); + public Response getWithResponse(String aliasName, Context context) { + Response inner = this.serviceClient().getWithResponse(aliasName, context); if (inner != null) { return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new PutAliasResponseImpl(inner.getValue(), this.manager())); + new SubscriptionAliasResponseImpl(inner.getValue(), this.manager())); } else { return null; } } - public PutAliasResponse get(String aliasName) { - PutAliasResponseInner inner = this.serviceClient().get(aliasName); + public SubscriptionAliasResponse get(String aliasName) { + SubscriptionAliasResponseInner inner = this.serviceClient().get(aliasName); if (inner != null) { - return new PutAliasResponseImpl(inner, this.manager()); + return new SubscriptionAliasResponseImpl(inner, this.manager()); } else { return null; } @@ -74,20 +74,20 @@ public void delete(String aliasName) { this.serviceClient().delete(aliasName); } - public Response listWithResponse(Context context) { - Response inner = this.serviceClient().listWithResponse(context); + public Response listWithResponse(Context context) { + Response inner = this.serviceClient().listWithResponse(context); if (inner != null) { return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new PutAliasListResultImpl(inner.getValue(), this.manager())); + new SubscriptionAliasListResultImpl(inner.getValue(), this.manager())); } else { return null; } } - public PutAliasListResult list() { - PutAliasListResultInner inner = this.serviceClient().list(); + public SubscriptionAliasListResult list() { + SubscriptionAliasListResultInner inner = this.serviceClient().list(); if (inner != null) { - return new PutAliasListResultImpl(inner, this.manager()); + return new SubscriptionAliasListResultImpl(inner, this.manager()); } else { return null; } diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/BillingAccountPoliciesResponseImpl.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/BillingAccountPoliciesResponseImpl.java new file mode 100644 index 000000000000..92a623137bdd --- /dev/null +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/BillingAccountPoliciesResponseImpl.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.subscription.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.subscription.fluent.models.BillingAccountPoliciesResponseInner; +import com.azure.resourcemanager.subscription.models.BillingAccountPoliciesResponse; +import com.azure.resourcemanager.subscription.models.BillingAccountPoliciesResponseProperties; + +public final class BillingAccountPoliciesResponseImpl implements BillingAccountPoliciesResponse { + private BillingAccountPoliciesResponseInner innerObject; + + private final com.azure.resourcemanager.subscription.SubscriptionManager serviceManager; + + BillingAccountPoliciesResponseImpl(BillingAccountPoliciesResponseInner innerObject, + com.azure.resourcemanager.subscription.SubscriptionManager 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 BillingAccountPoliciesResponseProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public BillingAccountPoliciesResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.subscription.SubscriptionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/BillingAccountsClientImpl.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/BillingAccountsClientImpl.java new file mode 100644 index 000000000000..bf6d77f104be --- /dev/null +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/BillingAccountsClientImpl.java @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.subscription.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.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.subscription.fluent.BillingAccountsClient; +import com.azure.resourcemanager.subscription.fluent.models.BillingAccountPoliciesResponseInner; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in BillingAccountsClient. + */ +public final class BillingAccountsClientImpl implements BillingAccountsClient { + /** + * The proxy service used to perform REST calls. + */ + private final BillingAccountsService service; + + /** + * The service client containing this operation class. + */ + private final SubscriptionClientImpl client; + + /** + * Initializes an instance of BillingAccountsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + BillingAccountsClientImpl(SubscriptionClientImpl client) { + this.service + = RestProxy.create(BillingAccountsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SubscriptionClientBillingAccounts to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SubscriptionClientBillingAccounts") + public interface BillingAccountsService { + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.Subscription/policies/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getPolicy(@HostParam("$host") String endpoint, + @PathParam("billingAccountId") String billingAccountId, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.Subscription/policies/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getPolicySync(@HostParam("$host") String endpoint, + @PathParam("billingAccountId") String billingAccountId, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get Billing Account Policy. + * + * @param billingAccountId Billing Account 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 billing Account Policy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getPolicyWithResponseAsync(String billingAccountId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountId == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getPolicy(this.client.getEndpoint(), billingAccountId, + this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get Billing Account Policy. + * + * @param billingAccountId Billing Account 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 billing Account Policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getPolicyAsync(String billingAccountId) { + return getPolicyWithResponseAsync(billingAccountId).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get Billing Account Policy. + * + * @param billingAccountId Billing Account 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 billing Account Policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getPolicyWithResponse(String billingAccountId, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountId is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getPolicySync(this.client.getEndpoint(), billingAccountId, this.client.getApiVersion(), accept, + context); + } + + /** + * Get Billing Account Policy. + * + * @param billingAccountId Billing Account 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 billing Account Policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BillingAccountPoliciesResponseInner getPolicy(String billingAccountId) { + return getPolicyWithResponse(billingAccountId, Context.NONE).getValue(); + } + + private static final ClientLogger LOGGER = new ClientLogger(BillingAccountsClientImpl.class); +} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/BillingAccountsImpl.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/BillingAccountsImpl.java new file mode 100644 index 000000000000..2bb487ede149 --- /dev/null +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/BillingAccountsImpl.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.subscription.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.subscription.fluent.BillingAccountsClient; +import com.azure.resourcemanager.subscription.fluent.models.BillingAccountPoliciesResponseInner; +import com.azure.resourcemanager.subscription.models.BillingAccountPoliciesResponse; +import com.azure.resourcemanager.subscription.models.BillingAccounts; + +public final class BillingAccountsImpl implements BillingAccounts { + private static final ClientLogger LOGGER = new ClientLogger(BillingAccountsImpl.class); + + private final BillingAccountsClient innerClient; + + private final com.azure.resourcemanager.subscription.SubscriptionManager serviceManager; + + public BillingAccountsImpl(BillingAccountsClient innerClient, + com.azure.resourcemanager.subscription.SubscriptionManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getPolicyWithResponse(String billingAccountId, Context context) { + Response inner + = this.serviceClient().getPolicyWithResponse(billingAccountId, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new BillingAccountPoliciesResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public BillingAccountPoliciesResponse getPolicy(String billingAccountId) { + BillingAccountPoliciesResponseInner inner = this.serviceClient().getPolicy(billingAccountId); + if (inner != null) { + return new BillingAccountPoliciesResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + private BillingAccountsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.subscription.SubscriptionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/PutAliasResponseImpl.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/GetTenantPolicyResponseImpl.java similarity index 58% rename from sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/PutAliasResponseImpl.java rename to sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/GetTenantPolicyResponseImpl.java index fbbf30784329..eb1b70667b1e 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/PutAliasResponseImpl.java +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/GetTenantPolicyResponseImpl.java @@ -4,16 +4,17 @@ package com.azure.resourcemanager.subscription.implementation; -import com.azure.resourcemanager.subscription.fluent.models.PutAliasResponseInner; -import com.azure.resourcemanager.subscription.models.PutAliasResponse; -import com.azure.resourcemanager.subscription.models.PutAliasResponseProperties; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.subscription.fluent.models.GetTenantPolicyResponseInner; +import com.azure.resourcemanager.subscription.models.GetTenantPolicyResponse; +import com.azure.resourcemanager.subscription.models.TenantPolicy; -public final class PutAliasResponseImpl implements PutAliasResponse { - private PutAliasResponseInner innerObject; +public final class GetTenantPolicyResponseImpl implements GetTenantPolicyResponse { + private GetTenantPolicyResponseInner innerObject; private final com.azure.resourcemanager.subscription.SubscriptionManager serviceManager; - PutAliasResponseImpl(PutAliasResponseInner innerObject, + GetTenantPolicyResponseImpl(GetTenantPolicyResponseInner innerObject, com.azure.resourcemanager.subscription.SubscriptionManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; @@ -31,11 +32,15 @@ public String type() { return this.innerModel().type(); } - public PutAliasResponseProperties properties() { + public TenantPolicy properties() { return this.innerModel().properties(); } - public PutAliasResponseInner innerModel() { + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public GetTenantPolicyResponseInner innerModel() { return this.innerObject; } diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/LocationImpl.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/LocationImpl.java deleted file mode 100644 index 73aa8d012c81..000000000000 --- a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/LocationImpl.java +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.subscription.implementation; - -import com.azure.resourcemanager.subscription.fluent.models.LocationInner; -import com.azure.resourcemanager.subscription.models.Location; - -public final class LocationImpl implements Location { - private LocationInner innerObject; - - private final com.azure.resourcemanager.subscription.SubscriptionManager serviceManager; - - LocationImpl(LocationInner innerObject, com.azure.resourcemanager.subscription.SubscriptionManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - } - - public String id() { - return this.innerModel().id(); - } - - public String subscriptionId() { - return this.innerModel().subscriptionId(); - } - - public String name() { - return this.innerModel().name(); - } - - public String displayName() { - return this.innerModel().displayName(); - } - - public String latitude() { - return this.innerModel().latitude(); - } - - public String longitude() { - return this.innerModel().longitude(); - } - - public LocationInner innerModel() { - return this.innerObject; - } - - private com.azure.resourcemanager.subscription.SubscriptionManager manager() { - return this.serviceManager; - } -} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/OperationListResultImpl.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/OperationImpl.java similarity index 52% rename from sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/OperationListResultImpl.java rename to sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/OperationImpl.java index 5fa68bda8133..0d0a24b868f5 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/OperationListResultImpl.java +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/OperationImpl.java @@ -4,37 +4,34 @@ package com.azure.resourcemanager.subscription.implementation; -import com.azure.resourcemanager.subscription.fluent.models.OperationListResultInner; +import com.azure.resourcemanager.subscription.fluent.models.OperationInner; import com.azure.resourcemanager.subscription.models.Operation; -import com.azure.resourcemanager.subscription.models.OperationListResult; -import java.util.Collections; -import java.util.List; +import com.azure.resourcemanager.subscription.models.OperationDisplay; -public final class OperationListResultImpl implements OperationListResult { - private OperationListResultInner innerObject; +public final class OperationImpl implements Operation { + private OperationInner innerObject; private final com.azure.resourcemanager.subscription.SubscriptionManager serviceManager; - OperationListResultImpl(OperationListResultInner innerObject, + OperationImpl(OperationInner innerObject, com.azure.resourcemanager.subscription.SubscriptionManager 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 name() { + return this.innerModel().name(); } - public String nextLink() { - return this.innerModel().nextLink(); + public Boolean isDataAction() { + return this.innerModel().isDataAction(); } - public OperationListResultInner innerModel() { + public OperationDisplay display() { + return this.innerModel().display(); + } + + public OperationInner innerModel() { return this.innerObject; } diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/OperationsClientImpl.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/OperationsClientImpl.java index d55b1a2da3b6..a27879889427 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/OperationsClientImpl.java +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/OperationsClientImpl.java @@ -10,18 +10,25 @@ 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.subscription.fluent.OperationsClient; -import com.azure.resourcemanager.subscription.fluent.models.OperationListResultInner; +import com.azure.resourcemanager.subscription.fluent.models.OperationInner; +import com.azure.resourcemanager.subscription.models.OperationListResult; import reactor.core.publisher.Mono; /** @@ -54,14 +61,35 @@ public final class OperationsClientImpl implements OperationsClient { * perform REST calls. */ @Host("{$host}") - @ServiceInterface(name = "SubscriptionClientOp") + @ServiceInterface(name = "SubscriptionClientOperations") public interface OperationsService { @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Subscription/operations") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list(@HostParam("$host") String endpoint, + Mono> list(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Subscription/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@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); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); } /** @@ -69,21 +97,57 @@ Mono> list(@HostParam("$host") String endpoin * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of the request to list operations along with {@link Response} on successful completion of + * @return result of the request to list operations along with {@link PagedResponse} on successful completion of * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listWithResponseAsync() { + 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 apiVersion = "2020-09-01"; final String accept = "application/json"; - return FluxUtil.withContext(context -> service.list(this.client.getEndpoint(), apiVersion, accept, context)) + 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 Microsoft.Subscription 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 result of the request to list operations as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the available Microsoft.Subscription 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 result of the request to list operations along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Lists all of the available Microsoft.Subscription API operations. * @@ -91,19 +155,20 @@ private Mono> listWithResponseAsync() { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of the request to list operations along with {@link Response} on successful completion of - * {@link Mono}. + * @return result of the request to list operations along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listWithResponseAsync(Context context) { + private PagedResponse listSinglePage(Context context) { if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); } - final String apiVersion = "2020-09-01"; final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.list(this.client.getEndpoint(), apiVersion, accept, context); + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -111,11 +176,11 @@ private Mono> listWithResponseAsync(Context c * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of the request to list operations on successful completion of {@link Mono}. + * @return result of the request to list operations as paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono listAsync() { - return listWithResponseAsync().flatMap(res -> Mono.justOrEmpty(res.getValue())); + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listNextSinglePage(nextLink)); } /** @@ -125,22 +190,92 @@ private Mono listAsync() { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of the request to list operations along with {@link Response}. + * @return result of the request to list operations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listNextSinglePage(nextLink, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list operations along with {@link PagedResponse} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response listWithResponse(Context context) { - return listWithResponseAsync(context).block(); + 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())); } /** - * Lists all of the available Microsoft.Subscription API operations. + * Get the next page of items. * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of the request to list operations. + * @return result of the request to list operations along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public OperationListResultInner list() { - return listWithResponse(Context.NONE).getValue(); + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @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 result of the request to list operations along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } + + private static final ClientLogger LOGGER = new ClientLogger(OperationsClientImpl.class); } diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/OperationsImpl.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/OperationsImpl.java index 2f20acbcb44b..f2763dab2576 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/OperationsImpl.java +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/OperationsImpl.java @@ -4,13 +4,12 @@ package com.azure.resourcemanager.subscription.implementation; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.http.rest.PagedIterable; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.subscription.fluent.OperationsClient; -import com.azure.resourcemanager.subscription.fluent.models.OperationListResultInner; -import com.azure.resourcemanager.subscription.models.OperationListResult; +import com.azure.resourcemanager.subscription.fluent.models.OperationInner; +import com.azure.resourcemanager.subscription.models.Operation; import com.azure.resourcemanager.subscription.models.Operations; public final class OperationsImpl implements Operations { @@ -26,23 +25,14 @@ public OperationsImpl(OperationsClient innerClient, this.serviceManager = serviceManager; } - public Response listWithResponse(Context context) { - Response inner = this.serviceClient().listWithResponse(context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new OperationListResultImpl(inner.getValue(), this.manager())); - } else { - return null; - } + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); } - public OperationListResult list() { - OperationListResultInner inner = this.serviceClient().list(); - if (inner != null) { - return new OperationListResultImpl(inner, this.manager()); - } else { - return null; - } + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); } private OperationsClient serviceClient() { diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/PutAliasListResultImpl.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/SubscriptionAliasListResultImpl.java similarity index 54% rename from sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/PutAliasListResultImpl.java rename to sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/SubscriptionAliasListResultImpl.java index aad5acf1a9e2..ca88e9fb9cc1 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/PutAliasListResultImpl.java +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/SubscriptionAliasListResultImpl.java @@ -4,30 +4,30 @@ package com.azure.resourcemanager.subscription.implementation; -import com.azure.resourcemanager.subscription.fluent.models.PutAliasListResultInner; -import com.azure.resourcemanager.subscription.fluent.models.PutAliasResponseInner; -import com.azure.resourcemanager.subscription.models.PutAliasListResult; -import com.azure.resourcemanager.subscription.models.PutAliasResponse; +import com.azure.resourcemanager.subscription.fluent.models.SubscriptionAliasListResultInner; +import com.azure.resourcemanager.subscription.fluent.models.SubscriptionAliasResponseInner; +import com.azure.resourcemanager.subscription.models.SubscriptionAliasListResult; +import com.azure.resourcemanager.subscription.models.SubscriptionAliasResponse; import java.util.Collections; import java.util.List; import java.util.stream.Collectors; -public final class PutAliasListResultImpl implements PutAliasListResult { - private PutAliasListResultInner innerObject; +public final class SubscriptionAliasListResultImpl implements SubscriptionAliasListResult { + private SubscriptionAliasListResultInner innerObject; private final com.azure.resourcemanager.subscription.SubscriptionManager serviceManager; - PutAliasListResultImpl(PutAliasListResultInner innerObject, + SubscriptionAliasListResultImpl(SubscriptionAliasListResultInner innerObject, com.azure.resourcemanager.subscription.SubscriptionManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; } - public List value() { - List inner = this.innerModel().value(); + public List value() { + List inner = this.innerModel().value(); if (inner != null) { return Collections.unmodifiableList(inner.stream() - .map(inner1 -> new PutAliasResponseImpl(inner1, this.manager())) + .map(inner1 -> new SubscriptionAliasResponseImpl(inner1, this.manager())) .collect(Collectors.toList())); } else { return Collections.emptyList(); @@ -38,7 +38,7 @@ public String nextLink() { return this.innerModel().nextLink(); } - public PutAliasListResultInner innerModel() { + public SubscriptionAliasListResultInner innerModel() { return this.innerObject; } diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/SubscriptionAliasResponseImpl.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/SubscriptionAliasResponseImpl.java new file mode 100644 index 000000000000..9312d97b1af0 --- /dev/null +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/SubscriptionAliasResponseImpl.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.subscription.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.subscription.fluent.models.SubscriptionAliasResponseInner; +import com.azure.resourcemanager.subscription.models.SubscriptionAliasResponse; +import com.azure.resourcemanager.subscription.models.SubscriptionAliasResponseProperties; + +public final class SubscriptionAliasResponseImpl implements SubscriptionAliasResponse { + private SubscriptionAliasResponseInner innerObject; + + private final com.azure.resourcemanager.subscription.SubscriptionManager serviceManager; + + SubscriptionAliasResponseImpl(SubscriptionAliasResponseInner innerObject, + com.azure.resourcemanager.subscription.SubscriptionManager 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 SubscriptionAliasResponseProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public SubscriptionAliasResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.subscription.SubscriptionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/SubscriptionClientImpl.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/SubscriptionClientImpl.java index fa87e26d40b4..889452607bc0 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/SubscriptionClientImpl.java +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/SubscriptionClientImpl.java @@ -15,20 +15,24 @@ 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.management.polling.SyncPollerFactory; +import com.azure.core.util.BinaryData; import com.azure.core.util.Context; import com.azure.core.util.CoreUtils; import com.azure.core.util.logging.ClientLogger; import com.azure.core.util.polling.AsyncPollResponse; import com.azure.core.util.polling.LongRunningOperationStatus; import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; import com.azure.core.util.serializer.SerializerAdapter; import com.azure.core.util.serializer.SerializerEncoding; import com.azure.resourcemanager.subscription.fluent.AliasClient; +import com.azure.resourcemanager.subscription.fluent.BillingAccountsClient; import com.azure.resourcemanager.subscription.fluent.OperationsClient; import com.azure.resourcemanager.subscription.fluent.SubscriptionClient; import com.azure.resourcemanager.subscription.fluent.SubscriptionOperationsClient; +import com.azure.resourcemanager.subscription.fluent.SubscriptionPoliciesClient; import com.azure.resourcemanager.subscription.fluent.SubscriptionsClient; -import com.azure.resourcemanager.subscription.fluent.TenantsClient; import java.io.IOException; import java.lang.reflect.Type; import java.nio.ByteBuffer; @@ -57,6 +61,20 @@ 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. */ @@ -113,20 +131,6 @@ public SubscriptionsClient getSubscriptions() { return this.subscriptions; } - /** - * The TenantsClient object to access its operations. - */ - private final TenantsClient tenants; - - /** - * Gets the TenantsClient object to access its operations. - * - * @return the TenantsClient object. - */ - public TenantsClient getTenants() { - return this.tenants; - } - /** * The SubscriptionOperationsClient object to access its operations. */ @@ -169,6 +173,34 @@ public AliasClient getAlias() { return this.alias; } + /** + * The SubscriptionPoliciesClient object to access its operations. + */ + private final SubscriptionPoliciesClient subscriptionPolicies; + + /** + * Gets the SubscriptionPoliciesClient object to access its operations. + * + * @return the SubscriptionPoliciesClient object. + */ + public SubscriptionPoliciesClient getSubscriptionPolicies() { + return this.subscriptionPolicies; + } + + /** + * The BillingAccountsClient object to access its operations. + */ + private final BillingAccountsClient billingAccounts; + + /** + * Gets the BillingAccountsClient object to access its operations. + * + * @return the BillingAccountsClient object. + */ + public BillingAccountsClient getBillingAccounts() { + return this.billingAccounts; + } + /** * Initializes an instance of SubscriptionClient client. * @@ -184,11 +216,13 @@ public AliasClient getAlias() { this.serializerAdapter = serializerAdapter; this.defaultPollInterval = defaultPollInterval; this.endpoint = endpoint; + this.apiVersion = "2021-10-01"; this.subscriptions = new SubscriptionsClientImpl(this); - this.tenants = new TenantsClientImpl(this); this.subscriptionOperations = new SubscriptionOperationsClientImpl(this); this.operations = new OperationsClientImpl(this); this.alias = new AliasClientImpl(this); + this.subscriptionPolicies = new SubscriptionPoliciesClientImpl(this); + this.billingAccounts = new BillingAccountsClientImpl(this); } /** @@ -228,6 +262,23 @@ public PollerFlux, U> getLroResult(Mono type of poll result. + * @param type of final result. + * @return SyncPoller for poll result and final result. + */ + public SyncPoller, U> getLroResult(Response activationResponse, + Type pollResultType, Type finalResultType, Context context) { + return SyncPollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, () -> activationResponse, context); + } + /** * Gets the final result, or an error, based on last async poll response. * diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/SubscriptionCreationResultImpl.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/SubscriptionCreationResultImpl.java new file mode 100644 index 000000000000..907c118c2ed1 --- /dev/null +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/SubscriptionCreationResultImpl.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.subscription.implementation; + +import com.azure.resourcemanager.subscription.fluent.models.SubscriptionCreationResultInner; +import com.azure.resourcemanager.subscription.models.SubscriptionCreationResult; + +public final class SubscriptionCreationResultImpl implements SubscriptionCreationResult { + private SubscriptionCreationResultInner innerObject; + + private final com.azure.resourcemanager.subscription.SubscriptionManager serviceManager; + + SubscriptionCreationResultImpl(SubscriptionCreationResultInner innerObject, + com.azure.resourcemanager.subscription.SubscriptionManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String subscriptionLink() { + return this.innerModel().subscriptionLink(); + } + + public SubscriptionCreationResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.subscription.SubscriptionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/SubscriptionOperationsClientImpl.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/SubscriptionOperationsClientImpl.java index 7d17ac77d61a..5f3f468cdd0f 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/SubscriptionOperationsClientImpl.java +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/SubscriptionOperationsClientImpl.java @@ -4,29 +4,26 @@ package com.azure.resourcemanager.subscription.implementation; -import com.azure.core.annotation.BodyParam; 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.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.subscription.fluent.SubscriptionOperationsClient; -import com.azure.resourcemanager.subscription.fluent.models.CanceledSubscriptionIdInner; -import com.azure.resourcemanager.subscription.fluent.models.EnabledSubscriptionIdInner; -import com.azure.resourcemanager.subscription.fluent.models.RenamedSubscriptionIdInner; -import com.azure.resourcemanager.subscription.models.SubscriptionName; +import com.azure.resourcemanager.subscription.fluent.models.SubscriptionCreationResultInner; +import com.azure.resourcemanager.subscription.models.SubscriptionOperationsGetResponse; import reactor.core.publisher.Mono; /** @@ -59,336 +56,106 @@ public final class SubscriptionOperationsClientImpl implements SubscriptionOpera * service to perform REST calls. */ @Host("{$host}") - @ServiceInterface(name = "SubscriptionClientSu") + @ServiceInterface(name = "SubscriptionClientSubscriptionOperations") public interface SubscriptionOperationsService { @Headers({ "Content-Type: application/json" }) - @Post("/subscriptions/{subscriptionId}/providers/Microsoft.Subscription/cancel") - @ExpectedResponses({ 200 }) + @Get("/providers/Microsoft.Subscription/subscriptionOperations/{operationId}") + @ExpectedResponses({ 200, 202 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> cancel(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, + Mono get(@HostParam("$host") String endpoint, + @PathParam("operationId") String operationId, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) - @Post("/subscriptions/{subscriptionId}/providers/Microsoft.Subscription/rename") - @ExpectedResponses({ 200 }) + @Get("/providers/Microsoft.Subscription/subscriptionOperations/{operationId}") + @ExpectedResponses({ 200, 202 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> rename(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, - @BodyParam("application/json") SubscriptionName body, @HeaderParam("Accept") String accept, - Context context); - - @Headers({ "Content-Type: application/json" }) - @Post("/subscriptions/{subscriptionId}/providers/Microsoft.Subscription/enable") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> enable(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, + SubscriptionOperationsGetResponse getSync(@HostParam("$host") String endpoint, + @PathParam("operationId") String operationId, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); } /** - * The operation to cancel a subscription. + * Get the status of the pending Microsoft.Subscription API operations. * - * @param subscriptionId Subscription Id. + * @param operationId The operation ID, which can be found from the Location field in the generate recommendation + * response header. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the ID of the canceled subscription along with {@link Response} on successful completion of {@link Mono}. + * @return the status of the pending Microsoft.Subscription API operations on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> cancelWithResponseAsync(String subscriptionId) { + private Mono getWithResponseAsync(String operationId) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } - if (subscriptionId == null) { - return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + if (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); } - final String apiVersion = "2020-09-01"; final String accept = "application/json"; return FluxUtil - .withContext( - context -> service.cancel(this.client.getEndpoint(), subscriptionId, apiVersion, accept, context)) + .withContext(context -> service.get(this.client.getEndpoint(), operationId, this.client.getApiVersion(), + accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * The operation to cancel a subscription. - * - * @param subscriptionId Subscription 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 ID of the canceled subscription along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> cancelWithResponseAsync(String subscriptionId, - Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (subscriptionId == null) { - return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); - } - final String apiVersion = "2020-09-01"; - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.cancel(this.client.getEndpoint(), subscriptionId, apiVersion, accept, context); - } - - /** - * The operation to cancel a subscription. - * - * @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 ID of the canceled subscription on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono cancelAsync(String subscriptionId) { - return cancelWithResponseAsync(subscriptionId).flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * The operation to cancel a subscription. - * - * @param subscriptionId Subscription 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 ID of the canceled subscription along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response cancelWithResponse(String subscriptionId, Context context) { - return cancelWithResponseAsync(subscriptionId, context).block(); - } - - /** - * The operation to cancel a subscription. - * - * @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 ID of the canceled subscription. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public CanceledSubscriptionIdInner cancel(String subscriptionId) { - return cancelWithResponse(subscriptionId, Context.NONE).getValue(); - } - - /** - * The operation to rename a subscription. - * - * @param subscriptionId Subscription Id. - * @param body Subscription Name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the ID of the subscriptions that is being renamed along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> renameWithResponseAsync(String subscriptionId, - SubscriptionName body) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (subscriptionId == null) { - return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); - } - if (body == null) { - return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); - } else { - body.validate(); - } - final String apiVersion = "2020-09-01"; - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> service.rename(this.client.getEndpoint(), subscriptionId, apiVersion, body, accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * The operation to rename a subscription. - * - * @param subscriptionId Subscription Id. - * @param body Subscription Name. - * @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 ID of the subscriptions that is being renamed along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> renameWithResponseAsync(String subscriptionId, - SubscriptionName body, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (subscriptionId == null) { - return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); - } - if (body == null) { - return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); - } else { - body.validate(); - } - final String apiVersion = "2020-09-01"; - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.rename(this.client.getEndpoint(), subscriptionId, apiVersion, body, accept, context); - } - - /** - * The operation to rename a subscription. + * Get the status of the pending Microsoft.Subscription API operations. * - * @param subscriptionId Subscription Id. - * @param body Subscription Name. + * @param operationId The operation ID, which can be found from the Location field in the generate recommendation + * response header. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the ID of the subscriptions that is being renamed on successful completion of {@link Mono}. + * @return the status of the pending Microsoft.Subscription API operations on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono renameAsync(String subscriptionId, SubscriptionName body) { - return renameWithResponseAsync(subscriptionId, body).flatMap(res -> Mono.justOrEmpty(res.getValue())); + private Mono getAsync(String operationId) { + return getWithResponseAsync(operationId).flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** - * The operation to rename a subscription. + * Get the status of the pending Microsoft.Subscription API operations. * - * @param subscriptionId Subscription Id. - * @param body Subscription Name. + * @param operationId The operation ID, which can be found from the Location field in the generate recommendation + * response header. * @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 ID of the subscriptions that is being renamed along with {@link Response}. + * @return the status of the pending Microsoft.Subscription API operations. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response renameWithResponse(String subscriptionId, SubscriptionName body, - Context context) { - return renameWithResponseAsync(subscriptionId, body, context).block(); - } - - /** - * The operation to rename a subscription. - * - * @param subscriptionId Subscription Id. - * @param body Subscription Name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the ID of the subscriptions that is being renamed. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public RenamedSubscriptionIdInner rename(String subscriptionId, SubscriptionName body) { - return renameWithResponse(subscriptionId, body, Context.NONE).getValue(); - } - - /** - * The operation to enable a subscription. - * - * @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 ID of the subscriptions that is being enabled along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> enableWithResponseAsync(String subscriptionId) { + public SubscriptionOperationsGetResponse getWithResponse(String operationId, Context context) { if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); } - if (subscriptionId == null) { - return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + if (operationId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); } - final String apiVersion = "2020-09-01"; final String accept = "application/json"; - return FluxUtil - .withContext( - context -> service.enable(this.client.getEndpoint(), subscriptionId, apiVersion, accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + return service.getSync(this.client.getEndpoint(), operationId, this.client.getApiVersion(), accept, context); } /** - * The operation to enable a subscription. + * Get the status of the pending Microsoft.Subscription API operations. * - * @param subscriptionId Subscription 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 ID of the subscriptions that is being enabled along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> enableWithResponseAsync(String subscriptionId, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (subscriptionId == null) { - return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); - } - final String apiVersion = "2020-09-01"; - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.enable(this.client.getEndpoint(), subscriptionId, apiVersion, accept, context); - } - - /** - * The operation to enable a subscription. - * - * @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 ID of the subscriptions that is being enabled on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono enableAsync(String subscriptionId) { - return enableWithResponseAsync(subscriptionId).flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * The operation to enable a subscription. - * - * @param subscriptionId Subscription Id. - * @param context The context to associate with this operation. + * @param operationId The operation ID, which can be found from the Location field in the generate recommendation + * response header. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the ID of the subscriptions that is being enabled along with {@link Response}. + * @return the status of the pending Microsoft.Subscription API operations. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response enableWithResponse(String subscriptionId, Context context) { - return enableWithResponseAsync(subscriptionId, context).block(); + public SubscriptionCreationResultInner get(String operationId) { + return getWithResponse(operationId, Context.NONE).getValue(); } - /** - * The operation to enable a subscription. - * - * @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 ID of the subscriptions that is being enabled. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public EnabledSubscriptionIdInner enable(String subscriptionId) { - return enableWithResponse(subscriptionId, Context.NONE).getValue(); - } + private static final ClientLogger LOGGER = new ClientLogger(SubscriptionOperationsClientImpl.class); } diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/SubscriptionOperationsImpl.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/SubscriptionOperationsImpl.java index 461a3a9fcfe2..459591569bb5 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/SubscriptionOperationsImpl.java +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/SubscriptionOperationsImpl.java @@ -9,14 +9,10 @@ import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.subscription.fluent.SubscriptionOperationsClient; -import com.azure.resourcemanager.subscription.fluent.models.CanceledSubscriptionIdInner; -import com.azure.resourcemanager.subscription.fluent.models.EnabledSubscriptionIdInner; -import com.azure.resourcemanager.subscription.fluent.models.RenamedSubscriptionIdInner; -import com.azure.resourcemanager.subscription.models.CanceledSubscriptionId; -import com.azure.resourcemanager.subscription.models.EnabledSubscriptionId; -import com.azure.resourcemanager.subscription.models.RenamedSubscriptionId; -import com.azure.resourcemanager.subscription.models.SubscriptionName; +import com.azure.resourcemanager.subscription.fluent.models.SubscriptionCreationResultInner; +import com.azure.resourcemanager.subscription.models.SubscriptionCreationResult; import com.azure.resourcemanager.subscription.models.SubscriptionOperations; +import com.azure.resourcemanager.subscription.models.SubscriptionOperationsGetResponse; public final class SubscriptionOperationsImpl implements SubscriptionOperations { private static final ClientLogger LOGGER = new ClientLogger(SubscriptionOperationsImpl.class); @@ -31,60 +27,20 @@ public SubscriptionOperationsImpl(SubscriptionOperationsClient innerClient, this.serviceManager = serviceManager; } - public Response cancelWithResponse(String subscriptionId, Context context) { - Response inner = this.serviceClient().cancelWithResponse(subscriptionId, context); + public Response getWithResponse(String operationId, Context context) { + SubscriptionOperationsGetResponse inner = this.serviceClient().getWithResponse(operationId, context); if (inner != null) { return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new CanceledSubscriptionIdImpl(inner.getValue(), this.manager())); + new SubscriptionCreationResultImpl(inner.getValue(), this.manager())); } else { return null; } } - public CanceledSubscriptionId cancel(String subscriptionId) { - CanceledSubscriptionIdInner inner = this.serviceClient().cancel(subscriptionId); + public SubscriptionCreationResult get(String operationId) { + SubscriptionCreationResultInner inner = this.serviceClient().get(operationId); if (inner != null) { - return new CanceledSubscriptionIdImpl(inner, this.manager()); - } else { - return null; - } - } - - public Response renameWithResponse(String subscriptionId, SubscriptionName body, - Context context) { - Response inner - = this.serviceClient().renameWithResponse(subscriptionId, body, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new RenamedSubscriptionIdImpl(inner.getValue(), this.manager())); - } else { - return null; - } - } - - public RenamedSubscriptionId rename(String subscriptionId, SubscriptionName body) { - RenamedSubscriptionIdInner inner = this.serviceClient().rename(subscriptionId, body); - if (inner != null) { - return new RenamedSubscriptionIdImpl(inner, this.manager()); - } else { - return null; - } - } - - public Response enableWithResponse(String subscriptionId, Context context) { - Response inner = this.serviceClient().enableWithResponse(subscriptionId, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new EnabledSubscriptionIdImpl(inner.getValue(), this.manager())); - } else { - return null; - } - } - - public EnabledSubscriptionId enable(String subscriptionId) { - EnabledSubscriptionIdInner inner = this.serviceClient().enable(subscriptionId); - if (inner != null) { - return new EnabledSubscriptionIdImpl(inner, this.manager()); + return new SubscriptionCreationResultImpl(inner, this.manager()); } else { return null; } diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/SubscriptionPoliciesClientImpl.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/SubscriptionPoliciesClientImpl.java new file mode 100644 index 000000000000..af1b59f7d5d4 --- /dev/null +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/SubscriptionPoliciesClientImpl.java @@ -0,0 +1,474 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.subscription.implementation; + +import com.azure.core.annotation.BodyParam; +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.subscription.fluent.SubscriptionPoliciesClient; +import com.azure.resourcemanager.subscription.fluent.models.GetTenantPolicyResponseInner; +import com.azure.resourcemanager.subscription.models.GetTenantPolicyListResponse; +import com.azure.resourcemanager.subscription.models.PutTenantPolicyRequestProperties; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in SubscriptionPoliciesClient. + */ +public final class SubscriptionPoliciesClientImpl implements SubscriptionPoliciesClient { + /** + * The proxy service used to perform REST calls. + */ + private final SubscriptionPoliciesService service; + + /** + * The service client containing this operation class. + */ + private final SubscriptionClientImpl client; + + /** + * Initializes an instance of SubscriptionPoliciesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SubscriptionPoliciesClientImpl(SubscriptionClientImpl client) { + this.service = RestProxy.create(SubscriptionPoliciesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SubscriptionClientSubscriptionPolicies to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SubscriptionClientSubscriptionPolicies") + public interface SubscriptionPoliciesService { + @Headers({ "Content-Type: application/json" }) + @Put("/providers/Microsoft.Subscription/policies/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> addUpdatePolicyForTenant(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") PutTenantPolicyRequestProperties body, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/providers/Microsoft.Subscription/policies/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response addUpdatePolicyForTenantSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") PutTenantPolicyRequestProperties body, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Subscription/policies/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getPolicyForTenant(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Subscription/policies/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getPolicyForTenantSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Subscription/policies") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listPolicyForTenant(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Subscription/policies") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listPolicyForTenantSync(@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> listPolicyForTenantNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listPolicyForTenantNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Create or Update Subscription tenant policy for user's tenant. + * + * @param body The body 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 tenant policy Information along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + addUpdatePolicyForTenantWithResponseAsync(PutTenantPolicyRequestProperties body) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.addUpdatePolicyForTenant(this.client.getEndpoint(), + this.client.getApiVersion(), body, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or Update Subscription tenant policy for user's tenant. + * + * @param body The body 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 tenant policy Information on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono addUpdatePolicyForTenantAsync(PutTenantPolicyRequestProperties body) { + return addUpdatePolicyForTenantWithResponseAsync(body).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Create or Update Subscription tenant policy for user's tenant. + * + * @param body The body 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 tenant policy Information along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response + addUpdatePolicyForTenantWithResponse(PutTenantPolicyRequestProperties body, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (body == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return service.addUpdatePolicyForTenantSync(this.client.getEndpoint(), this.client.getApiVersion(), body, + accept, context); + } + + /** + * Create or Update Subscription tenant policy for user's tenant. + * + * @param body The body 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 tenant policy Information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GetTenantPolicyResponseInner addUpdatePolicyForTenant(PutTenantPolicyRequestProperties body) { + return addUpdatePolicyForTenantWithResponse(body, Context.NONE).getValue(); + } + + /** + * Get the subscription tenant policy for the user's 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 subscription tenant policy for the user's tenant along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getPolicyForTenantWithResponseAsync() { + 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.getPolicyForTenant(this.client.getEndpoint(), this.client.getApiVersion(), + accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the subscription tenant policy for the user's 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 subscription tenant policy for the user's tenant on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getPolicyForTenantAsync() { + return getPolicyForTenantWithResponseAsync().flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get the subscription tenant policy for the user's 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 subscription tenant policy for the user's tenant along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getPolicyForTenantWithResponse(Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getPolicyForTenantSync(this.client.getEndpoint(), this.client.getApiVersion(), accept, context); + } + + /** + * Get the subscription tenant policy for the user's 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 subscription tenant policy for the user's tenant. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GetTenantPolicyResponseInner getPolicyForTenant() { + return getPolicyForTenantWithResponse(Context.NONE).getValue(); + } + + /** + * Get the subscription tenant policy for the user's 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 subscription tenant policy for the user's tenant along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listPolicyForTenantSinglePageAsync() { + 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.listPolicyForTenant(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())); + } + + /** + * Get the subscription tenant policy for the user's 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 subscription tenant policy for the user's tenant as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listPolicyForTenantAsync() { + return new PagedFlux<>(() -> listPolicyForTenantSinglePageAsync(), + nextLink -> listPolicyForTenantNextSinglePageAsync(nextLink)); + } + + /** + * Get the subscription tenant policy for the user's 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 subscription tenant policy for the user's tenant along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listPolicyForTenantSinglePage() { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listPolicyForTenantSync(this.client.getEndpoint(), + this.client.getApiVersion(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the subscription tenant policy for the user's 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 subscription tenant policy for the user's tenant along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listPolicyForTenantSinglePage(Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listPolicyForTenantSync(this.client.getEndpoint(), this.client.getApiVersion(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the subscription tenant policy for the user's 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 subscription tenant policy for the user's tenant as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listPolicyForTenant() { + return new PagedIterable<>(() -> listPolicyForTenantSinglePage(), + nextLink -> listPolicyForTenantNextSinglePage(nextLink)); + } + + /** + * Get the subscription tenant policy for the user's 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 subscription tenant policy for the user's tenant as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listPolicyForTenant(Context context) { + return new PagedIterable<>(() -> listPolicyForTenantSinglePage(context), + nextLink -> listPolicyForTenantNextSinglePage(nextLink, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the subscription tenant policy for the user's tenant along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listPolicyForTenantNextSinglePageAsync(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.listPolicyForTenantNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the subscription tenant policy for the user's tenant along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listPolicyForTenantNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listPolicyForTenantNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @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 subscription tenant policy for the user's tenant along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listPolicyForTenantNextSinglePage(String nextLink, + Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listPolicyForTenantNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + private static final ClientLogger LOGGER = new ClientLogger(SubscriptionPoliciesClientImpl.class); +} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/SubscriptionPoliciesImpl.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/SubscriptionPoliciesImpl.java new file mode 100644 index 000000000000..b7d4b91d34e3 --- /dev/null +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/SubscriptionPoliciesImpl.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.subscription.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.subscription.fluent.SubscriptionPoliciesClient; +import com.azure.resourcemanager.subscription.fluent.models.GetTenantPolicyResponseInner; +import com.azure.resourcemanager.subscription.models.GetTenantPolicyResponse; +import com.azure.resourcemanager.subscription.models.PutTenantPolicyRequestProperties; +import com.azure.resourcemanager.subscription.models.SubscriptionPolicies; + +public final class SubscriptionPoliciesImpl implements SubscriptionPolicies { + private static final ClientLogger LOGGER = new ClientLogger(SubscriptionPoliciesImpl.class); + + private final SubscriptionPoliciesClient innerClient; + + private final com.azure.resourcemanager.subscription.SubscriptionManager serviceManager; + + public SubscriptionPoliciesImpl(SubscriptionPoliciesClient innerClient, + com.azure.resourcemanager.subscription.SubscriptionManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response addUpdatePolicyForTenantWithResponse(PutTenantPolicyRequestProperties body, + Context context) { + Response inner + = this.serviceClient().addUpdatePolicyForTenantWithResponse(body, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new GetTenantPolicyResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public GetTenantPolicyResponse addUpdatePolicyForTenant(PutTenantPolicyRequestProperties body) { + GetTenantPolicyResponseInner inner = this.serviceClient().addUpdatePolicyForTenant(body); + if (inner != null) { + return new GetTenantPolicyResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getPolicyForTenantWithResponse(Context context) { + Response inner = this.serviceClient().getPolicyForTenantWithResponse(context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new GetTenantPolicyResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public GetTenantPolicyResponse getPolicyForTenant() { + GetTenantPolicyResponseInner inner = this.serviceClient().getPolicyForTenant(); + if (inner != null) { + return new GetTenantPolicyResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listPolicyForTenant() { + PagedIterable inner = this.serviceClient().listPolicyForTenant(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new GetTenantPolicyResponseImpl(inner1, this.manager())); + } + + public PagedIterable listPolicyForTenant(Context context) { + PagedIterable inner = this.serviceClient().listPolicyForTenant(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new GetTenantPolicyResponseImpl(inner1, this.manager())); + } + + private SubscriptionPoliciesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.subscription.SubscriptionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/SubscriptionsClientImpl.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/SubscriptionsClientImpl.java index 87fd9ef2bbf4..d875f196d7fc 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/SubscriptionsClientImpl.java +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/SubscriptionsClientImpl.java @@ -4,6 +4,7 @@ package com.azure.resourcemanager.subscription.implementation; +import com.azure.core.annotation.BodyParam; import com.azure.core.annotation.ExpectedResponses; import com.azure.core.annotation.Get; import com.azure.core.annotation.HeaderParam; @@ -11,25 +12,31 @@ 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.management.polling.PollResult; +import com.azure.core.util.BinaryData; 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.subscription.fluent.SubscriptionsClient; -import com.azure.resourcemanager.subscription.fluent.models.LocationInner; -import com.azure.resourcemanager.subscription.fluent.models.SubscriptionInner; -import com.azure.resourcemanager.subscription.models.LocationListResult; -import com.azure.resourcemanager.subscription.models.SubscriptionListResult; +import com.azure.resourcemanager.subscription.fluent.models.AcceptOwnershipStatusResponseInner; +import com.azure.resourcemanager.subscription.fluent.models.CanceledSubscriptionIdInner; +import com.azure.resourcemanager.subscription.fluent.models.EnabledSubscriptionIdInner; +import com.azure.resourcemanager.subscription.fluent.models.RenamedSubscriptionIdInner; +import com.azure.resourcemanager.subscription.models.AcceptOwnershipRequest; +import com.azure.resourcemanager.subscription.models.SubscriptionName; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; /** @@ -62,54 +69,104 @@ public final class SubscriptionsClientImpl implements SubscriptionsClient { * perform REST calls. */ @Host("{$host}") - @ServiceInterface(name = "SubscriptionClientSu") + @ServiceInterface(name = "SubscriptionClientSubscriptions") public interface SubscriptionsService { @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/locations") + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.Subscription/cancel") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listLocations(@HostParam("$host") String endpoint, + Mono> cancel(@HostParam("$host") String endpoint, @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}") + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.Subscription/cancel") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> get(@HostParam("$host") String endpoint, + Response cancelSync(@HostParam("$host") String endpoint, @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions") + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.Subscription/rename") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list(@HostParam("$host") String endpoint, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + Mono> rename(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SubscriptionName body, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.Subscription/rename") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response renameSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SubscriptionName body, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.Subscription/enable") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> enable(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) - @Get("{nextLink}") + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.Subscription/enable") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + Response enableSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/providers/Microsoft.Subscription/subscriptions/{subscriptionId}/acceptOwnership") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> acceptOwnership(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") AcceptOwnershipRequest body, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/providers/Microsoft.Subscription/subscriptions/{subscriptionId}/acceptOwnership") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response acceptOwnershipSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") AcceptOwnershipRequest body, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Subscription/subscriptions/{subscriptionId}/acceptOwnershipStatus") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> acceptOwnershipStatus(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Subscription/subscriptions/{subscriptionId}/acceptOwnershipStatus") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response acceptOwnershipStatusSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); } /** - * Gets all available geo-locations. - * - * This operation provides all the locations that are available for resource providers; however, each resource - * provider may support a subset of this list. + * The operation to cancel a subscription. * - * @param subscriptionId The ID of the target subscription. + * @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 location list operation response along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return the ID of the canceled subscription along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listLocationsSinglePageAsync(String subscriptionId) { + private Mono> cancelWithResponseAsync(String subscriptionId) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -117,155 +174,175 @@ private Mono> listLocationsSinglePageAsync(String s if (subscriptionId == null) { return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); } - final String apiVersion = "2016-06-01"; final String accept = "application/json"; - return FluxUtil.withContext( - context -> service.listLocations(this.client.getEndpoint(), subscriptionId, apiVersion, accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), - res.getHeaders(), res.getValue().value(), null, null)) + return FluxUtil + .withContext(context -> service.cancel(this.client.getEndpoint(), subscriptionId, + this.client.getApiVersion(), accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Gets all available geo-locations. + * The operation to cancel a subscription. * - * This operation provides all the locations that are available for resource providers; however, each resource - * provider may support a subset of this list. + * @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 ID of the canceled subscription on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono cancelAsync(String subscriptionId) { + return cancelWithResponseAsync(subscriptionId).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * The operation to cancel a subscription. * - * @param subscriptionId The ID of the target subscription. + * @param subscriptionId Subscription 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 location list operation response along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return the ID of the canceled subscription along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listLocationsSinglePageAsync(String subscriptionId, Context context) { + public Response cancelWithResponse(String subscriptionId, Context context) { if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (subscriptionId == null) { - return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); } - final String apiVersion = "2016-06-01"; final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.listLocations(this.client.getEndpoint(), subscriptionId, apiVersion, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), null, null)); + return service.cancelSync(this.client.getEndpoint(), subscriptionId, this.client.getApiVersion(), accept, + context); } /** - * Gets all available geo-locations. + * The operation to cancel a subscription. * - * This operation provides all the locations that are available for resource providers; however, each resource - * provider may support a subset of this list. - * - * @param subscriptionId The ID of the target subscription. + * @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 location list operation response as paginated response with {@link PagedFlux}. + * @return the ID of the canceled subscription. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listLocationsAsync(String subscriptionId) { - return new PagedFlux<>(() -> listLocationsSinglePageAsync(subscriptionId)); + @ServiceMethod(returns = ReturnType.SINGLE) + public CanceledSubscriptionIdInner cancel(String subscriptionId) { + return cancelWithResponse(subscriptionId, Context.NONE).getValue(); } /** - * Gets all available geo-locations. - * - * This operation provides all the locations that are available for resource providers; however, each resource - * provider may support a subset of this list. + * The operation to rename a subscription. * - * @param subscriptionId The ID of the target subscription. - * @param context The context to associate with this operation. + * @param subscriptionId Subscription Id. + * @param body Subscription Name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return location list operation response as paginated response with {@link PagedFlux}. + * @return the ID of the subscriptions that is being renamed along with {@link Response} on successful completion of + * {@link Mono}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listLocationsAsync(String subscriptionId, Context context) { - return new PagedFlux<>(() -> listLocationsSinglePageAsync(subscriptionId, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> renameWithResponseAsync(String subscriptionId, + SubscriptionName body) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.rename(this.client.getEndpoint(), subscriptionId, + this.client.getApiVersion(), body, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Gets all available geo-locations. - * - * This operation provides all the locations that are available for resource providers; however, each resource - * provider may support a subset of this list. + * The operation to rename a subscription. * - * @param subscriptionId The ID of the target subscription. + * @param subscriptionId Subscription Id. + * @param body Subscription Name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return location list operation response as paginated response with {@link PagedIterable}. + * @return the ID of the subscriptions that is being renamed on successful completion of {@link Mono}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listLocations(String subscriptionId) { - return new PagedIterable<>(listLocationsAsync(subscriptionId)); + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono renameAsync(String subscriptionId, SubscriptionName body) { + return renameWithResponseAsync(subscriptionId, body).flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** - * Gets all available geo-locations. + * The operation to rename a subscription. * - * This operation provides all the locations that are available for resource providers; however, each resource - * provider may support a subset of this list. - * - * @param subscriptionId The ID of the target subscription. + * @param subscriptionId Subscription Id. + * @param body Subscription Name. * @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 location list operation response as paginated response with {@link PagedIterable}. + * @return the ID of the subscriptions that is being renamed along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listLocations(String subscriptionId, Context context) { - return new PagedIterable<>(listLocationsAsync(subscriptionId, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + public Response renameWithResponse(String subscriptionId, SubscriptionName body, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (body == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return service.renameSync(this.client.getEndpoint(), subscriptionId, this.client.getApiVersion(), body, accept, + context); } /** - * Gets details about a specified subscription. + * The operation to rename a subscription. * - * @param subscriptionId The ID of the target subscription. + * @param subscriptionId Subscription Id. + * @param body Subscription Name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return details about a specified subscription along with {@link Response} on successful completion of - * {@link Mono}. + * @return the ID of the subscriptions that is being renamed. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String subscriptionId) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (subscriptionId == null) { - return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); - } - final String apiVersion = "2016-06-01"; - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.get(this.client.getEndpoint(), subscriptionId, apiVersion, accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + public RenamedSubscriptionIdInner rename(String subscriptionId, SubscriptionName body) { + return renameWithResponse(subscriptionId, body, Context.NONE).getValue(); } /** - * Gets details about a specified subscription. + * The operation to enable a subscription. * - * @param subscriptionId The ID of the target subscription. - * @param context The context to associate with this operation. + * @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 details about a specified subscription along with {@link Response} on successful completion of + * @return the ID of the subscriptions that is being enabled along with {@link Response} on successful completion of * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String subscriptionId, Context context) { + private Mono> enableWithResponseAsync(String subscriptionId) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -273,202 +350,340 @@ private Mono> getWithResponseAsync(String subscripti if (subscriptionId == null) { return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); } - final String apiVersion = "2016-06-01"; final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.get(this.client.getEndpoint(), subscriptionId, apiVersion, accept, context); + return FluxUtil + .withContext(context -> service.enable(this.client.getEndpoint(), subscriptionId, + this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Gets details about a specified subscription. + * The operation to enable a subscription. * - * @param subscriptionId The ID of the target subscription. + * @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 details about a specified subscription on successful completion of {@link Mono}. + * @return the ID of the subscriptions that is being enabled on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getAsync(String subscriptionId) { - return getWithResponseAsync(subscriptionId).flatMap(res -> Mono.justOrEmpty(res.getValue())); + private Mono enableAsync(String subscriptionId) { + return enableWithResponseAsync(subscriptionId).flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** - * Gets details about a specified subscription. + * The operation to enable a subscription. * - * @param subscriptionId The ID of the target subscription. + * @param subscriptionId Subscription 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 details about a specified subscription along with {@link Response}. + * @return the ID of the subscriptions that is being enabled along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(String subscriptionId, Context context) { - return getWithResponseAsync(subscriptionId, context).block(); + public Response enableWithResponse(String subscriptionId, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + final String accept = "application/json"; + return service.enableSync(this.client.getEndpoint(), subscriptionId, this.client.getApiVersion(), accept, + context); } /** - * Gets details about a specified subscription. + * The operation to enable a subscription. * - * @param subscriptionId The ID of the target subscription. + * @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 details about a specified subscription. + * @return the ID of the subscriptions that is being enabled. */ @ServiceMethod(returns = ReturnType.SINGLE) - public SubscriptionInner get(String subscriptionId) { - return getWithResponse(subscriptionId, Context.NONE).getValue(); + public EnabledSubscriptionIdInner enable(String subscriptionId) { + return enableWithResponse(subscriptionId, Context.NONE).getValue(); } /** - * Gets all subscriptions for a tenant. + * Accept subscription ownership. * + * @param subscriptionId Subscription Id. + * @param body The body 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 all subscriptions for a tenant along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync() { + private Mono>> acceptOwnershipWithResponseAsync(String subscriptionId, + AcceptOwnershipRequest body) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } - final String apiVersion = "2016-06-01"; + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } final String accept = "application/json"; - return FluxUtil.withContext(context -> service.list(this.client.getEndpoint(), apiVersion, accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), - res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + return FluxUtil + .withContext(context -> service.acceptOwnership(this.client.getEndpoint(), subscriptionId, + this.client.getApiVersion(), body, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Gets all subscriptions for a tenant. + * Accept subscription ownership. * + * @param subscriptionId Subscription Id. + * @param body The body 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 response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response acceptOwnershipWithResponse(String subscriptionId, AcceptOwnershipRequest body) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (body == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return service.acceptOwnershipSync(this.client.getEndpoint(), subscriptionId, this.client.getApiVersion(), body, + accept, Context.NONE); + } + + /** + * Accept subscription ownership. + * + * @param subscriptionId Subscription Id. + * @param body The body 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 all subscriptions for a tenant along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return the response body along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(Context context) { + private Response acceptOwnershipWithResponse(String subscriptionId, AcceptOwnershipRequest body, + Context context) { if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (body == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); } - final String apiVersion = "2016-06-01"; final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.list(this.client.getEndpoint(), apiVersion, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + return service.acceptOwnershipSync(this.client.getEndpoint(), subscriptionId, this.client.getApiVersion(), body, + accept, context); + } + + /** + * Accept subscription ownership. + * + * @param subscriptionId Subscription Id. + * @param body The body 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginAcceptOwnershipAsync(String subscriptionId, + AcceptOwnershipRequest body) { + Mono>> mono = acceptOwnershipWithResponseAsync(subscriptionId, body); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); } /** - * Gets all subscriptions for a tenant. + * Accept subscription ownership. * + * @param subscriptionId Subscription Id. + * @param body The body 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 all subscriptions for a tenant as paginated response with {@link PagedFlux}. + * @return the {@link SyncPoller} for polling of long-running operation. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync() { - return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginAcceptOwnership(String subscriptionId, AcceptOwnershipRequest body) { + Response response = acceptOwnershipWithResponse(subscriptionId, body); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); } /** - * Gets all subscriptions for a tenant. + * Accept subscription ownership. * + * @param subscriptionId Subscription Id. + * @param body The body 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 all subscriptions for a tenant as paginated response with {@link PagedFlux}. + * @return the {@link SyncPoller} for polling of long-running operation. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(context), - nextLink -> listNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginAcceptOwnership(String subscriptionId, AcceptOwnershipRequest body, + Context context) { + Response response = acceptOwnershipWithResponse(subscriptionId, body, context); + return this.client.getLroResult(response, Void.class, Void.class, context); } /** - * Gets all subscriptions for a tenant. + * Accept subscription ownership. * + * @param subscriptionId Subscription Id. + * @param body The body 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 A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono acceptOwnershipAsync(String subscriptionId, AcceptOwnershipRequest body) { + return beginAcceptOwnershipAsync(subscriptionId, body).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Accept subscription ownership. + * + * @param subscriptionId Subscription Id. + * @param body The body 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 all subscriptions for a tenant as paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list() { - return new PagedIterable<>(listAsync()); + @ServiceMethod(returns = ReturnType.SINGLE) + public void acceptOwnership(String subscriptionId, AcceptOwnershipRequest body) { + beginAcceptOwnership(subscriptionId, body).getFinalResult(); } /** - * Gets all subscriptions for a tenant. + * Accept subscription ownership. * + * @param subscriptionId Subscription Id. + * @param body The body 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 all subscriptions for a tenant as paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(Context context) { - return new PagedIterable<>(listAsync(context)); + @ServiceMethod(returns = ReturnType.SINGLE) + public void acceptOwnership(String subscriptionId, AcceptOwnershipRequest body, Context context) { + beginAcceptOwnership(subscriptionId, body, context).getFinalResult(); } /** - * Get the next page of items. + * Accept subscription ownership status. * - * @param nextLink The URL to get the next list of items. + * @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 subscription list operation response along with {@link PagedResponse} on successful completion of + * @return subscription Accept Ownership Response along with {@link Response} 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.")); - } + private Mono> + acceptOwnershipStatusWithResponseAsync(String subscriptionId) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() 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.listNext(nextLink, this.client.getEndpoint(), accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), - res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + return FluxUtil + .withContext(context -> service.acceptOwnershipStatus(this.client.getEndpoint(), subscriptionId, + this.client.getApiVersion(), accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Get the next page of items. + * Accept subscription ownership status. * - * @param nextLink The URL to get the next list of items. + * @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 subscription Accept Ownership Response on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono acceptOwnershipStatusAsync(String subscriptionId) { + return acceptOwnershipStatusWithResponseAsync(subscriptionId).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Accept subscription ownership status. + * + * @param subscriptionId Subscription 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 subscription list operation response along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return subscription Accept Ownership Response along with {@link Response}. */ @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.")); - } + public Response acceptOwnershipStatusWithResponse(String subscriptionId, + Context context) { if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter subscriptionId 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)); + return service.acceptOwnershipStatusSync(this.client.getEndpoint(), subscriptionId, this.client.getApiVersion(), + accept, context); } + + /** + * Accept subscription ownership status. + * + * @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 subscription Accept Ownership Response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AcceptOwnershipStatusResponseInner acceptOwnershipStatus(String subscriptionId) { + return acceptOwnershipStatusWithResponse(subscriptionId, Context.NONE).getValue(); + } + + private static final ClientLogger LOGGER = new ClientLogger(SubscriptionsClientImpl.class); } diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/SubscriptionsImpl.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/SubscriptionsImpl.java index 7d18bb790bc2..94aeac190529 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/SubscriptionsImpl.java +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/SubscriptionsImpl.java @@ -4,16 +4,21 @@ package com.azure.resourcemanager.subscription.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.subscription.fluent.SubscriptionsClient; -import com.azure.resourcemanager.subscription.fluent.models.LocationInner; -import com.azure.resourcemanager.subscription.fluent.models.SubscriptionInner; -import com.azure.resourcemanager.subscription.models.Location; -import com.azure.resourcemanager.subscription.models.Subscription; +import com.azure.resourcemanager.subscription.fluent.models.AcceptOwnershipStatusResponseInner; +import com.azure.resourcemanager.subscription.fluent.models.CanceledSubscriptionIdInner; +import com.azure.resourcemanager.subscription.fluent.models.EnabledSubscriptionIdInner; +import com.azure.resourcemanager.subscription.fluent.models.RenamedSubscriptionIdInner; +import com.azure.resourcemanager.subscription.models.AcceptOwnershipRequest; +import com.azure.resourcemanager.subscription.models.AcceptOwnershipStatusResponse; +import com.azure.resourcemanager.subscription.models.CanceledSubscriptionId; +import com.azure.resourcemanager.subscription.models.EnabledSubscriptionId; +import com.azure.resourcemanager.subscription.models.RenamedSubscriptionId; +import com.azure.resourcemanager.subscription.models.SubscriptionName; import com.azure.resourcemanager.subscription.models.Subscriptions; public final class SubscriptionsImpl implements Subscriptions { @@ -29,43 +34,92 @@ public SubscriptionsImpl(SubscriptionsClient innerClient, this.serviceManager = serviceManager; } - public PagedIterable listLocations(String subscriptionId) { - PagedIterable inner = this.serviceClient().listLocations(subscriptionId); - return ResourceManagerUtils.mapPage(inner, inner1 -> new LocationImpl(inner1, this.manager())); + public Response cancelWithResponse(String subscriptionId, Context context) { + Response inner = this.serviceClient().cancelWithResponse(subscriptionId, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new CanceledSubscriptionIdImpl(inner.getValue(), this.manager())); + } else { + return null; + } } - public PagedIterable listLocations(String subscriptionId, Context context) { - PagedIterable inner = this.serviceClient().listLocations(subscriptionId, context); - return ResourceManagerUtils.mapPage(inner, inner1 -> new LocationImpl(inner1, this.manager())); + public CanceledSubscriptionId cancel(String subscriptionId) { + CanceledSubscriptionIdInner inner = this.serviceClient().cancel(subscriptionId); + if (inner != null) { + return new CanceledSubscriptionIdImpl(inner, this.manager()); + } else { + return null; + } } - public Response getWithResponse(String subscriptionId, Context context) { - Response inner = this.serviceClient().getWithResponse(subscriptionId, context); + public Response renameWithResponse(String subscriptionId, SubscriptionName body, + Context context) { + Response inner + = this.serviceClient().renameWithResponse(subscriptionId, body, context); if (inner != null) { return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new SubscriptionImpl(inner.getValue(), this.manager())); + new RenamedSubscriptionIdImpl(inner.getValue(), this.manager())); } else { return null; } } - public Subscription get(String subscriptionId) { - SubscriptionInner inner = this.serviceClient().get(subscriptionId); + public RenamedSubscriptionId rename(String subscriptionId, SubscriptionName body) { + RenamedSubscriptionIdInner inner = this.serviceClient().rename(subscriptionId, body); if (inner != null) { - return new SubscriptionImpl(inner, this.manager()); + return new RenamedSubscriptionIdImpl(inner, this.manager()); } else { return null; } } - public PagedIterable list() { - PagedIterable inner = this.serviceClient().list(); - return ResourceManagerUtils.mapPage(inner, inner1 -> new SubscriptionImpl(inner1, this.manager())); + public Response enableWithResponse(String subscriptionId, Context context) { + Response inner = this.serviceClient().enableWithResponse(subscriptionId, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new EnabledSubscriptionIdImpl(inner.getValue(), this.manager())); + } else { + return null; + } } - public PagedIterable list(Context context) { - PagedIterable inner = this.serviceClient().list(context); - return ResourceManagerUtils.mapPage(inner, inner1 -> new SubscriptionImpl(inner1, this.manager())); + public EnabledSubscriptionId enable(String subscriptionId) { + EnabledSubscriptionIdInner inner = this.serviceClient().enable(subscriptionId); + if (inner != null) { + return new EnabledSubscriptionIdImpl(inner, this.manager()); + } else { + return null; + } + } + + public void acceptOwnership(String subscriptionId, AcceptOwnershipRequest body) { + this.serviceClient().acceptOwnership(subscriptionId, body); + } + + public void acceptOwnership(String subscriptionId, AcceptOwnershipRequest body, Context context) { + this.serviceClient().acceptOwnership(subscriptionId, body, context); + } + + public Response acceptOwnershipStatusWithResponse(String subscriptionId, + Context context) { + Response inner + = this.serviceClient().acceptOwnershipStatusWithResponse(subscriptionId, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new AcceptOwnershipStatusResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public AcceptOwnershipStatusResponse acceptOwnershipStatus(String subscriptionId) { + AcceptOwnershipStatusResponseInner inner = this.serviceClient().acceptOwnershipStatus(subscriptionId); + if (inner != null) { + return new AcceptOwnershipStatusResponseImpl(inner, this.manager()); + } else { + return null; + } } private SubscriptionsClient serviceClient() { diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/TenantIdDescriptionImpl.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/TenantIdDescriptionImpl.java deleted file mode 100644 index 8b7421c1c7f7..000000000000 --- a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/TenantIdDescriptionImpl.java +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.subscription.implementation; - -import com.azure.resourcemanager.subscription.fluent.models.TenantIdDescriptionInner; -import com.azure.resourcemanager.subscription.models.TenantIdDescription; - -public final class TenantIdDescriptionImpl implements TenantIdDescription { - private TenantIdDescriptionInner innerObject; - - private final com.azure.resourcemanager.subscription.SubscriptionManager serviceManager; - - TenantIdDescriptionImpl(TenantIdDescriptionInner innerObject, - com.azure.resourcemanager.subscription.SubscriptionManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - } - - public String id() { - return this.innerModel().id(); - } - - public String tenantId() { - return this.innerModel().tenantId(); - } - - public String tenantCategory() { - return this.innerModel().tenantCategory(); - } - - public String country() { - return this.innerModel().country(); - } - - public String countryCode() { - return this.innerModel().countryCode(); - } - - public String displayName() { - return this.innerModel().displayName(); - } - - public String domains() { - return this.innerModel().domains(); - } - - public String defaultDomain() { - return this.innerModel().defaultDomain(); - } - - public String tenantType() { - return this.innerModel().tenantType(); - } - - public TenantIdDescriptionInner innerModel() { - return this.innerObject; - } - - private com.azure.resourcemanager.subscription.SubscriptionManager manager() { - return this.serviceManager; - } -} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/TenantsClientImpl.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/TenantsClientImpl.java deleted file mode 100644 index da1a73c14765..000000000000 --- a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/TenantsClientImpl.java +++ /dev/null @@ -1,226 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.subscription.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Headers; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.PathParam; -import com.azure.core.annotation.QueryParam; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.http.rest.PagedFlux; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.http.rest.PagedResponse; -import com.azure.core.http.rest.PagedResponseBase; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.management.exception.ManagementException; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.resourcemanager.subscription.fluent.TenantsClient; -import com.azure.resourcemanager.subscription.fluent.models.TenantIdDescriptionInner; -import com.azure.resourcemanager.subscription.models.TenantListResult; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in TenantsClient. - */ -public final class TenantsClientImpl implements TenantsClient { - /** - * The proxy service used to perform REST calls. - */ - private final TenantsService service; - - /** - * The service client containing this operation class. - */ - private final SubscriptionClientImpl client; - - /** - * Initializes an instance of TenantsClientImpl. - * - * @param client the instance of the service client containing this operation class. - */ - TenantsClientImpl(SubscriptionClientImpl client) { - this.service = RestProxy.create(TenantsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for SubscriptionClientTenants to be used by the proxy service to perform - * REST calls. - */ - @Host("{$host}") - @ServiceInterface(name = "SubscriptionClientTe") - public interface TenantsService { - @Headers({ "Content-Type: application/json" }) - @Get("/tenants") - @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); - } - - /** - * Gets the tenants for your account. - * - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the tenants for your account 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 apiVersion = "2016-06-01"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.list(this.client.getEndpoint(), apiVersion, 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())); - } - - /** - * Gets the tenants for your account. - * - * @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 tenants for your account 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 apiVersion = "2016-06-01"; - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.list(this.client.getEndpoint(), apiVersion, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); - } - - /** - * Gets the tenants for your account. - * - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the tenants for your account as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync() { - return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); - } - - /** - * Gets the tenants for your account. - * - * @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 tenants for your account as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(context), - nextLink -> listNextSinglePageAsync(nextLink, context)); - } - - /** - * Gets the tenants for your account. - * - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the tenants for your account as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list() { - return new PagedIterable<>(listAsync()); - } - - /** - * Gets the tenants for your account. - * - * @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 tenants for your account as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(Context context) { - return new PagedIterable<>(listAsync(context)); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws 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 Ids information along with {@link PagedResponse} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @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 Ids information 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/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/TenantsImpl.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/TenantsImpl.java deleted file mode 100644 index 3969d2e1cb94..000000000000 --- a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/implementation/TenantsImpl.java +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.subscription.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.subscription.fluent.TenantsClient; -import com.azure.resourcemanager.subscription.fluent.models.TenantIdDescriptionInner; -import com.azure.resourcemanager.subscription.models.TenantIdDescription; -import com.azure.resourcemanager.subscription.models.Tenants; - -public final class TenantsImpl implements Tenants { - private static final ClientLogger LOGGER = new ClientLogger(TenantsImpl.class); - - private final TenantsClient innerClient; - - private final com.azure.resourcemanager.subscription.SubscriptionManager serviceManager; - - public TenantsImpl(TenantsClient innerClient, - com.azure.resourcemanager.subscription.SubscriptionManager serviceManager) { - this.innerClient = innerClient; - this.serviceManager = serviceManager; - } - - public PagedIterable list() { - PagedIterable inner = this.serviceClient().list(); - return ResourceManagerUtils.mapPage(inner, inner1 -> new TenantIdDescriptionImpl(inner1, this.manager())); - } - - public PagedIterable list(Context context) { - PagedIterable inner = this.serviceClient().list(context); - return ResourceManagerUtils.mapPage(inner, inner1 -> new TenantIdDescriptionImpl(inner1, this.manager())); - } - - private TenantsClient serviceClient() { - return this.innerClient; - } - - private com.azure.resourcemanager.subscription.SubscriptionManager manager() { - return this.serviceManager; - } -} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/AcceptOwnership.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/AcceptOwnership.java new file mode 100644 index 000000000000..5d4dc30933e1 --- /dev/null +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/AcceptOwnership.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.subscription.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The accept ownership state of the resource. + */ +public final class AcceptOwnership extends ExpandableStringEnum { + /** + * Static value Pending for AcceptOwnership. + */ + public static final AcceptOwnership PENDING = fromString("Pending"); + + /** + * Static value Completed for AcceptOwnership. + */ + public static final AcceptOwnership COMPLETED = fromString("Completed"); + + /** + * Static value Expired for AcceptOwnership. + */ + public static final AcceptOwnership EXPIRED = fromString("Expired"); + + /** + * Creates a new instance of AcceptOwnership value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AcceptOwnership() { + } + + /** + * Creates or finds a AcceptOwnership from its string representation. + * + * @param name a name to look for. + * @return the corresponding AcceptOwnership. + */ + public static AcceptOwnership fromString(String name) { + return fromString(name, AcceptOwnership.class); + } + + /** + * Gets known AcceptOwnership values. + * + * @return known AcceptOwnership values. + */ + public static Collection values() { + return values(AcceptOwnership.class); + } +} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/AcceptOwnershipRequest.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/AcceptOwnershipRequest.java new file mode 100644 index 000000000000..7e4028eb97b8 --- /dev/null +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/AcceptOwnershipRequest.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.subscription.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The parameters required to accept subscription ownership. + */ +@Fluent +public final class AcceptOwnershipRequest implements JsonSerializable { + /* + * Accept subscription ownership request properties. + */ + private AcceptOwnershipRequestProperties properties; + + /** + * Creates an instance of AcceptOwnershipRequest class. + */ + public AcceptOwnershipRequest() { + } + + /** + * Get the properties property: Accept subscription ownership request properties. + * + * @return the properties value. + */ + public AcceptOwnershipRequestProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Accept subscription ownership request properties. + * + * @param properties the properties value to set. + * @return the AcceptOwnershipRequest object itself. + */ + public AcceptOwnershipRequest withProperties(AcceptOwnershipRequestProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AcceptOwnershipRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AcceptOwnershipRequest if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the AcceptOwnershipRequest. + */ + public static AcceptOwnershipRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AcceptOwnershipRequest deserializedAcceptOwnershipRequest = new AcceptOwnershipRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedAcceptOwnershipRequest.properties = AcceptOwnershipRequestProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAcceptOwnershipRequest; + }); + } +} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/AcceptOwnershipRequestProperties.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/AcceptOwnershipRequestProperties.java new file mode 100644 index 000000000000..7eb267fcf5b1 --- /dev/null +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/AcceptOwnershipRequestProperties.java @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.subscription.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * Accept subscription ownership request properties. + */ +@Fluent +public final class AcceptOwnershipRequestProperties implements JsonSerializable { + /* + * The friendly name of the subscription. + */ + private String displayName; + + /* + * Management group Id for the subscription. + */ + private String managementGroupId; + + /* + * Tags for the subscription + */ + private Map tags; + + /** + * Creates an instance of AcceptOwnershipRequestProperties class. + */ + public AcceptOwnershipRequestProperties() { + } + + /** + * 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 AcceptOwnershipRequestProperties object itself. + */ + public AcceptOwnershipRequestProperties withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the managementGroupId property: Management group Id for the subscription. + * + * @return the managementGroupId value. + */ + public String managementGroupId() { + return this.managementGroupId; + } + + /** + * Set the managementGroupId property: Management group Id for the subscription. + * + * @param managementGroupId the managementGroupId value to set. + * @return the AcceptOwnershipRequestProperties object itself. + */ + public AcceptOwnershipRequestProperties withManagementGroupId(String managementGroupId) { + this.managementGroupId = managementGroupId; + return this; + } + + /** + * Get the tags property: Tags for the subscription. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Tags for the subscription. + * + * @param tags the tags value to set. + * @return the AcceptOwnershipRequestProperties object itself. + */ + public AcceptOwnershipRequestProperties withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (displayName() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property displayName in model AcceptOwnershipRequestProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AcceptOwnershipRequestProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("displayName", this.displayName); + jsonWriter.writeStringField("managementGroupId", this.managementGroupId); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AcceptOwnershipRequestProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AcceptOwnershipRequestProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AcceptOwnershipRequestProperties. + */ + public static AcceptOwnershipRequestProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AcceptOwnershipRequestProperties deserializedAcceptOwnershipRequestProperties + = new AcceptOwnershipRequestProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("displayName".equals(fieldName)) { + deserializedAcceptOwnershipRequestProperties.displayName = reader.getString(); + } else if ("managementGroupId".equals(fieldName)) { + deserializedAcceptOwnershipRequestProperties.managementGroupId = reader.getString(); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedAcceptOwnershipRequestProperties.tags = tags; + } else { + reader.skipChildren(); + } + } + + return deserializedAcceptOwnershipRequestProperties; + }); + } +} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/AcceptOwnershipStatusResponse.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/AcceptOwnershipStatusResponse.java new file mode 100644 index 000000000000..7b8aa9232a7b --- /dev/null +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/AcceptOwnershipStatusResponse.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.subscription.models; + +import com.azure.resourcemanager.subscription.fluent.models.AcceptOwnershipStatusResponseInner; +import java.util.Map; + +/** + * An immutable client-side representation of AcceptOwnershipStatusResponse. + */ +public interface AcceptOwnershipStatusResponse { + /** + * Gets the subscriptionId property: Newly created subscription Id. + * + * @return the subscriptionId value. + */ + String subscriptionId(); + + /** + * Gets the acceptOwnershipState property: The accept ownership state of the resource. + * + * @return the acceptOwnershipState value. + */ + AcceptOwnership acceptOwnershipState(); + + /** + * Gets the provisioningState property: The provisioning state of the resource. + * + * @return the provisioningState value. + */ + Provisioning provisioningState(); + + /** + * Gets the billingOwner property: UPN of the billing owner. + * + * @return the billingOwner value. + */ + String billingOwner(); + + /** + * Gets the subscriptionTenantId property: Tenant Id of the subscription. + * + * @return the subscriptionTenantId value. + */ + String subscriptionTenantId(); + + /** + * Gets the displayName property: The display name of the subscription. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the tags property: Tags for the subscription. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the inner com.azure.resourcemanager.subscription.fluent.models.AcceptOwnershipStatusResponseInner object. + * + * @return the inner object. + */ + AcceptOwnershipStatusResponseInner innerModel(); +} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/Alias.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/Alias.java index 9766302f26c9..a33eb2a5bdfa 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/Alias.java +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/Alias.java @@ -14,21 +14,21 @@ public interface Alias { /** * Create Alias Subscription. * - * @param aliasName Name for this subscription creation request also known as alias. Note that this is not the same - * as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. + * @param aliasName AliasName is the name for the subscription creation request. Note that this is not the same as + * subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. * @param body The body 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 subscription Information with the alias. */ - PutAliasResponse create(String aliasName, PutAliasRequest body); + SubscriptionAliasResponse create(String aliasName, PutAliasRequest body); /** * Create Alias Subscription. * - * @param aliasName Name for this subscription creation request also known as alias. Note that this is not the same - * as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. + * @param aliasName AliasName is the name for the subscription creation request. Note that this is not the same as + * subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. * @param body The body parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -36,38 +36,38 @@ public interface Alias { * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return subscription Information with the alias. */ - PutAliasResponse create(String aliasName, PutAliasRequest body, Context context); + SubscriptionAliasResponse create(String aliasName, PutAliasRequest body, Context context); /** * Get Alias Subscription. * - * @param aliasName Name for this subscription creation request also known as alias. Note that this is not the same - * as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. + * @param aliasName AliasName is the name for the subscription creation request. Note that this is not the same as + * subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. * @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 alias Subscription along with {@link Response}. */ - Response getWithResponse(String aliasName, Context context); + Response getWithResponse(String aliasName, Context context); /** * Get Alias Subscription. * - * @param aliasName Name for this subscription creation request also known as alias. Note that this is not the same - * as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. + * @param aliasName AliasName is the name for the subscription creation request. Note that this is not the same as + * subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. * @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 alias Subscription. */ - PutAliasResponse get(String aliasName); + SubscriptionAliasResponse get(String aliasName); /** * Delete Alias. * - * @param aliasName Name for this subscription creation request also known as alias. Note that this is not the same - * as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. + * @param aliasName AliasName is the name for the subscription creation request. Note that this is not the same as + * subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. * @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. @@ -79,8 +79,8 @@ public interface Alias { /** * Delete Alias. * - * @param aliasName Name for this subscription creation request also known as alias. Note that this is not the same - * as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. + * @param aliasName AliasName is the name for the subscription creation request. Note that this is not the same as + * subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. * @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. @@ -88,22 +88,22 @@ public interface Alias { void delete(String aliasName); /** - * Get Alias Subscription. + * List Alias Subscription. * * @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 alias Subscription along with {@link Response}. + * @return the list of aliases along with {@link Response}. */ - Response listWithResponse(Context context); + Response listWithResponse(Context context); /** - * Get Alias Subscription. + * List Alias Subscription. * * @throws com.azure.core.management.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 alias Subscription. + * @return the list of aliases. */ - PutAliasListResult list(); + SubscriptionAliasListResult list(); } diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/BillingAccountPoliciesResponse.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/BillingAccountPoliciesResponse.java new file mode 100644 index 000000000000..4a3b7f8afc30 --- /dev/null +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/BillingAccountPoliciesResponse.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.subscription.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.subscription.fluent.models.BillingAccountPoliciesResponseInner; + +/** + * An immutable client-side representation of BillingAccountPoliciesResponse. + */ +public interface BillingAccountPoliciesResponse { + /** + * 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 properties property: Billing account policies response properties. + * + * @return the properties value. + */ + BillingAccountPoliciesResponseProperties properties(); + + /** + * Gets the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner com.azure.resourcemanager.subscription.fluent.models.BillingAccountPoliciesResponseInner object. + * + * @return the inner object. + */ + BillingAccountPoliciesResponseInner innerModel(); +} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/BillingAccountPoliciesResponseProperties.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/BillingAccountPoliciesResponseProperties.java new file mode 100644 index 000000000000..1403e0d287c5 --- /dev/null +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/BillingAccountPoliciesResponseProperties.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.subscription.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Put billing account policies response properties. + */ +@Fluent +public final class BillingAccountPoliciesResponseProperties + implements JsonSerializable { + /* + * Service tenant for the billing account. + */ + private List serviceTenants; + + /* + * Determine if the transfers are allowed for the billing account + */ + private Boolean allowTransfers; + + /** + * Creates an instance of BillingAccountPoliciesResponseProperties class. + */ + public BillingAccountPoliciesResponseProperties() { + } + + /** + * Get the serviceTenants property: Service tenant for the billing account. + * + * @return the serviceTenants value. + */ + public List serviceTenants() { + return this.serviceTenants; + } + + /** + * Set the serviceTenants property: Service tenant for the billing account. + * + * @param serviceTenants the serviceTenants value to set. + * @return the BillingAccountPoliciesResponseProperties object itself. + */ + public BillingAccountPoliciesResponseProperties withServiceTenants(List serviceTenants) { + this.serviceTenants = serviceTenants; + return this; + } + + /** + * Get the allowTransfers property: Determine if the transfers are allowed for the billing account. + * + * @return the allowTransfers value. + */ + public Boolean allowTransfers() { + return this.allowTransfers; + } + + /** + * Set the allowTransfers property: Determine if the transfers are allowed for the billing account. + * + * @param allowTransfers the allowTransfers value to set. + * @return the BillingAccountPoliciesResponseProperties object itself. + */ + public BillingAccountPoliciesResponseProperties withAllowTransfers(Boolean allowTransfers) { + this.allowTransfers = allowTransfers; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (serviceTenants() != null) { + serviceTenants().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("serviceTenants", this.serviceTenants, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeBooleanField("allowTransfers", this.allowTransfers); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BillingAccountPoliciesResponseProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BillingAccountPoliciesResponseProperties if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the BillingAccountPoliciesResponseProperties. + */ + public static BillingAccountPoliciesResponseProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BillingAccountPoliciesResponseProperties deserializedBillingAccountPoliciesResponseProperties + = new BillingAccountPoliciesResponseProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("serviceTenants".equals(fieldName)) { + List serviceTenants + = reader.readArray(reader1 -> ServiceTenantResponse.fromJson(reader1)); + deserializedBillingAccountPoliciesResponseProperties.serviceTenants = serviceTenants; + } else if ("allowTransfers".equals(fieldName)) { + deserializedBillingAccountPoliciesResponseProperties.allowTransfers + = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedBillingAccountPoliciesResponseProperties; + }); + } +} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/Tenants.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/BillingAccounts.java similarity index 57% rename from sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/Tenants.java rename to sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/BillingAccounts.java index ab8f9c0f8cf4..fa1fa399b04c 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/Tenants.java +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/BillingAccounts.java @@ -4,30 +4,33 @@ package com.azure.resourcemanager.subscription.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 Tenants. + * Resource collection API of BillingAccounts. */ -public interface Tenants { +public interface BillingAccounts { /** - * Gets the tenants for your account. + * Get Billing Account Policy. * + * @param billingAccountId Billing Account 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 tenants for your account as paginated response with {@link PagedIterable}. + * @return billing Account Policy along with {@link Response}. */ - PagedIterable list(); + Response getPolicyWithResponse(String billingAccountId, Context context); /** - * Gets the tenants for your account. + * Get Billing Account Policy. * - * @param context The context to associate with this operation. + * @param billingAccountId Billing Account 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 tenants for your account as paginated response with {@link PagedIterable}. + * @return billing Account Policy. */ - PagedIterable list(Context context); + BillingAccountPoliciesResponse getPolicy(String billingAccountId); } diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/GetTenantPolicyListResponse.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/GetTenantPolicyListResponse.java new file mode 100644 index 000000000000..50b18a008bc0 --- /dev/null +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/GetTenantPolicyListResponse.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.subscription.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.subscription.fluent.models.GetTenantPolicyResponseInner; +import java.io.IOException; +import java.util.List; + +/** + * Tenant policy information list. + */ +@Immutable +public final class GetTenantPolicyListResponse implements JsonSerializable { + /* + * The list of tenant policies. + */ + private List value; + + /* + * The link (url) to the next page of results. + */ + private String nextLink; + + /** + * Creates an instance of GetTenantPolicyListResponse class. + */ + public GetTenantPolicyListResponse() { + } + + /** + * Get the value property: The list of tenant policies. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link (url) to the next page 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GetTenantPolicyListResponse from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GetTenantPolicyListResponse if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the GetTenantPolicyListResponse. + */ + public static GetTenantPolicyListResponse fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GetTenantPolicyListResponse deserializedGetTenantPolicyListResponse = new GetTenantPolicyListResponse(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> GetTenantPolicyResponseInner.fromJson(reader1)); + deserializedGetTenantPolicyListResponse.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedGetTenantPolicyListResponse.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedGetTenantPolicyListResponse; + }); + } +} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/PutAliasResponse.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/GetTenantPolicyResponse.java similarity index 56% rename from sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/PutAliasResponse.java rename to sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/GetTenantPolicyResponse.java index 8185746513f5..b20b5f40b05f 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/PutAliasResponse.java +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/GetTenantPolicyResponse.java @@ -4,12 +4,13 @@ package com.azure.resourcemanager.subscription.models; -import com.azure.resourcemanager.subscription.fluent.models.PutAliasResponseInner; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.subscription.fluent.models.GetTenantPolicyResponseInner; /** - * An immutable client-side representation of PutAliasResponse. + * An immutable client-side representation of GetTenantPolicyResponse. */ -public interface PutAliasResponse { +public interface GetTenantPolicyResponse { /** * Gets the id property: Fully qualified resource Id for the resource. * @@ -32,16 +33,23 @@ public interface PutAliasResponse { String type(); /** - * Gets the properties property: Put Alias response properties. + * Gets the properties property: Tenant policy properties. * * @return the properties value. */ - PutAliasResponseProperties properties(); + TenantPolicy properties(); /** - * Gets the inner com.azure.resourcemanager.subscription.fluent.models.PutAliasResponseInner object. + * Gets the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner com.azure.resourcemanager.subscription.fluent.models.GetTenantPolicyResponseInner object. * * @return the inner object. */ - PutAliasResponseInner innerModel(); + GetTenantPolicyResponseInner innerModel(); } diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/Location.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/Location.java deleted file mode 100644 index e66e7e2062c5..000000000000 --- a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/Location.java +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.subscription.models; - -import com.azure.resourcemanager.subscription.fluent.models.LocationInner; - -/** - * An immutable client-side representation of Location. - */ -public interface Location { - /** - * Gets the id property: The fully qualified ID of the location. For example, - * /subscriptions/00000000-0000-0000-0000-000000000000/locations/westus. - * - * @return the id value. - */ - String id(); - - /** - * Gets the subscriptionId property: The subscription ID. - * - * @return the subscriptionId value. - */ - String subscriptionId(); - - /** - * Gets the name property: The location name. - * - * @return the name value. - */ - String name(); - - /** - * Gets the displayName property: The display name of the location. - * - * @return the displayName value. - */ - String displayName(); - - /** - * Gets the latitude property: The latitude of the location. - * - * @return the latitude value. - */ - String latitude(); - - /** - * Gets the longitude property: The longitude of the location. - * - * @return the longitude value. - */ - String longitude(); - - /** - * Gets the inner com.azure.resourcemanager.subscription.fluent.models.LocationInner object. - * - * @return the inner object. - */ - LocationInner innerModel(); -} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/LocationListResult.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/LocationListResult.java deleted file mode 100644 index e63064951fa7..000000000000 --- a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/LocationListResult.java +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.subscription.models; - -import com.azure.core.annotation.Fluent; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import com.azure.resourcemanager.subscription.fluent.models.LocationInner; -import java.io.IOException; -import java.util.List; - -/** - * Location list operation response. - */ -@Fluent -public final class LocationListResult implements JsonSerializable { - /* - * An array of locations. - */ - private List value; - - /** - * Creates an instance of LocationListResult class. - */ - public LocationListResult() { - } - - /** - * Get the value property: An array of locations. - * - * @return the value value. - */ - public List value() { - return this.value; - } - - /** - * Set the value property: An array of locations. - * - * @param value the value value to set. - * @return the LocationListResult object itself. - */ - public LocationListResult withValue(List value) { - this.value = value; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (value() != null) { - value().forEach(e -> e.validate()); - } - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of LocationListResult from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of LocationListResult if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IOException If an error occurs while reading the LocationListResult. - */ - public static LocationListResult fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - LocationListResult deserializedLocationListResult = new LocationListResult(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("value".equals(fieldName)) { - List value = reader.readArray(reader1 -> LocationInner.fromJson(reader1)); - deserializedLocationListResult.value = value; - } else { - reader.skipChildren(); - } - } - - return deserializedLocationListResult; - }); - } -} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/Operation.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/Operation.java index 223a62b4955f..b8d4367a21b6 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/Operation.java +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/Operation.java @@ -4,121 +4,37 @@ package com.azure.resourcemanager.subscription.models; -import com.azure.core.annotation.Fluent; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; +import com.azure.resourcemanager.subscription.fluent.models.OperationInner; /** - * REST API operation. + * An immutable client-side representation of Operation. */ -@Fluent -public final class Operation implements JsonSerializable { - /* - * Operation name: {provider}/{resource}/{operation} - */ - private String name; - - /* - * The object that represents the operation. - */ - private OperationDisplay display; - - /** - * Creates an instance of Operation class. - */ - public Operation() { - } - +public interface Operation { /** - * Get the name property: Operation name: {provider}/{resource}/{operation}. + * Gets the name property: Operation name: {provider}/{resource}/{operation}. * * @return the name value. */ - public String name() { - return this.name; - } + String name(); /** - * Set the name property: Operation name: {provider}/{resource}/{operation}. + * Gets the isDataAction property: Indicates whether the operation is a data action. * - * @param name the name value to set. - * @return the Operation object itself. + * @return the isDataAction value. */ - public Operation withName(String name) { - this.name = name; - return this; - } + Boolean isDataAction(); /** - * Get the display property: The object that represents the operation. + * Gets the display property: The object that represents the operation. * * @return the display value. */ - public OperationDisplay display() { - return this.display; - } - - /** - * Set the display property: The object that represents the operation. - * - * @param display the display value to set. - * @return the Operation object itself. - */ - public Operation withDisplay(OperationDisplay 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(); - } - } + OperationDisplay display(); /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - jsonWriter.writeJsonField("display", this.display); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Operation from the JsonReader. + * Gets the inner com.azure.resourcemanager.subscription.fluent.models.OperationInner object. * - * @param jsonReader The JsonReader being read. - * @return An instance of Operation if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IOException If an error occurs while reading the Operation. + * @return the inner object. */ - public static Operation fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - Operation deserializedOperation = new Operation(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - deserializedOperation.name = reader.getString(); - } else if ("display".equals(fieldName)) { - deserializedOperation.display = OperationDisplay.fromJson(reader); - } else { - reader.skipChildren(); - } - } - - return deserializedOperation; - }); - } + OperationInner innerModel(); } diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/OperationDisplay.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/OperationDisplay.java index 2447e8aedc86..063ccdd6cc78 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/OperationDisplay.java +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/OperationDisplay.java @@ -31,6 +31,11 @@ public final class OperationDisplay implements JsonSerializable { + /* + * List of operations. + */ + private List value; + + /* + * URL to get the next set of operation list results if there are any. + */ + private String nextLink; + + /** + * Creates an instance of OperationListResult class. + */ + public OperationListResult() { + } + /** - * Gets the value property: List of operations. + * Get the value property: List of operations. * * @return the value value. */ - List value(); + public List value() { + return this.value; + } + + /** + * Set the value property: List of operations. + * + * @param value the value value to set. + * @return the OperationListResult object itself. + */ + public OperationListResult withValue(List value) { + this.value = value; + return this; + } /** - * Gets the nextLink property: URL to get the next set of operation list results if there are any. + * Get the nextLink property: URL to get the next set of operation list results if there are any. * * @return the nextLink value. */ - String nextLink(); + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: URL to get the next set of operation list results if there are any. + * + * @param nextLink the nextLink value to set. + * @return the OperationListResult object itself. + */ + public OperationListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } /** - * Gets the inner com.azure.resourcemanager.subscription.fluent.models.OperationListResultInner object. + * Reads an instance of OperationListResult from the JsonReader. * - * @return the inner object. + * @param jsonReader The JsonReader being read. + * @return An instance of OperationListResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationListResult. */ - OperationListResultInner innerModel(); + public static OperationListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationListResult deserializedOperationListResult = new OperationListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> OperationInner.fromJson(reader1)); + deserializedOperationListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedOperationListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationListResult; + }); + } } diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/Operations.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/Operations.java index 53fc8bdb085e..f8ff69f92ef4 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/Operations.java +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/Operations.java @@ -4,7 +4,7 @@ package com.azure.resourcemanager.subscription.models; -import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.PagedIterable; import com.azure.core.util.Context; /** @@ -14,20 +14,20 @@ public interface Operations { /** * Lists all of the available Microsoft.Subscription 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 result of the request to list operations along with {@link Response}. + * @return result of the request to list operations as paginated response with {@link PagedIterable}. */ - Response listWithResponse(Context context); + PagedIterable list(); /** * Lists all of the available Microsoft.Subscription 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 result of the request to list operations. + * @return result of the request to list operations as paginated response with {@link PagedIterable}. */ - OperationListResult list(); + PagedIterable list(Context context); } diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/Provisioning.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/Provisioning.java new file mode 100644 index 000000000000..5b5cfd378de5 --- /dev/null +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/Provisioning.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.subscription.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The provisioning state of the resource. + */ +public final class Provisioning extends ExpandableStringEnum { + /** + * Static value Pending for Provisioning. + */ + public static final Provisioning PENDING = fromString("Pending"); + + /** + * Static value Accepted for Provisioning. + */ + public static final Provisioning ACCEPTED = fromString("Accepted"); + + /** + * Static value Succeeded for Provisioning. + */ + public static final Provisioning SUCCEEDED = fromString("Succeeded"); + + /** + * Creates a new instance of Provisioning value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Provisioning() { + } + + /** + * Creates or finds a Provisioning from its string representation. + * + * @param name a name to look for. + * @return the corresponding Provisioning. + */ + public static Provisioning fromString(String name) { + return fromString(name, Provisioning.class); + } + + /** + * Gets known Provisioning values. + * + * @return known Provisioning values. + */ + public static Collection values() { + return values(Provisioning.class); + } +} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/PutAliasRequest.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/PutAliasRequest.java index 6eee633eec6c..21df61a86989 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/PutAliasRequest.java +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/PutAliasRequest.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.subscription.models; import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -54,16 +53,11 @@ public PutAliasRequest withProperties(PutAliasRequestProperties properties) { * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { - if (properties() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException("Missing required property properties in model PutAliasRequest")); - } else { + if (properties() != null) { properties().validate(); } } - private static final ClientLogger LOGGER = new ClientLogger(PutAliasRequest.class); - /** * {@inheritDoc} */ @@ -80,7 +74,6 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { * @param jsonReader The JsonReader being read. * @return An instance of PutAliasRequest if the JsonReader was pointing to an instance of it, or null if it was * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. * @throws IOException If an error occurs while reading the PutAliasRequest. */ public static PutAliasRequest fromJson(JsonReader jsonReader) throws IOException { diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/PutAliasRequestAdditionalProperties.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/PutAliasRequestAdditionalProperties.java new file mode 100644 index 000000000000..9d035ad0c188 --- /dev/null +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/PutAliasRequestAdditionalProperties.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.subscription.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * Put subscription additional properties. + */ +@Fluent +public final class PutAliasRequestAdditionalProperties + implements JsonSerializable { + /* + * Management group Id for the subscription. + */ + private String managementGroupId; + + /* + * Tenant Id of the subscription + */ + private String subscriptionTenantId; + + /* + * Owner Id of the subscription + */ + private String subscriptionOwnerId; + + /* + * Tags for the subscription + */ + private Map tags; + + /** + * Creates an instance of PutAliasRequestAdditionalProperties class. + */ + public PutAliasRequestAdditionalProperties() { + } + + /** + * Get the managementGroupId property: Management group Id for the subscription. + * + * @return the managementGroupId value. + */ + public String managementGroupId() { + return this.managementGroupId; + } + + /** + * Set the managementGroupId property: Management group Id for the subscription. + * + * @param managementGroupId the managementGroupId value to set. + * @return the PutAliasRequestAdditionalProperties object itself. + */ + public PutAliasRequestAdditionalProperties withManagementGroupId(String managementGroupId) { + this.managementGroupId = managementGroupId; + return this; + } + + /** + * Get the subscriptionTenantId property: Tenant Id of the subscription. + * + * @return the subscriptionTenantId value. + */ + public String subscriptionTenantId() { + return this.subscriptionTenantId; + } + + /** + * Set the subscriptionTenantId property: Tenant Id of the subscription. + * + * @param subscriptionTenantId the subscriptionTenantId value to set. + * @return the PutAliasRequestAdditionalProperties object itself. + */ + public PutAliasRequestAdditionalProperties withSubscriptionTenantId(String subscriptionTenantId) { + this.subscriptionTenantId = subscriptionTenantId; + return this; + } + + /** + * Get the subscriptionOwnerId property: Owner Id of the subscription. + * + * @return the subscriptionOwnerId value. + */ + public String subscriptionOwnerId() { + return this.subscriptionOwnerId; + } + + /** + * Set the subscriptionOwnerId property: Owner Id of the subscription. + * + * @param subscriptionOwnerId the subscriptionOwnerId value to set. + * @return the PutAliasRequestAdditionalProperties object itself. + */ + public PutAliasRequestAdditionalProperties withSubscriptionOwnerId(String subscriptionOwnerId) { + this.subscriptionOwnerId = subscriptionOwnerId; + return this; + } + + /** + * Get the tags property: Tags for the subscription. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Tags for the subscription. + * + * @param tags the tags value to set. + * @return the PutAliasRequestAdditionalProperties object itself. + */ + public PutAliasRequestAdditionalProperties withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("managementGroupId", this.managementGroupId); + jsonWriter.writeStringField("subscriptionTenantId", this.subscriptionTenantId); + jsonWriter.writeStringField("subscriptionOwnerId", this.subscriptionOwnerId); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PutAliasRequestAdditionalProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PutAliasRequestAdditionalProperties if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the PutAliasRequestAdditionalProperties. + */ + public static PutAliasRequestAdditionalProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PutAliasRequestAdditionalProperties deserializedPutAliasRequestAdditionalProperties + = new PutAliasRequestAdditionalProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("managementGroupId".equals(fieldName)) { + deserializedPutAliasRequestAdditionalProperties.managementGroupId = reader.getString(); + } else if ("subscriptionTenantId".equals(fieldName)) { + deserializedPutAliasRequestAdditionalProperties.subscriptionTenantId = reader.getString(); + } else if ("subscriptionOwnerId".equals(fieldName)) { + deserializedPutAliasRequestAdditionalProperties.subscriptionOwnerId = reader.getString(); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedPutAliasRequestAdditionalProperties.tags = tags; + } else { + reader.skipChildren(); + } + } + + return deserializedPutAliasRequestAdditionalProperties; + }); + } +} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/PutAliasRequestProperties.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/PutAliasRequestProperties.java index efa30e68c2b0..195f8ca7edc1 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/PutAliasRequestProperties.java +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/PutAliasRequestProperties.java @@ -27,7 +27,11 @@ public final class PutAliasRequestProperties implements JsonSerializable { - /* - * Newly created subscription Id. - */ - private String subscriptionId; - - /* - * The provisioning state of the resource. - */ - private ProvisioningState provisioningState; - - /** - * Creates an instance of PutAliasResponseProperties class. - */ - public PutAliasResponseProperties() { - } - - /** - * Get the subscriptionId property: Newly created subscription Id. - * - * @return the subscriptionId value. - */ - public String subscriptionId() { - return this.subscriptionId; - } - - /** - * Get the provisioningState property: The provisioning state of the resource. - * - * @return the provisioningState value. - */ - public ProvisioningState provisioningState() { - return this.provisioningState; - } - - /** - * Set the provisioningState property: The provisioning state of the resource. - * - * @param provisioningState the provisioningState value to set. - * @return the PutAliasResponseProperties object itself. - */ - public PutAliasResponseProperties withProvisioningState(ProvisioningState provisioningState) { - this.provisioningState = provisioningState; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("provisioningState", - this.provisioningState == null ? null : this.provisioningState.toString()); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of PutAliasResponseProperties from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of PutAliasResponseProperties if the JsonReader was pointing to an instance of it, or null if - * it was pointing to JSON null. - * @throws IOException If an error occurs while reading the PutAliasResponseProperties. - */ - public static PutAliasResponseProperties fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - PutAliasResponseProperties deserializedPutAliasResponseProperties = new PutAliasResponseProperties(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("subscriptionId".equals(fieldName)) { - deserializedPutAliasResponseProperties.subscriptionId = reader.getString(); - } else if ("provisioningState".equals(fieldName)) { - deserializedPutAliasResponseProperties.provisioningState - = ProvisioningState.fromString(reader.getString()); - } else { - reader.skipChildren(); - } - } - - return deserializedPutAliasResponseProperties; - }); - } -} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/PutTenantPolicyRequestProperties.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/PutTenantPolicyRequestProperties.java new file mode 100644 index 000000000000..b3cf29353807 --- /dev/null +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/PutTenantPolicyRequestProperties.java @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.subscription.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; +import java.util.Objects; +import java.util.UUID; + +/** + * Put tenant policy request properties. + */ +@Fluent +public final class PutTenantPolicyRequestProperties implements JsonSerializable { + /* + * Blocks the leaving of subscriptions from user's tenant. + */ + private Boolean blockSubscriptionsLeavingTenant; + + /* + * Blocks the entering of subscriptions into user's tenant. + */ + private Boolean blockSubscriptionsIntoTenant; + + /* + * List of user objectIds that are exempted from the set subscription tenant policies for the user's tenant. + */ + private List exemptedPrincipals; + + /** + * Creates an instance of PutTenantPolicyRequestProperties class. + */ + public PutTenantPolicyRequestProperties() { + } + + /** + * Get the blockSubscriptionsLeavingTenant property: Blocks the leaving of subscriptions from user's tenant. + * + * @return the blockSubscriptionsLeavingTenant value. + */ + public Boolean blockSubscriptionsLeavingTenant() { + return this.blockSubscriptionsLeavingTenant; + } + + /** + * Set the blockSubscriptionsLeavingTenant property: Blocks the leaving of subscriptions from user's tenant. + * + * @param blockSubscriptionsLeavingTenant the blockSubscriptionsLeavingTenant value to set. + * @return the PutTenantPolicyRequestProperties object itself. + */ + public PutTenantPolicyRequestProperties + withBlockSubscriptionsLeavingTenant(Boolean blockSubscriptionsLeavingTenant) { + this.blockSubscriptionsLeavingTenant = blockSubscriptionsLeavingTenant; + return this; + } + + /** + * Get the blockSubscriptionsIntoTenant property: Blocks the entering of subscriptions into user's tenant. + * + * @return the blockSubscriptionsIntoTenant value. + */ + public Boolean blockSubscriptionsIntoTenant() { + return this.blockSubscriptionsIntoTenant; + } + + /** + * Set the blockSubscriptionsIntoTenant property: Blocks the entering of subscriptions into user's tenant. + * + * @param blockSubscriptionsIntoTenant the blockSubscriptionsIntoTenant value to set. + * @return the PutTenantPolicyRequestProperties object itself. + */ + public PutTenantPolicyRequestProperties withBlockSubscriptionsIntoTenant(Boolean blockSubscriptionsIntoTenant) { + this.blockSubscriptionsIntoTenant = blockSubscriptionsIntoTenant; + return this; + } + + /** + * Get the exemptedPrincipals property: List of user objectIds that are exempted from the set subscription tenant + * policies for the user's tenant. + * + * @return the exemptedPrincipals value. + */ + public List exemptedPrincipals() { + return this.exemptedPrincipals; + } + + /** + * Set the exemptedPrincipals property: List of user objectIds that are exempted from the set subscription tenant + * policies for the user's tenant. + * + * @param exemptedPrincipals the exemptedPrincipals value to set. + * @return the PutTenantPolicyRequestProperties object itself. + */ + public PutTenantPolicyRequestProperties withExemptedPrincipals(List exemptedPrincipals) { + this.exemptedPrincipals = exemptedPrincipals; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("blockSubscriptionsLeavingTenant", this.blockSubscriptionsLeavingTenant); + jsonWriter.writeBooleanField("blockSubscriptionsIntoTenant", this.blockSubscriptionsIntoTenant); + jsonWriter.writeArrayField("exemptedPrincipals", this.exemptedPrincipals, + (writer, element) -> writer.writeString(Objects.toString(element, null))); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PutTenantPolicyRequestProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PutTenantPolicyRequestProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the PutTenantPolicyRequestProperties. + */ + public static PutTenantPolicyRequestProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PutTenantPolicyRequestProperties deserializedPutTenantPolicyRequestProperties + = new PutTenantPolicyRequestProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("blockSubscriptionsLeavingTenant".equals(fieldName)) { + deserializedPutTenantPolicyRequestProperties.blockSubscriptionsLeavingTenant + = reader.getNullable(JsonReader::getBoolean); + } else if ("blockSubscriptionsIntoTenant".equals(fieldName)) { + deserializedPutTenantPolicyRequestProperties.blockSubscriptionsIntoTenant + = reader.getNullable(JsonReader::getBoolean); + } else if ("exemptedPrincipals".equals(fieldName)) { + List exemptedPrincipals = reader.readArray( + reader1 -> reader1.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString()))); + deserializedPutTenantPolicyRequestProperties.exemptedPrincipals = exemptedPrincipals; + } else { + reader.skipChildren(); + } + } + + return deserializedPutTenantPolicyRequestProperties; + }); + } +} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/ServiceTenantResponse.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/ServiceTenantResponse.java new file mode 100644 index 000000000000..9fb123969f1e --- /dev/null +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/ServiceTenantResponse.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.subscription.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Billing account service tenant. + */ +@Fluent +public final class ServiceTenantResponse implements JsonSerializable { + /* + * Service tenant id. + */ + private String tenantId; + + /* + * Service tenant name. + */ + private String tenantName; + + /** + * Creates an instance of ServiceTenantResponse class. + */ + public ServiceTenantResponse() { + } + + /** + * Get the tenantId property: Service tenant id. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Set the tenantId property: Service tenant id. + * + * @param tenantId the tenantId value to set. + * @return the ServiceTenantResponse object itself. + */ + public ServiceTenantResponse withTenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Get the tenantName property: Service tenant name. + * + * @return the tenantName value. + */ + public String tenantName() { + return this.tenantName; + } + + /** + * Set the tenantName property: Service tenant name. + * + * @param tenantName the tenantName value to set. + * @return the ServiceTenantResponse object itself. + */ + public ServiceTenantResponse withTenantName(String tenantName) { + this.tenantName = tenantName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("tenantId", this.tenantId); + jsonWriter.writeStringField("tenantName", this.tenantName); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ServiceTenantResponse from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ServiceTenantResponse if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the ServiceTenantResponse. + */ + public static ServiceTenantResponse fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ServiceTenantResponse deserializedServiceTenantResponse = new ServiceTenantResponse(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tenantId".equals(fieldName)) { + deserializedServiceTenantResponse.tenantId = reader.getString(); + } else if ("tenantName".equals(fieldName)) { + deserializedServiceTenantResponse.tenantName = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedServiceTenantResponse; + }); + } +} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/SpendingLimit.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/SpendingLimit.java deleted file mode 100644 index b2d6179e8487..000000000000 --- a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/SpendingLimit.java +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.subscription.models; - -/** - * The subscription spending limit. - */ -public enum SpendingLimit { - /** - * Enum value On. - */ - ON("On"), - - /** - * Enum value Off. - */ - OFF("Off"), - - /** - * Enum value CurrentPeriodOff. - */ - CURRENT_PERIOD_OFF("CurrentPeriodOff"); - - /** - * The actual serialized value for a SpendingLimit instance. - */ - private final String value; - - SpendingLimit(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a SpendingLimit instance. - * - * @param value the serialized value to parse. - * @return the parsed SpendingLimit object, or null if unable to parse. - */ - public static SpendingLimit fromString(String value) { - if (value == null) { - return null; - } - SpendingLimit[] items = SpendingLimit.values(); - for (SpendingLimit item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - /** - * {@inheritDoc} - */ - @Override - public String toString() { - return this.value; - } -} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/Subscription.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/Subscription.java deleted file mode 100644 index 48f20f7a286c..000000000000 --- a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/Subscription.java +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.subscription.models; - -import com.azure.resourcemanager.subscription.fluent.models.SubscriptionInner; -import java.util.Map; - -/** - * An immutable client-side representation of Subscription. - */ -public interface Subscription { - /** - * Gets the id property: The fully qualified ID for the subscription. For example, - * /subscriptions/00000000-0000-0000-0000-000000000000. - * - * @return the id value. - */ - String id(); - - /** - * Gets the subscriptionId property: The subscription ID. - * - * @return the subscriptionId value. - */ - String subscriptionId(); - - /** - * Gets the displayName property: The subscription display name. - * - * @return the displayName value. - */ - String displayName(); - - /** - * Gets the state property: The subscription state. Possible values are Enabled, Warned, PastDue, Disabled, and - * Deleted. - * - * @return the state value. - */ - SubscriptionState state(); - - /** - * Gets the tenantId property: The tenant ID. For example, 00000000-0000-0000-0000-000000000000. - * - * @return the tenantId value. - */ - String tenantId(); - - /** - * Gets the tags property: Tags for the subscription. - * - * @return the tags value. - */ - Map tags(); - - /** - * Gets the subscriptionPolicies property: The subscription policies. - * - * @return the subscriptionPolicies value. - */ - SubscriptionPolicies subscriptionPolicies(); - - /** - * Gets the authorizationSource property: The authorization source of the request. Valid values are one or more - * combinations of Legacy, RoleBased, Bypassed, Direct and Management. For example, 'Legacy, RoleBased'. - * - * @return the authorizationSource value. - */ - String authorizationSource(); - - /** - * Gets the inner com.azure.resourcemanager.subscription.fluent.models.SubscriptionInner object. - * - * @return the inner object. - */ - SubscriptionInner innerModel(); -} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/PutAliasListResult.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/SubscriptionAliasListResult.java similarity index 63% rename from sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/PutAliasListResult.java rename to sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/SubscriptionAliasListResult.java index c4bb351e6bd3..12e89717d1f8 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/PutAliasListResult.java +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/SubscriptionAliasListResult.java @@ -4,19 +4,19 @@ package com.azure.resourcemanager.subscription.models; -import com.azure.resourcemanager.subscription.fluent.models.PutAliasListResultInner; +import com.azure.resourcemanager.subscription.fluent.models.SubscriptionAliasListResultInner; import java.util.List; /** - * An immutable client-side representation of PutAliasListResult. + * An immutable client-side representation of SubscriptionAliasListResult. */ -public interface PutAliasListResult { +public interface SubscriptionAliasListResult { /** * Gets the value property: The list of alias. * * @return the value value. */ - List value(); + List value(); /** * Gets the nextLink property: The link (url) to the next page of results. @@ -26,9 +26,9 @@ public interface PutAliasListResult { String nextLink(); /** - * Gets the inner com.azure.resourcemanager.subscription.fluent.models.PutAliasListResultInner object. + * Gets the inner com.azure.resourcemanager.subscription.fluent.models.SubscriptionAliasListResultInner object. * * @return the inner object. */ - PutAliasListResultInner innerModel(); + SubscriptionAliasListResultInner innerModel(); } diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/SubscriptionAliasResponse.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/SubscriptionAliasResponse.java new file mode 100644 index 000000000000..df6f6d9547a8 --- /dev/null +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/SubscriptionAliasResponse.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.subscription.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.subscription.fluent.models.SubscriptionAliasResponseInner; + +/** + * An immutable client-side representation of SubscriptionAliasResponse. + */ +public interface SubscriptionAliasResponse { + /** + * 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 properties property: Subscription Alias response properties. + * + * @return the properties value. + */ + SubscriptionAliasResponseProperties properties(); + + /** + * Gets the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner com.azure.resourcemanager.subscription.fluent.models.SubscriptionAliasResponseInner object. + * + * @return the inner object. + */ + SubscriptionAliasResponseInner innerModel(); +} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/SubscriptionAliasResponseProperties.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/SubscriptionAliasResponseProperties.java new file mode 100644 index 000000000000..9bc24b32b3d3 --- /dev/null +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/SubscriptionAliasResponseProperties.java @@ -0,0 +1,384 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.subscription.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * Put subscription creation result properties. + */ +@Fluent +public final class SubscriptionAliasResponseProperties + implements JsonSerializable { + /* + * Newly created subscription Id. + */ + private String subscriptionId; + + /* + * The display name of the subscription. + */ + private String displayName; + + /* + * The provisioning state of the resource. + */ + private ProvisioningState provisioningState; + + /* + * Url to accept ownership of the subscription. + */ + private String acceptOwnershipUrl; + + /* + * The accept ownership state of the resource. + */ + private AcceptOwnership acceptOwnershipState; + + /* + * Billing scope of the subscription. + * For CustomerLed and FieldLed - + * /billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName} + * For PartnerLed - /billingAccounts/{billingAccountName}/customers/{customerName} + * For Legacy EA - /billingAccounts/{billingAccountName}/enrollmentAccounts/{enrollmentAccountName} + */ + private String billingScope; + + /* + * The workload type of the subscription. It can be either Production or DevTest. + */ + private Workload workload; + + /* + * Reseller Id + */ + private String resellerId; + + /* + * Owner Id of the subscription + */ + private String subscriptionOwnerId; + + /* + * The Management Group Id. + */ + private String managementGroupId; + + /* + * Created Time + */ + private String createdTime; + + /* + * Tags for the subscription + */ + private Map tags; + + /** + * Creates an instance of SubscriptionAliasResponseProperties class. + */ + public SubscriptionAliasResponseProperties() { + } + + /** + * Get the subscriptionId property: Newly created subscription Id. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Get the displayName property: The display name of the subscription. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The display name of the subscription. + * + * @param displayName the displayName value to set. + * @return the SubscriptionAliasResponseProperties object itself. + */ + public SubscriptionAliasResponseProperties withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the provisioningState property: The provisioning state of the resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioningState property: The provisioning state of the resource. + * + * @param provisioningState the provisioningState value to set. + * @return the SubscriptionAliasResponseProperties object itself. + */ + public SubscriptionAliasResponseProperties withProvisioningState(ProvisioningState provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Get the acceptOwnershipUrl property: Url to accept ownership of the subscription. + * + * @return the acceptOwnershipUrl value. + */ + public String acceptOwnershipUrl() { + return this.acceptOwnershipUrl; + } + + /** + * Get the acceptOwnershipState property: The accept ownership state of the resource. + * + * @return the acceptOwnershipState value. + */ + public AcceptOwnership acceptOwnershipState() { + return this.acceptOwnershipState; + } + + /** + * Get the billingScope property: Billing scope of the subscription. + * For CustomerLed and FieldLed - + * /billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName} + * For PartnerLed - /billingAccounts/{billingAccountName}/customers/{customerName} + * For Legacy EA - /billingAccounts/{billingAccountName}/enrollmentAccounts/{enrollmentAccountName}. + * + * @return the billingScope value. + */ + public String billingScope() { + return this.billingScope; + } + + /** + * Set the billingScope property: Billing scope of the subscription. + * For CustomerLed and FieldLed - + * /billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName} + * For PartnerLed - /billingAccounts/{billingAccountName}/customers/{customerName} + * For Legacy EA - /billingAccounts/{billingAccountName}/enrollmentAccounts/{enrollmentAccountName}. + * + * @param billingScope the billingScope value to set. + * @return the SubscriptionAliasResponseProperties object itself. + */ + public SubscriptionAliasResponseProperties withBillingScope(String billingScope) { + this.billingScope = billingScope; + return this; + } + + /** + * Get the workload property: The workload type of the subscription. It can be either Production or DevTest. + * + * @return the workload value. + */ + public Workload workload() { + return this.workload; + } + + /** + * Set the workload property: The workload type of the subscription. It can be either Production or DevTest. + * + * @param workload the workload value to set. + * @return the SubscriptionAliasResponseProperties object itself. + */ + public SubscriptionAliasResponseProperties withWorkload(Workload workload) { + this.workload = workload; + return this; + } + + /** + * Get the resellerId property: Reseller Id. + * + * @return the resellerId value. + */ + public String resellerId() { + return this.resellerId; + } + + /** + * Set the resellerId property: Reseller Id. + * + * @param resellerId the resellerId value to set. + * @return the SubscriptionAliasResponseProperties object itself. + */ + public SubscriptionAliasResponseProperties withResellerId(String resellerId) { + this.resellerId = resellerId; + return this; + } + + /** + * Get the subscriptionOwnerId property: Owner Id of the subscription. + * + * @return the subscriptionOwnerId value. + */ + public String subscriptionOwnerId() { + return this.subscriptionOwnerId; + } + + /** + * Set the subscriptionOwnerId property: Owner Id of the subscription. + * + * @param subscriptionOwnerId the subscriptionOwnerId value to set. + * @return the SubscriptionAliasResponseProperties object itself. + */ + public SubscriptionAliasResponseProperties withSubscriptionOwnerId(String subscriptionOwnerId) { + this.subscriptionOwnerId = subscriptionOwnerId; + return this; + } + + /** + * Get the managementGroupId property: The Management Group Id. + * + * @return the managementGroupId value. + */ + public String managementGroupId() { + return this.managementGroupId; + } + + /** + * Set the managementGroupId property: The Management Group Id. + * + * @param managementGroupId the managementGroupId value to set. + * @return the SubscriptionAliasResponseProperties object itself. + */ + public SubscriptionAliasResponseProperties withManagementGroupId(String managementGroupId) { + this.managementGroupId = managementGroupId; + return this; + } + + /** + * Get the createdTime property: Created Time. + * + * @return the createdTime value. + */ + public String createdTime() { + return this.createdTime; + } + + /** + * Set the createdTime property: Created Time. + * + * @param createdTime the createdTime value to set. + * @return the SubscriptionAliasResponseProperties object itself. + */ + public SubscriptionAliasResponseProperties withCreatedTime(String createdTime) { + this.createdTime = createdTime; + return this; + } + + /** + * Get the tags property: Tags for the subscription. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Tags for the subscription. + * + * @param tags the tags value to set. + * @return the SubscriptionAliasResponseProperties object itself. + */ + public SubscriptionAliasResponseProperties withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("displayName", this.displayName); + jsonWriter.writeStringField("provisioningState", + this.provisioningState == null ? null : this.provisioningState.toString()); + jsonWriter.writeStringField("billingScope", this.billingScope); + jsonWriter.writeStringField("workload", this.workload == null ? null : this.workload.toString()); + jsonWriter.writeStringField("resellerId", this.resellerId); + jsonWriter.writeStringField("subscriptionOwnerId", this.subscriptionOwnerId); + jsonWriter.writeStringField("managementGroupId", this.managementGroupId); + jsonWriter.writeStringField("createdTime", this.createdTime); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SubscriptionAliasResponseProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SubscriptionAliasResponseProperties if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SubscriptionAliasResponseProperties. + */ + public static SubscriptionAliasResponseProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SubscriptionAliasResponseProperties deserializedSubscriptionAliasResponseProperties + = new SubscriptionAliasResponseProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("subscriptionId".equals(fieldName)) { + deserializedSubscriptionAliasResponseProperties.subscriptionId = reader.getString(); + } else if ("displayName".equals(fieldName)) { + deserializedSubscriptionAliasResponseProperties.displayName = reader.getString(); + } else if ("provisioningState".equals(fieldName)) { + deserializedSubscriptionAliasResponseProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else if ("acceptOwnershipUrl".equals(fieldName)) { + deserializedSubscriptionAliasResponseProperties.acceptOwnershipUrl = reader.getString(); + } else if ("acceptOwnershipState".equals(fieldName)) { + deserializedSubscriptionAliasResponseProperties.acceptOwnershipState + = AcceptOwnership.fromString(reader.getString()); + } else if ("billingScope".equals(fieldName)) { + deserializedSubscriptionAliasResponseProperties.billingScope = reader.getString(); + } else if ("workload".equals(fieldName)) { + deserializedSubscriptionAliasResponseProperties.workload = Workload.fromString(reader.getString()); + } else if ("resellerId".equals(fieldName)) { + deserializedSubscriptionAliasResponseProperties.resellerId = reader.getString(); + } else if ("subscriptionOwnerId".equals(fieldName)) { + deserializedSubscriptionAliasResponseProperties.subscriptionOwnerId = reader.getString(); + } else if ("managementGroupId".equals(fieldName)) { + deserializedSubscriptionAliasResponseProperties.managementGroupId = reader.getString(); + } else if ("createdTime".equals(fieldName)) { + deserializedSubscriptionAliasResponseProperties.createdTime = reader.getString(); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedSubscriptionAliasResponseProperties.tags = tags; + } else { + reader.skipChildren(); + } + } + + return deserializedSubscriptionAliasResponseProperties; + }); + } +} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/SubscriptionCreationResult.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/SubscriptionCreationResult.java new file mode 100644 index 000000000000..30b0b82dbb3f --- /dev/null +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/SubscriptionCreationResult.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.subscription.models; + +import com.azure.resourcemanager.subscription.fluent.models.SubscriptionCreationResultInner; + +/** + * An immutable client-side representation of SubscriptionCreationResult. + */ +public interface SubscriptionCreationResult { + /** + * Gets the subscriptionLink property: The link to the new subscription. Use this link to check the status of + * subscription creation operation. + * + * @return the subscriptionLink value. + */ + String subscriptionLink(); + + /** + * Gets the inner com.azure.resourcemanager.subscription.fluent.models.SubscriptionCreationResultInner object. + * + * @return the inner object. + */ + SubscriptionCreationResultInner innerModel(); +} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/SubscriptionListResult.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/SubscriptionListResult.java deleted file mode 100644 index d673782c41df..000000000000 --- a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/SubscriptionListResult.java +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.subscription.models; - -import com.azure.core.annotation.Fluent; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import com.azure.resourcemanager.subscription.fluent.models.SubscriptionInner; -import java.io.IOException; -import java.util.List; - -/** - * Subscription list operation response. - */ -@Fluent -public final class SubscriptionListResult implements JsonSerializable { - /* - * An array of subscriptions. - */ - private List value; - - /* - * The URL to get the next set of results. - */ - private String nextLink; - - /** - * Creates an instance of SubscriptionListResult class. - */ - public SubscriptionListResult() { - } - - /** - * Get the value property: An array of subscriptions. - * - * @return the value value. - */ - public List value() { - return this.value; - } - - /** - * Set the value property: An array of subscriptions. - * - * @param value the value value to set. - * @return the SubscriptionListResult object itself. - */ - public SubscriptionListResult withValue(List value) { - this.value = value; - return this; - } - - /** - * Get the nextLink property: The URL to get the next set of results. - * - * @return the nextLink value. - */ - public String nextLink() { - return this.nextLink; - } - - /** - * Set the nextLink property: The URL to get the next set of results. - * - * @param nextLink the nextLink value to set. - * @return the SubscriptionListResult object itself. - */ - public SubscriptionListResult withNextLink(String nextLink) { - this.nextLink = nextLink; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (value() != null) { - value().forEach(e -> e.validate()); - } - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); - jsonWriter.writeStringField("nextLink", this.nextLink); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SubscriptionListResult from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SubscriptionListResult if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IOException If an error occurs while reading the SubscriptionListResult. - */ - public static SubscriptionListResult fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - SubscriptionListResult deserializedSubscriptionListResult = new SubscriptionListResult(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("value".equals(fieldName)) { - List value = reader.readArray(reader1 -> SubscriptionInner.fromJson(reader1)); - deserializedSubscriptionListResult.value = value; - } else if ("nextLink".equals(fieldName)) { - deserializedSubscriptionListResult.nextLink = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedSubscriptionListResult; - }); - } -} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/SubscriptionOperations.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/SubscriptionOperations.java index 58bc3642ce48..5b73fe557b6a 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/SubscriptionOperations.java +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/SubscriptionOperations.java @@ -12,73 +12,27 @@ */ public interface SubscriptionOperations { /** - * The operation to cancel a subscription. + * Get the status of the pending Microsoft.Subscription API operations. * - * @param subscriptionId Subscription Id. + * @param operationId The operation ID, which can be found from the Location field in the generate recommendation + * response header. * @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 ID of the canceled subscription along with {@link Response}. + * @return the status of the pending Microsoft.Subscription API operations. */ - Response cancelWithResponse(String subscriptionId, Context context); + Response getWithResponse(String operationId, Context context); /** - * The operation to cancel a subscription. + * Get the status of the pending Microsoft.Subscription API operations. * - * @param subscriptionId Subscription Id. + * @param operationId The operation ID, which can be found from the Location field in the generate recommendation + * response header. * @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 ID of the canceled subscription. + * @return the status of the pending Microsoft.Subscription API operations. */ - CanceledSubscriptionId cancel(String subscriptionId); - - /** - * The operation to rename a subscription. - * - * @param subscriptionId Subscription Id. - * @param body Subscription Name. - * @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 ID of the subscriptions that is being renamed along with {@link Response}. - */ - Response renameWithResponse(String subscriptionId, SubscriptionName body, Context context); - - /** - * The operation to rename a subscription. - * - * @param subscriptionId Subscription Id. - * @param body Subscription Name. - * @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 ID of the subscriptions that is being renamed. - */ - RenamedSubscriptionId rename(String subscriptionId, SubscriptionName body); - - /** - * The operation to enable a subscription. - * - * @param subscriptionId Subscription 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 ID of the subscriptions that is being enabled along with {@link Response}. - */ - Response enableWithResponse(String subscriptionId, Context context); - - /** - * The operation to enable a subscription. - * - * @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 ID of the subscriptions that is being enabled. - */ - EnabledSubscriptionId enable(String subscriptionId); + SubscriptionCreationResult get(String operationId); } diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/SubscriptionOperationsGetHeaders.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/SubscriptionOperationsGetHeaders.java new file mode 100644 index 000000000000..8b656f0c1c54 --- /dev/null +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/SubscriptionOperationsGetHeaders.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.subscription.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; + +/** + * The SubscriptionOperationsGetHeaders model. + */ +@Fluent +public final class SubscriptionOperationsGetHeaders { + /* + * The Retry-After property. + */ + private Long retryAfter; + + /* + * The Location property. + */ + private String location; + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of SubscriptionOperationsGetHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public SubscriptionOperationsGetHeaders(HttpHeaders rawHeaders) { + String retryAfter = rawHeaders.getValue(HttpHeaderName.RETRY_AFTER); + if (retryAfter != null) { + this.retryAfter = Long.parseLong(retryAfter); + } else { + this.retryAfter = null; + } + this.location = rawHeaders.getValue(HttpHeaderName.LOCATION); + } + + /** + * Get the retryAfter property: The Retry-After property. + * + * @return the retryAfter value. + */ + public Long retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter property: The Retry-After property. + * + * @param retryAfter the retryAfter value to set. + * @return the SubscriptionOperationsGetHeaders object itself. + */ + public SubscriptionOperationsGetHeaders withRetryAfter(Long retryAfter) { + this.retryAfter = retryAfter; + 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 SubscriptionOperationsGetHeaders object itself. + */ + public SubscriptionOperationsGetHeaders 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/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/SubscriptionOperationsGetResponse.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/SubscriptionOperationsGetResponse.java new file mode 100644 index 000000000000..bb42c939c57c --- /dev/null +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/SubscriptionOperationsGetResponse.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.subscription.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.subscription.fluent.models.SubscriptionCreationResultInner; + +/** + * Contains all response data for the get operation. + */ +public final class SubscriptionOperationsGetResponse + extends ResponseBase { + /** + * Creates an instance of SubscriptionOperationsGetResponse. + * + * @param request the request which resulted in this SubscriptionOperationsGetResponse. + * @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 SubscriptionOperationsGetResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, + SubscriptionCreationResultInner value, SubscriptionOperationsGetHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** + * Gets the deserialized response body. + * + * @return the deserialized response body. + */ + @Override + public SubscriptionCreationResultInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/SubscriptionPolicies.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/SubscriptionPolicies.java index 776bcf7ee352..011b7b41bb60 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/SubscriptionPolicies.java +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/SubscriptionPolicies.java @@ -4,113 +4,75 @@ package com.azure.resourcemanager.subscription.models; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; /** - * Subscription policies. + * Resource collection API of SubscriptionPolicies. */ -@Immutable -public final class SubscriptionPolicies implements JsonSerializable { - /* - * The subscription location placement ID. The ID indicates which regions are visible for a subscription. For - * example, a subscription with a location placement Id of Public_2014-09-01 has access to Azure public regions. - */ - private String locationPlacementId; - - /* - * The subscription quota ID. - */ - private String quotaId; - - /* - * The subscription spending limit. - */ - private SpendingLimit spendingLimit; - +public interface SubscriptionPolicies { /** - * Creates an instance of SubscriptionPolicies class. - */ - public SubscriptionPolicies() { - } - - /** - * Get the locationPlacementId property: The subscription location placement ID. The ID indicates which regions are - * visible for a subscription. For example, a subscription with a location placement Id of Public_2014-09-01 has - * access to Azure public regions. + * Create or Update Subscription tenant policy for user's tenant. * - * @return the locationPlacementId value. + * @param body The body 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 tenant policy Information along with {@link Response}. */ - public String locationPlacementId() { - return this.locationPlacementId; - } + Response addUpdatePolicyForTenantWithResponse(PutTenantPolicyRequestProperties body, + Context context); /** - * Get the quotaId property: The subscription quota ID. + * Create or Update Subscription tenant policy for user's tenant. * - * @return the quotaId value. + * @param body The body 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 tenant policy Information. */ - public String quotaId() { - return this.quotaId; - } + GetTenantPolicyResponse addUpdatePolicyForTenant(PutTenantPolicyRequestProperties body); /** - * Get the spendingLimit property: The subscription spending limit. + * Get the subscription tenant policy for the user's tenant. * - * @return the spendingLimit value. + * @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 subscription tenant policy for the user's tenant along with {@link Response}. */ - public SpendingLimit spendingLimit() { - return this.spendingLimit; - } + Response getPolicyForTenantWithResponse(Context context); /** - * Validates the instance. + * Get the subscription tenant policy for the user's tenant. * - * @throws IllegalArgumentException thrown if the instance is not valid. + * @throws com.azure.core.management.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 subscription tenant policy for the user's tenant. */ - public void validate() { - } + GetTenantPolicyResponse getPolicyForTenant(); /** - * {@inheritDoc} + * Get the subscription tenant policy for the user's 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 subscription tenant policy for the user's tenant as paginated response with {@link PagedIterable}. */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - return jsonWriter.writeEndObject(); - } + PagedIterable listPolicyForTenant(); /** - * Reads an instance of SubscriptionPolicies from the JsonReader. + * Get the subscription tenant policy for the user's tenant. * - * @param jsonReader The JsonReader being read. - * @return An instance of SubscriptionPolicies if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IOException If an error occurs while reading the SubscriptionPolicies. + * @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 subscription tenant policy for the user's tenant as paginated response with {@link PagedIterable}. */ - public static SubscriptionPolicies fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - SubscriptionPolicies deserializedSubscriptionPolicies = new SubscriptionPolicies(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("locationPlacementId".equals(fieldName)) { - deserializedSubscriptionPolicies.locationPlacementId = reader.getString(); - } else if ("quotaId".equals(fieldName)) { - deserializedSubscriptionPolicies.quotaId = reader.getString(); - } else if ("spendingLimit".equals(fieldName)) { - deserializedSubscriptionPolicies.spendingLimit = SpendingLimit.fromString(reader.getString()); - } else { - reader.skipChildren(); - } - } - - return deserializedSubscriptionPolicies; - }); - } + PagedIterable listPolicyForTenant(Context context); } diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/SubscriptionState.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/SubscriptionState.java deleted file mode 100644 index 3bf0a8ad5434..000000000000 --- a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/SubscriptionState.java +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.subscription.models; - -/** - * The subscription state. Possible values are Enabled, Warned, PastDue, Disabled, and Deleted. - */ -public enum SubscriptionState { - /** - * Enum value Enabled. - */ - ENABLED("Enabled"), - - /** - * Enum value Warned. - */ - WARNED("Warned"), - - /** - * Enum value PastDue. - */ - PAST_DUE("PastDue"), - - /** - * Enum value Disabled. - */ - DISABLED("Disabled"), - - /** - * Enum value Deleted. - */ - DELETED("Deleted"); - - /** - * The actual serialized value for a SubscriptionState instance. - */ - private final String value; - - SubscriptionState(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a SubscriptionState instance. - * - * @param value the serialized value to parse. - * @return the parsed SubscriptionState object, or null if unable to parse. - */ - public static SubscriptionState fromString(String value) { - if (value == null) { - return null; - } - SubscriptionState[] items = SubscriptionState.values(); - for (SubscriptionState item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - /** - * {@inheritDoc} - */ - @Override - public String toString() { - return this.value; - } -} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/Subscriptions.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/Subscriptions.java index 180392cd5652..8588d8407422 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/Subscriptions.java +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/Subscriptions.java @@ -4,7 +4,6 @@ package com.azure.resourcemanager.subscription.models; -import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.Response; import com.azure.core.util.Context; @@ -13,74 +12,119 @@ */ public interface Subscriptions { /** - * Gets all available geo-locations. + * The operation to cancel a subscription. * - * This operation provides all the locations that are available for resource providers; however, each resource - * provider may support a subset of this list. - * - * @param subscriptionId The ID of the target subscription. + * @param subscriptionId Subscription 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 location list operation response as paginated response with {@link PagedIterable}. + * @return the ID of the canceled subscription along with {@link Response}. */ - PagedIterable listLocations(String subscriptionId); + Response cancelWithResponse(String subscriptionId, Context context); /** - * Gets all available geo-locations. + * The operation to cancel a subscription. * - * This operation provides all the locations that are available for resource providers; however, each resource - * provider may support a subset of this list. + * @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 ID of the canceled subscription. + */ + CanceledSubscriptionId cancel(String subscriptionId); + + /** + * The operation to rename a subscription. * - * @param subscriptionId The ID of the target subscription. + * @param subscriptionId Subscription Id. + * @param body Subscription Name. * @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 location list operation response as paginated response with {@link PagedIterable}. + * @return the ID of the subscriptions that is being renamed along with {@link Response}. */ - PagedIterable listLocations(String subscriptionId, Context context); + Response renameWithResponse(String subscriptionId, SubscriptionName body, Context context); /** - * Gets details about a specified subscription. + * The operation to rename a subscription. * - * @param subscriptionId The ID of the target subscription. + * @param subscriptionId Subscription Id. + * @param body Subscription Name. + * @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 ID of the subscriptions that is being renamed. + */ + RenamedSubscriptionId rename(String subscriptionId, SubscriptionName body); + + /** + * The operation to enable a subscription. + * + * @param subscriptionId Subscription 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 details about a specified subscription along with {@link Response}. + * @return the ID of the subscriptions that is being enabled along with {@link Response}. */ - Response getWithResponse(String subscriptionId, Context context); + Response enableWithResponse(String subscriptionId, Context context); /** - * Gets details about a specified subscription. + * The operation to enable a subscription. * - * @param subscriptionId The ID of the target subscription. + * @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 details about a specified subscription. + * @return the ID of the subscriptions that is being enabled. */ - Subscription get(String subscriptionId); + EnabledSubscriptionId enable(String subscriptionId); /** - * Gets all subscriptions for a tenant. + * Accept subscription ownership. * + * @param subscriptionId Subscription Id. + * @param body The body 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 all subscriptions for a tenant as paginated response with {@link PagedIterable}. */ - PagedIterable list(); + void acceptOwnership(String subscriptionId, AcceptOwnershipRequest body); /** - * Gets all subscriptions for a tenant. + * Accept subscription ownership. * + * @param subscriptionId Subscription Id. + * @param body The body 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 all subscriptions for a tenant as paginated response with {@link PagedIterable}. */ - PagedIterable list(Context context); + void acceptOwnership(String subscriptionId, AcceptOwnershipRequest body, Context context); + + /** + * Accept subscription ownership status. + * + * @param subscriptionId Subscription 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 subscription Accept Ownership Response along with {@link Response}. + */ + Response acceptOwnershipStatusWithResponse(String subscriptionId, Context context); + + /** + * Accept subscription ownership status. + * + * @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 subscription Accept Ownership Response. + */ + AcceptOwnershipStatusResponse acceptOwnershipStatus(String subscriptionId); } diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/TenantIdDescription.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/TenantIdDescription.java deleted file mode 100644 index 428bd5716c69..000000000000 --- a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/TenantIdDescription.java +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.subscription.models; - -import com.azure.resourcemanager.subscription.fluent.models.TenantIdDescriptionInner; - -/** - * An immutable client-side representation of TenantIdDescription. - */ -public interface TenantIdDescription { - /** - * Gets the id property: The fully qualified ID of the tenant. For example, - * /tenants/00000000-0000-0000-0000-000000000000. - * - * @return the id value. - */ - String id(); - - /** - * Gets the tenantId property: The tenant ID. For example, 00000000-0000-0000-0000-000000000000. - * - * @return the tenantId value. - */ - String tenantId(); - - /** - * Gets the tenantCategory property: The category of the tenant. Possible values are - * TenantCategoryHome,TenantCategoryProjectedBy,TenantCategoryManagedBy. - * - * @return the tenantCategory value. - */ - String tenantCategory(); - - /** - * Gets the country property: The country/region name of the address for the tenant. - * - * @return the country value. - */ - String country(); - - /** - * Gets the countryCode property: The Country/region abbreviation for the tenant. - * - * @return the countryCode value. - */ - String countryCode(); - - /** - * Gets the displayName property: The display name of the tenant. - * - * @return the displayName value. - */ - String displayName(); - - /** - * Gets the domains property: The list of domains for the tenant. - * - * @return the domains value. - */ - String domains(); - - /** - * Gets the defaultDomain property: The default domain for the tenant. - * - * @return the defaultDomain value. - */ - String defaultDomain(); - - /** - * Gets the tenantType property: The tenant type. Only available for Home tenant category. - * - * @return the tenantType value. - */ - String tenantType(); - - /** - * Gets the inner com.azure.resourcemanager.subscription.fluent.models.TenantIdDescriptionInner object. - * - * @return the inner object. - */ - TenantIdDescriptionInner innerModel(); -} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/TenantListResult.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/TenantListResult.java deleted file mode 100644 index efcca9b93d6c..000000000000 --- a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/TenantListResult.java +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.subscription.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import com.azure.resourcemanager.subscription.fluent.models.TenantIdDescriptionInner; -import java.io.IOException; -import java.util.List; - -/** - * Tenant Ids information. - */ -@Fluent -public final class TenantListResult implements JsonSerializable { - /* - * An array of tenants. - */ - private List value; - - /* - * The URL to use for getting the next set of results. - */ - private String nextLink; - - /** - * Creates an instance of TenantListResult class. - */ - public TenantListResult() { - } - - /** - * Get the value property: An array of tenants. - * - * @return the value value. - */ - public List value() { - return this.value; - } - - /** - * Set the value property: An array of tenants. - * - * @param value the value value to set. - * @return the TenantListResult object itself. - */ - public TenantListResult 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; - } - - /** - * Set the nextLink property: The URL to use for getting the next set of results. - * - * @param nextLink the nextLink value to set. - * @return the TenantListResult object itself. - */ - public TenantListResult withNextLink(String nextLink) { - this.nextLink = nextLink; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (value() != null) { - value().forEach(e -> e.validate()); - } - if (nextLink() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException("Missing required property nextLink in model TenantListResult")); - } - } - - private static final ClientLogger LOGGER = new ClientLogger(TenantListResult.class); - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("nextLink", this.nextLink); - jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of TenantListResult from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of TenantListResult if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the TenantListResult. - */ - public static TenantListResult fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - TenantListResult deserializedTenantListResult = new TenantListResult(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("nextLink".equals(fieldName)) { - deserializedTenantListResult.nextLink = reader.getString(); - } else if ("value".equals(fieldName)) { - List value - = reader.readArray(reader1 -> TenantIdDescriptionInner.fromJson(reader1)); - deserializedTenantListResult.value = value; - } else { - reader.skipChildren(); - } - } - - return deserializedTenantListResult; - }); - } -} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/TenantPolicy.java b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/TenantPolicy.java new file mode 100644 index 000000000000..b7e0bedddbbb --- /dev/null +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/models/TenantPolicy.java @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.subscription.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; +import java.util.Objects; +import java.util.UUID; + +/** + * Tenant policy. + */ +@Fluent +public final class TenantPolicy implements JsonSerializable { + /* + * Policy Id. + */ + private String policyId; + + /* + * Blocks the leaving of subscriptions from user's tenant. + */ + private Boolean blockSubscriptionsLeavingTenant; + + /* + * Blocks the entering of subscriptions into user's tenant. + */ + private Boolean blockSubscriptionsIntoTenant; + + /* + * List of user objectIds that are exempted from the set subscription tenant policies for the user's tenant. + */ + private List exemptedPrincipals; + + /** + * Creates an instance of TenantPolicy class. + */ + public TenantPolicy() { + } + + /** + * Get the policyId property: Policy Id. + * + * @return the policyId value. + */ + public String policyId() { + return this.policyId; + } + + /** + * Get the blockSubscriptionsLeavingTenant property: Blocks the leaving of subscriptions from user's tenant. + * + * @return the blockSubscriptionsLeavingTenant value. + */ + public Boolean blockSubscriptionsLeavingTenant() { + return this.blockSubscriptionsLeavingTenant; + } + + /** + * Set the blockSubscriptionsLeavingTenant property: Blocks the leaving of subscriptions from user's tenant. + * + * @param blockSubscriptionsLeavingTenant the blockSubscriptionsLeavingTenant value to set. + * @return the TenantPolicy object itself. + */ + public TenantPolicy withBlockSubscriptionsLeavingTenant(Boolean blockSubscriptionsLeavingTenant) { + this.blockSubscriptionsLeavingTenant = blockSubscriptionsLeavingTenant; + return this; + } + + /** + * Get the blockSubscriptionsIntoTenant property: Blocks the entering of subscriptions into user's tenant. + * + * @return the blockSubscriptionsIntoTenant value. + */ + public Boolean blockSubscriptionsIntoTenant() { + return this.blockSubscriptionsIntoTenant; + } + + /** + * Set the blockSubscriptionsIntoTenant property: Blocks the entering of subscriptions into user's tenant. + * + * @param blockSubscriptionsIntoTenant the blockSubscriptionsIntoTenant value to set. + * @return the TenantPolicy object itself. + */ + public TenantPolicy withBlockSubscriptionsIntoTenant(Boolean blockSubscriptionsIntoTenant) { + this.blockSubscriptionsIntoTenant = blockSubscriptionsIntoTenant; + return this; + } + + /** + * Get the exemptedPrincipals property: List of user objectIds that are exempted from the set subscription tenant + * policies for the user's tenant. + * + * @return the exemptedPrincipals value. + */ + public List exemptedPrincipals() { + return this.exemptedPrincipals; + } + + /** + * Set the exemptedPrincipals property: List of user objectIds that are exempted from the set subscription tenant + * policies for the user's tenant. + * + * @param exemptedPrincipals the exemptedPrincipals value to set. + * @return the TenantPolicy object itself. + */ + public TenantPolicy withExemptedPrincipals(List exemptedPrincipals) { + this.exemptedPrincipals = exemptedPrincipals; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("blockSubscriptionsLeavingTenant", this.blockSubscriptionsLeavingTenant); + jsonWriter.writeBooleanField("blockSubscriptionsIntoTenant", this.blockSubscriptionsIntoTenant); + jsonWriter.writeArrayField("exemptedPrincipals", this.exemptedPrincipals, + (writer, element) -> writer.writeString(Objects.toString(element, null))); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TenantPolicy from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TenantPolicy if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the TenantPolicy. + */ + public static TenantPolicy fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TenantPolicy deserializedTenantPolicy = new TenantPolicy(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("policyId".equals(fieldName)) { + deserializedTenantPolicy.policyId = reader.getString(); + } else if ("blockSubscriptionsLeavingTenant".equals(fieldName)) { + deserializedTenantPolicy.blockSubscriptionsLeavingTenant + = reader.getNullable(JsonReader::getBoolean); + } else if ("blockSubscriptionsIntoTenant".equals(fieldName)) { + deserializedTenantPolicy.blockSubscriptionsIntoTenant = reader.getNullable(JsonReader::getBoolean); + } else if ("exemptedPrincipals".equals(fieldName)) { + List exemptedPrincipals = reader.readArray( + reader1 -> reader1.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString()))); + deserializedTenantPolicy.exemptedPrincipals = exemptedPrincipals; + } else { + reader.skipChildren(); + } + } + + return deserializedTenantPolicy; + }); + } +} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-subscription/proxy-config.json b/sdk/subscription/azure-resourcemanager-subscription/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-subscription/proxy-config.json index abba0d3463d2..2084c95c320c 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-subscription/proxy-config.json +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-subscription/proxy-config.json @@ -1 +1 @@ -[["com.azure.resourcemanager.subscription.implementation.AliasClientImpl$AliasService"],["com.azure.resourcemanager.subscription.implementation.OperationsClientImpl$OperationsService"],["com.azure.resourcemanager.subscription.implementation.SubscriptionOperationsClientImpl$SubscriptionOperationsService"],["com.azure.resourcemanager.subscription.implementation.SubscriptionsClientImpl$SubscriptionsService"],["com.azure.resourcemanager.subscription.implementation.TenantsClientImpl$TenantsService"]] \ No newline at end of file +[["com.azure.resourcemanager.subscription.implementation.AliasClientImpl$AliasService"],["com.azure.resourcemanager.subscription.implementation.BillingAccountsClientImpl$BillingAccountsService"],["com.azure.resourcemanager.subscription.implementation.OperationsClientImpl$OperationsService"],["com.azure.resourcemanager.subscription.implementation.SubscriptionOperationsClientImpl$SubscriptionOperationsService"],["com.azure.resourcemanager.subscription.implementation.SubscriptionPoliciesClientImpl$SubscriptionPoliciesService"],["com.azure.resourcemanager.subscription.implementation.SubscriptionsClientImpl$SubscriptionsService"]] \ No newline at end of file diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/main/resources/azure-resourcemanager-subscription.properties b/sdk/subscription/azure-resourcemanager-subscription/src/main/resources/azure-resourcemanager-subscription.properties new file mode 100644 index 000000000000..defbd48204e4 --- /dev/null +++ b/sdk/subscription/azure-resourcemanager-subscription/src/main/resources/azure-resourcemanager-subscription.properties @@ -0,0 +1 @@ +version=${project.version} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/AliasCreateSamples.java b/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/AliasCreateSamples.java index c81077d6dfaa..12197a333214 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/AliasCreateSamples.java +++ b/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/AliasCreateSamples.java @@ -5,8 +5,11 @@ package com.azure.resourcemanager.subscription.generated; import com.azure.resourcemanager.subscription.models.PutAliasRequest; +import com.azure.resourcemanager.subscription.models.PutAliasRequestAdditionalProperties; import com.azure.resourcemanager.subscription.models.PutAliasRequestProperties; import com.azure.resourcemanager.subscription.models.Workload; +import java.util.HashMap; +import java.util.Map; /** * Samples for Alias Create. @@ -14,7 +17,7 @@ public final class AliasCreateSamples { /* * x-ms-original-file: - * specification/subscription/resource-manager/Microsoft.Subscription/stable/2020-09-01/examples/createAlias.json + * specification/subscription/resource-manager/Microsoft.Subscription/stable/2021-10-01/examples/createAlias.json */ /** * Sample code: CreateAlias. @@ -24,10 +27,26 @@ public final class AliasCreateSamples { public static void createAlias(com.azure.resourcemanager.subscription.SubscriptionManager manager) { manager.alias() .create("aliasForNewSub", new PutAliasRequest().withProperties(new PutAliasRequestProperties() - .withDisplayName("Contoso MCA subscription") + .withDisplayName("Test Subscription") .withWorkload(Workload.PRODUCTION) .withBillingScope( - "/providers/Microsoft.Billing/billingAccounts/e879cf0f-2b4d-5431-109a-f72fc9868693:024cabf4-7321-4cf9-be59-df0c77ca51de_2019-05-31/billingProfiles/PE2Q-NOIT-BG7-TGB/invoiceSections/MTT4-OBS7-PJA-TGB")), + "/billingAccounts/af6231a7-7f8d-4fcc-a993-dd8466108d07:c663dac6-a9a5-405a-8938-cd903e12ab5b_2019_05_31/billingProfiles/QWDQ-QWHI-AUW-SJDO-DJH/invoiceSections/FEUF-EUHE-ISJ-SKDW-DJH") + .withAdditionalProperties(new PutAliasRequestAdditionalProperties() + .withSubscriptionTenantId("66f6e4d6-07dc-4aea-94ea-e12d3026a3c8") + .withSubscriptionOwnerId("f09b39eb-c496-482c-9ab9-afd799572f4c") + .withTags(mapOf("tag1", "Messi", "tag2", "Ronaldo", "tag3", "Lebron")))), com.azure.core.util.Context.NONE); } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } } diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/AliasDeleteSamples.java b/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/AliasDeleteSamples.java index 206e295a25be..debf18311a68 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/AliasDeleteSamples.java +++ b/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/AliasDeleteSamples.java @@ -10,7 +10,7 @@ public final class AliasDeleteSamples { /* * x-ms-original-file: - * specification/subscription/resource-manager/Microsoft.Subscription/stable/2020-09-01/examples/deleteAlias.json + * specification/subscription/resource-manager/Microsoft.Subscription/stable/2021-10-01/examples/deleteAlias.json */ /** * Sample code: DeleteAlias. diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/AliasGetSamples.java b/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/AliasGetSamples.java index b4cbe49f0ddc..7f5e2b6d30d1 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/AliasGetSamples.java +++ b/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/AliasGetSamples.java @@ -10,7 +10,7 @@ public final class AliasGetSamples { /* * x-ms-original-file: - * specification/subscription/resource-manager/Microsoft.Subscription/stable/2020-09-01/examples/getAlias.json + * specification/subscription/resource-manager/Microsoft.Subscription/stable/2021-10-01/examples/getAlias.json */ /** * Sample code: GetAlias. diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/AliasListSamples.java b/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/AliasListSamples.java index 42eb69959824..67a0b7da5ced 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/AliasListSamples.java +++ b/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/AliasListSamples.java @@ -10,14 +10,14 @@ public final class AliasListSamples { /* * x-ms-original-file: - * specification/subscription/resource-manager/Microsoft.Subscription/stable/2020-09-01/examples/listAlias.json + * specification/subscription/resource-manager/Microsoft.Subscription/stable/2021-10-01/examples/listAlias.json */ /** - * Sample code: GetAlias. + * Sample code: ListAlias. * * @param manager Entry point to SubscriptionManager. */ - public static void getAlias(com.azure.resourcemanager.subscription.SubscriptionManager manager) { + public static void listAlias(com.azure.resourcemanager.subscription.SubscriptionManager manager) { manager.alias().listWithResponse(com.azure.core.util.Context.NONE); } } diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/BillingAccountGetPolicySamples.java b/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/BillingAccountGetPolicySamples.java new file mode 100644 index 000000000000..35539ec2903f --- /dev/null +++ b/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/BillingAccountGetPolicySamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.subscription.generated; + +/** + * Samples for BillingAccount GetPolicy. + */ +public final class BillingAccountGetPolicySamples { + /* + * x-ms-original-file: + * specification/subscription/resource-manager/Microsoft.Subscription/stable/2021-10-01/examples/ + * getBillingAccountPolicy.json + */ + /** + * Sample code: GetBillingAccountPolicy. + * + * @param manager Entry point to SubscriptionManager. + */ + public static void getBillingAccountPolicy(com.azure.resourcemanager.subscription.SubscriptionManager manager) { + manager.billingAccounts().getPolicyWithResponse("testBillingAccountId", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/OperationsListSamples.java b/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/OperationsListSamples.java index 2c20ee781dca..a1d72ff74b3d 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/OperationsListSamples.java +++ b/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/OperationsListSamples.java @@ -10,7 +10,7 @@ public final class OperationsListSamples { /* * x-ms-original-file: - * specification/subscription/resource-manager/Microsoft.Subscription/stable/2020-09-01/examples/getOperations.json + * specification/subscription/resource-manager/Microsoft.Subscription/stable/2021-10-01/examples/getOperations.json */ /** * Sample code: getOperations. @@ -18,6 +18,6 @@ public final class OperationsListSamples { * @param manager Entry point to SubscriptionManager. */ public static void getOperations(com.azure.resourcemanager.subscription.SubscriptionManager manager) { - manager.operations().listWithResponse(com.azure.core.util.Context.NONE); + manager.operations().list(com.azure.core.util.Context.NONE); } } diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/SubscriptionAcceptOwnershipSamples.java b/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/SubscriptionAcceptOwnershipSamples.java new file mode 100644 index 000000000000..88446eec630c --- /dev/null +++ b/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/SubscriptionAcceptOwnershipSamples.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.subscription.generated; + +import com.azure.resourcemanager.subscription.models.AcceptOwnershipRequest; +import com.azure.resourcemanager.subscription.models.AcceptOwnershipRequestProperties; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Subscription AcceptOwnership. + */ +public final class SubscriptionAcceptOwnershipSamples { + /* + * x-ms-original-file: + * specification/subscription/resource-manager/Microsoft.Subscription/stable/2021-10-01/examples/ + * acceptSubscriptionOwnership.json + */ + /** + * Sample code: AcceptOwnership. + * + * @param manager Entry point to SubscriptionManager. + */ + public static void acceptOwnership(com.azure.resourcemanager.subscription.SubscriptionManager manager) { + manager.subscriptions() + .acceptOwnership("291bba3f-e0a5-47bc-a099-3bdcb2a50a05", + new AcceptOwnershipRequest() + .withProperties(new AcceptOwnershipRequestProperties().withDisplayName("Test Subscription") + .withTags(mapOf("tag1", "Messi", "tag2", "Ronaldo", "tag3", "Lebron"))), + com.azure.core.util.Context.NONE); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/SubscriptionAcceptOwnershipStatusSamples.java b/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/SubscriptionAcceptOwnershipStatusSamples.java new file mode 100644 index 000000000000..645ec03f9533 --- /dev/null +++ b/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/SubscriptionAcceptOwnershipStatusSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.subscription.generated; + +/** + * Samples for Subscription AcceptOwnershipStatus. + */ +public final class SubscriptionAcceptOwnershipStatusSamples { + /* + * x-ms-original-file: + * specification/subscription/resource-manager/Microsoft.Subscription/stable/2021-10-01/examples/ + * acceptOwnershipStatus.json + */ + /** + * Sample code: AcceptOwnershipStatus. + * + * @param manager Entry point to SubscriptionManager. + */ + public static void acceptOwnershipStatus(com.azure.resourcemanager.subscription.SubscriptionManager manager) { + manager.subscriptions() + .acceptOwnershipStatusWithResponse("291bba3f-e0a5-47bc-a099-3bdcb2a50a05", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/SubscriptionOperationCancelSamples.java b/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/SubscriptionCancelSamples.java similarity index 77% rename from sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/SubscriptionOperationCancelSamples.java rename to sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/SubscriptionCancelSamples.java index e16be4946a48..1ee4694d52e4 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/SubscriptionOperationCancelSamples.java +++ b/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/SubscriptionCancelSamples.java @@ -5,12 +5,12 @@ package com.azure.resourcemanager.subscription.generated; /** - * Samples for SubscriptionOperation Cancel. + * Samples for Subscription Cancel. */ -public final class SubscriptionOperationCancelSamples { +public final class SubscriptionCancelSamples { /* * x-ms-original-file: - * specification/subscription/resource-manager/Microsoft.Subscription/stable/2020-09-01/examples/cancelSubscription. + * specification/subscription/resource-manager/Microsoft.Subscription/stable/2021-10-01/examples/cancelSubscription. * json */ /** @@ -19,7 +19,7 @@ public final class SubscriptionOperationCancelSamples { * @param manager Entry point to SubscriptionManager. */ public static void cancelSubscription(com.azure.resourcemanager.subscription.SubscriptionManager manager) { - manager.subscriptionOperations() + manager.subscriptions() .cancelWithResponse("83aa47df-e3e9-49ff-877b-94304bf3d3ad", com.azure.core.util.Context.NONE); } } diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/SubscriptionOperationEnableSamples.java b/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/SubscriptionEnableSamples.java similarity index 77% rename from sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/SubscriptionOperationEnableSamples.java rename to sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/SubscriptionEnableSamples.java index 32f811ba5b4a..39b2f61bcac6 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/SubscriptionOperationEnableSamples.java +++ b/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/SubscriptionEnableSamples.java @@ -5,12 +5,12 @@ package com.azure.resourcemanager.subscription.generated; /** - * Samples for SubscriptionOperation Enable. + * Samples for Subscription Enable. */ -public final class SubscriptionOperationEnableSamples { +public final class SubscriptionEnableSamples { /* * x-ms-original-file: - * specification/subscription/resource-manager/Microsoft.Subscription/stable/2020-09-01/examples/enableSubscription. + * specification/subscription/resource-manager/Microsoft.Subscription/stable/2021-10-01/examples/enableSubscription. * json */ /** @@ -19,7 +19,7 @@ public final class SubscriptionOperationEnableSamples { * @param manager Entry point to SubscriptionManager. */ public static void enableSubscription(com.azure.resourcemanager.subscription.SubscriptionManager manager) { - manager.subscriptionOperations() + manager.subscriptions() .enableWithResponse("7948bcee-488c-47ce-941c-38e20ede803d", com.azure.core.util.Context.NONE); } } diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/SubscriptionsListSamples.java b/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/SubscriptionOperationGetSamples.java similarity index 50% rename from sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/SubscriptionsListSamples.java rename to sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/SubscriptionOperationGetSamples.java index b8ab1d881944..6b35a515b2d2 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/SubscriptionsListSamples.java +++ b/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/SubscriptionOperationGetSamples.java @@ -5,20 +5,22 @@ package com.azure.resourcemanager.subscription.generated; /** - * Samples for Subscriptions List. + * Samples for SubscriptionOperation Get. */ -public final class SubscriptionsListSamples { +public final class SubscriptionOperationGetSamples { /* * x-ms-original-file: - * specification/subscription/resource-manager/Microsoft.Subscription/stable/2016-06-01/examples/listSubscriptions. - * json + * specification/subscription/resource-manager/Microsoft.Subscription/stable/2021-10-01/examples/ + * getSubscriptionOperation.json */ /** - * Sample code: listSubscriptions. + * Sample code: getPendingSubscriptionOperations. * * @param manager Entry point to SubscriptionManager. */ - public static void listSubscriptions(com.azure.resourcemanager.subscription.SubscriptionManager manager) { - manager.subscriptions().list(com.azure.core.util.Context.NONE); + public static void + getPendingSubscriptionOperations(com.azure.resourcemanager.subscription.SubscriptionManager manager) { + manager.subscriptionOperations() + .getWithResponse("e4b8d068-f574-462a-a76f-6fa0afc613c9", com.azure.core.util.Context.NONE); } } diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/SubscriptionPolicyAddUpdatePolicyForTenantSamples.java b/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/SubscriptionPolicyAddUpdatePolicyForTenantSamples.java new file mode 100644 index 000000000000..594fdf89684f --- /dev/null +++ b/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/SubscriptionPolicyAddUpdatePolicyForTenantSamples.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.subscription.generated; + +import com.azure.resourcemanager.subscription.models.PutTenantPolicyRequestProperties; +import java.util.Arrays; +import java.util.UUID; + +/** + * Samples for SubscriptionPolicy AddUpdatePolicyForTenant. + */ +public final class SubscriptionPolicyAddUpdatePolicyForTenantSamples { + /* + * x-ms-original-file: + * specification/subscription/resource-manager/Microsoft.Subscription/stable/2021-10-01/examples/changeTenantPolicy. + * json + */ + /** + * Sample code: TenantPolicy. + * + * @param manager Entry point to SubscriptionManager. + */ + public static void tenantPolicy(com.azure.resourcemanager.subscription.SubscriptionManager manager) { + manager.subscriptionPolicies() + .addUpdatePolicyForTenantWithResponse( + new PutTenantPolicyRequestProperties().withBlockSubscriptionsLeavingTenant(true) + .withBlockSubscriptionsIntoTenant(true) + .withExemptedPrincipals(Arrays.asList(UUID.fromString("e879cf0f-2b4d-5431-109a-f72fc9868693"), + UUID.fromString("9792da87-c97b-410d-a97d-27021ba09ce6"))), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/SubscriptionsGetSamples.java b/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/SubscriptionPolicyGetPolicyForTenantSamples.java similarity index 55% rename from sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/SubscriptionsGetSamples.java rename to sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/SubscriptionPolicyGetPolicyForTenantSamples.java index b69a91e0b4db..1e5d9a107b0f 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/SubscriptionsGetSamples.java +++ b/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/SubscriptionPolicyGetPolicyForTenantSamples.java @@ -5,21 +5,20 @@ package com.azure.resourcemanager.subscription.generated; /** - * Samples for Subscriptions Get. + * Samples for SubscriptionPolicy GetPolicyForTenant. */ -public final class SubscriptionsGetSamples { +public final class SubscriptionPolicyGetPolicyForTenantSamples { /* * x-ms-original-file: - * specification/subscription/resource-manager/Microsoft.Subscription/stable/2016-06-01/examples/getSubscription. + * specification/subscription/resource-manager/Microsoft.Subscription/stable/2021-10-01/examples/getTenantPolicy. * json */ /** - * Sample code: getSubscription. + * Sample code: getTenantPolicy. * * @param manager Entry point to SubscriptionManager. */ - public static void getSubscription(com.azure.resourcemanager.subscription.SubscriptionManager manager) { - manager.subscriptions() - .getWithResponse("83aa47df-e3e9-49ff-877b-94304bf3d3ad", com.azure.core.util.Context.NONE); + public static void getTenantPolicy(com.azure.resourcemanager.subscription.SubscriptionManager manager) { + manager.subscriptionPolicies().getPolicyForTenantWithResponse(com.azure.core.util.Context.NONE); } } diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/SubscriptionPolicyListPolicyForTenantSamples.java b/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/SubscriptionPolicyListPolicyForTenantSamples.java new file mode 100644 index 000000000000..fb84c22b7868 --- /dev/null +++ b/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/SubscriptionPolicyListPolicyForTenantSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.subscription.generated; + +/** + * Samples for SubscriptionPolicy ListPolicyForTenant. + */ +public final class SubscriptionPolicyListPolicyForTenantSamples { + /* + * x-ms-original-file: + * specification/subscription/resource-manager/Microsoft.Subscription/stable/2021-10-01/examples/getTenantPolicyList + * .json + */ + /** + * Sample code: getTenantPolicyList. + * + * @param manager Entry point to SubscriptionManager. + */ + public static void getTenantPolicyList(com.azure.resourcemanager.subscription.SubscriptionManager manager) { + manager.subscriptionPolicies().listPolicyForTenant(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/SubscriptionOperationRenameSamples.java b/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/SubscriptionRenameSamples.java similarity index 80% rename from sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/SubscriptionOperationRenameSamples.java rename to sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/SubscriptionRenameSamples.java index 65fe11fc3288..1e73f83c7738 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/SubscriptionOperationRenameSamples.java +++ b/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/SubscriptionRenameSamples.java @@ -7,12 +7,12 @@ import com.azure.resourcemanager.subscription.models.SubscriptionName; /** - * Samples for SubscriptionOperation Rename. + * Samples for Subscription Rename. */ -public final class SubscriptionOperationRenameSamples { +public final class SubscriptionRenameSamples { /* * x-ms-original-file: - * specification/subscription/resource-manager/Microsoft.Subscription/stable/2020-09-01/examples/renameSubscription. + * specification/subscription/resource-manager/Microsoft.Subscription/stable/2021-10-01/examples/renameSubscription. * json */ /** @@ -21,7 +21,7 @@ public final class SubscriptionOperationRenameSamples { * @param manager Entry point to SubscriptionManager. */ public static void renameSubscription(com.azure.resourcemanager.subscription.SubscriptionManager manager) { - manager.subscriptionOperations() + manager.subscriptions() .renameWithResponse("83aa47df-e3e9-49ff-877b-94304bf3d3ad", new SubscriptionName().withSubscriptionName("Test Sub"), com.azure.core.util.Context.NONE); } diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/SubscriptionsListLocationsSamples.java b/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/SubscriptionsListLocationsSamples.java deleted file mode 100644 index baf547d28928..000000000000 --- a/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/SubscriptionsListLocationsSamples.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.subscription.generated; - -/** - * Samples for Subscriptions ListLocations. - */ -public final class SubscriptionsListLocationsSamples { - /* - * x-ms-original-file: - * specification/subscription/resource-manager/Microsoft.Subscription/stable/2016-06-01/examples/listLocations.json - */ - /** - * Sample code: listLocations. - * - * @param manager Entry point to SubscriptionManager. - */ - public static void listLocations(com.azure.resourcemanager.subscription.SubscriptionManager manager) { - manager.subscriptions().listLocations("83aa47df-e3e9-49ff-877b-94304bf3d3ad", com.azure.core.util.Context.NONE); - } -} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/TenantsListSamples.java b/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/TenantsListSamples.java deleted file mode 100644 index d4819fa64e29..000000000000 --- a/sdk/subscription/azure-resourcemanager-subscription/src/samples/java/com/azure/resourcemanager/subscription/generated/TenantsListSamples.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.subscription.generated; - -/** - * Samples for Tenants List. - */ -public final class TenantsListSamples { - /* - * x-ms-original-file: - * specification/subscription/resource-manager/Microsoft.Subscription/stable/2016-06-01/examples/listTenants.json - */ - /** - * Sample code: listTenants. - * - * @param manager Entry point to SubscriptionManager. - */ - public static void listTenants(com.azure.resourcemanager.subscription.SubscriptionManager manager) { - manager.tenants().list(com.azure.core.util.Context.NONE); - } -} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/AcceptOwnershipRequestPropertiesTests.java b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/AcceptOwnershipRequestPropertiesTests.java new file mode 100644 index 000000000000..bb797ec1b0ff --- /dev/null +++ b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/AcceptOwnershipRequestPropertiesTests.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.subscription.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.subscription.models.AcceptOwnershipRequestProperties; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class AcceptOwnershipRequestPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AcceptOwnershipRequestProperties model = BinaryData.fromString( + "{\"displayName\":\"cxtbzsg\",\"managementGroupId\":\"c\",\"tags\":{\"jeiachboosfl\":\"ewmdw\",\"fqpte\":\"ro\",\"i\":\"hzzvypyq\",\"npvswjdkirso\":\"z\"}}") + .toObject(AcceptOwnershipRequestProperties.class); + Assertions.assertEquals("cxtbzsg", model.displayName()); + Assertions.assertEquals("c", model.managementGroupId()); + Assertions.assertEquals("ewmdw", model.tags().get("jeiachboosfl")); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AcceptOwnershipRequestProperties model = new AcceptOwnershipRequestProperties().withDisplayName("cxtbzsg") + .withManagementGroupId("c") + .withTags(mapOf("jeiachboosfl", "ewmdw", "fqpte", "ro", "i", "hzzvypyq", "npvswjdkirso", "z")); + model = BinaryData.fromObject(model).toObject(AcceptOwnershipRequestProperties.class); + Assertions.assertEquals("cxtbzsg", model.displayName()); + Assertions.assertEquals("c", model.managementGroupId()); + Assertions.assertEquals("ewmdw", model.tags().get("jeiachboosfl")); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/AcceptOwnershipRequestTests.java b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/AcceptOwnershipRequestTests.java new file mode 100644 index 000000000000..28ba61ae23d6 --- /dev/null +++ b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/AcceptOwnershipRequestTests.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.subscription.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.subscription.models.AcceptOwnershipRequest; +import com.azure.resourcemanager.subscription.models.AcceptOwnershipRequestProperties; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class AcceptOwnershipRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AcceptOwnershipRequest model = BinaryData.fromString( + "{\"properties\":{\"displayName\":\"thwxmnteiwaopvkm\",\"managementGroupId\":\"c\",\"tags\":{\"fsrpymzidnse\":\"dcuf\"}}}") + .toObject(AcceptOwnershipRequest.class); + Assertions.assertEquals("thwxmnteiwaopvkm", model.properties().displayName()); + Assertions.assertEquals("c", model.properties().managementGroupId()); + Assertions.assertEquals("dcuf", model.properties().tags().get("fsrpymzidnse")); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AcceptOwnershipRequest model = new AcceptOwnershipRequest() + .withProperties(new AcceptOwnershipRequestProperties().withDisplayName("thwxmnteiwaopvkm") + .withManagementGroupId("c") + .withTags(mapOf("fsrpymzidnse", "dcuf"))); + model = BinaryData.fromObject(model).toObject(AcceptOwnershipRequest.class); + Assertions.assertEquals("thwxmnteiwaopvkm", model.properties().displayName()); + Assertions.assertEquals("c", model.properties().managementGroupId()); + Assertions.assertEquals("dcuf", model.properties().tags().get("fsrpymzidnse")); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/AcceptOwnershipStatusResponseInnerTests.java b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/AcceptOwnershipStatusResponseInnerTests.java new file mode 100644 index 000000000000..4ae60bd7cea5 --- /dev/null +++ b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/AcceptOwnershipStatusResponseInnerTests.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.subscription.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.subscription.fluent.models.AcceptOwnershipStatusResponseInner; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class AcceptOwnershipStatusResponseInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AcceptOwnershipStatusResponseInner model = BinaryData.fromString( + "{\"subscriptionId\":\"qxhcrmn\",\"acceptOwnershipState\":\"Expired\",\"provisioningState\":\"Accepted\",\"billingOwner\":\"whdsoifiyip\",\"subscriptionTenantId\":\"sqwpgrjb\",\"displayName\":\"orcjxvsnby\",\"tags\":{\"pcyshu\":\"bnmo\",\"jjgpb\":\"zafb\",\"jmkljavbqidtqajz\":\"oq\"}}") + .toObject(AcceptOwnershipStatusResponseInner.class); + Assertions.assertEquals("sqwpgrjb", model.subscriptionTenantId()); + Assertions.assertEquals("orcjxvsnby", model.displayName()); + Assertions.assertEquals("bnmo", model.tags().get("pcyshu")); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AcceptOwnershipStatusResponseInner model + = new AcceptOwnershipStatusResponseInner().withSubscriptionTenantId("sqwpgrjb") + .withDisplayName("orcjxvsnby") + .withTags(mapOf("pcyshu", "bnmo", "jjgpb", "zafb", "jmkljavbqidtqajz", "oq")); + model = BinaryData.fromObject(model).toObject(AcceptOwnershipStatusResponseInner.class); + Assertions.assertEquals("sqwpgrjb", model.subscriptionTenantId()); + Assertions.assertEquals("orcjxvsnby", model.displayName()); + Assertions.assertEquals("bnmo", model.tags().get("pcyshu")); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/AliasCreateMockTests.java b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/AliasCreateMockTests.java index f1be02f28192..8a25390d6254 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/AliasCreateMockTests.java +++ b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/AliasCreateMockTests.java @@ -6,17 +6,20 @@ import com.azure.core.credential.AccessToken; import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; import com.azure.core.test.http.MockHttpResponse; import com.azure.resourcemanager.subscription.SubscriptionManager; import com.azure.resourcemanager.subscription.models.ProvisioningState; import com.azure.resourcemanager.subscription.models.PutAliasRequest; +import com.azure.resourcemanager.subscription.models.PutAliasRequestAdditionalProperties; import com.azure.resourcemanager.subscription.models.PutAliasRequestProperties; -import com.azure.resourcemanager.subscription.models.PutAliasResponse; +import com.azure.resourcemanager.subscription.models.SubscriptionAliasResponse; import com.azure.resourcemanager.subscription.models.Workload; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import reactor.core.publisher.Mono; @@ -25,24 +28,49 @@ public final class AliasCreateMockTests { @Test public void testCreate() throws Exception { String responseStr - = "{\"properties\":{\"subscriptionId\":\"c\",\"provisioningState\":\"Succeeded\"},\"id\":\"wooc\",\"name\":\"cbonqvpk\",\"type\":\"lrxnjeaseiphe\"}"; + = "{\"properties\":{\"subscriptionId\":\"hfiqscjeypvhe\",\"displayName\":\"kgqhcjrefovg\",\"provisioningState\":\"Succeeded\",\"acceptOwnershipUrl\":\"leyyvx\",\"acceptOwnershipState\":\"Expired\",\"billingScope\":\"k\",\"workload\":\"Production\",\"resellerId\":\"pngjcrcczsqpjhvm\",\"subscriptionOwnerId\":\"jvnysounqe\",\"managementGroupId\":\"noae\",\"createdTime\":\"fhyhltrpmopjmcma\",\"tags\":{\"aodsfcpkv\":\"kthfui\"}},\"id\":\"dpuozmyz\",\"name\":\"dagfuaxbezyiuok\",\"type\":\"twhrdxwzywqsm\"}"; HttpClient httpClient = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); SubscriptionManager manager = SubscriptionManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); - PutAliasResponse response = manager.alias() - .create("cfionl", - new PutAliasRequest().withProperties(new PutAliasRequestProperties().withDisplayName("x") - .withWorkload(Workload.PRODUCTION) - .withBillingScope("tzxdpnqbqqwx") - .withSubscriptionId("feallnwsu") - .withResellerId("snjampmng")), + SubscriptionAliasResponse response = manager.alias() + .create("dejbavo", + new PutAliasRequest().withProperties(new PutAliasRequestProperties().withDisplayName("dmoh") + .withWorkload(Workload.DEV_TEST) + .withBillingScope("vudwx") + .withSubscriptionId("dnvowg") + .withResellerId("jugwdkcglhsl") + .withAdditionalProperties( + new PutAliasRequestAdditionalProperties().withManagementGroupId("dyggdtjixhbku") + .withSubscriptionTenantId("qweykhmenev") + .withSubscriptionOwnerId("exfwhy") + .withTags(mapOf("naamde", "bvyvdcsity")))), com.azure.core.util.Context.NONE); + Assertions.assertEquals("kgqhcjrefovg", response.properties().displayName()); Assertions.assertEquals(ProvisioningState.SUCCEEDED, response.properties().provisioningState()); + Assertions.assertEquals("k", response.properties().billingScope()); + Assertions.assertEquals(Workload.PRODUCTION, response.properties().workload()); + Assertions.assertEquals("pngjcrcczsqpjhvm", response.properties().resellerId()); + Assertions.assertEquals("jvnysounqe", response.properties().subscriptionOwnerId()); + Assertions.assertEquals("noae", response.properties().managementGroupId()); + Assertions.assertEquals("fhyhltrpmopjmcma", response.properties().createdTime()); + Assertions.assertEquals("kthfui", response.properties().tags().get("aodsfcpkv")); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; } } diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/AliasDeleteWithResponseMockTests.java b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/AliasDeleteWithResponseMockTests.java index 23aafa58ef16..b402e9bbaaa8 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/AliasDeleteWithResponseMockTests.java +++ b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/AliasDeleteWithResponseMockTests.java @@ -6,8 +6,8 @@ import com.azure.core.credential.AccessToken; import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; import com.azure.core.test.http.MockHttpResponse; import com.azure.resourcemanager.subscription.SubscriptionManager; import java.nio.charset.StandardCharsets; @@ -25,9 +25,9 @@ public void testDeleteWithResponse() throws Exception { SubscriptionManager manager = SubscriptionManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); - manager.alias().deleteWithResponse("wdslfhotwmcy", com.azure.core.util.Context.NONE); + manager.alias().deleteWithResponse("kcciwwzjuqkhr", com.azure.core.util.Context.NONE); } } diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/AliasGetWithResponseMockTests.java b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/AliasGetWithResponseMockTests.java index b8dcc0e01202..71f234403638 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/AliasGetWithResponseMockTests.java +++ b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/AliasGetWithResponseMockTests.java @@ -6,12 +6,13 @@ import com.azure.core.credential.AccessToken; import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; import com.azure.core.test.http.MockHttpResponse; import com.azure.resourcemanager.subscription.SubscriptionManager; import com.azure.resourcemanager.subscription.models.ProvisioningState; -import com.azure.resourcemanager.subscription.models.PutAliasResponse; +import com.azure.resourcemanager.subscription.models.SubscriptionAliasResponse; +import com.azure.resourcemanager.subscription.models.Workload; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; import org.junit.jupiter.api.Assertions; @@ -22,17 +23,26 @@ public final class AliasGetWithResponseMockTests { @Test public void testGetWithResponse() throws Exception { String responseStr - = "{\"properties\":{\"subscriptionId\":\"eyy\",\"provisioningState\":\"Failed\"},\"id\":\"jbdlwtgrhpdjpju\",\"name\":\"asxazjpqyegualhb\",\"type\":\"xhejjzzvdud\"}"; + = "{\"properties\":{\"subscriptionId\":\"ryocfsfksymdd\",\"displayName\":\"tki\",\"provisioningState\":\"Failed\",\"acceptOwnershipUrl\":\"qyud\",\"acceptOwnershipState\":\"Expired\",\"billingScope\":\"qn\",\"workload\":\"Production\",\"resellerId\":\"zvyifqrvkdvj\",\"subscriptionOwnerId\":\"lrmv\",\"managementGroupId\":\"f\",\"createdTime\":\"t\",\"tags\":{\"ruwiqzbqjvsov\":\"pulexxbczw\"}},\"id\":\"okacspk\",\"name\":\"lhzdobp\",\"type\":\"jmflbvvnch\"}"; HttpClient httpClient = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); SubscriptionManager manager = SubscriptionManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); - PutAliasResponse response = manager.alias().getWithResponse("f", com.azure.core.util.Context.NONE).getValue(); + SubscriptionAliasResponse response + = manager.alias().getWithResponse("surex", com.azure.core.util.Context.NONE).getValue(); + Assertions.assertEquals("tki", response.properties().displayName()); Assertions.assertEquals(ProvisioningState.FAILED, response.properties().provisioningState()); + Assertions.assertEquals("qn", response.properties().billingScope()); + Assertions.assertEquals(Workload.PRODUCTION, response.properties().workload()); + Assertions.assertEquals("zvyifqrvkdvj", response.properties().resellerId()); + Assertions.assertEquals("lrmv", response.properties().subscriptionOwnerId()); + Assertions.assertEquals("f", response.properties().managementGroupId()); + Assertions.assertEquals("t", response.properties().createdTime()); + Assertions.assertEquals("pulexxbczw", response.properties().tags().get("ruwiqzbqjvsov")); } } diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/AliasListWithResponseMockTests.java b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/AliasListWithResponseMockTests.java index fc02f09116b1..0716fed3fc55 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/AliasListWithResponseMockTests.java +++ b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/AliasListWithResponseMockTests.java @@ -6,11 +6,11 @@ import com.azure.core.credential.AccessToken; import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; import com.azure.core.test.http.MockHttpResponse; import com.azure.resourcemanager.subscription.SubscriptionManager; -import com.azure.resourcemanager.subscription.models.PutAliasListResult; +import com.azure.resourcemanager.subscription.models.SubscriptionAliasListResult; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; import org.junit.jupiter.api.Test; @@ -20,16 +20,17 @@ public final class AliasListWithResponseMockTests { @Test public void testListWithResponse() throws Exception { String responseStr - = "{\"value\":[{\"properties\":{\"subscriptionId\":\"jnpg\",\"provisioningState\":\"Failed\"},\"id\":\"tadehxnltyfsopp\",\"name\":\"suesnzw\",\"type\":\"ej\"},{\"properties\":{\"subscriptionId\":\"orxzdmohctbqvud\",\"provisioningState\":\"Accepted\"},\"id\":\"ndnvo\",\"name\":\"gujjugwdkcglh\",\"type\":\"lazjdyggdtjixhbk\"},{\"properties\":{\"subscriptionId\":\"qweykhmenev\",\"provisioningState\":\"Succeeded\"},\"id\":\"xfw\",\"name\":\"ybcibvyvdcsit\",\"type\":\"nnaamdectehfiqsc\"},{\"properties\":{\"subscriptionId\":\"pvhez\",\"provisioningState\":\"Succeeded\"},\"id\":\"q\",\"name\":\"c\",\"type\":\"refovgmkqsleyyvx\"}],\"nextLink\":\"jpkcattpng\"}"; + = "{\"value\":[{\"properties\":{\"subscriptionId\":\"ku\",\"displayName\":\"oskg\",\"provisioningState\":\"Failed\",\"acceptOwnershipUrl\":\"uimjmvx\",\"acceptOwnershipState\":\"Pending\",\"billingScope\":\"ugidyjrr\",\"workload\":\"Production\",\"resellerId\":\"osvexcsonpclhoc\",\"subscriptionOwnerId\":\"slkevle\",\"managementGroupId\":\"zfbuhf\",\"createdTime\":\"faxkffeii\",\"tags\":{\"shxmzsbbzoggigrx\":\"vmezy\",\"ptkoenkoukn\":\"burvjxxjnspy\",\"ngkpocipazy\":\"udwtiukbl\",\"gukgjnpiucgygevq\":\"o\"}},\"id\":\"typmrbpizcdrqjsd\",\"name\":\"ydnfyhxdeoejz\",\"type\":\"cwif\"},{\"properties\":{\"subscriptionId\":\"tgzfbishcbkh\",\"displayName\":\"deyeamdphagalpbu\",\"provisioningState\":\"Failed\",\"acceptOwnershipUrl\":\"pwhonowkg\",\"acceptOwnershipState\":\"Pending\",\"billingScope\":\"nkixzbinj\",\"workload\":\"DevTest\",\"resellerId\":\"tmryw\",\"subscriptionOwnerId\":\"zoqftiyqzrnkcqvy\",\"managementGroupId\":\"whzlsicohoq\",\"createdTime\":\"wvl\",\"tags\":{\"konocu\":\"vwhheunmmqhgyx\",\"zf\":\"oklyaxuconuq\",\"vjektcxsenh\":\"beypewrmjmw\"}},\"id\":\"rsffrzpwvlqdqgbi\",\"name\":\"ylihkaetckt\",\"type\":\"fcivfsnkym\"},{\"properties\":{\"subscriptionId\":\"qhjfbebr\",\"displayName\":\"xerf\",\"provisioningState\":\"Accepted\",\"acceptOwnershipUrl\":\"ttxfvjr\",\"acceptOwnershipState\":\"Completed\",\"billingScope\":\"hxepcyvahfnlj\",\"workload\":\"Production\",\"resellerId\":\"j\",\"subscriptionOwnerId\":\"ujqgidok\",\"managementGroupId\":\"ljyoxgvcltb\",\"createdTime\":\"ncghkje\",\"tags\":{\"smx\":\"hbijhtxfvgxb\",\"pvecxgodeb\":\"eh\",\"pukgriwflzlfb\":\"qkkrb\"}},\"id\":\"puz\",\"name\":\"cispnqzahmgkbr\",\"type\":\"yydhibnuqqk\"},{\"properties\":{\"subscriptionId\":\"a\",\"displayName\":\"gvtqagnbuynh\",\"provisioningState\":\"Failed\",\"acceptOwnershipUrl\":\"mebf\",\"acceptOwnershipState\":\"Pending\",\"billingScope\":\"butr\",\"workload\":\"Production\",\"resellerId\":\"azzmhjrunmpxt\",\"subscriptionOwnerId\":\"bh\",\"managementGroupId\":\"nlankxmyskpb\",\"createdTime\":\"nbtkcxywnytnr\",\"tags\":{\"czfc\":\"lqidyby\",\"rqlfktsthsucocmn\":\"haaxdbabphl\",\"ckzywbiexzfeyue\":\"yazttbtwwrqpue\"}},\"id\":\"ibx\",\"name\":\"jwbhqwalmuz\",\"type\":\"oxaepd\"}],\"nextLink\":\"jancu\"}"; HttpClient httpClient = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); SubscriptionManager manager = SubscriptionManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); - PutAliasListResult response = manager.alias().listWithResponse(com.azure.core.util.Context.NONE).getValue(); + SubscriptionAliasListResult response + = manager.alias().listWithResponse(com.azure.core.util.Context.NONE).getValue(); } } diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/BillingAccountPoliciesResponseInnerTests.java b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/BillingAccountPoliciesResponseInnerTests.java new file mode 100644 index 000000000000..fc1b7f71a9fc --- /dev/null +++ b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/BillingAccountPoliciesResponseInnerTests.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.subscription.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.subscription.fluent.models.BillingAccountPoliciesResponseInner; +import com.azure.resourcemanager.subscription.models.BillingAccountPoliciesResponseProperties; +import com.azure.resourcemanager.subscription.models.ServiceTenantResponse; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class BillingAccountPoliciesResponseInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + BillingAccountPoliciesResponseInner model = BinaryData.fromString( + "{\"properties\":{\"serviceTenants\":[{\"tenantId\":\"dntwndeicbtw\",\"tenantName\":\"zao\"},{\"tenantId\":\"uhrhcffcyddgl\",\"tenantName\":\"t\"}],\"allowTransfers\":true},\"id\":\"wpyeicxmqciwqvh\",\"name\":\"hix\",\"type\":\"igdtopbob\"}") + .toObject(BillingAccountPoliciesResponseInner.class); + Assertions.assertEquals("dntwndeicbtw", model.properties().serviceTenants().get(0).tenantId()); + Assertions.assertEquals("zao", model.properties().serviceTenants().get(0).tenantName()); + Assertions.assertTrue(model.properties().allowTransfers()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + BillingAccountPoliciesResponseInner model + = new BillingAccountPoliciesResponseInner().withProperties(new BillingAccountPoliciesResponseProperties() + .withServiceTenants( + Arrays.asList(new ServiceTenantResponse().withTenantId("dntwndeicbtw").withTenantName("zao"), + new ServiceTenantResponse().withTenantId("uhrhcffcyddgl").withTenantName("t"))) + .withAllowTransfers(true)); + model = BinaryData.fromObject(model).toObject(BillingAccountPoliciesResponseInner.class); + Assertions.assertEquals("dntwndeicbtw", model.properties().serviceTenants().get(0).tenantId()); + Assertions.assertEquals("zao", model.properties().serviceTenants().get(0).tenantName()); + Assertions.assertTrue(model.properties().allowTransfers()); + } +} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/BillingAccountPoliciesResponsePropertiesTests.java b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/BillingAccountPoliciesResponsePropertiesTests.java new file mode 100644 index 000000000000..a2f81c8a6dd9 --- /dev/null +++ b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/BillingAccountPoliciesResponsePropertiesTests.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.subscription.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.subscription.models.BillingAccountPoliciesResponseProperties; +import com.azure.resourcemanager.subscription.models.ServiceTenantResponse; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class BillingAccountPoliciesResponsePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + BillingAccountPoliciesResponseProperties model = BinaryData.fromString( + "{\"serviceTenants\":[{\"tenantId\":\"m\",\"tenantName\":\"u\"},{\"tenantId\":\"a\",\"tenantName\":\"rzayv\"}],\"allowTransfers\":false}") + .toObject(BillingAccountPoliciesResponseProperties.class); + Assertions.assertEquals("m", model.serviceTenants().get(0).tenantId()); + Assertions.assertEquals("u", model.serviceTenants().get(0).tenantName()); + Assertions.assertFalse(model.allowTransfers()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + BillingAccountPoliciesResponseProperties model + = new BillingAccountPoliciesResponseProperties() + .withServiceTenants(Arrays.asList(new ServiceTenantResponse().withTenantId("m").withTenantName("u"), + new ServiceTenantResponse().withTenantId("a").withTenantName("rzayv"))) + .withAllowTransfers(false); + model = BinaryData.fromObject(model).toObject(BillingAccountPoliciesResponseProperties.class); + Assertions.assertEquals("m", model.serviceTenants().get(0).tenantId()); + Assertions.assertEquals("u", model.serviceTenants().get(0).tenantName()); + Assertions.assertFalse(model.allowTransfers()); + } +} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/BillingAccountsGetPolicyWithResponseMockTests.java b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/BillingAccountsGetPolicyWithResponseMockTests.java new file mode 100644 index 000000000000..15dedf40bb2d --- /dev/null +++ b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/BillingAccountsGetPolicyWithResponseMockTests.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.subscription.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.subscription.SubscriptionManager; +import com.azure.resourcemanager.subscription.models.BillingAccountPoliciesResponse; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class BillingAccountsGetPolicyWithResponseMockTests { + @Test + public void testGetPolicyWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"serviceTenants\":[{\"tenantId\":\"hsmtxpsiebtfhvp\",\"tenantName\":\"apskrdqm\"},{\"tenantId\":\"jdhtldwkyzxu\",\"tenantName\":\"kn\"},{\"tenantId\":\"scwsv\",\"tenantName\":\"otogtwrupqs\"}],\"allowTransfers\":false},\"id\":\"i\",\"name\":\"ykvceoveil\",\"type\":\"vnotyfjfcnj\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + SubscriptionManager manager = SubscriptionManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + BillingAccountPoliciesResponse response = manager.billingAccounts() + .getPolicyWithResponse("baumnyqupedeoj", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("hsmtxpsiebtfhvp", response.properties().serviceTenants().get(0).tenantId()); + Assertions.assertEquals("apskrdqm", response.properties().serviceTenants().get(0).tenantName()); + Assertions.assertFalse(response.properties().allowTransfers()); + } +} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/CanceledSubscriptionIdInnerTests.java b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/CanceledSubscriptionIdInnerTests.java index fc7753b780df..d4a2bdb5efb0 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/CanceledSubscriptionIdInnerTests.java +++ b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/CanceledSubscriptionIdInnerTests.java @@ -11,7 +11,7 @@ public final class CanceledSubscriptionIdInnerTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { CanceledSubscriptionIdInner model - = BinaryData.fromString("{\"subscriptionId\":\"xth\"}").toObject(CanceledSubscriptionIdInner.class); + = BinaryData.fromString("{\"subscriptionId\":\"mhquvgjxp\"}").toObject(CanceledSubscriptionIdInner.class); } @org.junit.jupiter.api.Test diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/EnabledSubscriptionIdInnerTests.java b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/EnabledSubscriptionIdInnerTests.java index 1dca36d03d39..f288b143f4b3 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/EnabledSubscriptionIdInnerTests.java +++ b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/EnabledSubscriptionIdInnerTests.java @@ -10,8 +10,8 @@ public final class EnabledSubscriptionIdInnerTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { - EnabledSubscriptionIdInner model = BinaryData.fromString("{\"subscriptionId\":\"fygxgispemvtzfk\"}") - .toObject(EnabledSubscriptionIdInner.class); + EnabledSubscriptionIdInner model + = BinaryData.fromString("{\"subscriptionId\":\"sybbejhph\"}").toObject(EnabledSubscriptionIdInner.class); } @org.junit.jupiter.api.Test diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/GetTenantPolicyListResponseTests.java b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/GetTenantPolicyListResponseTests.java new file mode 100644 index 000000000000..8449d1981848 --- /dev/null +++ b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/GetTenantPolicyListResponseTests.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.subscription.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.subscription.models.GetTenantPolicyListResponse; + +public final class GetTenantPolicyListResponseTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + GetTenantPolicyListResponse model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"policyId\":\"qp\",\"blockSubscriptionsLeavingTenant\":true,\"blockSubscriptionsIntoTenant\":true,\"exemptedPrincipals\":[\"2b95eae0-4f72-4415-8670-7eafa754eca1\",\"aa241099-ea8c-412c-950c-0a19bcdfd64f\",\"edffc2d8-e98d-4083-b58d-ce32dc97fed0\"]},\"id\":\"pimexgstxgcpodg\",\"name\":\"aajrm\",\"type\":\"djwzrlov\"},{\"properties\":{\"policyId\":\"whijcoejctbza\",\"blockSubscriptionsLeavingTenant\":true,\"blockSubscriptionsIntoTenant\":false,\"exemptedPrincipals\":[\"9b259564-6bc1-4d45-8c15-53935445a00b\",\"4a7d196e-1c00-4d40-b1e0-741e384bd788\",\"68103724-7e6f-4f87-a0c5-4bdfce25d21d\"]},\"id\":\"bfkgukdkex\",\"name\":\"ppofmxaxcfjpgdd\",\"type\":\"ocjjxhvpmouexh\"}],\"nextLink\":\"xibqeojnx\"}") + .toObject(GetTenantPolicyListResponse.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + GetTenantPolicyListResponse model = new GetTenantPolicyListResponse(); + model = BinaryData.fromObject(model).toObject(GetTenantPolicyListResponse.class); + } +} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/GetTenantPolicyResponseInnerTests.java b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/GetTenantPolicyResponseInnerTests.java new file mode 100644 index 000000000000..c1ba26fcdc29 --- /dev/null +++ b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/GetTenantPolicyResponseInnerTests.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.subscription.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.subscription.fluent.models.GetTenantPolicyResponseInner; +import com.azure.resourcemanager.subscription.models.TenantPolicy; +import java.util.Arrays; +import java.util.UUID; +import org.junit.jupiter.api.Assertions; + +public final class GetTenantPolicyResponseInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + GetTenantPolicyResponseInner model = BinaryData.fromString( + "{\"properties\":{\"policyId\":\"rlkhbzhfepgzgq\",\"blockSubscriptionsLeavingTenant\":false,\"blockSubscriptionsIntoTenant\":true,\"exemptedPrincipals\":[\"faa5569a-344c-499a-9038-62aefecd133c\",\"fec1e915-abaa-4928-88c9-54a9753b0ee7\",\"b7bcbf80-dfdb-48a4-9820-9f9bf99ccde9\"]},\"id\":\"c\",\"name\":\"aierhhb\",\"type\":\"sglumma\"}") + .toObject(GetTenantPolicyResponseInner.class); + Assertions.assertFalse(model.properties().blockSubscriptionsLeavingTenant()); + Assertions.assertTrue(model.properties().blockSubscriptionsIntoTenant()); + Assertions.assertEquals(UUID.fromString("faa5569a-344c-499a-9038-62aefecd133c"), + model.properties().exemptedPrincipals().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + GetTenantPolicyResponseInner model = new GetTenantPolicyResponseInner() + .withProperties(new TenantPolicy().withBlockSubscriptionsLeavingTenant(false) + .withBlockSubscriptionsIntoTenant(true) + .withExemptedPrincipals(Arrays.asList(UUID.fromString("faa5569a-344c-499a-9038-62aefecd133c"), + UUID.fromString("fec1e915-abaa-4928-88c9-54a9753b0ee7"), + UUID.fromString("b7bcbf80-dfdb-48a4-9820-9f9bf99ccde9")))); + model = BinaryData.fromObject(model).toObject(GetTenantPolicyResponseInner.class); + Assertions.assertFalse(model.properties().blockSubscriptionsLeavingTenant()); + Assertions.assertTrue(model.properties().blockSubscriptionsIntoTenant()); + Assertions.assertEquals(UUID.fromString("faa5569a-344c-499a-9038-62aefecd133c"), + model.properties().exemptedPrincipals().get(0)); + } +} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/LocationInnerTests.java b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/LocationInnerTests.java deleted file mode 100644 index 65b1c1b686d7..000000000000 --- a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/LocationInnerTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.subscription.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.subscription.fluent.models.LocationInner; - -public final class LocationInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - LocationInner model = BinaryData.fromString( - "{\"id\":\"pewnw\",\"subscriptionId\":\"itjz\",\"name\":\"lusarh\",\"displayName\":\"fcqhsmyurkd\",\"latitude\":\"lx\",\"longitude\":\"kuksjtxukcdm\"}") - .toObject(LocationInner.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - LocationInner model = new LocationInner(); - model = BinaryData.fromObject(model).toObject(LocationInner.class); - } -} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/LocationListResultTests.java b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/LocationListResultTests.java deleted file mode 100644 index 8c888458e351..000000000000 --- a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/LocationListResultTests.java +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.subscription.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.subscription.fluent.models.LocationInner; -import com.azure.resourcemanager.subscription.models.LocationListResult; -import java.util.Arrays; - -public final class LocationListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - LocationListResult model = BinaryData.fromString( - "{\"value\":[{\"id\":\"quvgjxpybczme\",\"subscriptionId\":\"tzopbsphrupidgsy\",\"name\":\"ejhphoyc\",\"displayName\":\"xaobhdxbmtqioqjz\",\"latitude\":\"tbmufpo\",\"longitude\":\"oizh\"},{\"id\":\"rxybqsoq\",\"subscriptionId\":\"gkdmb\",\"name\":\"zlobcufpd\",\"displayName\":\"rbt\",\"latitude\":\"qjnqglhqgnufoooj\",\"longitude\":\"ifsqesaagdfmg\"},{\"id\":\"lhjxr\",\"subscriptionId\":\"kwm\",\"name\":\"ktsizntocipaou\",\"displayName\":\"psqucmpoyf\",\"latitude\":\"fogknygjofjdde\",\"longitude\":\"rd\"}]}") - .toObject(LocationListResult.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - LocationListResult model = new LocationListResult() - .withValue(Arrays.asList(new LocationInner(), new LocationInner(), new LocationInner())); - model = BinaryData.fromObject(model).toObject(LocationListResult.class); - } -} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/OperationDisplayTests.java b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/OperationDisplayTests.java index ce6142786e6e..ccf13e3f44d6 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/OperationDisplayTests.java +++ b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/OperationDisplayTests.java @@ -11,21 +11,25 @@ public final class OperationDisplayTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { - OperationDisplay model - = BinaryData.fromString("{\"provider\":\"ftyxolniw\",\"resource\":\"cukjf\",\"operation\":\"iawxklry\"}") - .toObject(OperationDisplay.class); - Assertions.assertEquals("ftyxolniw", model.provider()); - Assertions.assertEquals("cukjf", model.resource()); - Assertions.assertEquals("iawxklry", model.operation()); + OperationDisplay model = BinaryData.fromString( + "{\"provider\":\"ktsizntocipaou\",\"resource\":\"psqucmpoyf\",\"operation\":\"fogknygjofjdde\",\"description\":\"rd\"}") + .toObject(OperationDisplay.class); + Assertions.assertEquals("ktsizntocipaou", model.provider()); + Assertions.assertEquals("psqucmpoyf", model.resource()); + Assertions.assertEquals("fogknygjofjdde", model.operation()); + Assertions.assertEquals("rd", model.description()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - OperationDisplay model - = new OperationDisplay().withProvider("ftyxolniw").withResource("cukjf").withOperation("iawxklry"); + OperationDisplay model = new OperationDisplay().withProvider("ktsizntocipaou") + .withResource("psqucmpoyf") + .withOperation("fogknygjofjdde") + .withDescription("rd"); model = BinaryData.fromObject(model).toObject(OperationDisplay.class); - Assertions.assertEquals("ftyxolniw", model.provider()); - Assertions.assertEquals("cukjf", model.resource()); - Assertions.assertEquals("iawxklry", model.operation()); + Assertions.assertEquals("ktsizntocipaou", model.provider()); + Assertions.assertEquals("psqucmpoyf", model.resource()); + Assertions.assertEquals("fogknygjofjdde", model.operation()); + Assertions.assertEquals("rd", model.description()); } } diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/OperationInnerTests.java b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/OperationInnerTests.java new file mode 100644 index 000000000000..0930948726d7 --- /dev/null +++ b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/OperationInnerTests.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.subscription.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.subscription.fluent.models.OperationInner; +import com.azure.resourcemanager.subscription.models.OperationDisplay; +import org.junit.jupiter.api.Assertions; + +public final class OperationInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationInner model = BinaryData.fromString( + "{\"name\":\"pdznrbtcqqjnqgl\",\"isDataAction\":false,\"display\":{\"provider\":\"foooj\",\"resource\":\"ifsqesaagdfmg\",\"operation\":\"lhjxr\",\"description\":\"kwm\"}}") + .toObject(OperationInner.class); + Assertions.assertEquals("pdznrbtcqqjnqgl", model.name()); + Assertions.assertFalse(model.isDataAction()); + Assertions.assertEquals("foooj", model.display().provider()); + Assertions.assertEquals("ifsqesaagdfmg", model.display().resource()); + Assertions.assertEquals("lhjxr", model.display().operation()); + Assertions.assertEquals("kwm", model.display().description()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OperationInner model = new OperationInner().withName("pdznrbtcqqjnqgl") + .withIsDataAction(false) + .withDisplay(new OperationDisplay().withProvider("foooj") + .withResource("ifsqesaagdfmg") + .withOperation("lhjxr") + .withDescription("kwm")); + model = BinaryData.fromObject(model).toObject(OperationInner.class); + Assertions.assertEquals("pdznrbtcqqjnqgl", model.name()); + Assertions.assertFalse(model.isDataAction()); + Assertions.assertEquals("foooj", model.display().provider()); + Assertions.assertEquals("ifsqesaagdfmg", model.display().resource()); + Assertions.assertEquals("lhjxr", model.display().operation()); + Assertions.assertEquals("kwm", model.display().description()); + } +} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/OperationListResultInnerTests.java b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/OperationListResultInnerTests.java deleted file mode 100644 index 8bdcb2d98832..000000000000 --- a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/OperationListResultInnerTests.java +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.subscription.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.subscription.fluent.models.OperationListResultInner; -import com.azure.resourcemanager.subscription.models.Operation; -import com.azure.resourcemanager.subscription.models.OperationDisplay; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class OperationListResultInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OperationListResultInner model = BinaryData.fromString( - "{\"value\":[{\"name\":\"ljofxqeofjaeqjh\",\"display\":{\"provider\":\"asvm\",\"resource\":\"jqul\",\"operation\":\"sntnbybkzgcw\"}},{\"name\":\"clxxwrljdo\",\"display\":{\"provider\":\"cqvkocrcjdkwtn\",\"resource\":\"bnjbiksqrglssain\",\"operation\":\"jwnzlljfmp\"}},{\"name\":\"ebvmgxsabkyqd\",\"display\":{\"provider\":\"itcjczdz\",\"resource\":\"ndhkrw\",\"operation\":\"appd\"}}],\"nextLink\":\"dkvwrwjfe\"}") - .toObject(OperationListResultInner.class); - Assertions.assertEquals("ljofxqeofjaeqjh", model.value().get(0).name()); - Assertions.assertEquals("asvm", model.value().get(0).display().provider()); - Assertions.assertEquals("jqul", model.value().get(0).display().resource()); - Assertions.assertEquals("sntnbybkzgcw", model.value().get(0).display().operation()); - Assertions.assertEquals("dkvwrwjfe", model.nextLink()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OperationListResultInner model = new OperationListResultInner() - .withValue(Arrays.asList( - new Operation().withName("ljofxqeofjaeqjh") - .withDisplay( - new OperationDisplay().withProvider("asvm").withResource("jqul").withOperation("sntnbybkzgcw")), - new Operation().withName("clxxwrljdo") - .withDisplay(new OperationDisplay().withProvider("cqvkocrcjdkwtn") - .withResource("bnjbiksqrglssain") - .withOperation("jwnzlljfmp")), - new Operation().withName("ebvmgxsabkyqd") - .withDisplay( - new OperationDisplay().withProvider("itcjczdz").withResource("ndhkrw").withOperation("appd")))) - .withNextLink("dkvwrwjfe"); - model = BinaryData.fromObject(model).toObject(OperationListResultInner.class); - Assertions.assertEquals("ljofxqeofjaeqjh", model.value().get(0).name()); - Assertions.assertEquals("asvm", model.value().get(0).display().provider()); - Assertions.assertEquals("jqul", model.value().get(0).display().resource()); - Assertions.assertEquals("sntnbybkzgcw", model.value().get(0).display().operation()); - Assertions.assertEquals("dkvwrwjfe", model.nextLink()); - } -} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/OperationListResultTests.java b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/OperationListResultTests.java new file mode 100644 index 000000000000..f100e8dcb77e --- /dev/null +++ b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/OperationListResultTests.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.subscription.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.subscription.fluent.models.OperationInner; +import com.azure.resourcemanager.subscription.models.OperationDisplay; +import com.azure.resourcemanager.subscription.models.OperationListResult; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class OperationListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationListResult model = BinaryData.fromString( + "{\"value\":[{\"name\":\"qj\",\"isDataAction\":false,\"display\":{\"provider\":\"muf\",\"resource\":\"wnoi\",\"operation\":\"wlrxyb\",\"description\":\"oqijgkdmbpaz\"}}],\"nextLink\":\"bc\"}") + .toObject(OperationListResult.class); + Assertions.assertEquals("qj", model.value().get(0).name()); + Assertions.assertFalse(model.value().get(0).isDataAction()); + Assertions.assertEquals("muf", model.value().get(0).display().provider()); + Assertions.assertEquals("wnoi", model.value().get(0).display().resource()); + Assertions.assertEquals("wlrxyb", model.value().get(0).display().operation()); + Assertions.assertEquals("oqijgkdmbpaz", model.value().get(0).display().description()); + Assertions.assertEquals("bc", model.nextLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OperationListResult model + = new OperationListResult().withValue(Arrays.asList(new OperationInner().withName("qj") + .withIsDataAction(false) + .withDisplay(new OperationDisplay().withProvider("muf") + .withResource("wnoi") + .withOperation("wlrxyb") + .withDescription("oqijgkdmbpaz")))) + .withNextLink("bc"); + model = BinaryData.fromObject(model).toObject(OperationListResult.class); + Assertions.assertEquals("qj", model.value().get(0).name()); + Assertions.assertFalse(model.value().get(0).isDataAction()); + Assertions.assertEquals("muf", model.value().get(0).display().provider()); + Assertions.assertEquals("wnoi", model.value().get(0).display().resource()); + Assertions.assertEquals("wlrxyb", model.value().get(0).display().operation()); + Assertions.assertEquals("oqijgkdmbpaz", model.value().get(0).display().description()); + Assertions.assertEquals("bc", model.nextLink()); + } +} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/OperationTests.java b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/OperationTests.java deleted file mode 100644 index 4c54e5d958f6..000000000000 --- a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/OperationTests.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.subscription.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.subscription.models.Operation; -import com.azure.resourcemanager.subscription.models.OperationDisplay; -import org.junit.jupiter.api.Assertions; - -public final class OperationTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - Operation model = BinaryData.fromString( - "{\"name\":\"nhutjeltmrldhugj\",\"display\":{\"provider\":\"atqxho\",\"resource\":\"geablgphuticndvk\",\"operation\":\"zwyiftyhxhur\"}}") - .toObject(Operation.class); - Assertions.assertEquals("nhutjeltmrldhugj", model.name()); - Assertions.assertEquals("atqxho", model.display().provider()); - Assertions.assertEquals("geablgphuticndvk", model.display().resource()); - Assertions.assertEquals("zwyiftyhxhur", model.display().operation()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - Operation model = new Operation().withName("nhutjeltmrldhugj") - .withDisplay(new OperationDisplay().withProvider("atqxho") - .withResource("geablgphuticndvk") - .withOperation("zwyiftyhxhur")); - model = BinaryData.fromObject(model).toObject(Operation.class); - Assertions.assertEquals("nhutjeltmrldhugj", model.name()); - Assertions.assertEquals("atqxho", model.display().provider()); - Assertions.assertEquals("geablgphuticndvk", model.display().resource()); - Assertions.assertEquals("zwyiftyhxhur", model.display().operation()); - } -} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/OperationsListMockTests.java b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/OperationsListMockTests.java new file mode 100644 index 000000000000..9d236d011483 --- /dev/null +++ b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/OperationsListMockTests.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.subscription.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.subscription.SubscriptionManager; +import com.azure.resourcemanager.subscription.models.Operation; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class OperationsListMockTests { + @Test + public void testList() throws Exception { + String responseStr + = "{\"value\":[{\"name\":\"djpjumasxazjpq\",\"isDataAction\":false,\"display\":{\"provider\":\"lhbxxhejjzzvdud\",\"resource\":\"dslfhotwmcy\",\"operation\":\"wlbjnpgacftade\",\"description\":\"nltyfsoppusuesnz\"}}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + SubscriptionManager manager = SubscriptionManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response = manager.operations().list(com.azure.core.util.Context.NONE); + + Assertions.assertEquals("djpjumasxazjpq", response.iterator().next().name()); + Assertions.assertFalse(response.iterator().next().isDataAction()); + Assertions.assertEquals("lhbxxhejjzzvdud", response.iterator().next().display().provider()); + Assertions.assertEquals("dslfhotwmcy", response.iterator().next().display().resource()); + Assertions.assertEquals("wlbjnpgacftade", response.iterator().next().display().operation()); + Assertions.assertEquals("nltyfsoppusuesnz", response.iterator().next().display().description()); + } +} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/OperationsListWithResponseMockTests.java b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/OperationsListWithResponseMockTests.java deleted file mode 100644 index e27cccc19387..000000000000 --- a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/OperationsListWithResponseMockTests.java +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.subscription.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.subscription.SubscriptionManager; -import com.azure.resourcemanager.subscription.models.OperationListResult; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class OperationsListWithResponseMockTests { - @Test - public void testListWithResponse() throws Exception { - String responseStr - = "{\"value\":[{\"name\":\"rhcffcydd\",\"display\":{\"provider\":\"jthjqkwpyei\",\"resource\":\"mqc\",\"operation\":\"q\"}},{\"name\":\"khixuigdtopbo\",\"display\":{\"provider\":\"ghmewuam\",\"resource\":\"hrzayvvtpgvdf\",\"operation\":\"otkftutqxlngx\"}},{\"name\":\"fgugnxkrxdqmid\",\"display\":{\"provider\":\"zrvqdr\",\"resource\":\"hjybigehoqfbo\",\"operation\":\"kanyktzlcuiywg\"}},{\"name\":\"wgndrvynhzgpp\",\"display\":{\"provider\":\"gyncocpecfvmmc\",\"resource\":\"fsxlzevgbmqjqa\",\"operation\":\"y\"}}],\"nextLink\":\"ivkwlzuvccfwnfnb\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - SubscriptionManager manager = SubscriptionManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - OperationListResult response - = manager.operations().listWithResponse(com.azure.core.util.Context.NONE).getValue(); - - Assertions.assertEquals("rhcffcydd", response.value().get(0).name()); - Assertions.assertEquals("jthjqkwpyei", response.value().get(0).display().provider()); - Assertions.assertEquals("mqc", response.value().get(0).display().resource()); - Assertions.assertEquals("q", response.value().get(0).display().operation()); - Assertions.assertEquals("ivkwlzuvccfwnfnb", response.nextLink()); - } -} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/PutAliasListResultInnerTests.java b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/PutAliasListResultInnerTests.java deleted file mode 100644 index 1470c3b4b69d..000000000000 --- a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/PutAliasListResultInnerTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.subscription.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.subscription.fluent.models.PutAliasListResultInner; - -public final class PutAliasListResultInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - PutAliasListResultInner model = BinaryData.fromString( - "{\"value\":[{\"properties\":{\"subscriptionId\":\"qux\",\"provisioningState\":\"Succeeded\"},\"id\":\"yjgzjaoyfhrtxiln\",\"name\":\"rkujy\",\"type\":\"vlejuvfqa\"},{\"properties\":{\"subscriptionId\":\"yxwjkcp\",\"provisioningState\":\"Failed\"},\"id\":\"wbxgjvt\",\"name\":\"vpys\",\"type\":\"zdn\"}],\"nextLink\":\"jq\"}") - .toObject(PutAliasListResultInner.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - PutAliasListResultInner model = new PutAliasListResultInner(); - model = BinaryData.fromObject(model).toObject(PutAliasListResultInner.class); - } -} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/PutAliasRequestAdditionalPropertiesTests.java b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/PutAliasRequestAdditionalPropertiesTests.java new file mode 100644 index 000000000000..b2171a0a57df --- /dev/null +++ b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/PutAliasRequestAdditionalPropertiesTests.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.subscription.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.subscription.models.PutAliasRequestAdditionalProperties; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class PutAliasRequestAdditionalPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PutAliasRequestAdditionalProperties model = BinaryData.fromString( + "{\"managementGroupId\":\"wvukx\",\"subscriptionTenantId\":\"udccsnhsjc\",\"subscriptionOwnerId\":\"ejhkry\",\"tags\":{\"lokjyemkk\":\"apcz\",\"joxzjnchgejspodm\":\"ni\",\"h\":\"ilzyd\"}}") + .toObject(PutAliasRequestAdditionalProperties.class); + Assertions.assertEquals("wvukx", model.managementGroupId()); + Assertions.assertEquals("udccsnhsjc", model.subscriptionTenantId()); + Assertions.assertEquals("ejhkry", model.subscriptionOwnerId()); + Assertions.assertEquals("apcz", model.tags().get("lokjyemkk")); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PutAliasRequestAdditionalProperties model + = new PutAliasRequestAdditionalProperties().withManagementGroupId("wvukx") + .withSubscriptionTenantId("udccsnhsjc") + .withSubscriptionOwnerId("ejhkry") + .withTags(mapOf("lokjyemkk", "apcz", "joxzjnchgejspodm", "ni", "h", "ilzyd")); + model = BinaryData.fromObject(model).toObject(PutAliasRequestAdditionalProperties.class); + Assertions.assertEquals("wvukx", model.managementGroupId()); + Assertions.assertEquals("udccsnhsjc", model.subscriptionTenantId()); + Assertions.assertEquals("ejhkry", model.subscriptionOwnerId()); + Assertions.assertEquals("apcz", model.tags().get("lokjyemkk")); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/PutAliasRequestPropertiesTests.java b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/PutAliasRequestPropertiesTests.java index e28d914e45f7..559f4b4fb6f6 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/PutAliasRequestPropertiesTests.java +++ b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/PutAliasRequestPropertiesTests.java @@ -5,35 +5,62 @@ package com.azure.resourcemanager.subscription.generated; import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.subscription.models.PutAliasRequestAdditionalProperties; import com.azure.resourcemanager.subscription.models.PutAliasRequestProperties; import com.azure.resourcemanager.subscription.models.Workload; +import java.util.HashMap; +import java.util.Map; import org.junit.jupiter.api.Assertions; public final class PutAliasRequestPropertiesTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { PutAliasRequestProperties model = BinaryData.fromString( - "{\"displayName\":\"akeqs\",\"workload\":\"Production\",\"billingScope\":\"zqqedq\",\"subscriptionId\":\"bciqfouflm\",\"resellerId\":\"kzsmodm\"}") + "{\"displayName\":\"nryrtihf\",\"workload\":\"DevTest\",\"billingScope\":\"bpzvgn\",\"subscriptionId\":\"symglzufcyz\",\"resellerId\":\"hdbihan\",\"additionalProperties\":{\"managementGroupId\":\"fcbjysagithxqha\",\"subscriptionTenantId\":\"fpikxwczb\",\"subscriptionOwnerId\":\"cnpqxuhivyqniwby\",\"tags\":{\"mjgr\":\"xvd\"}}}") .toObject(PutAliasRequestProperties.class); - Assertions.assertEquals("akeqs", model.displayName()); - Assertions.assertEquals(Workload.PRODUCTION, model.workload()); - Assertions.assertEquals("zqqedq", model.billingScope()); - Assertions.assertEquals("bciqfouflm", model.subscriptionId()); - Assertions.assertEquals("kzsmodm", model.resellerId()); + Assertions.assertEquals("nryrtihf", model.displayName()); + Assertions.assertEquals(Workload.DEV_TEST, model.workload()); + Assertions.assertEquals("bpzvgn", model.billingScope()); + Assertions.assertEquals("symglzufcyz", model.subscriptionId()); + Assertions.assertEquals("hdbihan", model.resellerId()); + Assertions.assertEquals("fcbjysagithxqha", model.additionalProperties().managementGroupId()); + Assertions.assertEquals("fpikxwczb", model.additionalProperties().subscriptionTenantId()); + Assertions.assertEquals("cnpqxuhivyqniwby", model.additionalProperties().subscriptionOwnerId()); + Assertions.assertEquals("xvd", model.additionalProperties().tags().get("mjgr")); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - PutAliasRequestProperties model = new PutAliasRequestProperties().withDisplayName("akeqs") - .withWorkload(Workload.PRODUCTION) - .withBillingScope("zqqedq") - .withSubscriptionId("bciqfouflm") - .withResellerId("kzsmodm"); + PutAliasRequestProperties model = new PutAliasRequestProperties().withDisplayName("nryrtihf") + .withWorkload(Workload.DEV_TEST) + .withBillingScope("bpzvgn") + .withSubscriptionId("symglzufcyz") + .withResellerId("hdbihan") + .withAdditionalProperties(new PutAliasRequestAdditionalProperties().withManagementGroupId("fcbjysagithxqha") + .withSubscriptionTenantId("fpikxwczb") + .withSubscriptionOwnerId("cnpqxuhivyqniwby") + .withTags(mapOf("mjgr", "xvd"))); model = BinaryData.fromObject(model).toObject(PutAliasRequestProperties.class); - Assertions.assertEquals("akeqs", model.displayName()); - Assertions.assertEquals(Workload.PRODUCTION, model.workload()); - Assertions.assertEquals("zqqedq", model.billingScope()); - Assertions.assertEquals("bciqfouflm", model.subscriptionId()); - Assertions.assertEquals("kzsmodm", model.resellerId()); + Assertions.assertEquals("nryrtihf", model.displayName()); + Assertions.assertEquals(Workload.DEV_TEST, model.workload()); + Assertions.assertEquals("bpzvgn", model.billingScope()); + Assertions.assertEquals("symglzufcyz", model.subscriptionId()); + Assertions.assertEquals("hdbihan", model.resellerId()); + Assertions.assertEquals("fcbjysagithxqha", model.additionalProperties().managementGroupId()); + Assertions.assertEquals("fpikxwczb", model.additionalProperties().subscriptionTenantId()); + Assertions.assertEquals("cnpqxuhivyqniwby", model.additionalProperties().subscriptionOwnerId()); + Assertions.assertEquals("xvd", model.additionalProperties().tags().get("mjgr")); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; } } diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/PutAliasRequestTests.java b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/PutAliasRequestTests.java index 8d243d5eb163..104efc9ebf6f 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/PutAliasRequestTests.java +++ b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/PutAliasRequestTests.java @@ -6,36 +6,63 @@ import com.azure.core.util.BinaryData; import com.azure.resourcemanager.subscription.models.PutAliasRequest; +import com.azure.resourcemanager.subscription.models.PutAliasRequestAdditionalProperties; import com.azure.resourcemanager.subscription.models.PutAliasRequestProperties; import com.azure.resourcemanager.subscription.models.Workload; +import java.util.HashMap; +import java.util.Map; import org.junit.jupiter.api.Assertions; public final class PutAliasRequestTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { PutAliasRequest model = BinaryData.fromString( - "{\"properties\":{\"displayName\":\"wckbasyypnd\",\"workload\":\"Production\",\"billingScope\":\"cbacphejkotynqg\",\"subscriptionId\":\"l\",\"resellerId\":\"dlikwyqkgfgibma\"}}") + "{\"properties\":{\"displayName\":\"ewnwreitjzyfl\",\"workload\":\"DevTest\",\"billingScope\":\"hmofc\",\"subscriptionId\":\"smy\",\"resellerId\":\"kdtmlxhekuk\",\"additionalProperties\":{\"managementGroupId\":\"xukcdmpar\",\"subscriptionTenantId\":\"y\",\"subscriptionOwnerId\":\"nzwuxzd\",\"tags\":{\"u\":\"yrlhmwhfpmrqobm\"}}}}") .toObject(PutAliasRequest.class); - Assertions.assertEquals("wckbasyypnd", model.properties().displayName()); - Assertions.assertEquals(Workload.PRODUCTION, model.properties().workload()); - Assertions.assertEquals("cbacphejkotynqg", model.properties().billingScope()); - Assertions.assertEquals("l", model.properties().subscriptionId()); - Assertions.assertEquals("dlikwyqkgfgibma", model.properties().resellerId()); + Assertions.assertEquals("ewnwreitjzyfl", model.properties().displayName()); + Assertions.assertEquals(Workload.DEV_TEST, model.properties().workload()); + Assertions.assertEquals("hmofc", model.properties().billingScope()); + Assertions.assertEquals("smy", model.properties().subscriptionId()); + Assertions.assertEquals("kdtmlxhekuk", model.properties().resellerId()); + Assertions.assertEquals("xukcdmpar", model.properties().additionalProperties().managementGroupId()); + Assertions.assertEquals("y", model.properties().additionalProperties().subscriptionTenantId()); + Assertions.assertEquals("nzwuxzd", model.properties().additionalProperties().subscriptionOwnerId()); + Assertions.assertEquals("yrlhmwhfpmrqobm", model.properties().additionalProperties().tags().get("u")); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { PutAliasRequest model - = new PutAliasRequest().withProperties(new PutAliasRequestProperties().withDisplayName("wckbasyypnd") - .withWorkload(Workload.PRODUCTION) - .withBillingScope("cbacphejkotynqg") - .withSubscriptionId("l") - .withResellerId("dlikwyqkgfgibma")); + = new PutAliasRequest().withProperties(new PutAliasRequestProperties().withDisplayName("ewnwreitjzyfl") + .withWorkload(Workload.DEV_TEST) + .withBillingScope("hmofc") + .withSubscriptionId("smy") + .withResellerId("kdtmlxhekuk") + .withAdditionalProperties(new PutAliasRequestAdditionalProperties().withManagementGroupId("xukcdmpar") + .withSubscriptionTenantId("y") + .withSubscriptionOwnerId("nzwuxzd") + .withTags(mapOf("u", "yrlhmwhfpmrqobm")))); model = BinaryData.fromObject(model).toObject(PutAliasRequest.class); - Assertions.assertEquals("wckbasyypnd", model.properties().displayName()); - Assertions.assertEquals(Workload.PRODUCTION, model.properties().workload()); - Assertions.assertEquals("cbacphejkotynqg", model.properties().billingScope()); - Assertions.assertEquals("l", model.properties().subscriptionId()); - Assertions.assertEquals("dlikwyqkgfgibma", model.properties().resellerId()); + Assertions.assertEquals("ewnwreitjzyfl", model.properties().displayName()); + Assertions.assertEquals(Workload.DEV_TEST, model.properties().workload()); + Assertions.assertEquals("hmofc", model.properties().billingScope()); + Assertions.assertEquals("smy", model.properties().subscriptionId()); + Assertions.assertEquals("kdtmlxhekuk", model.properties().resellerId()); + Assertions.assertEquals("xukcdmpar", model.properties().additionalProperties().managementGroupId()); + Assertions.assertEquals("y", model.properties().additionalProperties().subscriptionTenantId()); + Assertions.assertEquals("nzwuxzd", model.properties().additionalProperties().subscriptionOwnerId()); + Assertions.assertEquals("yrlhmwhfpmrqobm", model.properties().additionalProperties().tags().get("u")); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; } } diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/PutAliasResponseInnerTests.java b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/PutAliasResponseInnerTests.java deleted file mode 100644 index d4dcfde8e465..000000000000 --- a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/PutAliasResponseInnerTests.java +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.subscription.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.subscription.fluent.models.PutAliasResponseInner; -import com.azure.resourcemanager.subscription.models.ProvisioningState; -import com.azure.resourcemanager.subscription.models.PutAliasResponseProperties; -import org.junit.jupiter.api.Assertions; - -public final class PutAliasResponseInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - PutAliasResponseInner model = BinaryData.fromString( - "{\"properties\":{\"subscriptionId\":\"ugpbkw\",\"provisioningState\":\"Succeeded\"},\"id\":\"tduqktapspwgcuer\",\"name\":\"umkdosvqwhbmd\",\"type\":\"bbjfddgmbmbexp\"}") - .toObject(PutAliasResponseInner.class); - Assertions.assertEquals(ProvisioningState.SUCCEEDED, model.properties().provisioningState()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - PutAliasResponseInner model = new PutAliasResponseInner() - .withProperties(new PutAliasResponseProperties().withProvisioningState(ProvisioningState.SUCCEEDED)); - model = BinaryData.fromObject(model).toObject(PutAliasResponseInner.class); - Assertions.assertEquals(ProvisioningState.SUCCEEDED, model.properties().provisioningState()); - } -} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/PutAliasResponsePropertiesTests.java b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/PutAliasResponsePropertiesTests.java deleted file mode 100644 index 3483d03b2533..000000000000 --- a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/PutAliasResponsePropertiesTests.java +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.subscription.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.subscription.models.ProvisioningState; -import com.azure.resourcemanager.subscription.models.PutAliasResponseProperties; -import org.junit.jupiter.api.Assertions; - -public final class PutAliasResponsePropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - PutAliasResponseProperties model - = BinaryData.fromString("{\"subscriptionId\":\"htqqrolfp\",\"provisioningState\":\"Failed\"}") - .toObject(PutAliasResponseProperties.class); - Assertions.assertEquals(ProvisioningState.FAILED, model.provisioningState()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - PutAliasResponseProperties model - = new PutAliasResponseProperties().withProvisioningState(ProvisioningState.FAILED); - model = BinaryData.fromObject(model).toObject(PutAliasResponseProperties.class); - Assertions.assertEquals(ProvisioningState.FAILED, model.provisioningState()); - } -} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/PutTenantPolicyRequestPropertiesTests.java b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/PutTenantPolicyRequestPropertiesTests.java new file mode 100644 index 000000000000..8407504f3a65 --- /dev/null +++ b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/PutTenantPolicyRequestPropertiesTests.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.subscription.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.subscription.models.PutTenantPolicyRequestProperties; +import java.util.Arrays; +import java.util.UUID; +import org.junit.jupiter.api.Assertions; + +public final class PutTenantPolicyRequestPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PutTenantPolicyRequestProperties model = BinaryData.fromString( + "{\"blockSubscriptionsLeavingTenant\":false,\"blockSubscriptionsIntoTenant\":true,\"exemptedPrincipals\":[\"51f863b4-2638-467d-835b-0be19b493036\"]}") + .toObject(PutTenantPolicyRequestProperties.class); + Assertions.assertFalse(model.blockSubscriptionsLeavingTenant()); + Assertions.assertTrue(model.blockSubscriptionsIntoTenant()); + Assertions.assertEquals(UUID.fromString("51f863b4-2638-467d-835b-0be19b493036"), + model.exemptedPrincipals().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PutTenantPolicyRequestProperties model + = new PutTenantPolicyRequestProperties().withBlockSubscriptionsLeavingTenant(false) + .withBlockSubscriptionsIntoTenant(true) + .withExemptedPrincipals(Arrays.asList(UUID.fromString("51f863b4-2638-467d-835b-0be19b493036"))); + model = BinaryData.fromObject(model).toObject(PutTenantPolicyRequestProperties.class); + Assertions.assertFalse(model.blockSubscriptionsLeavingTenant()); + Assertions.assertTrue(model.blockSubscriptionsIntoTenant()); + Assertions.assertEquals(UUID.fromString("51f863b4-2638-467d-835b-0be19b493036"), + model.exemptedPrincipals().get(0)); + } +} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/RenamedSubscriptionIdInnerTests.java b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/RenamedSubscriptionIdInnerTests.java index eadd9175b958..485864d895fc 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/RenamedSubscriptionIdInnerTests.java +++ b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/RenamedSubscriptionIdInnerTests.java @@ -11,7 +11,7 @@ public final class RenamedSubscriptionIdInnerTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { RenamedSubscriptionIdInner model - = BinaryData.fromString("{\"subscriptionId\":\"ngbwjz\"}").toObject(RenamedSubscriptionIdInner.class); + = BinaryData.fromString("{\"subscriptionId\":\"upi\"}").toObject(RenamedSubscriptionIdInner.class); } @org.junit.jupiter.api.Test diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/ServiceTenantResponseTests.java b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/ServiceTenantResponseTests.java new file mode 100644 index 000000000000..1f6f5d001f3d --- /dev/null +++ b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/ServiceTenantResponseTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.subscription.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.subscription.models.ServiceTenantResponse; +import org.junit.jupiter.api.Assertions; + +public final class ServiceTenantResponseTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ServiceTenantResponse model = BinaryData.fromString("{\"tenantId\":\"vdfgiotk\",\"tenantName\":\"utqxlngx\"}") + .toObject(ServiceTenantResponse.class); + Assertions.assertEquals("vdfgiotk", model.tenantId()); + Assertions.assertEquals("utqxlngx", model.tenantName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ServiceTenantResponse model = new ServiceTenantResponse().withTenantId("vdfgiotk").withTenantName("utqxlngx"); + model = BinaryData.fromObject(model).toObject(ServiceTenantResponse.class); + Assertions.assertEquals("vdfgiotk", model.tenantId()); + Assertions.assertEquals("utqxlngx", model.tenantName()); + } +} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionAliasListResultInnerTests.java b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionAliasListResultInnerTests.java new file mode 100644 index 000000000000..d1e9992ced31 --- /dev/null +++ b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionAliasListResultInnerTests.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.subscription.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.subscription.fluent.models.SubscriptionAliasListResultInner; + +public final class SubscriptionAliasListResultInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SubscriptionAliasListResultInner model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"subscriptionId\":\"gispemvtzfkufubl\",\"displayName\":\"fxqeof\",\"provisioningState\":\"Succeeded\",\"acceptOwnershipUrl\":\"jhqjbasvmsmjqul\",\"acceptOwnershipState\":\"Pending\",\"billingScope\":\"tnb\",\"workload\":\"DevTest\",\"resellerId\":\"gc\",\"subscriptionOwnerId\":\"wclxxwrl\",\"managementGroupId\":\"ouskcqvkocrc\",\"createdTime\":\"kwt\",\"tags\":{\"p\":\"bnjbiksqrglssain\",\"mgxsab\":\"wnzlljfmppeeb\",\"jczdzevndh\":\"yqduujit\"}},\"id\":\"wpdappdsbdkv\",\"name\":\"rwjfe\",\"type\":\"snhu\"},{\"properties\":{\"subscriptionId\":\"ltmrldh\",\"displayName\":\"jzzd\",\"provisioningState\":\"Accepted\",\"acceptOwnershipUrl\":\"hocdgeab\",\"acceptOwnershipState\":\"Expired\",\"billingScope\":\"uticndvkaozwyif\",\"workload\":\"Production\",\"resellerId\":\"hurokftyxoln\",\"subscriptionOwnerId\":\"pwcukjfkgiawxk\",\"managementGroupId\":\"ypl\",\"createdTime\":\"kbasyypn\",\"tags\":{\"hejkotynqgou\":\"sgcbac\",\"kgfg\":\"zndlikwy\",\"qsrxybzqqed\":\"bmadgak\",\"iqfouflmmnkz\":\"ytb\"}},\"id\":\"odmgl\",\"name\":\"ugpbkw\",\"type\":\"mutduqktaps\"},{\"properties\":{\"subscriptionId\":\"cuertu\",\"displayName\":\"dosvqwhbmdgbbjf\",\"provisioningState\":\"Accepted\",\"acceptOwnershipUrl\":\"bmbexppbhtqqro\",\"acceptOwnershipState\":\"Pending\",\"billingScope\":\"psalgbqux\",\"workload\":\"Production\",\"resellerId\":\"jgzjaoyfhrtx\",\"subscriptionOwnerId\":\"n\",\"managementGroupId\":\"kujysvlejuvfq\",\"createdTime\":\"rlyxwjkcprbnw\",\"tags\":{\"dnrujqguhmuouqfp\":\"jvtbvpyss\",\"uizga\":\"wzwbnguitn\"}},\"id\":\"ufizuckyf\",\"name\":\"hr\",\"type\":\"idf\"}],\"nextLink\":\"wdzuhtymwisd\"}") + .toObject(SubscriptionAliasListResultInner.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SubscriptionAliasListResultInner model = new SubscriptionAliasListResultInner(); + model = BinaryData.fromObject(model).toObject(SubscriptionAliasListResultInner.class); + } +} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionAliasResponseInnerTests.java b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionAliasResponseInnerTests.java new file mode 100644 index 000000000000..c70974e1066a --- /dev/null +++ b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionAliasResponseInnerTests.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.subscription.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.subscription.fluent.models.SubscriptionAliasResponseInner; +import com.azure.resourcemanager.subscription.models.ProvisioningState; +import com.azure.resourcemanager.subscription.models.SubscriptionAliasResponseProperties; +import com.azure.resourcemanager.subscription.models.Workload; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class SubscriptionAliasResponseInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SubscriptionAliasResponseInner model = BinaryData.fromString( + "{\"properties\":{\"subscriptionId\":\"yahux\",\"displayName\":\"pmqnja\",\"provisioningState\":\"Failed\",\"acceptOwnershipUrl\":\"jsprozvcpute\",\"acceptOwnershipState\":\"Completed\",\"billingScope\":\"mfdatscmdvpj\",\"workload\":\"DevTest\",\"resellerId\":\"uuvmkjozkrwfnd\",\"subscriptionOwnerId\":\"djpslw\",\"managementGroupId\":\"dpvwryoqpsoaccta\",\"createdTime\":\"kljla\",\"tags\":{\"expa\":\"ryffdfdosy\"}},\"id\":\"akhmsbzjhcrz\",\"name\":\"vdphlxaolthqtr\",\"type\":\"qjbpfzfsin\"}") + .toObject(SubscriptionAliasResponseInner.class); + Assertions.assertEquals("pmqnja", model.properties().displayName()); + Assertions.assertEquals(ProvisioningState.FAILED, model.properties().provisioningState()); + Assertions.assertEquals("mfdatscmdvpj", model.properties().billingScope()); + Assertions.assertEquals(Workload.DEV_TEST, model.properties().workload()); + Assertions.assertEquals("uuvmkjozkrwfnd", model.properties().resellerId()); + Assertions.assertEquals("djpslw", model.properties().subscriptionOwnerId()); + Assertions.assertEquals("dpvwryoqpsoaccta", model.properties().managementGroupId()); + Assertions.assertEquals("kljla", model.properties().createdTime()); + Assertions.assertEquals("ryffdfdosy", model.properties().tags().get("expa")); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SubscriptionAliasResponseInner model = new SubscriptionAliasResponseInner() + .withProperties(new SubscriptionAliasResponseProperties().withDisplayName("pmqnja") + .withProvisioningState(ProvisioningState.FAILED) + .withBillingScope("mfdatscmdvpj") + .withWorkload(Workload.DEV_TEST) + .withResellerId("uuvmkjozkrwfnd") + .withSubscriptionOwnerId("djpslw") + .withManagementGroupId("dpvwryoqpsoaccta") + .withCreatedTime("kljla") + .withTags(mapOf("expa", "ryffdfdosy"))); + model = BinaryData.fromObject(model).toObject(SubscriptionAliasResponseInner.class); + Assertions.assertEquals("pmqnja", model.properties().displayName()); + Assertions.assertEquals(ProvisioningState.FAILED, model.properties().provisioningState()); + Assertions.assertEquals("mfdatscmdvpj", model.properties().billingScope()); + Assertions.assertEquals(Workload.DEV_TEST, model.properties().workload()); + Assertions.assertEquals("uuvmkjozkrwfnd", model.properties().resellerId()); + Assertions.assertEquals("djpslw", model.properties().subscriptionOwnerId()); + Assertions.assertEquals("dpvwryoqpsoaccta", model.properties().managementGroupId()); + Assertions.assertEquals("kljla", model.properties().createdTime()); + Assertions.assertEquals("ryffdfdosy", model.properties().tags().get("expa")); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionAliasResponsePropertiesTests.java b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionAliasResponsePropertiesTests.java new file mode 100644 index 000000000000..30b54ff67d71 --- /dev/null +++ b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionAliasResponsePropertiesTests.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.subscription.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.subscription.models.ProvisioningState; +import com.azure.resourcemanager.subscription.models.SubscriptionAliasResponseProperties; +import com.azure.resourcemanager.subscription.models.Workload; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class SubscriptionAliasResponsePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SubscriptionAliasResponseProperties model = BinaryData.fromString( + "{\"subscriptionId\":\"v\",\"displayName\":\"jrwzox\",\"provisioningState\":\"Failed\",\"acceptOwnershipUrl\":\"elluwfziton\",\"acceptOwnershipState\":\"Pending\",\"billingScope\":\"pjkjlxofpdv\",\"workload\":\"DevTest\",\"resellerId\":\"xypininmayhuybbk\",\"subscriptionOwnerId\":\"depoog\",\"managementGroupId\":\"uvamiheognarxzxt\",\"createdTime\":\"o\",\"tags\":{\"bwjzr\":\"ivyevcciqihnhun\"}}") + .toObject(SubscriptionAliasResponseProperties.class); + Assertions.assertEquals("jrwzox", model.displayName()); + Assertions.assertEquals(ProvisioningState.FAILED, model.provisioningState()); + Assertions.assertEquals("pjkjlxofpdv", model.billingScope()); + Assertions.assertEquals(Workload.DEV_TEST, model.workload()); + Assertions.assertEquals("xypininmayhuybbk", model.resellerId()); + Assertions.assertEquals("depoog", model.subscriptionOwnerId()); + Assertions.assertEquals("uvamiheognarxzxt", model.managementGroupId()); + Assertions.assertEquals("o", model.createdTime()); + Assertions.assertEquals("ivyevcciqihnhun", model.tags().get("bwjzr")); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SubscriptionAliasResponseProperties model = new SubscriptionAliasResponseProperties().withDisplayName("jrwzox") + .withProvisioningState(ProvisioningState.FAILED) + .withBillingScope("pjkjlxofpdv") + .withWorkload(Workload.DEV_TEST) + .withResellerId("xypininmayhuybbk") + .withSubscriptionOwnerId("depoog") + .withManagementGroupId("uvamiheognarxzxt") + .withCreatedTime("o") + .withTags(mapOf("bwjzr", "ivyevcciqihnhun")); + model = BinaryData.fromObject(model).toObject(SubscriptionAliasResponseProperties.class); + Assertions.assertEquals("jrwzox", model.displayName()); + Assertions.assertEquals(ProvisioningState.FAILED, model.provisioningState()); + Assertions.assertEquals("pjkjlxofpdv", model.billingScope()); + Assertions.assertEquals(Workload.DEV_TEST, model.workload()); + Assertions.assertEquals("xypininmayhuybbk", model.resellerId()); + Assertions.assertEquals("depoog", model.subscriptionOwnerId()); + Assertions.assertEquals("uvamiheognarxzxt", model.managementGroupId()); + Assertions.assertEquals("o", model.createdTime()); + Assertions.assertEquals("ivyevcciqihnhun", model.tags().get("bwjzr")); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionCreationResultInnerTests.java b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionCreationResultInnerTests.java new file mode 100644 index 000000000000..3f1b69b2b411 --- /dev/null +++ b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionCreationResultInnerTests.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.subscription.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.subscription.fluent.models.SubscriptionCreationResultInner; +import org.junit.jupiter.api.Assertions; + +public final class SubscriptionCreationResultInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SubscriptionCreationResultInner model = BinaryData.fromString("{\"subscriptionLink\":\"cmsxaobhdxbm\"}") + .toObject(SubscriptionCreationResultInner.class); + Assertions.assertEquals("cmsxaobhdxbm", model.subscriptionLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SubscriptionCreationResultInner model + = new SubscriptionCreationResultInner().withSubscriptionLink("cmsxaobhdxbm"); + model = BinaryData.fromObject(model).toObject(SubscriptionCreationResultInner.class); + Assertions.assertEquals("cmsxaobhdxbm", model.subscriptionLink()); + } +} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionNameTests.java b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionNameTests.java index d87bd629774d..357cd1dfe42b 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionNameTests.java +++ b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionNameTests.java @@ -12,14 +12,14 @@ public final class SubscriptionNameTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { SubscriptionName model - = BinaryData.fromString("{\"subscriptionName\":\"tusivyevcciqihn\"}").toObject(SubscriptionName.class); - Assertions.assertEquals("tusivyevcciqihn", model.subscriptionName()); + = BinaryData.fromString("{\"subscriptionName\":\"czmehmtzopbsp\"}").toObject(SubscriptionName.class); + Assertions.assertEquals("czmehmtzopbsp", model.subscriptionName()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - SubscriptionName model = new SubscriptionName().withSubscriptionName("tusivyevcciqihn"); + SubscriptionName model = new SubscriptionName().withSubscriptionName("czmehmtzopbsp"); model = BinaryData.fromObject(model).toObject(SubscriptionName.class); - Assertions.assertEquals("tusivyevcciqihn", model.subscriptionName()); + Assertions.assertEquals("czmehmtzopbsp", model.subscriptionName()); } } diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionsListLocationsMockTests.java b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionOperationsGetWithResponseMockTests.java similarity index 58% rename from sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionsListLocationsMockTests.java rename to sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionOperationsGetWithResponseMockTests.java index 66c22fa71c8f..b209178115f4 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionsListLocationsMockTests.java +++ b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionOperationsGetWithResponseMockTests.java @@ -6,32 +6,33 @@ import com.azure.core.credential.AccessToken; import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; import com.azure.core.test.http.MockHttpResponse; import com.azure.resourcemanager.subscription.SubscriptionManager; -import com.azure.resourcemanager.subscription.models.Location; +import com.azure.resourcemanager.subscription.models.SubscriptionCreationResult; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import reactor.core.publisher.Mono; -public final class SubscriptionsListLocationsMockTests { +public final class SubscriptionOperationsGetWithResponseMockTests { @Test - public void testListLocations() throws Exception { - String responseStr - = "{\"value\":[{\"id\":\"itnwuizgazxufi\",\"subscriptionId\":\"ckyfih\",\"name\":\"idf\",\"displayName\":\"wdzuhtymwisd\",\"latitude\":\"thwxmnteiwaopvkm\",\"longitude\":\"c\"}]}"; + public void testGetWithResponse() throws Exception { + String responseStr = "{\"subscriptionLink\":\"ienjbdlwtgr\"}"; HttpClient httpClient = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); SubscriptionManager manager = SubscriptionManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); - PagedIterable response - = manager.subscriptions().listLocations("uhmuouqfprwzwbn", com.azure.core.util.Context.NONE); + SubscriptionCreationResult response = manager.subscriptionOperations() + .getWithResponse("njeaseipheofloke", com.azure.core.util.Context.NONE) + .getValue(); + Assertions.assertEquals("ienjbdlwtgr", response.subscriptionLink()); } } diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionPoliciesAddUpdatePolicyForTenantWithResponseMockTests.java b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionPoliciesAddUpdatePolicyForTenantWithResponseMockTests.java new file mode 100644 index 000000000000..b70e5cce2d11 --- /dev/null +++ b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionPoliciesAddUpdatePolicyForTenantWithResponseMockTests.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.subscription.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.subscription.SubscriptionManager; +import com.azure.resourcemanager.subscription.models.GetTenantPolicyResponse; +import com.azure.resourcemanager.subscription.models.PutTenantPolicyRequestProperties; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.UUID; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SubscriptionPoliciesAddUpdatePolicyForTenantWithResponseMockTests { + @Test + public void testAddUpdatePolicyForTenantWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"policyId\":\"bniwdj\",\"blockSubscriptionsLeavingTenant\":false,\"blockSubscriptionsIntoTenant\":false,\"exemptedPrincipals\":[\"1a9785a0-8897-4c22-9ce7-68fc76d523c0\"]},\"id\":\"gnxytxhpzxbz\",\"name\":\"fzab\",\"type\":\"lcuhxwtctyqiklb\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + SubscriptionManager manager = SubscriptionManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + GetTenantPolicyResponse response = manager.subscriptionPolicies() + .addUpdatePolicyForTenantWithResponse( + new PutTenantPolicyRequestProperties().withBlockSubscriptionsLeavingTenant(true) + .withBlockSubscriptionsIntoTenant(true) + .withExemptedPrincipals(Arrays.asList(UUID.fromString("5672b716-effa-431f-8bf2-eb66626b97b7"), + UUID.fromString("3828b643-ba29-4d42-9ae8-4f014c41bdf6"), + UUID.fromString("baaf9c68-453b-4d0e-a491-f18928520c39"), + UUID.fromString("072162fc-7e49-42f3-b6e4-f0ca25e108bf"))), + com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertFalse(response.properties().blockSubscriptionsLeavingTenant()); + Assertions.assertFalse(response.properties().blockSubscriptionsIntoTenant()); + Assertions.assertEquals(UUID.fromString("1a9785a0-8897-4c22-9ce7-68fc76d523c0"), + response.properties().exemptedPrincipals().get(0)); + } +} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionPoliciesGetPolicyForTenantWithResponseMockTests.java b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionPoliciesGetPolicyForTenantWithResponseMockTests.java new file mode 100644 index 000000000000..19c1061514e7 --- /dev/null +++ b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionPoliciesGetPolicyForTenantWithResponseMockTests.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.subscription.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.subscription.SubscriptionManager; +import com.azure.resourcemanager.subscription.models.GetTenantPolicyResponse; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.UUID; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SubscriptionPoliciesGetPolicyForTenantWithResponseMockTests { + @Test + public void testGetPolicyForTenantWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"policyId\":\"plwzbhvgyugu\",\"blockSubscriptionsLeavingTenant\":true,\"blockSubscriptionsIntoTenant\":true,\"exemptedPrincipals\":[\"3482294d-2fcc-4207-b22d-9e5cee9d56b9\"]},\"id\":\"xquk\",\"name\":\"fpl\",\"type\":\"mg\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + SubscriptionManager manager = SubscriptionManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + GetTenantPolicyResponse response = manager.subscriptionPolicies() + .getPolicyForTenantWithResponse(com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertTrue(response.properties().blockSubscriptionsLeavingTenant()); + Assertions.assertTrue(response.properties().blockSubscriptionsIntoTenant()); + Assertions.assertEquals(UUID.fromString("3482294d-2fcc-4207-b22d-9e5cee9d56b9"), + response.properties().exemptedPrincipals().get(0)); + } +} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionPoliciesListPolicyForTenantMockTests.java b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionPoliciesListPolicyForTenantMockTests.java new file mode 100644 index 000000000000..11878a6eccab --- /dev/null +++ b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionPoliciesListPolicyForTenantMockTests.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.subscription.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.subscription.SubscriptionManager; +import com.azure.resourcemanager.subscription.models.GetTenantPolicyResponse; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.UUID; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SubscriptionPoliciesListPolicyForTenantMockTests { + @Test + public void testListPolicyForTenant() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"policyId\":\"kjz\",\"blockSubscriptionsLeavingTenant\":false,\"blockSubscriptionsIntoTenant\":false,\"exemptedPrincipals\":[\"16c7317f-d654-4f7b-9ab1-7e393da672ac\",\"fb826feb-5b60-4820-b5f6-48306d75afe5\",\"345bec4d-0153-4111-8e41-d83dd430eb9f\"]},\"id\":\"opwi\",\"name\":\"ighxpk\",\"type\":\"wzbaiue\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + SubscriptionManager manager = SubscriptionManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response + = manager.subscriptionPolicies().listPolicyForTenant(com.azure.core.util.Context.NONE); + + Assertions.assertFalse(response.iterator().next().properties().blockSubscriptionsLeavingTenant()); + Assertions.assertFalse(response.iterator().next().properties().blockSubscriptionsIntoTenant()); + Assertions.assertEquals(UUID.fromString("16c7317f-d654-4f7b-9ab1-7e393da672ac"), + response.iterator().next().properties().exemptedPrincipals().get(0)); + } +} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionPoliciesTests.java b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionPoliciesTests.java deleted file mode 100644 index 43b04c3a21f5..000000000000 --- a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionPoliciesTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.subscription.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.subscription.models.SubscriptionPolicies; - -public final class SubscriptionPoliciesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - SubscriptionPolicies model = BinaryData - .fromString("{\"locationPlacementId\":\"vd\",\"quotaId\":\"jgrtfwvukxga\",\"spendingLimit\":\"Off\"}") - .toObject(SubscriptionPolicies.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SubscriptionPolicies model = new SubscriptionPolicies(); - model = BinaryData.fromObject(model).toObject(SubscriptionPolicies.class); - } -} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionsAcceptOwnershipStatusWithResponseMockTests.java b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionsAcceptOwnershipStatusWithResponseMockTests.java new file mode 100644 index 000000000000..f2a910c4efb8 --- /dev/null +++ b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionsAcceptOwnershipStatusWithResponseMockTests.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.subscription.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.subscription.SubscriptionManager; +import com.azure.resourcemanager.subscription.models.AcceptOwnershipStatusResponse; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SubscriptionsAcceptOwnershipStatusWithResponseMockTests { + @Test + public void testAcceptOwnershipStatusWithResponse() throws Exception { + String responseStr + = "{\"subscriptionId\":\"oo\",\"acceptOwnershipState\":\"Expired\",\"provisioningState\":\"Pending\",\"billingOwner\":\"v\",\"subscriptionTenantId\":\"m\",\"displayName\":\"qabcypm\",\"tags\":{\"zuvccfwnfnbacfio\":\"w\",\"bxetqgtzxdpn\":\"l\",\"eallnwsubisnj\":\"bqqwxrj\",\"hcbonqvpkvlr\":\"mpmngnzscxaqwoo\"}}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + SubscriptionManager manager = SubscriptionManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + AcceptOwnershipStatusResponse response = manager.subscriptions() + .acceptOwnershipStatusWithResponse("fvm", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("m", response.subscriptionTenantId()); + Assertions.assertEquals("qabcypm", response.displayName()); + Assertions.assertEquals("w", response.tags().get("zuvccfwnfnbacfio")); + } +} diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionOperationsCancelWithResponseMockTests.java b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionsCancelWithResponseMockTests.java similarity index 72% rename from sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionOperationsCancelWithResponseMockTests.java rename to sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionsCancelWithResponseMockTests.java index be52dd8d5c6b..fd94deee6e23 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionOperationsCancelWithResponseMockTests.java +++ b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionsCancelWithResponseMockTests.java @@ -6,8 +6,8 @@ import com.azure.core.credential.AccessToken; import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; import com.azure.core.test.http.MockHttpResponse; import com.azure.resourcemanager.subscription.SubscriptionManager; import com.azure.resourcemanager.subscription.models.CanceledSubscriptionId; @@ -16,21 +16,20 @@ import org.junit.jupiter.api.Test; import reactor.core.publisher.Mono; -public final class SubscriptionOperationsCancelWithResponseMockTests { +public final class SubscriptionsCancelWithResponseMockTests { @Test public void testCancelWithResponse() throws Exception { - String responseStr = "{\"subscriptionId\":\"kexxppof\"}"; + String responseStr = "{\"subscriptionId\":\"dqmidtt\"}"; HttpClient httpClient = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); SubscriptionManager manager = SubscriptionManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); - CanceledSubscriptionId response = manager.subscriptionOperations() - .cancelWithResponse("qsycbkbfkgu", com.azure.core.util.Context.NONE) - .getValue(); + CanceledSubscriptionId response + = manager.subscriptions().cancelWithResponse("efgugnxk", com.azure.core.util.Context.NONE).getValue(); } } diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionOperationsEnableWithResponseMockTests.java b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionsEnableWithResponseMockTests.java similarity index 72% rename from sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionOperationsEnableWithResponseMockTests.java rename to sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionsEnableWithResponseMockTests.java index f28e910d34f9..465403f1a66b 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionOperationsEnableWithResponseMockTests.java +++ b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionsEnableWithResponseMockTests.java @@ -6,8 +6,8 @@ import com.azure.core.credential.AccessToken; import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; import com.azure.core.test.http.MockHttpResponse; import com.azure.resourcemanager.subscription.SubscriptionManager; import com.azure.resourcemanager.subscription.models.EnabledSubscriptionId; @@ -16,21 +16,20 @@ import org.junit.jupiter.api.Test; import reactor.core.publisher.Mono; -public final class SubscriptionOperationsEnableWithResponseMockTests { +public final class SubscriptionsEnableWithResponseMockTests { @Test public void testEnableWithResponse() throws Exception { - String responseStr = "{\"subscriptionId\":\"icbtwnpzao\"}"; + String responseStr = "{\"subscriptionId\":\"hzgpphrcgyncocpe\"}"; HttpClient httpClient = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); SubscriptionManager manager = SubscriptionManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); - EnabledSubscriptionId response = manager.subscriptionOperations() - .enableWithResponse("jnxqbzvddntwn", com.azure.core.util.Context.NONE) - .getValue(); + EnabledSubscriptionId response + = manager.subscriptions().enableWithResponse("ywgndrv", com.azure.core.util.Context.NONE).getValue(); } } diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionOperationsRenameWithResponseMockTests.java b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionsRenameWithResponseMockTests.java similarity index 74% rename from sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionOperationsRenameWithResponseMockTests.java rename to sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionsRenameWithResponseMockTests.java index 5a2258fd3335..f065722d914e 100644 --- a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionOperationsRenameWithResponseMockTests.java +++ b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/SubscriptionsRenameWithResponseMockTests.java @@ -6,8 +6,8 @@ import com.azure.core.credential.AccessToken; import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; import com.azure.core.test.http.MockHttpResponse; import com.azure.resourcemanager.subscription.SubscriptionManager; import com.azure.resourcemanager.subscription.models.RenamedSubscriptionId; @@ -17,20 +17,20 @@ import org.junit.jupiter.api.Test; import reactor.core.publisher.Mono; -public final class SubscriptionOperationsRenameWithResponseMockTests { +public final class SubscriptionsRenameWithResponseMockTests { @Test public void testRenameWithResponse() throws Exception { - String responseStr = "{\"subscriptionId\":\"bqe\"}"; + String responseStr = "{\"subscriptionId\":\"kanyktzlcuiywg\"}"; HttpClient httpClient = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); SubscriptionManager manager = SubscriptionManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); - RenamedSubscriptionId response = manager.subscriptionOperations() - .renameWithResponse("xaxcfjpgddtocjjx", new SubscriptionName().withSubscriptionName("pmouexhdz"), + RenamedSubscriptionId response = manager.subscriptions() + .renameWithResponse("zrvqdr", new SubscriptionName().withSubscriptionName("hjybigehoqfbo"), com.azure.core.util.Context.NONE) .getValue(); diff --git a/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/TenantPolicyTests.java b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/TenantPolicyTests.java new file mode 100644 index 000000000000..ee5a9cccaa74 --- /dev/null +++ b/sdk/subscription/azure-resourcemanager-subscription/src/test/java/com/azure/resourcemanager/subscription/generated/TenantPolicyTests.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.subscription.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.subscription.models.TenantPolicy; +import java.util.Arrays; +import java.util.UUID; +import org.junit.jupiter.api.Assertions; + +public final class TenantPolicyTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TenantPolicy model = BinaryData.fromString( + "{\"policyId\":\"j\",\"blockSubscriptionsLeavingTenant\":false,\"blockSubscriptionsIntoTenant\":true,\"exemptedPrincipals\":[\"a71c6e4b-089c-4aac-8833-260b2bf453ac\",\"d6b00d3e-1cbd-4380-8c9f-2005449f0a25\"]}") + .toObject(TenantPolicy.class); + Assertions.assertFalse(model.blockSubscriptionsLeavingTenant()); + Assertions.assertTrue(model.blockSubscriptionsIntoTenant()); + Assertions.assertEquals(UUID.fromString("a71c6e4b-089c-4aac-8833-260b2bf453ac"), + model.exemptedPrincipals().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + TenantPolicy model = new TenantPolicy().withBlockSubscriptionsLeavingTenant(false) + .withBlockSubscriptionsIntoTenant(true) + .withExemptedPrincipals(Arrays.asList(UUID.fromString("a71c6e4b-089c-4aac-8833-260b2bf453ac"), + UUID.fromString("d6b00d3e-1cbd-4380-8c9f-2005449f0a25"))); + model = BinaryData.fromObject(model).toObject(TenantPolicy.class); + Assertions.assertFalse(model.blockSubscriptionsLeavingTenant()); + Assertions.assertTrue(model.blockSubscriptionsIntoTenant()); + Assertions.assertEquals(UUID.fromString("a71c6e4b-089c-4aac-8833-260b2bf453ac"), + model.exemptedPrincipals().get(0)); + } +}