From 82a8eb20c3a2fd20d5a972303d33311c129d81b0 Mon Sep 17 00:00:00 2001 From: Judy Liu Date: Wed, 22 Jan 2025 16:27:47 +0800 Subject: [PATCH] [Release] sdk/resourcemanager/quota/armquota/1.1.0-beta.2 (#23968) * [Release] sdk/resourcemanager/quota/armquota/1.1.0-beta.2 generation from spec commit: f3ac3c7d3f3a312364ed4db78744e20fea1fd235 * update asset.json * update asset.json * update asset.json * update asset.json * update asset.json * update asset.json * update asset.json * update asset * update asset * update date * update date --- .../quota/armquota/CHANGELOG.md | 62 +++ .../quota/armquota/assets.json | 2 +- .../quota/armquota/autorest.md | 8 +- sdk/resourcemanager/quota/armquota/client.go | 20 +- .../quota/armquota/client_example_test.go | 22 +- .../quota/armquota/client_factory.go | 14 - .../quota/armquota/constants.go | 52 +- .../armquota/fake/groupquotalimits_server.go | 92 +--- .../fake/groupquotalimitsrequest_server.go | 92 +--- .../fake/groupquotalocationsettings_server.go | 305 ------------ ...groupquotasubscriptionallocation_server.go | 88 +--- ...otasubscriptionallocationrequest_server.go | 98 +--- .../armquota/fake/groupquotausages_server.go | 120 ----- .../quota/armquota/fake/server_factory.go | 14 - .../quota/armquota/groupquotalimits_client.go | 115 +---- .../groupquotalimits_client_example_test.go | 149 ++---- .../groupquotalimitsrequest_client.go | 152 ++---- ...pquotalimitsrequest_client_example_test.go | 133 +++--- .../groupquotalocationsettings_client.go | 393 ---------------- ...otalocationsettings_client_example_test.go | 228 --------- .../quota/armquota/groupquotas_client.go | 26 +- .../groupquotas_client_example_test.go | 64 +-- ...groupquotasubscriptionallocation_client.go | 122 +---- ...scriptionallocation_client_example_test.go | 101 ++-- ...otasubscriptionallocationrequest_client.go | 144 +----- ...onallocationrequest_client_example_test.go | 183 +++---- .../groupquotasubscriptionrequests_client.go | 8 +- ...ubscriptionrequests_client_example_test.go | 4 +- .../groupquotasubscriptions_client.go | 26 +- ...pquotasubscriptions_client_example_test.go | 10 +- .../quota/armquota/groupquotausages_client.go | 113 ----- .../groupquotausages_client_example_test.go | 74 --- sdk/resourcemanager/quota/armquota/models.go | 179 ++++--- .../quota/armquota/models_serde.go | 445 +++++++++--------- .../quota/armquota/operation_client.go | 4 +- .../armquota/operation_client_example_test.go | 2 +- sdk/resourcemanager/quota/armquota/options.go | 71 +-- .../quota/armquota/quota_live_test.go | 19 +- .../quota/armquota/requeststatus_client.go | 8 +- .../requeststatus_client_example_test.go | 8 +- .../quota/armquota/responses.go | 68 +-- .../quota/armquota/usages_client.go | 8 +- .../armquota/usages_client_example_test.go | 10 +- 43 files changed, 849 insertions(+), 3007 deletions(-) delete mode 100644 sdk/resourcemanager/quota/armquota/fake/groupquotalocationsettings_server.go delete mode 100644 sdk/resourcemanager/quota/armquota/fake/groupquotausages_server.go delete mode 100644 sdk/resourcemanager/quota/armquota/groupquotalocationsettings_client.go delete mode 100644 sdk/resourcemanager/quota/armquota/groupquotalocationsettings_client_example_test.go delete mode 100644 sdk/resourcemanager/quota/armquota/groupquotausages_client.go delete mode 100644 sdk/resourcemanager/quota/armquota/groupquotausages_client_example_test.go diff --git a/sdk/resourcemanager/quota/armquota/CHANGELOG.md b/sdk/resourcemanager/quota/armquota/CHANGELOG.md index ebfac6afd750..f4248d37060d 100644 --- a/sdk/resourcemanager/quota/armquota/CHANGELOG.md +++ b/sdk/resourcemanager/quota/armquota/CHANGELOG.md @@ -1,5 +1,67 @@ # Release History +## 1.1.0-beta.2 (2025-01-22) +### Breaking Changes + +- Function `*GroupQuotaSubscriptionAllocationRequestClient.BeginUpdate` parameter(s) have been changed from `(context.Context, string, string, string, string, AllocationRequestStatus, *GroupQuotaSubscriptionAllocationRequestClientBeginUpdateOptions)` to `(context.Context, string, string, string, string, SubscriptionQuotaAllocationsList, *GroupQuotaSubscriptionAllocationRequestClientBeginUpdateOptions)` +- Function `*GroupQuotaSubscriptionAllocationRequestClient.Get` parameter(s) have been changed from `(context.Context, string, string, string, *GroupQuotaSubscriptionAllocationRequestClientGetOptions)` to `(context.Context, string, string, string, string, *GroupQuotaSubscriptionAllocationRequestClientGetOptions)` +- Type of `GroupQuotaLimit.Properties` has been changed from `*GroupQuotaDetails` to `*GroupQuotaLimitProperties` +- Type of `GroupQuotaLimitsRequestClientBeginUpdateOptions.GroupQuotaRequest` has been changed from `*SubmittedResourceRequestStatus` to `*GroupQuotaLimitList` +- Type of `GroupQuotasEntity.Properties` has been changed from `*GroupQuotasEntityBase` to `*GroupQuotasEntityProperties` +- Type of `GroupQuotasEntityPatch.Properties` has been changed from `*GroupQuotasEntityBasePatch` to `*GroupQuotasEntityPatchProperties` +- Type of `SubscriptionQuotaAllocations.Properties` has been changed from `*SubscriptionQuotaDetails` to `*SubscriptionQuotaAllocationsProperties` +- Enum `EnforcementState` has been removed +- Enum `EnvironmentType` has been removed +- Enum `GroupingIDType` has been removed +- Function `*ClientFactory.NewGroupQuotaLocationSettingsClient` has been removed +- Function `*ClientFactory.NewGroupQuotaUsagesClient` has been removed +- Function `*GroupQuotaLimitsClient.Get` has been removed +- Function `*GroupQuotaLimitsRequestClient.BeginCreateOrUpdate` has been removed +- Function `NewGroupQuotaLocationSettingsClient` has been removed +- Function `*GroupQuotaLocationSettingsClient.BeginCreateOrUpdate` has been removed +- Function `*GroupQuotaLocationSettingsClient.Get` has been removed +- Function `*GroupQuotaLocationSettingsClient.NewListPager` has been removed +- Function `*GroupQuotaLocationSettingsClient.BeginUpdate` has been removed +- Function `*GroupQuotaSubscriptionAllocationClient.Get` has been removed +- Function `*GroupQuotaSubscriptionAllocationRequestClient.BeginCreateOrUpdate` has been removed +- Function `NewGroupQuotaUsagesClient` has been removed +- Function `*GroupQuotaUsagesClient.NewListPager` has been removed +- Operation `*GroupQuotaLimitsClient.NewListPager` does not support pagination anymore, use `*GroupQuotaLimitsClient.List` instead. +- Operation `*GroupQuotaSubscriptionAllocationClient.NewListPager` does not support pagination anymore, use `*GroupQuotaSubscriptionAllocationClient.List` instead. +- Struct `AdditionalAttributes` has been removed +- Struct `AdditionalAttributesPatch` has been removed +- Struct `BillingAccountID` has been removed +- Struct `GroupQuotasEnforcementListResponse` has been removed +- Struct `GroupQuotasEnforcementResponse` has been removed +- Struct `GroupQuotasEnforcementResponseProperties` has been removed +- Struct `GroupingID` has been removed +- Field `Region` of struct `GroupQuotaDetails` has been removed +- Field `ID`, `Name`, `SystemData`, `Type` of struct `GroupQuotaLimit` has been removed +- Field `NextLink`, `Value` of struct `GroupQuotaLimitList` has been removed +- Field `SubmittedResourceRequestStatus` of struct `GroupQuotaLimitsRequestClientUpdateResponse` has been removed +- Field `AllocationRequestStatus` of struct `GroupQuotaSubscriptionAllocationRequestClientUpdateResponse` has been removed +- Field `AdditionalAttributes` of struct `GroupQuotasEntityBase` has been removed +- Field `AdditionalAttributes` of struct `GroupQuotasEntityBasePatch` has been removed +- Field `ID`, `Name`, `SystemData`, `Type` of struct `SubscriptionQuotaAllocations` has been removed +- Field `NextLink`, `Value` of struct `SubscriptionQuotaAllocationsList` has been removed +- Field `Region` of struct `SubscriptionQuotaDetails` has been removed + +### Features Added + +- New struct `GroupQuotaLimitListProperties` +- New struct `GroupQuotaLimitProperties` +- New struct `GroupQuotasEntityPatchProperties` +- New struct `GroupQuotasEntityProperties` +- New struct `SubscriptionQuotaAllocationsListProperties` +- New struct `SubscriptionQuotaAllocationsProperties` +- New field `ResourceName` in struct `GroupQuotaDetails` +- New field `ID`, `Name`, `Properties`, `SystemData`, `Type` in struct `GroupQuotaLimitList` +- New anonymous field `GroupQuotaLimitList` in struct `GroupQuotaLimitsRequestClientUpdateResponse` +- New anonymous field `SubscriptionQuotaAllocationsList` in struct `GroupQuotaSubscriptionAllocationRequestClientUpdateResponse` +- New field `ID`, `Name`, `Properties`, `SystemData`, `Type` in struct `SubscriptionQuotaAllocationsList` +- New field `ResourceName` in struct `SubscriptionQuotaDetails` + + ## 1.1.0-beta.1 (2024-04-26) ### Features Added diff --git a/sdk/resourcemanager/quota/armquota/assets.json b/sdk/resourcemanager/quota/armquota/assets.json index ba8a26cde667..65f5a5463474 100644 --- a/sdk/resourcemanager/quota/armquota/assets.json +++ b/sdk/resourcemanager/quota/armquota/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "go", "TagPrefix": "go/resourcemanager/quota/armquota", - "Tag": "go/resourcemanager/quota/armquota_8b5e62691b" + "Tag": "go/resourcemanager/quota/armquota_2613ed8b9a" } diff --git a/sdk/resourcemanager/quota/armquota/autorest.md b/sdk/resourcemanager/quota/armquota/autorest.md index 5c75f3f69b7c..01f95fdd9da5 100644 --- a/sdk/resourcemanager/quota/armquota/autorest.md +++ b/sdk/resourcemanager/quota/armquota/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/106483d9f698ac3b6c0d481ab0c5fab14152e21f/specification/quota/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/106483d9f698ac3b6c0d481ab0c5fab14152e21f/specification/quota/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/55c5a0cd6da80b2700333c01e9a9c6067de9cef0/specification/quota/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/55c5a0cd6da80b2700333c01e9a9c6067de9cef0/specification/quota/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.1.0-beta.1 -tag: package-2023-06-01-preview +module-version: 1.1.0-beta.2 +tag: package-2024-12-18-preview ``` \ No newline at end of file diff --git a/sdk/resourcemanager/quota/armquota/client.go b/sdk/resourcemanager/quota/armquota/client.go index ff6fc396de2e..3ad2607e11c5 100644 --- a/sdk/resourcemanager/quota/armquota/client.go +++ b/sdk/resourcemanager/quota/armquota/client.go @@ -49,7 +49,7 @@ func NewClient(credential azcore.TokenCredential, options *arm.ClientOptions) (* // the request. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2024-12-18-preview // - resourceName - Resource name for a given resource provider. For example: // - SKU name for Microsoft.Compute // - SKU or TotalLowPriorityCores for Microsoft.MachineLearningServices For Microsoft.Network PublicIPAddresses. @@ -86,7 +86,7 @@ func (client *Client) BeginCreateOrUpdate(ctx context.Context, resourceName stri // the request. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2024-12-18-preview func (client *Client) createOrUpdate(ctx context.Context, resourceName string, scope string, createQuotaRequest CurrentQuotaLimitBase, options *ClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "Client.BeginCreateOrUpdate" @@ -121,7 +121,7 @@ func (client *Client) createOrUpdateCreateRequest(ctx context.Context, resourceN return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2024-12-18-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, createQuotaRequest); err != nil { @@ -134,7 +134,7 @@ func (client *Client) createOrUpdateCreateRequest(ctx context.Context, resourceN // limit that can be submitted with a PUT request. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2024-12-18-preview // - resourceName - Resource name for a given resource provider. For example: // - SKU name for Microsoft.Compute // - SKU or TotalLowPriorityCores for Microsoft.MachineLearningServices For Microsoft.Network PublicIPAddresses. @@ -178,7 +178,7 @@ func (client *Client) getCreateRequest(ctx context.Context, resourceName string, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2024-12-18-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -199,7 +199,7 @@ func (client *Client) getHandleResponse(resp *http.Response) (ClientGetResponse, // NewListPager - Get a list of current quota limits of all resources for the specified scope. The response from this GET // operation can be leveraged to submit requests to update a quota. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2024-12-18-preview // - scope - The target Azure resource URI. For example, /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/. // This is the target Azure // resource URI for the List GET operation. If a {resourceName} is added after /quotas, then it's the target Azure resource @@ -237,7 +237,7 @@ func (client *Client) listCreateRequest(ctx context.Context, scope string, optio return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2024-12-18-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -263,7 +263,7 @@ func (client *Client) listHandleResponse(resp *http.Response) (ClientListRespons // the request. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2024-12-18-preview // - resourceName - Resource name for a given resource provider. For example: // - SKU name for Microsoft.Compute // - SKU or TotalLowPriorityCores for Microsoft.MachineLearningServices For Microsoft.Network PublicIPAddresses. @@ -299,7 +299,7 @@ func (client *Client) BeginUpdate(ctx context.Context, resourceName string, scop // the request. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2024-12-18-preview func (client *Client) update(ctx context.Context, resourceName string, scope string, createQuotaRequest CurrentQuotaLimitBase, options *ClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "Client.BeginUpdate" @@ -334,7 +334,7 @@ func (client *Client) updateCreateRequest(ctx context.Context, resourceName stri return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2024-12-18-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, createQuotaRequest); err != nil { diff --git a/sdk/resourcemanager/quota/armquota/client_example_test.go b/sdk/resourcemanager/quota/armquota/client_example_test.go index aec5179c5423..24cff619332b 100644 --- a/sdk/resourcemanager/quota/armquota/client_example_test.go +++ b/sdk/resourcemanager/quota/armquota/client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/quota/armquota" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/106483d9f698ac3b6c0d481ab0c5fab14152e21f/specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/getComputeOneSkuQuotaLimit.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/55c5a0cd6da80b2700333c01e9a9c6067de9cef0/specification/quota/resource-manager/Microsoft.Quota/preview/2024-12-18-preview/examples/getComputeOneSkuQuotaLimit.json func ExampleClient_Get_quotasGetRequestForCompute() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -56,7 +56,7 @@ func ExampleClient_Get_quotasGetRequestForCompute() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/106483d9f698ac3b6c0d481ab0c5fab14152e21f/specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/getNetworkOneSkuQuotaLimit.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/55c5a0cd6da80b2700333c01e9a9c6067de9cef0/specification/quota/resource-manager/Microsoft.Quota/preview/2024-12-18-preview/examples/getNetworkOneSkuQuotaLimit.json func ExampleClient_Get_quotasUsagesRequestForNetwork() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -94,7 +94,7 @@ func ExampleClient_Get_quotasUsagesRequestForNetwork() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/106483d9f698ac3b6c0d481ab0c5fab14152e21f/specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/putNetworkOneSkuQuotaRequest.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/55c5a0cd6da80b2700333c01e9a9c6067de9cef0/specification/quota/resource-manager/Microsoft.Quota/preview/2024-12-18-preview/examples/putNetworkOneSkuQuotaRequest.json func ExampleClient_BeginCreateOrUpdate_quotasPutRequestForNetwork() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -144,7 +144,7 @@ func ExampleClient_BeginCreateOrUpdate_quotasPutRequestForNetwork() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/106483d9f698ac3b6c0d481ab0c5fab14152e21f/specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/putNetworkOneSkuQuotaRequestStandardSkuPublicIpAddresses.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/55c5a0cd6da80b2700333c01e9a9c6067de9cef0/specification/quota/resource-manager/Microsoft.Quota/preview/2024-12-18-preview/examples/putNetworkOneSkuQuotaRequestStandardSkuPublicIpAddresses.json func ExampleClient_BeginCreateOrUpdate_quotasPutRequestForNetworkStandardSkuPublicIpAddressesResource() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -194,7 +194,7 @@ func ExampleClient_BeginCreateOrUpdate_quotasPutRequestForNetworkStandardSkuPubl // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/106483d9f698ac3b6c0d481ab0c5fab14152e21f/specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/putComputeOneSkuQuotaRequest.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/55c5a0cd6da80b2700333c01e9a9c6067de9cef0/specification/quota/resource-manager/Microsoft.Quota/preview/2024-12-18-preview/examples/putComputeOneSkuQuotaRequest.json func ExampleClient_BeginCreateOrUpdate_quotasPutRequestForCompute() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -242,7 +242,7 @@ func ExampleClient_BeginCreateOrUpdate_quotasPutRequestForCompute() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/106483d9f698ac3b6c0d481ab0c5fab14152e21f/specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/putMachineLearningServicesQuotaRequestLowPriority.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/55c5a0cd6da80b2700333c01e9a9c6067de9cef0/specification/quota/resource-manager/Microsoft.Quota/preview/2024-12-18-preview/examples/putMachineLearningServicesQuotaRequestLowPriority.json func ExampleClient_BeginCreateOrUpdate_quotasRequestForMachineLearningServicesLowPriorityResource() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -292,7 +292,7 @@ func ExampleClient_BeginCreateOrUpdate_quotasRequestForMachineLearningServicesLo // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/106483d9f698ac3b6c0d481ab0c5fab14152e21f/specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/patchComputeQuotaRequest.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/55c5a0cd6da80b2700333c01e9a9c6067de9cef0/specification/quota/resource-manager/Microsoft.Quota/preview/2024-12-18-preview/examples/patchComputeQuotaRequest.json func ExampleClient_BeginUpdate_quotasRequestPatchForCompute() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -341,7 +341,7 @@ func ExampleClient_BeginUpdate_quotasRequestPatchForCompute() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/106483d9f698ac3b6c0d481ab0c5fab14152e21f/specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/patchNetworkOneSkuQuotaRequest.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/55c5a0cd6da80b2700333c01e9a9c6067de9cef0/specification/quota/resource-manager/Microsoft.Quota/preview/2024-12-18-preview/examples/patchNetworkOneSkuQuotaRequest.json func ExampleClient_BeginUpdate_quotasRequestPatchForNetwork() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -391,7 +391,7 @@ func ExampleClient_BeginUpdate_quotasRequestPatchForNetwork() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/106483d9f698ac3b6c0d481ab0c5fab14152e21f/specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/getComputeQuotaLimits.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/55c5a0cd6da80b2700333c01e9a9c6067de9cef0/specification/quota/resource-manager/Microsoft.Quota/preview/2024-12-18-preview/examples/getComputeQuotaLimits.json func ExampleClient_NewListPager_quotasListQuotaLimitsForCompute() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -623,7 +623,7 @@ func ExampleClient_NewListPager_quotasListQuotaLimitsForCompute() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/106483d9f698ac3b6c0d481ab0c5fab14152e21f/specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/getNetworkQuotaLimits.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/55c5a0cd6da80b2700333c01e9a9c6067de9cef0/specification/quota/resource-manager/Microsoft.Quota/preview/2024-12-18-preview/examples/getNetworkQuotaLimits.json func ExampleClient_NewListPager_quotasListQuotaLimitsForNetwork() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1374,7 +1374,7 @@ func ExampleClient_NewListPager_quotasListQuotaLimitsForNetwork() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/106483d9f698ac3b6c0d481ab0c5fab14152e21f/specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/getMachineLearningServicesQuotaLimits.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/55c5a0cd6da80b2700333c01e9a9c6067de9cef0/specification/quota/resource-manager/Microsoft.Quota/preview/2024-12-18-preview/examples/getMachineLearningServicesQuotaLimits.json func ExampleClient_NewListPager_quotasListQuotaLimitsMachineLearningServices() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/quota/armquota/client_factory.go b/sdk/resourcemanager/quota/armquota/client_factory.go index 74b5c9a04737..f41a2b25f629 100644 --- a/sdk/resourcemanager/quota/armquota/client_factory.go +++ b/sdk/resourcemanager/quota/armquota/client_factory.go @@ -57,13 +57,6 @@ func (c *ClientFactory) NewGroupQuotaLimitsRequestClient() *GroupQuotaLimitsRequ } } -// NewGroupQuotaLocationSettingsClient creates a new instance of GroupQuotaLocationSettingsClient. -func (c *ClientFactory) NewGroupQuotaLocationSettingsClient() *GroupQuotaLocationSettingsClient { - return &GroupQuotaLocationSettingsClient{ - internal: c.internal, - } -} - // NewGroupQuotaSubscriptionAllocationClient creates a new instance of GroupQuotaSubscriptionAllocationClient. func (c *ClientFactory) NewGroupQuotaSubscriptionAllocationClient() *GroupQuotaSubscriptionAllocationClient { return &GroupQuotaSubscriptionAllocationClient{ @@ -95,13 +88,6 @@ func (c *ClientFactory) NewGroupQuotaSubscriptionsClient() *GroupQuotaSubscripti } } -// NewGroupQuotaUsagesClient creates a new instance of GroupQuotaUsagesClient. -func (c *ClientFactory) NewGroupQuotaUsagesClient() *GroupQuotaUsagesClient { - return &GroupQuotaUsagesClient{ - internal: c.internal, - } -} - // NewGroupQuotasClient creates a new instance of GroupQuotasClient. func (c *ClientFactory) NewGroupQuotasClient() *GroupQuotasClient { return &GroupQuotasClient{ diff --git a/sdk/resourcemanager/quota/armquota/constants.go b/sdk/resourcemanager/quota/armquota/constants.go index 63cce458a857..9bbc1fd5e36f 100644 --- a/sdk/resourcemanager/quota/armquota/constants.go +++ b/sdk/resourcemanager/quota/armquota/constants.go @@ -10,7 +10,7 @@ package armquota const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/quota/armquota" - moduleVersion = "v1.1.0-beta.1" + moduleVersion = "v1.1.0-beta.2" ) // CreatedByType - The type of identity that created the resource. @@ -33,56 +33,6 @@ func PossibleCreatedByTypeValues() []CreatedByType { } } -// EnforcementState - Enforcement status. -type EnforcementState string - -const ( - EnforcementStateDisabled EnforcementState = "Disabled" - EnforcementStateEnabled EnforcementState = "Enabled" - EnforcementStateNotAvailable EnforcementState = "NotAvailable" -) - -// PossibleEnforcementStateValues returns the possible values for the EnforcementState const type. -func PossibleEnforcementStateValues() []EnforcementState { - return []EnforcementState{ - EnforcementStateDisabled, - EnforcementStateEnabled, - EnforcementStateNotAvailable, - } -} - -// EnvironmentType - Environment name. -type EnvironmentType string - -const ( - EnvironmentTypeNonProduction EnvironmentType = "NonProduction" - EnvironmentTypeProduction EnvironmentType = "Production" -) - -// PossibleEnvironmentTypeValues returns the possible values for the EnvironmentType const type. -func PossibleEnvironmentTypeValues() []EnvironmentType { - return []EnvironmentType{ - EnvironmentTypeNonProduction, - EnvironmentTypeProduction, - } -} - -// GroupingIDType - GroupingId type. It is a required property. More types of groupIds can be supported in future. -type GroupingIDType string - -const ( - GroupingIDTypeBillingID GroupingIDType = "BillingId" - GroupingIDTypeServiceTreeID GroupingIDType = "ServiceTreeId" -) - -// PossibleGroupingIDTypeValues returns the possible values for the GroupingIDType const type. -func PossibleGroupingIDTypeValues() []GroupingIDType { - return []GroupingIDType{ - GroupingIDTypeBillingID, - GroupingIDTypeServiceTreeID, - } -} - // LimitType - The limit object type. type LimitType string diff --git a/sdk/resourcemanager/quota/armquota/fake/groupquotalimits_server.go b/sdk/resourcemanager/quota/armquota/fake/groupquotalimits_server.go index d121067217c5..37f2ca943a2d 100644 --- a/sdk/resourcemanager/quota/armquota/fake/groupquotalimits_server.go +++ b/sdk/resourcemanager/quota/armquota/fake/groupquotalimits_server.go @@ -15,7 +15,6 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/quota/armquota" "net/http" "net/url" @@ -24,30 +23,22 @@ import ( // GroupQuotaLimitsServer is a fake server for instances of the armquota.GroupQuotaLimitsClient type. type GroupQuotaLimitsServer struct { - // Get is the fake for method GroupQuotaLimitsClient.Get + // List is the fake for method GroupQuotaLimitsClient.List // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, managementGroupID string, groupQuotaName string, resourceProviderName string, resourceName string, filter string, options *armquota.GroupQuotaLimitsClientGetOptions) (resp azfake.Responder[armquota.GroupQuotaLimitsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method GroupQuotaLimitsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(managementGroupID string, groupQuotaName string, resourceProviderName string, filter string, options *armquota.GroupQuotaLimitsClientListOptions) (resp azfake.PagerResponder[armquota.GroupQuotaLimitsClientListResponse]) + List func(ctx context.Context, managementGroupID string, groupQuotaName string, resourceProviderName string, location string, options *armquota.GroupQuotaLimitsClientListOptions) (resp azfake.Responder[armquota.GroupQuotaLimitsClientListResponse], errResp azfake.ErrorResponder) } // NewGroupQuotaLimitsServerTransport creates a new instance of GroupQuotaLimitsServerTransport with the provided implementation. // The returned GroupQuotaLimitsServerTransport instance is connected to an instance of armquota.GroupQuotaLimitsClient via the // azcore.ClientOptions.Transporter field in the client's constructor parameters. func NewGroupQuotaLimitsServerTransport(srv *GroupQuotaLimitsServer) *GroupQuotaLimitsServerTransport { - return &GroupQuotaLimitsServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armquota.GroupQuotaLimitsClientListResponse]](), - } + return &GroupQuotaLimitsServerTransport{srv: srv} } // GroupQuotaLimitsServerTransport connects instances of armquota.GroupQuotaLimitsClient to instances of GroupQuotaLimitsServer. // Don't use this type directly, use NewGroupQuotaLimitsServerTransport instead. type GroupQuotaLimitsServerTransport struct { - srv *GroupQuotaLimitsServer - newListPager *tracker[azfake.PagerResponder[armquota.GroupQuotaLimitsClientListResponse]] + srv *GroupQuotaLimitsServer } // Do implements the policy.Transporter interface for GroupQuotaLimitsServerTransport. @@ -62,10 +53,8 @@ func (g *GroupQuotaLimitsServerTransport) Do(req *http.Request) (*http.Response, var err error switch method { - case "GroupQuotaLimitsClient.Get": - resp, err = g.dispatchGet(req) - case "GroupQuotaLimitsClient.NewListPager": - resp, err = g.dispatchNewListPager(req) + case "GroupQuotaLimitsClient.List": + resp, err = g.dispatchList(req) default: err = fmt.Errorf("unhandled API %s", method) } @@ -77,17 +66,16 @@ func (g *GroupQuotaLimitsServerTransport) Do(req *http.Request) (*http.Response, return resp, nil } -func (g *GroupQuotaLimitsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if g.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} +func (g *GroupQuotaLimitsServerTransport) dispatchList(req *http.Request) (*http.Response, error) { + if g.srv.List == nil { + return nil, &nonRetriableError{errors.New("fake for method List not implemented")} } - const regexStr = `/providers/Microsoft\.Management/managementGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Quota/groupQuotas/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceProviders/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/groupQuotaLimits/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + const regexStr = `/providers/Microsoft\.Management/managementGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Quota/groupQuotas/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceProviders/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/groupQuotaLimits/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) if matches == nil || len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } - qp := req.URL.Query() managementGroupIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("managementGroupId")]) if err != nil { return nil, err @@ -100,15 +88,11 @@ func (g *GroupQuotaLimitsServerTransport) dispatchGet(req *http.Request) (*http. if err != nil { return nil, err } - resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) - if err != nil { - return nil, err - } - filterParam, err := url.QueryUnescape(qp.Get("$filter")) + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) if err != nil { return nil, err } - respr, errRespr := g.srv.Get(req.Context(), managementGroupIDParam, groupQuotaNameParam, resourceProviderNameParam, resourceNameParam, filterParam, nil) + respr, errRespr := g.srv.List(req.Context(), managementGroupIDParam, groupQuotaNameParam, resourceProviderNameParam, locationParam, nil) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } @@ -116,59 +100,9 @@ func (g *GroupQuotaLimitsServerTransport) dispatchGet(req *http.Request) (*http. if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).GroupQuotaLimit, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (g *GroupQuotaLimitsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if g.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := g.newListPager.get(req) - if newListPager == nil { - const regexStr = `/providers/Microsoft\.Management/managementGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Quota/groupQuotas/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceProviders/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/groupQuotaLimits` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - managementGroupIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("managementGroupId")]) - if err != nil { - return nil, err - } - groupQuotaNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("groupQuotaName")]) - if err != nil { - return nil, err - } - resourceProviderNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceProviderName")]) - if err != nil { - return nil, err - } - filterParam, err := url.QueryUnescape(qp.Get("$filter")) - if err != nil { - return nil, err - } - resp := g.srv.NewListPager(managementGroupIDParam, groupQuotaNameParam, resourceProviderNameParam, filterParam, nil) - newListPager = &resp - g.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armquota.GroupQuotaLimitsClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).GroupQuotaLimitList, req) if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - g.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - g.newListPager.remove(req) - } return resp, nil } diff --git a/sdk/resourcemanager/quota/armquota/fake/groupquotalimitsrequest_server.go b/sdk/resourcemanager/quota/armquota/fake/groupquotalimitsrequest_server.go index e4867fed8eda..365a3a4a1a67 100644 --- a/sdk/resourcemanager/quota/armquota/fake/groupquotalimitsrequest_server.go +++ b/sdk/resourcemanager/quota/armquota/fake/groupquotalimitsrequest_server.go @@ -25,10 +25,6 @@ import ( // GroupQuotaLimitsRequestServer is a fake server for instances of the armquota.GroupQuotaLimitsRequestClient type. type GroupQuotaLimitsRequestServer struct { - // BeginCreateOrUpdate is the fake for method GroupQuotaLimitsRequestClient.BeginCreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreateOrUpdate func(ctx context.Context, managementGroupID string, groupQuotaName string, resourceProviderName string, resourceName string, options *armquota.GroupQuotaLimitsRequestClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armquota.GroupQuotaLimitsRequestClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - // Get is the fake for method GroupQuotaLimitsRequestClient.Get // HTTP status codes to indicate success: http.StatusOK Get func(ctx context.Context, managementGroupID string, groupQuotaName string, requestID string, options *armquota.GroupQuotaLimitsRequestClientGetOptions) (resp azfake.Responder[armquota.GroupQuotaLimitsRequestClientGetResponse], errResp azfake.ErrorResponder) @@ -39,7 +35,7 @@ type GroupQuotaLimitsRequestServer struct { // BeginUpdate is the fake for method GroupQuotaLimitsRequestClient.BeginUpdate // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginUpdate func(ctx context.Context, managementGroupID string, groupQuotaName string, resourceProviderName string, resourceName string, options *armquota.GroupQuotaLimitsRequestClientBeginUpdateOptions) (resp azfake.PollerResponder[armquota.GroupQuotaLimitsRequestClientUpdateResponse], errResp azfake.ErrorResponder) + BeginUpdate func(ctx context.Context, managementGroupID string, groupQuotaName string, resourceProviderName string, location string, options *armquota.GroupQuotaLimitsRequestClientBeginUpdateOptions) (resp azfake.PollerResponder[armquota.GroupQuotaLimitsRequestClientUpdateResponse], errResp azfake.ErrorResponder) } // NewGroupQuotaLimitsRequestServerTransport creates a new instance of GroupQuotaLimitsRequestServerTransport with the provided implementation. @@ -47,20 +43,18 @@ type GroupQuotaLimitsRequestServer struct { // azcore.ClientOptions.Transporter field in the client's constructor parameters. func NewGroupQuotaLimitsRequestServerTransport(srv *GroupQuotaLimitsRequestServer) *GroupQuotaLimitsRequestServerTransport { return &GroupQuotaLimitsRequestServerTransport{ - srv: srv, - beginCreateOrUpdate: newTracker[azfake.PollerResponder[armquota.GroupQuotaLimitsRequestClientCreateOrUpdateResponse]](), - newListPager: newTracker[azfake.PagerResponder[armquota.GroupQuotaLimitsRequestClientListResponse]](), - beginUpdate: newTracker[azfake.PollerResponder[armquota.GroupQuotaLimitsRequestClientUpdateResponse]](), + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armquota.GroupQuotaLimitsRequestClientListResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armquota.GroupQuotaLimitsRequestClientUpdateResponse]](), } } // GroupQuotaLimitsRequestServerTransport connects instances of armquota.GroupQuotaLimitsRequestClient to instances of GroupQuotaLimitsRequestServer. // Don't use this type directly, use NewGroupQuotaLimitsRequestServerTransport instead. type GroupQuotaLimitsRequestServerTransport struct { - srv *GroupQuotaLimitsRequestServer - beginCreateOrUpdate *tracker[azfake.PollerResponder[armquota.GroupQuotaLimitsRequestClientCreateOrUpdateResponse]] - newListPager *tracker[azfake.PagerResponder[armquota.GroupQuotaLimitsRequestClientListResponse]] - beginUpdate *tracker[azfake.PollerResponder[armquota.GroupQuotaLimitsRequestClientUpdateResponse]] + srv *GroupQuotaLimitsRequestServer + newListPager *tracker[azfake.PagerResponder[armquota.GroupQuotaLimitsRequestClientListResponse]] + beginUpdate *tracker[azfake.PollerResponder[armquota.GroupQuotaLimitsRequestClientUpdateResponse]] } // Do implements the policy.Transporter interface for GroupQuotaLimitsRequestServerTransport. @@ -75,8 +69,6 @@ func (g *GroupQuotaLimitsRequestServerTransport) Do(req *http.Request) (*http.Re var err error switch method { - case "GroupQuotaLimitsRequestClient.BeginCreateOrUpdate": - resp, err = g.dispatchBeginCreateOrUpdate(req) case "GroupQuotaLimitsRequestClient.Get": resp, err = g.dispatchGet(req) case "GroupQuotaLimitsRequestClient.NewListPager": @@ -94,68 +86,6 @@ func (g *GroupQuotaLimitsRequestServerTransport) Do(req *http.Request) (*http.Re return resp, nil } -func (g *GroupQuotaLimitsRequestServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { - if g.srv.BeginCreateOrUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} - } - beginCreateOrUpdate := g.beginCreateOrUpdate.get(req) - if beginCreateOrUpdate == nil { - const regexStr = `/providers/Microsoft\.Management/managementGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Quota/groupQuotas/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceProviders/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/groupQuotaRequests/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armquota.SubmittedResourceRequestStatus](req) - if err != nil { - return nil, err - } - managementGroupIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("managementGroupId")]) - if err != nil { - return nil, err - } - groupQuotaNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("groupQuotaName")]) - if err != nil { - return nil, err - } - resourceProviderNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceProviderName")]) - if err != nil { - return nil, err - } - resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) - if err != nil { - return nil, err - } - var options *armquota.GroupQuotaLimitsRequestClientBeginCreateOrUpdateOptions - if !reflect.ValueOf(body).IsZero() { - options = &armquota.GroupQuotaLimitsRequestClientBeginCreateOrUpdateOptions{ - GroupQuotaRequest: &body, - } - } - respr, errRespr := g.srv.BeginCreateOrUpdate(req.Context(), managementGroupIDParam, groupQuotaNameParam, resourceProviderNameParam, resourceNameParam, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginCreateOrUpdate = &respr - g.beginCreateOrUpdate.add(req, beginCreateOrUpdate) - } - - resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { - g.beginCreateOrUpdate.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} - } - if !server.PollerResponderMore(beginCreateOrUpdate) { - g.beginCreateOrUpdate.remove(req) - } - - return resp, nil -} - func (g *GroupQuotaLimitsRequestServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { if g.srv.Get == nil { return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} @@ -249,13 +179,13 @@ func (g *GroupQuotaLimitsRequestServerTransport) dispatchBeginUpdate(req *http.R } beginUpdate := g.beginUpdate.get(req) if beginUpdate == nil { - const regexStr = `/providers/Microsoft\.Management/managementGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Quota/groupQuotas/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceProviders/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/groupQuotaRequests/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + const regexStr = `/providers/Microsoft\.Management/managementGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Quota/groupQuotas/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceProviders/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/groupQuotaLimits/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) if matches == nil || len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } - body, err := server.UnmarshalRequestAsJSON[armquota.SubmittedResourceRequestStatus](req) + body, err := server.UnmarshalRequestAsJSON[armquota.GroupQuotaLimitList](req) if err != nil { return nil, err } @@ -271,7 +201,7 @@ func (g *GroupQuotaLimitsRequestServerTransport) dispatchBeginUpdate(req *http.R if err != nil { return nil, err } - resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) if err != nil { return nil, err } @@ -281,7 +211,7 @@ func (g *GroupQuotaLimitsRequestServerTransport) dispatchBeginUpdate(req *http.R GroupQuotaRequest: &body, } } - respr, errRespr := g.srv.BeginUpdate(req.Context(), managementGroupIDParam, groupQuotaNameParam, resourceProviderNameParam, resourceNameParam, options) + respr, errRespr := g.srv.BeginUpdate(req.Context(), managementGroupIDParam, groupQuotaNameParam, resourceProviderNameParam, locationParam, options) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } diff --git a/sdk/resourcemanager/quota/armquota/fake/groupquotalocationsettings_server.go b/sdk/resourcemanager/quota/armquota/fake/groupquotalocationsettings_server.go deleted file mode 100644 index a3986e3ff132..000000000000 --- a/sdk/resourcemanager/quota/armquota/fake/groupquotalocationsettings_server.go +++ /dev/null @@ -1,305 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/quota/armquota" - "net/http" - "net/url" - "reflect" - "regexp" -) - -// GroupQuotaLocationSettingsServer is a fake server for instances of the armquota.GroupQuotaLocationSettingsClient type. -type GroupQuotaLocationSettingsServer struct { - // BeginCreateOrUpdate is the fake for method GroupQuotaLocationSettingsClient.BeginCreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreateOrUpdate func(ctx context.Context, managementGroupID string, groupQuotaName string, resourceProviderName string, location string, options *armquota.GroupQuotaLocationSettingsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armquota.GroupQuotaLocationSettingsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method GroupQuotaLocationSettingsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, managementGroupID string, groupQuotaName string, resourceProviderName string, location string, options *armquota.GroupQuotaLocationSettingsClientGetOptions) (resp azfake.Responder[armquota.GroupQuotaLocationSettingsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method GroupQuotaLocationSettingsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(managementGroupID string, groupQuotaName string, resourceProviderName string, options *armquota.GroupQuotaLocationSettingsClientListOptions) (resp azfake.PagerResponder[armquota.GroupQuotaLocationSettingsClientListResponse]) - - // BeginUpdate is the fake for method GroupQuotaLocationSettingsClient.BeginUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginUpdate func(ctx context.Context, managementGroupID string, groupQuotaName string, resourceProviderName string, location string, options *armquota.GroupQuotaLocationSettingsClientBeginUpdateOptions) (resp azfake.PollerResponder[armquota.GroupQuotaLocationSettingsClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewGroupQuotaLocationSettingsServerTransport creates a new instance of GroupQuotaLocationSettingsServerTransport with the provided implementation. -// The returned GroupQuotaLocationSettingsServerTransport instance is connected to an instance of armquota.GroupQuotaLocationSettingsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewGroupQuotaLocationSettingsServerTransport(srv *GroupQuotaLocationSettingsServer) *GroupQuotaLocationSettingsServerTransport { - return &GroupQuotaLocationSettingsServerTransport{ - srv: srv, - beginCreateOrUpdate: newTracker[azfake.PollerResponder[armquota.GroupQuotaLocationSettingsClientCreateOrUpdateResponse]](), - newListPager: newTracker[azfake.PagerResponder[armquota.GroupQuotaLocationSettingsClientListResponse]](), - beginUpdate: newTracker[azfake.PollerResponder[armquota.GroupQuotaLocationSettingsClientUpdateResponse]](), - } -} - -// GroupQuotaLocationSettingsServerTransport connects instances of armquota.GroupQuotaLocationSettingsClient to instances of GroupQuotaLocationSettingsServer. -// Don't use this type directly, use NewGroupQuotaLocationSettingsServerTransport instead. -type GroupQuotaLocationSettingsServerTransport struct { - srv *GroupQuotaLocationSettingsServer - beginCreateOrUpdate *tracker[azfake.PollerResponder[armquota.GroupQuotaLocationSettingsClientCreateOrUpdateResponse]] - newListPager *tracker[azfake.PagerResponder[armquota.GroupQuotaLocationSettingsClientListResponse]] - beginUpdate *tracker[azfake.PollerResponder[armquota.GroupQuotaLocationSettingsClientUpdateResponse]] -} - -// Do implements the policy.Transporter interface for GroupQuotaLocationSettingsServerTransport. -func (g *GroupQuotaLocationSettingsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "GroupQuotaLocationSettingsClient.BeginCreateOrUpdate": - resp, err = g.dispatchBeginCreateOrUpdate(req) - case "GroupQuotaLocationSettingsClient.Get": - resp, err = g.dispatchGet(req) - case "GroupQuotaLocationSettingsClient.NewListPager": - resp, err = g.dispatchNewListPager(req) - case "GroupQuotaLocationSettingsClient.BeginUpdate": - resp, err = g.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (g *GroupQuotaLocationSettingsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { - if g.srv.BeginCreateOrUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} - } - beginCreateOrUpdate := g.beginCreateOrUpdate.get(req) - if beginCreateOrUpdate == nil { - const regexStr = `/providers/Microsoft\.Management/managementGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Quota/groupQuotas/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceProviders/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/locationSettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armquota.GroupQuotasEnforcementResponse](req) - if err != nil { - return nil, err - } - managementGroupIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("managementGroupId")]) - if err != nil { - return nil, err - } - groupQuotaNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("groupQuotaName")]) - if err != nil { - return nil, err - } - resourceProviderNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceProviderName")]) - if err != nil { - return nil, err - } - locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) - if err != nil { - return nil, err - } - var options *armquota.GroupQuotaLocationSettingsClientBeginCreateOrUpdateOptions - if !reflect.ValueOf(body).IsZero() { - options = &armquota.GroupQuotaLocationSettingsClientBeginCreateOrUpdateOptions{ - LocationSettings: &body, - } - } - respr, errRespr := g.srv.BeginCreateOrUpdate(req.Context(), managementGroupIDParam, groupQuotaNameParam, resourceProviderNameParam, locationParam, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginCreateOrUpdate = &respr - g.beginCreateOrUpdate.add(req, beginCreateOrUpdate) - } - - resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { - g.beginCreateOrUpdate.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} - } - if !server.PollerResponderMore(beginCreateOrUpdate) { - g.beginCreateOrUpdate.remove(req) - } - - return resp, nil -} - -func (g *GroupQuotaLocationSettingsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if g.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/providers/Microsoft\.Management/managementGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Quota/groupQuotas/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceProviders/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/locationSettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - managementGroupIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("managementGroupId")]) - if err != nil { - return nil, err - } - groupQuotaNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("groupQuotaName")]) - if err != nil { - return nil, err - } - resourceProviderNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceProviderName")]) - if err != nil { - return nil, err - } - locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) - if err != nil { - return nil, err - } - respr, errRespr := g.srv.Get(req.Context(), managementGroupIDParam, groupQuotaNameParam, resourceProviderNameParam, locationParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).GroupQuotasEnforcementResponse, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (g *GroupQuotaLocationSettingsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if g.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := g.newListPager.get(req) - if newListPager == nil { - const regexStr = `/providers/Microsoft\.Management/managementGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Quota/groupQuotas/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceProviders/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/locationSettings` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - managementGroupIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("managementGroupId")]) - if err != nil { - return nil, err - } - groupQuotaNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("groupQuotaName")]) - if err != nil { - return nil, err - } - resourceProviderNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceProviderName")]) - if err != nil { - return nil, err - } - resp := g.srv.NewListPager(managementGroupIDParam, groupQuotaNameParam, resourceProviderNameParam, nil) - newListPager = &resp - g.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armquota.GroupQuotaLocationSettingsClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - g.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - g.newListPager.remove(req) - } - return resp, nil -} - -func (g *GroupQuotaLocationSettingsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { - if g.srv.BeginUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} - } - beginUpdate := g.beginUpdate.get(req) - if beginUpdate == nil { - const regexStr = `/providers/Microsoft\.Management/managementGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Quota/groupQuotas/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceProviders/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/locationSettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armquota.GroupQuotasEnforcementResponse](req) - if err != nil { - return nil, err - } - managementGroupIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("managementGroupId")]) - if err != nil { - return nil, err - } - groupQuotaNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("groupQuotaName")]) - if err != nil { - return nil, err - } - resourceProviderNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceProviderName")]) - if err != nil { - return nil, err - } - locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) - if err != nil { - return nil, err - } - var options *armquota.GroupQuotaLocationSettingsClientBeginUpdateOptions - if !reflect.ValueOf(body).IsZero() { - options = &armquota.GroupQuotaLocationSettingsClientBeginUpdateOptions{ - LocationSettings: &body, - } - } - respr, errRespr := g.srv.BeginUpdate(req.Context(), managementGroupIDParam, groupQuotaNameParam, resourceProviderNameParam, locationParam, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginUpdate = &respr - g.beginUpdate.add(req, beginUpdate) - } - - resp, err := server.PollerResponderNext(beginUpdate, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { - g.beginUpdate.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} - } - if !server.PollerResponderMore(beginUpdate) { - g.beginUpdate.remove(req) - } - - return resp, nil -} diff --git a/sdk/resourcemanager/quota/armquota/fake/groupquotasubscriptionallocation_server.go b/sdk/resourcemanager/quota/armquota/fake/groupquotasubscriptionallocation_server.go index 58b5f62f0048..b10d51c80e0b 100644 --- a/sdk/resourcemanager/quota/armquota/fake/groupquotasubscriptionallocation_server.go +++ b/sdk/resourcemanager/quota/armquota/fake/groupquotasubscriptionallocation_server.go @@ -15,7 +15,6 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/quota/armquota" "net/http" "net/url" @@ -24,30 +23,22 @@ import ( // GroupQuotaSubscriptionAllocationServer is a fake server for instances of the armquota.GroupQuotaSubscriptionAllocationClient type. type GroupQuotaSubscriptionAllocationServer struct { - // Get is the fake for method GroupQuotaSubscriptionAllocationClient.Get + // List is the fake for method GroupQuotaSubscriptionAllocationClient.List // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, managementGroupID string, groupQuotaName string, resourceName string, filter string, options *armquota.GroupQuotaSubscriptionAllocationClientGetOptions) (resp azfake.Responder[armquota.GroupQuotaSubscriptionAllocationClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method GroupQuotaSubscriptionAllocationClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(managementGroupID string, groupQuotaName string, filter string, options *armquota.GroupQuotaSubscriptionAllocationClientListOptions) (resp azfake.PagerResponder[armquota.GroupQuotaSubscriptionAllocationClientListResponse]) + List func(ctx context.Context, managementGroupID string, groupQuotaName string, resourceProviderName string, location string, options *armquota.GroupQuotaSubscriptionAllocationClientListOptions) (resp azfake.Responder[armquota.GroupQuotaSubscriptionAllocationClientListResponse], errResp azfake.ErrorResponder) } // NewGroupQuotaSubscriptionAllocationServerTransport creates a new instance of GroupQuotaSubscriptionAllocationServerTransport with the provided implementation. // The returned GroupQuotaSubscriptionAllocationServerTransport instance is connected to an instance of armquota.GroupQuotaSubscriptionAllocationClient via the // azcore.ClientOptions.Transporter field in the client's constructor parameters. func NewGroupQuotaSubscriptionAllocationServerTransport(srv *GroupQuotaSubscriptionAllocationServer) *GroupQuotaSubscriptionAllocationServerTransport { - return &GroupQuotaSubscriptionAllocationServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armquota.GroupQuotaSubscriptionAllocationClientListResponse]](), - } + return &GroupQuotaSubscriptionAllocationServerTransport{srv: srv} } // GroupQuotaSubscriptionAllocationServerTransport connects instances of armquota.GroupQuotaSubscriptionAllocationClient to instances of GroupQuotaSubscriptionAllocationServer. // Don't use this type directly, use NewGroupQuotaSubscriptionAllocationServerTransport instead. type GroupQuotaSubscriptionAllocationServerTransport struct { - srv *GroupQuotaSubscriptionAllocationServer - newListPager *tracker[azfake.PagerResponder[armquota.GroupQuotaSubscriptionAllocationClientListResponse]] + srv *GroupQuotaSubscriptionAllocationServer } // Do implements the policy.Transporter interface for GroupQuotaSubscriptionAllocationServerTransport. @@ -62,10 +53,8 @@ func (g *GroupQuotaSubscriptionAllocationServerTransport) Do(req *http.Request) var err error switch method { - case "GroupQuotaSubscriptionAllocationClient.Get": - resp, err = g.dispatchGet(req) - case "GroupQuotaSubscriptionAllocationClient.NewListPager": - resp, err = g.dispatchNewListPager(req) + case "GroupQuotaSubscriptionAllocationClient.List": + resp, err = g.dispatchList(req) default: err = fmt.Errorf("unhandled API %s", method) } @@ -77,17 +66,16 @@ func (g *GroupQuotaSubscriptionAllocationServerTransport) Do(req *http.Request) return resp, nil } -func (g *GroupQuotaSubscriptionAllocationServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if g.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} +func (g *GroupQuotaSubscriptionAllocationServerTransport) dispatchList(req *http.Request) (*http.Response, error) { + if g.srv.List == nil { + return nil, &nonRetriableError{errors.New("fake for method List not implemented")} } - const regexStr = `/providers/Microsoft\.Management/managementGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Quota/groupQuotas/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/quotaAllocations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + const regexStr = `/providers/Microsoft\.Management/managementGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Quota/groupQuotas/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceProviders/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/quotaAllocations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if matches == nil || len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } - qp := req.URL.Query() managementGroupIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("managementGroupId")]) if err != nil { return nil, err @@ -96,15 +84,15 @@ func (g *GroupQuotaSubscriptionAllocationServerTransport) dispatchGet(req *http. if err != nil { return nil, err } - resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + resourceProviderNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceProviderName")]) if err != nil { return nil, err } - filterParam, err := url.QueryUnescape(qp.Get("$filter")) + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) if err != nil { return nil, err } - respr, errRespr := g.srv.Get(req.Context(), managementGroupIDParam, groupQuotaNameParam, resourceNameParam, filterParam, nil) + respr, errRespr := g.srv.List(req.Context(), managementGroupIDParam, groupQuotaNameParam, resourceProviderNameParam, locationParam, nil) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } @@ -112,55 +100,9 @@ func (g *GroupQuotaSubscriptionAllocationServerTransport) dispatchGet(req *http. if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SubscriptionQuotaAllocations, req) + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SubscriptionQuotaAllocationsList, req) if err != nil { return nil, err } return resp, nil } - -func (g *GroupQuotaSubscriptionAllocationServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if g.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := g.newListPager.get(req) - if newListPager == nil { - const regexStr = `/providers/Microsoft\.Management/managementGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Quota/groupQuotas/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/quotaAllocations` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - managementGroupIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("managementGroupId")]) - if err != nil { - return nil, err - } - groupQuotaNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("groupQuotaName")]) - if err != nil { - return nil, err - } - filterParam, err := url.QueryUnescape(qp.Get("$filter")) - if err != nil { - return nil, err - } - resp := g.srv.NewListPager(managementGroupIDParam, groupQuotaNameParam, filterParam, nil) - newListPager = &resp - g.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armquota.GroupQuotaSubscriptionAllocationClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - g.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - g.newListPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/quota/armquota/fake/groupquotasubscriptionallocationrequest_server.go b/sdk/resourcemanager/quota/armquota/fake/groupquotasubscriptionallocationrequest_server.go index 6a5204a9e238..f8f008190531 100644 --- a/sdk/resourcemanager/quota/armquota/fake/groupquotasubscriptionallocationrequest_server.go +++ b/sdk/resourcemanager/quota/armquota/fake/groupquotasubscriptionallocationrequest_server.go @@ -24,13 +24,9 @@ import ( // GroupQuotaSubscriptionAllocationRequestServer is a fake server for instances of the armquota.GroupQuotaSubscriptionAllocationRequestClient type. type GroupQuotaSubscriptionAllocationRequestServer struct { - // BeginCreateOrUpdate is the fake for method GroupQuotaSubscriptionAllocationRequestClient.BeginCreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreateOrUpdate func(ctx context.Context, managementGroupID string, groupQuotaName string, resourceProviderName string, resourceName string, allocateQuotaRequest armquota.AllocationRequestStatus, options *armquota.GroupQuotaSubscriptionAllocationRequestClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armquota.GroupQuotaSubscriptionAllocationRequestClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - // Get is the fake for method GroupQuotaSubscriptionAllocationRequestClient.Get // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, managementGroupID string, groupQuotaName string, allocationID string, options *armquota.GroupQuotaSubscriptionAllocationRequestClientGetOptions) (resp azfake.Responder[armquota.GroupQuotaSubscriptionAllocationRequestClientGetResponse], errResp azfake.ErrorResponder) + Get func(ctx context.Context, managementGroupID string, groupQuotaName string, resourceProviderName string, allocationID string, options *armquota.GroupQuotaSubscriptionAllocationRequestClientGetOptions) (resp azfake.Responder[armquota.GroupQuotaSubscriptionAllocationRequestClientGetResponse], errResp azfake.ErrorResponder) // NewListPager is the fake for method GroupQuotaSubscriptionAllocationRequestClient.NewListPager // HTTP status codes to indicate success: http.StatusOK @@ -38,7 +34,7 @@ type GroupQuotaSubscriptionAllocationRequestServer struct { // BeginUpdate is the fake for method GroupQuotaSubscriptionAllocationRequestClient.BeginUpdate // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginUpdate func(ctx context.Context, managementGroupID string, groupQuotaName string, resourceProviderName string, resourceName string, allocateQuotaRequest armquota.AllocationRequestStatus, options *armquota.GroupQuotaSubscriptionAllocationRequestClientBeginUpdateOptions) (resp azfake.PollerResponder[armquota.GroupQuotaSubscriptionAllocationRequestClientUpdateResponse], errResp azfake.ErrorResponder) + BeginUpdate func(ctx context.Context, managementGroupID string, groupQuotaName string, resourceProviderName string, location string, allocateQuotaRequest armquota.SubscriptionQuotaAllocationsList, options *armquota.GroupQuotaSubscriptionAllocationRequestClientBeginUpdateOptions) (resp azfake.PollerResponder[armquota.GroupQuotaSubscriptionAllocationRequestClientUpdateResponse], errResp azfake.ErrorResponder) } // NewGroupQuotaSubscriptionAllocationRequestServerTransport creates a new instance of GroupQuotaSubscriptionAllocationRequestServerTransport with the provided implementation. @@ -46,20 +42,18 @@ type GroupQuotaSubscriptionAllocationRequestServer struct { // azcore.ClientOptions.Transporter field in the client's constructor parameters. func NewGroupQuotaSubscriptionAllocationRequestServerTransport(srv *GroupQuotaSubscriptionAllocationRequestServer) *GroupQuotaSubscriptionAllocationRequestServerTransport { return &GroupQuotaSubscriptionAllocationRequestServerTransport{ - srv: srv, - beginCreateOrUpdate: newTracker[azfake.PollerResponder[armquota.GroupQuotaSubscriptionAllocationRequestClientCreateOrUpdateResponse]](), - newListPager: newTracker[azfake.PagerResponder[armquota.GroupQuotaSubscriptionAllocationRequestClientListResponse]](), - beginUpdate: newTracker[azfake.PollerResponder[armquota.GroupQuotaSubscriptionAllocationRequestClientUpdateResponse]](), + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armquota.GroupQuotaSubscriptionAllocationRequestClientListResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armquota.GroupQuotaSubscriptionAllocationRequestClientUpdateResponse]](), } } // GroupQuotaSubscriptionAllocationRequestServerTransport connects instances of armquota.GroupQuotaSubscriptionAllocationRequestClient to instances of GroupQuotaSubscriptionAllocationRequestServer. // Don't use this type directly, use NewGroupQuotaSubscriptionAllocationRequestServerTransport instead. type GroupQuotaSubscriptionAllocationRequestServerTransport struct { - srv *GroupQuotaSubscriptionAllocationRequestServer - beginCreateOrUpdate *tracker[azfake.PollerResponder[armquota.GroupQuotaSubscriptionAllocationRequestClientCreateOrUpdateResponse]] - newListPager *tracker[azfake.PagerResponder[armquota.GroupQuotaSubscriptionAllocationRequestClientListResponse]] - beginUpdate *tracker[azfake.PollerResponder[armquota.GroupQuotaSubscriptionAllocationRequestClientUpdateResponse]] + srv *GroupQuotaSubscriptionAllocationRequestServer + newListPager *tracker[azfake.PagerResponder[armquota.GroupQuotaSubscriptionAllocationRequestClientListResponse]] + beginUpdate *tracker[azfake.PollerResponder[armquota.GroupQuotaSubscriptionAllocationRequestClientUpdateResponse]] } // Do implements the policy.Transporter interface for GroupQuotaSubscriptionAllocationRequestServerTransport. @@ -74,8 +68,6 @@ func (g *GroupQuotaSubscriptionAllocationRequestServerTransport) Do(req *http.Re var err error switch method { - case "GroupQuotaSubscriptionAllocationRequestClient.BeginCreateOrUpdate": - resp, err = g.dispatchBeginCreateOrUpdate(req) case "GroupQuotaSubscriptionAllocationRequestClient.Get": resp, err = g.dispatchGet(req) case "GroupQuotaSubscriptionAllocationRequestClient.NewListPager": @@ -93,70 +85,14 @@ func (g *GroupQuotaSubscriptionAllocationRequestServerTransport) Do(req *http.Re return resp, nil } -func (g *GroupQuotaSubscriptionAllocationRequestServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { - if g.srv.BeginCreateOrUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} - } - beginCreateOrUpdate := g.beginCreateOrUpdate.get(req) - if beginCreateOrUpdate == nil { - const regexStr = `/providers/Microsoft\.Management/managementGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Quota/groupQuotas/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceProviders/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/quotaAllocationRequests/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armquota.AllocationRequestStatus](req) - if err != nil { - return nil, err - } - managementGroupIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("managementGroupId")]) - if err != nil { - return nil, err - } - groupQuotaNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("groupQuotaName")]) - if err != nil { - return nil, err - } - resourceProviderNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceProviderName")]) - if err != nil { - return nil, err - } - resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) - if err != nil { - return nil, err - } - respr, errRespr := g.srv.BeginCreateOrUpdate(req.Context(), managementGroupIDParam, groupQuotaNameParam, resourceProviderNameParam, resourceNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginCreateOrUpdate = &respr - g.beginCreateOrUpdate.add(req, beginCreateOrUpdate) - } - - resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { - g.beginCreateOrUpdate.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} - } - if !server.PollerResponderMore(beginCreateOrUpdate) { - g.beginCreateOrUpdate.remove(req) - } - - return resp, nil -} - func (g *GroupQuotaSubscriptionAllocationRequestServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { if g.srv.Get == nil { return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} } - const regexStr = `/providers/Microsoft\.Management/managementGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Quota/groupQuotas/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/quotaAllocationRequests/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + const regexStr = `/providers/Microsoft\.Management/managementGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Quota/groupQuotas/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceProviders/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/quotaAllocationRequests/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if matches == nil || len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } managementGroupIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("managementGroupId")]) @@ -167,11 +103,15 @@ func (g *GroupQuotaSubscriptionAllocationRequestServerTransport) dispatchGet(req if err != nil { return nil, err } + resourceProviderNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceProviderName")]) + if err != nil { + return nil, err + } allocationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("allocationId")]) if err != nil { return nil, err } - respr, errRespr := g.srv.Get(req.Context(), managementGroupIDParam, groupQuotaNameParam, allocationIDParam, nil) + respr, errRespr := g.srv.Get(req.Context(), managementGroupIDParam, groupQuotaNameParam, resourceProviderNameParam, allocationIDParam, nil) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } @@ -242,13 +182,13 @@ func (g *GroupQuotaSubscriptionAllocationRequestServerTransport) dispatchBeginUp } beginUpdate := g.beginUpdate.get(req) if beginUpdate == nil { - const regexStr = `/providers/Microsoft\.Management/managementGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Quota/groupQuotas/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceProviders/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/quotaAllocationRequests/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + const regexStr = `/providers/Microsoft\.Management/managementGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Quota/groupQuotas/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceProviders/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/quotaAllocations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) if matches == nil || len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } - body, err := server.UnmarshalRequestAsJSON[armquota.AllocationRequestStatus](req) + body, err := server.UnmarshalRequestAsJSON[armquota.SubscriptionQuotaAllocationsList](req) if err != nil { return nil, err } @@ -264,11 +204,11 @@ func (g *GroupQuotaSubscriptionAllocationRequestServerTransport) dispatchBeginUp if err != nil { return nil, err } - resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) if err != nil { return nil, err } - respr, errRespr := g.srv.BeginUpdate(req.Context(), managementGroupIDParam, groupQuotaNameParam, resourceProviderNameParam, resourceNameParam, body, nil) + respr, errRespr := g.srv.BeginUpdate(req.Context(), managementGroupIDParam, groupQuotaNameParam, resourceProviderNameParam, locationParam, body, nil) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } diff --git a/sdk/resourcemanager/quota/armquota/fake/groupquotausages_server.go b/sdk/resourcemanager/quota/armquota/fake/groupquotausages_server.go deleted file mode 100644 index a20d6d7f5a2f..000000000000 --- a/sdk/resourcemanager/quota/armquota/fake/groupquotausages_server.go +++ /dev/null @@ -1,120 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/quota/armquota" - "net/http" - "net/url" - "regexp" -) - -// GroupQuotaUsagesServer is a fake server for instances of the armquota.GroupQuotaUsagesClient type. -type GroupQuotaUsagesServer struct { - // NewListPager is the fake for method GroupQuotaUsagesClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(managementGroupID string, groupQuotaName string, resourceProviderName string, location string, options *armquota.GroupQuotaUsagesClientListOptions) (resp azfake.PagerResponder[armquota.GroupQuotaUsagesClientListResponse]) -} - -// NewGroupQuotaUsagesServerTransport creates a new instance of GroupQuotaUsagesServerTransport with the provided implementation. -// The returned GroupQuotaUsagesServerTransport instance is connected to an instance of armquota.GroupQuotaUsagesClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewGroupQuotaUsagesServerTransport(srv *GroupQuotaUsagesServer) *GroupQuotaUsagesServerTransport { - return &GroupQuotaUsagesServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armquota.GroupQuotaUsagesClientListResponse]](), - } -} - -// GroupQuotaUsagesServerTransport connects instances of armquota.GroupQuotaUsagesClient to instances of GroupQuotaUsagesServer. -// Don't use this type directly, use NewGroupQuotaUsagesServerTransport instead. -type GroupQuotaUsagesServerTransport struct { - srv *GroupQuotaUsagesServer - newListPager *tracker[azfake.PagerResponder[armquota.GroupQuotaUsagesClientListResponse]] -} - -// Do implements the policy.Transporter interface for GroupQuotaUsagesServerTransport. -func (g *GroupQuotaUsagesServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "GroupQuotaUsagesClient.NewListPager": - resp, err = g.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (g *GroupQuotaUsagesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if g.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := g.newListPager.get(req) - if newListPager == nil { - const regexStr = `/providers/Microsoft\.Management/managementGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Quota/groupQuotas/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceProviders/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/locationUsages/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - managementGroupIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("managementGroupId")]) - if err != nil { - return nil, err - } - groupQuotaNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("groupQuotaName")]) - if err != nil { - return nil, err - } - resourceProviderNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceProviderName")]) - if err != nil { - return nil, err - } - locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) - if err != nil { - return nil, err - } - resp := g.srv.NewListPager(managementGroupIDParam, groupQuotaNameParam, resourceProviderNameParam, locationParam, nil) - newListPager = &resp - g.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armquota.GroupQuotaUsagesClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - g.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - g.newListPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/quota/armquota/fake/server_factory.go b/sdk/resourcemanager/quota/armquota/fake/server_factory.go index 2e351dff5aa6..01a721260827 100644 --- a/sdk/resourcemanager/quota/armquota/fake/server_factory.go +++ b/sdk/resourcemanager/quota/armquota/fake/server_factory.go @@ -22,12 +22,10 @@ type ServerFactory struct { Server Server GroupQuotaLimitsServer GroupQuotaLimitsServer GroupQuotaLimitsRequestServer GroupQuotaLimitsRequestServer - GroupQuotaLocationSettingsServer GroupQuotaLocationSettingsServer GroupQuotaSubscriptionAllocationServer GroupQuotaSubscriptionAllocationServer GroupQuotaSubscriptionAllocationRequestServer GroupQuotaSubscriptionAllocationRequestServer GroupQuotaSubscriptionRequestsServer GroupQuotaSubscriptionRequestsServer GroupQuotaSubscriptionsServer GroupQuotaSubscriptionsServer - GroupQuotaUsagesServer GroupQuotaUsagesServer GroupQuotasServer GroupQuotasServer OperationServer OperationServer RequestStatusServer RequestStatusServer @@ -51,12 +49,10 @@ type ServerFactoryTransport struct { trServer *ServerTransport trGroupQuotaLimitsServer *GroupQuotaLimitsServerTransport trGroupQuotaLimitsRequestServer *GroupQuotaLimitsRequestServerTransport - trGroupQuotaLocationSettingsServer *GroupQuotaLocationSettingsServerTransport trGroupQuotaSubscriptionAllocationServer *GroupQuotaSubscriptionAllocationServerTransport trGroupQuotaSubscriptionAllocationRequestServer *GroupQuotaSubscriptionAllocationRequestServerTransport trGroupQuotaSubscriptionRequestsServer *GroupQuotaSubscriptionRequestsServerTransport trGroupQuotaSubscriptionsServer *GroupQuotaSubscriptionsServerTransport - trGroupQuotaUsagesServer *GroupQuotaUsagesServerTransport trGroupQuotasServer *GroupQuotasServerTransport trOperationServer *OperationServerTransport trRequestStatusServer *RequestStatusServerTransport @@ -89,11 +85,6 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { return NewGroupQuotaLimitsRequestServerTransport(&s.srv.GroupQuotaLimitsRequestServer) }) resp, err = s.trGroupQuotaLimitsRequestServer.Do(req) - case "GroupQuotaLocationSettingsClient": - initServer(s, &s.trGroupQuotaLocationSettingsServer, func() *GroupQuotaLocationSettingsServerTransport { - return NewGroupQuotaLocationSettingsServerTransport(&s.srv.GroupQuotaLocationSettingsServer) - }) - resp, err = s.trGroupQuotaLocationSettingsServer.Do(req) case "GroupQuotaSubscriptionAllocationClient": initServer(s, &s.trGroupQuotaSubscriptionAllocationServer, func() *GroupQuotaSubscriptionAllocationServerTransport { return NewGroupQuotaSubscriptionAllocationServerTransport(&s.srv.GroupQuotaSubscriptionAllocationServer) @@ -114,11 +105,6 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { return NewGroupQuotaSubscriptionsServerTransport(&s.srv.GroupQuotaSubscriptionsServer) }) resp, err = s.trGroupQuotaSubscriptionsServer.Do(req) - case "GroupQuotaUsagesClient": - initServer(s, &s.trGroupQuotaUsagesServer, func() *GroupQuotaUsagesServerTransport { - return NewGroupQuotaUsagesServerTransport(&s.srv.GroupQuotaUsagesServer) - }) - resp, err = s.trGroupQuotaUsagesServer.Do(req) case "GroupQuotasClient": initServer(s, &s.trGroupQuotasServer, func() *GroupQuotasServerTransport { return NewGroupQuotasServerTransport(&s.srv.GroupQuotasServer) }) resp, err = s.trGroupQuotasServer.Do(req) diff --git a/sdk/resourcemanager/quota/armquota/groupquotalimits_client.go b/sdk/resourcemanager/quota/armquota/groupquotalimits_client.go index 48092bf9c758..4306c52d4932 100644 --- a/sdk/resourcemanager/quota/armquota/groupquotalimits_client.go +++ b/sdk/resourcemanager/quota/armquota/groupquotalimits_client.go @@ -40,122 +40,42 @@ func NewGroupQuotaLimitsClient(credential azcore.TokenCredential, options *arm.C return client, nil } -// Get - Gets the GroupQuotaLimits for the specific resource for a specific resource based on the resourceProviders, resourceName -// and $filter passed. The $filter=location eq {location} is required to location -// specific resources groupQuota. +// List - Gets the GroupQuotaLimits for the specified resource provider and location for resource names passed in $filter=resourceName +// eq {SKU}. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2024-12-18-preview // - managementGroupID - Management Group Id. // - groupQuotaName - The GroupQuota name. The name should be unique for the provided context tenantId/MgId. // - resourceProviderName - The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource // provider supports this API. -// - resourceName - Resource name. -// - filter - FIELD SUPPORTED OPERATORS -// location eq {location} -// Example: $filter=location eq eastus -// - options - GroupQuotaLimitsClientGetOptions contains the optional parameters for the GroupQuotaLimitsClient.Get method. -func (client *GroupQuotaLimitsClient) Get(ctx context.Context, managementGroupID string, groupQuotaName string, resourceProviderName string, resourceName string, filter string, options *GroupQuotaLimitsClientGetOptions) (GroupQuotaLimitsClientGetResponse, error) { +// - location - The name of the Azure region. +// - options - GroupQuotaLimitsClientListOptions contains the optional parameters for the GroupQuotaLimitsClient.List method. +func (client *GroupQuotaLimitsClient) List(ctx context.Context, managementGroupID string, groupQuotaName string, resourceProviderName string, location string, options *GroupQuotaLimitsClientListOptions) (GroupQuotaLimitsClientListResponse, error) { var err error - const operationName = "GroupQuotaLimitsClient.Get" + const operationName = "GroupQuotaLimitsClient.List" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, managementGroupID, groupQuotaName, resourceProviderName, resourceName, filter, options) + req, err := client.listCreateRequest(ctx, managementGroupID, groupQuotaName, resourceProviderName, location, options) if err != nil { - return GroupQuotaLimitsClientGetResponse{}, err + return GroupQuotaLimitsClientListResponse{}, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return GroupQuotaLimitsClientGetResponse{}, err + return GroupQuotaLimitsClientListResponse{}, err } if !runtime.HasStatusCode(httpResp, http.StatusOK) { err = runtime.NewResponseError(httpResp) - return GroupQuotaLimitsClientGetResponse{}, err + return GroupQuotaLimitsClientListResponse{}, err } - resp, err := client.getHandleResponse(httpResp) + resp, err := client.listHandleResponse(httpResp) return resp, err } -// getCreateRequest creates the Get request. -func (client *GroupQuotaLimitsClient) getCreateRequest(ctx context.Context, managementGroupID string, groupQuotaName string, resourceProviderName string, resourceName string, filter string, options *GroupQuotaLimitsClientGetOptions) (*policy.Request, error) { - urlPath := "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/groupQuotaLimits/{resourceName}" - if managementGroupID == "" { - return nil, errors.New("parameter managementGroupID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{managementGroupId}", url.PathEscape(managementGroupID)) - if groupQuotaName == "" { - return nil, errors.New("parameter groupQuotaName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{groupQuotaName}", url.PathEscape(groupQuotaName)) - if resourceProviderName == "" { - return nil, errors.New("parameter resourceProviderName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceProviderName}", url.PathEscape(resourceProviderName)) - if resourceName == "" { - return nil, errors.New("parameter resourceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("$filter", filter) - reqQP.Set("api-version", "2023-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *GroupQuotaLimitsClient) getHandleResponse(resp *http.Response) (GroupQuotaLimitsClientGetResponse, error) { - result := GroupQuotaLimitsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.GroupQuotaLimit); err != nil { - return GroupQuotaLimitsClientGetResponse{}, err - } - return result, nil -} - -// NewListPager - Gets the GroupQuotaLimits for the all resource for a specific resourceProvider and $filter passed. The $filter=location -// eq {location} is required to location specific resources groupQuota. -// -// Generated from API version 2023-06-01-preview -// - managementGroupID - Management Group Id. -// - groupQuotaName - The GroupQuota name. The name should be unique for the provided context tenantId/MgId. -// - resourceProviderName - The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource -// provider supports this API. -// - filter - FIELD SUPPORTED OPERATORS -// location eq {location} -// Example: $filter=location eq eastus -// - options - GroupQuotaLimitsClientListOptions contains the optional parameters for the GroupQuotaLimitsClient.NewListPager -// method. -func (client *GroupQuotaLimitsClient) NewListPager(managementGroupID string, groupQuotaName string, resourceProviderName string, filter string, options *GroupQuotaLimitsClientListOptions) *runtime.Pager[GroupQuotaLimitsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[GroupQuotaLimitsClientListResponse]{ - More: func(page GroupQuotaLimitsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *GroupQuotaLimitsClientListResponse) (GroupQuotaLimitsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "GroupQuotaLimitsClient.NewListPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, managementGroupID, groupQuotaName, resourceProviderName, filter, options) - }, nil) - if err != nil { - return GroupQuotaLimitsClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - // listCreateRequest creates the List request. -func (client *GroupQuotaLimitsClient) listCreateRequest(ctx context.Context, managementGroupID string, groupQuotaName string, resourceProviderName string, filter string, options *GroupQuotaLimitsClientListOptions) (*policy.Request, error) { - urlPath := "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/groupQuotaLimits" +func (client *GroupQuotaLimitsClient) listCreateRequest(ctx context.Context, managementGroupID string, groupQuotaName string, resourceProviderName string, location string, options *GroupQuotaLimitsClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/groupQuotaLimits/{location}" if managementGroupID == "" { return nil, errors.New("parameter managementGroupID cannot be empty") } @@ -168,13 +88,16 @@ func (client *GroupQuotaLimitsClient) listCreateRequest(ctx context.Context, man return nil, errors.New("parameter resourceProviderName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceProviderName}", url.PathEscape(resourceProviderName)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("$filter", filter) - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2024-12-18-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/quota/armquota/groupquotalimits_client_example_test.go b/sdk/resourcemanager/quota/armquota/groupquotalimits_client_example_test.go index db9b5d8f3752..616af609307d 100644 --- a/sdk/resourcemanager/quota/armquota/groupquotalimits_client_example_test.go +++ b/sdk/resourcemanager/quota/armquota/groupquotalimits_client_example_test.go @@ -17,8 +17,8 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/quota/armquota" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/106483d9f698ac3b6c0d481ab0c5fab14152e21f/specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotaLimits/GetGroupQuotaLimits-Compute.json -func ExampleGroupQuotaLimitsClient_Get() { +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/55c5a0cd6da80b2700333c01e9a9c6067de9cef0/specification/quota/resource-manager/Microsoft.Quota/preview/2024-12-18-preview/examples/GroupQuotaLimits/ListGroupQuotaLimits-Compute.json +func ExampleGroupQuotaLimitsClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) @@ -28,109 +28,62 @@ func ExampleGroupQuotaLimitsClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewGroupQuotaLimitsClient().Get(ctx, "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", "groupquota1", "Microsoft.Compute", "cores", "location eq westus", nil) + res, err := clientFactory.NewGroupQuotaLimitsClient().List(ctx, "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", "groupquota1", "Microsoft.Compute", "westus", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } // You could use response here. We use blank identifier for just demo purposes. _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GroupQuotaLimit = armquota.GroupQuotaLimit{ - // Name: to.Ptr("cores"), + // res.GroupQuotaLimitList = armquota.GroupQuotaLimitList{ + // Name: to.Ptr("westus"), // Type: to.Ptr("Microsoft.Quota/groupQuotas/groupQuotaLimits"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/E7EC67B3-7657-4966-BFFC-41EFD36BAA09/providers/Microsoft.Quota/groupQuotas/groupquota1/providers/Microsoft.Compute/locations/westus/groupQuotaLimits/cores"), - // Properties: &armquota.GroupQuotaDetails{ - // Name: &armquota.GroupQuotaDetailsName{ - // LocalizedValue: to.Ptr("Total vCPUs Regional Cores"), - // Value: to.Ptr("cores"), - // }, - // AllocatedToSubscriptions: &armquota.AllocatedQuotaToSubscriptionList{ - // Value: []*armquota.AllocatedToSubscription{ - // { - // QuotaAllocated: to.Ptr[int64](20), - // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }}, - // }, - // AvailableLimit: to.Ptr[int64](80), - // Limit: to.Ptr[int64](100), - // Region: to.Ptr("westus"), - // Unit: to.Ptr("count"), + // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/E7EC67B3-7657-4966-BFFC-41EFD36BAA09/providers/Microsoft.Quota/groupQuotas/groupquota1/resourceProviders/Microsoft.Compute/groupQuotaLimits/westus"), + // Properties: &armquota.GroupQuotaLimitListProperties{ + // ProvisioningState: to.Ptr(armquota.RequestStateSucceeded), + // Value: []*armquota.GroupQuotaLimit{ + // { + // Properties: &armquota.GroupQuotaLimitProperties{ + // Name: &armquota.GroupQuotaDetailsName{ + // LocalizedValue: to.Ptr("standard DDv4 Family vCPUs"), + // Value: to.Ptr("standardddv4family"), + // }, + // AllocatedToSubscriptions: &armquota.AllocatedQuotaToSubscriptionList{ + // Value: []*armquota.AllocatedToSubscription{ + // { + // QuotaAllocated: to.Ptr[int64](20), + // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // }, + // { + // QuotaAllocated: to.Ptr[int64](30), + // SubscriptionID: to.Ptr("A000000-0000-0000-0000-000000000000"), + // }}, + // }, + // AvailableLimit: to.Ptr[int64](50), + // Limit: to.Ptr[int64](100), + // ResourceName: to.Ptr("standardddv4family"), + // Unit: to.Ptr("count"), + // }, + // }, + // { + // Properties: &armquota.GroupQuotaLimitProperties{ + // Name: &armquota.GroupQuotaDetailsName{ + // LocalizedValue: to.Ptr("Standard AV2 Family vCPUs"), + // Value: to.Ptr("standardav2family"), + // }, + // AllocatedToSubscriptions: &armquota.AllocatedQuotaToSubscriptionList{ + // Value: []*armquota.AllocatedToSubscription{ + // { + // QuotaAllocated: to.Ptr[int64](20), + // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // }}, + // }, + // AvailableLimit: to.Ptr[int64](80), + // Limit: to.Ptr[int64](100), + // ResourceName: to.Ptr("standardav2family"), + // Unit: to.Ptr("count"), + // }, + // }}, // }, // } } - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/106483d9f698ac3b6c0d481ab0c5fab14152e21f/specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotaLimits/ListGroupQuotaLimits-Compute.json -func ExampleGroupQuotaLimitsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armquota.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewGroupQuotaLimitsClient().NewListPager("E7EC67B3-7657-4966-BFFC-41EFD36BAA09", "groupquota1", "Microsoft.Compute", "location eq westus", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.GroupQuotaLimitList = armquota.GroupQuotaLimitList{ - // Value: []*armquota.GroupQuotaLimit{ - // { - // Name: to.Ptr("cores"), - // Type: to.Ptr("Microsoft.Quota/groupQuotas/groupQuotaLimits"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/E7EC67B3-7657-4966-BFFC-41EFD36BAA09/providers/Microsoft.Quota/groupQuotas/groupquota1/providers/Microsoft.Compute/locations/westus/groupQuotaLimits/cores"), - // Properties: &armquota.GroupQuotaDetails{ - // Name: &armquota.GroupQuotaDetailsName{ - // LocalizedValue: to.Ptr("standard DDv4 Family vCPUs"), - // Value: to.Ptr("standardddv4family"), - // }, - // AllocatedToSubscriptions: &armquota.AllocatedQuotaToSubscriptionList{ - // Value: []*armquota.AllocatedToSubscription{ - // { - // QuotaAllocated: to.Ptr[int64](20), - // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // { - // QuotaAllocated: to.Ptr[int64](30), - // SubscriptionID: to.Ptr("A000000-0000-0000-0000-000000000000"), - // }}, - // }, - // AvailableLimit: to.Ptr[int64](50), - // Limit: to.Ptr[int64](100), - // Region: to.Ptr("westus"), - // Unit: to.Ptr("count"), - // }, - // }, - // { - // Name: to.Ptr("standardav2family"), - // Type: to.Ptr("Microsoft.Quota/groupQuotas/groupQuotaLimits"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/E7EC67B3-7657-4966-BFFC-41EFD36BAA09/providers/Microsoft.Quota/groupQuotas/groupquota1/providers/Microsoft.Compute/locations/westus/groupQuotaLimits/standardav2family"), - // Properties: &armquota.GroupQuotaDetails{ - // Name: &armquota.GroupQuotaDetailsName{ - // LocalizedValue: to.Ptr("Standard AV2 Family vCPUs"), - // Value: to.Ptr("standardav2family"), - // }, - // AllocatedToSubscriptions: &armquota.AllocatedQuotaToSubscriptionList{ - // Value: []*armquota.AllocatedToSubscription{ - // { - // QuotaAllocated: to.Ptr[int64](20), - // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }}, - // }, - // AvailableLimit: to.Ptr[int64](80), - // Limit: to.Ptr[int64](100), - // Region: to.Ptr("westus"), - // Unit: to.Ptr("count"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/quota/armquota/groupquotalimitsrequest_client.go b/sdk/resourcemanager/quota/armquota/groupquotalimitsrequest_client.go index 710702432b4e..2d93970cbb28 100644 --- a/sdk/resourcemanager/quota/armquota/groupquotalimitsrequest_client.go +++ b/sdk/resourcemanager/quota/armquota/groupquotalimitsrequest_client.go @@ -40,108 +40,10 @@ func NewGroupQuotaLimitsRequestClient(credential azcore.TokenCredential, options return client, nil } -// BeginCreateOrUpdate - Put the GroupQuota requests for a specific ResourceProvider/Location/Resource. the location and resourceName -// ("name": {"value" : "resourceName") properties are specified in the request body. Only 1 -// resource quota can be requested. 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. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -// - managementGroupID - Management Group Id. -// - groupQuotaName - The GroupQuota name. The name should be unique for the provided context tenantId/MgId. -// - resourceProviderName - The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource -// provider supports this API. -// - resourceName - Resource name. -// - options - GroupQuotaLimitsRequestClientBeginCreateOrUpdateOptions contains the optional parameters for the GroupQuotaLimitsRequestClient.BeginCreateOrUpdate -// method. -func (client *GroupQuotaLimitsRequestClient) BeginCreateOrUpdate(ctx context.Context, managementGroupID string, groupQuotaName string, resourceProviderName string, resourceName string, options *GroupQuotaLimitsRequestClientBeginCreateOrUpdateOptions) (*runtime.Poller[GroupQuotaLimitsRequestClientCreateOrUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.createOrUpdate(ctx, managementGroupID, groupQuotaName, resourceProviderName, resourceName, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[GroupQuotaLimitsRequestClientCreateOrUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[GroupQuotaLimitsRequestClientCreateOrUpdateResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// CreateOrUpdate - Put the GroupQuota requests for a specific ResourceProvider/Location/Resource. the location and resourceName -// ("name": {"value" : "resourceName") properties are specified in the request body. Only 1 -// resource quota can be requested. 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. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -func (client *GroupQuotaLimitsRequestClient) createOrUpdate(ctx context.Context, managementGroupID string, groupQuotaName string, resourceProviderName string, resourceName string, options *GroupQuotaLimitsRequestClientBeginCreateOrUpdateOptions) (*http.Response, error) { - var err error - const operationName = "GroupQuotaLimitsRequestClient.BeginCreateOrUpdate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createOrUpdateCreateRequest(ctx, managementGroupID, groupQuotaName, resourceProviderName, resourceName, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *GroupQuotaLimitsRequestClient) createOrUpdateCreateRequest(ctx context.Context, managementGroupID string, groupQuotaName string, resourceProviderName string, resourceName string, options *GroupQuotaLimitsRequestClientBeginCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/groupQuotaRequests/{resourceName}" - if managementGroupID == "" { - return nil, errors.New("parameter managementGroupID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{managementGroupId}", url.PathEscape(managementGroupID)) - if groupQuotaName == "" { - return nil, errors.New("parameter groupQuotaName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{groupQuotaName}", url.PathEscape(groupQuotaName)) - if resourceProviderName == "" { - return nil, errors.New("parameter resourceProviderName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceProviderName}", url.PathEscape(resourceProviderName)) - if resourceName == "" { - return nil, errors.New("parameter resourceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.GroupQuotaRequest != nil { - if err := runtime.MarshalAsJSON(req, *options.GroupQuotaRequest); err != nil { - return nil, err - } - return req, nil - } - return req, nil -} - // Get - Get API to check the status of a GroupQuota request by requestId. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2024-12-18-preview // - managementGroupID - Management Group Id. // - groupQuotaName - The GroupQuota name. The name should be unique for the provided context tenantId/MgId. // - requestID - Request Id. @@ -189,7 +91,7 @@ func (client *GroupQuotaLimitsRequestClient) getCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2024-12-18-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -206,7 +108,7 @@ func (client *GroupQuotaLimitsRequestClient) getHandleResponse(resp *http.Respon // NewListPager - Get API to check the status of a GroupQuota request by requestId. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2024-12-18-preview // - managementGroupID - Management Group Id. // - groupQuotaName - The GroupQuota name. The name should be unique for the provided context tenantId/MgId. // - resourceProviderName - The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource @@ -260,7 +162,7 @@ func (client *GroupQuotaLimitsRequestClient) listCreateRequest(ctx context.Conte } reqQP := req.Raw().URL.Query() reqQP.Set("$filter", filter) - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2024-12-18-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -275,24 +177,24 @@ func (client *GroupQuotaLimitsRequestClient) listHandleResponse(resp *http.Respo return result, nil } -// BeginUpdate - Create the GroupQuota requests for a specific ResourceProvider/Location/Resource. the location and resourceName -// properties are specified in the request body. Only 1 resource quota can be requested. -// Please note that patch request creates a new groupQuota request. 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. +// BeginUpdate - Create the GroupQuota requests for a specific ResourceProvider/Location/Resource. The resourceName properties +// are specified in the request body. Only 1 resource quota can be requested. Please note +// that patch request creates a new groupQuota request. 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. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2024-12-18-preview // - managementGroupID - Management Group Id. // - groupQuotaName - The GroupQuota name. The name should be unique for the provided context tenantId/MgId. // - resourceProviderName - The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource // provider supports this API. -// - resourceName - Resource name. +// - location - The name of the Azure region. // - options - GroupQuotaLimitsRequestClientBeginUpdateOptions contains the optional parameters for the GroupQuotaLimitsRequestClient.BeginUpdate // method. -func (client *GroupQuotaLimitsRequestClient) BeginUpdate(ctx context.Context, managementGroupID string, groupQuotaName string, resourceProviderName string, resourceName string, options *GroupQuotaLimitsRequestClientBeginUpdateOptions) (*runtime.Poller[GroupQuotaLimitsRequestClientUpdateResponse], error) { +func (client *GroupQuotaLimitsRequestClient) BeginUpdate(ctx context.Context, managementGroupID string, groupQuotaName string, resourceProviderName string, location string, options *GroupQuotaLimitsRequestClientBeginUpdateOptions) (*runtime.Poller[GroupQuotaLimitsRequestClientUpdateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.update(ctx, managementGroupID, groupQuotaName, resourceProviderName, resourceName, options) + resp, err := client.update(ctx, managementGroupID, groupQuotaName, resourceProviderName, location, options) if err != nil { return nil, err } @@ -308,21 +210,21 @@ func (client *GroupQuotaLimitsRequestClient) BeginUpdate(ctx context.Context, ma } } -// Update - Create the GroupQuota requests for a specific ResourceProvider/Location/Resource. the location and resourceName -// properties are specified in the request body. Only 1 resource quota can be requested. -// Please note that patch request creates a new groupQuota request. 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. +// Update - Create the GroupQuota requests for a specific ResourceProvider/Location/Resource. The resourceName properties +// are specified in the request body. Only 1 resource quota can be requested. Please note +// that patch request creates a new groupQuota request. 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. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview -func (client *GroupQuotaLimitsRequestClient) update(ctx context.Context, managementGroupID string, groupQuotaName string, resourceProviderName string, resourceName string, options *GroupQuotaLimitsRequestClientBeginUpdateOptions) (*http.Response, error) { +// Generated from API version 2024-12-18-preview +func (client *GroupQuotaLimitsRequestClient) update(ctx context.Context, managementGroupID string, groupQuotaName string, resourceProviderName string, location string, options *GroupQuotaLimitsRequestClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "GroupQuotaLimitsRequestClient.BeginUpdate" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.updateCreateRequest(ctx, managementGroupID, groupQuotaName, resourceProviderName, resourceName, options) + req, err := client.updateCreateRequest(ctx, managementGroupID, groupQuotaName, resourceProviderName, location, options) if err != nil { return nil, err } @@ -338,8 +240,8 @@ func (client *GroupQuotaLimitsRequestClient) update(ctx context.Context, managem } // updateCreateRequest creates the Update request. -func (client *GroupQuotaLimitsRequestClient) updateCreateRequest(ctx context.Context, managementGroupID string, groupQuotaName string, resourceProviderName string, resourceName string, options *GroupQuotaLimitsRequestClientBeginUpdateOptions) (*policy.Request, error) { - urlPath := "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/groupQuotaRequests/{resourceName}" +func (client *GroupQuotaLimitsRequestClient) updateCreateRequest(ctx context.Context, managementGroupID string, groupQuotaName string, resourceProviderName string, location string, options *GroupQuotaLimitsRequestClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/groupQuotaLimits/{location}" if managementGroupID == "" { return nil, errors.New("parameter managementGroupID cannot be empty") } @@ -352,16 +254,16 @@ func (client *GroupQuotaLimitsRequestClient) updateCreateRequest(ctx context.Con return nil, errors.New("parameter resourceProviderName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceProviderName}", url.PathEscape(resourceProviderName)) - if resourceName == "" { - return nil, errors.New("parameter resourceName cannot be empty") + if location == "" { + return nil, errors.New("parameter location cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2024-12-18-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.GroupQuotaRequest != nil { diff --git a/sdk/resourcemanager/quota/armquota/groupquotalimitsrequest_client_example_test.go b/sdk/resourcemanager/quota/armquota/groupquotalimitsrequest_client_example_test.go index 5deaef304c53..817a9885fef9 100644 --- a/sdk/resourcemanager/quota/armquota/groupquotalimitsrequest_client_example_test.go +++ b/sdk/resourcemanager/quota/armquota/groupquotalimitsrequest_client_example_test.go @@ -13,55 +13,12 @@ import ( "context" "log" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/quota/armquota" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/106483d9f698ac3b6c0d481ab0c5fab14152e21f/specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotaLimitsRequests/PutGroupQuotaLimitsRequests-Compute.json -func ExampleGroupQuotaLimitsRequestClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armquota.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGroupQuotaLimitsRequestClient().BeginCreateOrUpdate(ctx, "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", "groupquota1", "Microsoft.Compute", "standardav2family", &armquota.GroupQuotaLimitsRequestClientBeginCreateOrUpdateOptions{GroupQuotaRequest: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SubmittedResourceRequestStatus = armquota.SubmittedResourceRequestStatus{ - // Name: to.Ptr("requestId1"), - // Type: to.Ptr("Microsoft.Quota/groupQuotas/groupQuotaLimitsRequests"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/E7EC67B3-7657-4966-BFFC-41EFD36BAA09/providers/Microsoft.Quota/groupQuotas/groupquota1/resourceProviders/Microsoft.Compute/groupQuotaLimitsRequests/requestId1"), - // Properties: &armquota.SubmittedResourceRequestStatusProperties{ - // ProvisioningState: to.Ptr(armquota.RequestStateSucceeded), - // RequestSubmitTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-03-08T12:09:27.978Z"); return t}()), - // RequestedResource: &armquota.GroupQuotaRequestBase{ - // Properties: &armquota.GroupQuotaRequestBaseProperties{ - // Name: &armquota.GroupQuotaRequestBasePropertiesName{ - // LocalizedValue: to.Ptr("Standard AV2 Family vCPUs"), - // Value: to.Ptr("standardav2family"), - // }, - // Comments: to.Ptr("Contoso requires more quota."), - // Limit: to.Ptr[int64](100), - // Region: to.Ptr("westus"), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/106483d9f698ac3b6c0d481ab0c5fab14152e21f/specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotaLimitsRequests/PatchGroupQuotaLimitsRequests-Compute.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/55c5a0cd6da80b2700333c01e9a9c6067de9cef0/specification/quota/resource-manager/Microsoft.Quota/preview/2024-12-18-preview/examples/GroupQuotaLimitsRequests/PatchGroupQuotaLimitsRequests-Compute.json func ExampleGroupQuotaLimitsRequestClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -72,7 +29,26 @@ func ExampleGroupQuotaLimitsRequestClient_BeginUpdate() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewGroupQuotaLimitsRequestClient().BeginUpdate(ctx, "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", "groupquota1", "Microsoft.Compute", "standardav2family", &armquota.GroupQuotaLimitsRequestClientBeginUpdateOptions{GroupQuotaRequest: nil}) + poller, err := clientFactory.NewGroupQuotaLimitsRequestClient().BeginUpdate(ctx, "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", "groupquota1", "Microsoft.Compute", "westus", &armquota.GroupQuotaLimitsRequestClientBeginUpdateOptions{GroupQuotaRequest: &armquota.GroupQuotaLimitList{ + Properties: &armquota.GroupQuotaLimitListProperties{ + Value: []*armquota.GroupQuotaLimit{ + { + Properties: &armquota.GroupQuotaLimitProperties{ + Comment: to.Ptr("Contoso requires more quota."), + Limit: to.Ptr[int64](110), + ResourceName: to.Ptr("standardddv4family"), + }, + }, + { + Properties: &armquota.GroupQuotaLimitProperties{ + Comment: to.Ptr("Contoso requires more quota."), + Limit: to.Ptr[int64](110), + ResourceName: to.Ptr("standardav2family"), + }, + }}, + }, + }, + }) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -83,29 +59,60 @@ func ExampleGroupQuotaLimitsRequestClient_BeginUpdate() { // You could use response here. We use blank identifier for just demo purposes. _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SubmittedResourceRequestStatus = armquota.SubmittedResourceRequestStatus{ - // Name: to.Ptr("requestId1"), - // Type: to.Ptr("Microsoft.Quota/groupQuotas/groupQuotaLimitsRequests"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/E7EC67B3-7657-4966-BFFC-41EFD36BAA09/providers/Microsoft.Quota/groupQuotas/groupquota1/resourceProviders/Microsoft.Compute/groupQuotaLimitsRequests/requestId1"), - // Properties: &armquota.SubmittedResourceRequestStatusProperties{ + // res.GroupQuotaLimitList = armquota.GroupQuotaLimitList{ + // Name: to.Ptr("westus"), + // Type: to.Ptr("Microsoft.Quota/groupQuotas/groupQuotaLimits"), + // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/E7EC67B3-7657-4966-BFFC-41EFD36BAA09/providers/Microsoft.Quota/groupQuotas/groupquota1/resourceProviders/Microsoft.Compute/groupQuotaLimits/westus"), + // Properties: &armquota.GroupQuotaLimitListProperties{ // ProvisioningState: to.Ptr(armquota.RequestStateSucceeded), - // RequestSubmitTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-03-08T12:09:27.978Z"); return t}()), - // RequestedResource: &armquota.GroupQuotaRequestBase{ - // Properties: &armquota.GroupQuotaRequestBaseProperties{ - // Name: &armquota.GroupQuotaRequestBasePropertiesName{ - // LocalizedValue: to.Ptr("Standard AV2 Family vCPUs"), - // Value: to.Ptr("standardav2family"), + // Value: []*armquota.GroupQuotaLimit{ + // { + // Properties: &armquota.GroupQuotaLimitProperties{ + // Name: &armquota.GroupQuotaDetailsName{ + // LocalizedValue: to.Ptr("standard DDv4 Family vCPUs"), + // Value: to.Ptr("standardddv4family"), + // }, + // AllocatedToSubscriptions: &armquota.AllocatedQuotaToSubscriptionList{ + // Value: []*armquota.AllocatedToSubscription{ + // { + // QuotaAllocated: to.Ptr[int64](20), + // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // }, + // { + // QuotaAllocated: to.Ptr[int64](30), + // SubscriptionID: to.Ptr("A000000-0000-0000-0000-000000000000"), + // }}, + // }, + // AvailableLimit: to.Ptr[int64](50), + // Limit: to.Ptr[int64](100), + // ResourceName: to.Ptr("standardddv4family"), + // Unit: to.Ptr("count"), // }, - // Comments: to.Ptr("Contoso requires more quota."), - // Limit: to.Ptr[int64](100), - // Region: to.Ptr("westus"), // }, - // }, + // { + // Properties: &armquota.GroupQuotaLimitProperties{ + // Name: &armquota.GroupQuotaDetailsName{ + // LocalizedValue: to.Ptr("Standard AV2 Family vCPUs"), + // Value: to.Ptr("standardav2family"), + // }, + // AllocatedToSubscriptions: &armquota.AllocatedQuotaToSubscriptionList{ + // Value: []*armquota.AllocatedToSubscription{ + // { + // QuotaAllocated: to.Ptr[int64](20), + // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // }}, + // }, + // AvailableLimit: to.Ptr[int64](80), + // Limit: to.Ptr[int64](100), + // ResourceName: to.Ptr("standardav2family"), + // Unit: to.Ptr("count"), + // }, + // }}, // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/106483d9f698ac3b6c0d481ab0c5fab14152e21f/specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotaLimitsRequests/GroupQuotaLimitsRequests_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/55c5a0cd6da80b2700333c01e9a9c6067de9cef0/specification/quota/resource-manager/Microsoft.Quota/preview/2024-12-18-preview/examples/GroupQuotaLimitsRequests/GroupQuotaLimitsRequests_Get.json func ExampleGroupQuotaLimitsRequestClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -146,7 +153,7 @@ func ExampleGroupQuotaLimitsRequestClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/106483d9f698ac3b6c0d481ab0c5fab14152e21f/specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotaLimitsRequests/GroupQuotaLimitsRequests_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/55c5a0cd6da80b2700333c01e9a9c6067de9cef0/specification/quota/resource-manager/Microsoft.Quota/preview/2024-12-18-preview/examples/GroupQuotaLimitsRequests/GroupQuotaLimitsRequests_List.json func ExampleGroupQuotaLimitsRequestClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/quota/armquota/groupquotalocationsettings_client.go b/sdk/resourcemanager/quota/armquota/groupquotalocationsettings_client.go deleted file mode 100644 index 79de7bf55ccc..000000000000 --- a/sdk/resourcemanager/quota/armquota/groupquotalocationsettings_client.go +++ /dev/null @@ -1,393 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armquota - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// GroupQuotaLocationSettingsClient contains the methods for the GroupQuotaLocationSettings group. -// Don't use this type directly, use NewGroupQuotaLocationSettingsClient() instead. -type GroupQuotaLocationSettingsClient struct { - internal *arm.Client -} - -// NewGroupQuotaLocationSettingsClient creates a new instance of GroupQuotaLocationSettingsClient with the specified values. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewGroupQuotaLocationSettingsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*GroupQuotaLocationSettingsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &GroupQuotaLocationSettingsClient{ - internal: cl, - } - return client, nil -} - -// BeginCreateOrUpdate - Enables the GroupQuotas enforcement for the resource provider and the location specified. The resource -// provider will start using the group quotas as the overall quota for the subscriptions included in -// the GroupQuota. The subscriptions cannot request quota at subscription level. The subscriptions share the GroupQuotaLimits -// assigned to the GroupQuota. If the GroupQuotaLimits is used, then submit a -// groupQuotaLimit request for the specific resource - provider/location/resource. Once the GroupQuota Enforcement is enabled -// then, it cannot be deleted or reverted back. To disable GroupQuota -// Enforcement - -// 1. Remove all the subscriptions from the groupQuota using the delete API for Subscriptions (Check the example - GroupQuotaSubscriptions_Delete). -// 2. Ten delete the GroupQuota (Check the example - GroupQuotas_Delete). -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -// - managementGroupID - Management Group Id. -// - groupQuotaName - The GroupQuota name. The name should be unique for the provided context tenantId/MgId. -// - resourceProviderName - The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource -// provider supports this API. -// - location - The name of the Azure region. -// - options - GroupQuotaLocationSettingsClientBeginCreateOrUpdateOptions contains the optional parameters for the GroupQuotaLocationSettingsClient.BeginCreateOrUpdate -// method. -func (client *GroupQuotaLocationSettingsClient) BeginCreateOrUpdate(ctx context.Context, managementGroupID string, groupQuotaName string, resourceProviderName string, location string, options *GroupQuotaLocationSettingsClientBeginCreateOrUpdateOptions) (*runtime.Poller[GroupQuotaLocationSettingsClientCreateOrUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.createOrUpdate(ctx, managementGroupID, groupQuotaName, resourceProviderName, location, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[GroupQuotaLocationSettingsClientCreateOrUpdateResponse]{ - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[GroupQuotaLocationSettingsClientCreateOrUpdateResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// CreateOrUpdate - Enables the GroupQuotas enforcement for the resource provider and the location specified. The resource -// provider will start using the group quotas as the overall quota for the subscriptions included in -// the GroupQuota. The subscriptions cannot request quota at subscription level. The subscriptions share the GroupQuotaLimits -// assigned to the GroupQuota. If the GroupQuotaLimits is used, then submit a -// groupQuotaLimit request for the specific resource - provider/location/resource. Once the GroupQuota Enforcement is enabled -// then, it cannot be deleted or reverted back. To disable GroupQuota -// Enforcement - -// 1. Remove all the subscriptions from the groupQuota using the delete API for Subscriptions (Check the example - GroupQuotaSubscriptions_Delete). -// 2. Ten delete the GroupQuota (Check the example - GroupQuotas_Delete). -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -func (client *GroupQuotaLocationSettingsClient) createOrUpdate(ctx context.Context, managementGroupID string, groupQuotaName string, resourceProviderName string, location string, options *GroupQuotaLocationSettingsClientBeginCreateOrUpdateOptions) (*http.Response, error) { - var err error - const operationName = "GroupQuotaLocationSettingsClient.BeginCreateOrUpdate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createOrUpdateCreateRequest(ctx, managementGroupID, groupQuotaName, resourceProviderName, location, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *GroupQuotaLocationSettingsClient) createOrUpdateCreateRequest(ctx context.Context, managementGroupID string, groupQuotaName string, resourceProviderName string, location string, options *GroupQuotaLocationSettingsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/locationSettings/{location}" - if managementGroupID == "" { - return nil, errors.New("parameter managementGroupID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{managementGroupId}", url.PathEscape(managementGroupID)) - if groupQuotaName == "" { - return nil, errors.New("parameter groupQuotaName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{groupQuotaName}", url.PathEscape(groupQuotaName)) - if resourceProviderName == "" { - return nil, errors.New("parameter resourceProviderName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceProviderName}", url.PathEscape(resourceProviderName)) - if location == "" { - return nil, errors.New("parameter location cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.LocationSettings != nil { - if err := runtime.MarshalAsJSON(req, *options.LocationSettings); err != nil { - return nil, err - } - return req, nil - } - return req, nil -} - -// Get - Gets the GroupQuotas enforcement settings for the ResourceProvider/location. The locations, where GroupQuota enforcement -// is not enabled will return Not Found. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -// - managementGroupID - Management Group Id. -// - groupQuotaName - The GroupQuota name. The name should be unique for the provided context tenantId/MgId. -// - resourceProviderName - The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource -// provider supports this API. -// - location - The name of the Azure region. -// - options - GroupQuotaLocationSettingsClientGetOptions contains the optional parameters for the GroupQuotaLocationSettingsClient.Get -// method. -func (client *GroupQuotaLocationSettingsClient) Get(ctx context.Context, managementGroupID string, groupQuotaName string, resourceProviderName string, location string, options *GroupQuotaLocationSettingsClientGetOptions) (GroupQuotaLocationSettingsClientGetResponse, error) { - var err error - const operationName = "GroupQuotaLocationSettingsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, managementGroupID, groupQuotaName, resourceProviderName, location, options) - if err != nil { - return GroupQuotaLocationSettingsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return GroupQuotaLocationSettingsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return GroupQuotaLocationSettingsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *GroupQuotaLocationSettingsClient) getCreateRequest(ctx context.Context, managementGroupID string, groupQuotaName string, resourceProviderName string, location string, options *GroupQuotaLocationSettingsClientGetOptions) (*policy.Request, error) { - urlPath := "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/locationSettings/{location}" - if managementGroupID == "" { - return nil, errors.New("parameter managementGroupID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{managementGroupId}", url.PathEscape(managementGroupID)) - if groupQuotaName == "" { - return nil, errors.New("parameter groupQuotaName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{groupQuotaName}", url.PathEscape(groupQuotaName)) - if resourceProviderName == "" { - return nil, errors.New("parameter resourceProviderName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceProviderName}", url.PathEscape(resourceProviderName)) - if location == "" { - return nil, errors.New("parameter location cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *GroupQuotaLocationSettingsClient) getHandleResponse(resp *http.Response) (GroupQuotaLocationSettingsClientGetResponse, error) { - result := GroupQuotaLocationSettingsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.GroupQuotasEnforcementResponse); err != nil { - return GroupQuotaLocationSettingsClientGetResponse{}, err - } - return result, nil -} - -// NewListPager - Returns only the list of the Azure regions settings, where the GroupQuotas enforcement is enabled. The locations -// not included in GroupQuota Enforcement will not be listed, the regions in failed status -// with listed as status Failed. -// -// Generated from API version 2023-06-01-preview -// - managementGroupID - Management Group Id. -// - groupQuotaName - The GroupQuota name. The name should be unique for the provided context tenantId/MgId. -// - resourceProviderName - The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource -// provider supports this API. -// - options - GroupQuotaLocationSettingsClientListOptions contains the optional parameters for the GroupQuotaLocationSettingsClient.NewListPager -// method. -func (client *GroupQuotaLocationSettingsClient) NewListPager(managementGroupID string, groupQuotaName string, resourceProviderName string, options *GroupQuotaLocationSettingsClientListOptions) *runtime.Pager[GroupQuotaLocationSettingsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[GroupQuotaLocationSettingsClientListResponse]{ - More: func(page GroupQuotaLocationSettingsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *GroupQuotaLocationSettingsClientListResponse) (GroupQuotaLocationSettingsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "GroupQuotaLocationSettingsClient.NewListPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, managementGroupID, groupQuotaName, resourceProviderName, options) - }, nil) - if err != nil { - return GroupQuotaLocationSettingsClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *GroupQuotaLocationSettingsClient) listCreateRequest(ctx context.Context, managementGroupID string, groupQuotaName string, resourceProviderName string, options *GroupQuotaLocationSettingsClientListOptions) (*policy.Request, error) { - urlPath := "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/locationSettings" - if managementGroupID == "" { - return nil, errors.New("parameter managementGroupID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{managementGroupId}", url.PathEscape(managementGroupID)) - if groupQuotaName == "" { - return nil, errors.New("parameter groupQuotaName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{groupQuotaName}", url.PathEscape(groupQuotaName)) - if resourceProviderName == "" { - return nil, errors.New("parameter resourceProviderName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceProviderName}", url.PathEscape(resourceProviderName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *GroupQuotaLocationSettingsClient) listHandleResponse(resp *http.Response) (GroupQuotaLocationSettingsClientListResponse, error) { - result := GroupQuotaLocationSettingsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.GroupQuotasEnforcementListResponse); err != nil { - return GroupQuotaLocationSettingsClientListResponse{}, err - } - return result, nil -} - -// BeginUpdate - Enables the GroupQuotas enforcement for the resource provider and the location specified. The resource provider -// will start using the group quotas as the overall quota for the subscriptions included in -// the GroupQuota. The subscriptions cannot request quota at subscription level. The subscriptions share the GroupQuotaLimits -// assigned to the GroupQuota. If the GroupQuotaLimits is used, then submit a -// groupQuotaLimit request for the specific resource - provider/location/resource. Once the GroupQuota Enforcement is enabled -// then, it cannot be deleted or reverted back. To disable GroupQuota -// Enforcement - -// 1. Remove all the subscriptions from the groupQuota using the delete API for Subscriptions (Check the example - GroupQuotaSubscriptions_Delete). -// 2. Ten delete the GroupQuota (Check the example - GroupQuotas_Delete). -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -// - managementGroupID - Management Group Id. -// - groupQuotaName - The GroupQuota name. The name should be unique for the provided context tenantId/MgId. -// - resourceProviderName - The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource -// provider supports this API. -// - location - The name of the Azure region. -// - options - GroupQuotaLocationSettingsClientBeginUpdateOptions contains the optional parameters for the GroupQuotaLocationSettingsClient.BeginUpdate -// method. -func (client *GroupQuotaLocationSettingsClient) BeginUpdate(ctx context.Context, managementGroupID string, groupQuotaName string, resourceProviderName string, location string, options *GroupQuotaLocationSettingsClientBeginUpdateOptions) (*runtime.Poller[GroupQuotaLocationSettingsClientUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.update(ctx, managementGroupID, groupQuotaName, resourceProviderName, location, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[GroupQuotaLocationSettingsClientUpdateResponse]{ - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[GroupQuotaLocationSettingsClientUpdateResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// Update - Enables the GroupQuotas enforcement for the resource provider and the location specified. The resource provider -// will start using the group quotas as the overall quota for the subscriptions included in -// the GroupQuota. The subscriptions cannot request quota at subscription level. The subscriptions share the GroupQuotaLimits -// assigned to the GroupQuota. If the GroupQuotaLimits is used, then submit a -// groupQuotaLimit request for the specific resource - provider/location/resource. Once the GroupQuota Enforcement is enabled -// then, it cannot be deleted or reverted back. To disable GroupQuota -// Enforcement - -// 1. Remove all the subscriptions from the groupQuota using the delete API for Subscriptions (Check the example - GroupQuotaSubscriptions_Delete). -// 2. Ten delete the GroupQuota (Check the example - GroupQuotas_Delete). -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -func (client *GroupQuotaLocationSettingsClient) update(ctx context.Context, managementGroupID string, groupQuotaName string, resourceProviderName string, location string, options *GroupQuotaLocationSettingsClientBeginUpdateOptions) (*http.Response, error) { - var err error - const operationName = "GroupQuotaLocationSettingsClient.BeginUpdate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.updateCreateRequest(ctx, managementGroupID, groupQuotaName, resourceProviderName, location, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// updateCreateRequest creates the Update request. -func (client *GroupQuotaLocationSettingsClient) updateCreateRequest(ctx context.Context, managementGroupID string, groupQuotaName string, resourceProviderName string, location string, options *GroupQuotaLocationSettingsClientBeginUpdateOptions) (*policy.Request, error) { - urlPath := "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/locationSettings/{location}" - if managementGroupID == "" { - return nil, errors.New("parameter managementGroupID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{managementGroupId}", url.PathEscape(managementGroupID)) - if groupQuotaName == "" { - return nil, errors.New("parameter groupQuotaName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{groupQuotaName}", url.PathEscape(groupQuotaName)) - if resourceProviderName == "" { - return nil, errors.New("parameter resourceProviderName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceProviderName}", url.PathEscape(resourceProviderName)) - if location == "" { - return nil, errors.New("parameter location cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.LocationSettings != nil { - if err := runtime.MarshalAsJSON(req, *options.LocationSettings); err != nil { - return nil, err - } - return req, nil - } - return req, nil -} diff --git a/sdk/resourcemanager/quota/armquota/groupquotalocationsettings_client_example_test.go b/sdk/resourcemanager/quota/armquota/groupquotalocationsettings_client_example_test.go deleted file mode 100644 index 77174616a529..000000000000 --- a/sdk/resourcemanager/quota/armquota/groupquotalocationsettings_client_example_test.go +++ /dev/null @@ -1,228 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armquota_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/quota/armquota" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/106483d9f698ac3b6c0d481ab0c5fab14152e21f/specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotasEnforcement/PutGroupQuotaEnforcement.json -func ExampleGroupQuotaLocationSettingsClient_BeginCreateOrUpdate_groupQuotaLocationSettingsCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armquota.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGroupQuotaLocationSettingsClient().BeginCreateOrUpdate(ctx, "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", "groupquota1", "Microsoft.Compute", "eastus", &armquota.GroupQuotaLocationSettingsClientBeginCreateOrUpdateOptions{LocationSettings: &armquota.GroupQuotasEnforcementResponse{ - Properties: &armquota.GroupQuotasEnforcementResponseProperties{ - EnforcementEnabled: to.Ptr(armquota.EnforcementStateEnabled), - }, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GroupQuotasEnforcementResponse = armquota.GroupQuotasEnforcementResponse{ - // Name: to.Ptr("eastus"), - // Type: to.Ptr("Microsoft.Quota/groupQuotas/locationSettings"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/E7EC67B3-7657-4966-BFFC-41EFD36BAA09/providers/Microsoft.Quota/groupQuotas/groupquota1/resourceProviders/Microsoft.Compute/locationSettings/eastus"), - // Properties: &armquota.GroupQuotasEnforcementResponseProperties{ - // EnforcementEnabled: to.Ptr(armquota.EnforcementStateEnabled), - // ProvisioningState: to.Ptr(armquota.RequestStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/106483d9f698ac3b6c0d481ab0c5fab14152e21f/specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotasEnforcement/PutGroupQuotaEnforcementFailed.json -func ExampleGroupQuotaLocationSettingsClient_BeginCreateOrUpdate_groupQuotaLocationSettingsCreateOrUpdateFailed() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armquota.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGroupQuotaLocationSettingsClient().BeginCreateOrUpdate(ctx, "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", "groupquota1", "Microsoft.Compute", "eastus", &armquota.GroupQuotaLocationSettingsClientBeginCreateOrUpdateOptions{LocationSettings: &armquota.GroupQuotasEnforcementResponse{ - Properties: &armquota.GroupQuotasEnforcementResponseProperties{ - EnforcementEnabled: to.Ptr(armquota.EnforcementStateEnabled), - }, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GroupQuotasEnforcementResponse = armquota.GroupQuotasEnforcementResponse{ - // Name: to.Ptr("eastus"), - // Type: to.Ptr("Microsoft.Quota/groupQuotas/locationSettings"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/E7EC67B3-7657-4966-BFFC-41EFD36BAA09/providers/Microsoft.Quota/groupQuotas/groupquota1/resourceProviders/Microsoft.Compute/locationSettings/eastus"), - // Properties: &armquota.GroupQuotasEnforcementResponseProperties{ - // EnforcementEnabled: to.Ptr(armquota.EnforcementStateEnabled), - // FaultCode: to.Ptr("RegionNotSupported"), - // ProvisioningState: to.Ptr(armquota.RequestStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/106483d9f698ac3b6c0d481ab0c5fab14152e21f/specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotasEnforcement/PatchGroupQuotaEnforcement.json -func ExampleGroupQuotaLocationSettingsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armquota.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGroupQuotaLocationSettingsClient().BeginUpdate(ctx, "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", "groupquota1", "Microsoft.Compute", "eastus", &armquota.GroupQuotaLocationSettingsClientBeginUpdateOptions{LocationSettings: &armquota.GroupQuotasEnforcementResponse{ - Properties: &armquota.GroupQuotasEnforcementResponseProperties{ - EnforcementEnabled: to.Ptr(armquota.EnforcementStateEnabled), - }, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GroupQuotasEnforcementResponse = armquota.GroupQuotasEnforcementResponse{ - // Name: to.Ptr("eastus"), - // Type: to.Ptr("Microsoft.Quota/groupQuotas/locationSettings"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/E7EC67B3-7657-4966-BFFC-41EFD36BAA09/providers/Microsoft.Quota/groupQuotas/groupquota1/resourceProviders/Microsoft.Compute/locationSettings/eastus"), - // Properties: &armquota.GroupQuotasEnforcementResponseProperties{ - // EnforcementEnabled: to.Ptr(armquota.EnforcementStateEnabled), - // ProvisioningState: to.Ptr(armquota.RequestStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/106483d9f698ac3b6c0d481ab0c5fab14152e21f/specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotasEnforcement/GetGroupQuotaEnforcement.json -func ExampleGroupQuotaLocationSettingsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armquota.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGroupQuotaLocationSettingsClient().Get(ctx, "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", "groupquota1", "Microsoft.Compute", "eastus", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GroupQuotasEnforcementResponse = armquota.GroupQuotasEnforcementResponse{ - // Name: to.Ptr("eastus"), - // Type: to.Ptr("Microsoft.Quota/groupQuotas/locationSettings"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/E7EC67B3-7657-4966-BFFC-41EFD36BAA09/providers/Microsoft.Quota/groupQuotas/groupquota1/resourceProviders/Microsoft.Compute/locationSettings/eastus"), - // Properties: &armquota.GroupQuotasEnforcementResponseProperties{ - // EnforcementEnabled: to.Ptr(armquota.EnforcementStateEnabled), - // ProvisioningState: to.Ptr(armquota.RequestStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/106483d9f698ac3b6c0d481ab0c5fab14152e21f/specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotasEnforcement/ListGroupQuotaEnforcement.json -func ExampleGroupQuotaLocationSettingsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armquota.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewGroupQuotaLocationSettingsClient().NewListPager("E7EC67B3-7657-4966-BFFC-41EFD36BAA09", "groupquota1", "Microsoft.Compute", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.GroupQuotasEnforcementListResponse = armquota.GroupQuotasEnforcementListResponse{ - // Value: []*armquota.GroupQuotasEnforcementResponse{ - // { - // Name: to.Ptr("eastus"), - // Type: to.Ptr("Microsoft.Quota/groupQuotas/locationSettings"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/E7EC67B3-7657-4966-BFFC-41EFD36BAA09/providers/Microsoft.Quota/groupQuotas/groupquota1/resourceProviders/Microsoft.Compute/locationSettings/eastus"), - // Properties: &armquota.GroupQuotasEnforcementResponseProperties{ - // EnforcementEnabled: to.Ptr(armquota.EnforcementStateEnabled), - // ProvisioningState: to.Ptr(armquota.RequestStateSucceeded), - // }, - // }, - // { - // Name: to.Ptr("westus"), - // Type: to.Ptr("Microsoft.Quota/groupQuotas/locationSettings"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/E7EC67B3-7657-4966-BFFC-41EFD36BAA09/providers/Microsoft.Quota/groupQuotas/groupquota1/resourceProviders/Microsoft.Compute/locationSettings/westus"), - // Properties: &armquota.GroupQuotasEnforcementResponseProperties{ - // EnforcementEnabled: to.Ptr(armquota.EnforcementStateEnabled), - // ProvisioningState: to.Ptr(armquota.RequestStateSucceeded), - // }, - // }, - // { - // Name: to.Ptr("westus2"), - // Type: to.Ptr("Microsoft.Quota/groupQuotas/locationSettings"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/E7EC67B3-7657-4966-BFFC-41EFD36BAA09/providers/Microsoft.Quota/groupQuotas/groupquota1/resourceProviders/Microsoft.Compute/locationSettings/westus2"), - // Properties: &armquota.GroupQuotasEnforcementResponseProperties{ - // EnforcementEnabled: to.Ptr(armquota.EnforcementStateEnabled), - // ProvisioningState: to.Ptr(armquota.RequestStateSucceeded), - // }, - // }, - // { - // Name: to.Ptr("eastasia"), - // Type: to.Ptr("Microsoft.Quota/groupQuotas/groupQlocationSettingsuotasEnforcement"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/E7EC67B3-7657-4966-BFFC-41EFD36BAA09/providers/Microsoft.Quota/groupQuotas/groupquota1/resourceProviders/Microsoft.Compute/locationSettings/eastasia"), - // Properties: &armquota.GroupQuotasEnforcementResponseProperties{ - // EnforcementEnabled: to.Ptr(armquota.EnforcementStateEnabled), - // FaultCode: to.Ptr("RegionNotSupported"), - // ProvisioningState: to.Ptr(armquota.RequestStateSucceeded), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/quota/armquota/groupquotas_client.go b/sdk/resourcemanager/quota/armquota/groupquotas_client.go index ed3bc31dd011..b4c0f676a7ad 100644 --- a/sdk/resourcemanager/quota/armquota/groupquotas_client.go +++ b/sdk/resourcemanager/quota/armquota/groupquotas_client.go @@ -48,7 +48,7 @@ func NewGroupQuotasClient(credential azcore.TokenCredential, options *arm.Client // change to Get URI and full details can be checked. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2024-12-18-preview // - managementGroupID - Management Group Id. // - groupQuotaName - The GroupQuota name. The name should be unique for the provided context tenantId/MgId. // - options - GroupQuotasClientBeginCreateOrUpdateOptions contains the optional parameters for the GroupQuotasClient.BeginCreateOrUpdate @@ -79,7 +79,7 @@ func (client *GroupQuotasClient) BeginCreateOrUpdate(ctx context.Context, manage // change to Get URI and full details can be checked. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2024-12-18-preview func (client *GroupQuotasClient) createOrUpdate(ctx context.Context, managementGroupID string, groupQuotaName string, options *GroupQuotasClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "GroupQuotasClient.BeginCreateOrUpdate" @@ -117,7 +117,7 @@ func (client *GroupQuotasClient) createOrUpdateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2024-12-18-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.GroupQuotaPutRequestBody != nil { @@ -132,7 +132,7 @@ func (client *GroupQuotasClient) createOrUpdateCreateRequest(ctx context.Context // BeginDelete - Deletes the GroupQuotas for the name passed. All the remaining shareQuota in the GroupQuotas will be lost. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2024-12-18-preview // - managementGroupID - Management Group Id. // - groupQuotaName - The GroupQuota name. The name should be unique for the provided context tenantId/MgId. // - options - GroupQuotasClientBeginDeleteOptions contains the optional parameters for the GroupQuotasClient.BeginDelete method. @@ -157,7 +157,7 @@ func (client *GroupQuotasClient) BeginDelete(ctx context.Context, managementGrou // Delete - Deletes the GroupQuotas for the name passed. All the remaining shareQuota in the GroupQuotas will be lost. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2024-12-18-preview func (client *GroupQuotasClient) deleteOperation(ctx context.Context, managementGroupID string, groupQuotaName string, options *GroupQuotasClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "GroupQuotasClient.BeginDelete" @@ -195,7 +195,7 @@ func (client *GroupQuotasClient) deleteCreateRequest(ctx context.Context, manage return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2024-12-18-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -205,7 +205,7 @@ func (client *GroupQuotasClient) deleteCreateRequest(ctx context.Context, manage // can be access from the group quota APIs. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2024-12-18-preview // - managementGroupID - Management Group Id. // - groupQuotaName - The GroupQuota name. The name should be unique for the provided context tenantId/MgId. // - options - GroupQuotasClientGetOptions contains the optional parameters for the GroupQuotasClient.Get method. @@ -247,7 +247,7 @@ func (client *GroupQuotasClient) getCreateRequest(ctx context.Context, managemen return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2024-12-18-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -265,7 +265,7 @@ func (client *GroupQuotasClient) getHandleResponse(resp *http.Response) (GroupQu // NewListPager - Lists GroupQuotas for the scope passed. It will return the GroupQuotas QuotaEntity properties only.The details // on group quota can be access from the group quota APIs. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2024-12-18-preview // - managementGroupID - Management Group Id. // - options - GroupQuotasClientListOptions contains the optional parameters for the GroupQuotasClient.NewListPager method. func (client *GroupQuotasClient) NewListPager(managementGroupID string, options *GroupQuotasClientListOptions) *runtime.Pager[GroupQuotasClientListResponse] { @@ -303,7 +303,7 @@ func (client *GroupQuotasClient) listCreateRequest(ctx context.Context, manageme return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2024-12-18-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -328,7 +328,7 @@ func (client *GroupQuotasClient) listHandleResponse(resp *http.Response) (GroupQ // unchanged. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2024-12-18-preview // - managementGroupID - Management Group Id. // - groupQuotaName - The GroupQuota name. The name should be unique for the provided context tenantId/MgId. // - options - GroupQuotasClientBeginUpdateOptions contains the optional parameters for the GroupQuotasClient.BeginUpdate method. @@ -360,7 +360,7 @@ func (client *GroupQuotasClient) BeginUpdate(ctx context.Context, managementGrou // unchanged. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2024-12-18-preview func (client *GroupQuotasClient) update(ctx context.Context, managementGroupID string, groupQuotaName string, options *GroupQuotasClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "GroupQuotasClient.BeginUpdate" @@ -398,7 +398,7 @@ func (client *GroupQuotasClient) updateCreateRequest(ctx context.Context, manage return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2024-12-18-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.GroupQuotasPatchRequestBody != nil { diff --git a/sdk/resourcemanager/quota/armquota/groupquotas_client_example_test.go b/sdk/resourcemanager/quota/armquota/groupquotas_client_example_test.go index 7ba38058cd97..c8b61004bc55 100644 --- a/sdk/resourcemanager/quota/armquota/groupquotas_client_example_test.go +++ b/sdk/resourcemanager/quota/armquota/groupquotas_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/quota/armquota" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/106483d9f698ac3b6c0d481ab0c5fab14152e21f/specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotas/PutGroupQuotas.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/55c5a0cd6da80b2700333c01e9a9c6067de9cef0/specification/quota/resource-manager/Microsoft.Quota/preview/2024-12-18-preview/examples/GroupQuotas/PutGroupQuotas.json func ExampleGroupQuotasClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -30,14 +30,7 @@ func ExampleGroupQuotasClient_BeginCreateOrUpdate() { log.Fatalf("failed to create client: %v", err) } poller, err := clientFactory.NewGroupQuotasClient().BeginCreateOrUpdate(ctx, "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", "groupquota1", &armquota.GroupQuotasClientBeginCreateOrUpdateOptions{GroupQuotaPutRequestBody: &armquota.GroupQuotasEntity{ - Properties: &armquota.GroupQuotasEntityBase{ - AdditionalAttributes: &armquota.AdditionalAttributes{ - Environment: to.Ptr(armquota.EnvironmentTypeProduction), - GroupID: &armquota.GroupingID{ - GroupingIDType: to.Ptr(armquota.GroupingIDTypeServiceTreeID), - Value: to.Ptr("yourServiceTreeIdHere"), - }, - }, + Properties: &armquota.GroupQuotasEntityProperties{ DisplayName: to.Ptr("GroupQuota1"), }, }, @@ -56,21 +49,14 @@ func ExampleGroupQuotasClient_BeginCreateOrUpdate() { // Name: to.Ptr("groupquota1"), // Type: to.Ptr("Microsoft.Quota/groupQuotas"), // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/E7EC67B3-7657-4966-BFFC-41EFD36BAA09/providers/Microsoft.Quota/groupQuotas/groupquota1"), - // Properties: &armquota.GroupQuotasEntityBase{ - // AdditionalAttributes: &armquota.AdditionalAttributes{ - // Environment: to.Ptr(armquota.EnvironmentTypeProduction), - // GroupID: &armquota.GroupingID{ - // GroupingIDType: to.Ptr(armquota.GroupingIDTypeServiceTreeID), - // Value: to.Ptr("yourServiceTreeIdHere"), - // }, - // }, + // Properties: &armquota.GroupQuotasEntityProperties{ // DisplayName: to.Ptr("GroupQuota1"), // ProvisioningState: to.Ptr(armquota.RequestStateSucceeded), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/106483d9f698ac3b6c0d481ab0c5fab14152e21f/specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotas/PatchGroupQuotas.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/55c5a0cd6da80b2700333c01e9a9c6067de9cef0/specification/quota/resource-manager/Microsoft.Quota/preview/2024-12-18-preview/examples/GroupQuotas/PatchGroupQuotas.json func ExampleGroupQuotasClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -82,14 +68,7 @@ func ExampleGroupQuotasClient_BeginUpdate() { log.Fatalf("failed to create client: %v", err) } poller, err := clientFactory.NewGroupQuotasClient().BeginUpdate(ctx, "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", "groupquota1", &armquota.GroupQuotasClientBeginUpdateOptions{GroupQuotasPatchRequestBody: &armquota.GroupQuotasEntityPatch{ - Properties: &armquota.GroupQuotasEntityBasePatch{ - AdditionalAttributes: &armquota.AdditionalAttributesPatch{ - Environment: to.Ptr(armquota.EnvironmentTypeProduction), - GroupID: &armquota.GroupingID{ - GroupingIDType: to.Ptr(armquota.GroupingIDTypeServiceTreeID), - Value: to.Ptr("UpdatedServiceTreeIdHere"), - }, - }, + Properties: &armquota.GroupQuotasEntityPatchProperties{ DisplayName: to.Ptr("UpdatedGroupQuota1"), }, }, @@ -108,21 +87,14 @@ func ExampleGroupQuotasClient_BeginUpdate() { // Name: to.Ptr("groupquota1"), // Type: to.Ptr("Microsoft.Quota/groupQuotas"), // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/E7EC67B3-7657-4966-BFFC-41EFD36BAA09/providers/Microsoft.Quota/groupQuotas/groupquota1"), - // Properties: &armquota.GroupQuotasEntityBase{ - // AdditionalAttributes: &armquota.AdditionalAttributes{ - // Environment: to.Ptr(armquota.EnvironmentTypeProduction), - // GroupID: &armquota.GroupingID{ - // GroupingIDType: to.Ptr(armquota.GroupingIDTypeServiceTreeID), - // Value: to.Ptr("UpdatedServiceTreeIdHere"), - // }, - // }, + // Properties: &armquota.GroupQuotasEntityProperties{ // DisplayName: to.Ptr("UpdatedGroupQuota1"), // ProvisioningState: to.Ptr(armquota.RequestStateSucceeded), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/106483d9f698ac3b6c0d481ab0c5fab14152e21f/specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotas/GetGroupQuotas.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/55c5a0cd6da80b2700333c01e9a9c6067de9cef0/specification/quota/resource-manager/Microsoft.Quota/preview/2024-12-18-preview/examples/GroupQuotas/GetGroupQuotas.json func ExampleGroupQuotasClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -144,21 +116,14 @@ func ExampleGroupQuotasClient_Get() { // Name: to.Ptr("groupquota1"), // Type: to.Ptr("Microsoft.Quota/groupQuotas"), // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/E7EC67B3-7657-4966-BFFC-41EFD36BAA09/providers/Microsoft.Quota/groupQuotas/groupquota1"), - // Properties: &armquota.GroupQuotasEntityBase{ - // AdditionalAttributes: &armquota.AdditionalAttributes{ - // Environment: to.Ptr(armquota.EnvironmentTypeProduction), - // GroupID: &armquota.GroupingID{ - // GroupingIDType: to.Ptr(armquota.GroupingIDTypeServiceTreeID), - // Value: to.Ptr("yourServiceTreeIdHere"), - // }, - // }, + // Properties: &armquota.GroupQuotasEntityProperties{ // DisplayName: to.Ptr("GroupQuota1"), // ProvisioningState: to.Ptr(armquota.RequestStateSucceeded), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/106483d9f698ac3b6c0d481ab0c5fab14152e21f/specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotas/DeleteGroupQuotas.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/55c5a0cd6da80b2700333c01e9a9c6067de9cef0/specification/quota/resource-manager/Microsoft.Quota/preview/2024-12-18-preview/examples/GroupQuotas/DeleteGroupQuotas.json func ExampleGroupQuotasClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -179,7 +144,7 @@ func ExampleGroupQuotasClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/106483d9f698ac3b6c0d481ab0c5fab14152e21f/specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotas/GetGroupQuotasList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/55c5a0cd6da80b2700333c01e9a9c6067de9cef0/specification/quota/resource-manager/Microsoft.Quota/preview/2024-12-18-preview/examples/GroupQuotas/GetGroupQuotasList.json func ExampleGroupQuotasClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -207,14 +172,7 @@ func ExampleGroupQuotasClient_NewListPager() { // Name: to.Ptr("groupquota1"), // Type: to.Ptr("Microsoft.Quota/groupQuotas"), // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/E7EC67B3-7657-4966-BFFC-41EFD36BAA09/providers/Microsoft.Quota/groupQuotas/groupquota1"), - // Properties: &armquota.GroupQuotasEntityBase{ - // AdditionalAttributes: &armquota.AdditionalAttributes{ - // Environment: to.Ptr(armquota.EnvironmentTypeProduction), - // GroupID: &armquota.GroupingID{ - // GroupingIDType: to.Ptr(armquota.GroupingIDTypeServiceTreeID), - // Value: to.Ptr("yourServiceTreeIdHere"), - // }, - // }, + // Properties: &armquota.GroupQuotasEntityProperties{ // DisplayName: to.Ptr("GroupQuota1"), // ProvisioningState: to.Ptr(armquota.RequestStateSucceeded), // }, diff --git a/sdk/resourcemanager/quota/armquota/groupquotasubscriptionallocation_client.go b/sdk/resourcemanager/quota/armquota/groupquotasubscriptionallocation_client.go index 10e00fb03ae8..97696498dfe3 100644 --- a/sdk/resourcemanager/quota/armquota/groupquotasubscriptionallocation_client.go +++ b/sdk/resourcemanager/quota/armquota/groupquotasubscriptionallocation_client.go @@ -43,45 +43,45 @@ func NewGroupQuotaSubscriptionAllocationClient(subscriptionID string, credential return client, nil } -// Get - Gets Quota allocated to a subscription for the specific Resource Provider, Location, ResourceName. This will include -// the GroupQuota and total quota allocated to the subscription. Only the Group quota -// allocated to the subscription can be allocated back to the MG Group Quota. +// List - Gets all the quota allocated to a subscription for the specified resource provider and location for resource names +// passed in $filter=resourceName eq {SKU}. This will include the GroupQuota and total +// quota allocated to the subscription. Only the Group quota allocated to the subscription can be allocated back to the MG +// Group Quota. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2024-12-18-preview // - managementGroupID - Management Group Id. // - groupQuotaName - The GroupQuota name. The name should be unique for the provided context tenantId/MgId. -// - resourceName - Resource name. -// - filter - FIELD SUPPORTED OPERATORS -// location eq {location} -// Example: $filter=location eq eastus -// - options - GroupQuotaSubscriptionAllocationClientGetOptions contains the optional parameters for the GroupQuotaSubscriptionAllocationClient.Get +// - resourceProviderName - The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource +// provider supports this API. +// - location - The name of the Azure region. +// - options - GroupQuotaSubscriptionAllocationClientListOptions contains the optional parameters for the GroupQuotaSubscriptionAllocationClient.List // method. -func (client *GroupQuotaSubscriptionAllocationClient) Get(ctx context.Context, managementGroupID string, groupQuotaName string, resourceName string, filter string, options *GroupQuotaSubscriptionAllocationClientGetOptions) (GroupQuotaSubscriptionAllocationClientGetResponse, error) { +func (client *GroupQuotaSubscriptionAllocationClient) List(ctx context.Context, managementGroupID string, groupQuotaName string, resourceProviderName string, location string, options *GroupQuotaSubscriptionAllocationClientListOptions) (GroupQuotaSubscriptionAllocationClientListResponse, error) { var err error - const operationName = "GroupQuotaSubscriptionAllocationClient.Get" + const operationName = "GroupQuotaSubscriptionAllocationClient.List" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, managementGroupID, groupQuotaName, resourceName, filter, options) + req, err := client.listCreateRequest(ctx, managementGroupID, groupQuotaName, resourceProviderName, location, options) if err != nil { - return GroupQuotaSubscriptionAllocationClientGetResponse{}, err + return GroupQuotaSubscriptionAllocationClientListResponse{}, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return GroupQuotaSubscriptionAllocationClientGetResponse{}, err + return GroupQuotaSubscriptionAllocationClientListResponse{}, err } if !runtime.HasStatusCode(httpResp, http.StatusOK) { err = runtime.NewResponseError(httpResp) - return GroupQuotaSubscriptionAllocationClientGetResponse{}, err + return GroupQuotaSubscriptionAllocationClientListResponse{}, err } - resp, err := client.getHandleResponse(httpResp) + resp, err := client.listHandleResponse(httpResp) return resp, err } -// getCreateRequest creates the Get request. -func (client *GroupQuotaSubscriptionAllocationClient) getCreateRequest(ctx context.Context, managementGroupID string, groupQuotaName string, resourceName string, filter string, options *GroupQuotaSubscriptionAllocationClientGetOptions) (*policy.Request, error) { - urlPath := "/providers/Microsoft.Management/managementGroups/{managementGroupId}/subscriptions/{subscriptionId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/quotaAllocations/{resourceName}" +// listCreateRequest creates the List request. +func (client *GroupQuotaSubscriptionAllocationClient) listCreateRequest(ctx context.Context, managementGroupID string, groupQuotaName string, resourceProviderName string, location string, options *GroupQuotaSubscriptionAllocationClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Management/managementGroups/{managementGroupId}/subscriptions/{subscriptionId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/quotaAllocations/{location}" if managementGroupID == "" { return nil, errors.New("parameter managementGroupID cannot be empty") } @@ -94,90 +94,20 @@ func (client *GroupQuotaSubscriptionAllocationClient) getCreateRequest(ctx conte return nil, errors.New("parameter groupQuotaName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{groupQuotaName}", url.PathEscape(groupQuotaName)) - if resourceName == "" { - return nil, errors.New("parameter resourceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("$filter", filter) - reqQP.Set("api-version", "2023-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *GroupQuotaSubscriptionAllocationClient) getHandleResponse(resp *http.Response) (GroupQuotaSubscriptionAllocationClientGetResponse, error) { - result := GroupQuotaSubscriptionAllocationClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.SubscriptionQuotaAllocations); err != nil { - return GroupQuotaSubscriptionAllocationClientGetResponse{}, err - } - return result, nil -} - -// NewListPager - Gets all the quota allocated to a subscription for the specific Resource Provider, Location. This will include -// the GroupQuota and total quota allocated to the subscription. Only the Group quota -// allocated to the subscription can be allocated back to the MG Group Quota. Use the $filter parameter to filter out the -// specific resource based on the ResourceProvider/Location. $filter is a required -// parameter. -// -// Generated from API version 2023-06-01-preview -// - managementGroupID - Management Group Id. -// - groupQuotaName - The GroupQuota name. The name should be unique for the provided context tenantId/MgId. -// - filter - FIELD SUPPORTED OPERATORS -// location eq {location} -// Example: $filter=location eq eastus -// - options - GroupQuotaSubscriptionAllocationClientListOptions contains the optional parameters for the GroupQuotaSubscriptionAllocationClient.NewListPager -// method. -func (client *GroupQuotaSubscriptionAllocationClient) NewListPager(managementGroupID string, groupQuotaName string, filter string, options *GroupQuotaSubscriptionAllocationClientListOptions) *runtime.Pager[GroupQuotaSubscriptionAllocationClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[GroupQuotaSubscriptionAllocationClientListResponse]{ - More: func(page GroupQuotaSubscriptionAllocationClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *GroupQuotaSubscriptionAllocationClientListResponse) (GroupQuotaSubscriptionAllocationClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "GroupQuotaSubscriptionAllocationClient.NewListPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, managementGroupID, groupQuotaName, filter, options) - }, nil) - if err != nil { - return GroupQuotaSubscriptionAllocationClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *GroupQuotaSubscriptionAllocationClient) listCreateRequest(ctx context.Context, managementGroupID string, groupQuotaName string, filter string, options *GroupQuotaSubscriptionAllocationClientListOptions) (*policy.Request, error) { - urlPath := "/providers/Microsoft.Management/managementGroups/{managementGroupId}/subscriptions/{subscriptionId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/quotaAllocations" - if managementGroupID == "" { - return nil, errors.New("parameter managementGroupID cannot be empty") + if resourceProviderName == "" { + return nil, errors.New("parameter resourceProviderName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{managementGroupId}", url.PathEscape(managementGroupID)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceProviderName}", url.PathEscape(resourceProviderName)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if groupQuotaName == "" { - return nil, errors.New("parameter groupQuotaName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{groupQuotaName}", url.PathEscape(groupQuotaName)) + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("$filter", filter) - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2024-12-18-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/quota/armquota/groupquotasubscriptionallocation_client_example_test.go b/sdk/resourcemanager/quota/armquota/groupquotasubscriptionallocation_client_example_test.go index c3a7b18dd3fd..0754db27fb8c 100644 --- a/sdk/resourcemanager/quota/armquota/groupquotasubscriptionallocation_client_example_test.go +++ b/sdk/resourcemanager/quota/armquota/groupquotasubscriptionallocation_client_example_test.go @@ -17,8 +17,8 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/quota/armquota" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/106483d9f698ac3b6c0d481ab0c5fab14152e21f/specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/SubscriptionQuotaAllocation/SubscriptionQuotaAllocation_List-Compute.json -func ExampleGroupQuotaSubscriptionAllocationClient_NewListPager() { +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/55c5a0cd6da80b2700333c01e9a9c6067de9cef0/specification/quota/resource-manager/Microsoft.Quota/preview/2024-12-18-preview/examples/SubscriptionQuotaAllocation/SubscriptionQuotaAllocation_List-Compute.json +func ExampleGroupQuotaSubscriptionAllocationClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) @@ -28,81 +28,42 @@ func ExampleGroupQuotaSubscriptionAllocationClient_NewListPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewGroupQuotaSubscriptionAllocationClient().NewListPager("E7EC67B3-7657-4966-BFFC-41EFD36BAA09", "groupquota1", "provider eq Microsoft.Compute & location eq westus", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SubscriptionQuotaAllocationsList = armquota.SubscriptionQuotaAllocationsList{ - // Value: []*armquota.SubscriptionQuotaAllocations{ - // { - // Name: to.Ptr("standardddv4family"), - // Type: to.Ptr("Microsoft.Quota/groupQuotas/quotaAllocations"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/E7EC67B3-7657-4966-BFFC-41EFD36BAA09/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Quota/groupQuotas/groupquota1/providers/Microsoft.Compute/locations/westus/quotaAllocations/standardddv4family"), - // Properties: &armquota.SubscriptionQuotaDetails{ - // Name: &armquota.SubscriptionQuotaDetailsName{ - // LocalizedValue: to.Ptr("standard DDv4 Family vCPUs"), - // Value: to.Ptr("standardddv4family"), - // }, - // Limit: to.Ptr[int64](25), - // Region: to.Ptr("westus"), - // ShareableQuota: to.Ptr[int64](15), - // }, - // }, - // { - // Name: to.Ptr("standardav2family"), - // Type: to.Ptr("Microsoft.Quota/groupQuotas/quotaAllocations"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/E7EC67B3-7657-4966-BFFC-41EFD36BAA09/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Quota/groupQuotas/groupquota1/providers/Microsoft.Compute/locations/westus/quotaAllocations/standardav2family"), - // Properties: &armquota.SubscriptionQuotaDetails{ - // Name: &armquota.SubscriptionQuotaDetailsName{ - // LocalizedValue: to.Ptr("standard Av2 Family vCPUs"), - // Value: to.Ptr("standardav2family"), - // }, - // Limit: to.Ptr[int64](30), - // Region: to.Ptr("westus"), - // ShareableQuota: to.Ptr[int64](0), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/106483d9f698ac3b6c0d481ab0c5fab14152e21f/specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/SubscriptionQuotaAllocation/SubscriptionQuotaAllocation_Get-Compute.json -func ExampleGroupQuotaSubscriptionAllocationClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armquota.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGroupQuotaSubscriptionAllocationClient().Get(ctx, "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", "groupquota1", "standardav2family", "provider eq Microsoft.Compute & location eq westus", nil) + res, err := clientFactory.NewGroupQuotaSubscriptionAllocationClient().List(ctx, "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", "groupquota1", "Microsoft.Compute", "westus", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } // You could use response here. We use blank identifier for just demo purposes. _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SubscriptionQuotaAllocations = armquota.SubscriptionQuotaAllocations{ - // Name: to.Ptr("standardav2family"), + // res.SubscriptionQuotaAllocationsList = armquota.SubscriptionQuotaAllocationsList{ + // Name: to.Ptr("westus"), // Type: to.Ptr("Microsoft.Quota/groupQuotas/quotaAllocations"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/E7EC67B3-7657-4966-BFFC-41EFD36BAA09/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Quota/groupQuotas/groupquota1/providers/Microsoft.Compute/locations/westus/quotaAllocations/standardav2family"), - // Properties: &armquota.SubscriptionQuotaDetails{ - // Name: &armquota.SubscriptionQuotaDetailsName{ - // LocalizedValue: to.Ptr("standard Av2 Family vCPUs"), - // Value: to.Ptr("standardav2family"), - // }, - // Limit: to.Ptr[int64](100), - // Region: to.Ptr("westus"), - // ShareableQuota: to.Ptr[int64](25), + // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/E7EC67B3-7657-4966-BFFC-41EFD36BAA09/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Quota/groupQuotas/groupquota1/resourceProviders/Microsoft.Compute/locations/westus/quotaAllocations/westus"), + // Properties: &armquota.SubscriptionQuotaAllocationsListProperties{ + // ProvisioningState: to.Ptr(armquota.RequestStateSucceeded), + // Value: []*armquota.SubscriptionQuotaAllocations{ + // { + // Properties: &armquota.SubscriptionQuotaAllocationsProperties{ + // Name: &armquota.SubscriptionQuotaDetailsName{ + // LocalizedValue: to.Ptr("standard DDv4 Family vCPUs"), + // Value: to.Ptr("standardddv4family"), + // }, + // Limit: to.Ptr[int64](25), + // ResourceName: to.Ptr("standardddv4family"), + // ShareableQuota: to.Ptr[int64](15), + // }, + // }, + // { + // Properties: &armquota.SubscriptionQuotaAllocationsProperties{ + // Name: &armquota.SubscriptionQuotaDetailsName{ + // LocalizedValue: to.Ptr("standard Av2 Family vCPUs"), + // Value: to.Ptr("standardav2family"), + // }, + // Limit: to.Ptr[int64](30), + // ResourceName: to.Ptr("standardav2family"), + // ShareableQuota: to.Ptr[int64](0), + // }, + // }}, // }, // } } diff --git a/sdk/resourcemanager/quota/armquota/groupquotasubscriptionallocationrequest_client.go b/sdk/resourcemanager/quota/armquota/groupquotasubscriptionallocationrequest_client.go index d9ff380321ae..912e6c979db5 100644 --- a/sdk/resourcemanager/quota/armquota/groupquotasubscriptionallocationrequest_client.go +++ b/sdk/resourcemanager/quota/armquota/groupquotasubscriptionallocationrequest_client.go @@ -43,120 +43,24 @@ func NewGroupQuotaSubscriptionAllocationRequestClient(subscriptionID string, cre return client, nil } -// BeginCreateOrUpdate - Request to assign quota from group quota to a specific Subscription. The assign GroupQuota to subscriptions -// or reduce the quota allocated to subscription to give back the unused quota ( quota >= -// usages) to the groupQuota. So, this API can be used to assign Quota to subscriptions and assign back unused quota to group -// quota, which can be assigned to another subscriptions in the GroupQuota. +// Get - Get the quota allocation request status for the subscriptionId by allocationId. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2024-12-18-preview // - managementGroupID - Management Group Id. // - groupQuotaName - The GroupQuota name. The name should be unique for the provided context tenantId/MgId. // - resourceProviderName - The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource // provider supports this API. -// - resourceName - Resource name. -// - allocateQuotaRequest - Quota requests payload. -// - options - GroupQuotaSubscriptionAllocationRequestClientBeginCreateOrUpdateOptions contains the optional parameters for -// the GroupQuotaSubscriptionAllocationRequestClient.BeginCreateOrUpdate method. -func (client *GroupQuotaSubscriptionAllocationRequestClient) BeginCreateOrUpdate(ctx context.Context, managementGroupID string, groupQuotaName string, resourceProviderName string, resourceName string, allocateQuotaRequest AllocationRequestStatus, options *GroupQuotaSubscriptionAllocationRequestClientBeginCreateOrUpdateOptions) (*runtime.Poller[GroupQuotaSubscriptionAllocationRequestClientCreateOrUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.createOrUpdate(ctx, managementGroupID, groupQuotaName, resourceProviderName, resourceName, allocateQuotaRequest, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[GroupQuotaSubscriptionAllocationRequestClientCreateOrUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[GroupQuotaSubscriptionAllocationRequestClientCreateOrUpdateResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// CreateOrUpdate - Request to assign quota from group quota to a specific Subscription. The assign GroupQuota to subscriptions -// or reduce the quota allocated to subscription to give back the unused quota ( quota >= -// usages) to the groupQuota. So, this API can be used to assign Quota to subscriptions and assign back unused quota to group -// quota, which can be assigned to another subscriptions in the GroupQuota. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -func (client *GroupQuotaSubscriptionAllocationRequestClient) createOrUpdate(ctx context.Context, managementGroupID string, groupQuotaName string, resourceProviderName string, resourceName string, allocateQuotaRequest AllocationRequestStatus, options *GroupQuotaSubscriptionAllocationRequestClientBeginCreateOrUpdateOptions) (*http.Response, error) { - var err error - const operationName = "GroupQuotaSubscriptionAllocationRequestClient.BeginCreateOrUpdate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createOrUpdateCreateRequest(ctx, managementGroupID, groupQuotaName, resourceProviderName, resourceName, allocateQuotaRequest, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *GroupQuotaSubscriptionAllocationRequestClient) createOrUpdateCreateRequest(ctx context.Context, managementGroupID string, groupQuotaName string, resourceProviderName string, resourceName string, allocateQuotaRequest AllocationRequestStatus, options *GroupQuotaSubscriptionAllocationRequestClientBeginCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/providers/Microsoft.Management/managementGroups/{managementGroupId}/subscriptions/{subscriptionId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/quotaAllocationRequests/{resourceName}" - if managementGroupID == "" { - return nil, errors.New("parameter managementGroupID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{managementGroupId}", url.PathEscape(managementGroupID)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if groupQuotaName == "" { - return nil, errors.New("parameter groupQuotaName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{groupQuotaName}", url.PathEscape(groupQuotaName)) - if resourceProviderName == "" { - return nil, errors.New("parameter resourceProviderName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceProviderName}", url.PathEscape(resourceProviderName)) - if resourceName == "" { - return nil, errors.New("parameter resourceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, allocateQuotaRequest); err != nil { - return nil, err - } - return req, nil -} - -// Get - Get the quota allocation request status for the subscriptionId by allocationId. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -// - managementGroupID - Management Group Id. -// - groupQuotaName - The GroupQuota name. The name should be unique for the provided context tenantId/MgId. // - allocationID - Request Id. // - options - GroupQuotaSubscriptionAllocationRequestClientGetOptions contains the optional parameters for the GroupQuotaSubscriptionAllocationRequestClient.Get // method. -func (client *GroupQuotaSubscriptionAllocationRequestClient) Get(ctx context.Context, managementGroupID string, groupQuotaName string, allocationID string, options *GroupQuotaSubscriptionAllocationRequestClientGetOptions) (GroupQuotaSubscriptionAllocationRequestClientGetResponse, error) { +func (client *GroupQuotaSubscriptionAllocationRequestClient) Get(ctx context.Context, managementGroupID string, groupQuotaName string, resourceProviderName string, allocationID string, options *GroupQuotaSubscriptionAllocationRequestClientGetOptions) (GroupQuotaSubscriptionAllocationRequestClientGetResponse, error) { var err error const operationName = "GroupQuotaSubscriptionAllocationRequestClient.Get" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, managementGroupID, groupQuotaName, allocationID, options) + req, err := client.getCreateRequest(ctx, managementGroupID, groupQuotaName, resourceProviderName, allocationID, options) if err != nil { return GroupQuotaSubscriptionAllocationRequestClientGetResponse{}, err } @@ -173,8 +77,8 @@ func (client *GroupQuotaSubscriptionAllocationRequestClient) Get(ctx context.Con } // getCreateRequest creates the Get request. -func (client *GroupQuotaSubscriptionAllocationRequestClient) getCreateRequest(ctx context.Context, managementGroupID string, groupQuotaName string, allocationID string, options *GroupQuotaSubscriptionAllocationRequestClientGetOptions) (*policy.Request, error) { - urlPath := "/providers/Microsoft.Management/managementGroups/{managementGroupId}/subscriptions/{subscriptionId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/quotaAllocationRequests/{allocationId}" +func (client *GroupQuotaSubscriptionAllocationRequestClient) getCreateRequest(ctx context.Context, managementGroupID string, groupQuotaName string, resourceProviderName string, allocationID string, options *GroupQuotaSubscriptionAllocationRequestClientGetOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Management/managementGroups/{managementGroupId}/subscriptions/{subscriptionId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/quotaAllocationRequests/{allocationId}" if managementGroupID == "" { return nil, errors.New("parameter managementGroupID cannot be empty") } @@ -187,6 +91,10 @@ func (client *GroupQuotaSubscriptionAllocationRequestClient) getCreateRequest(ct return nil, errors.New("parameter groupQuotaName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{groupQuotaName}", url.PathEscape(groupQuotaName)) + if resourceProviderName == "" { + return nil, errors.New("parameter resourceProviderName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceProviderName}", url.PathEscape(resourceProviderName)) if allocationID == "" { return nil, errors.New("parameter allocationID cannot be empty") } @@ -196,7 +104,7 @@ func (client *GroupQuotaSubscriptionAllocationRequestClient) getCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2024-12-18-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -214,7 +122,7 @@ func (client *GroupQuotaSubscriptionAllocationRequestClient) getHandleResponse(r // NewListPager - Get all the quotaAllocationRequests for a resourceProvider/location. The filter paramter for location is // required. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2024-12-18-preview // - managementGroupID - Management Group Id. // - groupQuotaName - The GroupQuota name. The name should be unique for the provided context tenantId/MgId. // - resourceProviderName - The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource @@ -272,7 +180,7 @@ func (client *GroupQuotaSubscriptionAllocationRequestClient) listCreateRequest(c } reqQP := req.Raw().URL.Query() reqQP.Set("$filter", filter) - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2024-12-18-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -295,18 +203,18 @@ func (client *GroupQuotaSubscriptionAllocationRequestClient) listHandleResponse( // where it's needed. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2024-12-18-preview // - managementGroupID - Management Group Id. // - groupQuotaName - The GroupQuota name. The name should be unique for the provided context tenantId/MgId. // - resourceProviderName - The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource // provider supports this API. -// - resourceName - Resource name. +// - location - The name of the Azure region. // - allocateQuotaRequest - Quota requests payload. // - options - GroupQuotaSubscriptionAllocationRequestClientBeginUpdateOptions contains the optional parameters for the GroupQuotaSubscriptionAllocationRequestClient.BeginUpdate // method. -func (client *GroupQuotaSubscriptionAllocationRequestClient) BeginUpdate(ctx context.Context, managementGroupID string, groupQuotaName string, resourceProviderName string, resourceName string, allocateQuotaRequest AllocationRequestStatus, options *GroupQuotaSubscriptionAllocationRequestClientBeginUpdateOptions) (*runtime.Poller[GroupQuotaSubscriptionAllocationRequestClientUpdateResponse], error) { +func (client *GroupQuotaSubscriptionAllocationRequestClient) BeginUpdate(ctx context.Context, managementGroupID string, groupQuotaName string, resourceProviderName string, location string, allocateQuotaRequest SubscriptionQuotaAllocationsList, options *GroupQuotaSubscriptionAllocationRequestClientBeginUpdateOptions) (*runtime.Poller[GroupQuotaSubscriptionAllocationRequestClientUpdateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.update(ctx, managementGroupID, groupQuotaName, resourceProviderName, resourceName, allocateQuotaRequest, options) + resp, err := client.update(ctx, managementGroupID, groupQuotaName, resourceProviderName, location, allocateQuotaRequest, options) if err != nil { return nil, err } @@ -330,14 +238,14 @@ func (client *GroupQuotaSubscriptionAllocationRequestClient) BeginUpdate(ctx con // where it's needed. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview -func (client *GroupQuotaSubscriptionAllocationRequestClient) update(ctx context.Context, managementGroupID string, groupQuotaName string, resourceProviderName string, resourceName string, allocateQuotaRequest AllocationRequestStatus, options *GroupQuotaSubscriptionAllocationRequestClientBeginUpdateOptions) (*http.Response, error) { +// Generated from API version 2024-12-18-preview +func (client *GroupQuotaSubscriptionAllocationRequestClient) update(ctx context.Context, managementGroupID string, groupQuotaName string, resourceProviderName string, location string, allocateQuotaRequest SubscriptionQuotaAllocationsList, options *GroupQuotaSubscriptionAllocationRequestClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "GroupQuotaSubscriptionAllocationRequestClient.BeginUpdate" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.updateCreateRequest(ctx, managementGroupID, groupQuotaName, resourceProviderName, resourceName, allocateQuotaRequest, options) + req, err := client.updateCreateRequest(ctx, managementGroupID, groupQuotaName, resourceProviderName, location, allocateQuotaRequest, options) if err != nil { return nil, err } @@ -353,8 +261,8 @@ func (client *GroupQuotaSubscriptionAllocationRequestClient) update(ctx context. } // updateCreateRequest creates the Update request. -func (client *GroupQuotaSubscriptionAllocationRequestClient) updateCreateRequest(ctx context.Context, managementGroupID string, groupQuotaName string, resourceProviderName string, resourceName string, allocateQuotaRequest AllocationRequestStatus, options *GroupQuotaSubscriptionAllocationRequestClientBeginUpdateOptions) (*policy.Request, error) { - urlPath := "/providers/Microsoft.Management/managementGroups/{managementGroupId}/subscriptions/{subscriptionId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/quotaAllocationRequests/{resourceName}" +func (client *GroupQuotaSubscriptionAllocationRequestClient) updateCreateRequest(ctx context.Context, managementGroupID string, groupQuotaName string, resourceProviderName string, location string, allocateQuotaRequest SubscriptionQuotaAllocationsList, options *GroupQuotaSubscriptionAllocationRequestClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Management/managementGroups/{managementGroupId}/subscriptions/{subscriptionId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/quotaAllocations/{location}" if managementGroupID == "" { return nil, errors.New("parameter managementGroupID cannot be empty") } @@ -371,16 +279,16 @@ func (client *GroupQuotaSubscriptionAllocationRequestClient) updateCreateRequest return nil, errors.New("parameter resourceProviderName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceProviderName}", url.PathEscape(resourceProviderName)) - if resourceName == "" { - return nil, errors.New("parameter resourceName cannot be empty") + if location == "" { + return nil, errors.New("parameter location cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2024-12-18-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, allocateQuotaRequest); err != nil { diff --git a/sdk/resourcemanager/quota/armquota/groupquotasubscriptionallocationrequest_client_example_test.go b/sdk/resourcemanager/quota/armquota/groupquotasubscriptionallocationrequest_client_example_test.go index 2113b1175d27..8a0429df8002 100644 --- a/sdk/resourcemanager/quota/armquota/groupquotasubscriptionallocationrequest_client_example_test.go +++ b/sdk/resourcemanager/quota/armquota/groupquotasubscriptionallocationrequest_client_example_test.go @@ -18,7 +18,78 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/quota/armquota" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/106483d9f698ac3b6c0d481ab0c5fab14152e21f/specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/SubscriptionQuotaAllocationRequests/SubscriptionQuotaAllocationRequests_Get-Compute.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/55c5a0cd6da80b2700333c01e9a9c6067de9cef0/specification/quota/resource-manager/Microsoft.Quota/preview/2024-12-18-preview/examples/SubscriptionQuotaAllocationRequests/PatchSubscriptionQuotaAllocationRequest-Compute.json +func ExampleGroupQuotaSubscriptionAllocationRequestClient_BeginUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armquota.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewGroupQuotaSubscriptionAllocationRequestClient().BeginUpdate(ctx, "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", "groupquota1", "Microsoft.Compute", "westus", armquota.SubscriptionQuotaAllocationsList{ + Properties: &armquota.SubscriptionQuotaAllocationsListProperties{ + Value: []*armquota.SubscriptionQuotaAllocations{ + { + Properties: &armquota.SubscriptionQuotaAllocationsProperties{ + Limit: to.Ptr[int64](110), + ResourceName: to.Ptr("standardddv4family"), + }, + }, + { + Properties: &armquota.SubscriptionQuotaAllocationsProperties{ + Limit: to.Ptr[int64](110), + ResourceName: to.Ptr("standardav2family"), + }, + }}, + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.SubscriptionQuotaAllocationsList = armquota.SubscriptionQuotaAllocationsList{ + // Name: to.Ptr("westus"), + // Type: to.Ptr("Microsoft.Quota/groupQuotas/quotaAllocations"), + // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/E7EC67B3-7657-4966-BFFC-41EFD36BAA09/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Quota/groupQuotas/groupquota1/resourceProviders/Microsoft.Compute/locations/westus/quotaAllocations/westus"), + // Properties: &armquota.SubscriptionQuotaAllocationsListProperties{ + // ProvisioningState: to.Ptr(armquota.RequestStateSucceeded), + // Value: []*armquota.SubscriptionQuotaAllocations{ + // { + // Properties: &armquota.SubscriptionQuotaAllocationsProperties{ + // Name: &armquota.SubscriptionQuotaDetailsName{ + // LocalizedValue: to.Ptr("standard DDv4 Family vCPUs"), + // Value: to.Ptr("standardddv4family"), + // }, + // Limit: to.Ptr[int64](25), + // ResourceName: to.Ptr("standardddv4family"), + // ShareableQuota: to.Ptr[int64](15), + // }, + // }, + // { + // Properties: &armquota.SubscriptionQuotaAllocationsProperties{ + // Name: &armquota.SubscriptionQuotaDetailsName{ + // LocalizedValue: to.Ptr("standard Av2 Family vCPUs"), + // Value: to.Ptr("standardav2family"), + // }, + // Limit: to.Ptr[int64](30), + // ResourceName: to.Ptr("standardav2family"), + // ShareableQuota: to.Ptr[int64](0), + // }, + // }}, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/55c5a0cd6da80b2700333c01e9a9c6067de9cef0/specification/quota/resource-manager/Microsoft.Quota/preview/2024-12-18-preview/examples/SubscriptionQuotaAllocationRequests/SubscriptionQuotaAllocationRequests_Get-Compute.json func ExampleGroupQuotaSubscriptionAllocationRequestClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -29,7 +100,7 @@ func ExampleGroupQuotaSubscriptionAllocationRequestClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewGroupQuotaSubscriptionAllocationRequestClient().Get(ctx, "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", "groupquota1", "AE000000-0000-0000-0000-00000000000A", nil) + res, err := clientFactory.NewGroupQuotaSubscriptionAllocationRequestClient().Get(ctx, "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", "groupquota1", "Microsoft.Compute", "AE000000-0000-0000-0000-00000000000A", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -58,7 +129,7 @@ func ExampleGroupQuotaSubscriptionAllocationRequestClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/106483d9f698ac3b6c0d481ab0c5fab14152e21f/specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/SubscriptionQuotaAllocationRequests/SubscriptionQuotaAllocationRequests_List-Compute.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/55c5a0cd6da80b2700333c01e9a9c6067de9cef0/specification/quota/resource-manager/Microsoft.Quota/preview/2024-12-18-preview/examples/SubscriptionQuotaAllocationRequests/SubscriptionQuotaAllocationRequests_List-Compute.json func ExampleGroupQuotaSubscriptionAllocationRequestClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -105,109 +176,3 @@ func ExampleGroupQuotaSubscriptionAllocationRequestClient_NewListPager() { // } } } - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/106483d9f698ac3b6c0d481ab0c5fab14152e21f/specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/SubscriptionQuotaAllocationRequests/PutSubscriptionQuotaAllocationRequest-Compute.json -func ExampleGroupQuotaSubscriptionAllocationRequestClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armquota.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGroupQuotaSubscriptionAllocationRequestClient().BeginCreateOrUpdate(ctx, "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", "groupquota1", "Microsoft.Compute", "standardav2family", armquota.AllocationRequestStatus{ - Properties: &armquota.AllocationRequestStatusProperties{ - RequestedResource: &armquota.AllocationRequestBase{ - Properties: &armquota.AllocationRequestBaseProperties{ - Limit: to.Ptr[int64](10), - Region: to.Ptr("westus"), - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AllocationRequestStatus = armquota.AllocationRequestStatus{ - // Name: to.Ptr("standardav2family"), - // Type: to.Ptr("Microsoft.Quota/groupQuotas/quotaAllocations"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/E7EC67B3-7657-4966-BFFC-41EFD36BAA09/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Quota/groupQuotas/groupquota1/resourceProviders/Microsoft.Compute/locations/westus/quotaAllocations/standardav2family"), - // Properties: &armquota.AllocationRequestStatusProperties{ - // FaultCode: to.Ptr(""), - // ProvisioningState: to.Ptr(armquota.RequestStateSucceeded), - // RequestSubmitTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-03-20T18:24:38.105Z"); return t}()), - // RequestedResource: &armquota.AllocationRequestBase{ - // Properties: &armquota.AllocationRequestBaseProperties{ - // Name: &armquota.AllocationRequestBasePropertiesName{ - // LocalizedValue: to.Ptr("Standard AV2 Family"), - // Value: to.Ptr("standardav2family"), - // }, - // Limit: to.Ptr[int64](0), - // Region: to.Ptr("westus"), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/106483d9f698ac3b6c0d481ab0c5fab14152e21f/specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/SubscriptionQuotaAllocationRequests/PatchSubscriptionQuotaAllocationRequest-Compute.json -func ExampleGroupQuotaSubscriptionAllocationRequestClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armquota.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGroupQuotaSubscriptionAllocationRequestClient().BeginUpdate(ctx, "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", "groupquota1", "Microsoft.Compute", "standardav2family", armquota.AllocationRequestStatus{ - Properties: &armquota.AllocationRequestStatusProperties{ - RequestedResource: &armquota.AllocationRequestBase{ - Properties: &armquota.AllocationRequestBaseProperties{ - Limit: to.Ptr[int64](10), - Region: to.Ptr("westus"), - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AllocationRequestStatus = armquota.AllocationRequestStatus{ - // Name: to.Ptr("standardav2family"), - // Type: to.Ptr("Microsoft.Quota/groupQuotas/quotaAllocations"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/E7EC67B3-7657-4966-BFFC-41EFD36BAA09/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Quota/groupQuotas/groupquota1/resourceProviders/Microsoft.Compute/locations/westus/quotaAllocations/standardav2family"), - // Properties: &armquota.AllocationRequestStatusProperties{ - // FaultCode: to.Ptr(""), - // ProvisioningState: to.Ptr(armquota.RequestStateSucceeded), - // RequestSubmitTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-03-20T18:42:53.779Z"); return t}()), - // RequestedResource: &armquota.AllocationRequestBase{ - // Properties: &armquota.AllocationRequestBaseProperties{ - // Name: &armquota.AllocationRequestBasePropertiesName{ - // LocalizedValue: to.Ptr("Standard Av2 Family"), - // Value: to.Ptr("standardav2family"), - // }, - // Limit: to.Ptr[int64](70), - // Region: to.Ptr("westus"), - // }, - // }, - // }, - // } -} diff --git a/sdk/resourcemanager/quota/armquota/groupquotasubscriptionrequests_client.go b/sdk/resourcemanager/quota/armquota/groupquotasubscriptionrequests_client.go index 14a5386866e9..3efbfd3db8d5 100644 --- a/sdk/resourcemanager/quota/armquota/groupquotasubscriptionrequests_client.go +++ b/sdk/resourcemanager/quota/armquota/groupquotasubscriptionrequests_client.go @@ -45,7 +45,7 @@ func NewGroupQuotaSubscriptionRequestsClient(credential azcore.TokenCredential, // to check the intermediate status. This API provides the finals status with the request details and status. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2024-12-18-preview // - managementGroupID - Management Group Id. // - groupQuotaName - The GroupQuota name. The name should be unique for the provided context tenantId/MgId. // - requestID - Request Id. @@ -93,7 +93,7 @@ func (client *GroupQuotaSubscriptionRequestsClient) getCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2024-12-18-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -111,7 +111,7 @@ func (client *GroupQuotaSubscriptionRequestsClient) getHandleResponse(resp *http // NewListPager - List API to check the status of a subscriptionId requests by requestId. Request history is maintained for // 1 year. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2024-12-18-preview // - managementGroupID - Management Group Id. // - groupQuotaName - The GroupQuota name. The name should be unique for the provided context tenantId/MgId. // - options - GroupQuotaSubscriptionRequestsClientListOptions contains the optional parameters for the GroupQuotaSubscriptionRequestsClient.NewListPager @@ -155,7 +155,7 @@ func (client *GroupQuotaSubscriptionRequestsClient) listCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2024-12-18-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/quota/armquota/groupquotasubscriptionrequests_client_example_test.go b/sdk/resourcemanager/quota/armquota/groupquotasubscriptionrequests_client_example_test.go index 9e1bf301e43b..5928a80ad61e 100644 --- a/sdk/resourcemanager/quota/armquota/groupquotasubscriptionrequests_client_example_test.go +++ b/sdk/resourcemanager/quota/armquota/groupquotasubscriptionrequests_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/quota/armquota" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/106483d9f698ac3b6c0d481ab0c5fab14152e21f/specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/SubscriptionRequests/SubscriptionRequests_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/55c5a0cd6da80b2700333c01e9a9c6067de9cef0/specification/quota/resource-manager/Microsoft.Quota/preview/2024-12-18-preview/examples/SubscriptionRequests/SubscriptionRequests_List.json func ExampleGroupQuotaSubscriptionRequestsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -55,7 +55,7 @@ func ExampleGroupQuotaSubscriptionRequestsClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/106483d9f698ac3b6c0d481ab0c5fab14152e21f/specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/SubscriptionRequests/SubscriptionRequests_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/55c5a0cd6da80b2700333c01e9a9c6067de9cef0/specification/quota/resource-manager/Microsoft.Quota/preview/2024-12-18-preview/examples/SubscriptionRequests/SubscriptionRequests_Get.json func ExampleGroupQuotaSubscriptionRequestsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/quota/armquota/groupquotasubscriptions_client.go b/sdk/resourcemanager/quota/armquota/groupquotasubscriptions_client.go index e2e316831bb6..503e7b32fcf4 100644 --- a/sdk/resourcemanager/quota/armquota/groupquotasubscriptions_client.go +++ b/sdk/resourcemanager/quota/armquota/groupquotasubscriptions_client.go @@ -48,7 +48,7 @@ func NewGroupQuotaSubscriptionsClient(subscriptionID string, credential azcore.T // which can be included in the GroupQuotas. The request's TenantId is validated against the subscription's TenantId. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2024-12-18-preview // - managementGroupID - Management Group Id. // - groupQuotaName - The GroupQuota name. The name should be unique for the provided context tenantId/MgId. // - options - GroupQuotaSubscriptionsClientBeginCreateOrUpdateOptions contains the optional parameters for the GroupQuotaSubscriptionsClient.BeginCreateOrUpdate @@ -76,7 +76,7 @@ func (client *GroupQuotaSubscriptionsClient) BeginCreateOrUpdate(ctx context.Con // which can be included in the GroupQuotas. The request's TenantId is validated against the subscription's TenantId. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2024-12-18-preview func (client *GroupQuotaSubscriptionsClient) createOrUpdate(ctx context.Context, managementGroupID string, groupQuotaName string, options *GroupQuotaSubscriptionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "GroupQuotaSubscriptionsClient.BeginCreateOrUpdate" @@ -118,7 +118,7 @@ func (client *GroupQuotaSubscriptionsClient) createOrUpdateCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2024-12-18-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -128,7 +128,7 @@ func (client *GroupQuotaSubscriptionsClient) createOrUpdateCreateRequest(ctx con // TenantId. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2024-12-18-preview // - managementGroupID - Management Group Id. // - groupQuotaName - The GroupQuota name. The name should be unique for the provided context tenantId/MgId. // - options - GroupQuotaSubscriptionsClientBeginDeleteOptions contains the optional parameters for the GroupQuotaSubscriptionsClient.BeginDelete @@ -154,7 +154,7 @@ func (client *GroupQuotaSubscriptionsClient) BeginDelete(ctx context.Context, ma // Delete - Removes the subscription from GroupQuotas. The request's TenantId is validated against the subscription's TenantId. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2024-12-18-preview func (client *GroupQuotaSubscriptionsClient) deleteOperation(ctx context.Context, managementGroupID string, groupQuotaName string, options *GroupQuotaSubscriptionsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "GroupQuotaSubscriptionsClient.BeginDelete" @@ -196,7 +196,7 @@ func (client *GroupQuotaSubscriptionsClient) deleteCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2024-12-18-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -206,7 +206,7 @@ func (client *GroupQuotaSubscriptionsClient) deleteCreateRequest(ctx context.Con // is not a member of GroupQuota, it will return 404, else 200. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2024-12-18-preview // - managementGroupID - Management Group Id. // - groupQuotaName - The GroupQuota name. The name should be unique for the provided context tenantId/MgId. // - options - GroupQuotaSubscriptionsClientGetOptions contains the optional parameters for the GroupQuotaSubscriptionsClient.Get @@ -253,7 +253,7 @@ func (client *GroupQuotaSubscriptionsClient) getCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2024-12-18-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -270,7 +270,7 @@ func (client *GroupQuotaSubscriptionsClient) getHandleResponse(resp *http.Respon // NewListPager - Returns a list of the subscriptionIds associated with the GroupQuotas. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2024-12-18-preview // - managementGroupID - Management Group Id. // - groupQuotaName - The GroupQuota name. The name should be unique for the provided context tenantId/MgId. // - options - GroupQuotaSubscriptionsClientListOptions contains the optional parameters for the GroupQuotaSubscriptionsClient.NewListPager @@ -314,7 +314,7 @@ func (client *GroupQuotaSubscriptionsClient) listCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2024-12-18-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -334,7 +334,7 @@ func (client *GroupQuotaSubscriptionsClient) listHandleResponse(resp *http.Respo // validated against the subscription's TenantId. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2024-12-18-preview // - managementGroupID - Management Group Id. // - groupQuotaName - The GroupQuota name. The name should be unique for the provided context tenantId/MgId. // - options - GroupQuotaSubscriptionsClientBeginUpdateOptions contains the optional parameters for the GroupQuotaSubscriptionsClient.BeginUpdate @@ -362,7 +362,7 @@ func (client *GroupQuotaSubscriptionsClient) BeginUpdate(ctx context.Context, ma // validated against the subscription's TenantId. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2024-12-18-preview func (client *GroupQuotaSubscriptionsClient) update(ctx context.Context, managementGroupID string, groupQuotaName string, options *GroupQuotaSubscriptionsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "GroupQuotaSubscriptionsClient.BeginUpdate" @@ -404,7 +404,7 @@ func (client *GroupQuotaSubscriptionsClient) updateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2024-12-18-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/quota/armquota/groupquotasubscriptions_client_example_test.go b/sdk/resourcemanager/quota/armquota/groupquotasubscriptions_client_example_test.go index 7b740c9878ab..1e2643ed6c9d 100644 --- a/sdk/resourcemanager/quota/armquota/groupquotasubscriptions_client_example_test.go +++ b/sdk/resourcemanager/quota/armquota/groupquotasubscriptions_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/quota/armquota" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/106483d9f698ac3b6c0d481ab0c5fab14152e21f/specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotasSubscriptions/PutGroupQuotasSubscription.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/55c5a0cd6da80b2700333c01e9a9c6067de9cef0/specification/quota/resource-manager/Microsoft.Quota/preview/2024-12-18-preview/examples/GroupQuotasSubscriptions/PutGroupQuotasSubscription.json func ExampleGroupQuotaSubscriptionsClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -50,7 +50,7 @@ func ExampleGroupQuotaSubscriptionsClient_BeginCreateOrUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/106483d9f698ac3b6c0d481ab0c5fab14152e21f/specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotasSubscriptions/PatchGroupQuotasSubscription.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/55c5a0cd6da80b2700333c01e9a9c6067de9cef0/specification/quota/resource-manager/Microsoft.Quota/preview/2024-12-18-preview/examples/GroupQuotasSubscriptions/PatchGroupQuotasSubscription.json func ExampleGroupQuotaSubscriptionsClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -83,7 +83,7 @@ func ExampleGroupQuotaSubscriptionsClient_BeginUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/106483d9f698ac3b6c0d481ab0c5fab14152e21f/specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotasSubscriptions/DeleteGroupQuotaSubscriptions.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/55c5a0cd6da80b2700333c01e9a9c6067de9cef0/specification/quota/resource-manager/Microsoft.Quota/preview/2024-12-18-preview/examples/GroupQuotasSubscriptions/DeleteGroupQuotaSubscriptions.json func ExampleGroupQuotaSubscriptionsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -104,7 +104,7 @@ func ExampleGroupQuotaSubscriptionsClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/106483d9f698ac3b6c0d481ab0c5fab14152e21f/specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotasSubscriptions/GetGroupQuotaSubscriptions.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/55c5a0cd6da80b2700333c01e9a9c6067de9cef0/specification/quota/resource-manager/Microsoft.Quota/preview/2024-12-18-preview/examples/GroupQuotasSubscriptions/GetGroupQuotaSubscriptions.json func ExampleGroupQuotaSubscriptionsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -133,7 +133,7 @@ func ExampleGroupQuotaSubscriptionsClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/106483d9f698ac3b6c0d481ab0c5fab14152e21f/specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotasSubscriptions/ListGroupQuotaSubscriptions.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/55c5a0cd6da80b2700333c01e9a9c6067de9cef0/specification/quota/resource-manager/Microsoft.Quota/preview/2024-12-18-preview/examples/GroupQuotasSubscriptions/ListGroupQuotaSubscriptions.json func ExampleGroupQuotaSubscriptionsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/quota/armquota/groupquotausages_client.go b/sdk/resourcemanager/quota/armquota/groupquotausages_client.go deleted file mode 100644 index 03491725d573..000000000000 --- a/sdk/resourcemanager/quota/armquota/groupquotausages_client.go +++ /dev/null @@ -1,113 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armquota - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// GroupQuotaUsagesClient contains the methods for the GroupQuotaUsages group. -// Don't use this type directly, use NewGroupQuotaUsagesClient() instead. -type GroupQuotaUsagesClient struct { - internal *arm.Client -} - -// NewGroupQuotaUsagesClient creates a new instance of GroupQuotaUsagesClient with the specified values. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewGroupQuotaUsagesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*GroupQuotaUsagesClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &GroupQuotaUsagesClient{ - internal: cl, - } - return client, nil -} - -// NewListPager - Gets the GroupQuotas usages and limits(quota). Location is required paramter. -// -// Generated from API version 2023-06-01-preview -// - managementGroupID - Management Group Id. -// - groupQuotaName - The GroupQuota name. The name should be unique for the provided context tenantId/MgId. -// - resourceProviderName - The resource provider name, such as - Microsoft.Compute. Currently only Microsoft.Compute resource -// provider supports this API. -// - location - The name of the Azure region. -// - options - GroupQuotaUsagesClientListOptions contains the optional parameters for the GroupQuotaUsagesClient.NewListPager -// method. -func (client *GroupQuotaUsagesClient) NewListPager(managementGroupID string, groupQuotaName string, resourceProviderName string, location string, options *GroupQuotaUsagesClientListOptions) *runtime.Pager[GroupQuotaUsagesClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[GroupQuotaUsagesClientListResponse]{ - More: func(page GroupQuotaUsagesClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *GroupQuotaUsagesClientListResponse) (GroupQuotaUsagesClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "GroupQuotaUsagesClient.NewListPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, managementGroupID, groupQuotaName, resourceProviderName, location, options) - }, nil) - if err != nil { - return GroupQuotaUsagesClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *GroupQuotaUsagesClient) listCreateRequest(ctx context.Context, managementGroupID string, groupQuotaName string, resourceProviderName string, location string, options *GroupQuotaUsagesClientListOptions) (*policy.Request, error) { - urlPath := "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Quota/groupQuotas/{groupQuotaName}/resourceProviders/{resourceProviderName}/locationUsages/{location}" - if managementGroupID == "" { - return nil, errors.New("parameter managementGroupID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{managementGroupId}", url.PathEscape(managementGroupID)) - if groupQuotaName == "" { - return nil, errors.New("parameter groupQuotaName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{groupQuotaName}", url.PathEscape(groupQuotaName)) - if resourceProviderName == "" { - return nil, errors.New("parameter resourceProviderName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceProviderName}", url.PathEscape(resourceProviderName)) - if location == "" { - return nil, errors.New("parameter location cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *GroupQuotaUsagesClient) listHandleResponse(resp *http.Response) (GroupQuotaUsagesClientListResponse, error) { - result := GroupQuotaUsagesClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ResourceUsageList); err != nil { - return GroupQuotaUsagesClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/quota/armquota/groupquotausages_client_example_test.go b/sdk/resourcemanager/quota/armquota/groupquotausages_client_example_test.go deleted file mode 100644 index a8f76a140ef1..000000000000 --- a/sdk/resourcemanager/quota/armquota/groupquotausages_client_example_test.go +++ /dev/null @@ -1,74 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armquota_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/quota/armquota" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/106483d9f698ac3b6c0d481ab0c5fab14152e21f/specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GroupQuotaUsages/GetGroupQuotaUsages.json -func ExampleGroupQuotaUsagesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armquota.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewGroupQuotaUsagesClient().NewListPager("E7EC67B3-7657-4966-BFFC-41EFD36BAA09", "groupquota1", "Microsoft.Compute", "westus", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ResourceUsageList = armquota.ResourceUsageList{ - // Value: []*armquota.ResourceUsages{ - // { - // Name: to.Ptr("standardddv4family"), - // Type: to.Ptr("Microsoft.Quota/groupQuotas/locationSUsages"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/E7EC67B3-7657-4966-BFFC-41EFD36BAA09/providers/Microsoft.Quota/groupQuotas/groupquota1/resourceProviders/Microsoft.Compute/locationSUsages/eastus/resources/standardddv4family"), - // Properties: &armquota.GroupQuotaUsagesBase{ - // Name: &armquota.GroupQuotaUsagesBaseName{ - // LocalizedValue: to.Ptr("standard DDv4 Family vCPUs"), - // Value: to.Ptr("standardddv4family"), - // }, - // Limit: to.Ptr[int64](100), - // Unit: to.Ptr("count"), - // Usages: to.Ptr[int64](30), - // }, - // }, - // { - // Name: to.Ptr("standardav2family"), - // Type: to.Ptr("Microsoft.Quota/groupQuotas/locationSUsages"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/E7EC67B3-7657-4966-BFFC-41EFD36BAA09/providers/Microsoft.Quota/groupQuotas/groupquota1/resourceProviders/Microsoft.Compute/locationSUsages/eastus/resources/standardav2family"), - // Properties: &armquota.GroupQuotaUsagesBase{ - // Name: &armquota.GroupQuotaUsagesBaseName{ - // LocalizedValue: to.Ptr("standard Av2 Family vCPUs"), - // Value: to.Ptr("standardav2family"), - // }, - // Limit: to.Ptr[int64](150), - // Unit: to.Ptr("count"), - // Usages: to.Ptr[int64](70), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/quota/armquota/models.go b/sdk/resourcemanager/quota/armquota/models.go index dd2af8253ba9..87206bdac4c4 100644 --- a/sdk/resourcemanager/quota/armquota/models.go +++ b/sdk/resourcemanager/quota/armquota/models.go @@ -10,26 +10,6 @@ package armquota import "time" -// AdditionalAttributes - Additional attribute or filter to allow subscriptions meeting the requirements to be part of the -// GroupQuota. -type AdditionalAttributes struct { - // REQUIRED; The grouping Id for the group quota. It can be Billing Id or ServiceTreeId if applicable. - GroupID *GroupingID - - // Environment name. - Environment *EnvironmentType -} - -// AdditionalAttributesPatch - Additional attribute or filter to allow subscriptions meeting the requirements to be part of -// the GroupQuota. -type AdditionalAttributesPatch struct { - // Environment name. - Environment *EnvironmentType - - // The grouping Id for the group quota. It can be Billing Id or ServiceTreeId if applicable. - GroupID *GroupingID -} - // AllocatedQuotaToSubscriptionList - Quota allocated to subscriptions type AllocatedQuotaToSubscriptionList struct { // List of Group Quota Limit allocated to subscriptions. @@ -112,11 +92,6 @@ type AllocationRequestStatusProperties struct { RequestSubmitTime *time.Time } -// BillingAccountID - A Billing Account Id. -type BillingAccountID struct { - ID *string -} - // CommonResourceProperties - Resource properties. type CommonResourceProperties struct { // READ-ONLY; Resource ID @@ -213,8 +188,8 @@ type GroupQuotaDetails struct { // The current Group Quota Limit at the parentId level. Limit *int64 - // Location/Azure region for the quota requested for resource. - Region *string + // The resource name, such as SKU name. + ResourceName *string // READ-ONLY; Quota allocated to subscriptions AllocatedToSubscriptions *AllocatedQuotaToSubscriptionList @@ -244,7 +219,12 @@ type GroupQuotaDetailsName struct { // GroupQuotaLimit - Group Quota limit. type GroupQuotaLimit struct { // Group Quota properties for the specified resource. - Properties *GroupQuotaDetails + Properties *GroupQuotaLimitProperties +} + +// GroupQuotaLimitList - List of Group Quota Limit details. +type GroupQuotaLimitList struct { + Properties *GroupQuotaLimitListProperties // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string @@ -259,13 +239,41 @@ type GroupQuotaLimit struct { Type *string } -// GroupQuotaLimitList - List of Group Quota Limit details. -type GroupQuotaLimitList struct { +type GroupQuotaLimitListProperties struct { // List of Group Quota Limit details. Value []*GroupQuotaLimit // READ-ONLY; The URL to use for getting the next set of results. NextLink *string + + // READ-ONLY; Request status. + ProvisioningState *RequestState +} + +// GroupQuotaLimitProperties - Group Quota properties for the specified resource. +type GroupQuotaLimitProperties struct { + // Any comment related to quota request. + Comment *string + + // The current Group Quota Limit at the parentId level. + Limit *int64 + + // The resource name, such as SKU name. + ResourceName *string + + // READ-ONLY; Quota allocated to subscriptions + AllocatedToSubscriptions *AllocatedQuotaToSubscriptionList + + // READ-ONLY; The available Group Quota Limit at the MG level. This Group quota can be allocated to subscription(s). + AvailableLimit *int64 + + // READ-ONLY; 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. + Name *GroupQuotaDetailsName + + // READ-ONLY; 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. + Unit *string } // GroupQuotaList - List of Group Quotas at MG level. @@ -335,11 +343,11 @@ type GroupQuotaSubscriptionIDList struct { } type GroupQuotaSubscriptionIDProperties struct { + // An Azure subscriptionId. + SubscriptionID *string + // READ-ONLY; Status of this subscriptionId being associated with the GroupQuotasEntity. ProvisioningState *RequestState - - // READ-ONLY; An Azure subscriptionId. - SubscriptionID *string } // GroupQuotaSubscriptionRequestStatus - The new quota limit request status. @@ -408,47 +416,10 @@ type GroupQuotaUsagesBaseName struct { LocalizedValue *string } -// GroupQuotasEnforcementListResponse - List of Azure regions, where the group quotas is enabled for enforcement. -type GroupQuotasEnforcementListResponse struct { - // List of Azure Regions. - Value []*GroupQuotasEnforcementResponse - - // READ-ONLY; The URL to use for getting the next set of results. - NextLink *string -} - -// GroupQuotasEnforcementResponse - The GroupQuota Enforcement status for a Azure Location/Region. -type GroupQuotasEnforcementResponse struct { - Properties *GroupQuotasEnforcementResponseProperties - - // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" - ID *string - - // READ-ONLY; The name of the resource - Name *string - - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. - SystemData *SystemData - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string -} - -type GroupQuotasEnforcementResponseProperties struct { - // Is the GroupQuota Enforcement enabled for the Azure region. - EnforcementEnabled *EnforcementState - - // READ-ONLY; Details of the failure. - FaultCode *string - - // READ-ONLY; Request status. - ProvisioningState *RequestState -} - // GroupQuotasEntity - Properties and filters for ShareQuota. The request parameter is optional, if there are no filters specified. type GroupQuotasEntity struct { - // Properties and filters for ShareQuota. The request parameter is optional, if there are no filters specified. - Properties *GroupQuotasEntityBase + // Properties + Properties *GroupQuotasEntityProperties // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string @@ -466,9 +437,6 @@ type GroupQuotasEntity struct { // GroupQuotasEntityBase - Properties and filters for ShareQuota. The request parameter is optional, if there are no filters // specified. type GroupQuotasEntityBase struct { - // Additional attributes to filter/restrict the subscriptions, which can be added to the subscriptionIds. - AdditionalAttributes *AdditionalAttributes - // Display name of the GroupQuota entity. DisplayName *string @@ -479,9 +447,6 @@ type GroupQuotasEntityBase struct { // GroupQuotasEntityBasePatch - Properties and filters for ShareQuota. The request parameter is optional, if there are no // filters specified. type GroupQuotasEntityBasePatch struct { - // Additional attributes to filter/restrict the subscriptions, which can be added to the subscriptionIds. - AdditionalAttributes *AdditionalAttributesPatch - // Display name of the GroupQuota entity. DisplayName *string @@ -492,8 +457,8 @@ type GroupQuotasEntityBasePatch struct { // GroupQuotasEntityPatch - Properties and filters for ShareQuota. The request parameter is optional, if there are no filters // specified. type GroupQuotasEntityPatch struct { - // Properties and filters for ShareQuota. The request parameter is optional, if there are no filters specified. - Properties *GroupQuotasEntityBasePatch + // Properties + Properties *GroupQuotasEntityPatchProperties // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string @@ -508,13 +473,22 @@ type GroupQuotasEntityPatch struct { Type *string } -// GroupingID - The grouping Id for the group quota. It can be Billing Id or ServiceTreeId if applicable. -type GroupingID struct { - // GroupingId type. It is a required property. More types of groupIds can be supported in future. - GroupingIDType *GroupingIDType +// GroupQuotasEntityPatchProperties - Properties +type GroupQuotasEntityPatchProperties struct { + // Display name of the GroupQuota entity. + DisplayName *string - // GroupId value based on the groupingType selected - Billing Id or ServiceTreeId. - Value *string + // READ-ONLY; Provisioning state of the operation. + ProvisioningState *RequestState +} + +// GroupQuotasEntityProperties - Properties +type GroupQuotasEntityProperties struct { + // Display name of the GroupQuota entity. + DisplayName *string + + // READ-ONLY; Provisioning state of the operation. + ProvisioningState *RequestState } // LROResponse - The provisioning state for the operation. @@ -990,7 +964,12 @@ type SubscriptionQuotaAllocationRequestList struct { // allocated to the subscription can be allocated back to the MG Group Quota. type SubscriptionQuotaAllocations struct { // Quota properties for the specified resource. - Properties *SubscriptionQuotaDetails + Properties *SubscriptionQuotaAllocationsProperties +} + +// SubscriptionQuotaAllocationsList - Subscription quota list. +type SubscriptionQuotaAllocationsList struct { + Properties *SubscriptionQuotaAllocationsListProperties // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string @@ -1005,13 +984,31 @@ type SubscriptionQuotaAllocations struct { Type *string } -// SubscriptionQuotaAllocationsList - Subscription quota list. -type SubscriptionQuotaAllocationsList struct { +type SubscriptionQuotaAllocationsListProperties struct { // Subscription quota list. Value []*SubscriptionQuotaAllocations // READ-ONLY; The URL to use for getting the next set of results. NextLink *string + + // READ-ONLY; Request status. + ProvisioningState *RequestState +} + +// SubscriptionQuotaAllocationsProperties - Quota properties for the specified resource. +type SubscriptionQuotaAllocationsProperties struct { + // The total quota limit for the subscription. + Limit *int64 + + // The resource name, such as SKU name. + ResourceName *string + + // READ-ONLY; 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. + Name *SubscriptionQuotaDetailsName + + // READ-ONLY; The shareable quota for the subscription. + ShareableQuota *int64 } // SubscriptionQuotaAllocationsStatusList - Subscription quota allocation requests status list. @@ -1028,8 +1025,8 @@ type SubscriptionQuotaDetails struct { // The total quota limit for the subscription. Limit *int64 - // Location/Azure region for the quota requested for resource. - Region *string + // The resource name, such as SKU name. + ResourceName *string // READ-ONLY; 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. diff --git a/sdk/resourcemanager/quota/armquota/models_serde.go b/sdk/resourcemanager/quota/armquota/models_serde.go index 15d8a2cc0bb4..455e6b6aabe0 100644 --- a/sdk/resourcemanager/quota/armquota/models_serde.go +++ b/sdk/resourcemanager/quota/armquota/models_serde.go @@ -15,68 +15,6 @@ import ( "reflect" ) -// MarshalJSON implements the json.Marshaller interface for type AdditionalAttributes. -func (a AdditionalAttributes) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "environment", a.Environment) - populate(objectMap, "groupId", a.GroupID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AdditionalAttributes. -func (a *AdditionalAttributes) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "environment": - err = unpopulate(val, "Environment", &a.Environment) - delete(rawMsg, key) - case "groupId": - err = unpopulate(val, "GroupID", &a.GroupID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AdditionalAttributesPatch. -func (a AdditionalAttributesPatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "environment", a.Environment) - populate(objectMap, "groupId", a.GroupID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AdditionalAttributesPatch. -func (a *AdditionalAttributesPatch) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "environment": - err = unpopulate(val, "Environment", &a.Environment) - delete(rawMsg, key) - case "groupId": - err = unpopulate(val, "GroupID", &a.GroupID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type AllocatedQuotaToSubscriptionList. func (a AllocatedQuotaToSubscriptionList) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -341,33 +279,6 @@ func (a *AllocationRequestStatusProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type BillingAccountID. -func (b BillingAccountID) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", b.ID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type BillingAccountID. -func (b *BillingAccountID) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &b.ID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type CommonResourceProperties. func (c CommonResourceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -644,7 +555,7 @@ func (g GroupQuotaDetails) MarshalJSON() ([]byte, error) { populate(objectMap, "comment", g.Comment) populate(objectMap, "limit", g.Limit) populate(objectMap, "name", g.Name) - populate(objectMap, "region", g.Region) + populate(objectMap, "resourceName", g.ResourceName) populate(objectMap, "unit", g.Unit) return json.Marshal(objectMap) } @@ -673,8 +584,8 @@ func (g *GroupQuotaDetails) UnmarshalJSON(data []byte) error { case "name": err = unpopulate(val, "Name", &g.Name) delete(rawMsg, key) - case "region": - err = unpopulate(val, "Region", &g.Region) + case "resourceName": + err = unpopulate(val, "ResourceName", &g.ResourceName) delete(rawMsg, key) case "unit": err = unpopulate(val, "Unit", &g.Unit) @@ -720,6 +631,33 @@ func (g *GroupQuotaDetailsName) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type GroupQuotaLimit. func (g GroupQuotaLimit) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", g.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GroupQuotaLimit. +func (g *GroupQuotaLimit) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &g.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GroupQuotaLimitList. +func (g GroupQuotaLimitList) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", g.ID) populate(objectMap, "name", g.Name) @@ -729,8 +667,8 @@ func (g GroupQuotaLimit) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GroupQuotaLimit. -func (g *GroupQuotaLimit) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GroupQuotaLimitList. +func (g *GroupQuotaLimitList) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", g, err) @@ -761,16 +699,17 @@ func (g *GroupQuotaLimit) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type GroupQuotaLimitList. -func (g GroupQuotaLimitList) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GroupQuotaLimitListProperties. +func (g GroupQuotaLimitListProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "nextLink", g.NextLink) + populate(objectMap, "provisioningState", g.ProvisioningState) populate(objectMap, "value", g.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GroupQuotaLimitList. -func (g *GroupQuotaLimitList) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GroupQuotaLimitListProperties. +func (g *GroupQuotaLimitListProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", g, err) @@ -781,6 +720,9 @@ func (g *GroupQuotaLimitList) UnmarshalJSON(data []byte) error { case "nextLink": err = unpopulate(val, "NextLink", &g.NextLink) delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &g.ProvisioningState) + delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &g.Value) delete(rawMsg, key) @@ -792,6 +734,57 @@ func (g *GroupQuotaLimitList) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type GroupQuotaLimitProperties. +func (g GroupQuotaLimitProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "allocatedToSubscriptions", g.AllocatedToSubscriptions) + populate(objectMap, "availableLimit", g.AvailableLimit) + populate(objectMap, "comment", g.Comment) + populate(objectMap, "limit", g.Limit) + populate(objectMap, "name", g.Name) + populate(objectMap, "resourceName", g.ResourceName) + populate(objectMap, "unit", g.Unit) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GroupQuotaLimitProperties. +func (g *GroupQuotaLimitProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "allocatedToSubscriptions": + err = unpopulate(val, "AllocatedToSubscriptions", &g.AllocatedToSubscriptions) + delete(rawMsg, key) + case "availableLimit": + err = unpopulate(val, "AvailableLimit", &g.AvailableLimit) + delete(rawMsg, key) + case "comment": + err = unpopulate(val, "Comment", &g.Comment) + delete(rawMsg, key) + case "limit": + err = unpopulate(val, "Limit", &g.Limit) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &g.Name) + delete(rawMsg, key) + case "resourceName": + err = unpopulate(val, "ResourceName", &g.ResourceName) + delete(rawMsg, key) + case "unit": + err = unpopulate(val, "Unit", &g.Unit) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type GroupQuotaList. func (g GroupQuotaList) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1204,115 +1197,6 @@ func (g *GroupQuotaUsagesBaseName) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type GroupQuotasEnforcementListResponse. -func (g GroupQuotasEnforcementListResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", g.NextLink) - populate(objectMap, "value", g.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type GroupQuotasEnforcementListResponse. -func (g *GroupQuotasEnforcementListResponse) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &g.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &g.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type GroupQuotasEnforcementResponse. -func (g GroupQuotasEnforcementResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", g.ID) - populate(objectMap, "name", g.Name) - populate(objectMap, "properties", g.Properties) - populate(objectMap, "systemData", g.SystemData) - populate(objectMap, "type", g.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type GroupQuotasEnforcementResponse. -func (g *GroupQuotasEnforcementResponse) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &g.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &g.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &g.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &g.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &g.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type GroupQuotasEnforcementResponseProperties. -func (g GroupQuotasEnforcementResponseProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "enforcementEnabled", g.EnforcementEnabled) - populate(objectMap, "faultCode", g.FaultCode) - populate(objectMap, "provisioningState", g.ProvisioningState) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type GroupQuotasEnforcementResponseProperties. -func (g *GroupQuotasEnforcementResponseProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "enforcementEnabled": - err = unpopulate(val, "EnforcementEnabled", &g.EnforcementEnabled) - delete(rawMsg, key) - case "faultCode": - err = unpopulate(val, "FaultCode", &g.FaultCode) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &g.ProvisioningState) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type GroupQuotasEntity. func (g GroupQuotasEntity) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1359,7 +1243,6 @@ func (g *GroupQuotasEntity) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type GroupQuotasEntityBase. func (g GroupQuotasEntityBase) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "additionalAttributes", g.AdditionalAttributes) populate(objectMap, "displayName", g.DisplayName) populate(objectMap, "provisioningState", g.ProvisioningState) return json.Marshal(objectMap) @@ -1374,9 +1257,6 @@ func (g *GroupQuotasEntityBase) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "additionalAttributes": - err = unpopulate(val, "AdditionalAttributes", &g.AdditionalAttributes) - delete(rawMsg, key) case "displayName": err = unpopulate(val, "DisplayName", &g.DisplayName) delete(rawMsg, key) @@ -1394,7 +1274,6 @@ func (g *GroupQuotasEntityBase) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type GroupQuotasEntityBasePatch. func (g GroupQuotasEntityBasePatch) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "additionalAttributes", g.AdditionalAttributes) populate(objectMap, "displayName", g.DisplayName) populate(objectMap, "provisioningState", g.ProvisioningState) return json.Marshal(objectMap) @@ -1409,9 +1288,6 @@ func (g *GroupQuotasEntityBasePatch) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "additionalAttributes": - err = unpopulate(val, "AdditionalAttributes", &g.AdditionalAttributes) - delete(rawMsg, key) case "displayName": err = unpopulate(val, "DisplayName", &g.DisplayName) delete(rawMsg, key) @@ -1469,16 +1345,16 @@ func (g *GroupQuotasEntityPatch) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type GroupingID. -func (g GroupingID) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GroupQuotasEntityPatchProperties. +func (g GroupQuotasEntityPatchProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "groupingIdType", g.GroupingIDType) - populate(objectMap, "value", g.Value) + populate(objectMap, "displayName", g.DisplayName) + populate(objectMap, "provisioningState", g.ProvisioningState) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GroupingID. -func (g *GroupingID) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GroupQuotasEntityPatchProperties. +func (g *GroupQuotasEntityPatchProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", g, err) @@ -1486,11 +1362,42 @@ func (g *GroupingID) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "groupingIdType": - err = unpopulate(val, "GroupingIDType", &g.GroupingIDType) + case "displayName": + err = unpopulate(val, "DisplayName", &g.DisplayName) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &g.Value) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &g.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GroupQuotasEntityProperties. +func (g GroupQuotasEntityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "displayName", g.DisplayName) + populate(objectMap, "provisioningState", g.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GroupQuotasEntityProperties. +func (g *GroupQuotasEntityProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "displayName": + err = unpopulate(val, "DisplayName", &g.DisplayName) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &g.ProvisioningState) delete(rawMsg, key) } if err != nil { @@ -2718,6 +2625,33 @@ func (s *SubscriptionQuotaAllocationRequestList) UnmarshalJSON(data []byte) erro // MarshalJSON implements the json.Marshaller interface for type SubscriptionQuotaAllocations. func (s SubscriptionQuotaAllocations) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", s.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionQuotaAllocations. +func (s *SubscriptionQuotaAllocations) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SubscriptionQuotaAllocationsList. +func (s SubscriptionQuotaAllocationsList) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", s.ID) populate(objectMap, "name", s.Name) @@ -2727,8 +2661,8 @@ func (s SubscriptionQuotaAllocations) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionQuotaAllocations. -func (s *SubscriptionQuotaAllocations) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionQuotaAllocationsList. +func (s *SubscriptionQuotaAllocationsList) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -2759,16 +2693,17 @@ func (s *SubscriptionQuotaAllocations) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SubscriptionQuotaAllocationsList. -func (s SubscriptionQuotaAllocationsList) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SubscriptionQuotaAllocationsListProperties. +func (s SubscriptionQuotaAllocationsListProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "provisioningState", s.ProvisioningState) populate(objectMap, "value", s.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionQuotaAllocationsList. -func (s *SubscriptionQuotaAllocationsList) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionQuotaAllocationsListProperties. +func (s *SubscriptionQuotaAllocationsListProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -2779,6 +2714,9 @@ func (s *SubscriptionQuotaAllocationsList) UnmarshalJSON(data []byte) error { case "nextLink": err = unpopulate(val, "NextLink", &s.NextLink) delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &s.Value) delete(rawMsg, key) @@ -2790,6 +2728,45 @@ func (s *SubscriptionQuotaAllocationsList) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type SubscriptionQuotaAllocationsProperties. +func (s SubscriptionQuotaAllocationsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "limit", s.Limit) + populate(objectMap, "name", s.Name) + populate(objectMap, "resourceName", s.ResourceName) + populate(objectMap, "shareableQuota", s.ShareableQuota) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionQuotaAllocationsProperties. +func (s *SubscriptionQuotaAllocationsProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "limit": + err = unpopulate(val, "Limit", &s.Limit) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "resourceName": + err = unpopulate(val, "ResourceName", &s.ResourceName) + delete(rawMsg, key) + case "shareableQuota": + err = unpopulate(val, "ShareableQuota", &s.ShareableQuota) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type SubscriptionQuotaAllocationsStatusList. func (s SubscriptionQuotaAllocationsStatusList) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -2826,7 +2803,7 @@ func (s SubscriptionQuotaDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "limit", s.Limit) populate(objectMap, "name", s.Name) - populate(objectMap, "region", s.Region) + populate(objectMap, "resourceName", s.ResourceName) populate(objectMap, "shareableQuota", s.ShareableQuota) return json.Marshal(objectMap) } @@ -2846,8 +2823,8 @@ func (s *SubscriptionQuotaDetails) UnmarshalJSON(data []byte) error { case "name": err = unpopulate(val, "Name", &s.Name) delete(rawMsg, key) - case "region": - err = unpopulate(val, "Region", &s.Region) + case "resourceName": + err = unpopulate(val, "ResourceName", &s.ResourceName) delete(rawMsg, key) case "shareableQuota": err = unpopulate(val, "ShareableQuota", &s.ShareableQuota) diff --git a/sdk/resourcemanager/quota/armquota/operation_client.go b/sdk/resourcemanager/quota/armquota/operation_client.go index 928c50bb4aee..64c44aa89399 100644 --- a/sdk/resourcemanager/quota/armquota/operation_client.go +++ b/sdk/resourcemanager/quota/armquota/operation_client.go @@ -39,7 +39,7 @@ func NewOperationClient(credential azcore.TokenCredential, options *arm.ClientOp // NewListPager - List all the operations supported by the Microsoft.Quota resource provider. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2024-12-18-preview // - options - OperationClientListOptions contains the optional parameters for the OperationClient.NewListPager method. func (client *OperationClient) NewListPager(options *OperationClientListOptions) *runtime.Pager[OperationClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationClientListResponse]{ @@ -72,7 +72,7 @@ func (client *OperationClient) listCreateRequest(ctx context.Context, options *O return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2024-12-18-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/quota/armquota/operation_client_example_test.go b/sdk/resourcemanager/quota/armquota/operation_client_example_test.go index a117dc45664e..6ac0104c157c 100644 --- a/sdk/resourcemanager/quota/armquota/operation_client_example_test.go +++ b/sdk/resourcemanager/quota/armquota/operation_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/quota/armquota" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/106483d9f698ac3b6c0d481ab0c5fab14152e21f/specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/GetOperations.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/55c5a0cd6da80b2700333c01e9a9c6067de9cef0/specification/quota/resource-manager/Microsoft.Quota/preview/2024-12-18-preview/examples/GetOperations.json func ExampleOperationClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/quota/armquota/options.go b/sdk/resourcemanager/quota/armquota/options.go index e67354bfdf78..1d18fd258b02 100644 --- a/sdk/resourcemanager/quota/armquota/options.go +++ b/sdk/resourcemanager/quota/armquota/options.go @@ -30,31 +30,16 @@ type ClientListOptions struct { // placeholder for future optional parameters } -// GroupQuotaLimitsClientGetOptions contains the optional parameters for the GroupQuotaLimitsClient.Get method. -type GroupQuotaLimitsClientGetOptions struct { - // placeholder for future optional parameters -} - -// GroupQuotaLimitsClientListOptions contains the optional parameters for the GroupQuotaLimitsClient.NewListPager method. +// GroupQuotaLimitsClientListOptions contains the optional parameters for the GroupQuotaLimitsClient.List method. type GroupQuotaLimitsClientListOptions struct { // placeholder for future optional parameters } -// GroupQuotaLimitsRequestClientBeginCreateOrUpdateOptions contains the optional parameters for the GroupQuotaLimitsRequestClient.BeginCreateOrUpdate -// method. -type GroupQuotaLimitsRequestClientBeginCreateOrUpdateOptions struct { - // The GroupQuotaRequest body details for specific resourceProvider/location/resources. - GroupQuotaRequest *SubmittedResourceRequestStatus - - // Resumes the LRO from the provided token. - ResumeToken string -} - // GroupQuotaLimitsRequestClientBeginUpdateOptions contains the optional parameters for the GroupQuotaLimitsRequestClient.BeginUpdate // method. type GroupQuotaLimitsRequestClientBeginUpdateOptions struct { // The GroupQuotaRequest body details for specific resourceProvider/location/resources. - GroupQuotaRequest *SubmittedResourceRequestStatus + GroupQuotaRequest *GroupQuotaLimitList // Resumes the LRO from the provided token. ResumeToken string @@ -71,57 +56,12 @@ type GroupQuotaLimitsRequestClientListOptions struct { // placeholder for future optional parameters } -// GroupQuotaLocationSettingsClientBeginCreateOrUpdateOptions contains the optional parameters for the GroupQuotaLocationSettingsClient.BeginCreateOrUpdate -// method. -type GroupQuotaLocationSettingsClientBeginCreateOrUpdateOptions struct { - // The GroupQuota body details for creation or update of a GroupQuota entity. - LocationSettings *GroupQuotasEnforcementResponse - - // Resumes the LRO from the provided token. - ResumeToken string -} - -// GroupQuotaLocationSettingsClientBeginUpdateOptions contains the optional parameters for the GroupQuotaLocationSettingsClient.BeginUpdate -// method. -type GroupQuotaLocationSettingsClientBeginUpdateOptions struct { - // The GroupQuota body details for creation or update of a GroupQuota entity. - LocationSettings *GroupQuotasEnforcementResponse - - // Resumes the LRO from the provided token. - ResumeToken string -} - -// GroupQuotaLocationSettingsClientGetOptions contains the optional parameters for the GroupQuotaLocationSettingsClient.Get -// method. -type GroupQuotaLocationSettingsClientGetOptions struct { - // placeholder for future optional parameters -} - -// GroupQuotaLocationSettingsClientListOptions contains the optional parameters for the GroupQuotaLocationSettingsClient.NewListPager -// method. -type GroupQuotaLocationSettingsClientListOptions struct { - // placeholder for future optional parameters -} - -// GroupQuotaSubscriptionAllocationClientGetOptions contains the optional parameters for the GroupQuotaSubscriptionAllocationClient.Get -// method. -type GroupQuotaSubscriptionAllocationClientGetOptions struct { - // placeholder for future optional parameters -} - -// GroupQuotaSubscriptionAllocationClientListOptions contains the optional parameters for the GroupQuotaSubscriptionAllocationClient.NewListPager +// GroupQuotaSubscriptionAllocationClientListOptions contains the optional parameters for the GroupQuotaSubscriptionAllocationClient.List // method. type GroupQuotaSubscriptionAllocationClientListOptions struct { // placeholder for future optional parameters } -// GroupQuotaSubscriptionAllocationRequestClientBeginCreateOrUpdateOptions contains the optional parameters for the GroupQuotaSubscriptionAllocationRequestClient.BeginCreateOrUpdate -// method. -type GroupQuotaSubscriptionAllocationRequestClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - // GroupQuotaSubscriptionAllocationRequestClientBeginUpdateOptions contains the optional parameters for the GroupQuotaSubscriptionAllocationRequestClient.BeginUpdate // method. type GroupQuotaSubscriptionAllocationRequestClientBeginUpdateOptions struct { @@ -185,11 +125,6 @@ type GroupQuotaSubscriptionsClientListOptions struct { // placeholder for future optional parameters } -// GroupQuotaUsagesClientListOptions contains the optional parameters for the GroupQuotaUsagesClient.NewListPager method. -type GroupQuotaUsagesClientListOptions struct { - // placeholder for future optional parameters -} - // GroupQuotasClientBeginCreateOrUpdateOptions contains the optional parameters for the GroupQuotasClient.BeginCreateOrUpdate // method. type GroupQuotasClientBeginCreateOrUpdateOptions struct { diff --git a/sdk/resourcemanager/quota/armquota/quota_live_test.go b/sdk/resourcemanager/quota/armquota/quota_live_test.go index 461564bcc9be..de552b84c809 100644 --- a/sdk/resourcemanager/quota/armquota/quota_live_test.go +++ b/sdk/resourcemanager/quota/armquota/quota_live_test.go @@ -57,7 +57,6 @@ func TestQuotaTestSuite(t *testing.T) { // Microsoft.Quota/quotas/{resourceName} func (testsuite *QuotaTestSuite) TestQuota() { - var id string var err error // From step Quota_List @@ -85,17 +84,11 @@ func (testsuite *QuotaTestSuite) TestQuota() { Skiptoken: nil, }) for requestStatusClientNewListPager.More() { - nextResult, err := requestStatusClientNewListPager.NextPage(testsuite.ctx) + _, err := requestStatusClientNewListPager.NextPage(testsuite.ctx) testsuite.Require().NoError(err) - id = *nextResult.Value[0].Name break } - - // From step QuotaRequestStatus_Get - fmt.Println("Call operation: QuotaRequestStatus_Get") - _, err = requestStatusClient.Get(testsuite.ctx, id, "subscriptions/"+testsuite.subscriptionId+"/providers/Microsoft.Network/locations/eastus", nil) - testsuite.Require().NoError(err) } // Microsoft.Quota/operations @@ -115,7 +108,6 @@ func (testsuite *QuotaTestSuite) TestQuotaOperation() { // Microsoft.Quota/usages/{resourceName} func (testsuite *QuotaTestSuite) TestUsages() { - var resourceName string var err error // From step Usages_List fmt.Println("Call operation: Usages_List") @@ -123,15 +115,8 @@ func (testsuite *QuotaTestSuite) TestUsages() { testsuite.Require().NoError(err) usagesClientNewListPager := usagesClient.NewListPager("subscriptions/"+testsuite.subscriptionId+"/providers/Microsoft.Network/locations/eastus", nil) for usagesClientNewListPager.More() { - nextResult, err := usagesClientNewListPager.NextPage(testsuite.ctx) + _, err = usagesClientNewListPager.NextPage(testsuite.ctx) testsuite.Require().NoError(err) - - resourceName = *nextResult.Value[0].Name break } - - // From step Usages_Get - fmt.Println("Call operation: Usages_Get") - _, err = usagesClient.Get(testsuite.ctx, resourceName, "subscriptions/"+testsuite.subscriptionId+"/providers/Microsoft.Network/locations/eastus", nil) - testsuite.Require().NoError(err) } diff --git a/sdk/resourcemanager/quota/armquota/requeststatus_client.go b/sdk/resourcemanager/quota/armquota/requeststatus_client.go index 5944ddb7b766..5eb69dd0c978 100644 --- a/sdk/resourcemanager/quota/armquota/requeststatus_client.go +++ b/sdk/resourcemanager/quota/armquota/requeststatus_client.go @@ -46,7 +46,7 @@ func NewRequestStatusClient(credential azcore.TokenCredential, options *arm.Clie // operation. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2024-12-18-preview // - id - Quota request ID. // - scope - The target Azure resource URI. For example, /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/. // This is the target Azure @@ -88,7 +88,7 @@ func (client *RequestStatusClient) getCreateRequest(ctx context.Context, id stri return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2024-12-18-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -106,7 +106,7 @@ func (client *RequestStatusClient) getHandleResponse(resp *http.Response) (Reque // NewListPager - For the specified scope, get the current quota requests for a one year period ending at the time is made. // Use the oData filter to select quota requests. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2024-12-18-preview // - scope - The target Azure resource URI. For example, /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/. // This is the target Azure // resource URI for the List GET operation. If a {resourceName} is added after /quotas, then it's the target Azure resource @@ -153,7 +153,7 @@ func (client *RequestStatusClient) listCreateRequest(ctx context.Context, scope if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2024-12-18-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/quota/armquota/requeststatus_client_example_test.go b/sdk/resourcemanager/quota/armquota/requeststatus_client_example_test.go index 91f3faeb1d3d..a29d6aaa3242 100644 --- a/sdk/resourcemanager/quota/armquota/requeststatus_client_example_test.go +++ b/sdk/resourcemanager/quota/armquota/requeststatus_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/quota/armquota" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/106483d9f698ac3b6c0d481ab0c5fab14152e21f/specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/getQuotaRequestStatusFailed.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/55c5a0cd6da80b2700333c01e9a9c6067de9cef0/specification/quota/resource-manager/Microsoft.Quota/preview/2024-12-18-preview/examples/getQuotaRequestStatusFailed.json func ExampleRequestStatusClient_Get_quotaRequestFailed() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -65,7 +65,7 @@ func ExampleRequestStatusClient_Get_quotaRequestFailed() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/106483d9f698ac3b6c0d481ab0c5fab14152e21f/specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/getQuotaRequestStatusInProgress.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/55c5a0cd6da80b2700333c01e9a9c6067de9cef0/specification/quota/resource-manager/Microsoft.Quota/preview/2024-12-18-preview/examples/getQuotaRequestStatusInProgress.json func ExampleRequestStatusClient_Get_quotaRequestInProgress() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -122,7 +122,7 @@ func ExampleRequestStatusClient_Get_quotaRequestInProgress() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/106483d9f698ac3b6c0d481ab0c5fab14152e21f/specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/getQuotaRequestStatusById.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/55c5a0cd6da80b2700333c01e9a9c6067de9cef0/specification/quota/resource-manager/Microsoft.Quota/preview/2024-12-18-preview/examples/getQuotaRequestStatusById.json func ExampleRequestStatusClient_Get_quotaRequestStatus() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -166,7 +166,7 @@ func ExampleRequestStatusClient_Get_quotaRequestStatus() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/106483d9f698ac3b6c0d481ab0c5fab14152e21f/specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/getQuotaRequestsHistory.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/55c5a0cd6da80b2700333c01e9a9c6067de9cef0/specification/quota/resource-manager/Microsoft.Quota/preview/2024-12-18-preview/examples/getQuotaRequestsHistory.json func ExampleRequestStatusClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/quota/armquota/responses.go b/sdk/resourcemanager/quota/armquota/responses.go index 6958d5978060..08fc101e92ad 100644 --- a/sdk/resourcemanager/quota/armquota/responses.go +++ b/sdk/resourcemanager/quota/armquota/responses.go @@ -38,24 +38,12 @@ type ClientUpdateResponse struct { CurrentQuotaLimitBase } -// GroupQuotaLimitsClientGetResponse contains the response from method GroupQuotaLimitsClient.Get. -type GroupQuotaLimitsClientGetResponse struct { - // Group Quota limit. - GroupQuotaLimit -} - -// GroupQuotaLimitsClientListResponse contains the response from method GroupQuotaLimitsClient.NewListPager. +// GroupQuotaLimitsClientListResponse contains the response from method GroupQuotaLimitsClient.List. type GroupQuotaLimitsClientListResponse struct { // List of Group Quota Limit details. GroupQuotaLimitList } -// GroupQuotaLimitsRequestClientCreateOrUpdateResponse contains the response from method GroupQuotaLimitsRequestClient.BeginCreateOrUpdate. -type GroupQuotaLimitsRequestClientCreateOrUpdateResponse struct { - // Status of a single GroupQuota request. - SubmittedResourceRequestStatus -} - // GroupQuotaLimitsRequestClientGetResponse contains the response from method GroupQuotaLimitsRequestClient.Get. type GroupQuotaLimitsRequestClientGetResponse struct { // Status of a single GroupQuota request. @@ -70,54 +58,16 @@ type GroupQuotaLimitsRequestClientListResponse struct { // GroupQuotaLimitsRequestClientUpdateResponse contains the response from method GroupQuotaLimitsRequestClient.BeginUpdate. type GroupQuotaLimitsRequestClientUpdateResponse struct { - // Status of a single GroupQuota request. - SubmittedResourceRequestStatus -} - -// GroupQuotaLocationSettingsClientCreateOrUpdateResponse contains the response from method GroupQuotaLocationSettingsClient.BeginCreateOrUpdate. -type GroupQuotaLocationSettingsClientCreateOrUpdateResponse struct { - // The GroupQuota Enforcement status for a Azure Location/Region. - GroupQuotasEnforcementResponse -} - -// GroupQuotaLocationSettingsClientGetResponse contains the response from method GroupQuotaLocationSettingsClient.Get. -type GroupQuotaLocationSettingsClientGetResponse struct { - // The GroupQuota Enforcement status for a Azure Location/Region. - GroupQuotasEnforcementResponse -} - -// GroupQuotaLocationSettingsClientListResponse contains the response from method GroupQuotaLocationSettingsClient.NewListPager. -type GroupQuotaLocationSettingsClientListResponse struct { - // List of Azure regions, where the group quotas is enabled for enforcement. - GroupQuotasEnforcementListResponse -} - -// GroupQuotaLocationSettingsClientUpdateResponse contains the response from method GroupQuotaLocationSettingsClient.BeginUpdate. -type GroupQuotaLocationSettingsClientUpdateResponse struct { - // The GroupQuota Enforcement status for a Azure Location/Region. - GroupQuotasEnforcementResponse -} - -// GroupQuotaSubscriptionAllocationClientGetResponse contains the response from method GroupQuotaSubscriptionAllocationClient.Get. -type GroupQuotaSubscriptionAllocationClientGetResponse struct { - // Quota allocated to a subscription for the specific Resource Provider, Location, ResourceName. This will include the GroupQuota - // and total quota allocated to the subscription. Only the Group quota allocated to the subscription can be allocated back - // to the MG Group Quota. - SubscriptionQuotaAllocations + // List of Group Quota Limit details. + GroupQuotaLimitList } -// GroupQuotaSubscriptionAllocationClientListResponse contains the response from method GroupQuotaSubscriptionAllocationClient.NewListPager. +// GroupQuotaSubscriptionAllocationClientListResponse contains the response from method GroupQuotaSubscriptionAllocationClient.List. type GroupQuotaSubscriptionAllocationClientListResponse struct { // Subscription quota list. SubscriptionQuotaAllocationsList } -// GroupQuotaSubscriptionAllocationRequestClientCreateOrUpdateResponse contains the response from method GroupQuotaSubscriptionAllocationRequestClient.BeginCreateOrUpdate. -type GroupQuotaSubscriptionAllocationRequestClientCreateOrUpdateResponse struct { - // The subscription quota allocation status. - AllocationRequestStatus -} - // GroupQuotaSubscriptionAllocationRequestClientGetResponse contains the response from method GroupQuotaSubscriptionAllocationRequestClient.Get. type GroupQuotaSubscriptionAllocationRequestClientGetResponse struct { // The subscription quota allocation status. @@ -132,8 +82,8 @@ type GroupQuotaSubscriptionAllocationRequestClientListResponse struct { // GroupQuotaSubscriptionAllocationRequestClientUpdateResponse contains the response from method GroupQuotaSubscriptionAllocationRequestClient.BeginUpdate. type GroupQuotaSubscriptionAllocationRequestClientUpdateResponse struct { - // The subscription quota allocation status. - AllocationRequestStatus + // Subscription quota list. + SubscriptionQuotaAllocationsList } // GroupQuotaSubscriptionRequestsClientGetResponse contains the response from method GroupQuotaSubscriptionRequestsClient.Get. @@ -177,12 +127,6 @@ type GroupQuotaSubscriptionsClientUpdateResponse struct { GroupQuotaSubscriptionID } -// GroupQuotaUsagesClientListResponse contains the response from method GroupQuotaUsagesClient.NewListPager. -type GroupQuotaUsagesClientListResponse struct { - // List of resource usages and quotas for GroupQuota. - ResourceUsageList -} - // GroupQuotasClientCreateOrUpdateResponse contains the response from method GroupQuotasClient.BeginCreateOrUpdate. type GroupQuotasClientCreateOrUpdateResponse struct { // Properties and filters for ShareQuota. The request parameter is optional, if there are no filters specified. diff --git a/sdk/resourcemanager/quota/armquota/usages_client.go b/sdk/resourcemanager/quota/armquota/usages_client.go index c2ad95acc4c1..db2b02cfa9b3 100644 --- a/sdk/resourcemanager/quota/armquota/usages_client.go +++ b/sdk/resourcemanager/quota/armquota/usages_client.go @@ -43,7 +43,7 @@ func NewUsagesClient(credential azcore.TokenCredential, options *arm.ClientOptio // Get - Get the current usage of a resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2024-12-18-preview // - resourceName - Resource name for a given resource provider. For example: // - SKU name for Microsoft.Compute // - SKU or TotalLowPriorityCores for Microsoft.MachineLearningServices For Microsoft.Network PublicIPAddresses. @@ -87,7 +87,7 @@ func (client *UsagesClient) getCreateRequest(ctx context.Context, resourceName s return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2024-12-18-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -107,7 +107,7 @@ func (client *UsagesClient) getHandleResponse(resp *http.Response) (UsagesClient // NewListPager - Get a list of current usage for all resources for the scope specified. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2024-12-18-preview // - scope - The target Azure resource URI. For example, /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/. // This is the target Azure // resource URI for the List GET operation. If a {resourceName} is added after /quotas, then it's the target Azure resource @@ -145,7 +145,7 @@ func (client *UsagesClient) listCreateRequest(ctx context.Context, scope string, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2024-12-18-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/quota/armquota/usages_client_example_test.go b/sdk/resourcemanager/quota/armquota/usages_client_example_test.go index 8b165704ef08..be4c1e7062e9 100644 --- a/sdk/resourcemanager/quota/armquota/usages_client_example_test.go +++ b/sdk/resourcemanager/quota/armquota/usages_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/quota/armquota" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/106483d9f698ac3b6c0d481ab0c5fab14152e21f/specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/getComputeOneSkuUsages.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/55c5a0cd6da80b2700333c01e9a9c6067de9cef0/specification/quota/resource-manager/Microsoft.Quota/preview/2024-12-18-preview/examples/getComputeOneSkuUsages.json func ExampleUsagesClient_Get_quotasUsagesRequestForCompute() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -54,7 +54,7 @@ func ExampleUsagesClient_Get_quotasUsagesRequestForCompute() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/106483d9f698ac3b6c0d481ab0c5fab14152e21f/specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/getNetworkOneSkuUsages.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/55c5a0cd6da80b2700333c01e9a9c6067de9cef0/specification/quota/resource-manager/Microsoft.Quota/preview/2024-12-18-preview/examples/getNetworkOneSkuUsages.json func ExampleUsagesClient_Get_quotasUsagesRequestForNetwork() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -91,7 +91,7 @@ func ExampleUsagesClient_Get_quotasUsagesRequestForNetwork() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/106483d9f698ac3b6c0d481ab0c5fab14152e21f/specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/getComputeUsages.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/55c5a0cd6da80b2700333c01e9a9c6067de9cef0/specification/quota/resource-manager/Microsoft.Quota/preview/2024-12-18-preview/examples/getComputeUsages.json func ExampleUsagesClient_NewListPager_quotasListUsagesForCompute() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -311,7 +311,7 @@ func ExampleUsagesClient_NewListPager_quotasListUsagesForCompute() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/106483d9f698ac3b6c0d481ab0c5fab14152e21f/specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/getNetworkUsages.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/55c5a0cd6da80b2700333c01e9a9c6067de9cef0/specification/quota/resource-manager/Microsoft.Quota/preview/2024-12-18-preview/examples/getNetworkUsages.json func ExampleUsagesClient_NewListPager_quotasListUsagesForNetwork() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -717,7 +717,7 @@ func ExampleUsagesClient_NewListPager_quotasListUsagesForNetwork() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/106483d9f698ac3b6c0d481ab0c5fab14152e21f/specification/quota/resource-manager/Microsoft.Quota/preview/2023-06-01-preview/examples/getMachineLearningServicesUsages.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/55c5a0cd6da80b2700333c01e9a9c6067de9cef0/specification/quota/resource-manager/Microsoft.Quota/preview/2024-12-18-preview/examples/getMachineLearningServicesUsages.json func ExampleUsagesClient_NewListPager_quotasListUsagesMachineLearningServices() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil {