diff --git a/sdk/quota/azure-resourcemanager-quota/CHANGELOG.md b/sdk/quota/azure-resourcemanager-quota/CHANGELOG.md index 84e27ac37a62..131ad0898ab7 100644 --- a/sdk/quota/azure-resourcemanager-quota/CHANGELOG.md +++ b/sdk/quota/azure-resourcemanager-quota/CHANGELOG.md @@ -1,6 +1,8 @@ # Release History -## 1.0.0-beta.4 (Unreleased) +## 1.0.0-beta.1 (2023-08-16) + +- Azure Resource Manager quota client library for Java. This package contains Microsoft Azure SDK for quota Management SDK. Microsoft Azure Quota Resource Provider. This Swagger is for Azure MG Group Quota using GroupQuota Entity. Package tag package-2023-06-01-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ### Features Added diff --git a/sdk/quota/azure-resourcemanager-quota/README.md b/sdk/quota/azure-resourcemanager-quota/README.md index 91326e71c752..bd85b9b88bf1 100644 --- a/sdk/quota/azure-resourcemanager-quota/README.md +++ b/sdk/quota/azure-resourcemanager-quota/README.md @@ -2,7 +2,7 @@ Azure Resource Manager quota client library for Java. -This package contains Microsoft Azure SDK for quota Management SDK. Microsoft Azure Quota Resource Provider. Package tag package-2023-02-01. 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 quota Management SDK. Microsoft Azure Quota Resource Provider. This Swagger is for Azure MG Group Quota using GroupQuota Entity. Package tag package-2023-06-01-preview. 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 @@ -32,7 +32,7 @@ Various documentation is available to help you get started com.azure.resourcemanager azure-resourcemanager-quota - 1.0.0-beta.3 + 1.0.0-beta.4 ``` [//]: # ({x-version-update-end}) @@ -103,3 +103,5 @@ 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/ + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Fquota%2Fazure-resourcemanager-quota%2FREADME.png) diff --git a/sdk/quota/azure-resourcemanager-quota/SAMPLE.md b/sdk/quota/azure-resourcemanager-quota/SAMPLE.md index 257c2498bb06..68dc25c4fe9e 100644 --- a/sdk/quota/azure-resourcemanager-quota/SAMPLE.md +++ b/sdk/quota/azure-resourcemanager-quota/SAMPLE.md @@ -1,6 +1,46 @@ # Code snippets and samples +## GroupQuotaLimits + +- [CreateOrUpdate](#groupquotalimits_createorupdate) +- [Get](#groupquotalimits_get) +- [List](#groupquotalimits_list) +- [Update](#groupquotalimits_update) + +## GroupQuotaLimitsRequests + +- [Get](#groupquotalimitsrequests_get) +- [List](#groupquotalimitsrequests_list) + +## GroupQuotaSubscriptionQuotaAllocation + +- [CreateOrUpdate](#groupquotasubscriptionquotaallocation_createorupdate) +- [Get](#groupquotasubscriptionquotaallocation_get) +- [List](#groupquotasubscriptionquotaallocation_list) +- [Update](#groupquotasubscriptionquotaallocation_update) + +## GroupQuotaSubscriptionQuotaAllocationRequests + +- [Get](#groupquotasubscriptionquotaallocationrequests_get) +- [List](#groupquotasubscriptionquotaallocationrequests_list) + +## GroupQuotaSubscriptions + +- [CreateOrUpdate](#groupquotasubscriptions_createorupdate) +- [Delete](#groupquotasubscriptions_delete) +- [Get](#groupquotasubscriptions_get) +- [List](#groupquotasubscriptions_list) +- [Update](#groupquotasubscriptions_update) + +## GroupQuotas + +- [CreateOrUpdate](#groupquotas_createorupdate) +- [Delete](#groupquotas_delete) +- [Get](#groupquotas_get) +- [List](#groupquotas_list) +- [Update](#groupquotas_update) + ## Quota - [CreateOrUpdate](#quota_createorupdate) @@ -17,10 +57,612 @@ - [Get](#quotarequeststatus_get) - [List](#quotarequeststatus_list) +## SubscriptionRequests + +- [Get](#subscriptionrequests_get) +- [List](#subscriptionrequests_list) + ## Usages - [Get](#usages_get) - [List](#usages_list) +### GroupQuotaLimits_CreateOrUpdate + +```java +/** Samples for GroupQuotaLimits CreateOrUpdate. */ +public final class GroupQuotaLimitsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotaLimits/PutGroupQuotaLimits-Compute.json + */ + /** + * Sample code: GroupQuotaLimits_Put_Request_ForCompute. + * + * @param manager Entry point to QuotaManager. + */ + public static void groupQuotaLimitsPutRequestForCompute(com.azure.resourcemanager.quota.QuotaManager manager) { + manager + .groupQuotaLimits() + .createOrUpdate( + "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", + "providers/Microsoft.Compute/locations/westus", + "groupquota1", + "cores", + null, + com.azure.core.util.Context.NONE); + } +} +``` + +### GroupQuotaLimits_Get + +```java +/** Samples for GroupQuotaLimits Get. */ +public final class GroupQuotaLimitsGetSamples { + /* + * x-ms-original-file: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotaLimits/GetGroupQuotaLimits-Compute.json + */ + /** + * Sample code: GroupQuotaLimits_Get_Request_ForCompute. + * + * @param manager Entry point to QuotaManager. + */ + public static void groupQuotaLimitsGetRequestForCompute(com.azure.resourcemanager.quota.QuotaManager manager) { + manager + .groupQuotaLimits() + .getWithResponse( + "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", + "providers/Microsoft.Compute/locations/westus", + "groupquota1", + "cores", + com.azure.core.util.Context.NONE); + } +} +``` + +### GroupQuotaLimits_List + +```java +/** Samples for GroupQuotaLimits List. */ +public final class GroupQuotaLimitsListSamples { + /* + * x-ms-original-file: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotaLimits/ListGroupQuotaLimits-Compute.json + */ + /** + * Sample code: GroupQuotaLimits_List_Request_ForCompute. + * + * @param manager Entry point to QuotaManager. + */ + public static void groupQuotaLimitsListRequestForCompute(com.azure.resourcemanager.quota.QuotaManager manager) { + manager + .groupQuotaLimits() + .list( + "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", + "providers/Microsoft.Compute/locations/westus", + "groupquota1", + com.azure.core.util.Context.NONE); + } +} +``` + +### GroupQuotaLimits_Update + +```java +/** Samples for GroupQuotaLimits Update. */ +public final class GroupQuotaLimitsUpdateSamples { + /* + * x-ms-original-file: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotaLimits/PatchGroupQuotaLimits-Compute.json + */ + /** + * Sample code: GroupQuotaLimits_Patch_Request_ForCompute. + * + * @param manager Entry point to QuotaManager. + */ + public static void groupQuotaLimitsPatchRequestForCompute(com.azure.resourcemanager.quota.QuotaManager manager) { + manager + .groupQuotaLimits() + .update( + "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", + "providers/Microsoft.Compute/locations/westus", + "groupquota1", + "cores", + null, + com.azure.core.util.Context.NONE); + } +} +``` + +### GroupQuotaLimitsRequests_Get + +```java +/** Samples for GroupQuotaLimitsRequests Get. */ +public final class GroupQuotaLimitsRequestsGetSamples { + /* + * x-ms-original-file: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotaLimitsRequests/GroupQuotaLimitsRequests_Get.json + */ + /** + * Sample code: GroupQuotaLimitsRequests_Get. + * + * @param manager Entry point to QuotaManager. + */ + public static void groupQuotaLimitsRequestsGet(com.azure.resourcemanager.quota.QuotaManager manager) { + manager + .groupQuotaLimitsRequests() + .getWithResponse( + "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", + "providers/Microsoft.Compute/locations/westus", + "groupquota1", + "someId", + com.azure.core.util.Context.NONE); + } +} +``` + +### GroupQuotaLimitsRequests_List + +```java +/** Samples for GroupQuotaLimitsRequests List. */ +public final class GroupQuotaLimitsRequestsListSamples { + /* + * x-ms-original-file: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotaLimitsRequests/GroupQuotaLimitsRequests_List.json + */ + /** + * Sample code: GroupQuotaLimitsRequests_List. + * + * @param manager Entry point to QuotaManager. + */ + public static void groupQuotaLimitsRequestsList(com.azure.resourcemanager.quota.QuotaManager manager) { + manager + .groupQuotaLimitsRequests() + .list( + "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", + "providers/Microsoft.Compute/locations/westus", + "groupquota1", + com.azure.core.util.Context.NONE); + } +} +``` + +### GroupQuotaSubscriptionQuotaAllocation_CreateOrUpdate + +```java +import com.azure.resourcemanager.quota.fluent.models.SubscriptionQuotaAllocationsInner; +import com.azure.resourcemanager.quota.models.SubscriptionGroupQuotaAssignment; +import com.azure.resourcemanager.quota.models.SubscriptionQuotaDetails; +import java.util.Arrays; + +/** Samples for GroupQuotaSubscriptionQuotaAllocation CreateOrUpdate. */ +public final class GroupQuotaSubscriptionQuotaAllocationCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/SubscriptionQuotaAllocation/SubscriptionQuotaAllocation_Put_Request-Compute.json + */ + /** + * Sample code: SubscriptionQuotaAllocation_Put_Request_ForCompute. + * + * @param manager Entry point to QuotaManager. + */ + public static void subscriptionQuotaAllocationPutRequestForCompute( + com.azure.resourcemanager.quota.QuotaManager manager) { + manager + .groupQuotaSubscriptionQuotaAllocations() + .createOrUpdate( + "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", + "providers/Microsoft.Compute/locations/westus", + "groupquota1", + "cores", + new SubscriptionQuotaAllocationsInner() + .withProperties( + new SubscriptionQuotaDetails() + .withQuotaSources( + Arrays + .asList( + new SubscriptionGroupQuotaAssignment() + .withManagementGroupId("00000000-0000-0000-0000-000000000000") + .withQuotaAllocated(75L)))), + com.azure.core.util.Context.NONE); + } +} +``` + +### GroupQuotaSubscriptionQuotaAllocation_Get + +```java +/** Samples for GroupQuotaSubscriptionQuotaAllocation Get. */ +public final class GroupQuotaSubscriptionQuotaAllocationGetSamples { + /* + * x-ms-original-file: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/SubscriptionQuotaAllocation/SubscriptionQuotaAllocation_Get_Request-Compute.json + */ + /** + * Sample code: SubscriptionQuotaAllocation_Get_Request_ForCompute. + * + * @param manager Entry point to QuotaManager. + */ + public static void subscriptionQuotaAllocationGetRequestForCompute( + com.azure.resourcemanager.quota.QuotaManager manager) { + manager + .groupQuotaSubscriptionQuotaAllocations() + .getWithResponse( + "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", + "providers/Microsoft.Compute/locations/westus", + "groupquota1", + "cores", + com.azure.core.util.Context.NONE); + } +} +``` + +### GroupQuotaSubscriptionQuotaAllocation_List + +```java +/** Samples for GroupQuotaSubscriptionQuotaAllocation List. */ +public final class GroupQuotaSubscriptionQuotaAllocationListSamples { + /* + * x-ms-original-file: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/SubscriptionQuotaAllocation/SubscriptionQuotaAllocation_List_Request-Compute.json + */ + /** + * Sample code: SubscriptionQuotaAllocation_List_Request_ForCompute. + * + * @param manager Entry point to QuotaManager. + */ + public static void subscriptionQuotaAllocationListRequestForCompute( + com.azure.resourcemanager.quota.QuotaManager manager) { + manager + .groupQuotaSubscriptionQuotaAllocations() + .list( + "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", + "providers/Microsoft.Compute/locations/westus", + "groupquota1", + com.azure.core.util.Context.NONE); + } +} +``` + +### GroupQuotaSubscriptionQuotaAllocation_Update + +```java +import com.azure.resourcemanager.quota.fluent.models.SubscriptionQuotaAllocationsInner; +import com.azure.resourcemanager.quota.models.SubscriptionGroupQuotaAssignment; +import com.azure.resourcemanager.quota.models.SubscriptionQuotaDetails; +import java.util.Arrays; + +/** Samples for GroupQuotaSubscriptionQuotaAllocation Update. */ +public final class GroupQuotaSubscriptionQuotaAllocationUpdateSamples { + /* + * x-ms-original-file: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/SubscriptionQuotaAllocation/SubscriptionQuotaAllocation_Patch_Request-Compute.json + */ + /** + * Sample code: SubscriptionQuotaAllocation_Patch_Request_ForCompute. + * + * @param manager Entry point to QuotaManager. + */ + public static void subscriptionQuotaAllocationPatchRequestForCompute( + com.azure.resourcemanager.quota.QuotaManager manager) { + manager + .groupQuotaSubscriptionQuotaAllocations() + .update( + "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", + "providers/Microsoft.Compute/locations/westus", + "groupquota1", + "cores", + new SubscriptionQuotaAllocationsInner() + .withProperties( + new SubscriptionQuotaDetails() + .withQuotaSources( + Arrays + .asList( + new SubscriptionGroupQuotaAssignment() + .withManagementGroupId("00000000-0000-0000-0000-000000000000") + .withQuotaAllocated(75L)))), + com.azure.core.util.Context.NONE); + } +} +``` + +### GroupQuotaSubscriptionQuotaAllocationRequests_Get + +```java +/** Samples for GroupQuotaSubscriptionQuotaAllocationRequests Get. */ +public final class GroupQuotaSubscriptionQuotaAllocationRequestsGetSamples { + /* + * x-ms-original-file: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/SubscriptionQuotaAllocationRequests/SubscriptionQuotaAllocationRequests_Get_Request-Compute.json + */ + /** + * Sample code: SubscriptionQuotaAllocationRequests_Get_Request_ForCompute. + * + * @param manager Entry point to QuotaManager. + */ + public static void subscriptionQuotaAllocationRequestsGetRequestForCompute( + com.azure.resourcemanager.quota.QuotaManager manager) { + manager + .groupQuotaSubscriptionQuotaAllocationRequests() + .getWithResponse( + "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", + "providers/Microsoft.Compute/locations/westus", + "groupquota1", + "11111111-1111-1111-1111-111111111111", + com.azure.core.util.Context.NONE); + } +} +``` + +### GroupQuotaSubscriptionQuotaAllocationRequests_List + +```java +/** Samples for GroupQuotaSubscriptionQuotaAllocationRequests List. */ +public final class GroupQuotaSubscriptionQuotaAllocationRequestsListSamples { + /* + * x-ms-original-file: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/SubscriptionQuotaAllocationRequests/SubscriptionQuotaAllocationRequests_List_Request-Compute.json + */ + /** + * Sample code: SubscriptionQuotaAllocationRequests_List_Request_ForCompute. + * + * @param manager Entry point to QuotaManager. + */ + public static void subscriptionQuotaAllocationRequestsListRequestForCompute( + com.azure.resourcemanager.quota.QuotaManager manager) { + manager + .groupQuotaSubscriptionQuotaAllocationRequests() + .list( + "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", + "providers/Microsoft.Compute/locations/westus", + "groupquota1", + com.azure.core.util.Context.NONE); + } +} +``` + +### GroupQuotaSubscriptions_CreateOrUpdate + +```java +/** Samples for GroupQuotaSubscriptions CreateOrUpdate. */ +public final class GroupQuotaSubscriptionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotasSubscriptions/PutGroupQuotasSubscription.json + */ + /** + * Sample code: GroupQuotaSubscriptions_Put_Subscriptions. + * + * @param manager Entry point to QuotaManager. + */ + public static void groupQuotaSubscriptionsPutSubscriptions(com.azure.resourcemanager.quota.QuotaManager manager) { + manager + .groupQuotaSubscriptions() + .createOrUpdate("E7EC67B3-7657-4966-BFFC-41EFD36BAA09", "groupquota1", com.azure.core.util.Context.NONE); + } +} +``` + +### GroupQuotaSubscriptions_Delete + +```java +/** Samples for GroupQuotaSubscriptions Delete. */ +public final class GroupQuotaSubscriptionsDeleteSamples { + /* + * x-ms-original-file: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotasSubscriptions/DeleteGroupQuotaSubscriptions.json + */ + /** + * Sample code: GroupQuotaSubscriptions_Delete_Subscriptions. + * + * @param manager Entry point to QuotaManager. + */ + public static void groupQuotaSubscriptionsDeleteSubscriptions( + com.azure.resourcemanager.quota.QuotaManager manager) { + manager + .groupQuotaSubscriptions() + .deleteByResourceGroupWithResponse( + "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", "groupquota1", com.azure.core.util.Context.NONE); + } +} +``` + +### GroupQuotaSubscriptions_Get + +```java +/** Samples for GroupQuotaSubscriptions Get. */ +public final class GroupQuotaSubscriptionsGetSamples { + /* + * x-ms-original-file: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotasSubscriptions/GetGroupQuotaSubscriptions.json + */ + /** + * Sample code: GroupQuotaSubscriptions_Get_Subscriptions. + * + * @param manager Entry point to QuotaManager. + */ + public static void groupQuotaSubscriptionsGetSubscriptions(com.azure.resourcemanager.quota.QuotaManager manager) { + manager + .groupQuotaSubscriptions() + .getWithResponse("E7EC67B3-7657-4966-BFFC-41EFD36BAA09", "groupquota1", com.azure.core.util.Context.NONE); + } +} +``` + +### GroupQuotaSubscriptions_List + +```java +/** Samples for GroupQuotaSubscriptions List. */ +public final class GroupQuotaSubscriptionsListSamples { + /* + * x-ms-original-file: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotasSubscriptions/ListGroupQuotaSubscriptions.json + */ + /** + * Sample code: GroupQuotaSubscriptions_List_Subscriptions. + * + * @param manager Entry point to QuotaManager. + */ + public static void groupQuotaSubscriptionsListSubscriptions(com.azure.resourcemanager.quota.QuotaManager manager) { + manager + .groupQuotaSubscriptions() + .list("E7EC67B3-7657-4966-BFFC-41EFD36BAA09", "groupquota1", com.azure.core.util.Context.NONE); + } +} +``` + +### GroupQuotaSubscriptions_Update + +```java +/** Samples for GroupQuotaSubscriptions Update. */ +public final class GroupQuotaSubscriptionsUpdateSamples { + /* + * x-ms-original-file: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotasSubscriptions/PatchGroupQuotasSubscription.json + */ + /** + * Sample code: GroupQuotaSubscriptions_Patch_Subscriptions. + * + * @param manager Entry point to QuotaManager. + */ + public static void groupQuotaSubscriptionsPatchSubscriptions(com.azure.resourcemanager.quota.QuotaManager manager) { + manager + .groupQuotaSubscriptions() + .update("E7EC67B3-7657-4966-BFFC-41EFD36BAA09", "groupquota1", com.azure.core.util.Context.NONE); + } +} +``` + +### GroupQuotas_CreateOrUpdate + +```java +import com.azure.resourcemanager.quota.fluent.models.GroupQuotasEntityInner; +import com.azure.resourcemanager.quota.models.AdditionalAttributes; +import com.azure.resourcemanager.quota.models.EnvironmentType; +import com.azure.resourcemanager.quota.models.GroupQuotasEntityBase; +import com.azure.resourcemanager.quota.models.GroupingId; +import com.azure.resourcemanager.quota.models.GroupingIdType; + +/** Samples for GroupQuotas CreateOrUpdate. */ +public final class GroupQuotasCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotas/PutGroupQuotas.json + */ + /** + * Sample code: GroupQuotas_Put_Request_ForCompute. + * + * @param manager Entry point to QuotaManager. + */ + public static void groupQuotasPutRequestForCompute(com.azure.resourcemanager.quota.QuotaManager manager) { + manager + .groupQuotas() + .createOrUpdate( + "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", + "groupquota1", + new GroupQuotasEntityInner() + .withProperties( + new GroupQuotasEntityBase() + .withDisplayName("GroupQuota1") + .withAdditionalAttributes( + new AdditionalAttributes() + .withGroupId( + new GroupingId() + .withGroupingIdType(GroupingIdType.SERVICE_TREE_ID) + .withValue("yourServiceTreeIdHere")) + .withEnvironment(EnvironmentType.PRODUCTION))), + com.azure.core.util.Context.NONE); + } +} +``` + +### GroupQuotas_Delete + +```java +/** Samples for GroupQuotas Delete. */ +public final class GroupQuotasDeleteSamples { + /* + * x-ms-original-file: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotas/DeleteGroupQuotas.json + */ + /** + * Sample code: GroupQuotas_Delete_Request_ForCompute. + * + * @param manager Entry point to QuotaManager. + */ + public static void groupQuotasDeleteRequestForCompute(com.azure.resourcemanager.quota.QuotaManager manager) { + manager + .groupQuotas() + .deleteByResourceGroupWithResponse( + "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", "groupquota1", com.azure.core.util.Context.NONE); + } +} +``` + +### GroupQuotas_Get + +```java +/** Samples for GroupQuotas Get. */ +public final class GroupQuotasGetSamples { + /* + * x-ms-original-file: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotas/GetGroupQuotas.json + */ + /** + * Sample code: GroupQuotas_Get_Request_ForCompute. + * + * @param manager Entry point to QuotaManager. + */ + public static void groupQuotasGetRequestForCompute(com.azure.resourcemanager.quota.QuotaManager manager) { + manager + .groupQuotas() + .getWithResponse("E7EC67B3-7657-4966-BFFC-41EFD36BAA09", "groupquota1", com.azure.core.util.Context.NONE); + } +} +``` + +### GroupQuotas_List + +```java +/** Samples for GroupQuotas List. */ +public final class GroupQuotasListSamples { + /* + * x-ms-original-file: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotas/GetGroupQuotasList.json + */ + /** + * Sample code: GroupQuotas_List_Request_ForCompute. + * + * @param manager Entry point to QuotaManager. + */ + public static void groupQuotasListRequestForCompute(com.azure.resourcemanager.quota.QuotaManager manager) { + manager.groupQuotas().list("E7EC67B3-7657-4966-BFFC-41EFD36BAA09", com.azure.core.util.Context.NONE); + } +} +``` + +### GroupQuotas_Update + +```java +import com.azure.resourcemanager.quota.fluent.models.GroupQuotasEntityInner; +import com.azure.resourcemanager.quota.models.AdditionalAttributes; +import com.azure.resourcemanager.quota.models.EnvironmentType; +import com.azure.resourcemanager.quota.models.GroupQuotasEntityBase; +import com.azure.resourcemanager.quota.models.GroupingId; +import com.azure.resourcemanager.quota.models.GroupingIdType; + +/** Samples for GroupQuotas Update. */ +public final class GroupQuotasUpdateSamples { + /* + * x-ms-original-file: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotas/PatchGroupQuotas.json + */ + /** + * Sample code: GroupQuotas_Patch_Request_ForCompute. + * + * @param manager Entry point to QuotaManager. + */ + public static void groupQuotasPatchRequestForCompute(com.azure.resourcemanager.quota.QuotaManager manager) { + manager + .groupQuotas() + .update( + "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", + "groupquota1", + new GroupQuotasEntityInner() + .withProperties( + new GroupQuotasEntityBase() + .withDisplayName("GroupQuota1") + .withAdditionalAttributes( + new AdditionalAttributes() + .withGroupId( + new GroupingId() + .withGroupingIdType(GroupingIdType.SERVICE_TREE_ID) + .withValue("yourServiceTreeIdHere")) + .withEnvironment(EnvironmentType.PRODUCTION))), + com.azure.core.util.Context.NONE); + } +} +``` + ### Quota_CreateOrUpdate ```java @@ -386,6 +1028,52 @@ public final class QuotaRequestStatusListSamples { } ``` +### SubscriptionRequests_Get + +```java +/** Samples for SubscriptionRequests Get. */ +public final class SubscriptionRequestsGetSamples { + /* + * x-ms-original-file: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/SubscriptionRequests/SubscriptionRequests_Get.json + */ + /** + * Sample code: SubscriptionRequests_Get. + * + * @param manager Entry point to QuotaManager. + */ + public static void subscriptionRequestsGet(com.azure.resourcemanager.quota.QuotaManager manager) { + manager + .subscriptionRequests() + .getWithResponse( + "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", + "groupquota1", + "00000000-0000-0000-0000-000000000000", + com.azure.core.util.Context.NONE); + } +} +``` + +### SubscriptionRequests_List + +```java +/** Samples for SubscriptionRequests List. */ +public final class SubscriptionRequestsListSamples { + /* + * x-ms-original-file: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/SubscriptionRequests/SubscriptionRequests_List.json + */ + /** + * Sample code: SubscriptionRequests_List. + * + * @param manager Entry point to QuotaManager. + */ + public static void subscriptionRequestsList(com.azure.resourcemanager.quota.QuotaManager manager) { + manager + .subscriptionRequests() + .list("E7EC67B3-7657-4966-BFFC-41EFD36BAA09", "groupquota1", com.azure.core.util.Context.NONE); + } +} +``` + ### Usages_Get ```java diff --git a/sdk/quota/azure-resourcemanager-quota/pom.xml b/sdk/quota/azure-resourcemanager-quota/pom.xml index 475fa107371e..96f1fac88b2b 100644 --- a/sdk/quota/azure-resourcemanager-quota/pom.xml +++ b/sdk/quota/azure-resourcemanager-quota/pom.xml @@ -18,7 +18,7 @@ jar Microsoft Azure SDK for quota Management - This package contains Microsoft Azure SDK for quota Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Microsoft Azure Quota Resource Provider. Package tag package-2023-02-01. + This package contains Microsoft Azure SDK for quota Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Microsoft Azure Quota Resource Provider. This Swagger is for Azure MG Group Quota using GroupQuota Entity. Package tag package-2023-06-01-preview. https://github.com/Azure/azure-sdk-for-java diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/QuotaManager.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/QuotaManager.java index 1414f561b6e5..9f96e91171fd 100644 --- a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/QuotaManager.java +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/QuotaManager.java @@ -25,13 +25,27 @@ import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.quota.fluent.AzureQuotaExtensionApi; import com.azure.resourcemanager.quota.implementation.AzureQuotaExtensionApiBuilder; +import com.azure.resourcemanager.quota.implementation.GroupQuotaLimitsImpl; +import com.azure.resourcemanager.quota.implementation.GroupQuotaLimitsRequestsImpl; +import com.azure.resourcemanager.quota.implementation.GroupQuotaSubscriptionQuotaAllocationRequestsImpl; +import com.azure.resourcemanager.quota.implementation.GroupQuotaSubscriptionQuotaAllocationsImpl; +import com.azure.resourcemanager.quota.implementation.GroupQuotaSubscriptionsImpl; +import com.azure.resourcemanager.quota.implementation.GroupQuotasImpl; import com.azure.resourcemanager.quota.implementation.QuotaOperationsImpl; import com.azure.resourcemanager.quota.implementation.QuotaRequestStatusImpl; import com.azure.resourcemanager.quota.implementation.QuotasImpl; +import com.azure.resourcemanager.quota.implementation.SubscriptionRequestsImpl; import com.azure.resourcemanager.quota.implementation.UsagesImpl; +import com.azure.resourcemanager.quota.models.GroupQuotaLimits; +import com.azure.resourcemanager.quota.models.GroupQuotaLimitsRequests; +import com.azure.resourcemanager.quota.models.GroupQuotaSubscriptionQuotaAllocationRequests; +import com.azure.resourcemanager.quota.models.GroupQuotaSubscriptionQuotaAllocations; +import com.azure.resourcemanager.quota.models.GroupQuotaSubscriptions; +import com.azure.resourcemanager.quota.models.GroupQuotas; import com.azure.resourcemanager.quota.models.QuotaOperations; import com.azure.resourcemanager.quota.models.QuotaRequestStatus; import com.azure.resourcemanager.quota.models.Quotas; +import com.azure.resourcemanager.quota.models.SubscriptionRequests; import com.azure.resourcemanager.quota.models.Usages; import java.time.Duration; import java.time.temporal.ChronoUnit; @@ -40,8 +54,25 @@ import java.util.Objects; import java.util.stream.Collectors; -/** Entry point to QuotaManager. Microsoft Azure Quota Resource Provider. */ +/** + * Entry point to QuotaManager. Microsoft Azure Quota Resource Provider. This Swagger is for Azure MG Group Quota using + * GroupQuota Entity. + */ public final class QuotaManager { + private GroupQuotas groupQuotas; + + private GroupQuotaSubscriptions groupQuotaSubscriptions; + + private SubscriptionRequests subscriptionRequests; + + private GroupQuotaLimits groupQuotaLimits; + + private GroupQuotaLimitsRequests groupQuotaLimitsRequests; + + private GroupQuotaSubscriptionQuotaAllocations groupQuotaSubscriptionQuotaAllocations; + + private GroupQuotaSubscriptionQuotaAllocationRequests groupQuotaSubscriptionQuotaAllocationRequests; + private Usages usages; private Quotas quotas; @@ -59,6 +90,7 @@ private QuotaManager(HttpPipeline httpPipeline, AzureProfile profile, Duration d new AzureQuotaExtensionApiBuilder() .pipeline(httpPipeline) .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) .defaultPollInterval(defaultPollInterval) .buildClient(); } @@ -214,7 +246,7 @@ public QuotaManager authenticate(TokenCredential credential, AzureProfile profil .append("-") .append("com.azure.resourcemanager.quota") .append("/") - .append("1.0.0-beta.3"); + .append("1.0.0-beta.1"); if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { userAgentBuilder .append(" (") @@ -271,6 +303,96 @@ public QuotaManager authenticate(TokenCredential credential, AzureProfile profil } } + /** + * Gets the resource collection API of GroupQuotas. + * + * @return Resource collection API of GroupQuotas. + */ + public GroupQuotas groupQuotas() { + if (this.groupQuotas == null) { + this.groupQuotas = new GroupQuotasImpl(clientObject.getGroupQuotas(), this); + } + return groupQuotas; + } + + /** + * Gets the resource collection API of GroupQuotaSubscriptions. + * + * @return Resource collection API of GroupQuotaSubscriptions. + */ + public GroupQuotaSubscriptions groupQuotaSubscriptions() { + if (this.groupQuotaSubscriptions == null) { + this.groupQuotaSubscriptions = + new GroupQuotaSubscriptionsImpl(clientObject.getGroupQuotaSubscriptions(), this); + } + return groupQuotaSubscriptions; + } + + /** + * Gets the resource collection API of SubscriptionRequests. + * + * @return Resource collection API of SubscriptionRequests. + */ + public SubscriptionRequests subscriptionRequests() { + if (this.subscriptionRequests == null) { + this.subscriptionRequests = new SubscriptionRequestsImpl(clientObject.getSubscriptionRequests(), this); + } + return subscriptionRequests; + } + + /** + * Gets the resource collection API of GroupQuotaLimits. + * + * @return Resource collection API of GroupQuotaLimits. + */ + public GroupQuotaLimits groupQuotaLimits() { + if (this.groupQuotaLimits == null) { + this.groupQuotaLimits = new GroupQuotaLimitsImpl(clientObject.getGroupQuotaLimits(), this); + } + return groupQuotaLimits; + } + + /** + * Gets the resource collection API of GroupQuotaLimitsRequests. + * + * @return Resource collection API of GroupQuotaLimitsRequests. + */ + public GroupQuotaLimitsRequests groupQuotaLimitsRequests() { + if (this.groupQuotaLimitsRequests == null) { + this.groupQuotaLimitsRequests = + new GroupQuotaLimitsRequestsImpl(clientObject.getGroupQuotaLimitsRequests(), this); + } + return groupQuotaLimitsRequests; + } + + /** + * Gets the resource collection API of GroupQuotaSubscriptionQuotaAllocations. + * + * @return Resource collection API of GroupQuotaSubscriptionQuotaAllocations. + */ + public GroupQuotaSubscriptionQuotaAllocations groupQuotaSubscriptionQuotaAllocations() { + if (this.groupQuotaSubscriptionQuotaAllocations == null) { + this.groupQuotaSubscriptionQuotaAllocations = + new GroupQuotaSubscriptionQuotaAllocationsImpl( + clientObject.getGroupQuotaSubscriptionQuotaAllocations(), this); + } + return groupQuotaSubscriptionQuotaAllocations; + } + + /** + * Gets the resource collection API of GroupQuotaSubscriptionQuotaAllocationRequests. + * + * @return Resource collection API of GroupQuotaSubscriptionQuotaAllocationRequests. + */ + public GroupQuotaSubscriptionQuotaAllocationRequests groupQuotaSubscriptionQuotaAllocationRequests() { + if (this.groupQuotaSubscriptionQuotaAllocationRequests == null) { + this.groupQuotaSubscriptionQuotaAllocationRequests = + new GroupQuotaSubscriptionQuotaAllocationRequestsImpl( + clientObject.getGroupQuotaSubscriptionQuotaAllocationRequests(), this); + } + return groupQuotaSubscriptionQuotaAllocationRequests; + } + /** * Gets the resource collection API of Usages. * diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/fluent/AzureQuotaExtensionApi.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/fluent/AzureQuotaExtensionApi.java index ca752d9f946d..7413f6918d56 100644 --- a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/fluent/AzureQuotaExtensionApi.java +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/fluent/AzureQuotaExtensionApi.java @@ -9,6 +9,13 @@ /** The interface for AzureQuotaExtensionApi class. */ public interface AzureQuotaExtensionApi { + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + /** * Gets server parameter. * @@ -17,11 +24,11 @@ public interface AzureQuotaExtensionApi { String getEndpoint(); /** - * Gets Api Version. + * Gets server parameter. * - * @return the apiVersion value. + * @return the endpoint value. */ - String getApiVersion(); + String getEndpoint(); /** * Gets The HTTP pipeline to send requests through. @@ -37,6 +44,55 @@ public interface AzureQuotaExtensionApi { */ Duration getDefaultPollInterval(); + /** + * Gets the GroupQuotasClient object to access its operations. + * + * @return the GroupQuotasClient object. + */ + GroupQuotasClient getGroupQuotas(); + + /** + * Gets the GroupQuotaSubscriptionsClient object to access its operations. + * + * @return the GroupQuotaSubscriptionsClient object. + */ + GroupQuotaSubscriptionsClient getGroupQuotaSubscriptions(); + + /** + * Gets the SubscriptionRequestsClient object to access its operations. + * + * @return the SubscriptionRequestsClient object. + */ + SubscriptionRequestsClient getSubscriptionRequests(); + + /** + * Gets the GroupQuotaLimitsClient object to access its operations. + * + * @return the GroupQuotaLimitsClient object. + */ + GroupQuotaLimitsClient getGroupQuotaLimits(); + + /** + * Gets the GroupQuotaLimitsRequestsClient object to access its operations. + * + * @return the GroupQuotaLimitsRequestsClient object. + */ + GroupQuotaLimitsRequestsClient getGroupQuotaLimitsRequests(); + + /** + * Gets the GroupQuotaSubscriptionQuotaAllocationsClient object to access its operations. + * + * @return the GroupQuotaSubscriptionQuotaAllocationsClient object. + */ + GroupQuotaSubscriptionQuotaAllocationsClient getGroupQuotaSubscriptionQuotaAllocations(); + + /** + * Gets the GroupQuotaSubscriptionQuotaAllocationRequestsClient object to access its operations. + * + * @return the GroupQuotaSubscriptionQuotaAllocationRequestsClient object. + */ + GroupQuotaSubscriptionQuotaAllocationRequestsClient getGroupQuotaSubscriptionQuotaAllocationRequests(); + /** * Gets the UsagesClient object to access its operations. * diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/fluent/GroupQuotaLimitsClient.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/fluent/GroupQuotaLimitsClient.java new file mode 100644 index 000000000000..5428fe738660 --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/fluent/GroupQuotaLimitsClient.java @@ -0,0 +1,364 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.quota.fluent.models.GroupQuotaLimitInner; + +/** An instance of this class provides access to all the operations defined in GroupQuotaLimitsClient. */ +public interface GroupQuotaLimitsClient { + /** + * Updates the GroupQuotaLimits for the specific resource under a Management Group. + * + *

Updates the GroupQuotaLimits for the specific resource under a Management Group. A groupQuotaLimitRequestId + * will be returned by the Service. The status can be polled periodically. The status Async polling is using + * standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to + * Get URI and full details can be checked. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource 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 {@link SyncPoller} for polling of group Quota limit. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, GroupQuotaLimitInner> beginCreateOrUpdate( + String mgId, String resourceProviderScope, String groupQuotaName, String resourceName); + + /** + * Updates the GroupQuotaLimits for the specific resource under a Management Group. + * + *

Updates the GroupQuotaLimits for the specific resource under a Management Group. A groupQuotaLimitRequestId + * will be returned by the Service. The status can be polled periodically. The status Async polling is using + * standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to + * Get URI and full details can be checked. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource name. + * @param groupQuotaLimitRequest The GroupQuotaLimit Request. + * @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 group Quota limit. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, GroupQuotaLimitInner> beginCreateOrUpdate( + String mgId, + String resourceProviderScope, + String groupQuotaName, + String resourceName, + GroupQuotaLimitInner groupQuotaLimitRequest, + Context context); + + /** + * Updates the GroupQuotaLimits for the specific resource under a Management Group. + * + *

Updates the GroupQuotaLimits for the specific resource under a Management Group. A groupQuotaLimitRequestId + * will be returned by the Service. The status can be polled periodically. The status Async polling is using + * standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to + * Get URI and full details can be checked. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource 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 group Quota limit. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GroupQuotaLimitInner createOrUpdate( + String mgId, String resourceProviderScope, String groupQuotaName, String resourceName); + + /** + * Updates the GroupQuotaLimits for the specific resource under a Management Group. + * + *

Updates the GroupQuotaLimits for the specific resource under a Management Group. A groupQuotaLimitRequestId + * will be returned by the Service. The status can be polled periodically. The status Async polling is using + * standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to + * Get URI and full details can be checked. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource name. + * @param groupQuotaLimitRequest The GroupQuotaLimit Request. + * @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 group Quota limit. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GroupQuotaLimitInner createOrUpdate( + String mgId, + String resourceProviderScope, + String groupQuotaName, + String resourceName, + GroupQuotaLimitInner groupQuotaLimitRequest, + Context context); + + /** + * Updates the GroupQuotaLimits for the specific resource under a Management Group. + * + *

Updates the GroupQuotaLimits for the specific resource under a Management Group. A groupQuotaLimitRequestId + * will be returned by the Service. The status will be updated periodically. The status Async polling is using + * standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed,then the URI will change to + * Get URI and full details can be checked. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource 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 {@link SyncPoller} for polling of group Quota limit. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, GroupQuotaLimitInner> beginUpdate( + String mgId, String resourceProviderScope, String groupQuotaName, String resourceName); + + /** + * Updates the GroupQuotaLimits for the specific resource under a Management Group. + * + *

Updates the GroupQuotaLimits for the specific resource under a Management Group. A groupQuotaLimitRequestId + * will be returned by the Service. The status will be updated periodically. The status Async polling is using + * standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed,then the URI will change to + * Get URI and full details can be checked. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource name. + * @param groupQuotaLimitRequest The GroupQuotaLimit Request. + * @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 group Quota limit. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, GroupQuotaLimitInner> beginUpdate( + String mgId, + String resourceProviderScope, + String groupQuotaName, + String resourceName, + GroupQuotaLimitInner groupQuotaLimitRequest, + Context context); + + /** + * Updates the GroupQuotaLimits for the specific resource under a Management Group. + * + *

Updates the GroupQuotaLimits for the specific resource under a Management Group. A groupQuotaLimitRequestId + * will be returned by the Service. The status will be updated periodically. The status Async polling is using + * standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed,then the URI will change to + * Get URI and full details can be checked. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource 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 group Quota limit. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GroupQuotaLimitInner update(String mgId, String resourceProviderScope, String groupQuotaName, String resourceName); + + /** + * Updates the GroupQuotaLimits for the specific resource under a Management Group. + * + *

Updates the GroupQuotaLimits for the specific resource under a Management Group. A groupQuotaLimitRequestId + * will be returned by the Service. The status will be updated periodically. The status Async polling is using + * standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed,then the URI will change to + * Get URI and full details can be checked. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource name. + * @param groupQuotaLimitRequest The GroupQuotaLimit Request. + * @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 group Quota limit. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GroupQuotaLimitInner update( + String mgId, + String resourceProviderScope, + String groupQuotaName, + String resourceName, + GroupQuotaLimitInner groupQuotaLimitRequest, + Context context); + + /** + * Gets the resource groupQuotaLimits for the MGId. + * + *

Gets the resource groupQuotaLimits for the MGId. It will include the limits, availableLimits, + * assignedToSubscriptions: Quotas assigned to subscriptions from the groupQuota. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource 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 resource groupQuotaLimits for the MGId along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String mgId, String resourceProviderScope, String groupQuotaName, String resourceName, Context context); + + /** + * Gets the resource groupQuotaLimits for the MGId. + * + *

Gets the resource groupQuotaLimits for the MGId. It will include the limits, availableLimits, + * assignedToSubscriptions: Quotas assigned to subscriptions from the groupQuota. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource 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 resource groupQuotaLimits for the MGId. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GroupQuotaLimitInner get(String mgId, String resourceProviderScope, String groupQuotaName, String resourceName); + + /** + * Gets the List of resources groupQuotaLimits for the MGId, based on the scope. + * + *

Gets the List of resources groupQuotaLimits for the MGId, based on the scope. The scope can be - + * providers/Microsoft.Compute/locations/<eastus>. The list elements will be same as the Get API - It will + * include the limits, availableLimits, assignedToSubscriptions: Quotas assigned to subscriptions from the + * groupQuota. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of resources groupQuotaLimits for the MGId, based on the scope as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String mgId, String resourceProviderScope, String groupQuotaName); + + /** + * Gets the List of resources groupQuotaLimits for the MGId, based on the scope. + * + *

Gets the List of resources groupQuotaLimits for the MGId, based on the scope. The scope can be - + * providers/Microsoft.Compute/locations/<eastus>. The list elements will be same as the Get API - It will + * include the limits, availableLimits, assignedToSubscriptions: Quotas assigned to subscriptions from the + * groupQuota. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @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 List of resources groupQuotaLimits for the MGId, based on the scope as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String mgId, String resourceProviderScope, String groupQuotaName, Context context); +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/fluent/GroupQuotaLimitsRequestsClient.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/fluent/GroupQuotaLimitsRequestsClient.java new file mode 100644 index 000000000000..9b6852ad4a17 --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/fluent/GroupQuotaLimitsRequestsClient.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.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.quota.fluent.models.SubmittedResourceRequestStatusInner; + +/** An instance of this class provides access to all the operations defined in GroupQuotaLimitsRequestsClient. */ +public interface GroupQuotaLimitsRequestsClient { + /** + * List the status of all GroupQuota requests. + * + *

List API to check the status of a GroupQuota requests by requestId. The groupQuotaRequest history is + * maintained for 1 year. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return share Quota Entity list as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String mgId, String resourceProviderScope, String groupQuotaName); + + /** + * List the status of all GroupQuota requests. + * + *

List API to check the status of a GroupQuota requests by requestId. The groupQuotaRequest history is + * maintained for 1 year. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @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 share Quota Entity list as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String mgId, String resourceProviderScope, String groupQuotaName, Context context); + + /** + * Get the status of a single GroupQuota request by requestId. + * + *

Get API to check the status of a GroupQuota request by requestId. Use the polling API - OperationsStatus URI + * specified in Azure-AsyncOperation header field, with retry-after duration in seconds to check the intermediate + * status. This API provides the finals status with the request details and status. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param requestId Request 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 aPI to check the status of a GroupQuota request by requestId along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String mgId, String resourceProviderScope, String groupQuotaName, String requestId, Context context); + + /** + * Get the status of a single GroupQuota request by requestId. + * + *

Get API to check the status of a GroupQuota request by requestId. Use the polling API - OperationsStatus URI + * specified in Azure-AsyncOperation header field, with retry-after duration in seconds to check the intermediate + * status. This API provides the finals status with the request details and status. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param requestId Request 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 aPI to check the status of a GroupQuota request by requestId. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SubmittedResourceRequestStatusInner get( + String mgId, String resourceProviderScope, String groupQuotaName, String requestId); +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/fluent/GroupQuotaSubscriptionQuotaAllocationRequestsClient.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/fluent/GroupQuotaSubscriptionQuotaAllocationRequestsClient.java new file mode 100644 index 000000000000..8b63f16c7bcf --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/fluent/GroupQuotaSubscriptionQuotaAllocationRequestsClient.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.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.quota.fluent.models.SubscriptionQuotaAllocationRequestInner; + +/** + * An instance of this class provides access to all the operations defined in + * GroupQuotaSubscriptionQuotaAllocationRequestsClient. + */ +public interface GroupQuotaSubscriptionQuotaAllocationRequestsClient { + /** + * Get the status of the quota allocation request for the subscriptionId. + * + *

Get the quota allocation request status for the subscriptionId by allocationId. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param allocationId Resource allocation 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 quota allocation request status for the subscriptionId by allocationId along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String mgId, String resourceProviderScope, String groupQuotaName, String allocationId, Context context); + + /** + * Get the status of the quota allocation request for the subscriptionId. + * + *

Get the quota allocation request status for the subscriptionId by allocationId. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param allocationId Resource allocation 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 quota allocation request status for the subscriptionId by allocationId. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SubscriptionQuotaAllocationRequestInner get( + String mgId, String resourceProviderScope, String groupQuotaName, String allocationId); + + /** + * Lists all the quota allocation requests.to subscriptions + * + *

Lists all the allocation requests. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String mgId, String resourceProviderScope, String groupQuotaName); + + /** + * Lists all the quota allocation requests.to subscriptions + * + *

Lists all the allocation requests. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @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 paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String mgId, String resourceProviderScope, String groupQuotaName, Context context); +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/fluent/GroupQuotaSubscriptionQuotaAllocationsClient.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/fluent/GroupQuotaSubscriptionQuotaAllocationsClient.java new file mode 100644 index 000000000000..b1bd19946a24 --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/fluent/GroupQuotaSubscriptionQuotaAllocationsClient.java @@ -0,0 +1,387 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.quota.fluent.models.SubscriptionQuotaAllocationsInner; + +/** + * An instance of this class provides access to all the operations defined in + * GroupQuotaSubscriptionQuotaAllocationsClient. + */ +public interface GroupQuotaSubscriptionQuotaAllocationsClient { + /** + * Gets all the quota assigned to a subscription for the specific Resource Provider, Location. + * + *

Gets all the quota assigned to a subscription for the specific Resource Provider, Location. This will include + * the GroupQuota and total quota assigned to the subscription. Only the Group quota assigned to the subscription + * can be assigned back to the MG Group Quota. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the quota assigned to a subscription for the specific Resource Provider, Location as paginated + * response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String mgId, String resourceProviderScope, String groupQuotaName); + + /** + * Gets all the quota assigned to a subscription for the specific Resource Provider, Location. + * + *

Gets all the quota assigned to a subscription for the specific Resource Provider, Location. This will include + * the GroupQuota and total quota assigned to the subscription. Only the Group quota assigned to the subscription + * can be assigned back to the MG Group Quota. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the quota assigned to a subscription for the specific Resource Provider, Location as paginated + * response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String mgId, String resourceProviderScope, String groupQuotaName, Context context); + + /** + * Request to assign quota from group quota to a specific Subscription. This request will use Asynchronous pattern + * to check the status using Async polling as standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * + *

Request to assign a specific resource quota from group quota to a specific Subscription. The subscriptions can + * also reduce the quota assigned to subscription to give back the group back to MG. The quota assignment back to MG + * groupQuota is limited by the GroupQuota assigned to subscription, which means the maximum unused quota assigned + * back to MG groupQuota will be the groupQuota assigned to the subscriptions. So, this API can used to assign Quota + * to subscriptions and assign back unused quota, which was previously assigned from MG groupQuota to subscription. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource name. + * @param allocateQuotaRequest Quota requests payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 quota assigned to a subscription for the specific Resource + * Provider, Location, ResourceName. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SubscriptionQuotaAllocationsInner> beginCreateOrUpdate( + String mgId, + String resourceProviderScope, + String groupQuotaName, + String resourceName, + SubscriptionQuotaAllocationsInner allocateQuotaRequest); + + /** + * Request to assign quota from group quota to a specific Subscription. This request will use Asynchronous pattern + * to check the status using Async polling as standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * + *

Request to assign a specific resource quota from group quota to a specific Subscription. The subscriptions can + * also reduce the quota assigned to subscription to give back the group back to MG. The quota assignment back to MG + * groupQuota is limited by the GroupQuota assigned to subscription, which means the maximum unused quota assigned + * back to MG groupQuota will be the groupQuota assigned to the subscriptions. So, this API can used to assign Quota + * to subscriptions and assign back unused quota, which was previously assigned from MG groupQuota to subscription. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource name. + * @param allocateQuotaRequest Quota requests payload. + * @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 quota assigned to a subscription for the specific Resource + * Provider, Location, ResourceName. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SubscriptionQuotaAllocationsInner> beginCreateOrUpdate( + String mgId, + String resourceProviderScope, + String groupQuotaName, + String resourceName, + SubscriptionQuotaAllocationsInner allocateQuotaRequest, + Context context); + + /** + * Request to assign quota from group quota to a specific Subscription. This request will use Asynchronous pattern + * to check the status using Async polling as standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * + *

Request to assign a specific resource quota from group quota to a specific Subscription. The subscriptions can + * also reduce the quota assigned to subscription to give back the group back to MG. The quota assignment back to MG + * groupQuota is limited by the GroupQuota assigned to subscription, which means the maximum unused quota assigned + * back to MG groupQuota will be the groupQuota assigned to the subscriptions. So, this API can used to assign Quota + * to subscriptions and assign back unused quota, which was previously assigned from MG groupQuota to subscription. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource name. + * @param allocateQuotaRequest Quota requests payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return quota assigned to a subscription for the specific Resource Provider, Location, ResourceName. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SubscriptionQuotaAllocationsInner createOrUpdate( + String mgId, + String resourceProviderScope, + String groupQuotaName, + String resourceName, + SubscriptionQuotaAllocationsInner allocateQuotaRequest); + + /** + * Request to assign quota from group quota to a specific Subscription. This request will use Asynchronous pattern + * to check the status using Async polling as standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * + *

Request to assign a specific resource quota from group quota to a specific Subscription. The subscriptions can + * also reduce the quota assigned to subscription to give back the group back to MG. The quota assignment back to MG + * groupQuota is limited by the GroupQuota assigned to subscription, which means the maximum unused quota assigned + * back to MG groupQuota will be the groupQuota assigned to the subscriptions. So, this API can used to assign Quota + * to subscriptions and assign back unused quota, which was previously assigned from MG groupQuota to subscription. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource name. + * @param allocateQuotaRequest Quota requests payload. + * @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 quota assigned to a subscription for the specific Resource Provider, Location, ResourceName. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SubscriptionQuotaAllocationsInner createOrUpdate( + String mgId, + String resourceProviderScope, + String groupQuotaName, + String resourceName, + SubscriptionQuotaAllocationsInner allocateQuotaRequest, + Context context); + + /** + * Request to assign quota from group quota to a specific Subscription. This request will use Asynchronous pattern + * with 202 response and status polling API. + * + *

Request to assign quota from group quota to a specific Subscription. The subscriptions and reduce the quota + * assigned to subscription to give back the group back to MG. The quota assignment back to MG groupQuota is limited + * by the GroupQuota assigned to subscription, using this API. So, this API can used to assign Quota to + * subscriptions and assign back unused quota, which was previously assigned from MG groupQuota to subscription(s). + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource name. + * @param allocateQuotaRequest Quota requests payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 quota assigned to a subscription for the specific Resource + * Provider, Location, ResourceName. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SubscriptionQuotaAllocationsInner> beginUpdate( + String mgId, + String resourceProviderScope, + String groupQuotaName, + String resourceName, + SubscriptionQuotaAllocationsInner allocateQuotaRequest); + + /** + * Request to assign quota from group quota to a specific Subscription. This request will use Asynchronous pattern + * with 202 response and status polling API. + * + *

Request to assign quota from group quota to a specific Subscription. The subscriptions and reduce the quota + * assigned to subscription to give back the group back to MG. The quota assignment back to MG groupQuota is limited + * by the GroupQuota assigned to subscription, using this API. So, this API can used to assign Quota to + * subscriptions and assign back unused quota, which was previously assigned from MG groupQuota to subscription(s). + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource name. + * @param allocateQuotaRequest Quota requests payload. + * @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 quota assigned to a subscription for the specific Resource + * Provider, Location, ResourceName. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SubscriptionQuotaAllocationsInner> beginUpdate( + String mgId, + String resourceProviderScope, + String groupQuotaName, + String resourceName, + SubscriptionQuotaAllocationsInner allocateQuotaRequest, + Context context); + + /** + * Request to assign quota from group quota to a specific Subscription. This request will use Asynchronous pattern + * with 202 response and status polling API. + * + *

Request to assign quota from group quota to a specific Subscription. The subscriptions and reduce the quota + * assigned to subscription to give back the group back to MG. The quota assignment back to MG groupQuota is limited + * by the GroupQuota assigned to subscription, using this API. So, this API can used to assign Quota to + * subscriptions and assign back unused quota, which was previously assigned from MG groupQuota to subscription(s). + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource name. + * @param allocateQuotaRequest Quota requests payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return quota assigned to a subscription for the specific Resource Provider, Location, ResourceName. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SubscriptionQuotaAllocationsInner update( + String mgId, + String resourceProviderScope, + String groupQuotaName, + String resourceName, + SubscriptionQuotaAllocationsInner allocateQuotaRequest); + + /** + * Request to assign quota from group quota to a specific Subscription. This request will use Asynchronous pattern + * with 202 response and status polling API. + * + *

Request to assign quota from group quota to a specific Subscription. The subscriptions and reduce the quota + * assigned to subscription to give back the group back to MG. The quota assignment back to MG groupQuota is limited + * by the GroupQuota assigned to subscription, using this API. So, this API can used to assign Quota to + * subscriptions and assign back unused quota, which was previously assigned from MG groupQuota to subscription(s). + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource name. + * @param allocateQuotaRequest Quota requests payload. + * @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 quota assigned to a subscription for the specific Resource Provider, Location, ResourceName. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SubscriptionQuotaAllocationsInner update( + String mgId, + String resourceProviderScope, + String groupQuotaName, + String resourceName, + SubscriptionQuotaAllocationsInner allocateQuotaRequest, + Context context); + + /** + * Gets Quota assigned to a subscription for the specific Resource Provider, Location, ResourceName. + * + *

Gets Quota assigned to a subscription for the specific Resource Provider, Location, ResourceName. This will + * include the GroupQuota and total quota assigned to the subscription. Only the Group quota assigned to the + * subscription can be assigned back to the MG Group Quota. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource 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 quota assigned to a subscription for the specific Resource Provider, Location, ResourceName along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String mgId, String resourceProviderScope, String groupQuotaName, String resourceName, Context context); + + /** + * Gets Quota assigned to a subscription for the specific Resource Provider, Location, ResourceName. + * + *

Gets Quota assigned to a subscription for the specific Resource Provider, Location, ResourceName. This will + * include the GroupQuota and total quota assigned to the subscription. Only the Group quota assigned to the + * subscription can be assigned back to the MG Group Quota. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource 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 quota assigned to a subscription for the specific Resource Provider, Location, ResourceName. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SubscriptionQuotaAllocationsInner get( + String mgId, String resourceProviderScope, String groupQuotaName, String resourceName); +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/fluent/GroupQuotaSubscriptionsClient.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/fluent/GroupQuotaSubscriptionsClient.java new file mode 100644 index 000000000000..37f7987119f5 --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/fluent/GroupQuotaSubscriptionsClient.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.quota.fluent.models.GroupQuotaSubscriptionIdInner; + +/** An instance of this class provides access to all the operations defined in GroupQuotaSubscriptionsClient. */ +public interface GroupQuotaSubscriptionsClient { + /** + * Adds subscription to the GroupQuotas. + * + *

Adds a subscription to GroupQuotas. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 this represents a Azure subscriptionId that is associated with a + * GroupQuotaSEntity. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, GroupQuotaSubscriptionIdInner> beginCreateOrUpdate( + String mgId, String groupQuotaName); + + /** + * Adds subscription to the GroupQuotas. + * + *

Adds a subscription to GroupQuotas. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @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 this represents a Azure subscriptionId that is associated with a + * GroupQuotaSEntity. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, GroupQuotaSubscriptionIdInner> beginCreateOrUpdate( + String mgId, String groupQuotaName, Context context); + + /** + * Adds subscription to the GroupQuotas. + * + *

Adds a subscription to GroupQuotas. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this represents a Azure subscriptionId that is associated with a GroupQuotaSEntity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GroupQuotaSubscriptionIdInner createOrUpdate(String mgId, String groupQuotaName); + + /** + * Adds subscription to the GroupQuotas. + * + *

Adds a subscription to GroupQuotas. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @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 this represents a Azure subscriptionId that is associated with a GroupQuotaSEntity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GroupQuotaSubscriptionIdInner createOrUpdate(String mgId, String groupQuotaName, Context context); + + /** + * Updates the GroupQuotas with the subscription to add to the subscriptions list. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 this represents a Azure subscriptionId that is associated with a + * GroupQuotaSEntity. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, GroupQuotaSubscriptionIdInner> beginUpdate( + String mgId, String groupQuotaName); + + /** + * Updates the GroupQuotas with the subscription to add to the subscriptions list. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @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 this represents a Azure subscriptionId that is associated with a + * GroupQuotaSEntity. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, GroupQuotaSubscriptionIdInner> beginUpdate( + String mgId, String groupQuotaName, Context context); + + /** + * Updates the GroupQuotas with the subscription to add to the subscriptions list. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this represents a Azure subscriptionId that is associated with a GroupQuotaSEntity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GroupQuotaSubscriptionIdInner update(String mgId, String groupQuotaName); + + /** + * Updates the GroupQuotas with the subscription to add to the subscriptions list. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @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 this represents a Azure subscriptionId that is associated with a GroupQuotaSEntity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GroupQuotaSubscriptionIdInner update(String mgId, String groupQuotaName, Context context); + + /** + * Removes the subscription from GroupQuotas. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String mgId, String groupQuotaName, Context context); + + /** + * Removes the subscription from GroupQuotas. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String mgId, String groupQuotaName); + + /** + * Returns the subscriptionId along with its provisioning state for being associated with the GroupQuotasEntity. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @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 this represents a Azure subscriptionId that is associated with a GroupQuotaSEntity along with {@link + * Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String mgId, String groupQuotaName, Context context); + + /** + * Returns the subscriptionId along with its provisioning state for being associated with the GroupQuotasEntity. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this represents a Azure subscriptionId that is associated with a GroupQuotaSEntity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GroupQuotaSubscriptionIdInner get(String mgId, String groupQuotaName); + + /** + * Returns a list of the subscriptionIds associated with the GroupQuotasEntity. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of GroupQuotaSubscriptionIds as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String mgId, String groupQuotaName); + + /** + * Returns a list of the subscriptionIds associated with the GroupQuotasEntity. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @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 list of GroupQuotaSubscriptionIds as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String mgId, String groupQuotaName, Context context); +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/fluent/GroupQuotasClient.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/fluent/GroupQuotasClient.java new file mode 100644 index 000000000000..ec5d3a709458 --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/fluent/GroupQuotasClient.java @@ -0,0 +1,289 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.quota.fluent.models.GroupQuotasEntityInner; + +/** An instance of this class provides access to all the operations defined in GroupQuotasClient. */ +public interface GroupQuotasClient { + /** + * Creates a new GroupQuota for the name passed. + * + *

Creates a new GroupQuota for the name passed. A RequestId will be returned by the Service. The status can be + * polled periodically. The status Async polling is using standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to + * Get URI and full details can be checked. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 properties and filters for ShareQuota. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, GroupQuotasEntityInner> beginCreateOrUpdate( + String mgId, String groupQuotaName); + + /** + * Creates a new GroupQuota for the name passed. + * + *

Creates a new GroupQuota for the name passed. A RequestId will be returned by the Service. The status can be + * polled periodically. The status Async polling is using standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to + * Get URI and full details can be checked. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param groupQuotaPutRequestBody The GroupQuota body details for creation or update of a GroupQuota entity. + * @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 properties and filters for ShareQuota. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, GroupQuotasEntityInner> beginCreateOrUpdate( + String mgId, String groupQuotaName, GroupQuotasEntityInner groupQuotaPutRequestBody, Context context); + + /** + * Creates a new GroupQuota for the name passed. + * + *

Creates a new GroupQuota for the name passed. A RequestId will be returned by the Service. The status can be + * polled periodically. The status Async polling is using standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to + * Get URI and full details can be checked. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties and filters for ShareQuota. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GroupQuotasEntityInner createOrUpdate(String mgId, String groupQuotaName); + + /** + * Creates a new GroupQuota for the name passed. + * + *

Creates a new GroupQuota for the name passed. A RequestId will be returned by the Service. The status can be + * polled periodically. The status Async polling is using standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to + * Get URI and full details can be checked. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param groupQuotaPutRequestBody The GroupQuota body details for creation or update of a GroupQuota entity. + * @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 properties and filters for ShareQuota. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GroupQuotasEntityInner createOrUpdate( + String mgId, String groupQuotaName, GroupQuotasEntityInner groupQuotaPutRequestBody, Context context); + + /** + * Updates a new GroupQuotas for the name passed. + * + *

Updates the GroupQuotas for the name passed. A GroupQuotas RequestId will be returned by the Service. The + * status can be polled periodically. The status Async polling is using standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to + * Get URI and full details can be checked. Any change in the filters will be applicable to the future quota + * assignments, existing quota assigned to subscriptions from the GroupQuotas remains unchanged. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 properties and filters for ShareQuota. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, GroupQuotasEntityInner> beginUpdate( + String mgId, String groupQuotaName); + + /** + * Updates a new GroupQuotas for the name passed. + * + *

Updates the GroupQuotas for the name passed. A GroupQuotas RequestId will be returned by the Service. The + * status can be polled periodically. The status Async polling is using standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to + * Get URI and full details can be checked. Any change in the filters will be applicable to the future quota + * assignments, existing quota assigned to subscriptions from the GroupQuotas remains unchanged. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param groupQuotasPatchRequestBody The GroupQuotas Patch Request. + * @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 properties and filters for ShareQuota. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, GroupQuotasEntityInner> beginUpdate( + String mgId, String groupQuotaName, GroupQuotasEntityInner groupQuotasPatchRequestBody, Context context); + + /** + * Updates a new GroupQuotas for the name passed. + * + *

Updates the GroupQuotas for the name passed. A GroupQuotas RequestId will be returned by the Service. The + * status can be polled periodically. The status Async polling is using standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to + * Get URI and full details can be checked. Any change in the filters will be applicable to the future quota + * assignments, existing quota assigned to subscriptions from the GroupQuotas remains unchanged. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties and filters for ShareQuota. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GroupQuotasEntityInner update(String mgId, String groupQuotaName); + + /** + * Updates a new GroupQuotas for the name passed. + * + *

Updates the GroupQuotas for the name passed. A GroupQuotas RequestId will be returned by the Service. The + * status can be polled periodically. The status Async polling is using standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to + * Get URI and full details can be checked. Any change in the filters will be applicable to the future quota + * assignments, existing quota assigned to subscriptions from the GroupQuotas remains unchanged. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param groupQuotasPatchRequestBody The GroupQuotas Patch Request. + * @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 properties and filters for ShareQuota. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GroupQuotasEntityInner update( + String mgId, String groupQuotaName, GroupQuotasEntityInner groupQuotasPatchRequestBody, Context context); + + /** + * Gets GroupQuotas for the name passed. + * + *

Gets the GroupQuotas for the name passed. It will return the GroupQuotas properties only. The details on + * groupQuota can be access from the groupQuota APIs. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @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 GroupQuotas for the name passed along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String mgId, String groupQuotaName, Context context); + + /** + * Gets GroupQuotas for the name passed. + * + *

Gets the GroupQuotas for the name passed. It will return the GroupQuotas properties only. The details on + * groupQuota can be access from the groupQuota APIs. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the GroupQuotas for the name passed. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GroupQuotasEntityInner get(String mgId, String groupQuotaName); + + /** + * Deletes GroupQuotas for the name passed. + * + *

Deletes the GroupQuotas for the name passed. All the remaining shareQuota in the GroupQuotas will be lost. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String mgId, String groupQuotaName, Context context); + + /** + * Deletes GroupQuotas for the name passed. + * + *

Deletes the GroupQuotas for the name passed. All the remaining shareQuota in the GroupQuotas will be lost. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String mgId, String groupQuotaName); + + /** + * Lists GroupQuotas for the scope passed. + * + *

Lists GroupQuotas for the scope passed. It will return the GroupQuotas QuotaEntity properties only.The details + * on groupQuota can be access from the groupQuota APIs. + * + * @param mgId Management Group Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Group Quotas at MG level as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String mgId); + + /** + * Lists GroupQuotas for the scope passed. + * + *

Lists GroupQuotas for the scope passed. It will return the GroupQuotas QuotaEntity properties only.The details + * on groupQuota can be access from the groupQuota APIs. + * + * @param mgId Management Group Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Group Quotas at MG level as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String mgId, Context context); +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/fluent/SubscriptionRequestsClient.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/fluent/SubscriptionRequestsClient.java new file mode 100644 index 000000000000..2b14e7538654 --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/fluent/SubscriptionRequestsClient.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.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.quota.fluent.models.GroupQuotaSubscriptionIdInner; + +/** An instance of this class provides access to all the operations defined in SubscriptionRequestsClient. */ +public interface SubscriptionRequestsClient { + /** + * List the status of all requests to add subscriptionIds to the GroupQuotasEntity. + * + *

List API to check the status of a subscriptionId requests by requestId. Request history is maintained for 1 + * year. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of GroupQuotaSubscriptionIds as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String mgId, String groupQuotaName); + + /** + * List the status of all requests to add subscriptionIds to the GroupQuotasEntity. + * + *

List API to check the status of a subscriptionId requests by requestId. Request history is maintained for 1 + * year. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @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 list of GroupQuotaSubscriptionIds as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String mgId, String groupQuotaName, Context context); + + /** + * Get the status of a single subscriptionId request by requestId. + * + *

Get API to check the status of a subscriptionIds request by requestId. Use the polling API - OperationsStatus + * URI specified in Azure-AsyncOperation header field, with retry-after duration in seconds to check the + * intermediate status. This API provides the finals status with the request details and status. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param requestId Request 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 aPI to check the status of a subscriptionIds request by requestId along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String mgId, String groupQuotaName, String requestId, Context context); + + /** + * Get the status of a single subscriptionId request by requestId. + * + *

Get API to check the status of a subscriptionIds request by requestId. Use the polling API - OperationsStatus + * URI specified in Azure-AsyncOperation header field, with retry-after duration in seconds to check the + * intermediate status. This API provides the finals status with the request details and status. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param requestId Request 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 aPI to check the status of a subscriptionIds request by requestId. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GroupQuotaSubscriptionIdInner get(String mgId, String groupQuotaName, String requestId); +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/fluent/models/GroupQuotaLimitInner.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/fluent/models/GroupQuotaLimitInner.java new file mode 100644 index 000000000000..53db9bed7c0c --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/fluent/models/GroupQuotaLimitInner.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.quota.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.quota.models.GroupQuotaDetails; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Group Quota limit. */ +@Fluent +public final class GroupQuotaLimitInner extends ProxyResource { + /* + * Group Quota properties for the specified resource. + */ + @JsonProperty(value = "properties") + private GroupQuotaDetails properties; + + /** Creates an instance of GroupQuotaLimitInner class. */ + public GroupQuotaLimitInner() { + } + + /** + * Get the properties property: Group Quota properties for the specified resource. + * + * @return the properties value. + */ + public GroupQuotaDetails properties() { + return this.properties; + } + + /** + * Set the properties property: Group Quota properties for the specified resource. + * + * @param properties the properties value to set. + * @return the GroupQuotaLimitInner object itself. + */ + public GroupQuotaLimitInner withProperties(GroupQuotaDetails 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(); + } + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/fluent/models/GroupQuotaSubscriptionIdInner.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/fluent/models/GroupQuotaSubscriptionIdInner.java new file mode 100644 index 000000000000..71b22f08d4ae --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/fluent/models/GroupQuotaSubscriptionIdInner.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.quota.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.quota.models.GroupQuotaSubscriptionIdProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** This represents a Azure subscriptionId that is associated with a GroupQuotaSEntity. */ +@Fluent +public final class GroupQuotaSubscriptionIdInner extends ProxyResource { + /* + * The properties property. + */ + @JsonProperty(value = "properties") + private GroupQuotaSubscriptionIdProperties properties; + + /** Creates an instance of GroupQuotaSubscriptionIdInner class. */ + public GroupQuotaSubscriptionIdInner() { + } + + /** + * Get the properties property: The properties property. + * + * @return the properties value. + */ + public GroupQuotaSubscriptionIdProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The properties property. + * + * @param properties the properties value to set. + * @return the GroupQuotaSubscriptionIdInner object itself. + */ + public GroupQuotaSubscriptionIdInner withProperties(GroupQuotaSubscriptionIdProperties 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(); + } + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/fluent/models/GroupQuotasEntityInner.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/fluent/models/GroupQuotasEntityInner.java new file mode 100644 index 000000000000..77dc0b61b8a3 --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/fluent/models/GroupQuotasEntityInner.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.quota.models.GroupQuotasEntityBase; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties and filters for ShareQuota. The request parameter is optional, if there are no filters specified. */ +@Fluent +public final class GroupQuotasEntityInner extends ProxyResource { + /* + * Properties and filters for ShareQuota. The request parameter is optional, if there are no filters specified. + */ + @JsonProperty(value = "properties") + private GroupQuotasEntityBase properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of GroupQuotasEntityInner class. */ + public GroupQuotasEntityInner() { + } + + /** + * Get the properties property: Properties and filters for ShareQuota. The request parameter is optional, if there + * are no filters specified. + * + * @return the properties value. + */ + public GroupQuotasEntityBase properties() { + return this.properties; + } + + /** + * Set the properties property: Properties and filters for ShareQuota. The request parameter is optional, if there + * are no filters specified. + * + * @param properties the properties value to set. + * @return the GroupQuotasEntityInner object itself. + */ + public GroupQuotasEntityInner withProperties(GroupQuotasEntityBase properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/fluent/models/SubmittedResourceRequestStatusInner.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/fluent/models/SubmittedResourceRequestStatusInner.java new file mode 100644 index 000000000000..0a4cb68d57be --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/fluent/models/SubmittedResourceRequestStatusInner.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.quota.models.RequestState; +import com.azure.resourcemanager.quota.models.ResourceBaseRequest; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Status of a single GroupQuota request. */ +@Fluent +public final class SubmittedResourceRequestStatusInner { + /* + * Requested Resource. + */ + @JsonProperty(value = "requestedResource") + private ResourceBaseRequest requestedResource; + + /* + * Request status. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private RequestState status; + + /** Creates an instance of SubmittedResourceRequestStatusInner class. */ + public SubmittedResourceRequestStatusInner() { + } + + /** + * Get the requestedResource property: Requested Resource. + * + * @return the requestedResource value. + */ + public ResourceBaseRequest requestedResource() { + return this.requestedResource; + } + + /** + * Set the requestedResource property: Requested Resource. + * + * @param requestedResource the requestedResource value to set. + * @return the SubmittedResourceRequestStatusInner object itself. + */ + public SubmittedResourceRequestStatusInner withRequestedResource(ResourceBaseRequest requestedResource) { + this.requestedResource = requestedResource; + return this; + } + + /** + * Get the status property: Request status. + * + * @return the status value. + */ + public RequestState status() { + return this.status; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (requestedResource() != null) { + requestedResource().validate(); + } + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/fluent/models/SubscriptionQuotaAllocationRequestInner.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/fluent/models/SubscriptionQuotaAllocationRequestInner.java new file mode 100644 index 000000000000..9d74ee75b7d5 --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/fluent/models/SubscriptionQuotaAllocationRequestInner.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.quota.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.quota.models.SubscriptionQuotaAllocationRequestProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The new quota limit for the subscription. */ +@Fluent +public final class SubscriptionQuotaAllocationRequestInner { + /* + * The properties property. + */ + @JsonProperty(value = "properties") + private SubscriptionQuotaAllocationRequestProperties properties; + + /** Creates an instance of SubscriptionQuotaAllocationRequestInner class. */ + public SubscriptionQuotaAllocationRequestInner() { + } + + /** + * Get the properties property: The properties property. + * + * @return the properties value. + */ + public SubscriptionQuotaAllocationRequestProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The properties property. + * + * @param properties the properties value to set. + * @return the SubscriptionQuotaAllocationRequestInner object itself. + */ + public SubscriptionQuotaAllocationRequestInner withProperties( + SubscriptionQuotaAllocationRequestProperties 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(); + } + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/fluent/models/SubscriptionQuotaAllocationsInner.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/fluent/models/SubscriptionQuotaAllocationsInner.java new file mode 100644 index 000000000000..cf47fb789b23 --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/fluent/models/SubscriptionQuotaAllocationsInner.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.quota.models.SubscriptionQuotaDetails; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Quota assigned to a subscription for the specific Resource Provider, Location, ResourceName. This will include the + * GroupQuota and total quota assigned to the subscription. Only the Group quota assigned to the subscription can be + * assigned back to the MG Group Quota. + */ +@Fluent +public final class SubscriptionQuotaAllocationsInner extends ProxyResource { + /* + * Quota properties for the specified resource. + */ + @JsonProperty(value = "properties") + private SubscriptionQuotaDetails properties; + + /** Creates an instance of SubscriptionQuotaAllocationsInner class. */ + public SubscriptionQuotaAllocationsInner() { + } + + /** + * Get the properties property: Quota properties for the specified resource. + * + * @return the properties value. + */ + public SubscriptionQuotaDetails properties() { + return this.properties; + } + + /** + * Set the properties property: Quota properties for the specified resource. + * + * @param properties the properties value to set. + * @return the SubscriptionQuotaAllocationsInner object itself. + */ + public SubscriptionQuotaAllocationsInner withProperties(SubscriptionQuotaDetails 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(); + } + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/fluent/models/package-info.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/fluent/models/package-info.java index 674fb9e78bb0..1803854c58ed 100644 --- a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/fluent/models/package-info.java +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/fluent/models/package-info.java @@ -2,5 +2,8 @@ // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. -/** Package containing the inner data models for AzureQuotaExtensionApi. Microsoft Azure Quota Resource Provider. */ +/** + * Package containing the inner data models for AzureQuotaExtensionApi. Microsoft Azure Quota Resource Provider. This + * Swagger is for Azure MG Group Quota using GroupQuota Entity. + */ package com.azure.resourcemanager.quota.fluent.models; diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/fluent/package-info.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/fluent/package-info.java index f9b7490e09e3..aa2a65d145e4 100644 --- a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/fluent/package-info.java +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/fluent/package-info.java @@ -2,5 +2,8 @@ // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. -/** Package containing the service clients for AzureQuotaExtensionApi. Microsoft Azure Quota Resource Provider. */ +/** + * Package containing the service clients for AzureQuotaExtensionApi. Microsoft Azure Quota Resource Provider. This + * Swagger is for Azure MG Group Quota using GroupQuota Entity. + */ package com.azure.resourcemanager.quota.fluent; diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/AzureQuotaExtensionApiBuilder.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/AzureQuotaExtensionApiBuilder.java index a54ca0ebb91e..02fbdaba7269 100644 --- a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/AzureQuotaExtensionApiBuilder.java +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/AzureQuotaExtensionApiBuilder.java @@ -17,6 +17,38 @@ /** A builder for creating a new instance of the AzureQuotaExtensionApiImpl type. */ @ServiceClientBuilder(serviceClients = {AzureQuotaExtensionApiImpl.class}) public final class AzureQuotaExtensionApiBuilder { + /* + * The ID of the target subscription. The value must be an UUID. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. The value must be an UUID. + * + * @param subscriptionId the subscriptionId value. + * @return the AzureQuotaExtensionApiBuilder. + */ + public AzureQuotaExtensionApiBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the AzureQuotaExtensionApiBuilder. + */ + public AzureQuotaExtensionApiBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + /* * server parameter */ @@ -103,6 +135,7 @@ public AzureQuotaExtensionApiBuilder serializerAdapter(SerializerAdapter seriali * @return an instance of AzureQuotaExtensionApiImpl. */ public AzureQuotaExtensionApiImpl buildClient() { + String localEndpoint = (endpoint != null) ? endpoint : ""; String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; HttpPipeline localPipeline = @@ -117,7 +150,13 @@ public AzureQuotaExtensionApiImpl buildClient() { : SerializerFactory.createDefaultManagementSerializerAdapter(); AzureQuotaExtensionApiImpl client = new AzureQuotaExtensionApiImpl( - localPipeline, localSerializerAdapter, localDefaultPollInterval, localEnvironment, localEndpoint); + localPipeline, + localSerializerAdapter, + localDefaultPollInterval, + localEnvironment, + subscriptionId, + localEndpoint, + localEndpoint); return client; } } diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/AzureQuotaExtensionApiImpl.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/AzureQuotaExtensionApiImpl.java index 47b8c2141941..caddfa8dd4fc 100644 --- a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/AzureQuotaExtensionApiImpl.java +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/AzureQuotaExtensionApiImpl.java @@ -23,9 +23,16 @@ import com.azure.core.util.serializer.SerializerAdapter; import com.azure.core.util.serializer.SerializerEncoding; import com.azure.resourcemanager.quota.fluent.AzureQuotaExtensionApi; +import com.azure.resourcemanager.quota.fluent.GroupQuotaLimitsClient; +import com.azure.resourcemanager.quota.fluent.GroupQuotaLimitsRequestsClient; +import com.azure.resourcemanager.quota.fluent.GroupQuotaSubscriptionQuotaAllocationRequestsClient; +import com.azure.resourcemanager.quota.fluent.GroupQuotaSubscriptionQuotaAllocationsClient; +import com.azure.resourcemanager.quota.fluent.GroupQuotaSubscriptionsClient; +import com.azure.resourcemanager.quota.fluent.GroupQuotasClient; import com.azure.resourcemanager.quota.fluent.QuotaOperationsClient; import com.azure.resourcemanager.quota.fluent.QuotaRequestStatusClient; import com.azure.resourcemanager.quota.fluent.QuotasClient; +import com.azure.resourcemanager.quota.fluent.SubscriptionRequestsClient; import com.azure.resourcemanager.quota.fluent.UsagesClient; import java.io.IOException; import java.lang.reflect.Type; @@ -39,6 +46,18 @@ /** Initializes a new instance of the AzureQuotaExtensionApiImpl type. */ @ServiceClient(builder = AzureQuotaExtensionApiBuilder.class) public final class AzureQuotaExtensionApiImpl implements AzureQuotaExtensionApi { + /** The ID of the target subscription. The value must be an UUID. */ + private final String subscriptionId; + + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + /** server parameter. */ private final String endpoint; @@ -51,16 +70,16 @@ public String getEndpoint() { return this.endpoint; } - /** Api Version. */ - private final String apiVersion; + /** server parameter. */ + private final String endpoint; /** - * Gets Api Version. + * Gets server parameter. * - * @return the apiVersion value. + * @return the endpoint value. */ - public String getApiVersion() { - return this.apiVersion; + public String getEndpoint() { + return this.endpoint; } /** The HTTP pipeline to send requests through. */ @@ -99,6 +118,90 @@ public Duration getDefaultPollInterval() { return this.defaultPollInterval; } + /** The GroupQuotasClient object to access its operations. */ + private final GroupQuotasClient groupQuotas; + + /** + * Gets the GroupQuotasClient object to access its operations. + * + * @return the GroupQuotasClient object. + */ + public GroupQuotasClient getGroupQuotas() { + return this.groupQuotas; + } + + /** The GroupQuotaSubscriptionsClient object to access its operations. */ + private final GroupQuotaSubscriptionsClient groupQuotaSubscriptions; + + /** + * Gets the GroupQuotaSubscriptionsClient object to access its operations. + * + * @return the GroupQuotaSubscriptionsClient object. + */ + public GroupQuotaSubscriptionsClient getGroupQuotaSubscriptions() { + return this.groupQuotaSubscriptions; + } + + /** The SubscriptionRequestsClient object to access its operations. */ + private final SubscriptionRequestsClient subscriptionRequests; + + /** + * Gets the SubscriptionRequestsClient object to access its operations. + * + * @return the SubscriptionRequestsClient object. + */ + public SubscriptionRequestsClient getSubscriptionRequests() { + return this.subscriptionRequests; + } + + /** The GroupQuotaLimitsClient object to access its operations. */ + private final GroupQuotaLimitsClient groupQuotaLimits; + + /** + * Gets the GroupQuotaLimitsClient object to access its operations. + * + * @return the GroupQuotaLimitsClient object. + */ + public GroupQuotaLimitsClient getGroupQuotaLimits() { + return this.groupQuotaLimits; + } + + /** The GroupQuotaLimitsRequestsClient object to access its operations. */ + private final GroupQuotaLimitsRequestsClient groupQuotaLimitsRequests; + + /** + * Gets the GroupQuotaLimitsRequestsClient object to access its operations. + * + * @return the GroupQuotaLimitsRequestsClient object. + */ + public GroupQuotaLimitsRequestsClient getGroupQuotaLimitsRequests() { + return this.groupQuotaLimitsRequests; + } + + /** The GroupQuotaSubscriptionQuotaAllocationsClient object to access its operations. */ + private final GroupQuotaSubscriptionQuotaAllocationsClient groupQuotaSubscriptionQuotaAllocations; + + /** + * Gets the GroupQuotaSubscriptionQuotaAllocationsClient object to access its operations. + * + * @return the GroupQuotaSubscriptionQuotaAllocationsClient object. + */ + public GroupQuotaSubscriptionQuotaAllocationsClient getGroupQuotaSubscriptionQuotaAllocations() { + return this.groupQuotaSubscriptionQuotaAllocations; + } + + /** The GroupQuotaSubscriptionQuotaAllocationRequestsClient object to access its operations. */ + private final GroupQuotaSubscriptionQuotaAllocationRequestsClient groupQuotaSubscriptionQuotaAllocationRequests; + + /** + * Gets the GroupQuotaSubscriptionQuotaAllocationRequestsClient object to access its operations. + * + * @return the GroupQuotaSubscriptionQuotaAllocationRequestsClient object. + */ + public GroupQuotaSubscriptionQuotaAllocationRequestsClient getGroupQuotaSubscriptionQuotaAllocationRequests() { + return this.groupQuotaSubscriptionQuotaAllocationRequests; + } + /** The UsagesClient object to access its operations. */ private final UsagesClient usages; @@ -154,6 +257,8 @@ public QuotaOperationsClient getQuotaOperations() { * @param serializerAdapter The serializer to serialize an object into a string. * @param defaultPollInterval The default poll interval for long-running operation. * @param environment The Azure environment. + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param endpoint server parameter. * @param endpoint server parameter. */ AzureQuotaExtensionApiImpl( @@ -161,12 +266,23 @@ public QuotaOperationsClient getQuotaOperations() { SerializerAdapter serializerAdapter, Duration defaultPollInterval, AzureEnvironment environment, + String subscriptionId, + String endpoint, String endpoint) { this.httpPipeline = httpPipeline; this.serializerAdapter = serializerAdapter; this.defaultPollInterval = defaultPollInterval; + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; this.endpoint = endpoint; - this.apiVersion = "2023-02-01"; + this.groupQuotas = new GroupQuotasClientImpl(this); + this.groupQuotaSubscriptions = new GroupQuotaSubscriptionsClientImpl(this); + this.subscriptionRequests = new SubscriptionRequestsClientImpl(this); + this.groupQuotaLimits = new GroupQuotaLimitsClientImpl(this); + this.groupQuotaLimitsRequests = new GroupQuotaLimitsRequestsClientImpl(this); + this.groupQuotaSubscriptionQuotaAllocations = new GroupQuotaSubscriptionQuotaAllocationsClientImpl(this); + this.groupQuotaSubscriptionQuotaAllocationRequests = + new GroupQuotaSubscriptionQuotaAllocationRequestsClientImpl(this); this.usages = new UsagesClientImpl(this); this.quotas = new QuotasClientImpl(this); this.quotaRequestStatus = new QuotaRequestStatusClientImpl(this); diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/GroupQuotaLimitImpl.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/GroupQuotaLimitImpl.java new file mode 100644 index 000000000000..0a3b6ed9ff03 --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/GroupQuotaLimitImpl.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.implementation; + +import com.azure.resourcemanager.quota.fluent.models.GroupQuotaLimitInner; +import com.azure.resourcemanager.quota.models.GroupQuotaDetails; +import com.azure.resourcemanager.quota.models.GroupQuotaLimit; + +public final class GroupQuotaLimitImpl implements GroupQuotaLimit { + private GroupQuotaLimitInner innerObject; + + private final com.azure.resourcemanager.quota.QuotaManager serviceManager; + + GroupQuotaLimitImpl(GroupQuotaLimitInner innerObject, com.azure.resourcemanager.quota.QuotaManager 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 GroupQuotaDetails properties() { + return this.innerModel().properties(); + } + + public GroupQuotaLimitInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.quota.QuotaManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/GroupQuotaLimitsClientImpl.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/GroupQuotaLimitsClientImpl.java new file mode 100644 index 000000000000..f752c6fb2f99 --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/GroupQuotaLimitsClientImpl.java @@ -0,0 +1,1700 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.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.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.quota.fluent.GroupQuotaLimitsClient; +import com.azure.resourcemanager.quota.fluent.models.GroupQuotaLimitInner; +import com.azure.resourcemanager.quota.models.GroupQuotaLimitList; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in GroupQuotaLimitsClient. */ +public final class GroupQuotaLimitsClientImpl implements GroupQuotaLimitsClient { + /** The proxy service used to perform REST calls. */ + private final GroupQuotaLimitsService service; + + /** The service client containing this operation class. */ + private final AzureQuotaExtensionApiImpl client; + + /** + * Initializes an instance of GroupQuotaLimitsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + GroupQuotaLimitsClientImpl(AzureQuotaExtensionApiImpl client) { + this.service = + RestProxy.create(GroupQuotaLimitsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureQuotaExtensionApiGroupQuotaLimits to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureQuotaExtensionA") + public interface GroupQuotaLimitsService { + @Headers({"Content-Type: application/json"}) + @Put( + "/providers/Microsoft.Management/managementGroups/{mgId}/{resourceProviderScope}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/groupQuotaLimits/{resourceName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("mgId") String mgId, + @PathParam("resourceProviderScope") String resourceProviderScope, + @PathParam("groupQuotaName") String groupQuotaName, + @PathParam("resourceName") String resourceName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") GroupQuotaLimitInner groupQuotaLimitRequest, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/providers/Microsoft.Management/managementGroups/{mgId}/{resourceProviderScope}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/groupQuotaLimits/{resourceName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("mgId") String mgId, + @PathParam("resourceProviderScope") String resourceProviderScope, + @PathParam("groupQuotaName") String groupQuotaName, + @PathParam("resourceName") String resourceName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") GroupQuotaLimitInner groupQuotaLimitRequest, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Management/managementGroups/{mgId}/{resourceProviderScope}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/groupQuotaLimits/{resourceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("mgId") String mgId, + @PathParam("resourceProviderScope") String resourceProviderScope, + @PathParam("groupQuotaName") String groupQuotaName, + @PathParam("resourceName") String resourceName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Management/managementGroups/{mgId}/{resourceProviderScope}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/groupQuotaLimits") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("mgId") String mgId, + @PathParam("resourceProviderScope") String resourceProviderScope, + @PathParam("groupQuotaName") String groupQuotaName, + @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); + } + + /** + * Updates the GroupQuotaLimits for the specific resource under a Management Group. + * + *

Updates the GroupQuotaLimits for the specific resource under a Management Group. A groupQuotaLimitRequestId + * will be returned by the Service. The status can be polled periodically. The status Async polling is using + * standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to + * Get URI and full details can be checked. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource name. + * @param groupQuotaLimitRequest The GroupQuotaLimit Request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return group Quota limit along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String mgId, + String resourceProviderScope, + String groupQuotaName, + String resourceName, + GroupQuotaLimitInner groupQuotaLimitRequest) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (mgId == null) { + return Mono.error(new IllegalArgumentException("Parameter mgId is required and cannot be null.")); + } + if (resourceProviderScope == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceProviderScope is required and cannot be null.")); + } + if (groupQuotaName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupQuotaName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (groupQuotaLimitRequest != null) { + groupQuotaLimitRequest.validate(); + } + final String apiVersion = "2023-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + mgId, + resourceProviderScope, + groupQuotaName, + resourceName, + apiVersion, + groupQuotaLimitRequest, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates the GroupQuotaLimits for the specific resource under a Management Group. + * + *

Updates the GroupQuotaLimits for the specific resource under a Management Group. A groupQuotaLimitRequestId + * will be returned by the Service. The status can be polled periodically. The status Async polling is using + * standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to + * Get URI and full details can be checked. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource name. + * @param groupQuotaLimitRequest The GroupQuotaLimit Request. + * @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 group Quota limit along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String mgId, + String resourceProviderScope, + String groupQuotaName, + String resourceName, + GroupQuotaLimitInner groupQuotaLimitRequest, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (mgId == null) { + return Mono.error(new IllegalArgumentException("Parameter mgId is required and cannot be null.")); + } + if (resourceProviderScope == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceProviderScope is required and cannot be null.")); + } + if (groupQuotaName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupQuotaName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (groupQuotaLimitRequest != null) { + groupQuotaLimitRequest.validate(); + } + final String apiVersion = "2023-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + mgId, + resourceProviderScope, + groupQuotaName, + resourceName, + apiVersion, + groupQuotaLimitRequest, + accept, + context); + } + + /** + * Updates the GroupQuotaLimits for the specific resource under a Management Group. + * + *

Updates the GroupQuotaLimits for the specific resource under a Management Group. A groupQuotaLimitRequestId + * will be returned by the Service. The status can be polled periodically. The status Async polling is using + * standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to + * Get URI and full details can be checked. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource name. + * @param groupQuotaLimitRequest The GroupQuotaLimit Request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 group Quota limit. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, GroupQuotaLimitInner> beginCreateOrUpdateAsync( + String mgId, + String resourceProviderScope, + String groupQuotaName, + String resourceName, + GroupQuotaLimitInner groupQuotaLimitRequest) { + Mono>> mono = + createOrUpdateWithResponseAsync( + mgId, resourceProviderScope, groupQuotaName, resourceName, groupQuotaLimitRequest); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + GroupQuotaLimitInner.class, + GroupQuotaLimitInner.class, + this.client.getContext()); + } + + /** + * Updates the GroupQuotaLimits for the specific resource under a Management Group. + * + *

Updates the GroupQuotaLimits for the specific resource under a Management Group. A groupQuotaLimitRequestId + * will be returned by the Service. The status can be polled periodically. The status Async polling is using + * standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to + * Get URI and full details can be checked. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource 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 {@link PollerFlux} for polling of group Quota limit. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, GroupQuotaLimitInner> beginCreateOrUpdateAsync( + String mgId, String resourceProviderScope, String groupQuotaName, String resourceName) { + final GroupQuotaLimitInner groupQuotaLimitRequest = null; + Mono>> mono = + createOrUpdateWithResponseAsync( + mgId, resourceProviderScope, groupQuotaName, resourceName, groupQuotaLimitRequest); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + GroupQuotaLimitInner.class, + GroupQuotaLimitInner.class, + this.client.getContext()); + } + + /** + * Updates the GroupQuotaLimits for the specific resource under a Management Group. + * + *

Updates the GroupQuotaLimits for the specific resource under a Management Group. A groupQuotaLimitRequestId + * will be returned by the Service. The status can be polled periodically. The status Async polling is using + * standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to + * Get URI and full details can be checked. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource name. + * @param groupQuotaLimitRequest The GroupQuotaLimit Request. + * @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 group Quota limit. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, GroupQuotaLimitInner> beginCreateOrUpdateAsync( + String mgId, + String resourceProviderScope, + String groupQuotaName, + String resourceName, + GroupQuotaLimitInner groupQuotaLimitRequest, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + mgId, resourceProviderScope, groupQuotaName, resourceName, groupQuotaLimitRequest, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), GroupQuotaLimitInner.class, GroupQuotaLimitInner.class, context); + } + + /** + * Updates the GroupQuotaLimits for the specific resource under a Management Group. + * + *

Updates the GroupQuotaLimits for the specific resource under a Management Group. A groupQuotaLimitRequestId + * will be returned by the Service. The status can be polled periodically. The status Async polling is using + * standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to + * Get URI and full details can be checked. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource 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 {@link SyncPoller} for polling of group Quota limit. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, GroupQuotaLimitInner> beginCreateOrUpdate( + String mgId, String resourceProviderScope, String groupQuotaName, String resourceName) { + final GroupQuotaLimitInner groupQuotaLimitRequest = null; + return this + .beginCreateOrUpdateAsync(mgId, resourceProviderScope, groupQuotaName, resourceName, groupQuotaLimitRequest) + .getSyncPoller(); + } + + /** + * Updates the GroupQuotaLimits for the specific resource under a Management Group. + * + *

Updates the GroupQuotaLimits for the specific resource under a Management Group. A groupQuotaLimitRequestId + * will be returned by the Service. The status can be polled periodically. The status Async polling is using + * standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to + * Get URI and full details can be checked. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource name. + * @param groupQuotaLimitRequest The GroupQuotaLimit Request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of group Quota limit. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, GroupQuotaLimitInner> beginCreateOrUpdate( + String mgId, + String resourceProviderScope, + String groupQuotaName, + String resourceName, + GroupQuotaLimitInner groupQuotaLimitRequest, + Context context) { + return this + .beginCreateOrUpdateAsync( + mgId, resourceProviderScope, groupQuotaName, resourceName, groupQuotaLimitRequest, context) + .getSyncPoller(); + } + + /** + * Updates the GroupQuotaLimits for the specific resource under a Management Group. + * + *

Updates the GroupQuotaLimits for the specific resource under a Management Group. A groupQuotaLimitRequestId + * will be returned by the Service. The status can be polled periodically. The status Async polling is using + * standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to + * Get URI and full details can be checked. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource name. + * @param groupQuotaLimitRequest The GroupQuotaLimit Request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return group Quota limit on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String mgId, + String resourceProviderScope, + String groupQuotaName, + String resourceName, + GroupQuotaLimitInner groupQuotaLimitRequest) { + return beginCreateOrUpdateAsync( + mgId, resourceProviderScope, groupQuotaName, resourceName, groupQuotaLimitRequest) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates the GroupQuotaLimits for the specific resource under a Management Group. + * + *

Updates the GroupQuotaLimits for the specific resource under a Management Group. A groupQuotaLimitRequestId + * will be returned by the Service. The status can be polled periodically. The status Async polling is using + * standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to + * Get URI and full details can be checked. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource 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 group Quota limit on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String mgId, String resourceProviderScope, String groupQuotaName, String resourceName) { + final GroupQuotaLimitInner groupQuotaLimitRequest = null; + return beginCreateOrUpdateAsync( + mgId, resourceProviderScope, groupQuotaName, resourceName, groupQuotaLimitRequest) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates the GroupQuotaLimits for the specific resource under a Management Group. + * + *

Updates the GroupQuotaLimits for the specific resource under a Management Group. A groupQuotaLimitRequestId + * will be returned by the Service. The status can be polled periodically. The status Async polling is using + * standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to + * Get URI and full details can be checked. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource name. + * @param groupQuotaLimitRequest The GroupQuotaLimit Request. + * @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 group Quota limit on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String mgId, + String resourceProviderScope, + String groupQuotaName, + String resourceName, + GroupQuotaLimitInner groupQuotaLimitRequest, + Context context) { + return beginCreateOrUpdateAsync( + mgId, resourceProviderScope, groupQuotaName, resourceName, groupQuotaLimitRequest, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates the GroupQuotaLimits for the specific resource under a Management Group. + * + *

Updates the GroupQuotaLimits for the specific resource under a Management Group. A groupQuotaLimitRequestId + * will be returned by the Service. The status can be polled periodically. The status Async polling is using + * standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to + * Get URI and full details can be checked. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource 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 group Quota limit. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GroupQuotaLimitInner createOrUpdate( + String mgId, String resourceProviderScope, String groupQuotaName, String resourceName) { + final GroupQuotaLimitInner groupQuotaLimitRequest = null; + return createOrUpdateAsync(mgId, resourceProviderScope, groupQuotaName, resourceName, groupQuotaLimitRequest) + .block(); + } + + /** + * Updates the GroupQuotaLimits for the specific resource under a Management Group. + * + *

Updates the GroupQuotaLimits for the specific resource under a Management Group. A groupQuotaLimitRequestId + * will be returned by the Service. The status can be polled periodically. The status Async polling is using + * standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to + * Get URI and full details can be checked. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource name. + * @param groupQuotaLimitRequest The GroupQuotaLimit Request. + * @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 group Quota limit. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GroupQuotaLimitInner createOrUpdate( + String mgId, + String resourceProviderScope, + String groupQuotaName, + String resourceName, + GroupQuotaLimitInner groupQuotaLimitRequest, + Context context) { + return createOrUpdateAsync( + mgId, resourceProviderScope, groupQuotaName, resourceName, groupQuotaLimitRequest, context) + .block(); + } + + /** + * Updates the GroupQuotaLimits for the specific resource under a Management Group. + * + *

Updates the GroupQuotaLimits for the specific resource under a Management Group. A groupQuotaLimitRequestId + * will be returned by the Service. The status will be updated periodically. The status Async polling is using + * standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed,then the URI will change to + * Get URI and full details can be checked. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource name. + * @param groupQuotaLimitRequest The GroupQuotaLimit Request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return group Quota limit along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String mgId, + String resourceProviderScope, + String groupQuotaName, + String resourceName, + GroupQuotaLimitInner groupQuotaLimitRequest) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (mgId == null) { + return Mono.error(new IllegalArgumentException("Parameter mgId is required and cannot be null.")); + } + if (resourceProviderScope == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceProviderScope is required and cannot be null.")); + } + if (groupQuotaName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupQuotaName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (groupQuotaLimitRequest != null) { + groupQuotaLimitRequest.validate(); + } + final String apiVersion = "2023-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + mgId, + resourceProviderScope, + groupQuotaName, + resourceName, + apiVersion, + groupQuotaLimitRequest, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates the GroupQuotaLimits for the specific resource under a Management Group. + * + *

Updates the GroupQuotaLimits for the specific resource under a Management Group. A groupQuotaLimitRequestId + * will be returned by the Service. The status will be updated periodically. The status Async polling is using + * standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed,then the URI will change to + * Get URI and full details can be checked. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource name. + * @param groupQuotaLimitRequest The GroupQuotaLimit Request. + * @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 group Quota limit along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String mgId, + String resourceProviderScope, + String groupQuotaName, + String resourceName, + GroupQuotaLimitInner groupQuotaLimitRequest, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (mgId == null) { + return Mono.error(new IllegalArgumentException("Parameter mgId is required and cannot be null.")); + } + if (resourceProviderScope == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceProviderScope is required and cannot be null.")); + } + if (groupQuotaName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupQuotaName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (groupQuotaLimitRequest != null) { + groupQuotaLimitRequest.validate(); + } + final String apiVersion = "2023-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + mgId, + resourceProviderScope, + groupQuotaName, + resourceName, + apiVersion, + groupQuotaLimitRequest, + accept, + context); + } + + /** + * Updates the GroupQuotaLimits for the specific resource under a Management Group. + * + *

Updates the GroupQuotaLimits for the specific resource under a Management Group. A groupQuotaLimitRequestId + * will be returned by the Service. The status will be updated periodically. The status Async polling is using + * standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed,then the URI will change to + * Get URI and full details can be checked. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource name. + * @param groupQuotaLimitRequest The GroupQuotaLimit Request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 group Quota limit. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, GroupQuotaLimitInner> beginUpdateAsync( + String mgId, + String resourceProviderScope, + String groupQuotaName, + String resourceName, + GroupQuotaLimitInner groupQuotaLimitRequest) { + Mono>> mono = + updateWithResponseAsync(mgId, resourceProviderScope, groupQuotaName, resourceName, groupQuotaLimitRequest); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + GroupQuotaLimitInner.class, + GroupQuotaLimitInner.class, + this.client.getContext()); + } + + /** + * Updates the GroupQuotaLimits for the specific resource under a Management Group. + * + *

Updates the GroupQuotaLimits for the specific resource under a Management Group. A groupQuotaLimitRequestId + * will be returned by the Service. The status will be updated periodically. The status Async polling is using + * standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed,then the URI will change to + * Get URI and full details can be checked. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource 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 {@link PollerFlux} for polling of group Quota limit. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, GroupQuotaLimitInner> beginUpdateAsync( + String mgId, String resourceProviderScope, String groupQuotaName, String resourceName) { + final GroupQuotaLimitInner groupQuotaLimitRequest = null; + Mono>> mono = + updateWithResponseAsync(mgId, resourceProviderScope, groupQuotaName, resourceName, groupQuotaLimitRequest); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + GroupQuotaLimitInner.class, + GroupQuotaLimitInner.class, + this.client.getContext()); + } + + /** + * Updates the GroupQuotaLimits for the specific resource under a Management Group. + * + *

Updates the GroupQuotaLimits for the specific resource under a Management Group. A groupQuotaLimitRequestId + * will be returned by the Service. The status will be updated periodically. The status Async polling is using + * standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed,then the URI will change to + * Get URI and full details can be checked. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource name. + * @param groupQuotaLimitRequest The GroupQuotaLimit Request. + * @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 group Quota limit. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, GroupQuotaLimitInner> beginUpdateAsync( + String mgId, + String resourceProviderScope, + String groupQuotaName, + String resourceName, + GroupQuotaLimitInner groupQuotaLimitRequest, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync( + mgId, resourceProviderScope, groupQuotaName, resourceName, groupQuotaLimitRequest, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), GroupQuotaLimitInner.class, GroupQuotaLimitInner.class, context); + } + + /** + * Updates the GroupQuotaLimits for the specific resource under a Management Group. + * + *

Updates the GroupQuotaLimits for the specific resource under a Management Group. A groupQuotaLimitRequestId + * will be returned by the Service. The status will be updated periodically. The status Async polling is using + * standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed,then the URI will change to + * Get URI and full details can be checked. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource 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 {@link SyncPoller} for polling of group Quota limit. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, GroupQuotaLimitInner> beginUpdate( + String mgId, String resourceProviderScope, String groupQuotaName, String resourceName) { + final GroupQuotaLimitInner groupQuotaLimitRequest = null; + return this + .beginUpdateAsync(mgId, resourceProviderScope, groupQuotaName, resourceName, groupQuotaLimitRequest) + .getSyncPoller(); + } + + /** + * Updates the GroupQuotaLimits for the specific resource under a Management Group. + * + *

Updates the GroupQuotaLimits for the specific resource under a Management Group. A groupQuotaLimitRequestId + * will be returned by the Service. The status will be updated periodically. The status Async polling is using + * standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed,then the URI will change to + * Get URI and full details can be checked. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource name. + * @param groupQuotaLimitRequest The GroupQuotaLimit Request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of group Quota limit. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, GroupQuotaLimitInner> beginUpdate( + String mgId, + String resourceProviderScope, + String groupQuotaName, + String resourceName, + GroupQuotaLimitInner groupQuotaLimitRequest, + Context context) { + return this + .beginUpdateAsync( + mgId, resourceProviderScope, groupQuotaName, resourceName, groupQuotaLimitRequest, context) + .getSyncPoller(); + } + + /** + * Updates the GroupQuotaLimits for the specific resource under a Management Group. + * + *

Updates the GroupQuotaLimits for the specific resource under a Management Group. A groupQuotaLimitRequestId + * will be returned by the Service. The status will be updated periodically. The status Async polling is using + * standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed,then the URI will change to + * Get URI and full details can be checked. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource name. + * @param groupQuotaLimitRequest The GroupQuotaLimit Request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return group Quota limit on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String mgId, + String resourceProviderScope, + String groupQuotaName, + String resourceName, + GroupQuotaLimitInner groupQuotaLimitRequest) { + return beginUpdateAsync(mgId, resourceProviderScope, groupQuotaName, resourceName, groupQuotaLimitRequest) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates the GroupQuotaLimits for the specific resource under a Management Group. + * + *

Updates the GroupQuotaLimits for the specific resource under a Management Group. A groupQuotaLimitRequestId + * will be returned by the Service. The status will be updated periodically. The status Async polling is using + * standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed,then the URI will change to + * Get URI and full details can be checked. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource 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 group Quota limit on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String mgId, String resourceProviderScope, String groupQuotaName, String resourceName) { + final GroupQuotaLimitInner groupQuotaLimitRequest = null; + return beginUpdateAsync(mgId, resourceProviderScope, groupQuotaName, resourceName, groupQuotaLimitRequest) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates the GroupQuotaLimits for the specific resource under a Management Group. + * + *

Updates the GroupQuotaLimits for the specific resource under a Management Group. A groupQuotaLimitRequestId + * will be returned by the Service. The status will be updated periodically. The status Async polling is using + * standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed,then the URI will change to + * Get URI and full details can be checked. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource name. + * @param groupQuotaLimitRequest The GroupQuotaLimit Request. + * @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 group Quota limit on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String mgId, + String resourceProviderScope, + String groupQuotaName, + String resourceName, + GroupQuotaLimitInner groupQuotaLimitRequest, + Context context) { + return beginUpdateAsync( + mgId, resourceProviderScope, groupQuotaName, resourceName, groupQuotaLimitRequest, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates the GroupQuotaLimits for the specific resource under a Management Group. + * + *

Updates the GroupQuotaLimits for the specific resource under a Management Group. A groupQuotaLimitRequestId + * will be returned by the Service. The status will be updated periodically. The status Async polling is using + * standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed,then the URI will change to + * Get URI and full details can be checked. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource 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 group Quota limit. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GroupQuotaLimitInner update( + String mgId, String resourceProviderScope, String groupQuotaName, String resourceName) { + final GroupQuotaLimitInner groupQuotaLimitRequest = null; + return updateAsync(mgId, resourceProviderScope, groupQuotaName, resourceName, groupQuotaLimitRequest).block(); + } + + /** + * Updates the GroupQuotaLimits for the specific resource under a Management Group. + * + *

Updates the GroupQuotaLimits for the specific resource under a Management Group. A groupQuotaLimitRequestId + * will be returned by the Service. The status will be updated periodically. The status Async polling is using + * standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed,then the URI will change to + * Get URI and full details can be checked. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource name. + * @param groupQuotaLimitRequest The GroupQuotaLimit Request. + * @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 group Quota limit. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GroupQuotaLimitInner update( + String mgId, + String resourceProviderScope, + String groupQuotaName, + String resourceName, + GroupQuotaLimitInner groupQuotaLimitRequest, + Context context) { + return updateAsync(mgId, resourceProviderScope, groupQuotaName, resourceName, groupQuotaLimitRequest, context) + .block(); + } + + /** + * Gets the resource groupQuotaLimits for the MGId. + * + *

Gets the resource groupQuotaLimits for the MGId. It will include the limits, availableLimits, + * assignedToSubscriptions: Quotas assigned to subscriptions from the groupQuota. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource 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 resource groupQuotaLimits for the MGId along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String mgId, String resourceProviderScope, String groupQuotaName, String resourceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (mgId == null) { + return Mono.error(new IllegalArgumentException("Parameter mgId is required and cannot be null.")); + } + if (resourceProviderScope == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceProviderScope is required and cannot be null.")); + } + if (groupQuotaName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupQuotaName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String apiVersion = "2023-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + mgId, + resourceProviderScope, + groupQuotaName, + resourceName, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the resource groupQuotaLimits for the MGId. + * + *

Gets the resource groupQuotaLimits for the MGId. It will include the limits, availableLimits, + * assignedToSubscriptions: Quotas assigned to subscriptions from the groupQuota. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource 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 resource groupQuotaLimits for the MGId along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String mgId, String resourceProviderScope, String groupQuotaName, String resourceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (mgId == null) { + return Mono.error(new IllegalArgumentException("Parameter mgId is required and cannot be null.")); + } + if (resourceProviderScope == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceProviderScope is required and cannot be null.")); + } + if (groupQuotaName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupQuotaName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String apiVersion = "2023-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + mgId, + resourceProviderScope, + groupQuotaName, + resourceName, + apiVersion, + accept, + context); + } + + /** + * Gets the resource groupQuotaLimits for the MGId. + * + *

Gets the resource groupQuotaLimits for the MGId. It will include the limits, availableLimits, + * assignedToSubscriptions: Quotas assigned to subscriptions from the groupQuota. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource 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 resource groupQuotaLimits for the MGId on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String mgId, String resourceProviderScope, String groupQuotaName, String resourceName) { + return getWithResponseAsync(mgId, resourceProviderScope, groupQuotaName, resourceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the resource groupQuotaLimits for the MGId. + * + *

Gets the resource groupQuotaLimits for the MGId. It will include the limits, availableLimits, + * assignedToSubscriptions: Quotas assigned to subscriptions from the groupQuota. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource 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 resource groupQuotaLimits for the MGId along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String mgId, String resourceProviderScope, String groupQuotaName, String resourceName, Context context) { + return getWithResponseAsync(mgId, resourceProviderScope, groupQuotaName, resourceName, context).block(); + } + + /** + * Gets the resource groupQuotaLimits for the MGId. + * + *

Gets the resource groupQuotaLimits for the MGId. It will include the limits, availableLimits, + * assignedToSubscriptions: Quotas assigned to subscriptions from the groupQuota. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource 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 resource groupQuotaLimits for the MGId. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GroupQuotaLimitInner get( + String mgId, String resourceProviderScope, String groupQuotaName, String resourceName) { + return getWithResponse(mgId, resourceProviderScope, groupQuotaName, resourceName, Context.NONE).getValue(); + } + + /** + * Gets the List of resources groupQuotaLimits for the MGId, based on the scope. + * + *

Gets the List of resources groupQuotaLimits for the MGId, based on the scope. The scope can be - + * providers/Microsoft.Compute/locations/<eastus>. The list elements will be same as the Get API - It will + * include the limits, availableLimits, assignedToSubscriptions: Quotas assigned to subscriptions from the + * groupQuota. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of resources groupQuotaLimits for the MGId, based on the scope along with {@link PagedResponse} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String mgId, String resourceProviderScope, String groupQuotaName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (mgId == null) { + return Mono.error(new IllegalArgumentException("Parameter mgId is required and cannot be null.")); + } + if (resourceProviderScope == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceProviderScope is required and cannot be null.")); + } + if (groupQuotaName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupQuotaName is required and cannot be null.")); + } + final String apiVersion = "2023-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + mgId, + resourceProviderScope, + groupQuotaName, + 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 List of resources groupQuotaLimits for the MGId, based on the scope. + * + *

Gets the List of resources groupQuotaLimits for the MGId, based on the scope. The scope can be - + * providers/Microsoft.Compute/locations/<eastus>. The list elements will be same as the Get API - It will + * include the limits, availableLimits, assignedToSubscriptions: Quotas assigned to subscriptions from the + * groupQuota. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @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 List of resources groupQuotaLimits for the MGId, based on the scope along with {@link PagedResponse} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String mgId, String resourceProviderScope, String groupQuotaName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (mgId == null) { + return Mono.error(new IllegalArgumentException("Parameter mgId is required and cannot be null.")); + } + if (resourceProviderScope == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceProviderScope is required and cannot be null.")); + } + if (groupQuotaName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupQuotaName is required and cannot be null.")); + } + final String apiVersion = "2023-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), mgId, resourceProviderScope, groupQuotaName, apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets the List of resources groupQuotaLimits for the MGId, based on the scope. + * + *

Gets the List of resources groupQuotaLimits for the MGId, based on the scope. The scope can be - + * providers/Microsoft.Compute/locations/<eastus>. The list elements will be same as the Get API - It will + * include the limits, availableLimits, assignedToSubscriptions: Quotas assigned to subscriptions from the + * groupQuota. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of resources groupQuotaLimits for the MGId, based on the scope as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String mgId, String resourceProviderScope, String groupQuotaName) { + return new PagedFlux<>( + () -> listSinglePageAsync(mgId, resourceProviderScope, groupQuotaName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets the List of resources groupQuotaLimits for the MGId, based on the scope. + * + *

Gets the List of resources groupQuotaLimits for the MGId, based on the scope. The scope can be - + * providers/Microsoft.Compute/locations/<eastus>. The list elements will be same as the Get API - It will + * include the limits, availableLimits, assignedToSubscriptions: Quotas assigned to subscriptions from the + * groupQuota. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @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 List of resources groupQuotaLimits for the MGId, based on the scope as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String mgId, String resourceProviderScope, String groupQuotaName, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(mgId, resourceProviderScope, groupQuotaName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets the List of resources groupQuotaLimits for the MGId, based on the scope. + * + *

Gets the List of resources groupQuotaLimits for the MGId, based on the scope. The scope can be - + * providers/Microsoft.Compute/locations/<eastus>. The list elements will be same as the Get API - It will + * include the limits, availableLimits, assignedToSubscriptions: Quotas assigned to subscriptions from the + * groupQuota. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of resources groupQuotaLimits for the MGId, based on the scope as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String mgId, String resourceProviderScope, String groupQuotaName) { + return new PagedIterable<>(listAsync(mgId, resourceProviderScope, groupQuotaName)); + } + + /** + * Gets the List of resources groupQuotaLimits for the MGId, based on the scope. + * + *

Gets the List of resources groupQuotaLimits for the MGId, based on the scope. The scope can be - + * providers/Microsoft.Compute/locations/<eastus>. The list elements will be same as the Get API - It will + * include the limits, availableLimits, assignedToSubscriptions: Quotas assigned to subscriptions from the + * groupQuota. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @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 List of resources groupQuotaLimits for the MGId, based on the scope as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String mgId, String resourceProviderScope, String groupQuotaName, Context context) { + return new PagedIterable<>(listAsync(mgId, resourceProviderScope, groupQuotaName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

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

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Group Quota Limit details 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/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/GroupQuotaLimitsImpl.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/GroupQuotaLimitsImpl.java new file mode 100644 index 000000000000..25d3c87bc24c --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/GroupQuotaLimitsImpl.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.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.quota.fluent.GroupQuotaLimitsClient; +import com.azure.resourcemanager.quota.fluent.models.GroupQuotaLimitInner; +import com.azure.resourcemanager.quota.models.GroupQuotaLimit; +import com.azure.resourcemanager.quota.models.GroupQuotaLimits; + +public final class GroupQuotaLimitsImpl implements GroupQuotaLimits { + private static final ClientLogger LOGGER = new ClientLogger(GroupQuotaLimitsImpl.class); + + private final GroupQuotaLimitsClient innerClient; + + private final com.azure.resourcemanager.quota.QuotaManager serviceManager; + + public GroupQuotaLimitsImpl( + GroupQuotaLimitsClient innerClient, com.azure.resourcemanager.quota.QuotaManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public GroupQuotaLimit createOrUpdate( + String mgId, String resourceProviderScope, String groupQuotaName, String resourceName) { + GroupQuotaLimitInner inner = + this.serviceClient().createOrUpdate(mgId, resourceProviderScope, groupQuotaName, resourceName); + if (inner != null) { + return new GroupQuotaLimitImpl(inner, this.manager()); + } else { + return null; + } + } + + public GroupQuotaLimit createOrUpdate( + String mgId, + String resourceProviderScope, + String groupQuotaName, + String resourceName, + GroupQuotaLimitInner groupQuotaLimitRequest, + Context context) { + GroupQuotaLimitInner inner = + this + .serviceClient() + .createOrUpdate( + mgId, resourceProviderScope, groupQuotaName, resourceName, groupQuotaLimitRequest, context); + if (inner != null) { + return new GroupQuotaLimitImpl(inner, this.manager()); + } else { + return null; + } + } + + public GroupQuotaLimit update( + String mgId, String resourceProviderScope, String groupQuotaName, String resourceName) { + GroupQuotaLimitInner inner = + this.serviceClient().update(mgId, resourceProviderScope, groupQuotaName, resourceName); + if (inner != null) { + return new GroupQuotaLimitImpl(inner, this.manager()); + } else { + return null; + } + } + + public GroupQuotaLimit update( + String mgId, + String resourceProviderScope, + String groupQuotaName, + String resourceName, + GroupQuotaLimitInner groupQuotaLimitRequest, + Context context) { + GroupQuotaLimitInner inner = + this + .serviceClient() + .update(mgId, resourceProviderScope, groupQuotaName, resourceName, groupQuotaLimitRequest, context); + if (inner != null) { + return new GroupQuotaLimitImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String mgId, String resourceProviderScope, String groupQuotaName, String resourceName, Context context) { + Response inner = + this.serviceClient().getWithResponse(mgId, resourceProviderScope, groupQuotaName, resourceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new GroupQuotaLimitImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public GroupQuotaLimit get(String mgId, String resourceProviderScope, String groupQuotaName, String resourceName) { + GroupQuotaLimitInner inner = + this.serviceClient().get(mgId, resourceProviderScope, groupQuotaName, resourceName); + if (inner != null) { + return new GroupQuotaLimitImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable list(String mgId, String resourceProviderScope, String groupQuotaName) { + PagedIterable inner = + this.serviceClient().list(mgId, resourceProviderScope, groupQuotaName); + return Utils.mapPage(inner, inner1 -> new GroupQuotaLimitImpl(inner1, this.manager())); + } + + public PagedIterable list( + String mgId, String resourceProviderScope, String groupQuotaName, Context context) { + PagedIterable inner = + this.serviceClient().list(mgId, resourceProviderScope, groupQuotaName, context); + return Utils.mapPage(inner, inner1 -> new GroupQuotaLimitImpl(inner1, this.manager())); + } + + private GroupQuotaLimitsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.quota.QuotaManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/GroupQuotaLimitsRequestsClientImpl.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/GroupQuotaLimitsRequestsClientImpl.java new file mode 100644 index 000000000000..7d191eec0bf4 --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/GroupQuotaLimitsRequestsClientImpl.java @@ -0,0 +1,592 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.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.quota.fluent.GroupQuotaLimitsRequestsClient; +import com.azure.resourcemanager.quota.fluent.models.SubmittedResourceRequestStatusInner; +import com.azure.resourcemanager.quota.models.SubmittedResourceRequestStatusList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in GroupQuotaLimitsRequestsClient. */ +public final class GroupQuotaLimitsRequestsClientImpl implements GroupQuotaLimitsRequestsClient { + /** The proxy service used to perform REST calls. */ + private final GroupQuotaLimitsRequestsService service; + + /** The service client containing this operation class. */ + private final AzureQuotaExtensionApiImpl client; + + /** + * Initializes an instance of GroupQuotaLimitsRequestsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + GroupQuotaLimitsRequestsClientImpl(AzureQuotaExtensionApiImpl client) { + this.service = + RestProxy + .create(GroupQuotaLimitsRequestsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureQuotaExtensionApiGroupQuotaLimitsRequests to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureQuotaExtensionA") + public interface GroupQuotaLimitsRequestsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Management/managementGroups/{mgId}/{resourceProviderScope}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/groupQuotaRequests") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("mgId") String mgId, + @PathParam("resourceProviderScope") String resourceProviderScope, + @PathParam("groupQuotaName") String groupQuotaName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Management/managementGroups/{mgId}/{resourceProviderScope}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/groupQuotaRequests/{requestId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("mgId") String mgId, + @PathParam("resourceProviderScope") String resourceProviderScope, + @PathParam("groupQuotaName") String groupQuotaName, + @PathParam("requestId") String requestId, + @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); + } + + /** + * List the status of all GroupQuota requests. + * + *

List API to check the status of a GroupQuota requests by requestId. The groupQuotaRequest history is + * maintained for 1 year. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return share Quota Entity list along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String mgId, String resourceProviderScope, String groupQuotaName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (mgId == null) { + return Mono.error(new IllegalArgumentException("Parameter mgId is required and cannot be null.")); + } + if (resourceProviderScope == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceProviderScope is required and cannot be null.")); + } + if (groupQuotaName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupQuotaName is required and cannot be null.")); + } + final String apiVersion = "2023-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + mgId, + resourceProviderScope, + groupQuotaName, + 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())); + } + + /** + * List the status of all GroupQuota requests. + * + *

List API to check the status of a GroupQuota requests by requestId. The groupQuotaRequest history is + * maintained for 1 year. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @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 share Quota Entity list along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String mgId, String resourceProviderScope, String groupQuotaName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (mgId == null) { + return Mono.error(new IllegalArgumentException("Parameter mgId is required and cannot be null.")); + } + if (resourceProviderScope == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceProviderScope is required and cannot be null.")); + } + if (groupQuotaName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupQuotaName is required and cannot be null.")); + } + final String apiVersion = "2023-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), mgId, resourceProviderScope, groupQuotaName, apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List the status of all GroupQuota requests. + * + *

List API to check the status of a GroupQuota requests by requestId. The groupQuotaRequest history is + * maintained for 1 year. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return share Quota Entity list as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String mgId, String resourceProviderScope, String groupQuotaName) { + return new PagedFlux<>( + () -> listSinglePageAsync(mgId, resourceProviderScope, groupQuotaName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List the status of all GroupQuota requests. + * + *

List API to check the status of a GroupQuota requests by requestId. The groupQuotaRequest history is + * maintained for 1 year. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @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 share Quota Entity list as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String mgId, String resourceProviderScope, String groupQuotaName, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(mgId, resourceProviderScope, groupQuotaName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List the status of all GroupQuota requests. + * + *

List API to check the status of a GroupQuota requests by requestId. The groupQuotaRequest history is + * maintained for 1 year. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return share Quota Entity list as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String mgId, String resourceProviderScope, String groupQuotaName) { + return new PagedIterable<>(listAsync(mgId, resourceProviderScope, groupQuotaName)); + } + + /** + * List the status of all GroupQuota requests. + * + *

List API to check the status of a GroupQuota requests by requestId. The groupQuotaRequest history is + * maintained for 1 year. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @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 share Quota Entity list as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String mgId, String resourceProviderScope, String groupQuotaName, Context context) { + return new PagedIterable<>(listAsync(mgId, resourceProviderScope, groupQuotaName, context)); + } + + /** + * Get the status of a single GroupQuota request by requestId. + * + *

Get API to check the status of a GroupQuota request by requestId. Use the polling API - OperationsStatus URI + * specified in Azure-AsyncOperation header field, with retry-after duration in seconds to check the intermediate + * status. This API provides the finals status with the request details and status. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param requestId Request 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 aPI to check the status of a GroupQuota request by requestId along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String mgId, String resourceProviderScope, String groupQuotaName, String requestId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (mgId == null) { + return Mono.error(new IllegalArgumentException("Parameter mgId is required and cannot be null.")); + } + if (resourceProviderScope == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceProviderScope is required and cannot be null.")); + } + if (groupQuotaName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupQuotaName is required and cannot be null.")); + } + if (requestId == null) { + return Mono.error(new IllegalArgumentException("Parameter requestId is required and cannot be null.")); + } + final String apiVersion = "2023-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + mgId, + resourceProviderScope, + groupQuotaName, + requestId, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the status of a single GroupQuota request by requestId. + * + *

Get API to check the status of a GroupQuota request by requestId. Use the polling API - OperationsStatus URI + * specified in Azure-AsyncOperation header field, with retry-after duration in seconds to check the intermediate + * status. This API provides the finals status with the request details and status. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param requestId Request 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 aPI to check the status of a GroupQuota request by requestId along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String mgId, String resourceProviderScope, String groupQuotaName, String requestId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (mgId == null) { + return Mono.error(new IllegalArgumentException("Parameter mgId is required and cannot be null.")); + } + if (resourceProviderScope == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceProviderScope is required and cannot be null.")); + } + if (groupQuotaName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupQuotaName is required and cannot be null.")); + } + if (requestId == null) { + return Mono.error(new IllegalArgumentException("Parameter requestId is required and cannot be null.")); + } + final String apiVersion = "2023-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + mgId, + resourceProviderScope, + groupQuotaName, + requestId, + apiVersion, + accept, + context); + } + + /** + * Get the status of a single GroupQuota request by requestId. + * + *

Get API to check the status of a GroupQuota request by requestId. Use the polling API - OperationsStatus URI + * specified in Azure-AsyncOperation header field, with retry-after duration in seconds to check the intermediate + * status. This API provides the finals status with the request details and status. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param requestId Request 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 aPI to check the status of a GroupQuota request by requestId on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String mgId, String resourceProviderScope, String groupQuotaName, String requestId) { + return getWithResponseAsync(mgId, resourceProviderScope, groupQuotaName, requestId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get the status of a single GroupQuota request by requestId. + * + *

Get API to check the status of a GroupQuota request by requestId. Use the polling API - OperationsStatus URI + * specified in Azure-AsyncOperation header field, with retry-after duration in seconds to check the intermediate + * status. This API provides the finals status with the request details and status. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param requestId Request 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 aPI to check the status of a GroupQuota request by requestId along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String mgId, String resourceProviderScope, String groupQuotaName, String requestId, Context context) { + return getWithResponseAsync(mgId, resourceProviderScope, groupQuotaName, requestId, context).block(); + } + + /** + * Get the status of a single GroupQuota request by requestId. + * + *

Get API to check the status of a GroupQuota request by requestId. Use the polling API - OperationsStatus URI + * specified in Azure-AsyncOperation header field, with retry-after duration in seconds to check the intermediate + * status. This API provides the finals status with the request details and status. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param requestId Request 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 aPI to check the status of a GroupQuota request by requestId. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SubmittedResourceRequestStatusInner get( + String mgId, String resourceProviderScope, String groupQuotaName, String requestId) { + return getWithResponse(mgId, resourceProviderScope, groupQuotaName, requestId, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

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

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return share Quota Entity list 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/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/GroupQuotaLimitsRequestsImpl.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/GroupQuotaLimitsRequestsImpl.java new file mode 100644 index 000000000000..99c369e6cc34 --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/GroupQuotaLimitsRequestsImpl.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.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.quota.fluent.GroupQuotaLimitsRequestsClient; +import com.azure.resourcemanager.quota.fluent.models.SubmittedResourceRequestStatusInner; +import com.azure.resourcemanager.quota.models.GroupQuotaLimitsRequests; +import com.azure.resourcemanager.quota.models.SubmittedResourceRequestStatus; + +public final class GroupQuotaLimitsRequestsImpl implements GroupQuotaLimitsRequests { + private static final ClientLogger LOGGER = new ClientLogger(GroupQuotaLimitsRequestsImpl.class); + + private final GroupQuotaLimitsRequestsClient innerClient; + + private final com.azure.resourcemanager.quota.QuotaManager serviceManager; + + public GroupQuotaLimitsRequestsImpl( + GroupQuotaLimitsRequestsClient innerClient, com.azure.resourcemanager.quota.QuotaManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list( + String mgId, String resourceProviderScope, String groupQuotaName) { + PagedIterable inner = + this.serviceClient().list(mgId, resourceProviderScope, groupQuotaName); + return Utils.mapPage(inner, inner1 -> new SubmittedResourceRequestStatusImpl(inner1, this.manager())); + } + + public PagedIterable list( + String mgId, String resourceProviderScope, String groupQuotaName, Context context) { + PagedIterable inner = + this.serviceClient().list(mgId, resourceProviderScope, groupQuotaName, context); + return Utils.mapPage(inner, inner1 -> new SubmittedResourceRequestStatusImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String mgId, String resourceProviderScope, String groupQuotaName, String requestId, Context context) { + Response inner = + this.serviceClient().getWithResponse(mgId, resourceProviderScope, groupQuotaName, requestId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SubmittedResourceRequestStatusImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SubmittedResourceRequestStatus get( + String mgId, String resourceProviderScope, String groupQuotaName, String requestId) { + SubmittedResourceRequestStatusInner inner = + this.serviceClient().get(mgId, resourceProviderScope, groupQuotaName, requestId); + if (inner != null) { + return new SubmittedResourceRequestStatusImpl(inner, this.manager()); + } else { + return null; + } + } + + private GroupQuotaLimitsRequestsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.quota.QuotaManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/GroupQuotaSubscriptionIdImpl.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/GroupQuotaSubscriptionIdImpl.java new file mode 100644 index 000000000000..ed66fa84c7c7 --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/GroupQuotaSubscriptionIdImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.implementation; + +import com.azure.resourcemanager.quota.fluent.models.GroupQuotaSubscriptionIdInner; +import com.azure.resourcemanager.quota.models.GroupQuotaSubscriptionId; +import com.azure.resourcemanager.quota.models.GroupQuotaSubscriptionIdProperties; + +public final class GroupQuotaSubscriptionIdImpl implements GroupQuotaSubscriptionId { + private GroupQuotaSubscriptionIdInner innerObject; + + private final com.azure.resourcemanager.quota.QuotaManager serviceManager; + + GroupQuotaSubscriptionIdImpl( + GroupQuotaSubscriptionIdInner innerObject, com.azure.resourcemanager.quota.QuotaManager 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 GroupQuotaSubscriptionIdProperties properties() { + return this.innerModel().properties(); + } + + public GroupQuotaSubscriptionIdInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.quota.QuotaManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/GroupQuotaSubscriptionQuotaAllocationRequestsClientImpl.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/GroupQuotaSubscriptionQuotaAllocationRequestsClientImpl.java new file mode 100644 index 000000000000..852c3dc8b67b --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/GroupQuotaSubscriptionQuotaAllocationRequestsClientImpl.java @@ -0,0 +1,621 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.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.quota.fluent.GroupQuotaSubscriptionQuotaAllocationRequestsClient; +import com.azure.resourcemanager.quota.fluent.models.SubscriptionQuotaAllocationRequestInner; +import com.azure.resourcemanager.quota.models.SubscriptionQuotaAllocationRequestList; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * GroupQuotaSubscriptionQuotaAllocationRequestsClient. + */ +public final class GroupQuotaSubscriptionQuotaAllocationRequestsClientImpl + implements GroupQuotaSubscriptionQuotaAllocationRequestsClient { + /** The proxy service used to perform REST calls. */ + private final GroupQuotaSubscriptionQuotaAllocationRequestsService service; + + /** The service client containing this operation class. */ + private final AzureQuotaExtensionApiImpl client; + + /** + * Initializes an instance of GroupQuotaSubscriptionQuotaAllocationRequestsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + GroupQuotaSubscriptionQuotaAllocationRequestsClientImpl(AzureQuotaExtensionApiImpl client) { + this.service = + RestProxy + .create( + GroupQuotaSubscriptionQuotaAllocationRequestsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureQuotaExtensionApiGroupQuotaSubscriptionQuotaAllocationRequests + * to be used by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureQuotaExtensionA") + public interface GroupQuotaSubscriptionQuotaAllocationRequestsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Management/managementGroups/{mgId}/subscriptions/{subscriptionId}/{resourceProviderScope}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/quotaAllocationRequests/{allocationId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("mgId") String mgId, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceProviderScope") String resourceProviderScope, + @PathParam("groupQuotaName") String groupQuotaName, + @PathParam("allocationId") String allocationId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Management/managementGroups/{mgId}/subscriptions/{subscriptionId}/{resourceProviderScope}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/quotaAllocationRequests") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("mgId") String mgId, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceProviderScope") String resourceProviderScope, + @PathParam("groupQuotaName") String groupQuotaName, + @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); + } + + /** + * Get the status of the quota allocation request for the subscriptionId. + * + *

Get the quota allocation request status for the subscriptionId by allocationId. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param allocationId Resource allocation 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 quota allocation request status for the subscriptionId by allocationId along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String mgId, String resourceProviderScope, String groupQuotaName, String allocationId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (mgId == null) { + return Mono.error(new IllegalArgumentException("Parameter mgId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceProviderScope == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceProviderScope is required and cannot be null.")); + } + if (groupQuotaName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupQuotaName is required and cannot be null.")); + } + if (allocationId == null) { + return Mono.error(new IllegalArgumentException("Parameter allocationId is required and cannot be null.")); + } + final String apiVersion = "2023-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + mgId, + this.client.getSubscriptionId(), + resourceProviderScope, + groupQuotaName, + allocationId, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the status of the quota allocation request for the subscriptionId. + * + *

Get the quota allocation request status for the subscriptionId by allocationId. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param allocationId Resource allocation 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 quota allocation request status for the subscriptionId by allocationId along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String mgId, String resourceProviderScope, String groupQuotaName, String allocationId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (mgId == null) { + return Mono.error(new IllegalArgumentException("Parameter mgId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceProviderScope == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceProviderScope is required and cannot be null.")); + } + if (groupQuotaName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupQuotaName is required and cannot be null.")); + } + if (allocationId == null) { + return Mono.error(new IllegalArgumentException("Parameter allocationId is required and cannot be null.")); + } + final String apiVersion = "2023-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + mgId, + this.client.getSubscriptionId(), + resourceProviderScope, + groupQuotaName, + allocationId, + apiVersion, + accept, + context); + } + + /** + * Get the status of the quota allocation request for the subscriptionId. + * + *

Get the quota allocation request status for the subscriptionId by allocationId. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param allocationId Resource allocation 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 quota allocation request status for the subscriptionId by allocationId on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String mgId, String resourceProviderScope, String groupQuotaName, String allocationId) { + return getWithResponseAsync(mgId, resourceProviderScope, groupQuotaName, allocationId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get the status of the quota allocation request for the subscriptionId. + * + *

Get the quota allocation request status for the subscriptionId by allocationId. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param allocationId Resource allocation 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 quota allocation request status for the subscriptionId by allocationId along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String mgId, String resourceProviderScope, String groupQuotaName, String allocationId, Context context) { + return getWithResponseAsync(mgId, resourceProviderScope, groupQuotaName, allocationId, context).block(); + } + + /** + * Get the status of the quota allocation request for the subscriptionId. + * + *

Get the quota allocation request status for the subscriptionId by allocationId. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param allocationId Resource allocation 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 quota allocation request status for the subscriptionId by allocationId. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SubscriptionQuotaAllocationRequestInner get( + String mgId, String resourceProviderScope, String groupQuotaName, String allocationId) { + return getWithResponse(mgId, resourceProviderScope, groupQuotaName, allocationId, Context.NONE).getValue(); + } + + /** + * Lists all the quota allocation requests.to subscriptions + * + *

Lists all the allocation requests. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String mgId, String resourceProviderScope, String groupQuotaName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (mgId == null) { + return Mono.error(new IllegalArgumentException("Parameter mgId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceProviderScope == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceProviderScope is required and cannot be null.")); + } + if (groupQuotaName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupQuotaName is required and cannot be null.")); + } + final String apiVersion = "2023-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + mgId, + this.client.getSubscriptionId(), + resourceProviderScope, + groupQuotaName, + 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())); + } + + /** + * Lists all the quota allocation requests.to subscriptions + * + *

Lists all the allocation requests. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String mgId, String resourceProviderScope, String groupQuotaName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (mgId == null) { + return Mono.error(new IllegalArgumentException("Parameter mgId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceProviderScope == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceProviderScope is required and cannot be null.")); + } + if (groupQuotaName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupQuotaName is required and cannot be null.")); + } + final String apiVersion = "2023-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + mgId, + this.client.getSubscriptionId(), + resourceProviderScope, + groupQuotaName, + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all the quota allocation requests.to subscriptions + * + *

Lists all the allocation requests. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String mgId, String resourceProviderScope, String groupQuotaName) { + return new PagedFlux<>( + () -> listSinglePageAsync(mgId, resourceProviderScope, groupQuotaName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all the quota allocation requests.to subscriptions + * + *

Lists all the allocation requests. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @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 paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String mgId, String resourceProviderScope, String groupQuotaName, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(mgId, resourceProviderScope, groupQuotaName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all the quota allocation requests.to subscriptions + * + *

Lists all the allocation requests. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String mgId, String resourceProviderScope, String groupQuotaName) { + return new PagedIterable<>(listAsync(mgId, resourceProviderScope, groupQuotaName)); + } + + /** + * Lists all the quota allocation requests.to subscriptions + * + *

Lists all the allocation requests. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @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 paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String mgId, String resourceProviderScope, String groupQuotaName, Context context) { + return new PagedIterable<>(listAsync(mgId, resourceProviderScope, groupQuotaName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

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

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body 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/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/GroupQuotaSubscriptionQuotaAllocationRequestsImpl.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/GroupQuotaSubscriptionQuotaAllocationRequestsImpl.java new file mode 100644 index 000000000000..5a78b8d79ef6 --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/GroupQuotaSubscriptionQuotaAllocationRequestsImpl.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.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.quota.fluent.GroupQuotaSubscriptionQuotaAllocationRequestsClient; +import com.azure.resourcemanager.quota.fluent.models.SubscriptionQuotaAllocationRequestInner; +import com.azure.resourcemanager.quota.models.GroupQuotaSubscriptionQuotaAllocationRequests; +import com.azure.resourcemanager.quota.models.SubscriptionQuotaAllocationRequest; + +public final class GroupQuotaSubscriptionQuotaAllocationRequestsImpl + implements GroupQuotaSubscriptionQuotaAllocationRequests { + private static final ClientLogger LOGGER = + new ClientLogger(GroupQuotaSubscriptionQuotaAllocationRequestsImpl.class); + + private final GroupQuotaSubscriptionQuotaAllocationRequestsClient innerClient; + + private final com.azure.resourcemanager.quota.QuotaManager serviceManager; + + public GroupQuotaSubscriptionQuotaAllocationRequestsImpl( + GroupQuotaSubscriptionQuotaAllocationRequestsClient innerClient, + com.azure.resourcemanager.quota.QuotaManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String mgId, String resourceProviderScope, String groupQuotaName, String allocationId, Context context) { + Response inner = + this.serviceClient().getWithResponse(mgId, resourceProviderScope, groupQuotaName, allocationId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SubscriptionQuotaAllocationRequestImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SubscriptionQuotaAllocationRequest get( + String mgId, String resourceProviderScope, String groupQuotaName, String allocationId) { + SubscriptionQuotaAllocationRequestInner inner = + this.serviceClient().get(mgId, resourceProviderScope, groupQuotaName, allocationId); + if (inner != null) { + return new SubscriptionQuotaAllocationRequestImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable list( + String mgId, String resourceProviderScope, String groupQuotaName) { + PagedIterable inner = + this.serviceClient().list(mgId, resourceProviderScope, groupQuotaName); + return Utils.mapPage(inner, inner1 -> new SubscriptionQuotaAllocationRequestImpl(inner1, this.manager())); + } + + public PagedIterable list( + String mgId, String resourceProviderScope, String groupQuotaName, Context context) { + PagedIterable inner = + this.serviceClient().list(mgId, resourceProviderScope, groupQuotaName, context); + return Utils.mapPage(inner, inner1 -> new SubscriptionQuotaAllocationRequestImpl(inner1, this.manager())); + } + + private GroupQuotaSubscriptionQuotaAllocationRequestsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.quota.QuotaManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/GroupQuotaSubscriptionQuotaAllocationsClientImpl.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/GroupQuotaSubscriptionQuotaAllocationsClientImpl.java new file mode 100644 index 000000000000..e99984ae058b --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/GroupQuotaSubscriptionQuotaAllocationsClientImpl.java @@ -0,0 +1,1664 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.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.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.quota.fluent.GroupQuotaSubscriptionQuotaAllocationsClient; +import com.azure.resourcemanager.quota.fluent.models.SubscriptionQuotaAllocationsInner; +import com.azure.resourcemanager.quota.models.SubscriptionQuotaAllocationsList; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * GroupQuotaSubscriptionQuotaAllocationsClient. + */ +public final class GroupQuotaSubscriptionQuotaAllocationsClientImpl + implements GroupQuotaSubscriptionQuotaAllocationsClient { + /** The proxy service used to perform REST calls. */ + private final GroupQuotaSubscriptionQuotaAllocationsService service; + + /** The service client containing this operation class. */ + private final AzureQuotaExtensionApiImpl client; + + /** + * Initializes an instance of GroupQuotaSubscriptionQuotaAllocationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + GroupQuotaSubscriptionQuotaAllocationsClientImpl(AzureQuotaExtensionApiImpl client) { + this.service = + RestProxy + .create( + GroupQuotaSubscriptionQuotaAllocationsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureQuotaExtensionApiGroupQuotaSubscriptionQuotaAllocations to be + * used by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureQuotaExtensionA") + public interface GroupQuotaSubscriptionQuotaAllocationsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Management/managementGroups/{mgId}/subscriptions/{subscriptionId}/{resourceProviderScope}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/quotaAllocations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("mgId") String mgId, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceProviderScope") String resourceProviderScope, + @PathParam("groupQuotaName") String groupQuotaName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/providers/Microsoft.Management/managementGroups/{mgId}/subscriptions/{subscriptionId}/{resourceProviderScope}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/quotaAllocations/{resourceName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("mgId") String mgId, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceProviderScope") String resourceProviderScope, + @PathParam("groupQuotaName") String groupQuotaName, + @PathParam("resourceName") String resourceName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SubscriptionQuotaAllocationsInner allocateQuotaRequest, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/providers/Microsoft.Management/managementGroups/{mgId}/subscriptions/{subscriptionId}/{resourceProviderScope}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/quotaAllocations/{resourceName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("mgId") String mgId, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceProviderScope") String resourceProviderScope, + @PathParam("groupQuotaName") String groupQuotaName, + @PathParam("resourceName") String resourceName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SubscriptionQuotaAllocationsInner allocateQuotaRequest, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Management/managementGroups/{mgId}/subscriptions/{subscriptionId}/{resourceProviderScope}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/quotaAllocations/{resourceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("mgId") String mgId, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceProviderScope") String resourceProviderScope, + @PathParam("groupQuotaName") String groupQuotaName, + @PathParam("resourceName") String resourceName, + @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 all the quota assigned to a subscription for the specific Resource Provider, Location. + * + *

Gets all the quota assigned to a subscription for the specific Resource Provider, Location. This will include + * the GroupQuota and total quota assigned to the subscription. Only the Group quota assigned to the subscription + * can be assigned back to the MG Group Quota. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the quota assigned to a subscription for the specific Resource Provider, Location along with {@link + * PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String mgId, String resourceProviderScope, String groupQuotaName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (mgId == null) { + return Mono.error(new IllegalArgumentException("Parameter mgId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceProviderScope == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceProviderScope is required and cannot be null.")); + } + if (groupQuotaName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupQuotaName is required and cannot be null.")); + } + final String apiVersion = "2023-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + mgId, + this.client.getSubscriptionId(), + resourceProviderScope, + groupQuotaName, + 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 all the quota assigned to a subscription for the specific Resource Provider, Location. + * + *

Gets all the quota assigned to a subscription for the specific Resource Provider, Location. This will include + * the GroupQuota and total quota assigned to the subscription. Only the Group quota assigned to the subscription + * can be assigned back to the MG Group Quota. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the quota assigned to a subscription for the specific Resource Provider, Location along with {@link + * PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String mgId, String resourceProviderScope, String groupQuotaName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (mgId == null) { + return Mono.error(new IllegalArgumentException("Parameter mgId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceProviderScope == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceProviderScope is required and cannot be null.")); + } + if (groupQuotaName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupQuotaName is required and cannot be null.")); + } + final String apiVersion = "2023-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + mgId, + this.client.getSubscriptionId(), + resourceProviderScope, + groupQuotaName, + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets all the quota assigned to a subscription for the specific Resource Provider, Location. + * + *

Gets all the quota assigned to a subscription for the specific Resource Provider, Location. This will include + * the GroupQuota and total quota assigned to the subscription. Only the Group quota assigned to the subscription + * can be assigned back to the MG Group Quota. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the quota assigned to a subscription for the specific Resource Provider, Location as paginated + * response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String mgId, String resourceProviderScope, String groupQuotaName) { + return new PagedFlux<>( + () -> listSinglePageAsync(mgId, resourceProviderScope, groupQuotaName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets all the quota assigned to a subscription for the specific Resource Provider, Location. + * + *

Gets all the quota assigned to a subscription for the specific Resource Provider, Location. This will include + * the GroupQuota and total quota assigned to the subscription. Only the Group quota assigned to the subscription + * can be assigned back to the MG Group Quota. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the quota assigned to a subscription for the specific Resource Provider, Location as paginated + * response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String mgId, String resourceProviderScope, String groupQuotaName, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(mgId, resourceProviderScope, groupQuotaName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all the quota assigned to a subscription for the specific Resource Provider, Location. + * + *

Gets all the quota assigned to a subscription for the specific Resource Provider, Location. This will include + * the GroupQuota and total quota assigned to the subscription. Only the Group quota assigned to the subscription + * can be assigned back to the MG Group Quota. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the quota assigned to a subscription for the specific Resource Provider, Location as paginated + * response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String mgId, String resourceProviderScope, String groupQuotaName) { + return new PagedIterable<>(listAsync(mgId, resourceProviderScope, groupQuotaName)); + } + + /** + * Gets all the quota assigned to a subscription for the specific Resource Provider, Location. + * + *

Gets all the quota assigned to a subscription for the specific Resource Provider, Location. This will include + * the GroupQuota and total quota assigned to the subscription. Only the Group quota assigned to the subscription + * can be assigned back to the MG Group Quota. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the quota assigned to a subscription for the specific Resource Provider, Location as paginated + * response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String mgId, String resourceProviderScope, String groupQuotaName, Context context) { + return new PagedIterable<>(listAsync(mgId, resourceProviderScope, groupQuotaName, context)); + } + + /** + * Request to assign quota from group quota to a specific Subscription. This request will use Asynchronous pattern + * to check the status using Async polling as standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * + *

Request to assign a specific resource quota from group quota to a specific Subscription. The subscriptions can + * also reduce the quota assigned to subscription to give back the group back to MG. The quota assignment back to MG + * groupQuota is limited by the GroupQuota assigned to subscription, which means the maximum unused quota assigned + * back to MG groupQuota will be the groupQuota assigned to the subscriptions. So, this API can used to assign Quota + * to subscriptions and assign back unused quota, which was previously assigned from MG groupQuota to subscription. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource name. + * @param allocateQuotaRequest Quota requests payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return quota assigned to a subscription for the specific Resource Provider, Location, ResourceName along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String mgId, + String resourceProviderScope, + String groupQuotaName, + String resourceName, + SubscriptionQuotaAllocationsInner allocateQuotaRequest) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (mgId == null) { + return Mono.error(new IllegalArgumentException("Parameter mgId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceProviderScope == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceProviderScope is required and cannot be null.")); + } + if (groupQuotaName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupQuotaName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (allocateQuotaRequest == null) { + return Mono + .error(new IllegalArgumentException("Parameter allocateQuotaRequest is required and cannot be null.")); + } else { + allocateQuotaRequest.validate(); + } + final String apiVersion = "2023-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + mgId, + this.client.getSubscriptionId(), + resourceProviderScope, + groupQuotaName, + resourceName, + apiVersion, + allocateQuotaRequest, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Request to assign quota from group quota to a specific Subscription. This request will use Asynchronous pattern + * to check the status using Async polling as standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * + *

Request to assign a specific resource quota from group quota to a specific Subscription. The subscriptions can + * also reduce the quota assigned to subscription to give back the group back to MG. The quota assignment back to MG + * groupQuota is limited by the GroupQuota assigned to subscription, which means the maximum unused quota assigned + * back to MG groupQuota will be the groupQuota assigned to the subscriptions. So, this API can used to assign Quota + * to subscriptions and assign back unused quota, which was previously assigned from MG groupQuota to subscription. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource name. + * @param allocateQuotaRequest Quota requests payload. + * @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 quota assigned to a subscription for the specific Resource Provider, Location, ResourceName along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String mgId, + String resourceProviderScope, + String groupQuotaName, + String resourceName, + SubscriptionQuotaAllocationsInner allocateQuotaRequest, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (mgId == null) { + return Mono.error(new IllegalArgumentException("Parameter mgId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceProviderScope == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceProviderScope is required and cannot be null.")); + } + if (groupQuotaName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupQuotaName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (allocateQuotaRequest == null) { + return Mono + .error(new IllegalArgumentException("Parameter allocateQuotaRequest is required and cannot be null.")); + } else { + allocateQuotaRequest.validate(); + } + final String apiVersion = "2023-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + mgId, + this.client.getSubscriptionId(), + resourceProviderScope, + groupQuotaName, + resourceName, + apiVersion, + allocateQuotaRequest, + accept, + context); + } + + /** + * Request to assign quota from group quota to a specific Subscription. This request will use Asynchronous pattern + * to check the status using Async polling as standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * + *

Request to assign a specific resource quota from group quota to a specific Subscription. The subscriptions can + * also reduce the quota assigned to subscription to give back the group back to MG. The quota assignment back to MG + * groupQuota is limited by the GroupQuota assigned to subscription, which means the maximum unused quota assigned + * back to MG groupQuota will be the groupQuota assigned to the subscriptions. So, this API can used to assign Quota + * to subscriptions and assign back unused quota, which was previously assigned from MG groupQuota to subscription. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource name. + * @param allocateQuotaRequest Quota requests payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 quota assigned to a subscription for the specific Resource + * Provider, Location, ResourceName. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SubscriptionQuotaAllocationsInner> + beginCreateOrUpdateAsync( + String mgId, + String resourceProviderScope, + String groupQuotaName, + String resourceName, + SubscriptionQuotaAllocationsInner allocateQuotaRequest) { + Mono>> mono = + createOrUpdateWithResponseAsync( + mgId, resourceProviderScope, groupQuotaName, resourceName, allocateQuotaRequest); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + SubscriptionQuotaAllocationsInner.class, + SubscriptionQuotaAllocationsInner.class, + this.client.getContext()); + } + + /** + * Request to assign quota from group quota to a specific Subscription. This request will use Asynchronous pattern + * to check the status using Async polling as standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * + *

Request to assign a specific resource quota from group quota to a specific Subscription. The subscriptions can + * also reduce the quota assigned to subscription to give back the group back to MG. The quota assignment back to MG + * groupQuota is limited by the GroupQuota assigned to subscription, which means the maximum unused quota assigned + * back to MG groupQuota will be the groupQuota assigned to the subscriptions. So, this API can used to assign Quota + * to subscriptions and assign back unused quota, which was previously assigned from MG groupQuota to subscription. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource name. + * @param allocateQuotaRequest Quota requests payload. + * @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 quota assigned to a subscription for the specific Resource + * Provider, Location, ResourceName. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SubscriptionQuotaAllocationsInner> + beginCreateOrUpdateAsync( + String mgId, + String resourceProviderScope, + String groupQuotaName, + String resourceName, + SubscriptionQuotaAllocationsInner allocateQuotaRequest, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + mgId, resourceProviderScope, groupQuotaName, resourceName, allocateQuotaRequest, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + SubscriptionQuotaAllocationsInner.class, + SubscriptionQuotaAllocationsInner.class, + context); + } + + /** + * Request to assign quota from group quota to a specific Subscription. This request will use Asynchronous pattern + * to check the status using Async polling as standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * + *

Request to assign a specific resource quota from group quota to a specific Subscription. The subscriptions can + * also reduce the quota assigned to subscription to give back the group back to MG. The quota assignment back to MG + * groupQuota is limited by the GroupQuota assigned to subscription, which means the maximum unused quota assigned + * back to MG groupQuota will be the groupQuota assigned to the subscriptions. So, this API can used to assign Quota + * to subscriptions and assign back unused quota, which was previously assigned from MG groupQuota to subscription. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource name. + * @param allocateQuotaRequest Quota requests payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 quota assigned to a subscription for the specific Resource + * Provider, Location, ResourceName. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SubscriptionQuotaAllocationsInner> + beginCreateOrUpdate( + String mgId, + String resourceProviderScope, + String groupQuotaName, + String resourceName, + SubscriptionQuotaAllocationsInner allocateQuotaRequest) { + return this + .beginCreateOrUpdateAsync(mgId, resourceProviderScope, groupQuotaName, resourceName, allocateQuotaRequest) + .getSyncPoller(); + } + + /** + * Request to assign quota from group quota to a specific Subscription. This request will use Asynchronous pattern + * to check the status using Async polling as standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * + *

Request to assign a specific resource quota from group quota to a specific Subscription. The subscriptions can + * also reduce the quota assigned to subscription to give back the group back to MG. The quota assignment back to MG + * groupQuota is limited by the GroupQuota assigned to subscription, which means the maximum unused quota assigned + * back to MG groupQuota will be the groupQuota assigned to the subscriptions. So, this API can used to assign Quota + * to subscriptions and assign back unused quota, which was previously assigned from MG groupQuota to subscription. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource name. + * @param allocateQuotaRequest Quota requests payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of quota assigned to a subscription for the specific Resource + * Provider, Location, ResourceName. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SubscriptionQuotaAllocationsInner> + beginCreateOrUpdate( + String mgId, + String resourceProviderScope, + String groupQuotaName, + String resourceName, + SubscriptionQuotaAllocationsInner allocateQuotaRequest, + Context context) { + return this + .beginCreateOrUpdateAsync( + mgId, resourceProviderScope, groupQuotaName, resourceName, allocateQuotaRequest, context) + .getSyncPoller(); + } + + /** + * Request to assign quota from group quota to a specific Subscription. This request will use Asynchronous pattern + * to check the status using Async polling as standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * + *

Request to assign a specific resource quota from group quota to a specific Subscription. The subscriptions can + * also reduce the quota assigned to subscription to give back the group back to MG. The quota assignment back to MG + * groupQuota is limited by the GroupQuota assigned to subscription, which means the maximum unused quota assigned + * back to MG groupQuota will be the groupQuota assigned to the subscriptions. So, this API can used to assign Quota + * to subscriptions and assign back unused quota, which was previously assigned from MG groupQuota to subscription. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource name. + * @param allocateQuotaRequest Quota requests payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return quota assigned to a subscription for the specific Resource Provider, Location, ResourceName on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String mgId, + String resourceProviderScope, + String groupQuotaName, + String resourceName, + SubscriptionQuotaAllocationsInner allocateQuotaRequest) { + return beginCreateOrUpdateAsync(mgId, resourceProviderScope, groupQuotaName, resourceName, allocateQuotaRequest) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Request to assign quota from group quota to a specific Subscription. This request will use Asynchronous pattern + * to check the status using Async polling as standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * + *

Request to assign a specific resource quota from group quota to a specific Subscription. The subscriptions can + * also reduce the quota assigned to subscription to give back the group back to MG. The quota assignment back to MG + * groupQuota is limited by the GroupQuota assigned to subscription, which means the maximum unused quota assigned + * back to MG groupQuota will be the groupQuota assigned to the subscriptions. So, this API can used to assign Quota + * to subscriptions and assign back unused quota, which was previously assigned from MG groupQuota to subscription. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource name. + * @param allocateQuotaRequest Quota requests payload. + * @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 quota assigned to a subscription for the specific Resource Provider, Location, ResourceName on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String mgId, + String resourceProviderScope, + String groupQuotaName, + String resourceName, + SubscriptionQuotaAllocationsInner allocateQuotaRequest, + Context context) { + return beginCreateOrUpdateAsync( + mgId, resourceProviderScope, groupQuotaName, resourceName, allocateQuotaRequest, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Request to assign quota from group quota to a specific Subscription. This request will use Asynchronous pattern + * to check the status using Async polling as standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * + *

Request to assign a specific resource quota from group quota to a specific Subscription. The subscriptions can + * also reduce the quota assigned to subscription to give back the group back to MG. The quota assignment back to MG + * groupQuota is limited by the GroupQuota assigned to subscription, which means the maximum unused quota assigned + * back to MG groupQuota will be the groupQuota assigned to the subscriptions. So, this API can used to assign Quota + * to subscriptions and assign back unused quota, which was previously assigned from MG groupQuota to subscription. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource name. + * @param allocateQuotaRequest Quota requests payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return quota assigned to a subscription for the specific Resource Provider, Location, ResourceName. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SubscriptionQuotaAllocationsInner createOrUpdate( + String mgId, + String resourceProviderScope, + String groupQuotaName, + String resourceName, + SubscriptionQuotaAllocationsInner allocateQuotaRequest) { + return createOrUpdateAsync(mgId, resourceProviderScope, groupQuotaName, resourceName, allocateQuotaRequest) + .block(); + } + + /** + * Request to assign quota from group quota to a specific Subscription. This request will use Asynchronous pattern + * to check the status using Async polling as standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * + *

Request to assign a specific resource quota from group quota to a specific Subscription. The subscriptions can + * also reduce the quota assigned to subscription to give back the group back to MG. The quota assignment back to MG + * groupQuota is limited by the GroupQuota assigned to subscription, which means the maximum unused quota assigned + * back to MG groupQuota will be the groupQuota assigned to the subscriptions. So, this API can used to assign Quota + * to subscriptions and assign back unused quota, which was previously assigned from MG groupQuota to subscription. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource name. + * @param allocateQuotaRequest Quota requests payload. + * @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 quota assigned to a subscription for the specific Resource Provider, Location, ResourceName. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SubscriptionQuotaAllocationsInner createOrUpdate( + String mgId, + String resourceProviderScope, + String groupQuotaName, + String resourceName, + SubscriptionQuotaAllocationsInner allocateQuotaRequest, + Context context) { + return createOrUpdateAsync( + mgId, resourceProviderScope, groupQuotaName, resourceName, allocateQuotaRequest, context) + .block(); + } + + /** + * Request to assign quota from group quota to a specific Subscription. This request will use Asynchronous pattern + * with 202 response and status polling API. + * + *

Request to assign quota from group quota to a specific Subscription. The subscriptions and reduce the quota + * assigned to subscription to give back the group back to MG. The quota assignment back to MG groupQuota is limited + * by the GroupQuota assigned to subscription, using this API. So, this API can used to assign Quota to + * subscriptions and assign back unused quota, which was previously assigned from MG groupQuota to subscription(s). + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource name. + * @param allocateQuotaRequest Quota requests payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return quota assigned to a subscription for the specific Resource Provider, Location, ResourceName along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String mgId, + String resourceProviderScope, + String groupQuotaName, + String resourceName, + SubscriptionQuotaAllocationsInner allocateQuotaRequest) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (mgId == null) { + return Mono.error(new IllegalArgumentException("Parameter mgId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceProviderScope == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceProviderScope is required and cannot be null.")); + } + if (groupQuotaName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupQuotaName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (allocateQuotaRequest == null) { + return Mono + .error(new IllegalArgumentException("Parameter allocateQuotaRequest is required and cannot be null.")); + } else { + allocateQuotaRequest.validate(); + } + final String apiVersion = "2023-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + mgId, + this.client.getSubscriptionId(), + resourceProviderScope, + groupQuotaName, + resourceName, + apiVersion, + allocateQuotaRequest, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Request to assign quota from group quota to a specific Subscription. This request will use Asynchronous pattern + * with 202 response and status polling API. + * + *

Request to assign quota from group quota to a specific Subscription. The subscriptions and reduce the quota + * assigned to subscription to give back the group back to MG. The quota assignment back to MG groupQuota is limited + * by the GroupQuota assigned to subscription, using this API. So, this API can used to assign Quota to + * subscriptions and assign back unused quota, which was previously assigned from MG groupQuota to subscription(s). + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource name. + * @param allocateQuotaRequest Quota requests payload. + * @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 quota assigned to a subscription for the specific Resource Provider, Location, ResourceName along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String mgId, + String resourceProviderScope, + String groupQuotaName, + String resourceName, + SubscriptionQuotaAllocationsInner allocateQuotaRequest, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (mgId == null) { + return Mono.error(new IllegalArgumentException("Parameter mgId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceProviderScope == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceProviderScope is required and cannot be null.")); + } + if (groupQuotaName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupQuotaName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (allocateQuotaRequest == null) { + return Mono + .error(new IllegalArgumentException("Parameter allocateQuotaRequest is required and cannot be null.")); + } else { + allocateQuotaRequest.validate(); + } + final String apiVersion = "2023-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + mgId, + this.client.getSubscriptionId(), + resourceProviderScope, + groupQuotaName, + resourceName, + apiVersion, + allocateQuotaRequest, + accept, + context); + } + + /** + * Request to assign quota from group quota to a specific Subscription. This request will use Asynchronous pattern + * with 202 response and status polling API. + * + *

Request to assign quota from group quota to a specific Subscription. The subscriptions and reduce the quota + * assigned to subscription to give back the group back to MG. The quota assignment back to MG groupQuota is limited + * by the GroupQuota assigned to subscription, using this API. So, this API can used to assign Quota to + * subscriptions and assign back unused quota, which was previously assigned from MG groupQuota to subscription(s). + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource name. + * @param allocateQuotaRequest Quota requests payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 quota assigned to a subscription for the specific Resource + * Provider, Location, ResourceName. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SubscriptionQuotaAllocationsInner> + beginUpdateAsync( + String mgId, + String resourceProviderScope, + String groupQuotaName, + String resourceName, + SubscriptionQuotaAllocationsInner allocateQuotaRequest) { + Mono>> mono = + updateWithResponseAsync(mgId, resourceProviderScope, groupQuotaName, resourceName, allocateQuotaRequest); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + SubscriptionQuotaAllocationsInner.class, + SubscriptionQuotaAllocationsInner.class, + this.client.getContext()); + } + + /** + * Request to assign quota from group quota to a specific Subscription. This request will use Asynchronous pattern + * with 202 response and status polling API. + * + *

Request to assign quota from group quota to a specific Subscription. The subscriptions and reduce the quota + * assigned to subscription to give back the group back to MG. The quota assignment back to MG groupQuota is limited + * by the GroupQuota assigned to subscription, using this API. So, this API can used to assign Quota to + * subscriptions and assign back unused quota, which was previously assigned from MG groupQuota to subscription(s). + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource name. + * @param allocateQuotaRequest Quota requests payload. + * @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 quota assigned to a subscription for the specific Resource + * Provider, Location, ResourceName. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SubscriptionQuotaAllocationsInner> + beginUpdateAsync( + String mgId, + String resourceProviderScope, + String groupQuotaName, + String resourceName, + SubscriptionQuotaAllocationsInner allocateQuotaRequest, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync( + mgId, resourceProviderScope, groupQuotaName, resourceName, allocateQuotaRequest, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + SubscriptionQuotaAllocationsInner.class, + SubscriptionQuotaAllocationsInner.class, + context); + } + + /** + * Request to assign quota from group quota to a specific Subscription. This request will use Asynchronous pattern + * with 202 response and status polling API. + * + *

Request to assign quota from group quota to a specific Subscription. The subscriptions and reduce the quota + * assigned to subscription to give back the group back to MG. The quota assignment back to MG groupQuota is limited + * by the GroupQuota assigned to subscription, using this API. So, this API can used to assign Quota to + * subscriptions and assign back unused quota, which was previously assigned from MG groupQuota to subscription(s). + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource name. + * @param allocateQuotaRequest Quota requests payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 quota assigned to a subscription for the specific Resource + * Provider, Location, ResourceName. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SubscriptionQuotaAllocationsInner> beginUpdate( + String mgId, + String resourceProviderScope, + String groupQuotaName, + String resourceName, + SubscriptionQuotaAllocationsInner allocateQuotaRequest) { + return this + .beginUpdateAsync(mgId, resourceProviderScope, groupQuotaName, resourceName, allocateQuotaRequest) + .getSyncPoller(); + } + + /** + * Request to assign quota from group quota to a specific Subscription. This request will use Asynchronous pattern + * with 202 response and status polling API. + * + *

Request to assign quota from group quota to a specific Subscription. The subscriptions and reduce the quota + * assigned to subscription to give back the group back to MG. The quota assignment back to MG groupQuota is limited + * by the GroupQuota assigned to subscription, using this API. So, this API can used to assign Quota to + * subscriptions and assign back unused quota, which was previously assigned from MG groupQuota to subscription(s). + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource name. + * @param allocateQuotaRequest Quota requests payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of quota assigned to a subscription for the specific Resource + * Provider, Location, ResourceName. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SubscriptionQuotaAllocationsInner> beginUpdate( + String mgId, + String resourceProviderScope, + String groupQuotaName, + String resourceName, + SubscriptionQuotaAllocationsInner allocateQuotaRequest, + Context context) { + return this + .beginUpdateAsync(mgId, resourceProviderScope, groupQuotaName, resourceName, allocateQuotaRequest, context) + .getSyncPoller(); + } + + /** + * Request to assign quota from group quota to a specific Subscription. This request will use Asynchronous pattern + * with 202 response and status polling API. + * + *

Request to assign quota from group quota to a specific Subscription. The subscriptions and reduce the quota + * assigned to subscription to give back the group back to MG. The quota assignment back to MG groupQuota is limited + * by the GroupQuota assigned to subscription, using this API. So, this API can used to assign Quota to + * subscriptions and assign back unused quota, which was previously assigned from MG groupQuota to subscription(s). + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource name. + * @param allocateQuotaRequest Quota requests payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return quota assigned to a subscription for the specific Resource Provider, Location, ResourceName on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String mgId, + String resourceProviderScope, + String groupQuotaName, + String resourceName, + SubscriptionQuotaAllocationsInner allocateQuotaRequest) { + return beginUpdateAsync(mgId, resourceProviderScope, groupQuotaName, resourceName, allocateQuotaRequest) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Request to assign quota from group quota to a specific Subscription. This request will use Asynchronous pattern + * with 202 response and status polling API. + * + *

Request to assign quota from group quota to a specific Subscription. The subscriptions and reduce the quota + * assigned to subscription to give back the group back to MG. The quota assignment back to MG groupQuota is limited + * by the GroupQuota assigned to subscription, using this API. So, this API can used to assign Quota to + * subscriptions and assign back unused quota, which was previously assigned from MG groupQuota to subscription(s). + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource name. + * @param allocateQuotaRequest Quota requests payload. + * @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 quota assigned to a subscription for the specific Resource Provider, Location, ResourceName on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String mgId, + String resourceProviderScope, + String groupQuotaName, + String resourceName, + SubscriptionQuotaAllocationsInner allocateQuotaRequest, + Context context) { + return beginUpdateAsync( + mgId, resourceProviderScope, groupQuotaName, resourceName, allocateQuotaRequest, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Request to assign quota from group quota to a specific Subscription. This request will use Asynchronous pattern + * with 202 response and status polling API. + * + *

Request to assign quota from group quota to a specific Subscription. The subscriptions and reduce the quota + * assigned to subscription to give back the group back to MG. The quota assignment back to MG groupQuota is limited + * by the GroupQuota assigned to subscription, using this API. So, this API can used to assign Quota to + * subscriptions and assign back unused quota, which was previously assigned from MG groupQuota to subscription(s). + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource name. + * @param allocateQuotaRequest Quota requests payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return quota assigned to a subscription for the specific Resource Provider, Location, ResourceName. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SubscriptionQuotaAllocationsInner update( + String mgId, + String resourceProviderScope, + String groupQuotaName, + String resourceName, + SubscriptionQuotaAllocationsInner allocateQuotaRequest) { + return updateAsync(mgId, resourceProviderScope, groupQuotaName, resourceName, allocateQuotaRequest).block(); + } + + /** + * Request to assign quota from group quota to a specific Subscription. This request will use Asynchronous pattern + * with 202 response and status polling API. + * + *

Request to assign quota from group quota to a specific Subscription. The subscriptions and reduce the quota + * assigned to subscription to give back the group back to MG. The quota assignment back to MG groupQuota is limited + * by the GroupQuota assigned to subscription, using this API. So, this API can used to assign Quota to + * subscriptions and assign back unused quota, which was previously assigned from MG groupQuota to subscription(s). + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource name. + * @param allocateQuotaRequest Quota requests payload. + * @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 quota assigned to a subscription for the specific Resource Provider, Location, ResourceName. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SubscriptionQuotaAllocationsInner update( + String mgId, + String resourceProviderScope, + String groupQuotaName, + String resourceName, + SubscriptionQuotaAllocationsInner allocateQuotaRequest, + Context context) { + return updateAsync(mgId, resourceProviderScope, groupQuotaName, resourceName, allocateQuotaRequest, context) + .block(); + } + + /** + * Gets Quota assigned to a subscription for the specific Resource Provider, Location, ResourceName. + * + *

Gets Quota assigned to a subscription for the specific Resource Provider, Location, ResourceName. This will + * include the GroupQuota and total quota assigned to the subscription. Only the Group quota assigned to the + * subscription can be assigned back to the MG Group Quota. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource 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 quota assigned to a subscription for the specific Resource Provider, Location, ResourceName along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String mgId, String resourceProviderScope, String groupQuotaName, String resourceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (mgId == null) { + return Mono.error(new IllegalArgumentException("Parameter mgId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceProviderScope == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceProviderScope is required and cannot be null.")); + } + if (groupQuotaName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupQuotaName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String apiVersion = "2023-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + mgId, + this.client.getSubscriptionId(), + resourceProviderScope, + groupQuotaName, + resourceName, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets Quota assigned to a subscription for the specific Resource Provider, Location, ResourceName. + * + *

Gets Quota assigned to a subscription for the specific Resource Provider, Location, ResourceName. This will + * include the GroupQuota and total quota assigned to the subscription. Only the Group quota assigned to the + * subscription can be assigned back to the MG Group Quota. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource 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 quota assigned to a subscription for the specific Resource Provider, Location, ResourceName along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String mgId, String resourceProviderScope, String groupQuotaName, String resourceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (mgId == null) { + return Mono.error(new IllegalArgumentException("Parameter mgId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceProviderScope == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceProviderScope is required and cannot be null.")); + } + if (groupQuotaName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupQuotaName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String apiVersion = "2023-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + mgId, + this.client.getSubscriptionId(), + resourceProviderScope, + groupQuotaName, + resourceName, + apiVersion, + accept, + context); + } + + /** + * Gets Quota assigned to a subscription for the specific Resource Provider, Location, ResourceName. + * + *

Gets Quota assigned to a subscription for the specific Resource Provider, Location, ResourceName. This will + * include the GroupQuota and total quota assigned to the subscription. Only the Group quota assigned to the + * subscription can be assigned back to the MG Group Quota. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource 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 quota assigned to a subscription for the specific Resource Provider, Location, ResourceName on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String mgId, String resourceProviderScope, String groupQuotaName, String resourceName) { + return getWithResponseAsync(mgId, resourceProviderScope, groupQuotaName, resourceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets Quota assigned to a subscription for the specific Resource Provider, Location, ResourceName. + * + *

Gets Quota assigned to a subscription for the specific Resource Provider, Location, ResourceName. This will + * include the GroupQuota and total quota assigned to the subscription. Only the Group quota assigned to the + * subscription can be assigned back to the MG Group Quota. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource 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 quota assigned to a subscription for the specific Resource Provider, Location, ResourceName along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String mgId, String resourceProviderScope, String groupQuotaName, String resourceName, Context context) { + return getWithResponseAsync(mgId, resourceProviderScope, groupQuotaName, resourceName, context).block(); + } + + /** + * Gets Quota assigned to a subscription for the specific Resource Provider, Location, ResourceName. + * + *

Gets Quota assigned to a subscription for the specific Resource Provider, Location, ResourceName. This will + * include the GroupQuota and total quota assigned to the subscription. Only the Group quota assigned to the + * subscription can be assigned back to the MG Group Quota. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource 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 quota assigned to a subscription for the specific Resource Provider, Location, ResourceName. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SubscriptionQuotaAllocationsInner get( + String mgId, String resourceProviderScope, String groupQuotaName, String resourceName) { + return getWithResponse(mgId, resourceProviderScope, groupQuotaName, resourceName, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

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

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return subscription quota list 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/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/GroupQuotaSubscriptionQuotaAllocationsImpl.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/GroupQuotaSubscriptionQuotaAllocationsImpl.java new file mode 100644 index 000000000000..eae31ae70fe8 --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/GroupQuotaSubscriptionQuotaAllocationsImpl.java @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.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.quota.fluent.GroupQuotaSubscriptionQuotaAllocationsClient; +import com.azure.resourcemanager.quota.fluent.models.SubscriptionQuotaAllocationsInner; +import com.azure.resourcemanager.quota.models.GroupQuotaSubscriptionQuotaAllocations; +import com.azure.resourcemanager.quota.models.SubscriptionQuotaAllocations; + +public final class GroupQuotaSubscriptionQuotaAllocationsImpl implements GroupQuotaSubscriptionQuotaAllocations { + private static final ClientLogger LOGGER = new ClientLogger(GroupQuotaSubscriptionQuotaAllocationsImpl.class); + + private final GroupQuotaSubscriptionQuotaAllocationsClient innerClient; + + private final com.azure.resourcemanager.quota.QuotaManager serviceManager; + + public GroupQuotaSubscriptionQuotaAllocationsImpl( + GroupQuotaSubscriptionQuotaAllocationsClient innerClient, + com.azure.resourcemanager.quota.QuotaManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list( + String mgId, String resourceProviderScope, String groupQuotaName) { + PagedIterable inner = + this.serviceClient().list(mgId, resourceProviderScope, groupQuotaName); + return Utils.mapPage(inner, inner1 -> new SubscriptionQuotaAllocationsImpl(inner1, this.manager())); + } + + public PagedIterable list( + String mgId, String resourceProviderScope, String groupQuotaName, Context context) { + PagedIterable inner = + this.serviceClient().list(mgId, resourceProviderScope, groupQuotaName, context); + return Utils.mapPage(inner, inner1 -> new SubscriptionQuotaAllocationsImpl(inner1, this.manager())); + } + + public SubscriptionQuotaAllocations createOrUpdate( + String mgId, + String resourceProviderScope, + String groupQuotaName, + String resourceName, + SubscriptionQuotaAllocationsInner allocateQuotaRequest) { + SubscriptionQuotaAllocationsInner inner = + this + .serviceClient() + .createOrUpdate(mgId, resourceProviderScope, groupQuotaName, resourceName, allocateQuotaRequest); + if (inner != null) { + return new SubscriptionQuotaAllocationsImpl(inner, this.manager()); + } else { + return null; + } + } + + public SubscriptionQuotaAllocations createOrUpdate( + String mgId, + String resourceProviderScope, + String groupQuotaName, + String resourceName, + SubscriptionQuotaAllocationsInner allocateQuotaRequest, + Context context) { + SubscriptionQuotaAllocationsInner inner = + this + .serviceClient() + .createOrUpdate( + mgId, resourceProviderScope, groupQuotaName, resourceName, allocateQuotaRequest, context); + if (inner != null) { + return new SubscriptionQuotaAllocationsImpl(inner, this.manager()); + } else { + return null; + } + } + + public SubscriptionQuotaAllocations update( + String mgId, + String resourceProviderScope, + String groupQuotaName, + String resourceName, + SubscriptionQuotaAllocationsInner allocateQuotaRequest) { + SubscriptionQuotaAllocationsInner inner = + this + .serviceClient() + .update(mgId, resourceProviderScope, groupQuotaName, resourceName, allocateQuotaRequest); + if (inner != null) { + return new SubscriptionQuotaAllocationsImpl(inner, this.manager()); + } else { + return null; + } + } + + public SubscriptionQuotaAllocations update( + String mgId, + String resourceProviderScope, + String groupQuotaName, + String resourceName, + SubscriptionQuotaAllocationsInner allocateQuotaRequest, + Context context) { + SubscriptionQuotaAllocationsInner inner = + this + .serviceClient() + .update(mgId, resourceProviderScope, groupQuotaName, resourceName, allocateQuotaRequest, context); + if (inner != null) { + return new SubscriptionQuotaAllocationsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String mgId, String resourceProviderScope, String groupQuotaName, String resourceName, Context context) { + Response inner = + this.serviceClient().getWithResponse(mgId, resourceProviderScope, groupQuotaName, resourceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SubscriptionQuotaAllocationsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SubscriptionQuotaAllocations get( + String mgId, String resourceProviderScope, String groupQuotaName, String resourceName) { + SubscriptionQuotaAllocationsInner inner = + this.serviceClient().get(mgId, resourceProviderScope, groupQuotaName, resourceName); + if (inner != null) { + return new SubscriptionQuotaAllocationsImpl(inner, this.manager()); + } else { + return null; + } + } + + private GroupQuotaSubscriptionQuotaAllocationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.quota.QuotaManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/GroupQuotaSubscriptionsClientImpl.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/GroupQuotaSubscriptionsClientImpl.java new file mode 100644 index 000000000000..10e0da56cd10 --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/GroupQuotaSubscriptionsClientImpl.java @@ -0,0 +1,1169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.implementation; + +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.quota.fluent.GroupQuotaSubscriptionsClient; +import com.azure.resourcemanager.quota.fluent.models.GroupQuotaSubscriptionIdInner; +import com.azure.resourcemanager.quota.models.GroupQuotaSubscriptionIdList; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in GroupQuotaSubscriptionsClient. */ +public final class GroupQuotaSubscriptionsClientImpl implements GroupQuotaSubscriptionsClient { + /** The proxy service used to perform REST calls. */ + private final GroupQuotaSubscriptionsService service; + + /** The service client containing this operation class. */ + private final AzureQuotaExtensionApiImpl client; + + /** + * Initializes an instance of GroupQuotaSubscriptionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + GroupQuotaSubscriptionsClientImpl(AzureQuotaExtensionApiImpl client) { + this.service = + RestProxy + .create(GroupQuotaSubscriptionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureQuotaExtensionApiGroupQuotaSubscriptions to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureQuotaExtensionA") + public interface GroupQuotaSubscriptionsService { + @Headers({"Content-Type: application/json"}) + @Put( + "/providers/Microsoft.Management/managementGroups/{mgId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/subscriptions/{subscriptionId}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("mgId") String mgId, + @PathParam("groupQuotaName") String groupQuotaName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/providers/Microsoft.Management/managementGroups/{mgId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/subscriptions/{subscriptionId}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("mgId") String mgId, + @PathParam("groupQuotaName") String groupQuotaName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/providers/Microsoft.Management/managementGroups/{mgId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/subscriptions/{subscriptionId}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("mgId") String mgId, + @PathParam("groupQuotaName") String groupQuotaName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Management/managementGroups/{mgId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/subscriptions/{subscriptionId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("mgId") String mgId, + @PathParam("groupQuotaName") String groupQuotaName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Management/managementGroups/{mgId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/subscriptions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("mgId") String mgId, + @PathParam("groupQuotaName") String groupQuotaName, + @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); + } + + /** + * Adds subscription to the GroupQuotas. + * + *

Adds a subscription to GroupQuotas. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this represents a Azure subscriptionId that is associated with a GroupQuotaSEntity along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String mgId, String groupQuotaName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (mgId == null) { + return Mono.error(new IllegalArgumentException("Parameter mgId is required and cannot be null.")); + } + if (groupQuotaName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupQuotaName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2023-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + mgId, + groupQuotaName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Adds subscription to the GroupQuotas. + * + *

Adds a subscription to GroupQuotas. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @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 this represents a Azure subscriptionId that is associated with a GroupQuotaSEntity along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String mgId, String groupQuotaName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (mgId == null) { + return Mono.error(new IllegalArgumentException("Parameter mgId is required and cannot be null.")); + } + if (groupQuotaName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupQuotaName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2023-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + mgId, + groupQuotaName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Adds subscription to the GroupQuotas. + * + *

Adds a subscription to GroupQuotas. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 this represents a Azure subscriptionId that is associated with a + * GroupQuotaSEntity. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, GroupQuotaSubscriptionIdInner> + beginCreateOrUpdateAsync(String mgId, String groupQuotaName) { + Mono>> mono = createOrUpdateWithResponseAsync(mgId, groupQuotaName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + GroupQuotaSubscriptionIdInner.class, + GroupQuotaSubscriptionIdInner.class, + this.client.getContext()); + } + + /** + * Adds subscription to the GroupQuotas. + * + *

Adds a subscription to GroupQuotas. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @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 this represents a Azure subscriptionId that is associated with a + * GroupQuotaSEntity. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, GroupQuotaSubscriptionIdInner> + beginCreateOrUpdateAsync(String mgId, String groupQuotaName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = createOrUpdateWithResponseAsync(mgId, groupQuotaName, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + GroupQuotaSubscriptionIdInner.class, + GroupQuotaSubscriptionIdInner.class, + context); + } + + /** + * Adds subscription to the GroupQuotas. + * + *

Adds a subscription to GroupQuotas. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 this represents a Azure subscriptionId that is associated with a + * GroupQuotaSEntity. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, GroupQuotaSubscriptionIdInner> beginCreateOrUpdate( + String mgId, String groupQuotaName) { + return this.beginCreateOrUpdateAsync(mgId, groupQuotaName).getSyncPoller(); + } + + /** + * Adds subscription to the GroupQuotas. + * + *

Adds a subscription to GroupQuotas. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of this represents a Azure subscriptionId that is associated with a + * GroupQuotaSEntity. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, GroupQuotaSubscriptionIdInner> beginCreateOrUpdate( + String mgId, String groupQuotaName, Context context) { + return this.beginCreateOrUpdateAsync(mgId, groupQuotaName, context).getSyncPoller(); + } + + /** + * Adds subscription to the GroupQuotas. + * + *

Adds a subscription to GroupQuotas. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this represents a Azure subscriptionId that is associated with a GroupQuotaSEntity on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String mgId, String groupQuotaName) { + return beginCreateOrUpdateAsync(mgId, groupQuotaName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Adds subscription to the GroupQuotas. + * + *

Adds a subscription to GroupQuotas. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @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 this represents a Azure subscriptionId that is associated with a GroupQuotaSEntity on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String mgId, String groupQuotaName, Context context) { + return beginCreateOrUpdateAsync(mgId, groupQuotaName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Adds subscription to the GroupQuotas. + * + *

Adds a subscription to GroupQuotas. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this represents a Azure subscriptionId that is associated with a GroupQuotaSEntity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GroupQuotaSubscriptionIdInner createOrUpdate(String mgId, String groupQuotaName) { + return createOrUpdateAsync(mgId, groupQuotaName).block(); + } + + /** + * Adds subscription to the GroupQuotas. + * + *

Adds a subscription to GroupQuotas. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @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 this represents a Azure subscriptionId that is associated with a GroupQuotaSEntity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GroupQuotaSubscriptionIdInner createOrUpdate(String mgId, String groupQuotaName, Context context) { + return createOrUpdateAsync(mgId, groupQuotaName, context).block(); + } + + /** + * Updates the GroupQuotas with the subscription to add to the subscriptions list. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this represents a Azure subscriptionId that is associated with a GroupQuotaSEntity along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String mgId, String groupQuotaName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (mgId == null) { + return Mono.error(new IllegalArgumentException("Parameter mgId is required and cannot be null.")); + } + if (groupQuotaName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupQuotaName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2023-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + mgId, + groupQuotaName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates the GroupQuotas with the subscription to add to the subscriptions list. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @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 this represents a Azure subscriptionId that is associated with a GroupQuotaSEntity along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String mgId, String groupQuotaName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (mgId == null) { + return Mono.error(new IllegalArgumentException("Parameter mgId is required and cannot be null.")); + } + if (groupQuotaName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupQuotaName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2023-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + mgId, + groupQuotaName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Updates the GroupQuotas with the subscription to add to the subscriptions list. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 this represents a Azure subscriptionId that is associated with a + * GroupQuotaSEntity. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, GroupQuotaSubscriptionIdInner> beginUpdateAsync( + String mgId, String groupQuotaName) { + Mono>> mono = updateWithResponseAsync(mgId, groupQuotaName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + GroupQuotaSubscriptionIdInner.class, + GroupQuotaSubscriptionIdInner.class, + this.client.getContext()); + } + + /** + * Updates the GroupQuotas with the subscription to add to the subscriptions list. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @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 this represents a Azure subscriptionId that is associated with a + * GroupQuotaSEntity. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, GroupQuotaSubscriptionIdInner> beginUpdateAsync( + String mgId, String groupQuotaName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = updateWithResponseAsync(mgId, groupQuotaName, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + GroupQuotaSubscriptionIdInner.class, + GroupQuotaSubscriptionIdInner.class, + context); + } + + /** + * Updates the GroupQuotas with the subscription to add to the subscriptions list. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 this represents a Azure subscriptionId that is associated with a + * GroupQuotaSEntity. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, GroupQuotaSubscriptionIdInner> beginUpdate( + String mgId, String groupQuotaName) { + return this.beginUpdateAsync(mgId, groupQuotaName).getSyncPoller(); + } + + /** + * Updates the GroupQuotas with the subscription to add to the subscriptions list. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of this represents a Azure subscriptionId that is associated with a + * GroupQuotaSEntity. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, GroupQuotaSubscriptionIdInner> beginUpdate( + String mgId, String groupQuotaName, Context context) { + return this.beginUpdateAsync(mgId, groupQuotaName, context).getSyncPoller(); + } + + /** + * Updates the GroupQuotas with the subscription to add to the subscriptions list. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this represents a Azure subscriptionId that is associated with a GroupQuotaSEntity on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String mgId, String groupQuotaName) { + return beginUpdateAsync(mgId, groupQuotaName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates the GroupQuotas with the subscription to add to the subscriptions list. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @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 this represents a Azure subscriptionId that is associated with a GroupQuotaSEntity on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String mgId, String groupQuotaName, Context context) { + return beginUpdateAsync(mgId, groupQuotaName, context).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates the GroupQuotas with the subscription to add to the subscriptions list. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this represents a Azure subscriptionId that is associated with a GroupQuotaSEntity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GroupQuotaSubscriptionIdInner update(String mgId, String groupQuotaName) { + return updateAsync(mgId, groupQuotaName).block(); + } + + /** + * Updates the GroupQuotas with the subscription to add to the subscriptions list. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @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 this represents a Azure subscriptionId that is associated with a GroupQuotaSEntity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GroupQuotaSubscriptionIdInner update(String mgId, String groupQuotaName, Context context) { + return updateAsync(mgId, groupQuotaName, context).block(); + } + + /** + * Removes the subscription from GroupQuotas. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 mgId, String groupQuotaName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (mgId == null) { + return Mono.error(new IllegalArgumentException("Parameter mgId is required and cannot be null.")); + } + if (groupQuotaName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupQuotaName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2023-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + mgId, + groupQuotaName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Removes the subscription from GroupQuotas. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @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 mgId, String groupQuotaName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (mgId == null) { + return Mono.error(new IllegalArgumentException("Parameter mgId is required and cannot be null.")); + } + if (groupQuotaName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupQuotaName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2023-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + mgId, + groupQuotaName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Removes the subscription from GroupQuotas. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String mgId, String groupQuotaName) { + return deleteWithResponseAsync(mgId, groupQuotaName).flatMap(ignored -> Mono.empty()); + } + + /** + * Removes the subscription from GroupQuotas. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String mgId, String groupQuotaName, Context context) { + return deleteWithResponseAsync(mgId, groupQuotaName, context).block(); + } + + /** + * Removes the subscription from GroupQuotas. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String mgId, String groupQuotaName) { + deleteWithResponse(mgId, groupQuotaName, Context.NONE); + } + + /** + * Returns the subscriptionId along with its provisioning state for being associated with the GroupQuotasEntity. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this represents a Azure subscriptionId that is associated with a GroupQuotaSEntity along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String mgId, String groupQuotaName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (mgId == null) { + return Mono.error(new IllegalArgumentException("Parameter mgId is required and cannot be null.")); + } + if (groupQuotaName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupQuotaName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2023-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + mgId, + groupQuotaName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns the subscriptionId along with its provisioning state for being associated with the GroupQuotasEntity. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @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 this represents a Azure subscriptionId that is associated with a GroupQuotaSEntity along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String mgId, String groupQuotaName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (mgId == null) { + return Mono.error(new IllegalArgumentException("Parameter mgId is required and cannot be null.")); + } + if (groupQuotaName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupQuotaName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2023-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + mgId, + groupQuotaName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Returns the subscriptionId along with its provisioning state for being associated with the GroupQuotasEntity. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this represents a Azure subscriptionId that is associated with a GroupQuotaSEntity on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String mgId, String groupQuotaName) { + return getWithResponseAsync(mgId, groupQuotaName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Returns the subscriptionId along with its provisioning state for being associated with the GroupQuotasEntity. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @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 this represents a Azure subscriptionId that is associated with a GroupQuotaSEntity along with {@link + * Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String mgId, String groupQuotaName, Context context) { + return getWithResponseAsync(mgId, groupQuotaName, context).block(); + } + + /** + * Returns the subscriptionId along with its provisioning state for being associated with the GroupQuotasEntity. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this represents a Azure subscriptionId that is associated with a GroupQuotaSEntity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GroupQuotaSubscriptionIdInner get(String mgId, String groupQuotaName) { + return getWithResponse(mgId, groupQuotaName, Context.NONE).getValue(); + } + + /** + * Returns a list of the subscriptionIds associated with the GroupQuotasEntity. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of GroupQuotaSubscriptionIds along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String mgId, String groupQuotaName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (mgId == null) { + return Mono.error(new IllegalArgumentException("Parameter mgId is required and cannot be null.")); + } + if (groupQuotaName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupQuotaName is required and cannot be null.")); + } + final String apiVersion = "2023-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), mgId, groupQuotaName, 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())); + } + + /** + * Returns a list of the subscriptionIds associated with the GroupQuotasEntity. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @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 list of GroupQuotaSubscriptionIds along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String mgId, String groupQuotaName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (mgId == null) { + return Mono.error(new IllegalArgumentException("Parameter mgId is required and cannot be null.")); + } + if (groupQuotaName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupQuotaName is required and cannot be null.")); + } + final String apiVersion = "2023-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), mgId, groupQuotaName, apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Returns a list of the subscriptionIds associated with the GroupQuotasEntity. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of GroupQuotaSubscriptionIds as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String mgId, String groupQuotaName) { + return new PagedFlux<>( + () -> listSinglePageAsync(mgId, groupQuotaName), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Returns a list of the subscriptionIds associated with the GroupQuotasEntity. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @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 list of GroupQuotaSubscriptionIds as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String mgId, String groupQuotaName, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(mgId, groupQuotaName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Returns a list of the subscriptionIds associated with the GroupQuotasEntity. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of GroupQuotaSubscriptionIds as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String mgId, String groupQuotaName) { + return new PagedIterable<>(listAsync(mgId, groupQuotaName)); + } + + /** + * Returns a list of the subscriptionIds associated with the GroupQuotasEntity. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @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 list of GroupQuotaSubscriptionIds as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String mgId, String groupQuotaName, Context context) { + return new PagedIterable<>(listAsync(mgId, groupQuotaName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

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

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of GroupQuotaSubscriptionIds 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/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/GroupQuotaSubscriptionsImpl.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/GroupQuotaSubscriptionsImpl.java new file mode 100644 index 000000000000..bd3f4ff2584f --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/GroupQuotaSubscriptionsImpl.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.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.quota.fluent.GroupQuotaSubscriptionsClient; +import com.azure.resourcemanager.quota.fluent.models.GroupQuotaSubscriptionIdInner; +import com.azure.resourcemanager.quota.models.GroupQuotaSubscriptionId; +import com.azure.resourcemanager.quota.models.GroupQuotaSubscriptions; + +public final class GroupQuotaSubscriptionsImpl implements GroupQuotaSubscriptions { + private static final ClientLogger LOGGER = new ClientLogger(GroupQuotaSubscriptionsImpl.class); + + private final GroupQuotaSubscriptionsClient innerClient; + + private final com.azure.resourcemanager.quota.QuotaManager serviceManager; + + public GroupQuotaSubscriptionsImpl( + GroupQuotaSubscriptionsClient innerClient, com.azure.resourcemanager.quota.QuotaManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public GroupQuotaSubscriptionId createOrUpdate(String mgId, String groupQuotaName) { + GroupQuotaSubscriptionIdInner inner = this.serviceClient().createOrUpdate(mgId, groupQuotaName); + if (inner != null) { + return new GroupQuotaSubscriptionIdImpl(inner, this.manager()); + } else { + return null; + } + } + + public GroupQuotaSubscriptionId createOrUpdate(String mgId, String groupQuotaName, Context context) { + GroupQuotaSubscriptionIdInner inner = this.serviceClient().createOrUpdate(mgId, groupQuotaName, context); + if (inner != null) { + return new GroupQuotaSubscriptionIdImpl(inner, this.manager()); + } else { + return null; + } + } + + public GroupQuotaSubscriptionId update(String mgId, String groupQuotaName) { + GroupQuotaSubscriptionIdInner inner = this.serviceClient().update(mgId, groupQuotaName); + if (inner != null) { + return new GroupQuotaSubscriptionIdImpl(inner, this.manager()); + } else { + return null; + } + } + + public GroupQuotaSubscriptionId update(String mgId, String groupQuotaName, Context context) { + GroupQuotaSubscriptionIdInner inner = this.serviceClient().update(mgId, groupQuotaName, context); + if (inner != null) { + return new GroupQuotaSubscriptionIdImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteByResourceGroupWithResponse(String mgId, String groupQuotaName, Context context) { + return this.serviceClient().deleteWithResponse(mgId, groupQuotaName, context); + } + + public void deleteByResourceGroup(String mgId, String groupQuotaName) { + this.serviceClient().delete(mgId, groupQuotaName); + } + + public Response getWithResponse(String mgId, String groupQuotaName, Context context) { + Response inner = + this.serviceClient().getWithResponse(mgId, groupQuotaName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new GroupQuotaSubscriptionIdImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public GroupQuotaSubscriptionId get(String mgId, String groupQuotaName) { + GroupQuotaSubscriptionIdInner inner = this.serviceClient().get(mgId, groupQuotaName); + if (inner != null) { + return new GroupQuotaSubscriptionIdImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable list(String mgId, String groupQuotaName) { + PagedIterable inner = this.serviceClient().list(mgId, groupQuotaName); + return Utils.mapPage(inner, inner1 -> new GroupQuotaSubscriptionIdImpl(inner1, this.manager())); + } + + public PagedIterable list(String mgId, String groupQuotaName, Context context) { + PagedIterable inner = this.serviceClient().list(mgId, groupQuotaName, context); + return Utils.mapPage(inner, inner1 -> new GroupQuotaSubscriptionIdImpl(inner1, this.manager())); + } + + private GroupQuotaSubscriptionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.quota.QuotaManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/GroupQuotasClientImpl.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/GroupQuotasClientImpl.java new file mode 100644 index 000000000000..598b637aae7e --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/GroupQuotasClientImpl.java @@ -0,0 +1,1383 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.quota.fluent.GroupQuotasClient; +import com.azure.resourcemanager.quota.fluent.models.GroupQuotasEntityInner; +import com.azure.resourcemanager.quota.models.GroupQuotaList; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in GroupQuotasClient. */ +public final class GroupQuotasClientImpl implements GroupQuotasClient { + /** The proxy service used to perform REST calls. */ + private final GroupQuotasService service; + + /** The service client containing this operation class. */ + private final AzureQuotaExtensionApiImpl client; + + /** + * Initializes an instance of GroupQuotasClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + GroupQuotasClientImpl(AzureQuotaExtensionApiImpl client) { + this.service = + RestProxy.create(GroupQuotasService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureQuotaExtensionApiGroupQuotas to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureQuotaExtensionA") + public interface GroupQuotasService { + @Headers({"Content-Type: application/json"}) + @Put( + "/providers/Microsoft.Management/managementGroups/{mgId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("mgId") String mgId, + @PathParam("groupQuotaName") String groupQuotaName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") GroupQuotasEntityInner groupQuotaPutRequestBody, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/providers/Microsoft.Management/managementGroups/{mgId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("mgId") String mgId, + @PathParam("groupQuotaName") String groupQuotaName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") GroupQuotasEntityInner groupQuotasPatchRequestBody, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Management/managementGroups/{mgId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("mgId") String mgId, + @PathParam("groupQuotaName") String groupQuotaName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/providers/Microsoft.Management/managementGroups/{mgId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("mgId") String mgId, + @PathParam("groupQuotaName") String groupQuotaName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Management/managementGroups/{mgId}/providers/Microsoft.Quota/groupQuotas") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("mgId") String mgId, + @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); + } + + /** + * Creates a new GroupQuota for the name passed. + * + *

Creates a new GroupQuota for the name passed. A RequestId will be returned by the Service. The status can be + * polled periodically. The status Async polling is using standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to + * Get URI and full details can be checked. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param groupQuotaPutRequestBody The GroupQuota body details for creation or update of a GroupQuota entity. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties and filters for ShareQuota along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String mgId, String groupQuotaName, GroupQuotasEntityInner groupQuotaPutRequestBody) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (mgId == null) { + return Mono.error(new IllegalArgumentException("Parameter mgId is required and cannot be null.")); + } + if (groupQuotaName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupQuotaName is required and cannot be null.")); + } + if (groupQuotaPutRequestBody != null) { + groupQuotaPutRequestBody.validate(); + } + final String apiVersion = "2023-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + mgId, + groupQuotaName, + apiVersion, + groupQuotaPutRequestBody, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates a new GroupQuota for the name passed. + * + *

Creates a new GroupQuota for the name passed. A RequestId will be returned by the Service. The status can be + * polled periodically. The status Async polling is using standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to + * Get URI and full details can be checked. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param groupQuotaPutRequestBody The GroupQuota body details for creation or update of a GroupQuota entity. + * @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 properties and filters for ShareQuota along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String mgId, String groupQuotaName, GroupQuotasEntityInner groupQuotaPutRequestBody, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (mgId == null) { + return Mono.error(new IllegalArgumentException("Parameter mgId is required and cannot be null.")); + } + if (groupQuotaName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupQuotaName is required and cannot be null.")); + } + if (groupQuotaPutRequestBody != null) { + groupQuotaPutRequestBody.validate(); + } + final String apiVersion = "2023-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), mgId, groupQuotaName, apiVersion, groupQuotaPutRequestBody, accept, context); + } + + /** + * Creates a new GroupQuota for the name passed. + * + *

Creates a new GroupQuota for the name passed. A RequestId will be returned by the Service. The status can be + * polled periodically. The status Async polling is using standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to + * Get URI and full details can be checked. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param groupQuotaPutRequestBody The GroupQuota body details for creation or update of a GroupQuota entity. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 properties and filters for ShareQuota. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, GroupQuotasEntityInner> beginCreateOrUpdateAsync( + String mgId, String groupQuotaName, GroupQuotasEntityInner groupQuotaPutRequestBody) { + Mono>> mono = + createOrUpdateWithResponseAsync(mgId, groupQuotaName, groupQuotaPutRequestBody); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + GroupQuotasEntityInner.class, + GroupQuotasEntityInner.class, + this.client.getContext()); + } + + /** + * Creates a new GroupQuota for the name passed. + * + *

Creates a new GroupQuota for the name passed. A RequestId will be returned by the Service. The status can be + * polled periodically. The status Async polling is using standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to + * Get URI and full details can be checked. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 properties and filters for ShareQuota. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, GroupQuotasEntityInner> beginCreateOrUpdateAsync( + String mgId, String groupQuotaName) { + final GroupQuotasEntityInner groupQuotaPutRequestBody = null; + Mono>> mono = + createOrUpdateWithResponseAsync(mgId, groupQuotaName, groupQuotaPutRequestBody); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + GroupQuotasEntityInner.class, + GroupQuotasEntityInner.class, + this.client.getContext()); + } + + /** + * Creates a new GroupQuota for the name passed. + * + *

Creates a new GroupQuota for the name passed. A RequestId will be returned by the Service. The status can be + * polled periodically. The status Async polling is using standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to + * Get URI and full details can be checked. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param groupQuotaPutRequestBody The GroupQuota body details for creation or update of a GroupQuota entity. + * @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 properties and filters for ShareQuota. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, GroupQuotasEntityInner> beginCreateOrUpdateAsync( + String mgId, String groupQuotaName, GroupQuotasEntityInner groupQuotaPutRequestBody, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(mgId, groupQuotaName, groupQuotaPutRequestBody, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + GroupQuotasEntityInner.class, + GroupQuotasEntityInner.class, + context); + } + + /** + * Creates a new GroupQuota for the name passed. + * + *

Creates a new GroupQuota for the name passed. A RequestId will be returned by the Service. The status can be + * polled periodically. The status Async polling is using standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to + * Get URI and full details can be checked. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 properties and filters for ShareQuota. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, GroupQuotasEntityInner> beginCreateOrUpdate( + String mgId, String groupQuotaName) { + final GroupQuotasEntityInner groupQuotaPutRequestBody = null; + return this.beginCreateOrUpdateAsync(mgId, groupQuotaName, groupQuotaPutRequestBody).getSyncPoller(); + } + + /** + * Creates a new GroupQuota for the name passed. + * + *

Creates a new GroupQuota for the name passed. A RequestId will be returned by the Service. The status can be + * polled periodically. The status Async polling is using standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to + * Get URI and full details can be checked. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param groupQuotaPutRequestBody The GroupQuota body details for creation or update of a GroupQuota entity. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of properties and filters for ShareQuota. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, GroupQuotasEntityInner> beginCreateOrUpdate( + String mgId, String groupQuotaName, GroupQuotasEntityInner groupQuotaPutRequestBody, Context context) { + return this.beginCreateOrUpdateAsync(mgId, groupQuotaName, groupQuotaPutRequestBody, context).getSyncPoller(); + } + + /** + * Creates a new GroupQuota for the name passed. + * + *

Creates a new GroupQuota for the name passed. A RequestId will be returned by the Service. The status can be + * polled periodically. The status Async polling is using standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to + * Get URI and full details can be checked. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param groupQuotaPutRequestBody The GroupQuota body details for creation or update of a GroupQuota entity. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties and filters for ShareQuota on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String mgId, String groupQuotaName, GroupQuotasEntityInner groupQuotaPutRequestBody) { + return beginCreateOrUpdateAsync(mgId, groupQuotaName, groupQuotaPutRequestBody) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a new GroupQuota for the name passed. + * + *

Creates a new GroupQuota for the name passed. A RequestId will be returned by the Service. The status can be + * polled periodically. The status Async polling is using standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to + * Get URI and full details can be checked. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties and filters for ShareQuota on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String mgId, String groupQuotaName) { + final GroupQuotasEntityInner groupQuotaPutRequestBody = null; + return beginCreateOrUpdateAsync(mgId, groupQuotaName, groupQuotaPutRequestBody) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a new GroupQuota for the name passed. + * + *

Creates a new GroupQuota for the name passed. A RequestId will be returned by the Service. The status can be + * polled periodically. The status Async polling is using standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to + * Get URI and full details can be checked. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param groupQuotaPutRequestBody The GroupQuota body details for creation or update of a GroupQuota entity. + * @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 properties and filters for ShareQuota on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String mgId, String groupQuotaName, GroupQuotasEntityInner groupQuotaPutRequestBody, Context context) { + return beginCreateOrUpdateAsync(mgId, groupQuotaName, groupQuotaPutRequestBody, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a new GroupQuota for the name passed. + * + *

Creates a new GroupQuota for the name passed. A RequestId will be returned by the Service. The status can be + * polled periodically. The status Async polling is using standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to + * Get URI and full details can be checked. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties and filters for ShareQuota. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GroupQuotasEntityInner createOrUpdate(String mgId, String groupQuotaName) { + final GroupQuotasEntityInner groupQuotaPutRequestBody = null; + return createOrUpdateAsync(mgId, groupQuotaName, groupQuotaPutRequestBody).block(); + } + + /** + * Creates a new GroupQuota for the name passed. + * + *

Creates a new GroupQuota for the name passed. A RequestId will be returned by the Service. The status can be + * polled periodically. The status Async polling is using standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to + * Get URI and full details can be checked. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param groupQuotaPutRequestBody The GroupQuota body details for creation or update of a GroupQuota entity. + * @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 properties and filters for ShareQuota. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GroupQuotasEntityInner createOrUpdate( + String mgId, String groupQuotaName, GroupQuotasEntityInner groupQuotaPutRequestBody, Context context) { + return createOrUpdateAsync(mgId, groupQuotaName, groupQuotaPutRequestBody, context).block(); + } + + /** + * Updates a new GroupQuotas for the name passed. + * + *

Updates the GroupQuotas for the name passed. A GroupQuotas RequestId will be returned by the Service. The + * status can be polled periodically. The status Async polling is using standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to + * Get URI and full details can be checked. Any change in the filters will be applicable to the future quota + * assignments, existing quota assigned to subscriptions from the GroupQuotas remains unchanged. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param groupQuotasPatchRequestBody The GroupQuotas Patch Request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties and filters for ShareQuota along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String mgId, String groupQuotaName, GroupQuotasEntityInner groupQuotasPatchRequestBody) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (mgId == null) { + return Mono.error(new IllegalArgumentException("Parameter mgId is required and cannot be null.")); + } + if (groupQuotaName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupQuotaName is required and cannot be null.")); + } + if (groupQuotasPatchRequestBody != null) { + groupQuotasPatchRequestBody.validate(); + } + final String apiVersion = "2023-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + mgId, + groupQuotaName, + apiVersion, + groupQuotasPatchRequestBody, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates a new GroupQuotas for the name passed. + * + *

Updates the GroupQuotas for the name passed. A GroupQuotas RequestId will be returned by the Service. The + * status can be polled periodically. The status Async polling is using standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to + * Get URI and full details can be checked. Any change in the filters will be applicable to the future quota + * assignments, existing quota assigned to subscriptions from the GroupQuotas remains unchanged. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param groupQuotasPatchRequestBody The GroupQuotas Patch Request. + * @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 properties and filters for ShareQuota along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String mgId, String groupQuotaName, GroupQuotasEntityInner groupQuotasPatchRequestBody, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (mgId == null) { + return Mono.error(new IllegalArgumentException("Parameter mgId is required and cannot be null.")); + } + if (groupQuotaName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupQuotaName is required and cannot be null.")); + } + if (groupQuotasPatchRequestBody != null) { + groupQuotasPatchRequestBody.validate(); + } + final String apiVersion = "2023-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + mgId, + groupQuotaName, + apiVersion, + groupQuotasPatchRequestBody, + accept, + context); + } + + /** + * Updates a new GroupQuotas for the name passed. + * + *

Updates the GroupQuotas for the name passed. A GroupQuotas RequestId will be returned by the Service. The + * status can be polled periodically. The status Async polling is using standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to + * Get URI and full details can be checked. Any change in the filters will be applicable to the future quota + * assignments, existing quota assigned to subscriptions from the GroupQuotas remains unchanged. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param groupQuotasPatchRequestBody The GroupQuotas Patch Request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 properties and filters for ShareQuota. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, GroupQuotasEntityInner> beginUpdateAsync( + String mgId, String groupQuotaName, GroupQuotasEntityInner groupQuotasPatchRequestBody) { + Mono>> mono = + updateWithResponseAsync(mgId, groupQuotaName, groupQuotasPatchRequestBody); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + GroupQuotasEntityInner.class, + GroupQuotasEntityInner.class, + this.client.getContext()); + } + + /** + * Updates a new GroupQuotas for the name passed. + * + *

Updates the GroupQuotas for the name passed. A GroupQuotas RequestId will be returned by the Service. The + * status can be polled periodically. The status Async polling is using standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to + * Get URI and full details can be checked. Any change in the filters will be applicable to the future quota + * assignments, existing quota assigned to subscriptions from the GroupQuotas remains unchanged. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 properties and filters for ShareQuota. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, GroupQuotasEntityInner> beginUpdateAsync( + String mgId, String groupQuotaName) { + final GroupQuotasEntityInner groupQuotasPatchRequestBody = null; + Mono>> mono = + updateWithResponseAsync(mgId, groupQuotaName, groupQuotasPatchRequestBody); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + GroupQuotasEntityInner.class, + GroupQuotasEntityInner.class, + this.client.getContext()); + } + + /** + * Updates a new GroupQuotas for the name passed. + * + *

Updates the GroupQuotas for the name passed. A GroupQuotas RequestId will be returned by the Service. The + * status can be polled periodically. The status Async polling is using standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to + * Get URI and full details can be checked. Any change in the filters will be applicable to the future quota + * assignments, existing quota assigned to subscriptions from the GroupQuotas remains unchanged. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param groupQuotasPatchRequestBody The GroupQuotas Patch Request. + * @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 properties and filters for ShareQuota. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, GroupQuotasEntityInner> beginUpdateAsync( + String mgId, String groupQuotaName, GroupQuotasEntityInner groupQuotasPatchRequestBody, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(mgId, groupQuotaName, groupQuotasPatchRequestBody, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + GroupQuotasEntityInner.class, + GroupQuotasEntityInner.class, + context); + } + + /** + * Updates a new GroupQuotas for the name passed. + * + *

Updates the GroupQuotas for the name passed. A GroupQuotas RequestId will be returned by the Service. The + * status can be polled periodically. The status Async polling is using standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to + * Get URI and full details can be checked. Any change in the filters will be applicable to the future quota + * assignments, existing quota assigned to subscriptions from the GroupQuotas remains unchanged. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 properties and filters for ShareQuota. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, GroupQuotasEntityInner> beginUpdate( + String mgId, String groupQuotaName) { + final GroupQuotasEntityInner groupQuotasPatchRequestBody = null; + return this.beginUpdateAsync(mgId, groupQuotaName, groupQuotasPatchRequestBody).getSyncPoller(); + } + + /** + * Updates a new GroupQuotas for the name passed. + * + *

Updates the GroupQuotas for the name passed. A GroupQuotas RequestId will be returned by the Service. The + * status can be polled periodically. The status Async polling is using standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to + * Get URI and full details can be checked. Any change in the filters will be applicable to the future quota + * assignments, existing quota assigned to subscriptions from the GroupQuotas remains unchanged. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param groupQuotasPatchRequestBody The GroupQuotas Patch Request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of properties and filters for ShareQuota. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, GroupQuotasEntityInner> beginUpdate( + String mgId, String groupQuotaName, GroupQuotasEntityInner groupQuotasPatchRequestBody, Context context) { + return this.beginUpdateAsync(mgId, groupQuotaName, groupQuotasPatchRequestBody, context).getSyncPoller(); + } + + /** + * Updates a new GroupQuotas for the name passed. + * + *

Updates the GroupQuotas for the name passed. A GroupQuotas RequestId will be returned by the Service. The + * status can be polled periodically. The status Async polling is using standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to + * Get URI and full details can be checked. Any change in the filters will be applicable to the future quota + * assignments, existing quota assigned to subscriptions from the GroupQuotas remains unchanged. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param groupQuotasPatchRequestBody The GroupQuotas Patch Request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties and filters for ShareQuota on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String mgId, String groupQuotaName, GroupQuotasEntityInner groupQuotasPatchRequestBody) { + return beginUpdateAsync(mgId, groupQuotaName, groupQuotasPatchRequestBody) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a new GroupQuotas for the name passed. + * + *

Updates the GroupQuotas for the name passed. A GroupQuotas RequestId will be returned by the Service. The + * status can be polled periodically. The status Async polling is using standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to + * Get URI and full details can be checked. Any change in the filters will be applicable to the future quota + * assignments, existing quota assigned to subscriptions from the GroupQuotas remains unchanged. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties and filters for ShareQuota on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String mgId, String groupQuotaName) { + final GroupQuotasEntityInner groupQuotasPatchRequestBody = null; + return beginUpdateAsync(mgId, groupQuotaName, groupQuotasPatchRequestBody) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a new GroupQuotas for the name passed. + * + *

Updates the GroupQuotas for the name passed. A GroupQuotas RequestId will be returned by the Service. The + * status can be polled periodically. The status Async polling is using standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to + * Get URI and full details can be checked. Any change in the filters will be applicable to the future quota + * assignments, existing quota assigned to subscriptions from the GroupQuotas remains unchanged. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param groupQuotasPatchRequestBody The GroupQuotas Patch Request. + * @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 properties and filters for ShareQuota on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String mgId, String groupQuotaName, GroupQuotasEntityInner groupQuotasPatchRequestBody, Context context) { + return beginUpdateAsync(mgId, groupQuotaName, groupQuotasPatchRequestBody, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a new GroupQuotas for the name passed. + * + *

Updates the GroupQuotas for the name passed. A GroupQuotas RequestId will be returned by the Service. The + * status can be polled periodically. The status Async polling is using standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to + * Get URI and full details can be checked. Any change in the filters will be applicable to the future quota + * assignments, existing quota assigned to subscriptions from the GroupQuotas remains unchanged. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties and filters for ShareQuota. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GroupQuotasEntityInner update(String mgId, String groupQuotaName) { + final GroupQuotasEntityInner groupQuotasPatchRequestBody = null; + return updateAsync(mgId, groupQuotaName, groupQuotasPatchRequestBody).block(); + } + + /** + * Updates a new GroupQuotas for the name passed. + * + *

Updates the GroupQuotas for the name passed. A GroupQuotas RequestId will be returned by the Service. The + * status can be polled periodically. The status Async polling is using standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to + * Get URI and full details can be checked. Any change in the filters will be applicable to the future quota + * assignments, existing quota assigned to subscriptions from the GroupQuotas remains unchanged. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param groupQuotasPatchRequestBody The GroupQuotas Patch Request. + * @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 properties and filters for ShareQuota. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GroupQuotasEntityInner update( + String mgId, String groupQuotaName, GroupQuotasEntityInner groupQuotasPatchRequestBody, Context context) { + return updateAsync(mgId, groupQuotaName, groupQuotasPatchRequestBody, context).block(); + } + + /** + * Gets GroupQuotas for the name passed. + * + *

Gets the GroupQuotas for the name passed. It will return the GroupQuotas properties only. The details on + * groupQuota can be access from the groupQuota APIs. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the GroupQuotas for the name passed along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String mgId, String groupQuotaName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (mgId == null) { + return Mono.error(new IllegalArgumentException("Parameter mgId is required and cannot be null.")); + } + if (groupQuotaName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupQuotaName is required and cannot be null.")); + } + final String apiVersion = "2023-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.get(this.client.getEndpoint(), mgId, groupQuotaName, apiVersion, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets GroupQuotas for the name passed. + * + *

Gets the GroupQuotas for the name passed. It will return the GroupQuotas properties only. The details on + * groupQuota can be access from the groupQuota APIs. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @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 GroupQuotas for the name passed along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String mgId, String groupQuotaName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (mgId == null) { + return Mono.error(new IllegalArgumentException("Parameter mgId is required and cannot be null.")); + } + if (groupQuotaName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupQuotaName is required and cannot be null.")); + } + final String apiVersion = "2023-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), mgId, groupQuotaName, apiVersion, accept, context); + } + + /** + * Gets GroupQuotas for the name passed. + * + *

Gets the GroupQuotas for the name passed. It will return the GroupQuotas properties only. The details on + * groupQuota can be access from the groupQuota APIs. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the GroupQuotas for the name passed on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String mgId, String groupQuotaName) { + return getWithResponseAsync(mgId, groupQuotaName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets GroupQuotas for the name passed. + * + *

Gets the GroupQuotas for the name passed. It will return the GroupQuotas properties only. The details on + * groupQuota can be access from the groupQuota APIs. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @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 GroupQuotas for the name passed along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String mgId, String groupQuotaName, Context context) { + return getWithResponseAsync(mgId, groupQuotaName, context).block(); + } + + /** + * Gets GroupQuotas for the name passed. + * + *

Gets the GroupQuotas for the name passed. It will return the GroupQuotas properties only. The details on + * groupQuota can be access from the groupQuota APIs. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the GroupQuotas for the name passed. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GroupQuotasEntityInner get(String mgId, String groupQuotaName) { + return getWithResponse(mgId, groupQuotaName, Context.NONE).getValue(); + } + + /** + * Deletes GroupQuotas for the name passed. + * + *

Deletes the GroupQuotas for the name passed. All the remaining shareQuota in the GroupQuotas will be lost. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 mgId, String groupQuotaName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (mgId == null) { + return Mono.error(new IllegalArgumentException("Parameter mgId is required and cannot be null.")); + } + if (groupQuotaName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupQuotaName is required and cannot be null.")); + } + final String apiVersion = "2023-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.delete(this.client.getEndpoint(), mgId, groupQuotaName, apiVersion, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes GroupQuotas for the name passed. + * + *

Deletes the GroupQuotas for the name passed. All the remaining shareQuota in the GroupQuotas will be lost. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @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 mgId, String groupQuotaName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (mgId == null) { + return Mono.error(new IllegalArgumentException("Parameter mgId is required and cannot be null.")); + } + if (groupQuotaName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupQuotaName is required and cannot be null.")); + } + final String apiVersion = "2023-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), mgId, groupQuotaName, apiVersion, accept, context); + } + + /** + * Deletes GroupQuotas for the name passed. + * + *

Deletes the GroupQuotas for the name passed. All the remaining shareQuota in the GroupQuotas will be lost. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String mgId, String groupQuotaName) { + return deleteWithResponseAsync(mgId, groupQuotaName).flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes GroupQuotas for the name passed. + * + *

Deletes the GroupQuotas for the name passed. All the remaining shareQuota in the GroupQuotas will be lost. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String mgId, String groupQuotaName, Context context) { + return deleteWithResponseAsync(mgId, groupQuotaName, context).block(); + } + + /** + * Deletes GroupQuotas for the name passed. + * + *

Deletes the GroupQuotas for the name passed. All the remaining shareQuota in the GroupQuotas will be lost. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String mgId, String groupQuotaName) { + deleteWithResponse(mgId, groupQuotaName, Context.NONE); + } + + /** + * Lists GroupQuotas for the scope passed. + * + *

Lists GroupQuotas for the scope passed. It will return the GroupQuotas QuotaEntity properties only.The details + * on groupQuota can be access from the groupQuota APIs. + * + * @param mgId Management Group Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Group Quotas at MG level along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String mgId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (mgId == null) { + return Mono.error(new IllegalArgumentException("Parameter mgId is required and cannot be null.")); + } + final String apiVersion = "2023-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), mgId, 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())); + } + + /** + * Lists GroupQuotas for the scope passed. + * + *

Lists GroupQuotas for the scope passed. It will return the GroupQuotas QuotaEntity properties only.The details + * on groupQuota can be access from the groupQuota APIs. + * + * @param mgId Management Group Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Group Quotas at MG level along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String mgId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (mgId == null) { + return Mono.error(new IllegalArgumentException("Parameter mgId is required and cannot be null.")); + } + final String apiVersion = "2023-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), mgId, apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists GroupQuotas for the scope passed. + * + *

Lists GroupQuotas for the scope passed. It will return the GroupQuotas QuotaEntity properties only.The details + * on groupQuota can be access from the groupQuota APIs. + * + * @param mgId Management Group Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Group Quotas at MG level as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String mgId) { + return new PagedFlux<>(() -> listSinglePageAsync(mgId), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists GroupQuotas for the scope passed. + * + *

Lists GroupQuotas for the scope passed. It will return the GroupQuotas QuotaEntity properties only.The details + * on groupQuota can be access from the groupQuota APIs. + * + * @param mgId Management Group Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Group Quotas at MG level as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String mgId, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(mgId, context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists GroupQuotas for the scope passed. + * + *

Lists GroupQuotas for the scope passed. It will return the GroupQuotas QuotaEntity properties only.The details + * on groupQuota can be access from the groupQuota APIs. + * + * @param mgId Management Group Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Group Quotas at MG level as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String mgId) { + return new PagedIterable<>(listAsync(mgId)); + } + + /** + * Lists GroupQuotas for the scope passed. + * + *

Lists GroupQuotas for the scope passed. It will return the GroupQuotas QuotaEntity properties only.The details + * on groupQuota can be access from the groupQuota APIs. + * + * @param mgId Management Group Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Group Quotas at MG level as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String mgId, Context context) { + return new PagedIterable<>(listAsync(mgId, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

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

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Group Quotas at MG level 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/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/GroupQuotasEntityImpl.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/GroupQuotasEntityImpl.java new file mode 100644 index 000000000000..05ebf50de0cf --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/GroupQuotasEntityImpl.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.quota.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.quota.fluent.models.GroupQuotasEntityInner; +import com.azure.resourcemanager.quota.models.GroupQuotasEntity; +import com.azure.resourcemanager.quota.models.GroupQuotasEntityBase; + +public final class GroupQuotasEntityImpl implements GroupQuotasEntity { + private GroupQuotasEntityInner innerObject; + + private final com.azure.resourcemanager.quota.QuotaManager serviceManager; + + GroupQuotasEntityImpl( + GroupQuotasEntityInner innerObject, com.azure.resourcemanager.quota.QuotaManager 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 GroupQuotasEntityBase properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public GroupQuotasEntityInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.quota.QuotaManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/GroupQuotasImpl.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/GroupQuotasImpl.java new file mode 100644 index 000000000000..45bedba85a5c --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/GroupQuotasImpl.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.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.quota.fluent.GroupQuotasClient; +import com.azure.resourcemanager.quota.fluent.models.GroupQuotasEntityInner; +import com.azure.resourcemanager.quota.models.GroupQuotas; +import com.azure.resourcemanager.quota.models.GroupQuotasEntity; + +public final class GroupQuotasImpl implements GroupQuotas { + private static final ClientLogger LOGGER = new ClientLogger(GroupQuotasImpl.class); + + private final GroupQuotasClient innerClient; + + private final com.azure.resourcemanager.quota.QuotaManager serviceManager; + + public GroupQuotasImpl(GroupQuotasClient innerClient, com.azure.resourcemanager.quota.QuotaManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public GroupQuotasEntity createOrUpdate(String mgId, String groupQuotaName) { + GroupQuotasEntityInner inner = this.serviceClient().createOrUpdate(mgId, groupQuotaName); + if (inner != null) { + return new GroupQuotasEntityImpl(inner, this.manager()); + } else { + return null; + } + } + + public GroupQuotasEntity createOrUpdate( + String mgId, String groupQuotaName, GroupQuotasEntityInner groupQuotaPutRequestBody, Context context) { + GroupQuotasEntityInner inner = + this.serviceClient().createOrUpdate(mgId, groupQuotaName, groupQuotaPutRequestBody, context); + if (inner != null) { + return new GroupQuotasEntityImpl(inner, this.manager()); + } else { + return null; + } + } + + public GroupQuotasEntity update(String mgId, String groupQuotaName) { + GroupQuotasEntityInner inner = this.serviceClient().update(mgId, groupQuotaName); + if (inner != null) { + return new GroupQuotasEntityImpl(inner, this.manager()); + } else { + return null; + } + } + + public GroupQuotasEntity update( + String mgId, String groupQuotaName, GroupQuotasEntityInner groupQuotasPatchRequestBody, Context context) { + GroupQuotasEntityInner inner = + this.serviceClient().update(mgId, groupQuotaName, groupQuotasPatchRequestBody, context); + if (inner != null) { + return new GroupQuotasEntityImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String mgId, String groupQuotaName, Context context) { + Response inner = this.serviceClient().getWithResponse(mgId, groupQuotaName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new GroupQuotasEntityImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public GroupQuotasEntity get(String mgId, String groupQuotaName) { + GroupQuotasEntityInner inner = this.serviceClient().get(mgId, groupQuotaName); + if (inner != null) { + return new GroupQuotasEntityImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteByResourceGroupWithResponse(String mgId, String groupQuotaName, Context context) { + return this.serviceClient().deleteWithResponse(mgId, groupQuotaName, context); + } + + public void deleteByResourceGroup(String mgId, String groupQuotaName) { + this.serviceClient().delete(mgId, groupQuotaName); + } + + public PagedIterable list(String mgId) { + PagedIterable inner = this.serviceClient().list(mgId); + return Utils.mapPage(inner, inner1 -> new GroupQuotasEntityImpl(inner1, this.manager())); + } + + public PagedIterable list(String mgId, Context context) { + PagedIterable inner = this.serviceClient().list(mgId, context); + return Utils.mapPage(inner, inner1 -> new GroupQuotasEntityImpl(inner1, this.manager())); + } + + private GroupQuotasClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.quota.QuotaManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/QuotaOperationsClientImpl.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/QuotaOperationsClientImpl.java index bfa7ab00a576..0d9b4526b201 100644 --- a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/QuotaOperationsClientImpl.java +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/QuotaOperationsClientImpl.java @@ -94,10 +94,10 @@ private Mono> listSinglePageAsync() { new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } + final String apiVersion = "2023-02-01"; final String accept = "application/json"; return FluxUtil - .withContext( - context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, accept, context)) .>map( res -> new PagedResponseBase<>( @@ -129,10 +129,11 @@ private Mono> listSinglePageAsync(Context new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } + final String apiVersion = "2023-02-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service - .list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .list(this.client.getEndpoint(), apiVersion, accept, context) .map( res -> new PagedResponseBase<>( diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/QuotaRequestStatusClientImpl.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/QuotaRequestStatusClientImpl.java index c0b917410533..e0f0509c1bc5 100644 --- a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/QuotaRequestStatusClientImpl.java +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/QuotaRequestStatusClientImpl.java @@ -122,11 +122,10 @@ private Mono> getWithResponseAsync(String id, if (scope == null) { return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); } + final String apiVersion = "2023-02-01"; final String accept = "application/json"; return FluxUtil - .withContext( - context -> - service.get(this.client.getEndpoint(), id, this.client.getApiVersion(), scope, accept, context)) + .withContext(context -> service.get(this.client.getEndpoint(), id, apiVersion, scope, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } @@ -160,9 +159,10 @@ private Mono> getWithResponseAsync(String id, if (scope == null) { return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); } + final String apiVersion = "2023-02-01"; final String accept = "application/json"; context = this.client.mergeContext(context); - return service.get(this.client.getEndpoint(), id, this.client.getApiVersion(), scope, accept, context); + return service.get(this.client.getEndpoint(), id, apiVersion, scope, accept, context); } /** @@ -258,20 +258,12 @@ private Mono> listSinglePageAsync( if (scope == null) { return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); } + final String apiVersion = "2023-02-01"; final String accept = "application/json"; return FluxUtil .withContext( context -> - service - .list( - this.client.getEndpoint(), - this.client.getApiVersion(), - scope, - filter, - top, - skiptoken, - accept, - context)) + service.list(this.client.getEndpoint(), apiVersion, scope, filter, top, skiptoken, accept, context)) .>map( res -> new PagedResponseBase<>( @@ -317,11 +309,11 @@ private Mono> listSinglePageAsync( if (scope == null) { return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); } + final String apiVersion = "2023-02-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service - .list( - this.client.getEndpoint(), this.client.getApiVersion(), scope, filter, top, skiptoken, accept, context) + .list(this.client.getEndpoint(), apiVersion, scope, filter, top, skiptoken, accept, context) .map( res -> new PagedResponseBase<>( diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/QuotasClientImpl.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/QuotasClientImpl.java index 267f460ee08d..defe1c52f2f1 100644 --- a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/QuotasClientImpl.java +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/QuotasClientImpl.java @@ -154,18 +154,11 @@ private Mono getWithResponseAsync(String resourceName, String if (scope == null) { return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); } + final String apiVersion = "2023-02-01"; final String accept = "application/json"; return FluxUtil .withContext( - context -> - service - .get( - this.client.getEndpoint(), - resourceName, - this.client.getApiVersion(), - scope, - accept, - context)) + context -> service.get(this.client.getEndpoint(), resourceName, apiVersion, scope, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } @@ -199,10 +192,10 @@ private Mono getWithResponseAsync(String resourceName, String if (scope == null) { return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); } + final String apiVersion = "2023-02-01"; final String accept = "application/json"; context = this.client.mergeContext(context); - return service - .get(this.client.getEndpoint(), resourceName, this.client.getApiVersion(), scope, accept, context); + return service.get(this.client.getEndpoint(), resourceName, apiVersion, scope, accept, context); } /** @@ -307,6 +300,7 @@ private Mono>> createOrUpdateWithResponseAsync( } else { createQuotaRequest.validate(); } + final String apiVersion = "2023-02-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -315,7 +309,7 @@ private Mono>> createOrUpdateWithResponseAsync( .createOrUpdate( this.client.getEndpoint(), resourceName, - this.client.getApiVersion(), + apiVersion, scope, createQuotaRequest, accept, @@ -365,17 +359,12 @@ private Mono>> createOrUpdateWithResponseAsync( } else { createQuotaRequest.validate(); } + final String apiVersion = "2023-02-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service .createOrUpdate( - this.client.getEndpoint(), - resourceName, - this.client.getApiVersion(), - scope, - createQuotaRequest, - accept, - context); + this.client.getEndpoint(), resourceName, apiVersion, scope, createQuotaRequest, accept, context); } /** @@ -654,6 +643,7 @@ private Mono>> updateWithResponseAsync( } else { createQuotaRequest.validate(); } + final String apiVersion = "2023-02-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -662,7 +652,7 @@ private Mono>> updateWithResponseAsync( .update( this.client.getEndpoint(), resourceName, - this.client.getApiVersion(), + apiVersion, scope, createQuotaRequest, accept, @@ -712,17 +702,11 @@ private Mono>> updateWithResponseAsync( } else { createQuotaRequest.validate(); } + final String apiVersion = "2023-02-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service - .update( - this.client.getEndpoint(), - resourceName, - this.client.getApiVersion(), - scope, - createQuotaRequest, - accept, - context); + .update(this.client.getEndpoint(), resourceName, apiVersion, scope, createQuotaRequest, accept, context); } /** @@ -984,10 +968,10 @@ private Mono> listSinglePageAsync(Stri if (scope == null) { return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); } + final String apiVersion = "2023-02-01"; final String accept = "application/json"; return FluxUtil - .withContext( - context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), scope, accept, context)) + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, scope, accept, context)) .>map( res -> new PagedResponseBase<>( @@ -1026,10 +1010,11 @@ private Mono> listSinglePageAsync(Stri if (scope == null) { return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); } + final String apiVersion = "2023-02-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service - .list(this.client.getEndpoint(), this.client.getApiVersion(), scope, accept, context) + .list(this.client.getEndpoint(), apiVersion, scope, accept, context) .map( res -> new PagedResponseBase<>( diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/SubmittedResourceRequestStatusImpl.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/SubmittedResourceRequestStatusImpl.java new file mode 100644 index 000000000000..ef86c9fb3462 --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/SubmittedResourceRequestStatusImpl.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.quota.implementation; + +import com.azure.resourcemanager.quota.fluent.models.SubmittedResourceRequestStatusInner; +import com.azure.resourcemanager.quota.models.RequestState; +import com.azure.resourcemanager.quota.models.ResourceBaseRequest; +import com.azure.resourcemanager.quota.models.SubmittedResourceRequestStatus; + +public final class SubmittedResourceRequestStatusImpl implements SubmittedResourceRequestStatus { + private SubmittedResourceRequestStatusInner innerObject; + + private final com.azure.resourcemanager.quota.QuotaManager serviceManager; + + SubmittedResourceRequestStatusImpl( + SubmittedResourceRequestStatusInner innerObject, com.azure.resourcemanager.quota.QuotaManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public ResourceBaseRequest requestedResource() { + return this.innerModel().requestedResource(); + } + + public RequestState status() { + return this.innerModel().status(); + } + + public SubmittedResourceRequestStatusInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.quota.QuotaManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/SubscriptionQuotaAllocationRequestImpl.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/SubscriptionQuotaAllocationRequestImpl.java new file mode 100644 index 000000000000..e205bd4738bc --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/SubscriptionQuotaAllocationRequestImpl.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.quota.implementation; + +import com.azure.resourcemanager.quota.fluent.models.SubscriptionQuotaAllocationRequestInner; +import com.azure.resourcemanager.quota.models.SubscriptionQuotaAllocationRequest; +import com.azure.resourcemanager.quota.models.SubscriptionQuotaAllocationRequestProperties; + +public final class SubscriptionQuotaAllocationRequestImpl implements SubscriptionQuotaAllocationRequest { + private SubscriptionQuotaAllocationRequestInner innerObject; + + private final com.azure.resourcemanager.quota.QuotaManager serviceManager; + + SubscriptionQuotaAllocationRequestImpl( + SubscriptionQuotaAllocationRequestInner innerObject, + com.azure.resourcemanager.quota.QuotaManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public SubscriptionQuotaAllocationRequestProperties properties() { + return this.innerModel().properties(); + } + + public SubscriptionQuotaAllocationRequestInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.quota.QuotaManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/SubscriptionQuotaAllocationsImpl.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/SubscriptionQuotaAllocationsImpl.java new file mode 100644 index 000000000000..609c9e246e7b --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/SubscriptionQuotaAllocationsImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.implementation; + +import com.azure.resourcemanager.quota.fluent.models.SubscriptionQuotaAllocationsInner; +import com.azure.resourcemanager.quota.models.SubscriptionQuotaAllocations; +import com.azure.resourcemanager.quota.models.SubscriptionQuotaDetails; + +public final class SubscriptionQuotaAllocationsImpl implements SubscriptionQuotaAllocations { + private SubscriptionQuotaAllocationsInner innerObject; + + private final com.azure.resourcemanager.quota.QuotaManager serviceManager; + + SubscriptionQuotaAllocationsImpl( + SubscriptionQuotaAllocationsInner innerObject, com.azure.resourcemanager.quota.QuotaManager 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 SubscriptionQuotaDetails properties() { + return this.innerModel().properties(); + } + + public SubscriptionQuotaAllocationsInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.quota.QuotaManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/SubscriptionRequestsClientImpl.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/SubscriptionRequestsClientImpl.java new file mode 100644 index 000000000000..201a61e82b67 --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/SubscriptionRequestsClientImpl.java @@ -0,0 +1,489 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.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.quota.fluent.SubscriptionRequestsClient; +import com.azure.resourcemanager.quota.fluent.models.GroupQuotaSubscriptionIdInner; +import com.azure.resourcemanager.quota.models.GroupQuotaSubscriptionIdList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in SubscriptionRequestsClient. */ +public final class SubscriptionRequestsClientImpl implements SubscriptionRequestsClient { + /** The proxy service used to perform REST calls. */ + private final SubscriptionRequestsService service; + + /** The service client containing this operation class. */ + private final AzureQuotaExtensionApiImpl client; + + /** + * Initializes an instance of SubscriptionRequestsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SubscriptionRequestsClientImpl(AzureQuotaExtensionApiImpl client) { + this.service = + RestProxy + .create(SubscriptionRequestsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureQuotaExtensionApiSubscriptionRequests to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureQuotaExtensionA") + public interface SubscriptionRequestsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Management/managementGroups/{mgId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/subscriptionRequests") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("mgId") String mgId, + @PathParam("groupQuotaName") String groupQuotaName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Management/managementGroups/{mgId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/subscriptionRequests/{requestId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("mgId") String mgId, + @PathParam("groupQuotaName") String groupQuotaName, + @PathParam("requestId") String requestId, + @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); + } + + /** + * List the status of all requests to add subscriptionIds to the GroupQuotasEntity. + * + *

List API to check the status of a subscriptionId requests by requestId. Request history is maintained for 1 + * year. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of GroupQuotaSubscriptionIds along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String mgId, String groupQuotaName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (mgId == null) { + return Mono.error(new IllegalArgumentException("Parameter mgId is required and cannot be null.")); + } + if (groupQuotaName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupQuotaName is required and cannot be null.")); + } + final String apiVersion = "2023-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), mgId, groupQuotaName, 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())); + } + + /** + * List the status of all requests to add subscriptionIds to the GroupQuotasEntity. + * + *

List API to check the status of a subscriptionId requests by requestId. Request history is maintained for 1 + * year. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @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 list of GroupQuotaSubscriptionIds along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String mgId, String groupQuotaName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (mgId == null) { + return Mono.error(new IllegalArgumentException("Parameter mgId is required and cannot be null.")); + } + if (groupQuotaName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupQuotaName is required and cannot be null.")); + } + final String apiVersion = "2023-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), mgId, groupQuotaName, apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List the status of all requests to add subscriptionIds to the GroupQuotasEntity. + * + *

List API to check the status of a subscriptionId requests by requestId. Request history is maintained for 1 + * year. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of GroupQuotaSubscriptionIds as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String mgId, String groupQuotaName) { + return new PagedFlux<>( + () -> listSinglePageAsync(mgId, groupQuotaName), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List the status of all requests to add subscriptionIds to the GroupQuotasEntity. + * + *

List API to check the status of a subscriptionId requests by requestId. Request history is maintained for 1 + * year. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @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 list of GroupQuotaSubscriptionIds as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String mgId, String groupQuotaName, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(mgId, groupQuotaName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List the status of all requests to add subscriptionIds to the GroupQuotasEntity. + * + *

List API to check the status of a subscriptionId requests by requestId. Request history is maintained for 1 + * year. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of GroupQuotaSubscriptionIds as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String mgId, String groupQuotaName) { + return new PagedIterable<>(listAsync(mgId, groupQuotaName)); + } + + /** + * List the status of all requests to add subscriptionIds to the GroupQuotasEntity. + * + *

List API to check the status of a subscriptionId requests by requestId. Request history is maintained for 1 + * year. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @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 list of GroupQuotaSubscriptionIds as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String mgId, String groupQuotaName, Context context) { + return new PagedIterable<>(listAsync(mgId, groupQuotaName, context)); + } + + /** + * Get the status of a single subscriptionId request by requestId. + * + *

Get API to check the status of a subscriptionIds request by requestId. Use the polling API - OperationsStatus + * URI specified in Azure-AsyncOperation header field, with retry-after duration in seconds to check the + * intermediate status. This API provides the finals status with the request details and status. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param requestId Request 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 aPI to check the status of a subscriptionIds request by requestId along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String mgId, String groupQuotaName, String requestId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (mgId == null) { + return Mono.error(new IllegalArgumentException("Parameter mgId is required and cannot be null.")); + } + if (groupQuotaName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupQuotaName is required and cannot be null.")); + } + if (requestId == null) { + return Mono.error(new IllegalArgumentException("Parameter requestId is required and cannot be null.")); + } + final String apiVersion = "2023-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get(this.client.getEndpoint(), mgId, groupQuotaName, requestId, apiVersion, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the status of a single subscriptionId request by requestId. + * + *

Get API to check the status of a subscriptionIds request by requestId. Use the polling API - OperationsStatus + * URI specified in Azure-AsyncOperation header field, with retry-after duration in seconds to check the + * intermediate status. This API provides the finals status with the request details and status. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param requestId Request 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 aPI to check the status of a subscriptionIds request by requestId along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String mgId, String groupQuotaName, String requestId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (mgId == null) { + return Mono.error(new IllegalArgumentException("Parameter mgId is required and cannot be null.")); + } + if (groupQuotaName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupQuotaName is required and cannot be null.")); + } + if (requestId == null) { + return Mono.error(new IllegalArgumentException("Parameter requestId is required and cannot be null.")); + } + final String apiVersion = "2023-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), mgId, groupQuotaName, requestId, apiVersion, accept, context); + } + + /** + * Get the status of a single subscriptionId request by requestId. + * + *

Get API to check the status of a subscriptionIds request by requestId. Use the polling API - OperationsStatus + * URI specified in Azure-AsyncOperation header field, with retry-after duration in seconds to check the + * intermediate status. This API provides the finals status with the request details and status. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param requestId Request 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 aPI to check the status of a subscriptionIds request by requestId on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String mgId, String groupQuotaName, String requestId) { + return getWithResponseAsync(mgId, groupQuotaName, requestId).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get the status of a single subscriptionId request by requestId. + * + *

Get API to check the status of a subscriptionIds request by requestId. Use the polling API - OperationsStatus + * URI specified in Azure-AsyncOperation header field, with retry-after duration in seconds to check the + * intermediate status. This API provides the finals status with the request details and status. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param requestId Request 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 aPI to check the status of a subscriptionIds request by requestId along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String mgId, String groupQuotaName, String requestId, Context context) { + return getWithResponseAsync(mgId, groupQuotaName, requestId, context).block(); + } + + /** + * Get the status of a single subscriptionId request by requestId. + * + *

Get API to check the status of a subscriptionIds request by requestId. Use the polling API - OperationsStatus + * URI specified in Azure-AsyncOperation header field, with retry-after duration in seconds to check the + * intermediate status. This API provides the finals status with the request details and status. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param requestId Request 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 aPI to check the status of a subscriptionIds request by requestId. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GroupQuotaSubscriptionIdInner get(String mgId, String groupQuotaName, String requestId) { + return getWithResponse(mgId, groupQuotaName, requestId, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

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

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of GroupQuotaSubscriptionIds 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/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/SubscriptionRequestsImpl.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/SubscriptionRequestsImpl.java new file mode 100644 index 000000000000..89f0ab4e8b51 --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/SubscriptionRequestsImpl.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.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.quota.fluent.SubscriptionRequestsClient; +import com.azure.resourcemanager.quota.fluent.models.GroupQuotaSubscriptionIdInner; +import com.azure.resourcemanager.quota.models.GroupQuotaSubscriptionId; +import com.azure.resourcemanager.quota.models.SubscriptionRequests; + +public final class SubscriptionRequestsImpl implements SubscriptionRequests { + private static final ClientLogger LOGGER = new ClientLogger(SubscriptionRequestsImpl.class); + + private final SubscriptionRequestsClient innerClient; + + private final com.azure.resourcemanager.quota.QuotaManager serviceManager; + + public SubscriptionRequestsImpl( + SubscriptionRequestsClient innerClient, com.azure.resourcemanager.quota.QuotaManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String mgId, String groupQuotaName) { + PagedIterable inner = this.serviceClient().list(mgId, groupQuotaName); + return Utils.mapPage(inner, inner1 -> new GroupQuotaSubscriptionIdImpl(inner1, this.manager())); + } + + public PagedIterable list(String mgId, String groupQuotaName, Context context) { + PagedIterable inner = this.serviceClient().list(mgId, groupQuotaName, context); + return Utils.mapPage(inner, inner1 -> new GroupQuotaSubscriptionIdImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String mgId, String groupQuotaName, String requestId, Context context) { + Response inner = + this.serviceClient().getWithResponse(mgId, groupQuotaName, requestId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new GroupQuotaSubscriptionIdImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public GroupQuotaSubscriptionId get(String mgId, String groupQuotaName, String requestId) { + GroupQuotaSubscriptionIdInner inner = this.serviceClient().get(mgId, groupQuotaName, requestId); + if (inner != null) { + return new GroupQuotaSubscriptionIdImpl(inner, this.manager()); + } else { + return null; + } + } + + private SubscriptionRequestsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.quota.QuotaManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/UsagesClientImpl.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/UsagesClientImpl.java index fba4b3393d72..2ac78e51526e 100644 --- a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/UsagesClientImpl.java +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/UsagesClientImpl.java @@ -118,18 +118,11 @@ private Mono getWithResponseAsync(String resourceName, String if (scope == null) { return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); } + final String apiVersion = "2023-02-01"; final String accept = "application/json"; return FluxUtil .withContext( - context -> - service - .get( - this.client.getEndpoint(), - resourceName, - this.client.getApiVersion(), - scope, - accept, - context)) + context -> service.get(this.client.getEndpoint(), resourceName, apiVersion, scope, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } @@ -162,10 +155,10 @@ private Mono getWithResponseAsync(String resourceName, String if (scope == null) { return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); } + final String apiVersion = "2023-02-01"; final String accept = "application/json"; context = this.client.mergeContext(context); - return service - .get(this.client.getEndpoint(), resourceName, this.client.getApiVersion(), scope, accept, context); + return service.get(this.client.getEndpoint(), resourceName, apiVersion, scope, accept, context); } /** @@ -250,10 +243,10 @@ private Mono> listSinglePageAsync(String s if (scope == null) { return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); } + final String apiVersion = "2023-02-01"; final String accept = "application/json"; return FluxUtil - .withContext( - context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), scope, accept, context)) + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, scope, accept, context)) .>map( res -> new PagedResponseBase<>( @@ -291,10 +284,11 @@ private Mono> listSinglePageAsync(String s if (scope == null) { return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); } + final String apiVersion = "2023-02-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service - .list(this.client.getEndpoint(), this.client.getApiVersion(), scope, accept, context) + .list(this.client.getEndpoint(), apiVersion, scope, accept, context) .map( res -> new PagedResponseBase<>( diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/package-info.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/package-info.java index 84f250ba9a92..eef028eed85f 100644 --- a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/package-info.java +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/implementation/package-info.java @@ -2,5 +2,8 @@ // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. -/** Package containing the implementations for AzureQuotaExtensionApi. Microsoft Azure Quota Resource Provider. */ +/** + * Package containing the implementations for AzureQuotaExtensionApi. Microsoft Azure Quota Resource Provider. This + * Swagger is for Azure MG Group Quota using GroupQuota Entity. + */ package com.azure.resourcemanager.quota.implementation; diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/AdditionalAttributes.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/AdditionalAttributes.java new file mode 100644 index 000000000000..a3db9eca47c8 --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/AdditionalAttributes.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.quota.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Additional attribute to allow subscriptions to be part of the GroupQuota. */ +@Fluent +public final class AdditionalAttributes { + /* + * The grouping Id for the group quota. It can be management Group Id or ServiceTreeId if applicable. + */ + @JsonProperty(value = "groupId", required = true) + private GroupingId groupId; + + /* + * Environment name. + */ + @JsonProperty(value = "environment") + private EnvironmentType environment; + + /** Creates an instance of AdditionalAttributes class. */ + public AdditionalAttributes() { + } + + /** + * Get the groupId property: The grouping Id for the group quota. It can be management Group Id or ServiceTreeId if + * applicable. + * + * @return the groupId value. + */ + public GroupingId groupId() { + return this.groupId; + } + + /** + * Set the groupId property: The grouping Id for the group quota. It can be management Group Id or ServiceTreeId if + * applicable. + * + * @param groupId the groupId value to set. + * @return the AdditionalAttributes object itself. + */ + public AdditionalAttributes withGroupId(GroupingId groupId) { + this.groupId = groupId; + return this; + } + + /** + * Get the environment property: Environment name. + * + * @return the environment value. + */ + public EnvironmentType environment() { + return this.environment; + } + + /** + * Set the environment property: Environment name. + * + * @param environment the environment value to set. + * @return the AdditionalAttributes object itself. + */ + public AdditionalAttributes withEnvironment(EnvironmentType environment) { + this.environment = environment; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (groupId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property groupId in model AdditionalAttributes")); + } else { + groupId().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AdditionalAttributes.class); +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/AssignedToSubscription.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/AssignedToSubscription.java new file mode 100644 index 000000000000..13335a6d68a5 --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/AssignedToSubscription.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** SubscriptionIds and quota allocated to subscriptions from the GroupQuota. */ +@Fluent +public final class AssignedToSubscription { + /* + * An Azure subscriptionId. + */ + @JsonProperty(value = "subscriptionId") + private String subscriptionId; + + /* + * The amount of quota allocated to this subscriptionId from the GroupQuotasEntity. + */ + @JsonProperty(value = "quotaAllocated") + private Long quotaAllocated; + + /** Creates an instance of AssignedToSubscription class. */ + public AssignedToSubscription() { + } + + /** + * Get the subscriptionId property: An Azure subscriptionId. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Set the subscriptionId property: An Azure subscriptionId. + * + * @param subscriptionId the subscriptionId value to set. + * @return the AssignedToSubscription object itself. + */ + public AssignedToSubscription withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** + * Get the quotaAllocated property: The amount of quota allocated to this subscriptionId from the GroupQuotasEntity. + * + * @return the quotaAllocated value. + */ + public Long quotaAllocated() { + return this.quotaAllocated; + } + + /** + * Set the quotaAllocated property: The amount of quota allocated to this subscriptionId from the GroupQuotasEntity. + * + * @param quotaAllocated the quotaAllocated value to set. + * @return the AssignedToSubscription object itself. + */ + public AssignedToSubscription withQuotaAllocated(Long quotaAllocated) { + this.quotaAllocated = quotaAllocated; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/CurrentQuotaLimitBase.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/CurrentQuotaLimitBase.java index e17b2c44c128..a81af2d8e58c 100644 --- a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/CurrentQuotaLimitBase.java +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/CurrentQuotaLimitBase.java @@ -48,11 +48,13 @@ public interface CurrentQuotaLimitBase { /** The entirety of the CurrentQuotaLimitBase definition. */ interface Definition extends DefinitionStages.Blank, DefinitionStages.WithScope, DefinitionStages.WithCreate { } + /** The CurrentQuotaLimitBase definition stages. */ interface DefinitionStages { /** The first stage of the CurrentQuotaLimitBase definition. */ interface Blank extends WithScope { } + /** The stage of the CurrentQuotaLimitBase definition allowing to specify parent resource. */ interface WithScope { /** @@ -67,6 +69,7 @@ interface WithScope { */ WithCreate withExistingScope(String scope); } + /** * The stage of the CurrentQuotaLimitBase definition which contains all the minimum required properties for the * resource to be created, but also allows for any other optional properties to be specified. @@ -87,6 +90,7 @@ interface WithCreate extends DefinitionStages.WithProperties { */ CurrentQuotaLimitBase create(Context context); } + /** The stage of the CurrentQuotaLimitBase definition allowing to specify properties. */ interface WithProperties { /** @@ -99,6 +103,7 @@ interface WithProperties { WithCreate withProperties(QuotaProperties properties); } } + /** * Begins update for the CurrentQuotaLimitBase resource. * @@ -123,6 +128,7 @@ interface Update extends UpdateStages.WithProperties { */ CurrentQuotaLimitBase apply(Context context); } + /** The CurrentQuotaLimitBase update stages. */ interface UpdateStages { /** The stage of the CurrentQuotaLimitBase update allowing to specify properties. */ @@ -137,6 +143,7 @@ interface WithProperties { Update withProperties(QuotaProperties properties); } } + /** * Refreshes the resource to sync with Azure. * diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/EnvironmentType.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/EnvironmentType.java new file mode 100644 index 000000000000..dea6afc776e6 --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/EnvironmentType.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.quota.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Environment name. */ +public final class EnvironmentType extends ExpandableStringEnum { + /** Static value NonProduction for EnvironmentType. */ + public static final EnvironmentType NON_PRODUCTION = fromString("NonProduction"); + + /** Static value Production for EnvironmentType. */ + public static final EnvironmentType PRODUCTION = fromString("Production"); + + /** + * Creates a new instance of EnvironmentType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public EnvironmentType() { + } + + /** + * Creates or finds a EnvironmentType from its string representation. + * + * @param name a name to look for. + * @return the corresponding EnvironmentType. + */ + @JsonCreator + public static EnvironmentType fromString(String name) { + return fromString(name, EnvironmentType.class); + } + + /** + * Gets known EnvironmentType values. + * + * @return known EnvironmentType values. + */ + public static Collection values() { + return values(EnvironmentType.class); + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/GroupQuotaDetails.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/GroupQuotaDetails.java new file mode 100644 index 000000000000..4daeef976d7c --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/GroupQuotaDetails.java @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Group Quota details. */ +@Fluent +public final class GroupQuotaDetails { + /* + * The current Group Quota Limit at the parentId level. + */ + @JsonProperty(value = "limit") + private Long limit; + + /* + * Any comment related to quota request. + */ + @JsonProperty(value = "comment") + private String comment; + + /* + * Name of the resource provided by the resource Provider. This property is already included in the request URI, so + * it is a readonly property returned in the response. + */ + @JsonProperty(value = "name") + private GroupQuotaDetailsName name; + + /* + * The usages units, such as Count and Bytes. When requesting quota, use the **unit** value returned in the GET + * response in the request body of your PUT operation. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private String unit; + + /* + * The available Group Quota Limit at the MG level. This Group quota can be assigned to subscription(s). + */ + @JsonProperty(value = "availableLimit", access = JsonProperty.Access.WRITE_ONLY) + private Long availableLimit; + + /* + * Assigned Group Quota to subscriptions. + */ + @JsonProperty(value = "assignedToSubscriptions", access = JsonProperty.Access.WRITE_ONLY) + private List assignedToSubscriptions; + + /* + * Request status. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private RequestState provisioningState; + + /** Creates an instance of GroupQuotaDetails class. */ + public GroupQuotaDetails() { + } + + /** + * Get the limit property: The current Group Quota Limit at the parentId level. + * + * @return the limit value. + */ + public Long limit() { + return this.limit; + } + + /** + * Set the limit property: The current Group Quota Limit at the parentId level. + * + * @param limit the limit value to set. + * @return the GroupQuotaDetails object itself. + */ + public GroupQuotaDetails withLimit(Long limit) { + this.limit = limit; + return this; + } + + /** + * Get the comment property: Any comment related to quota request. + * + * @return the comment value. + */ + public String comment() { + return this.comment; + } + + /** + * Set the comment property: Any comment related to quota request. + * + * @param comment the comment value to set. + * @return the GroupQuotaDetails object itself. + */ + public GroupQuotaDetails withComment(String comment) { + this.comment = comment; + return this; + } + + /** + * Get the name property: Name of the resource provided by the resource Provider. This property is already included + * in the request URI, so it is a readonly property returned in the response. + * + * @return the name value. + */ + public GroupQuotaDetailsName name() { + return this.name; + } + + /** + * Set the name property: Name of the resource provided by the resource Provider. This property is already included + * in the request URI, so it is a readonly property returned in the response. + * + * @param name the name value to set. + * @return the GroupQuotaDetails object itself. + */ + public GroupQuotaDetails withName(GroupQuotaDetailsName name) { + this.name = name; + return this; + } + + /** + * Get the unit property: The usages units, such as Count and Bytes. When requesting quota, use the **unit** value + * returned in the GET response in the request body of your PUT operation. + * + * @return the unit value. + */ + public String unit() { + return this.unit; + } + + /** + * Get the availableLimit property: The available Group Quota Limit at the MG level. This Group quota can be + * assigned to subscription(s). + * + * @return the availableLimit value. + */ + public Long availableLimit() { + return this.availableLimit; + } + + /** + * Get the assignedToSubscriptions property: Assigned Group Quota to subscriptions. + * + * @return the assignedToSubscriptions value. + */ + public List assignedToSubscriptions() { + return this.assignedToSubscriptions; + } + + /** + * Get the provisioningState property: Request status. + * + * @return the provisioningState value. + */ + public RequestState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() != null) { + name().validate(); + } + if (assignedToSubscriptions() != null) { + assignedToSubscriptions().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/GroupQuotaDetailsName.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/GroupQuotaDetailsName.java new file mode 100644 index 000000000000..61a4bb026649 --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/GroupQuotaDetailsName.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Name of the resource provided by the resource Provider. This property is already included in the request URI, so it + * is a readonly property returned in the response. + */ +@Immutable +public final class GroupQuotaDetailsName { + /* + * Resource name. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private String value; + + /* + * Resource display name. + */ + @JsonProperty(value = "localizedValue", access = JsonProperty.Access.WRITE_ONLY) + private String localizedValue; + + /** Creates an instance of GroupQuotaDetailsName class. */ + public GroupQuotaDetailsName() { + } + + /** + * Get the value property: Resource name. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Get the localizedValue property: Resource display name. + * + * @return the localizedValue value. + */ + public String localizedValue() { + return this.localizedValue; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/GroupQuotaLimit.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/GroupQuotaLimit.java new file mode 100644 index 000000000000..133a77103a53 --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/GroupQuotaLimit.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.models; + +import com.azure.resourcemanager.quota.fluent.models.GroupQuotaLimitInner; + +/** An immutable client-side representation of GroupQuotaLimit. */ +public interface GroupQuotaLimit { + /** + * 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: Group Quota properties for the specified resource. + * + * @return the properties value. + */ + GroupQuotaDetails properties(); + + /** + * Gets the inner com.azure.resourcemanager.quota.fluent.models.GroupQuotaLimitInner object. + * + * @return the inner object. + */ + GroupQuotaLimitInner innerModel(); +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/GroupQuotaLimitList.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/GroupQuotaLimitList.java new file mode 100644 index 000000000000..d27d1364b391 --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/GroupQuotaLimitList.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.quota.fluent.models.GroupQuotaLimitInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of Group Quota Limit details. */ +@Fluent +public final class GroupQuotaLimitList { + /* + * List of Group Quota Limit details. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URL to use for getting the next set of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of GroupQuotaLimitList class. */ + public GroupQuotaLimitList() { + } + + /** + * Get the value property: List of Group Quota Limit details. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of Group Quota Limit details. + * + * @param value the value value to set. + * @return the GroupQuotaLimitList object itself. + */ + public GroupQuotaLimitList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URL to use for getting the next set of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/GroupQuotaLimits.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/GroupQuotaLimits.java new file mode 100644 index 000000000000..54f7cfee5dd5 --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/GroupQuotaLimits.java @@ -0,0 +1,226 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.quota.fluent.models.GroupQuotaLimitInner; + +/** Resource collection API of GroupQuotaLimits. */ +public interface GroupQuotaLimits { + /** + * Updates the GroupQuotaLimits for the specific resource under a Management Group. + * + *

Updates the GroupQuotaLimits for the specific resource under a Management Group. A groupQuotaLimitRequestId + * will be returned by the Service. The status can be polled periodically. The status Async polling is using + * standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to + * Get URI and full details can be checked. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource 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 group Quota limit. + */ + GroupQuotaLimit createOrUpdate( + String mgId, String resourceProviderScope, String groupQuotaName, String resourceName); + + /** + * Updates the GroupQuotaLimits for the specific resource under a Management Group. + * + *

Updates the GroupQuotaLimits for the specific resource under a Management Group. A groupQuotaLimitRequestId + * will be returned by the Service. The status can be polled periodically. The status Async polling is using + * standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to + * Get URI and full details can be checked. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource name. + * @param groupQuotaLimitRequest The GroupQuotaLimit Request. + * @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 group Quota limit. + */ + GroupQuotaLimit createOrUpdate( + String mgId, + String resourceProviderScope, + String groupQuotaName, + String resourceName, + GroupQuotaLimitInner groupQuotaLimitRequest, + Context context); + + /** + * Updates the GroupQuotaLimits for the specific resource under a Management Group. + * + *

Updates the GroupQuotaLimits for the specific resource under a Management Group. A groupQuotaLimitRequestId + * will be returned by the Service. The status will be updated periodically. The status Async polling is using + * standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed,then the URI will change to + * Get URI and full details can be checked. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource 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 group Quota limit. + */ + GroupQuotaLimit update(String mgId, String resourceProviderScope, String groupQuotaName, String resourceName); + + /** + * Updates the GroupQuotaLimits for the specific resource under a Management Group. + * + *

Updates the GroupQuotaLimits for the specific resource under a Management Group. A groupQuotaLimitRequestId + * will be returned by the Service. The status will be updated periodically. The status Async polling is using + * standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed,then the URI will change to + * Get URI and full details can be checked. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource name. + * @param groupQuotaLimitRequest The GroupQuotaLimit Request. + * @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 group Quota limit. + */ + GroupQuotaLimit update( + String mgId, + String resourceProviderScope, + String groupQuotaName, + String resourceName, + GroupQuotaLimitInner groupQuotaLimitRequest, + Context context); + + /** + * Gets the resource groupQuotaLimits for the MGId. + * + *

Gets the resource groupQuotaLimits for the MGId. It will include the limits, availableLimits, + * assignedToSubscriptions: Quotas assigned to subscriptions from the groupQuota. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource 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 resource groupQuotaLimits for the MGId along with {@link Response}. + */ + Response getWithResponse( + String mgId, String resourceProviderScope, String groupQuotaName, String resourceName, Context context); + + /** + * Gets the resource groupQuotaLimits for the MGId. + * + *

Gets the resource groupQuotaLimits for the MGId. It will include the limits, availableLimits, + * assignedToSubscriptions: Quotas assigned to subscriptions from the groupQuota. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource 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 resource groupQuotaLimits for the MGId. + */ + GroupQuotaLimit get(String mgId, String resourceProviderScope, String groupQuotaName, String resourceName); + + /** + * Gets the List of resources groupQuotaLimits for the MGId, based on the scope. + * + *

Gets the List of resources groupQuotaLimits for the MGId, based on the scope. The scope can be - + * providers/Microsoft.Compute/locations/<eastus>. The list elements will be same as the Get API - It will + * include the limits, availableLimits, assignedToSubscriptions: Quotas assigned to subscriptions from the + * groupQuota. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of resources groupQuotaLimits for the MGId, based on the scope as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list(String mgId, String resourceProviderScope, String groupQuotaName); + + /** + * Gets the List of resources groupQuotaLimits for the MGId, based on the scope. + * + *

Gets the List of resources groupQuotaLimits for the MGId, based on the scope. The scope can be - + * providers/Microsoft.Compute/locations/<eastus>. The list elements will be same as the Get API - It will + * include the limits, availableLimits, assignedToSubscriptions: Quotas assigned to subscriptions from the + * groupQuota. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @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 List of resources groupQuotaLimits for the MGId, based on the scope as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list( + String mgId, String resourceProviderScope, String groupQuotaName, Context context); +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/GroupQuotaLimitsRequests.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/GroupQuotaLimitsRequests.java new file mode 100644 index 000000000000..7c35fa5792fe --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/GroupQuotaLimitsRequests.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.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 GroupQuotaLimitsRequests. */ +public interface GroupQuotaLimitsRequests { + /** + * List the status of all GroupQuota requests. + * + *

List API to check the status of a GroupQuota requests by requestId. The groupQuotaRequest history is + * maintained for 1 year. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return share Quota Entity list as paginated response with {@link PagedIterable}. + */ + PagedIterable list( + String mgId, String resourceProviderScope, String groupQuotaName); + + /** + * List the status of all GroupQuota requests. + * + *

List API to check the status of a GroupQuota requests by requestId. The groupQuotaRequest history is + * maintained for 1 year. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @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 share Quota Entity list as paginated response with {@link PagedIterable}. + */ + PagedIterable list( + String mgId, String resourceProviderScope, String groupQuotaName, Context context); + + /** + * Get the status of a single GroupQuota request by requestId. + * + *

Get API to check the status of a GroupQuota request by requestId. Use the polling API - OperationsStatus URI + * specified in Azure-AsyncOperation header field, with retry-after duration in seconds to check the intermediate + * status. This API provides the finals status with the request details and status. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param requestId Request 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 aPI to check the status of a GroupQuota request by requestId along with {@link Response}. + */ + Response getWithResponse( + String mgId, String resourceProviderScope, String groupQuotaName, String requestId, Context context); + + /** + * Get the status of a single GroupQuota request by requestId. + * + *

Get API to check the status of a GroupQuota request by requestId. Use the polling API - OperationsStatus URI + * specified in Azure-AsyncOperation header field, with retry-after duration in seconds to check the intermediate + * status. This API provides the finals status with the request details and status. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param requestId Request 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 aPI to check the status of a GroupQuota request by requestId. + */ + SubmittedResourceRequestStatus get( + String mgId, String resourceProviderScope, String groupQuotaName, String requestId); +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/GroupQuotaList.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/GroupQuotaList.java new file mode 100644 index 000000000000..471f4b2b058f --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/GroupQuotaList.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.quota.fluent.models.GroupQuotasEntityInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of Group Quotas at MG level. */ +@Fluent +public final class GroupQuotaList { + /* + * List of Group Quotas at MG level. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URL to use for getting the next set of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of GroupQuotaList class. */ + public GroupQuotaList() { + } + + /** + * Get the value property: List of Group Quotas at MG level. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of Group Quotas at MG level. + * + * @param value the value value to set. + * @return the GroupQuotaList object itself. + */ + public GroupQuotaList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URL to use for getting the next set of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/GroupQuotaSubscriptionId.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/GroupQuotaSubscriptionId.java new file mode 100644 index 000000000000..b4000c2c366d --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/GroupQuotaSubscriptionId.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.models; + +import com.azure.resourcemanager.quota.fluent.models.GroupQuotaSubscriptionIdInner; + +/** An immutable client-side representation of GroupQuotaSubscriptionId. */ +public interface GroupQuotaSubscriptionId { + /** + * 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: The properties property. + * + * @return the properties value. + */ + GroupQuotaSubscriptionIdProperties properties(); + + /** + * Gets the inner com.azure.resourcemanager.quota.fluent.models.GroupQuotaSubscriptionIdInner object. + * + * @return the inner object. + */ + GroupQuotaSubscriptionIdInner innerModel(); +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/GroupQuotaSubscriptionIdList.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/GroupQuotaSubscriptionIdList.java new file mode 100644 index 000000000000..146a0e1e26ae --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/GroupQuotaSubscriptionIdList.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.quota.fluent.models.GroupQuotaSubscriptionIdInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of GroupQuotaSubscriptionIds. */ +@Fluent +public final class GroupQuotaSubscriptionIdList { + /* + * List of GroupQuotaSubscriptionIds + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URL to use for getting the next set of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of GroupQuotaSubscriptionIdList class. */ + public GroupQuotaSubscriptionIdList() { + } + + /** + * Get the value property: List of GroupQuotaSubscriptionIds. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of GroupQuotaSubscriptionIds. + * + * @param value the value value to set. + * @return the GroupQuotaSubscriptionIdList object itself. + */ + public GroupQuotaSubscriptionIdList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URL to use for getting the next set of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/GroupQuotaSubscriptionIdProperties.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/GroupQuotaSubscriptionIdProperties.java new file mode 100644 index 000000000000..f363603a9c8c --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/GroupQuotaSubscriptionIdProperties.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The GroupQuotaSubscriptionIdProperties model. */ +@Immutable +public final class GroupQuotaSubscriptionIdProperties { + /* + * An Azure subscriptionId. + */ + @JsonProperty(value = "subscriptionId", access = JsonProperty.Access.WRITE_ONLY) + private String subscriptionId; + + /* + * Status of this subscriptionId being associated with the GroupQuotasEntity. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private RequestState provisioningState; + + /** Creates an instance of GroupQuotaSubscriptionIdProperties class. */ + public GroupQuotaSubscriptionIdProperties() { + } + + /** + * Get the subscriptionId property: An Azure subscriptionId. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Get the provisioningState property: Status of this subscriptionId being associated with the GroupQuotasEntity. + * + * @return the provisioningState value. + */ + public RequestState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/GroupQuotaSubscriptionQuotaAllocationRequests.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/GroupQuotaSubscriptionQuotaAllocationRequests.java new file mode 100644 index 000000000000..d62a0d33f82b --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/GroupQuotaSubscriptionQuotaAllocationRequests.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.quota.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 GroupQuotaSubscriptionQuotaAllocationRequests. */ +public interface GroupQuotaSubscriptionQuotaAllocationRequests { + /** + * Get the status of the quota allocation request for the subscriptionId. + * + *

Get the quota allocation request status for the subscriptionId by allocationId. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param allocationId Resource allocation 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 quota allocation request status for the subscriptionId by allocationId along with {@link Response}. + */ + Response getWithResponse( + String mgId, String resourceProviderScope, String groupQuotaName, String allocationId, Context context); + + /** + * Get the status of the quota allocation request for the subscriptionId. + * + *

Get the quota allocation request status for the subscriptionId by allocationId. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param allocationId Resource allocation 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 quota allocation request status for the subscriptionId by allocationId. + */ + SubscriptionQuotaAllocationRequest get( + String mgId, String resourceProviderScope, String groupQuotaName, String allocationId); + + /** + * Lists all the quota allocation requests.to subscriptions + * + *

Lists all the allocation requests. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated response with {@link PagedIterable}. + */ + PagedIterable list( + String mgId, String resourceProviderScope, String groupQuotaName); + + /** + * Lists all the quota allocation requests.to subscriptions + * + *

Lists all the allocation requests. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @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 paginated response with {@link PagedIterable}. + */ + PagedIterable list( + String mgId, String resourceProviderScope, String groupQuotaName, Context context); +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/GroupQuotaSubscriptionQuotaAllocations.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/GroupQuotaSubscriptionQuotaAllocations.java new file mode 100644 index 000000000000..64bc1fe95769 --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/GroupQuotaSubscriptionQuotaAllocations.java @@ -0,0 +1,235 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.quota.fluent.models.SubscriptionQuotaAllocationsInner; + +/** Resource collection API of GroupQuotaSubscriptionQuotaAllocations. */ +public interface GroupQuotaSubscriptionQuotaAllocations { + /** + * Gets all the quota assigned to a subscription for the specific Resource Provider, Location. + * + *

Gets all the quota assigned to a subscription for the specific Resource Provider, Location. This will include + * the GroupQuota and total quota assigned to the subscription. Only the Group quota assigned to the subscription + * can be assigned back to the MG Group Quota. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the quota assigned to a subscription for the specific Resource Provider, Location as paginated + * response with {@link PagedIterable}. + */ + PagedIterable list(String mgId, String resourceProviderScope, String groupQuotaName); + + /** + * Gets all the quota assigned to a subscription for the specific Resource Provider, Location. + * + *

Gets all the quota assigned to a subscription for the specific Resource Provider, Location. This will include + * the GroupQuota and total quota assigned to the subscription. Only the Group quota assigned to the subscription + * can be assigned back to the MG Group Quota. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the quota assigned to a subscription for the specific Resource Provider, Location as paginated + * response with {@link PagedIterable}. + */ + PagedIterable list( + String mgId, String resourceProviderScope, String groupQuotaName, Context context); + + /** + * Request to assign quota from group quota to a specific Subscription. This request will use Asynchronous pattern + * to check the status using Async polling as standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * + *

Request to assign a specific resource quota from group quota to a specific Subscription. The subscriptions can + * also reduce the quota assigned to subscription to give back the group back to MG. The quota assignment back to MG + * groupQuota is limited by the GroupQuota assigned to subscription, which means the maximum unused quota assigned + * back to MG groupQuota will be the groupQuota assigned to the subscriptions. So, this API can used to assign Quota + * to subscriptions and assign back unused quota, which was previously assigned from MG groupQuota to subscription. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource name. + * @param allocateQuotaRequest Quota requests payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return quota assigned to a subscription for the specific Resource Provider, Location, ResourceName. + */ + SubscriptionQuotaAllocations createOrUpdate( + String mgId, + String resourceProviderScope, + String groupQuotaName, + String resourceName, + SubscriptionQuotaAllocationsInner allocateQuotaRequest); + + /** + * Request to assign quota from group quota to a specific Subscription. This request will use Asynchronous pattern + * to check the status using Async polling as standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * + *

Request to assign a specific resource quota from group quota to a specific Subscription. The subscriptions can + * also reduce the quota assigned to subscription to give back the group back to MG. The quota assignment back to MG + * groupQuota is limited by the GroupQuota assigned to subscription, which means the maximum unused quota assigned + * back to MG groupQuota will be the groupQuota assigned to the subscriptions. So, this API can used to assign Quota + * to subscriptions and assign back unused quota, which was previously assigned from MG groupQuota to subscription. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource name. + * @param allocateQuotaRequest Quota requests payload. + * @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 quota assigned to a subscription for the specific Resource Provider, Location, ResourceName. + */ + SubscriptionQuotaAllocations createOrUpdate( + String mgId, + String resourceProviderScope, + String groupQuotaName, + String resourceName, + SubscriptionQuotaAllocationsInner allocateQuotaRequest, + Context context); + + /** + * Request to assign quota from group quota to a specific Subscription. This request will use Asynchronous pattern + * with 202 response and status polling API. + * + *

Request to assign quota from group quota to a specific Subscription. The subscriptions and reduce the quota + * assigned to subscription to give back the group back to MG. The quota assignment back to MG groupQuota is limited + * by the GroupQuota assigned to subscription, using this API. So, this API can used to assign Quota to + * subscriptions and assign back unused quota, which was previously assigned from MG groupQuota to subscription(s). + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource name. + * @param allocateQuotaRequest Quota requests payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return quota assigned to a subscription for the specific Resource Provider, Location, ResourceName. + */ + SubscriptionQuotaAllocations update( + String mgId, + String resourceProviderScope, + String groupQuotaName, + String resourceName, + SubscriptionQuotaAllocationsInner allocateQuotaRequest); + + /** + * Request to assign quota from group quota to a specific Subscription. This request will use Asynchronous pattern + * with 202 response and status polling API. + * + *

Request to assign quota from group quota to a specific Subscription. The subscriptions and reduce the quota + * assigned to subscription to give back the group back to MG. The quota assignment back to MG groupQuota is limited + * by the GroupQuota assigned to subscription, using this API. So, this API can used to assign Quota to + * subscriptions and assign back unused quota, which was previously assigned from MG groupQuota to subscription(s). + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource name. + * @param allocateQuotaRequest Quota requests payload. + * @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 quota assigned to a subscription for the specific Resource Provider, Location, ResourceName. + */ + SubscriptionQuotaAllocations update( + String mgId, + String resourceProviderScope, + String groupQuotaName, + String resourceName, + SubscriptionQuotaAllocationsInner allocateQuotaRequest, + Context context); + + /** + * Gets Quota assigned to a subscription for the specific Resource Provider, Location, ResourceName. + * + *

Gets Quota assigned to a subscription for the specific Resource Provider, Location, ResourceName. This will + * include the GroupQuota and total quota assigned to the subscription. Only the Group quota assigned to the + * subscription can be assigned back to the MG Group Quota. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource 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 quota assigned to a subscription for the specific Resource Provider, Location, ResourceName along with + * {@link Response}. + */ + Response getWithResponse( + String mgId, String resourceProviderScope, String groupQuotaName, String resourceName, Context context); + + /** + * Gets Quota assigned to a subscription for the specific Resource Provider, Location, ResourceName. + * + *

Gets Quota assigned to a subscription for the specific Resource Provider, Location, ResourceName. This will + * include the GroupQuota and total quota assigned to the subscription. Only the Group quota assigned to the + * subscription can be assigned back to the MG Group Quota. + * + * @param mgId Management Group Id. + * @param resourceProviderScope Scope for the resource. Some resources do not require location parameter, such as + * CosmosDb, so can be skipped in scope. For most of the resources require - + * providers/Microsoft.Compute/locations/{locationName}. Some Rps such as Batch requires batchAccountName - + * providers/Microsoft.Batch/locations/{locationName}/accountName/{batchAccountName}. This extension enables to + * specify resources for any all the RPs. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param resourceName Resource 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 quota assigned to a subscription for the specific Resource Provider, Location, ResourceName. + */ + SubscriptionQuotaAllocations get( + String mgId, String resourceProviderScope, String groupQuotaName, String resourceName); +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/GroupQuotaSubscriptions.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/GroupQuotaSubscriptions.java new file mode 100644 index 000000000000..9d20f51f1290 --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/GroupQuotaSubscriptions.java @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.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 GroupQuotaSubscriptions. */ +public interface GroupQuotaSubscriptions { + /** + * Adds subscription to the GroupQuotas. + * + *

Adds a subscription to GroupQuotas. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this represents a Azure subscriptionId that is associated with a GroupQuotaSEntity. + */ + GroupQuotaSubscriptionId createOrUpdate(String mgId, String groupQuotaName); + + /** + * Adds subscription to the GroupQuotas. + * + *

Adds a subscription to GroupQuotas. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @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 this represents a Azure subscriptionId that is associated with a GroupQuotaSEntity. + */ + GroupQuotaSubscriptionId createOrUpdate(String mgId, String groupQuotaName, Context context); + + /** + * Updates the GroupQuotas with the subscription to add to the subscriptions list. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this represents a Azure subscriptionId that is associated with a GroupQuotaSEntity. + */ + GroupQuotaSubscriptionId update(String mgId, String groupQuotaName); + + /** + * Updates the GroupQuotas with the subscription to add to the subscriptions list. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @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 this represents a Azure subscriptionId that is associated with a GroupQuotaSEntity. + */ + GroupQuotaSubscriptionId update(String mgId, String groupQuotaName, Context context); + + /** + * Removes the subscription from GroupQuotas. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByResourceGroupWithResponse(String mgId, String groupQuotaName, Context context); + + /** + * Removes the subscription from GroupQuotas. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String mgId, String groupQuotaName); + + /** + * Returns the subscriptionId along with its provisioning state for being associated with the GroupQuotasEntity. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @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 this represents a Azure subscriptionId that is associated with a GroupQuotaSEntity along with {@link + * Response}. + */ + Response getWithResponse(String mgId, String groupQuotaName, Context context); + + /** + * Returns the subscriptionId along with its provisioning state for being associated with the GroupQuotasEntity. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this represents a Azure subscriptionId that is associated with a GroupQuotaSEntity. + */ + GroupQuotaSubscriptionId get(String mgId, String groupQuotaName); + + /** + * Returns a list of the subscriptionIds associated with the GroupQuotasEntity. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of GroupQuotaSubscriptionIds as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String mgId, String groupQuotaName); + + /** + * Returns a list of the subscriptionIds associated with the GroupQuotasEntity. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @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 list of GroupQuotaSubscriptionIds as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String mgId, String groupQuotaName, Context context); +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/GroupQuotas.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/GroupQuotas.java new file mode 100644 index 000000000000..1a7f35a9f9d1 --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/GroupQuotas.java @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.quota.fluent.models.GroupQuotasEntityInner; + +/** Resource collection API of GroupQuotas. */ +public interface GroupQuotas { + /** + * Creates a new GroupQuota for the name passed. + * + *

Creates a new GroupQuota for the name passed. A RequestId will be returned by the Service. The status can be + * polled periodically. The status Async polling is using standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to + * Get URI and full details can be checked. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties and filters for ShareQuota. + */ + GroupQuotasEntity createOrUpdate(String mgId, String groupQuotaName); + + /** + * Creates a new GroupQuota for the name passed. + * + *

Creates a new GroupQuota for the name passed. A RequestId will be returned by the Service. The status can be + * polled periodically. The status Async polling is using standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to + * Get URI and full details can be checked. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param groupQuotaPutRequestBody The GroupQuota body details for creation or update of a GroupQuota entity. + * @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 properties and filters for ShareQuota. + */ + GroupQuotasEntity createOrUpdate( + String mgId, String groupQuotaName, GroupQuotasEntityInner groupQuotaPutRequestBody, Context context); + + /** + * Updates a new GroupQuotas for the name passed. + * + *

Updates the GroupQuotas for the name passed. A GroupQuotas RequestId will be returned by the Service. The + * status can be polled periodically. The status Async polling is using standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to + * Get URI and full details can be checked. Any change in the filters will be applicable to the future quota + * assignments, existing quota assigned to subscriptions from the GroupQuotas remains unchanged. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties and filters for ShareQuota. + */ + GroupQuotasEntity update(String mgId, String groupQuotaName); + + /** + * Updates a new GroupQuotas for the name passed. + * + *

Updates the GroupQuotas for the name passed. A GroupQuotas RequestId will be returned by the Service. The + * status can be polled periodically. The status Async polling is using standards defined at - + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#asynchronous-operations. + * Use the OperationsStatus URI provided in Azure-AsyncOperation header, the duration will be specified in + * retry-after header. Once the operation gets to terminal state - Succeeded | Failed, then the URI will change to + * Get URI and full details can be checked. Any change in the filters will be applicable to the future quota + * assignments, existing quota assigned to subscriptions from the GroupQuotas remains unchanged. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param groupQuotasPatchRequestBody The GroupQuotas Patch Request. + * @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 properties and filters for ShareQuota. + */ + GroupQuotasEntity update( + String mgId, String groupQuotaName, GroupQuotasEntityInner groupQuotasPatchRequestBody, Context context); + + /** + * Gets GroupQuotas for the name passed. + * + *

Gets the GroupQuotas for the name passed. It will return the GroupQuotas properties only. The details on + * groupQuota can be access from the groupQuota APIs. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @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 GroupQuotas for the name passed along with {@link Response}. + */ + Response getWithResponse(String mgId, String groupQuotaName, Context context); + + /** + * Gets GroupQuotas for the name passed. + * + *

Gets the GroupQuotas for the name passed. It will return the GroupQuotas properties only. The details on + * groupQuota can be access from the groupQuota APIs. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the GroupQuotas for the name passed. + */ + GroupQuotasEntity get(String mgId, String groupQuotaName); + + /** + * Deletes GroupQuotas for the name passed. + * + *

Deletes the GroupQuotas for the name passed. All the remaining shareQuota in the GroupQuotas will be lost. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByResourceGroupWithResponse(String mgId, String groupQuotaName, Context context); + + /** + * Deletes GroupQuotas for the name passed. + * + *

Deletes the GroupQuotas for the name passed. All the remaining shareQuota in the GroupQuotas will be lost. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String mgId, String groupQuotaName); + + /** + * Lists GroupQuotas for the scope passed. + * + *

Lists GroupQuotas for the scope passed. It will return the GroupQuotas QuotaEntity properties only.The details + * on groupQuota can be access from the groupQuota APIs. + * + * @param mgId Management Group Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Group Quotas at MG level as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String mgId); + + /** + * Lists GroupQuotas for the scope passed. + * + *

Lists GroupQuotas for the scope passed. It will return the GroupQuotas QuotaEntity properties only.The details + * on groupQuota can be access from the groupQuota APIs. + * + * @param mgId Management Group Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Group Quotas at MG level as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String mgId, Context context); +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/GroupQuotasEntity.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/GroupQuotasEntity.java new file mode 100644 index 000000000000..13f5da3754f5 --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/GroupQuotasEntity.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.quota.fluent.models.GroupQuotasEntityInner; + +/** An immutable client-side representation of GroupQuotasEntity. */ +public interface GroupQuotasEntity { + /** + * 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: Properties and filters for ShareQuota. The request parameter is optional, if there + * are no filters specified. + * + * @return the properties value. + */ + GroupQuotasEntityBase properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner com.azure.resourcemanager.quota.fluent.models.GroupQuotasEntityInner object. + * + * @return the inner object. + */ + GroupQuotasEntityInner innerModel(); +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/GroupQuotasEntityBase.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/GroupQuotasEntityBase.java new file mode 100644 index 000000000000..3322d5ac81fa --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/GroupQuotasEntityBase.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.quota.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties and filters for ShareQuota. The request parameter is optional, if there are no filters specified. */ +@Fluent +public final class GroupQuotasEntityBase { + /* + * Display name of the GroupQuota entity. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /* + * Additional attributes to allow subscription, which can be added to the subscriptionIds. + */ + @JsonProperty(value = "additionalAttributes") + private AdditionalAttributes additionalAttributes; + + /* + * Provisioning state of the operation. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private RequestState provisioningState; + + /** Creates an instance of GroupQuotasEntityBase class. */ + public GroupQuotasEntityBase() { + } + + /** + * Get the displayName property: Display name of the GroupQuota entity. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: Display name of the GroupQuota entity. + * + * @param displayName the displayName value to set. + * @return the GroupQuotasEntityBase object itself. + */ + public GroupQuotasEntityBase withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the additionalAttributes property: Additional attributes to allow subscription, which can be added to the + * subscriptionIds. + * + * @return the additionalAttributes value. + */ + public AdditionalAttributes additionalAttributes() { + return this.additionalAttributes; + } + + /** + * Set the additionalAttributes property: Additional attributes to allow subscription, which can be added to the + * subscriptionIds. + * + * @param additionalAttributes the additionalAttributes value to set. + * @return the GroupQuotasEntityBase object itself. + */ + public GroupQuotasEntityBase withAdditionalAttributes(AdditionalAttributes additionalAttributes) { + this.additionalAttributes = additionalAttributes; + return this; + } + + /** + * Get the provisioningState property: Provisioning state of the operation. + * + * @return the provisioningState value. + */ + public RequestState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (additionalAttributes() != null) { + additionalAttributes().validate(); + } + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/GroupingId.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/GroupingId.java new file mode 100644 index 000000000000..1342e949ae56 --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/GroupingId.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The grouping Id for the group quota. It can be management Group Id or ServiceTreeId if applicable. */ +@Fluent +public final class GroupingId { + /* + * GroupingId type. It is a required property. More types of groupIds can be supported in future. MGID is already + * in the URI, so it's not needed.' + */ + @JsonProperty(value = "groupingIdType") + private GroupingIdType groupingIdType; + + /* + * GroupId value based on the groupingType selected - management Group Id or ServiceTreeId. + */ + @JsonProperty(value = "value") + private String value; + + /** Creates an instance of GroupingId class. */ + public GroupingId() { + } + + /** + * Get the groupingIdType property: GroupingId type. It is a required property. More types of groupIds can be + * supported in future. MGID is already in the URI, so it's not needed.'. + * + * @return the groupingIdType value. + */ + public GroupingIdType groupingIdType() { + return this.groupingIdType; + } + + /** + * Set the groupingIdType property: GroupingId type. It is a required property. More types of groupIds can be + * supported in future. MGID is already in the URI, so it's not needed.'. + * + * @param groupingIdType the groupingIdType value to set. + * @return the GroupingId object itself. + */ + public GroupingId withGroupingIdType(GroupingIdType groupingIdType) { + this.groupingIdType = groupingIdType; + return this; + } + + /** + * Get the value property: GroupId value based on the groupingType selected - management Group Id or ServiceTreeId. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: GroupId value based on the groupingType selected - management Group Id or ServiceTreeId. + * + * @param value the value value to set. + * @return the GroupingId object itself. + */ + public GroupingId withValue(String value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/GroupingIdType.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/GroupingIdType.java new file mode 100644 index 000000000000..bb6965a4b472 --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/GroupingIdType.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.quota.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * GroupingId type. It is a required property. More types of groupIds can be supported in future. MGID is already in the + * URI, so it's not needed.'. + */ +public final class GroupingIdType extends ExpandableStringEnum { + /** Static value ServiceTreeId for GroupingIdType. */ + public static final GroupingIdType SERVICE_TREE_ID = fromString("ServiceTreeId"); + + /** Static value BillingId for GroupingIdType. */ + public static final GroupingIdType BILLING_ID = fromString("BillingId"); + + /** + * Creates a new instance of GroupingIdType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public GroupingIdType() { + } + + /** + * Creates or finds a GroupingIdType from its string representation. + * + * @param name a name to look for. + * @return the corresponding GroupingIdType. + */ + @JsonCreator + public static GroupingIdType fromString(String name) { + return fromString(name, GroupingIdType.class); + } + + /** + * Gets known GroupingIdType values. + * + * @return known GroupingIdType values. + */ + public static Collection values() { + return values(GroupingIdType.class); + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/RequestState.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/RequestState.java new file mode 100644 index 000000000000..ea5baf3b8fdb --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/RequestState.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Request status. */ +public final class RequestState extends ExpandableStringEnum { + /** Static value Accepted for RequestState. */ + public static final RequestState ACCEPTED = fromString("Accepted"); + + /** Static value Created for RequestState. */ + public static final RequestState CREATED = fromString("Created"); + + /** Static value Invalid for RequestState. */ + public static final RequestState INVALID = fromString("Invalid"); + + /** Static value Succeeded for RequestState. */ + public static final RequestState SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for RequestState. */ + public static final RequestState FAILED = fromString("Failed"); + + /** Static value InProgress for RequestState. */ + public static final RequestState IN_PROGRESS = fromString("InProgress"); + + /** Static value Canceled for RequestState. */ + public static final RequestState CANCELED = fromString("Canceled"); + + /** + * Creates a new instance of RequestState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public RequestState() { + } + + /** + * Creates or finds a RequestState from its string representation. + * + * @param name a name to look for. + * @return the corresponding RequestState. + */ + @JsonCreator + public static RequestState fromString(String name) { + return fromString(name, RequestState.class); + } + + /** + * Gets known RequestState values. + * + * @return known RequestState values. + */ + public static Collection values() { + return values(RequestState.class); + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/ResourceBaseRequest.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/ResourceBaseRequest.java new file mode 100644 index 000000000000..b187622c6aa2 --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/ResourceBaseRequest.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.quota.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Resource definition with the requested quota. */ +@Fluent +public final class ResourceBaseRequest { + /* + * The resource name, such as SKU name. + */ + @JsonProperty(value = "resourceName") + private String resourceName; + + /* + * Quota requested for the resource. + */ + @JsonProperty(value = "limits") + private Long limits; + + /* + * Representing the units of the usage quota. Possible values are: Count, Bytes, Seconds, Percent, CountPerSecond, + * BytesPerSecond. Based on - https://armwiki.azurewebsites.net/api_contracts/UsagesAPIContract.html?q=usages . + * Different RPs may have different units, Count, type as int64 should work for most of the integer values. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private String unit; + + /** Creates an instance of ResourceBaseRequest class. */ + public ResourceBaseRequest() { + } + + /** + * Get the resourceName property: The resource name, such as SKU name. + * + * @return the resourceName value. + */ + public String resourceName() { + return this.resourceName; + } + + /** + * Set the resourceName property: The resource name, such as SKU name. + * + * @param resourceName the resourceName value to set. + * @return the ResourceBaseRequest object itself. + */ + public ResourceBaseRequest withResourceName(String resourceName) { + this.resourceName = resourceName; + return this; + } + + /** + * Get the limits property: Quota requested for the resource. + * + * @return the limits value. + */ + public Long limits() { + return this.limits; + } + + /** + * Set the limits property: Quota requested for the resource. + * + * @param limits the limits value to set. + * @return the ResourceBaseRequest object itself. + */ + public ResourceBaseRequest withLimits(Long limits) { + this.limits = limits; + return this; + } + + /** + * Get the unit property: Representing the units of the usage quota. Possible values are: Count, Bytes, Seconds, + * Percent, CountPerSecond, BytesPerSecond. Based on - + * https://armwiki.azurewebsites.net/api_contracts/UsagesAPIContract.html?q=usages . Different RPs may have + * different units, Count, type as int64 should work for most of the integer values. + * + * @return the unit value. + */ + public String unit() { + return this.unit; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/SubmittedResourceRequestStatus.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/SubmittedResourceRequestStatus.java new file mode 100644 index 000000000000..8274d73e01a1 --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/SubmittedResourceRequestStatus.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.models; + +import com.azure.resourcemanager.quota.fluent.models.SubmittedResourceRequestStatusInner; + +/** An immutable client-side representation of SubmittedResourceRequestStatus. */ +public interface SubmittedResourceRequestStatus { + /** + * Gets the requestedResource property: Requested Resource. + * + * @return the requestedResource value. + */ + ResourceBaseRequest requestedResource(); + + /** + * Gets the status property: Request status. + * + * @return the status value. + */ + RequestState status(); + + /** + * Gets the inner com.azure.resourcemanager.quota.fluent.models.SubmittedResourceRequestStatusInner object. + * + * @return the inner object. + */ + SubmittedResourceRequestStatusInner innerModel(); +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/SubmittedResourceRequestStatusList.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/SubmittedResourceRequestStatusList.java new file mode 100644 index 000000000000..4cc923231dd2 --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/SubmittedResourceRequestStatusList.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.quota.fluent.models.SubmittedResourceRequestStatusInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Share Quota Entity list. */ +@Fluent +public final class SubmittedResourceRequestStatusList { + /* + * Subscription groupQuotaRequests list. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URL to use for getting the next set of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of SubmittedResourceRequestStatusList class. */ + public SubmittedResourceRequestStatusList() { + } + + /** + * Get the value property: Subscription groupQuotaRequests list. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Subscription groupQuotaRequests list. + * + * @param value the value value to set. + * @return the SubmittedResourceRequestStatusList object itself. + */ + public SubmittedResourceRequestStatusList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URL to use for getting the next set of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/SubscriptionGroupQuotaAssignment.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/SubscriptionGroupQuotaAssignment.java new file mode 100644 index 000000000000..c54ea531be90 --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/SubscriptionGroupQuotaAssignment.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** MGId the source of groupQuota. */ +@Fluent +public final class SubscriptionGroupQuotaAssignment { + /* + * The management group id of the quota source. + */ + @JsonProperty(value = "managementGroupId") + private String managementGroupId; + + /* + * The amount of quota allocated to this subscriptionId from the quota source. + */ + @JsonProperty(value = "quotaAllocated") + private Long quotaAllocated; + + /** Creates an instance of SubscriptionGroupQuotaAssignment class. */ + public SubscriptionGroupQuotaAssignment() { + } + + /** + * Get the managementGroupId property: The management group id of the quota source. + * + * @return the managementGroupId value. + */ + public String managementGroupId() { + return this.managementGroupId; + } + + /** + * Set the managementGroupId property: The management group id of the quota source. + * + * @param managementGroupId the managementGroupId value to set. + * @return the SubscriptionGroupQuotaAssignment object itself. + */ + public SubscriptionGroupQuotaAssignment withManagementGroupId(String managementGroupId) { + this.managementGroupId = managementGroupId; + return this; + } + + /** + * Get the quotaAllocated property: The amount of quota allocated to this subscriptionId from the quota source. + * + * @return the quotaAllocated value. + */ + public Long quotaAllocated() { + return this.quotaAllocated; + } + + /** + * Set the quotaAllocated property: The amount of quota allocated to this subscriptionId from the quota source. + * + * @param quotaAllocated the quotaAllocated value to set. + * @return the SubscriptionGroupQuotaAssignment object itself. + */ + public SubscriptionGroupQuotaAssignment withQuotaAllocated(Long quotaAllocated) { + this.quotaAllocated = quotaAllocated; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/SubscriptionQuotaAllocationRequest.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/SubscriptionQuotaAllocationRequest.java new file mode 100644 index 000000000000..2bd49f7753e1 --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/SubscriptionQuotaAllocationRequest.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.quota.models; + +import com.azure.resourcemanager.quota.fluent.models.SubscriptionQuotaAllocationRequestInner; + +/** An immutable client-side representation of SubscriptionQuotaAllocationRequest. */ +public interface SubscriptionQuotaAllocationRequest { + /** + * Gets the properties property: The properties property. + * + * @return the properties value. + */ + SubscriptionQuotaAllocationRequestProperties properties(); + + /** + * Gets the inner com.azure.resourcemanager.quota.fluent.models.SubscriptionQuotaAllocationRequestInner object. + * + * @return the inner object. + */ + SubscriptionQuotaAllocationRequestInner innerModel(); +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/SubscriptionQuotaAllocationRequestList.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/SubscriptionQuotaAllocationRequestList.java new file mode 100644 index 000000000000..6a0e41c767be --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/SubscriptionQuotaAllocationRequestList.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.quota.fluent.models.SubscriptionQuotaAllocationRequestInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The SubscriptionQuotaAllocationRequestList model. */ +@Fluent +public final class SubscriptionQuotaAllocationRequestList { + /* + * Assigned Group Quota to subscriptions. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URL to use for getting the next set of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of SubscriptionQuotaAllocationRequestList class. */ + public SubscriptionQuotaAllocationRequestList() { + } + + /** + * Get the value property: Assigned Group Quota to subscriptions. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Assigned Group Quota to subscriptions. + * + * @param value the value value to set. + * @return the SubscriptionQuotaAllocationRequestList object itself. + */ + public SubscriptionQuotaAllocationRequestList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URL to use for getting the next set of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/SubscriptionQuotaAllocationRequestProperties.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/SubscriptionQuotaAllocationRequestProperties.java new file mode 100644 index 000000000000..df8cbb1563cf --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/SubscriptionQuotaAllocationRequestProperties.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The SubscriptionQuotaAllocationRequestProperties model. */ +@Fluent +public final class SubscriptionQuotaAllocationRequestProperties { + /* + * Request status. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private RequestState provisioningState; + + /* + * The new quota limit for the subscription. The incremental quota will be assigned from pre-approved groupQuota. + */ + @JsonProperty(value = "limit") + private Long limit; + + /** Creates an instance of SubscriptionQuotaAllocationRequestProperties class. */ + public SubscriptionQuotaAllocationRequestProperties() { + } + + /** + * Get the provisioningState property: Request status. + * + * @return the provisioningState value. + */ + public RequestState provisioningState() { + return this.provisioningState; + } + + /** + * Get the limit property: The new quota limit for the subscription. The incremental quota will be assigned from + * pre-approved groupQuota. + * + * @return the limit value. + */ + public Long limit() { + return this.limit; + } + + /** + * Set the limit property: The new quota limit for the subscription. The incremental quota will be assigned from + * pre-approved groupQuota. + * + * @param limit the limit value to set. + * @return the SubscriptionQuotaAllocationRequestProperties object itself. + */ + public SubscriptionQuotaAllocationRequestProperties withLimit(Long limit) { + this.limit = limit; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/SubscriptionQuotaAllocations.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/SubscriptionQuotaAllocations.java new file mode 100644 index 000000000000..15bc06f501b6 --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/SubscriptionQuotaAllocations.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.models; + +import com.azure.resourcemanager.quota.fluent.models.SubscriptionQuotaAllocationsInner; + +/** An immutable client-side representation of SubscriptionQuotaAllocations. */ +public interface SubscriptionQuotaAllocations { + /** + * 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: Quota properties for the specified resource. + * + * @return the properties value. + */ + SubscriptionQuotaDetails properties(); + + /** + * Gets the inner com.azure.resourcemanager.quota.fluent.models.SubscriptionQuotaAllocationsInner object. + * + * @return the inner object. + */ + SubscriptionQuotaAllocationsInner innerModel(); +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/SubscriptionQuotaAllocationsList.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/SubscriptionQuotaAllocationsList.java new file mode 100644 index 000000000000..b90f04bcd1d5 --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/SubscriptionQuotaAllocationsList.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.quota.fluent.models.SubscriptionQuotaAllocationsInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Subscription quota list. */ +@Fluent +public final class SubscriptionQuotaAllocationsList { + /* + * Subscription quota list. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URL to use for getting the next set of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of SubscriptionQuotaAllocationsList class. */ + public SubscriptionQuotaAllocationsList() { + } + + /** + * Get the value property: Subscription quota list. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Subscription quota list. + * + * @param value the value value to set. + * @return the SubscriptionQuotaAllocationsList object itself. + */ + public SubscriptionQuotaAllocationsList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URL to use for getting the next set of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/SubscriptionQuotaDetails.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/SubscriptionQuotaDetails.java new file mode 100644 index 000000000000..cf82c8eee0d5 --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/SubscriptionQuotaDetails.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Subscription Quota details. */ +@Fluent +public final class SubscriptionQuotaDetails { + /* + * The total quota limit for the subscription. + */ + @JsonProperty(value = "limit", access = JsonProperty.Access.WRITE_ONLY) + private Long limit; + + /* + * The non shareable quota for the subscription. + */ + @JsonProperty(value = "nonShareableQuota", access = JsonProperty.Access.WRITE_ONLY) + private Long nonShareableQuota; + + /* + * Request status. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private RequestState provisioningState; + + /* + * Assigned Group Quota to subscriptions. + */ + @JsonProperty(value = "quotaSources") + private List quotaSources; + + /** Creates an instance of SubscriptionQuotaDetails class. */ + public SubscriptionQuotaDetails() { + } + + /** + * Get the limit property: The total quota limit for the subscription. + * + * @return the limit value. + */ + public Long limit() { + return this.limit; + } + + /** + * Get the nonShareableQuota property: The non shareable quota for the subscription. + * + * @return the nonShareableQuota value. + */ + public Long nonShareableQuota() { + return this.nonShareableQuota; + } + + /** + * Get the provisioningState property: Request status. + * + * @return the provisioningState value. + */ + public RequestState provisioningState() { + return this.provisioningState; + } + + /** + * Get the quotaSources property: Assigned Group Quota to subscriptions. + * + * @return the quotaSources value. + */ + public List quotaSources() { + return this.quotaSources; + } + + /** + * Set the quotaSources property: Assigned Group Quota to subscriptions. + * + * @param quotaSources the quotaSources value to set. + * @return the SubscriptionQuotaDetails object itself. + */ + public SubscriptionQuotaDetails withQuotaSources(List quotaSources) { + this.quotaSources = quotaSources; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (quotaSources() != null) { + quotaSources().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/SubscriptionRequests.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/SubscriptionRequests.java new file mode 100644 index 000000000000..ec227f2b5ce7 --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/SubscriptionRequests.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.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 SubscriptionRequests. */ +public interface SubscriptionRequests { + /** + * List the status of all requests to add subscriptionIds to the GroupQuotasEntity. + * + *

List API to check the status of a subscriptionId requests by requestId. Request history is maintained for 1 + * year. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of GroupQuotaSubscriptionIds as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String mgId, String groupQuotaName); + + /** + * List the status of all requests to add subscriptionIds to the GroupQuotasEntity. + * + *

List API to check the status of a subscriptionId requests by requestId. Request history is maintained for 1 + * year. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @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 list of GroupQuotaSubscriptionIds as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String mgId, String groupQuotaName, Context context); + + /** + * Get the status of a single subscriptionId request by requestId. + * + *

Get API to check the status of a subscriptionIds request by requestId. Use the polling API - OperationsStatus + * URI specified in Azure-AsyncOperation header field, with retry-after duration in seconds to check the + * intermediate status. This API provides the finals status with the request details and status. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param requestId Request 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 aPI to check the status of a subscriptionIds request by requestId along with {@link Response}. + */ + Response getWithResponse( + String mgId, String groupQuotaName, String requestId, Context context); + + /** + * Get the status of a single subscriptionId request by requestId. + * + *

Get API to check the status of a subscriptionIds request by requestId. Use the polling API - OperationsStatus + * URI specified in Azure-AsyncOperation header field, with retry-after duration in seconds to check the + * intermediate status. This API provides the finals status with the request details and status. + * + * @param mgId Management Group Id. + * @param groupQuotaName The GroupQuota name. The name should be unique for the provided context tenantId/MgId. + * @param requestId Request 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 aPI to check the status of a subscriptionIds request by requestId. + */ + GroupQuotaSubscriptionId get(String mgId, String groupQuotaName, String requestId); +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/package-info.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/package-info.java index 2bc29ac9d800..49682960353a 100644 --- a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/package-info.java +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/models/package-info.java @@ -2,5 +2,8 @@ // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. -/** Package containing the data models for AzureQuotaExtensionApi. Microsoft Azure Quota Resource Provider. */ +/** + * Package containing the data models for AzureQuotaExtensionApi. Microsoft Azure Quota Resource Provider. This Swagger + * is for Azure MG Group Quota using GroupQuota Entity. + */ package com.azure.resourcemanager.quota.models; diff --git a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/package-info.java b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/package-info.java index 8fa6b5e13b6c..ad64a81c3ef4 100644 --- a/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/package-info.java +++ b/sdk/quota/azure-resourcemanager-quota/src/main/java/com/azure/resourcemanager/quota/package-info.java @@ -2,5 +2,8 @@ // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. -/** Package containing the classes for AzureQuotaExtensionApi. Microsoft Azure Quota Resource Provider. */ +/** + * Package containing the classes for AzureQuotaExtensionApi. Microsoft Azure Quota Resource Provider. This Swagger is + * for Azure MG Group Quota using GroupQuota Entity. + */ package com.azure.resourcemanager.quota; diff --git a/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotaLimitsCreateOrUpdateSamples.java b/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotaLimitsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..cc32c76595a2 --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotaLimitsCreateOrUpdateSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.generated; + +/** Samples for GroupQuotaLimits CreateOrUpdate. */ +public final class GroupQuotaLimitsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotaLimits/PutGroupQuotaLimits-Compute.json + */ + /** + * Sample code: GroupQuotaLimits_Put_Request_ForCompute. + * + * @param manager Entry point to QuotaManager. + */ + public static void groupQuotaLimitsPutRequestForCompute(com.azure.resourcemanager.quota.QuotaManager manager) { + manager + .groupQuotaLimits() + .createOrUpdate( + "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", + "providers/Microsoft.Compute/locations/westus", + "groupquota1", + "cores", + null, + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotaLimitsGetSamples.java b/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotaLimitsGetSamples.java new file mode 100644 index 000000000000..e15d87b3eb95 --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotaLimitsGetSamples.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.quota.generated; + +/** Samples for GroupQuotaLimits Get. */ +public final class GroupQuotaLimitsGetSamples { + /* + * x-ms-original-file: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotaLimits/GetGroupQuotaLimits-Compute.json + */ + /** + * Sample code: GroupQuotaLimits_Get_Request_ForCompute. + * + * @param manager Entry point to QuotaManager. + */ + public static void groupQuotaLimitsGetRequestForCompute(com.azure.resourcemanager.quota.QuotaManager manager) { + manager + .groupQuotaLimits() + .getWithResponse( + "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", + "providers/Microsoft.Compute/locations/westus", + "groupquota1", + "cores", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotaLimitsListSamples.java b/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotaLimitsListSamples.java new file mode 100644 index 000000000000..298e8175c9b1 --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotaLimitsListSamples.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.quota.generated; + +/** Samples for GroupQuotaLimits List. */ +public final class GroupQuotaLimitsListSamples { + /* + * x-ms-original-file: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotaLimits/ListGroupQuotaLimits-Compute.json + */ + /** + * Sample code: GroupQuotaLimits_List_Request_ForCompute. + * + * @param manager Entry point to QuotaManager. + */ + public static void groupQuotaLimitsListRequestForCompute(com.azure.resourcemanager.quota.QuotaManager manager) { + manager + .groupQuotaLimits() + .list( + "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", + "providers/Microsoft.Compute/locations/westus", + "groupquota1", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotaLimitsRequestsGetSamples.java b/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotaLimitsRequestsGetSamples.java new file mode 100644 index 000000000000..4e1e3a804e44 --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotaLimitsRequestsGetSamples.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.quota.generated; + +/** Samples for GroupQuotaLimitsRequests Get. */ +public final class GroupQuotaLimitsRequestsGetSamples { + /* + * x-ms-original-file: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotaLimitsRequests/GroupQuotaLimitsRequests_Get.json + */ + /** + * Sample code: GroupQuotaLimitsRequests_Get. + * + * @param manager Entry point to QuotaManager. + */ + public static void groupQuotaLimitsRequestsGet(com.azure.resourcemanager.quota.QuotaManager manager) { + manager + .groupQuotaLimitsRequests() + .getWithResponse( + "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", + "providers/Microsoft.Compute/locations/westus", + "groupquota1", + "someId", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotaLimitsRequestsListSamples.java b/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotaLimitsRequestsListSamples.java new file mode 100644 index 000000000000..a4cb8196dcfe --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotaLimitsRequestsListSamples.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.quota.generated; + +/** Samples for GroupQuotaLimitsRequests List. */ +public final class GroupQuotaLimitsRequestsListSamples { + /* + * x-ms-original-file: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotaLimitsRequests/GroupQuotaLimitsRequests_List.json + */ + /** + * Sample code: GroupQuotaLimitsRequests_List. + * + * @param manager Entry point to QuotaManager. + */ + public static void groupQuotaLimitsRequestsList(com.azure.resourcemanager.quota.QuotaManager manager) { + manager + .groupQuotaLimitsRequests() + .list( + "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", + "providers/Microsoft.Compute/locations/westus", + "groupquota1", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotaLimitsUpdateSamples.java b/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotaLimitsUpdateSamples.java new file mode 100644 index 000000000000..2bed595ae761 --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotaLimitsUpdateSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.generated; + +/** Samples for GroupQuotaLimits Update. */ +public final class GroupQuotaLimitsUpdateSamples { + /* + * x-ms-original-file: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotaLimits/PatchGroupQuotaLimits-Compute.json + */ + /** + * Sample code: GroupQuotaLimits_Patch_Request_ForCompute. + * + * @param manager Entry point to QuotaManager. + */ + public static void groupQuotaLimitsPatchRequestForCompute(com.azure.resourcemanager.quota.QuotaManager manager) { + manager + .groupQuotaLimits() + .update( + "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", + "providers/Microsoft.Compute/locations/westus", + "groupquota1", + "cores", + null, + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotaSubscriptionQuotaAllocationCreateOrUpdateSamples.java b/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotaSubscriptionQuotaAllocationCreateOrUpdateSamples.java new file mode 100644 index 000000000000..840b1deeaae4 --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotaSubscriptionQuotaAllocationCreateOrUpdateSamples.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.quota.generated; + +import com.azure.resourcemanager.quota.fluent.models.SubscriptionQuotaAllocationsInner; +import com.azure.resourcemanager.quota.models.SubscriptionGroupQuotaAssignment; +import com.azure.resourcemanager.quota.models.SubscriptionQuotaDetails; +import java.util.Arrays; + +/** Samples for GroupQuotaSubscriptionQuotaAllocation CreateOrUpdate. */ +public final class GroupQuotaSubscriptionQuotaAllocationCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/SubscriptionQuotaAllocation/SubscriptionQuotaAllocation_Put_Request-Compute.json + */ + /** + * Sample code: SubscriptionQuotaAllocation_Put_Request_ForCompute. + * + * @param manager Entry point to QuotaManager. + */ + public static void subscriptionQuotaAllocationPutRequestForCompute( + com.azure.resourcemanager.quota.QuotaManager manager) { + manager + .groupQuotaSubscriptionQuotaAllocations() + .createOrUpdate( + "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", + "providers/Microsoft.Compute/locations/westus", + "groupquota1", + "cores", + new SubscriptionQuotaAllocationsInner() + .withProperties( + new SubscriptionQuotaDetails() + .withQuotaSources( + Arrays + .asList( + new SubscriptionGroupQuotaAssignment() + .withManagementGroupId("00000000-0000-0000-0000-000000000000") + .withQuotaAllocated(75L)))), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotaSubscriptionQuotaAllocationGetSamples.java b/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotaSubscriptionQuotaAllocationGetSamples.java new file mode 100644 index 000000000000..a5393ce35b20 --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotaSubscriptionQuotaAllocationGetSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.generated; + +/** Samples for GroupQuotaSubscriptionQuotaAllocation Get. */ +public final class GroupQuotaSubscriptionQuotaAllocationGetSamples { + /* + * x-ms-original-file: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/SubscriptionQuotaAllocation/SubscriptionQuotaAllocation_Get_Request-Compute.json + */ + /** + * Sample code: SubscriptionQuotaAllocation_Get_Request_ForCompute. + * + * @param manager Entry point to QuotaManager. + */ + public static void subscriptionQuotaAllocationGetRequestForCompute( + com.azure.resourcemanager.quota.QuotaManager manager) { + manager + .groupQuotaSubscriptionQuotaAllocations() + .getWithResponse( + "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", + "providers/Microsoft.Compute/locations/westus", + "groupquota1", + "cores", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotaSubscriptionQuotaAllocationListSamples.java b/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotaSubscriptionQuotaAllocationListSamples.java new file mode 100644 index 000000000000..61c73fb0b41d --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotaSubscriptionQuotaAllocationListSamples.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.quota.generated; + +/** Samples for GroupQuotaSubscriptionQuotaAllocation List. */ +public final class GroupQuotaSubscriptionQuotaAllocationListSamples { + /* + * x-ms-original-file: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/SubscriptionQuotaAllocation/SubscriptionQuotaAllocation_List_Request-Compute.json + */ + /** + * Sample code: SubscriptionQuotaAllocation_List_Request_ForCompute. + * + * @param manager Entry point to QuotaManager. + */ + public static void subscriptionQuotaAllocationListRequestForCompute( + com.azure.resourcemanager.quota.QuotaManager manager) { + manager + .groupQuotaSubscriptionQuotaAllocations() + .list( + "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", + "providers/Microsoft.Compute/locations/westus", + "groupquota1", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotaSubscriptionQuotaAllocationRequestsGetSamples.java b/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotaSubscriptionQuotaAllocationRequestsGetSamples.java new file mode 100644 index 000000000000..de07e3798a6f --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotaSubscriptionQuotaAllocationRequestsGetSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.generated; + +/** Samples for GroupQuotaSubscriptionQuotaAllocationRequests Get. */ +public final class GroupQuotaSubscriptionQuotaAllocationRequestsGetSamples { + /* + * x-ms-original-file: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/SubscriptionQuotaAllocationRequests/SubscriptionQuotaAllocationRequests_Get_Request-Compute.json + */ + /** + * Sample code: SubscriptionQuotaAllocationRequests_Get_Request_ForCompute. + * + * @param manager Entry point to QuotaManager. + */ + public static void subscriptionQuotaAllocationRequestsGetRequestForCompute( + com.azure.resourcemanager.quota.QuotaManager manager) { + manager + .groupQuotaSubscriptionQuotaAllocationRequests() + .getWithResponse( + "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", + "providers/Microsoft.Compute/locations/westus", + "groupquota1", + "11111111-1111-1111-1111-111111111111", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotaSubscriptionQuotaAllocationRequestsListSamples.java b/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotaSubscriptionQuotaAllocationRequestsListSamples.java new file mode 100644 index 000000000000..4da3cda7bbba --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotaSubscriptionQuotaAllocationRequestsListSamples.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.quota.generated; + +/** Samples for GroupQuotaSubscriptionQuotaAllocationRequests List. */ +public final class GroupQuotaSubscriptionQuotaAllocationRequestsListSamples { + /* + * x-ms-original-file: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/SubscriptionQuotaAllocationRequests/SubscriptionQuotaAllocationRequests_List_Request-Compute.json + */ + /** + * Sample code: SubscriptionQuotaAllocationRequests_List_Request_ForCompute. + * + * @param manager Entry point to QuotaManager. + */ + public static void subscriptionQuotaAllocationRequestsListRequestForCompute( + com.azure.resourcemanager.quota.QuotaManager manager) { + manager + .groupQuotaSubscriptionQuotaAllocationRequests() + .list( + "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", + "providers/Microsoft.Compute/locations/westus", + "groupquota1", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotaSubscriptionQuotaAllocationUpdateSamples.java b/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotaSubscriptionQuotaAllocationUpdateSamples.java new file mode 100644 index 000000000000..dacdf5618fec --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotaSubscriptionQuotaAllocationUpdateSamples.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.quota.generated; + +import com.azure.resourcemanager.quota.fluent.models.SubscriptionQuotaAllocationsInner; +import com.azure.resourcemanager.quota.models.SubscriptionGroupQuotaAssignment; +import com.azure.resourcemanager.quota.models.SubscriptionQuotaDetails; +import java.util.Arrays; + +/** Samples for GroupQuotaSubscriptionQuotaAllocation Update. */ +public final class GroupQuotaSubscriptionQuotaAllocationUpdateSamples { + /* + * x-ms-original-file: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/SubscriptionQuotaAllocation/SubscriptionQuotaAllocation_Patch_Request-Compute.json + */ + /** + * Sample code: SubscriptionQuotaAllocation_Patch_Request_ForCompute. + * + * @param manager Entry point to QuotaManager. + */ + public static void subscriptionQuotaAllocationPatchRequestForCompute( + com.azure.resourcemanager.quota.QuotaManager manager) { + manager + .groupQuotaSubscriptionQuotaAllocations() + .update( + "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", + "providers/Microsoft.Compute/locations/westus", + "groupquota1", + "cores", + new SubscriptionQuotaAllocationsInner() + .withProperties( + new SubscriptionQuotaDetails() + .withQuotaSources( + Arrays + .asList( + new SubscriptionGroupQuotaAssignment() + .withManagementGroupId("00000000-0000-0000-0000-000000000000") + .withQuotaAllocated(75L)))), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotaSubscriptionsCreateOrUpdateSamples.java b/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotaSubscriptionsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..5029a91c1e4d --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotaSubscriptionsCreateOrUpdateSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.generated; + +/** Samples for GroupQuotaSubscriptions CreateOrUpdate. */ +public final class GroupQuotaSubscriptionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotasSubscriptions/PutGroupQuotasSubscription.json + */ + /** + * Sample code: GroupQuotaSubscriptions_Put_Subscriptions. + * + * @param manager Entry point to QuotaManager. + */ + public static void groupQuotaSubscriptionsPutSubscriptions(com.azure.resourcemanager.quota.QuotaManager manager) { + manager + .groupQuotaSubscriptions() + .createOrUpdate("E7EC67B3-7657-4966-BFFC-41EFD36BAA09", "groupquota1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotaSubscriptionsDeleteSamples.java b/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotaSubscriptionsDeleteSamples.java new file mode 100644 index 000000000000..594e4da13297 --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotaSubscriptionsDeleteSamples.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.quota.generated; + +/** Samples for GroupQuotaSubscriptions Delete. */ +public final class GroupQuotaSubscriptionsDeleteSamples { + /* + * x-ms-original-file: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotasSubscriptions/DeleteGroupQuotaSubscriptions.json + */ + /** + * Sample code: GroupQuotaSubscriptions_Delete_Subscriptions. + * + * @param manager Entry point to QuotaManager. + */ + public static void groupQuotaSubscriptionsDeleteSubscriptions( + com.azure.resourcemanager.quota.QuotaManager manager) { + manager + .groupQuotaSubscriptions() + .deleteByResourceGroupWithResponse( + "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", "groupquota1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotaSubscriptionsGetSamples.java b/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotaSubscriptionsGetSamples.java new file mode 100644 index 000000000000..3ecce4711551 --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotaSubscriptionsGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.generated; + +/** Samples for GroupQuotaSubscriptions Get. */ +public final class GroupQuotaSubscriptionsGetSamples { + /* + * x-ms-original-file: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotasSubscriptions/GetGroupQuotaSubscriptions.json + */ + /** + * Sample code: GroupQuotaSubscriptions_Get_Subscriptions. + * + * @param manager Entry point to QuotaManager. + */ + public static void groupQuotaSubscriptionsGetSubscriptions(com.azure.resourcemanager.quota.QuotaManager manager) { + manager + .groupQuotaSubscriptions() + .getWithResponse("E7EC67B3-7657-4966-BFFC-41EFD36BAA09", "groupquota1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotaSubscriptionsListSamples.java b/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotaSubscriptionsListSamples.java new file mode 100644 index 000000000000..f5ee03297f7b --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotaSubscriptionsListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.generated; + +/** Samples for GroupQuotaSubscriptions List. */ +public final class GroupQuotaSubscriptionsListSamples { + /* + * x-ms-original-file: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotasSubscriptions/ListGroupQuotaSubscriptions.json + */ + /** + * Sample code: GroupQuotaSubscriptions_List_Subscriptions. + * + * @param manager Entry point to QuotaManager. + */ + public static void groupQuotaSubscriptionsListSubscriptions(com.azure.resourcemanager.quota.QuotaManager manager) { + manager + .groupQuotaSubscriptions() + .list("E7EC67B3-7657-4966-BFFC-41EFD36BAA09", "groupquota1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotaSubscriptionsUpdateSamples.java b/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotaSubscriptionsUpdateSamples.java new file mode 100644 index 000000000000..7da13ed1fd1d --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotaSubscriptionsUpdateSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.generated; + +/** Samples for GroupQuotaSubscriptions Update. */ +public final class GroupQuotaSubscriptionsUpdateSamples { + /* + * x-ms-original-file: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotasSubscriptions/PatchGroupQuotasSubscription.json + */ + /** + * Sample code: GroupQuotaSubscriptions_Patch_Subscriptions. + * + * @param manager Entry point to QuotaManager. + */ + public static void groupQuotaSubscriptionsPatchSubscriptions(com.azure.resourcemanager.quota.QuotaManager manager) { + manager + .groupQuotaSubscriptions() + .update("E7EC67B3-7657-4966-BFFC-41EFD36BAA09", "groupquota1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotasCreateOrUpdateSamples.java b/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotasCreateOrUpdateSamples.java new file mode 100644 index 000000000000..1667008c4a28 --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotasCreateOrUpdateSamples.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.quota.generated; + +import com.azure.resourcemanager.quota.fluent.models.GroupQuotasEntityInner; +import com.azure.resourcemanager.quota.models.AdditionalAttributes; +import com.azure.resourcemanager.quota.models.EnvironmentType; +import com.azure.resourcemanager.quota.models.GroupQuotasEntityBase; +import com.azure.resourcemanager.quota.models.GroupingId; +import com.azure.resourcemanager.quota.models.GroupingIdType; + +/** Samples for GroupQuotas CreateOrUpdate. */ +public final class GroupQuotasCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotas/PutGroupQuotas.json + */ + /** + * Sample code: GroupQuotas_Put_Request_ForCompute. + * + * @param manager Entry point to QuotaManager. + */ + public static void groupQuotasPutRequestForCompute(com.azure.resourcemanager.quota.QuotaManager manager) { + manager + .groupQuotas() + .createOrUpdate( + "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", + "groupquota1", + new GroupQuotasEntityInner() + .withProperties( + new GroupQuotasEntityBase() + .withDisplayName("GroupQuota1") + .withAdditionalAttributes( + new AdditionalAttributes() + .withGroupId( + new GroupingId() + .withGroupingIdType(GroupingIdType.SERVICE_TREE_ID) + .withValue("yourServiceTreeIdHere")) + .withEnvironment(EnvironmentType.PRODUCTION))), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotasDeleteSamples.java b/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotasDeleteSamples.java new file mode 100644 index 000000000000..069e95cc1d57 --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotasDeleteSamples.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.quota.generated; + +/** Samples for GroupQuotas Delete. */ +public final class GroupQuotasDeleteSamples { + /* + * x-ms-original-file: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotas/DeleteGroupQuotas.json + */ + /** + * Sample code: GroupQuotas_Delete_Request_ForCompute. + * + * @param manager Entry point to QuotaManager. + */ + public static void groupQuotasDeleteRequestForCompute(com.azure.resourcemanager.quota.QuotaManager manager) { + manager + .groupQuotas() + .deleteByResourceGroupWithResponse( + "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", "groupquota1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotasGetSamples.java b/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotasGetSamples.java new file mode 100644 index 000000000000..8940161ea07f --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotasGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.generated; + +/** Samples for GroupQuotas Get. */ +public final class GroupQuotasGetSamples { + /* + * x-ms-original-file: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotas/GetGroupQuotas.json + */ + /** + * Sample code: GroupQuotas_Get_Request_ForCompute. + * + * @param manager Entry point to QuotaManager. + */ + public static void groupQuotasGetRequestForCompute(com.azure.resourcemanager.quota.QuotaManager manager) { + manager + .groupQuotas() + .getWithResponse("E7EC67B3-7657-4966-BFFC-41EFD36BAA09", "groupquota1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotasListSamples.java b/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotasListSamples.java new file mode 100644 index 000000000000..a4c7672f449c --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotasListSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.generated; + +/** Samples for GroupQuotas List. */ +public final class GroupQuotasListSamples { + /* + * x-ms-original-file: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotas/GetGroupQuotasList.json + */ + /** + * Sample code: GroupQuotas_List_Request_ForCompute. + * + * @param manager Entry point to QuotaManager. + */ + public static void groupQuotasListRequestForCompute(com.azure.resourcemanager.quota.QuotaManager manager) { + manager.groupQuotas().list("E7EC67B3-7657-4966-BFFC-41EFD36BAA09", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotasUpdateSamples.java b/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotasUpdateSamples.java new file mode 100644 index 000000000000..fb7dbd3ce5a9 --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/GroupQuotasUpdateSamples.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.quota.generated; + +import com.azure.resourcemanager.quota.fluent.models.GroupQuotasEntityInner; +import com.azure.resourcemanager.quota.models.AdditionalAttributes; +import com.azure.resourcemanager.quota.models.EnvironmentType; +import com.azure.resourcemanager.quota.models.GroupQuotasEntityBase; +import com.azure.resourcemanager.quota.models.GroupingId; +import com.azure.resourcemanager.quota.models.GroupingIdType; + +/** Samples for GroupQuotas Update. */ +public final class GroupQuotasUpdateSamples { + /* + * x-ms-original-file: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotas/PatchGroupQuotas.json + */ + /** + * Sample code: GroupQuotas_Patch_Request_ForCompute. + * + * @param manager Entry point to QuotaManager. + */ + public static void groupQuotasPatchRequestForCompute(com.azure.resourcemanager.quota.QuotaManager manager) { + manager + .groupQuotas() + .update( + "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", + "groupquota1", + new GroupQuotasEntityInner() + .withProperties( + new GroupQuotasEntityBase() + .withDisplayName("GroupQuota1") + .withAdditionalAttributes( + new AdditionalAttributes() + .withGroupId( + new GroupingId() + .withGroupingIdType(GroupingIdType.SERVICE_TREE_ID) + .withValue("yourServiceTreeIdHere")) + .withEnvironment(EnvironmentType.PRODUCTION))), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/SubscriptionRequestsGetSamples.java b/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/SubscriptionRequestsGetSamples.java new file mode 100644 index 000000000000..100160af1e88 --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/SubscriptionRequestsGetSamples.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.quota.generated; + +/** Samples for SubscriptionRequests Get. */ +public final class SubscriptionRequestsGetSamples { + /* + * x-ms-original-file: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/SubscriptionRequests/SubscriptionRequests_Get.json + */ + /** + * Sample code: SubscriptionRequests_Get. + * + * @param manager Entry point to QuotaManager. + */ + public static void subscriptionRequestsGet(com.azure.resourcemanager.quota.QuotaManager manager) { + manager + .subscriptionRequests() + .getWithResponse( + "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", + "groupquota1", + "00000000-0000-0000-0000-000000000000", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/SubscriptionRequestsListSamples.java b/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/SubscriptionRequestsListSamples.java new file mode 100644 index 000000000000..bb8389813d76 --- /dev/null +++ b/sdk/quota/azure-resourcemanager-quota/src/samples/java/com/azure/resourcemanager/quota/generated/SubscriptionRequestsListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.quota.generated; + +/** Samples for SubscriptionRequests List. */ +public final class SubscriptionRequestsListSamples { + /* + * x-ms-original-file: specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/SubscriptionRequests/SubscriptionRequests_List.json + */ + /** + * Sample code: SubscriptionRequests_List. + * + * @param manager Entry point to QuotaManager. + */ + public static void subscriptionRequestsList(com.azure.resourcemanager.quota.QuotaManager manager) { + manager + .subscriptionRequests() + .list("E7EC67B3-7657-4966-BFFC-41EFD36BAA09", "groupquota1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/CurrentQuotaLimitBaseInnerTests.java b/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/CurrentQuotaLimitBaseInnerTests.java deleted file mode 100644 index cc7ae7b268b4..000000000000 --- a/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/CurrentQuotaLimitBaseInnerTests.java +++ /dev/null @@ -1,40 +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.quota.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.quota.fluent.models.CurrentQuotaLimitBaseInner; -import com.azure.resourcemanager.quota.models.LimitJsonObject; -import com.azure.resourcemanager.quota.models.QuotaProperties; -import com.azure.resourcemanager.quota.models.ResourceName; -import org.junit.jupiter.api.Assertions; - -public final class CurrentQuotaLimitBaseInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - CurrentQuotaLimitBaseInner model = - BinaryData - .fromString( - "{\"properties\":{\"limit\":{\"limitObjectType\":\"LimitJsonObject\"},\"unit\":\"ithxqhabifpi\",\"name\":{\"value\":\"czbysc\",\"localizedValue\":\"q\"},\"resourceType\":\"hiv\",\"quotaPeriod\":\"n\",\"isQuotaApplicable\":false,\"properties\":\"databr\"},\"id\":\"xvd\",\"name\":\"mjgr\",\"type\":\"fwvuk\"}") - .toObject(CurrentQuotaLimitBaseInner.class); - Assertions.assertEquals("czbysc", model.properties().name().value()); - Assertions.assertEquals("hiv", model.properties().resourceType()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - CurrentQuotaLimitBaseInner model = - new CurrentQuotaLimitBaseInner() - .withProperties( - new QuotaProperties() - .withLimit(new LimitJsonObject()) - .withName(new ResourceName().withValue("czbysc")) - .withResourceType("hiv") - .withProperties("databr")); - model = BinaryData.fromObject(model).toObject(CurrentQuotaLimitBaseInner.class); - Assertions.assertEquals("czbysc", model.properties().name().value()); - Assertions.assertEquals("hiv", model.properties().resourceType()); - } -} diff --git a/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/CurrentUsagesBaseInnerTests.java b/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/CurrentUsagesBaseInnerTests.java deleted file mode 100644 index df613a1a43f6..000000000000 --- a/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/CurrentUsagesBaseInnerTests.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.quota.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.quota.fluent.models.CurrentUsagesBaseInner; -import com.azure.resourcemanager.quota.models.ResourceName; -import com.azure.resourcemanager.quota.models.UsagesObject; -import com.azure.resourcemanager.quota.models.UsagesProperties; -import com.azure.resourcemanager.quota.models.UsagesTypes; -import org.junit.jupiter.api.Assertions; - -public final class CurrentUsagesBaseInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - CurrentUsagesBaseInner model = - BinaryData - .fromString( - "{\"properties\":{\"usages\":{\"value\":304908421,\"usagesType\":\"Individual\"},\"unit\":\"gjxpybczmehmt\",\"name\":{\"value\":\"bsphrupidgsybbe\",\"localizedValue\":\"ph\"},\"resourceType\":\"cmsxaobhdxbm\",\"quotaPeriod\":\"ioq\",\"isQuotaApplicable\":false,\"properties\":\"datatbmufpo\"},\"id\":\"noi\",\"name\":\"hwlrx\",\"type\":\"bqsoqijg\"}") - .toObject(CurrentUsagesBaseInner.class); - Assertions.assertEquals(304908421, model.properties().usages().value()); - Assertions.assertEquals(UsagesTypes.INDIVIDUAL, model.properties().usages().usagesType()); - Assertions.assertEquals("bsphrupidgsybbe", model.properties().name().value()); - Assertions.assertEquals("cmsxaobhdxbm", model.properties().resourceType()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - CurrentUsagesBaseInner model = - new CurrentUsagesBaseInner() - .withProperties( - new UsagesProperties() - .withUsages(new UsagesObject().withValue(304908421).withUsagesType(UsagesTypes.INDIVIDUAL)) - .withName(new ResourceName().withValue("bsphrupidgsybbe")) - .withResourceType("cmsxaobhdxbm") - .withProperties("datatbmufpo")); - model = BinaryData.fromObject(model).toObject(CurrentUsagesBaseInner.class); - Assertions.assertEquals(304908421, model.properties().usages().value()); - Assertions.assertEquals(UsagesTypes.INDIVIDUAL, model.properties().usages().usagesType()); - Assertions.assertEquals("bsphrupidgsybbe", model.properties().name().value()); - Assertions.assertEquals("cmsxaobhdxbm", model.properties().resourceType()); - } -} diff --git a/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/LimitJsonObjectTests.java b/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/LimitJsonObjectTests.java deleted file mode 100644 index 7a2e83d1c203..000000000000 --- a/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/LimitJsonObjectTests.java +++ /dev/null @@ -1,22 +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.quota.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.quota.models.LimitJsonObject; - -public final class LimitJsonObjectTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - LimitJsonObject model = - BinaryData.fromString("{\"limitObjectType\":\"LimitJsonObject\"}").toObject(LimitJsonObject.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - LimitJsonObject model = new LimitJsonObject(); - model = BinaryData.fromObject(model).toObject(LimitJsonObject.class); - } -} diff --git a/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/LimitObjectTests.java b/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/LimitObjectTests.java deleted file mode 100644 index e20a3bbbf99f..000000000000 --- a/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/LimitObjectTests.java +++ /dev/null @@ -1,30 +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.quota.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.quota.models.LimitObject; -import com.azure.resourcemanager.quota.models.QuotaLimitTypes; -import org.junit.jupiter.api.Assertions; - -public final class LimitObjectTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - LimitObject model = - BinaryData - .fromString("{\"limitObjectType\":\"LimitValue\",\"value\":284238049,\"limitType\":\"Independent\"}") - .toObject(LimitObject.class); - Assertions.assertEquals(284238049, model.value()); - Assertions.assertEquals(QuotaLimitTypes.INDEPENDENT, model.limitType()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - LimitObject model = new LimitObject().withValue(284238049).withLimitType(QuotaLimitTypes.INDEPENDENT); - model = BinaryData.fromObject(model).toObject(LimitObject.class); - Assertions.assertEquals(284238049, model.value()); - Assertions.assertEquals(QuotaLimitTypes.INDEPENDENT, model.limitType()); - } -} diff --git a/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/OperationDisplayTests.java b/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/OperationDisplayTests.java deleted file mode 100644 index a0c9c06cc7fa..000000000000 --- a/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/OperationDisplayTests.java +++ /dev/null @@ -1,39 +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.quota.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.quota.models.OperationDisplay; -import org.junit.jupiter.api.Assertions; - -public final class OperationDisplayTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OperationDisplay model = - BinaryData - .fromString( - "{\"provider\":\"g\",\"resource\":\"tnwu\",\"operation\":\"gazxuf\",\"description\":\"uckyf\"}") - .toObject(OperationDisplay.class); - Assertions.assertEquals("g", model.provider()); - Assertions.assertEquals("tnwu", model.resource()); - Assertions.assertEquals("gazxuf", model.operation()); - Assertions.assertEquals("uckyf", model.description()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OperationDisplay model = - new OperationDisplay() - .withProvider("g") - .withResource("tnwu") - .withOperation("gazxuf") - .withDescription("uckyf"); - model = BinaryData.fromObject(model).toObject(OperationDisplay.class); - Assertions.assertEquals("g", model.provider()); - Assertions.assertEquals("tnwu", model.resource()); - Assertions.assertEquals("gazxuf", model.operation()); - Assertions.assertEquals("uckyf", model.description()); - } -} diff --git a/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/OperationListTests.java b/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/OperationListTests.java deleted file mode 100644 index 41dd17f3409b..000000000000 --- a/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/OperationListTests.java +++ /dev/null @@ -1,66 +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.quota.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.quota.fluent.models.OperationResponseInner; -import com.azure.resourcemanager.quota.models.OperationDisplay; -import com.azure.resourcemanager.quota.models.OperationList; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class OperationListTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OperationList model = - BinaryData - .fromString( - "{\"value\":[{\"name\":\"gibma\",\"display\":{\"provider\":\"keqsrxybzqqedq\",\"resource\":\"bciqfouflm\",\"operation\":\"kzsmodm\",\"description\":\"ougpbkwt\"},\"origin\":\"tduqktapspwgcuer\"},{\"name\":\"mkdo\",\"display\":{\"provider\":\"whbmd\",\"resource\":\"bjf\",\"operation\":\"gmbmbexppbh\",\"description\":\"qrolfpf\"},\"origin\":\"algbquxigjyjg\"}],\"nextLink\":\"aoyfhrtxilnerkuj\"}") - .toObject(OperationList.class); - Assertions.assertEquals("gibma", model.value().get(0).name()); - Assertions.assertEquals("keqsrxybzqqedq", model.value().get(0).display().provider()); - Assertions.assertEquals("bciqfouflm", model.value().get(0).display().resource()); - Assertions.assertEquals("kzsmodm", model.value().get(0).display().operation()); - Assertions.assertEquals("ougpbkwt", model.value().get(0).display().description()); - Assertions.assertEquals("tduqktapspwgcuer", model.value().get(0).origin()); - Assertions.assertEquals("aoyfhrtxilnerkuj", model.nextLink()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OperationList model = - new OperationList() - .withValue( - Arrays - .asList( - new OperationResponseInner() - .withName("gibma") - .withDisplay( - new OperationDisplay() - .withProvider("keqsrxybzqqedq") - .withResource("bciqfouflm") - .withOperation("kzsmodm") - .withDescription("ougpbkwt")) - .withOrigin("tduqktapspwgcuer"), - new OperationResponseInner() - .withName("mkdo") - .withDisplay( - new OperationDisplay() - .withProvider("whbmd") - .withResource("bjf") - .withOperation("gmbmbexppbh") - .withDescription("qrolfpf")) - .withOrigin("algbquxigjyjg"))) - .withNextLink("aoyfhrtxilnerkuj"); - model = BinaryData.fromObject(model).toObject(OperationList.class); - Assertions.assertEquals("gibma", model.value().get(0).name()); - Assertions.assertEquals("keqsrxybzqqedq", model.value().get(0).display().provider()); - Assertions.assertEquals("bciqfouflm", model.value().get(0).display().resource()); - Assertions.assertEquals("kzsmodm", model.value().get(0).display().operation()); - Assertions.assertEquals("ougpbkwt", model.value().get(0).display().description()); - Assertions.assertEquals("tduqktapspwgcuer", model.value().get(0).origin()); - Assertions.assertEquals("aoyfhrtxilnerkuj", model.nextLink()); - } -} diff --git a/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/OperationResponseInnerTests.java b/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/OperationResponseInnerTests.java deleted file mode 100644 index c507f2b5e697..000000000000 --- a/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/OperationResponseInnerTests.java +++ /dev/null @@ -1,48 +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.quota.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.quota.fluent.models.OperationResponseInner; -import com.azure.resourcemanager.quota.models.OperationDisplay; -import org.junit.jupiter.api.Assertions; - -public final class OperationResponseInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OperationResponseInner model = - BinaryData - .fromString( - "{\"name\":\"vlejuvfqa\",\"display\":{\"provider\":\"yxwjkcp\",\"resource\":\"nwbxgjvtbvpyssz\",\"operation\":\"rujqg\",\"description\":\"muouqfp\"},\"origin\":\"zw\"}") - .toObject(OperationResponseInner.class); - Assertions.assertEquals("vlejuvfqa", model.name()); - Assertions.assertEquals("yxwjkcp", model.display().provider()); - Assertions.assertEquals("nwbxgjvtbvpyssz", model.display().resource()); - Assertions.assertEquals("rujqg", model.display().operation()); - Assertions.assertEquals("muouqfp", model.display().description()); - Assertions.assertEquals("zw", model.origin()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OperationResponseInner model = - new OperationResponseInner() - .withName("vlejuvfqa") - .withDisplay( - new OperationDisplay() - .withProvider("yxwjkcp") - .withResource("nwbxgjvtbvpyssz") - .withOperation("rujqg") - .withDescription("muouqfp")) - .withOrigin("zw"); - model = BinaryData.fromObject(model).toObject(OperationResponseInner.class); - Assertions.assertEquals("vlejuvfqa", model.name()); - Assertions.assertEquals("yxwjkcp", model.display().provider()); - Assertions.assertEquals("nwbxgjvtbvpyssz", model.display().resource()); - Assertions.assertEquals("rujqg", model.display().operation()); - Assertions.assertEquals("muouqfp", model.display().description()); - Assertions.assertEquals("zw", model.origin()); - } -} diff --git a/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/QuotaLimitsTests.java b/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/QuotaLimitsTests.java deleted file mode 100644 index 43b99822172e..000000000000 --- a/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/QuotaLimitsTests.java +++ /dev/null @@ -1,53 +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.quota.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.quota.fluent.models.CurrentQuotaLimitBaseInner; -import com.azure.resourcemanager.quota.models.QuotaLimits; -import com.azure.resourcemanager.quota.models.QuotaProperties; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class QuotaLimitsTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - QuotaLimits model = - BinaryData - .fromString( - "{\"value\":[{\"properties\":{\"unit\":\"npmqnjaqwixjspro\",\"resourceType\":\"putegjvwmfd\",\"quotaPeriod\":\"scmdvpjhulsuu\",\"isQuotaApplicable\":true,\"properties\":\"dataozkrwfndiodjpslw\"},\"id\":\"jdpvwryo\",\"name\":\"psoacctazakljl\",\"type\":\"hbcryffdfdosyge\"},{\"properties\":{\"unit\":\"jakhmsbzjh\",\"resourceType\":\"evdphlxaol\",\"quotaPeriod\":\"qtrgqjbpfzfsinzg\",\"isQuotaApplicable\":true,\"properties\":\"datarwzoxxjtfelluwf\"},\"id\":\"it\",\"name\":\"np\",\"type\":\"qfpjk\"},{\"properties\":{\"unit\":\"fpdvhpfxxypi\",\"resourceType\":\"mayhuybbkpodepoo\",\"quotaPeriod\":\"nuvamiheogna\",\"isQuotaApplicable\":true,\"properties\":\"datatheotusiv\"},\"id\":\"evcciqihnhun\",\"name\":\"bwjzr\",\"type\":\"fygxgispemvtzfk\"}],\"nextLink\":\"ubljofxqe\"}") - .toObject(QuotaLimits.class); - Assertions.assertEquals("putegjvwmfd", model.value().get(0).properties().resourceType()); - Assertions.assertEquals("ubljofxqe", model.nextLink()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - QuotaLimits model = - new QuotaLimits() - .withValue( - Arrays - .asList( - new CurrentQuotaLimitBaseInner() - .withProperties( - new QuotaProperties() - .withResourceType("putegjvwmfd") - .withProperties("dataozkrwfndiodjpslw")), - new CurrentQuotaLimitBaseInner() - .withProperties( - new QuotaProperties() - .withResourceType("evdphlxaol") - .withProperties("datarwzoxxjtfelluwf")), - new CurrentQuotaLimitBaseInner() - .withProperties( - new QuotaProperties() - .withResourceType("mayhuybbkpodepoo") - .withProperties("datatheotusiv")))) - .withNextLink("ubljofxqe"); - model = BinaryData.fromObject(model).toObject(QuotaLimits.class); - Assertions.assertEquals("putegjvwmfd", model.value().get(0).properties().resourceType()); - Assertions.assertEquals("ubljofxqe", model.nextLink()); - } -} diff --git a/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/QuotaOperationsListMockTests.java b/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/QuotaOperationsListMockTests.java deleted file mode 100644 index cfd511ea0a61..000000000000 --- a/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/QuotaOperationsListMockTests.java +++ /dev/null @@ -1,72 +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.quota.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.quota.QuotaManager; -import com.azure.resourcemanager.quota.models.OperationResponse; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class QuotaOperationsListMockTests { - @Test - public void testList() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"value\":[{\"name\":\"gujjugwdkcglh\",\"display\":{\"provider\":\"zj\",\"resource\":\"ggd\",\"operation\":\"ixhbkuofqweykhm\",\"description\":\"evfyexfwhybcib\"},\"origin\":\"vdcsitynn\"}]}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - QuotaManager manager = - QuotaManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.quotaOperations().list(com.azure.core.util.Context.NONE); - - Assertions.assertEquals("gujjugwdkcglh", response.iterator().next().name()); - Assertions.assertEquals("zj", response.iterator().next().display().provider()); - Assertions.assertEquals("ggd", response.iterator().next().display().resource()); - Assertions.assertEquals("ixhbkuofqweykhm", response.iterator().next().display().operation()); - Assertions.assertEquals("evfyexfwhybcib", response.iterator().next().display().description()); - Assertions.assertEquals("vdcsitynn", response.iterator().next().origin()); - } -} diff --git a/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/QuotaPropertiesTests.java b/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/QuotaPropertiesTests.java deleted file mode 100644 index 05d2a41073a9..000000000000 --- a/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/QuotaPropertiesTests.java +++ /dev/null @@ -1,37 +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.quota.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.quota.models.LimitJsonObject; -import com.azure.resourcemanager.quota.models.QuotaProperties; -import com.azure.resourcemanager.quota.models.ResourceName; -import org.junit.jupiter.api.Assertions; - -public final class QuotaPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - QuotaProperties model = - BinaryData - .fromString( - "{\"limit\":{\"limitObjectType\":\"LimitJsonObject\"},\"unit\":\"udccsnhsjc\",\"name\":{\"value\":\"j\",\"localizedValue\":\"ryhtnapczwlokjy\"},\"resourceType\":\"kkvnipjox\",\"quotaPeriod\":\"nchgej\",\"isQuotaApplicable\":true,\"properties\":\"datamailzydehojw\"}") - .toObject(QuotaProperties.class); - Assertions.assertEquals("j", model.name().value()); - Assertions.assertEquals("kkvnipjox", model.resourceType()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - QuotaProperties model = - new QuotaProperties() - .withLimit(new LimitJsonObject()) - .withName(new ResourceName().withValue("j")) - .withResourceType("kkvnipjox") - .withProperties("datamailzydehojw"); - model = BinaryData.fromObject(model).toObject(QuotaProperties.class); - Assertions.assertEquals("j", model.name().value()); - Assertions.assertEquals("kkvnipjox", model.resourceType()); - } -} diff --git a/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/QuotaRequestDetailsListTests.java b/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/QuotaRequestDetailsListTests.java deleted file mode 100644 index 215ee9508286..000000000000 --- a/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/QuotaRequestDetailsListTests.java +++ /dev/null @@ -1,37 +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.quota.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.quota.fluent.models.QuotaRequestDetailsInner; -import com.azure.resourcemanager.quota.models.QuotaRequestDetailsList; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class QuotaRequestDetailsListTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - QuotaRequestDetailsList model = - BinaryData - .fromString( - "{\"value\":[{\"id\":\"qxhocdgeablgphut\",\"name\":\"ndv\",\"type\":\"ozwyiftyhxhuro\",\"properties\":{\"provisioningState\":\"Succeeded\",\"message\":\"olniwpwcukjf\",\"requestSubmitTime\":\"2021-02-25T16:13:04Z\",\"value\":[]}},{\"id\":\"klryplwck\",\"name\":\"syyp\",\"type\":\"dhsgcba\",\"properties\":{\"provisioningState\":\"InProgress\",\"message\":\"koty\",\"requestSubmitTime\":\"2021-02-05T05:14:14Z\",\"value\":[]}}],\"nextLink\":\"zndlikwy\"}") - .toObject(QuotaRequestDetailsList.class); - Assertions.assertEquals("zndlikwy", model.nextLink()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - QuotaRequestDetailsList model = - new QuotaRequestDetailsList() - .withValue( - Arrays - .asList( - new QuotaRequestDetailsInner().withValue(Arrays.asList()), - new QuotaRequestDetailsInner().withValue(Arrays.asList()))) - .withNextLink("zndlikwy"); - model = BinaryData.fromObject(model).toObject(QuotaRequestDetailsList.class); - Assertions.assertEquals("zndlikwy", model.nextLink()); - } -} diff --git a/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/QuotasCreateOrUpdateMockTests.java b/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/QuotasCreateOrUpdateMockTests.java deleted file mode 100644 index a3131665e617..000000000000 --- a/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/QuotasCreateOrUpdateMockTests.java +++ /dev/null @@ -1,81 +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.quota.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.quota.QuotaManager; -import com.azure.resourcemanager.quota.models.CurrentQuotaLimitBase; -import com.azure.resourcemanager.quota.models.LimitJsonObject; -import com.azure.resourcemanager.quota.models.QuotaProperties; -import com.azure.resourcemanager.quota.models.ResourceName; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class QuotasCreateOrUpdateMockTests { - @Test - public void testCreateOrUpdate() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"properties\":{\"limit\":{\"limitObjectType\":\"LimitJsonObject\"},\"unit\":\"gpphrcgyn\",\"name\":{\"value\":\"pec\",\"localizedValue\":\"m\"},\"resourceType\":\"oo\",\"quotaPeriod\":\"xlzevgbmqjqabcy\",\"isQuotaApplicable\":true,\"properties\":\"datakwlzuvccfwnfn\"},\"id\":\"acfi\",\"name\":\"nlebxetqgtzxd\",\"type\":\"nqbqqwxr\"}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - QuotaManager manager = - QuotaManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - CurrentQuotaLimitBase response = - manager - .quotas() - .define("pbobjo") - .withExistingScope("hm") - .withProperties( - new QuotaProperties() - .withLimit(new LimitJsonObject()) - .withName(new ResourceName().withValue("rzayv")) - .withResourceType("otkftutqxlngx") - .withProperties("datarvqdra")) - .create(); - - Assertions.assertEquals("pec", response.properties().name().value()); - Assertions.assertEquals("oo", response.properties().resourceType()); - } -} diff --git a/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/QuotasGetWithResponseMockTests.java b/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/QuotasGetWithResponseMockTests.java deleted file mode 100644 index cbbaa28bac3d..000000000000 --- a/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/QuotasGetWithResponseMockTests.java +++ /dev/null @@ -1,68 +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.quota.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.quota.QuotaManager; -import com.azure.resourcemanager.quota.models.CurrentQuotaLimitBase; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class QuotasGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"properties\":{\"limit\":{\"limitObjectType\":\"LimitJsonObject\"},\"unit\":\"xzlocxscp\",\"name\":{\"value\":\"rhhbcs\",\"localizedValue\":\"ummajtjaod\"},\"resourceType\":\"bnbdxkqpxokajion\",\"quotaPeriod\":\"mexgstxgcp\",\"isQuotaApplicable\":false,\"properties\":\"dataaajrm\"},\"id\":\"djwzrlov\",\"name\":\"clwhijcoejctbz\",\"type\":\"qsqsy\"}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - QuotaManager manager = - QuotaManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - CurrentQuotaLimitBase response = - manager.quotas().getWithResponse("ulpkudjkrl", "hbzhfepg", com.azure.core.util.Context.NONE).getValue(); - - Assertions.assertEquals("rhhbcs", response.properties().name().value()); - Assertions.assertEquals("bnbdxkqpxokajion", response.properties().resourceType()); - } -} diff --git a/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/QuotasListMockTests.java b/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/QuotasListMockTests.java deleted file mode 100644 index 68073d727ede..000000000000 --- a/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/QuotasListMockTests.java +++ /dev/null @@ -1,69 +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.quota.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.quota.QuotaManager; -import com.azure.resourcemanager.quota.models.CurrentQuotaLimitBase; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class QuotasListMockTests { - @Test - public void testList() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"value\":[{\"properties\":{\"limit\":{\"limitObjectType\":\"LimitJsonObject\"},\"unit\":\"fmxa\",\"name\":{\"value\":\"jpgd\",\"localizedValue\":\"ocjjxhvpmouexh\"},\"resourceType\":\"xibqeojnx\",\"quotaPeriod\":\"zvddntwndeicbtwn\",\"isQuotaApplicable\":false,\"properties\":\"dataqvuhrhcffcyddglm\"},\"id\":\"t\",\"name\":\"jqkwpyeicx\",\"type\":\"qciwqvhkhixuigdt\"}]}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - QuotaManager manager = - QuotaManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = - manager.quotas().list("bkbfkgukdkex", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("jpgd", response.iterator().next().properties().name().value()); - Assertions.assertEquals("xibqeojnx", response.iterator().next().properties().resourceType()); - } -} diff --git a/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/ResourceNameTests.java b/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/ResourceNameTests.java deleted file mode 100644 index b6ce7311a544..000000000000 --- a/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/ResourceNameTests.java +++ /dev/null @@ -1,27 +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.quota.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.quota.models.ResourceName; -import org.junit.jupiter.api.Assertions; - -public final class ResourceNameTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ResourceName model = - BinaryData - .fromString("{\"value\":\"xrifkwmrvkts\",\"localizedValue\":\"nt\"}") - .toObject(ResourceName.class); - Assertions.assertEquals("xrifkwmrvkts", model.value()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ResourceName model = new ResourceName().withValue("xrifkwmrvkts"); - model = BinaryData.fromObject(model).toObject(ResourceName.class); - Assertions.assertEquals("xrifkwmrvkts", model.value()); - } -} diff --git a/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/SubRequestTests.java b/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/SubRequestTests.java deleted file mode 100644 index bd1dc696d3aa..000000000000 --- a/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/SubRequestTests.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.quota.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.quota.models.LimitJsonObject; -import com.azure.resourcemanager.quota.models.ResourceName; -import com.azure.resourcemanager.quota.models.SubRequest; -import org.junit.jupiter.api.Assertions; - -public final class SubRequestTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - SubRequest model = - BinaryData - .fromString( - "{\"name\":{\"value\":\"jwnzlljfmp\",\"localizedValue\":\"ebvmgxsabkyqd\"},\"resourceType\":\"jitcjczdzevn\",\"unit\":\"krwpdap\",\"provisioningState\":\"InProgress\",\"message\":\"dkvwrwjfe\",\"subRequestId\":\"nhutjeltmrldhugj\",\"limit\":{\"limitObjectType\":\"LimitJsonObject\"}}") - .toObject(SubRequest.class); - Assertions.assertEquals("jwnzlljfmp", model.name().value()); - Assertions.assertEquals("krwpdap", model.unit()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SubRequest model = - new SubRequest() - .withName(new ResourceName().withValue("jwnzlljfmp")) - .withUnit("krwpdap") - .withLimit(new LimitJsonObject()); - model = BinaryData.fromObject(model).toObject(SubRequest.class); - Assertions.assertEquals("jwnzlljfmp", model.name().value()); - Assertions.assertEquals("krwpdap", model.unit()); - } -} diff --git a/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/UsagesGetWithResponseMockTests.java b/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/UsagesGetWithResponseMockTests.java deleted file mode 100644 index 06fbc303927f..000000000000 --- a/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/UsagesGetWithResponseMockTests.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.quota.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.quota.QuotaManager; -import com.azure.resourcemanager.quota.models.CurrentUsagesBase; -import com.azure.resourcemanager.quota.models.UsagesTypes; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class UsagesGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"properties\":{\"usages\":{\"value\":1651513421,\"usagesType\":\"Individual\"},\"unit\":\"kfthwxmntei\",\"name\":{\"value\":\"pvkmijcmmxdcuf\",\"localizedValue\":\"srp\"},\"resourceType\":\"zidnsezcxtbzsgfy\",\"quotaPeriod\":\"sne\",\"isQuotaApplicable\":true,\"properties\":\"dataz\"},\"id\":\"eiachboosflnr\",\"name\":\"sfqpteehz\",\"type\":\"vypyqrimzinpv\"}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - QuotaManager manager = - QuotaManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - CurrentUsagesBase response = - manager.usages().getWithResponse("idf", "zwdzuh", com.azure.core.util.Context.NONE).getValue(); - - Assertions.assertEquals(1651513421, response.properties().usages().value()); - Assertions.assertEquals(UsagesTypes.INDIVIDUAL, response.properties().usages().usagesType()); - Assertions.assertEquals("pvkmijcmmxdcuf", response.properties().name().value()); - Assertions.assertEquals("zidnsezcxtbzsgfy", response.properties().resourceType()); - } -} diff --git a/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/UsagesLimitsTests.java b/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/UsagesLimitsTests.java deleted file mode 100644 index 1a6215d0ecb9..000000000000 --- a/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/UsagesLimitsTests.java +++ /dev/null @@ -1,46 +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.quota.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.quota.fluent.models.CurrentUsagesBaseInner; -import com.azure.resourcemanager.quota.models.UsagesLimits; -import com.azure.resourcemanager.quota.models.UsagesProperties; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class UsagesLimitsTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - UsagesLimits model = - BinaryData - .fromString( - "{\"value\":[{\"properties\":{\"unit\":\"qucmpo\",\"resourceType\":\"kfo\",\"quotaPeriod\":\"nygj\",\"isQuotaApplicable\":true,\"properties\":\"datadeqsrdeupewn\"},\"id\":\"reitjzyflusar\",\"name\":\"mofcq\",\"type\":\"smy\"},{\"properties\":{\"unit\":\"tmlxhekuksjtx\",\"resourceType\":\"dmpa\",\"quotaPeriod\":\"ryuanzwuxzdxtay\",\"isQuotaApplicable\":true,\"properties\":\"datawhfpmrqobmtu\"},\"id\":\"knryrtihfxtij\",\"name\":\"pzvgnwzsymglzufc\",\"type\":\"zk\"}],\"nextLink\":\"dbihanufhfcbj\"}") - .toObject(UsagesLimits.class); - Assertions.assertEquals("kfo", model.value().get(0).properties().resourceType()); - Assertions.assertEquals("dbihanufhfcbj", model.nextLink()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - UsagesLimits model = - new UsagesLimits() - .withValue( - Arrays - .asList( - new CurrentUsagesBaseInner() - .withProperties( - new UsagesProperties().withResourceType("kfo").withProperties("datadeqsrdeupewn")), - new CurrentUsagesBaseInner() - .withProperties( - new UsagesProperties() - .withResourceType("dmpa") - .withProperties("datawhfpmrqobmtu")))) - .withNextLink("dbihanufhfcbj"); - model = BinaryData.fromObject(model).toObject(UsagesLimits.class); - Assertions.assertEquals("kfo", model.value().get(0).properties().resourceType()); - Assertions.assertEquals("dbihanufhfcbj", model.nextLink()); - } -} diff --git a/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/UsagesListMockTests.java b/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/UsagesListMockTests.java deleted file mode 100644 index 15ba1c9bba2d..000000000000 --- a/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/UsagesListMockTests.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.quota.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.quota.QuotaManager; -import com.azure.resourcemanager.quota.models.CurrentUsagesBase; -import com.azure.resourcemanager.quota.models.UsagesTypes; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class UsagesListMockTests { - @Test - public void testList() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"value\":[{\"properties\":{\"usages\":{\"value\":158859960,\"usagesType\":\"Combined\"},\"unit\":\"xhcr\",\"name\":{\"value\":\"hjtckwhd\",\"localizedValue\":\"ifiyipjxsqwpgrj\"},\"resourceType\":\"norcjxvsnbyxqab\",\"quotaPeriod\":\"ocpcy\",\"isQuotaApplicable\":false,\"properties\":\"datazafb\"},\"id\":\"jjgpb\",\"name\":\"oq\",\"type\":\"jmkljavbqidtqajz\"}]}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - QuotaManager manager = - QuotaManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.usages().list("wjdk", com.azure.core.util.Context.NONE); - - Assertions.assertEquals(158859960, response.iterator().next().properties().usages().value()); - Assertions.assertEquals(UsagesTypes.COMBINED, response.iterator().next().properties().usages().usagesType()); - Assertions.assertEquals("hjtckwhd", response.iterator().next().properties().name().value()); - Assertions.assertEquals("norcjxvsnbyxqab", response.iterator().next().properties().resourceType()); - } -} diff --git a/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/UsagesObjectTests.java b/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/UsagesObjectTests.java deleted file mode 100644 index 19ef6c01da24..000000000000 --- a/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/UsagesObjectTests.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.quota.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.quota.models.UsagesObject; -import com.azure.resourcemanager.quota.models.UsagesTypes; -import org.junit.jupiter.api.Assertions; - -public final class UsagesObjectTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - UsagesObject model = - BinaryData.fromString("{\"value\":1667898231,\"usagesType\":\"Individual\"}").toObject(UsagesObject.class); - Assertions.assertEquals(1667898231, model.value()); - Assertions.assertEquals(UsagesTypes.INDIVIDUAL, model.usagesType()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - UsagesObject model = new UsagesObject().withValue(1667898231).withUsagesType(UsagesTypes.INDIVIDUAL); - model = BinaryData.fromObject(model).toObject(UsagesObject.class); - Assertions.assertEquals(1667898231, model.value()); - Assertions.assertEquals(UsagesTypes.INDIVIDUAL, model.usagesType()); - } -} diff --git a/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/UsagesPropertiesTests.java b/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/UsagesPropertiesTests.java deleted file mode 100644 index 4f45b157444e..000000000000 --- a/sdk/quota/azure-resourcemanager-quota/src/test/java/com/azure/resourcemanager/quota/generated/UsagesPropertiesTests.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.quota.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.quota.models.ResourceName; -import com.azure.resourcemanager.quota.models.UsagesObject; -import com.azure.resourcemanager.quota.models.UsagesProperties; -import com.azure.resourcemanager.quota.models.UsagesTypes; -import org.junit.jupiter.api.Assertions; - -public final class UsagesPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - UsagesProperties model = - BinaryData - .fromString( - "{\"usages\":{\"value\":1715873571,\"usagesType\":\"Combined\"},\"unit\":\"zlobcufpd\",\"name\":{\"value\":\"btcqq\",\"localizedValue\":\"qglhq\"},\"resourceType\":\"ufo\",\"quotaPeriod\":\"jywif\",\"isQuotaApplicable\":false,\"properties\":\"dataaagdfmg\"}") - .toObject(UsagesProperties.class); - Assertions.assertEquals(1715873571, model.usages().value()); - Assertions.assertEquals(UsagesTypes.COMBINED, model.usages().usagesType()); - Assertions.assertEquals("btcqq", model.name().value()); - Assertions.assertEquals("ufo", model.resourceType()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - UsagesProperties model = - new UsagesProperties() - .withUsages(new UsagesObject().withValue(1715873571).withUsagesType(UsagesTypes.COMBINED)) - .withName(new ResourceName().withValue("btcqq")) - .withResourceType("ufo") - .withProperties("dataaagdfmg"); - model = BinaryData.fromObject(model).toObject(UsagesProperties.class); - Assertions.assertEquals(1715873571, model.usages().value()); - Assertions.assertEquals(UsagesTypes.COMBINED, model.usages().usagesType()); - Assertions.assertEquals("btcqq", model.name().value()); - Assertions.assertEquals("ufo", model.resourceType()); - } -}