diff --git a/sdk/resourcemanager/quota/armquota/CHANGELOG.md b/sdk/resourcemanager/quota/armquota/CHANGELOG.md index ebfac6afd750..684572a8a408 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 (2024-12-19) +### 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/autorest.md b/sdk/resourcemanager/quota/armquota/autorest.md index 5c75f3f69b7c..9c458fa2e9f8 100644 --- a/sdk/resourcemanager/quota/armquota/autorest.md +++ b/sdk/resourcemanager/quota/armquota/autorest.md @@ -5,9 +5,8 @@ ``` 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 +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/quota/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/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 ``` \ 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 deleted file mode 100644 index aec5179c5423..000000000000 --- a/sdk/resourcemanager/quota/armquota/client_example_test.go +++ /dev/null @@ -1,1437 +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/getComputeOneSkuQuotaLimit.json -func ExampleClient_Get_quotasGetRequestForCompute() { - 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.NewClient().Get(ctx, "standardNDSFamily", "subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/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.CurrentQuotaLimitBase = armquota.CurrentQuotaLimitBase{ - // Name: to.Ptr("standardNDSFamily"), - // Type: to.Ptr("Microsoft.Quota/Quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/providers/Microsoft.Quota/Quotas/standardNDSFamily"), - // Properties: &armquota.Properties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Standard NDS Family vCPUs"), - // Value: to.Ptr("standardNDSFamily"), - // }, - // IsQuotaApplicable: to.Ptr(true), - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // LimitType: to.Ptr(armquota.QuotaLimitTypesIndependent), - // Value: to.Ptr[int32](100), - // }, - // 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/getNetworkOneSkuQuotaLimit.json -func ExampleClient_Get_quotasUsagesRequestForNetwork() { - 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.NewClient().Get(ctx, "MinPublicIpInterNetworkPrefixLength", "subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/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.CurrentQuotaLimitBase = armquota.CurrentQuotaLimitBase{ - // Name: to.Ptr("MinPublicIpInterNetworkPrefixLength"), - // Type: to.Ptr("Microsoft.Quota/Quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/Quotas/MinPublicIpInterNetworkPrefixLength"), - // Properties: &armquota.Properties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Min Public Ip InterNetwork Prefix Length"), - // Value: to.Ptr("MinPublicIpInterNetworkPrefixLength"), - // }, - // IsQuotaApplicable: to.Ptr(true), - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](10), - // }, - // ResourceType: to.Ptr("MinPublicIpInterNetworkPrefixLength"), - // 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/putNetworkOneSkuQuotaRequest.json -func ExampleClient_BeginCreateOrUpdate_quotasPutRequestForNetwork() { - 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.NewClient().BeginCreateOrUpdate(ctx, "MinPublicIpInterNetworkPrefixLength", "subscriptions/D7EC67B3-7657-4966-BFFC-41EFD36BAAB3/providers/Microsoft.Network/locations/eastus", armquota.CurrentQuotaLimitBase{ - Properties: &armquota.Properties{ - Name: &armquota.ResourceName{ - Value: to.Ptr("MinPublicIpInterNetworkPrefixLength"), - }, - Limit: &armquota.LimitObject{ - LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - Value: to.Ptr[int32](10), - }, - ResourceType: to.Ptr("MinPublicIpInterNetworkPrefixLength"), - }, - }, 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.CurrentQuotaLimitBase = armquota.CurrentQuotaLimitBase{ - // Name: to.Ptr("2B5C8515-37D8-4B6A-879B-CD641A2CF605"), - // Type: to.Ptr("Microsoft.Quota/quotas"), - // ID: to.Ptr("/subscriptions/D7EC67B3-7657-4966-BFFC-41EFD36BAAB3/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/quotaRequests/2B5C8515-37D8-4B6A-879B-CD641A2CF605"), - // Properties: &armquota.Properties{ - // Name: &armquota.ResourceName{ - // Value: to.Ptr("MinPublicIpInterNetworkPrefixLength"), - // }, - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](10), - // }, - // ResourceType: to.Ptr("MinPublicIpInterNetworkPrefixLength"), - // }, - // } -} - -// 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 -func ExampleClient_BeginCreateOrUpdate_quotasPutRequestForNetworkStandardSkuPublicIpAddressesResource() { - 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.NewClient().BeginCreateOrUpdate(ctx, "StandardSkuPublicIpAddresses", "subscriptions/D7EC67B3-7657-4966-BFFC-41EFD36BAAB3/providers/Microsoft.Network/locations/eastus", armquota.CurrentQuotaLimitBase{ - Properties: &armquota.Properties{ - Name: &armquota.ResourceName{ - Value: to.Ptr("StandardSkuPublicIpAddresses"), - }, - Limit: &armquota.LimitObject{ - LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - Value: to.Ptr[int32](10), - }, - ResourceType: to.Ptr("PublicIpAddresses"), - }, - }, 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.CurrentQuotaLimitBase = armquota.CurrentQuotaLimitBase{ - // Name: to.Ptr("2B5C8515-37D8-4B6A-879B-CD641A2CF605"), - // Type: to.Ptr("Microsoft.Quota/quotas"), - // ID: to.Ptr("/subscriptions/D7EC67B3-7657-4966-BFFC-41EFD36BAAB3/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/quotaRequests/2B5C8515-37D8-4B6A-879B-CD641A2CF605"), - // Properties: &armquota.Properties{ - // Name: &armquota.ResourceName{ - // Value: to.Ptr("StandardSkuPublicIpAddresses"), - // }, - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](10), - // }, - // ResourceType: to.Ptr("PublicIpAddresses"), - // }, - // } -} - -// 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 -func ExampleClient_BeginCreateOrUpdate_quotasPutRequestForCompute() { - 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.NewClient().BeginCreateOrUpdate(ctx, "standardFSv2Family", "subscriptions/D7EC67B3-7657-4966-BFFC-41EFD36BAAB3/providers/Microsoft.Compute/locations/eastus", armquota.CurrentQuotaLimitBase{ - Properties: &armquota.Properties{ - Name: &armquota.ResourceName{ - Value: to.Ptr("standardFSv2Family"), - }, - Limit: &armquota.LimitObject{ - LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - Value: to.Ptr[int32](10), - }, - }, - }, 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.CurrentQuotaLimitBase = armquota.CurrentQuotaLimitBase{ - // Name: to.Ptr("standardFSv2Family"), - // Type: to.Ptr("Microsoft.Quota/quotas"), - // ID: to.Ptr("/subscriptions/D7EC67B3-7657-4966-BFFC-41EFD36BAAB3/providers/Microsoft.Compute/locations/eastus/providers/Microsoft.Quota/quotas/standardFSv2Family"), - // Properties: &armquota.Properties{ - // Name: &armquota.ResourceName{ - // Value: to.Ptr("standardFSv2Family"), - // }, - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](10), - // }, - // }, - // } -} - -// 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 -func ExampleClient_BeginCreateOrUpdate_quotasRequestForMachineLearningServicesLowPriorityResource() { - 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.NewClient().BeginCreateOrUpdate(ctx, "TotalLowPriorityCores", "subscriptions/D7EC67B3-7657-4966-BFFC-41EFD36BAAB3/providers/Microsoft.MachineLearningServices/locations/eastus", armquota.CurrentQuotaLimitBase{ - Properties: &armquota.Properties{ - Name: &armquota.ResourceName{ - Value: to.Ptr("TotalLowPriorityCores"), - }, - Limit: &armquota.LimitObject{ - LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - Value: to.Ptr[int32](10), - }, - ResourceType: to.Ptr("lowPriority"), - }, - }, 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.CurrentQuotaLimitBase = armquota.CurrentQuotaLimitBase{ - // Name: to.Ptr("TotalLowPriorityCores"), - // Type: to.Ptr("Microsoft.Quota/quotas"), - // ID: to.Ptr("/subscriptions/D7EC67B3-7657-4966-BFFC-41EFD36BAAB3/providers/Microsoft.MachineLearningServices/locations/eastus/providers/Microsoft.Quota/quotas/TotalLowPriorityCores"), - // Properties: &armquota.Properties{ - // Name: &armquota.ResourceName{ - // Value: to.Ptr("TotalLowPriorityCores"), - // }, - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](10), - // }, - // ResourceType: to.Ptr("lowPriority"), - // }, - // } -} - -// 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 -func ExampleClient_BeginUpdate_quotasRequestPatchForCompute() { - 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.NewClient().BeginUpdate(ctx, "standardFSv2Family", "subscriptions/D7EC67B3-7657-4966-BFFC-41EFD36BAAB3/providers/Microsoft.Compute/locations/eastus", armquota.CurrentQuotaLimitBase{ - Properties: &armquota.Properties{ - Name: &armquota.ResourceName{ - Value: to.Ptr("standardFSv2Family"), - }, - Limit: &armquota.LimitObject{ - LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - Value: to.Ptr[int32](10), - }, - }, - }, 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.CurrentQuotaLimitBase = armquota.CurrentQuotaLimitBase{ - // Name: to.Ptr("standardFSv2Family"), - // Type: to.Ptr("Microsoft.Quota/quotas"), - // ID: to.Ptr("/subscriptions/D7EC67B3-7657-4966-BFFC-41EFD36BAAB3/providers/Microsoft.Compute/locations/eastus/providers/Microsoft.Quota/quotas/standardFSv2Family"), - // Properties: &armquota.Properties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Standard FSv2 Family vCPUs"), - // Value: to.Ptr("standardFSv2Family"), - // }, - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](10), - // }, - // }, - // } -} - -// 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 -func ExampleClient_BeginUpdate_quotasRequestPatchForNetwork() { - 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.NewClient().BeginUpdate(ctx, "MinPublicIpInterNetworkPrefixLength", "subscriptions/D7EC67B3-7657-4966-BFFC-41EFD36BAAB3/providers/Microsoft.Network/locations/eastus", armquota.CurrentQuotaLimitBase{ - Properties: &armquota.Properties{ - Name: &armquota.ResourceName{ - Value: to.Ptr("MinPublicIpInterNetworkPrefixLength"), - }, - Limit: &armquota.LimitObject{ - LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - Value: to.Ptr[int32](10), - }, - ResourceType: to.Ptr("MinPublicIpInterNetworkPrefixLength"), - }, - }, 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.CurrentQuotaLimitBase = armquota.CurrentQuotaLimitBase{ - // Name: to.Ptr("2B5C8515-37D8-4B6A-879B-CD641A2CF605"), - // Type: to.Ptr("Microsoft.Quota/quotas"), - // ID: to.Ptr("/subscriptions/D7EC67B3-7657-4966-BFFC-41EFD36BAAB3/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/quotaRequests/2B5C8515-37D8-4B6A-879B-CD641A2CF605"), - // Properties: &armquota.Properties{ - // Name: &armquota.ResourceName{ - // Value: to.Ptr("MinPublicIpInterNetworkPrefixLength"), - // }, - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](10), - // }, - // ResourceType: to.Ptr("MinPublicIpInterNetworkPrefixLength"), - // }, - // } -} - -// 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 -func ExampleClient_NewListPager_quotasListQuotaLimitsForCompute() { - 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.NewClient().NewListPager("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus", 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.Limits = armquota.Limits{ - // Value: []*armquota.CurrentQuotaLimitBase{ - // { - // Name: to.Ptr("standardFSv2Family"), - // Type: to.Ptr("Microsoft.Quota/Quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/providers/Microsoft.Quota/Quotas/standardFSv2Family"), - // Properties: &armquota.Properties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Standard FSv2 Family vCPUs"), - // Value: to.Ptr("standardFSv2Family"), - // }, - // IsQuotaApplicable: to.Ptr(true), - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](10), - // }, - // Unit: to.Ptr("Count"), - // }, - // }, - // { - // Name: to.Ptr("standardNDSFamily"), - // Type: to.Ptr("Microsoft.Quota/Quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/providers/Microsoft.Quota/Quotas/standardNDSFamily"), - // Properties: &armquota.Properties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Standard NDS Family vCPUs"), - // Value: to.Ptr("standardNDSFamily"), - // }, - // IsQuotaApplicable: to.Ptr(true), - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](10), - // }, - // Unit: to.Ptr("Count"), - // }, - // }, - // { - // Name: to.Ptr("standardNCSv2Family"), - // Type: to.Ptr("Microsoft.Quota/Quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/providers/Microsoft.Quota/Quotas/standardNCSv2Family"), - // Properties: &armquota.Properties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Standard NCSv2 Family vCPUs"), - // Value: to.Ptr("standardNCSv2Family"), - // }, - // IsQuotaApplicable: to.Ptr(true), - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](10), - // }, - // Unit: to.Ptr("Count"), - // }, - // }, - // { - // Name: to.Ptr("standardNCSv3Family"), - // Type: to.Ptr("Microsoft.Quota/Quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/providers/Microsoft.Quota/Quotas/standardNCSv3Family"), - // Properties: &armquota.Properties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Standard NCSv3 Family vCPUs"), - // Value: to.Ptr("standardNCSv3Family"), - // }, - // IsQuotaApplicable: to.Ptr(true), - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](10), - // }, - // Unit: to.Ptr("Count"), - // }, - // }, - // { - // Name: to.Ptr("standardLSv2Family"), - // Type: to.Ptr("Microsoft.Quota/Quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/providers/Microsoft.Quota/Quotas/standardLSv2Family"), - // Properties: &armquota.Properties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Standard LSv2 Family vCPUs"), - // Value: to.Ptr("standardLSv2Family"), - // }, - // IsQuotaApplicable: to.Ptr(true), - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](10), - // }, - // Unit: to.Ptr("Count"), - // }, - // }, - // { - // Name: to.Ptr("standardPBSFamily"), - // Type: to.Ptr("Microsoft.Quota/Quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/providers/Microsoft.Quota/Quotas/standardPBSFamily"), - // Properties: &armquota.Properties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Standard PBS Family vCPUs"), - // Value: to.Ptr("standardPBSFamily"), - // }, - // IsQuotaApplicable: to.Ptr(true), - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](10), - // }, - // Unit: to.Ptr("Count"), - // }, - // }, - // { - // Name: to.Ptr("standardEIv3Family"), - // Type: to.Ptr("Microsoft.Quota/Quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/providers/Microsoft.Quota/Quotas/standardEIv3Family"), - // Properties: &armquota.Properties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Standard EIv3 Family vCPUs"), - // Value: to.Ptr("standardEIv3Family"), - // }, - // IsQuotaApplicable: to.Ptr(true), - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](10), - // }, - // Unit: to.Ptr("Count"), - // }, - // }, - // { - // Name: to.Ptr("standardEISv3Family"), - // Type: to.Ptr("Microsoft.Quota/Quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/providers/Microsoft.Quota/Quotas/standardEISv3Family"), - // Properties: &armquota.Properties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Standard EISv3 Family vCPUs"), - // Value: to.Ptr("standardEISv3Family"), - // }, - // IsQuotaApplicable: to.Ptr(true), - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](10), - // }, - // Unit: to.Ptr("Count"), - // }, - // }, - // { - // Name: to.Ptr("standardDCSFamily"), - // Type: to.Ptr("Microsoft.Quota/Quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/providers/Microsoft.Quota/Quotas/standardDCSFamily"), - // Properties: &armquota.Properties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Standard DCS Family vCPUs"), - // Value: to.Ptr("standardDCSFamily"), - // }, - // IsQuotaApplicable: to.Ptr(true), - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](10), - // }, - // Unit: to.Ptr("Count"), - // }, - // }, - // { - // Name: to.Ptr("standardNVSv2Family"), - // Type: to.Ptr("Microsoft.Quota/Quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/providers/Microsoft.Quota/Quotas/standardNVSv2Family"), - // Properties: &armquota.Properties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Standard NVSv2 Family vCPUs"), - // Value: to.Ptr("standardNVSv2Family"), - // }, - // IsQuotaApplicable: to.Ptr(true), - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](10), - // }, - // Unit: to.Ptr("Count"), - // }, - // }, - // { - // Name: to.Ptr("standardMSv2Family"), - // Type: to.Ptr("Microsoft.Quota/Quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/providers/Microsoft.Quota/Quotas/standardMSv2Family"), - // Properties: &armquota.Properties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Standard MSv2 Family vCPUs"), - // Value: to.Ptr("standardMSv2Family"), - // }, - // IsQuotaApplicable: to.Ptr(true), - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](10), - // }, - // Unit: to.Ptr("Count"), - // }, - // }, - // { - // Name: to.Ptr("availabilitySets"), - // Type: to.Ptr("Microsoft.Quota/Quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/providers/Microsoft.Quota/Quotas/availabilitySets"), - // Properties: &armquota.Properties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Availability Sets"), - // Value: to.Ptr("availabilitySets"), - // }, - // IsQuotaApplicable: to.Ptr(false), - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](10), - // }, - // 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/getNetworkQuotaLimits.json -func ExampleClient_NewListPager_quotasListQuotaLimitsForNetwork() { - 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.NewClient().NewListPager("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus", 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.Limits = armquota.Limits{ - // Value: []*armquota.CurrentQuotaLimitBase{ - // { - // Name: to.Ptr("VirtualNetworks"), - // Type: to.Ptr("Microsoft.Quota/Quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/Quotas/"), - // Properties: &armquota.Properties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Virtual Networks"), - // Value: to.Ptr("VirtualNetworks"), - // }, - // IsQuotaApplicable: to.Ptr(false), - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](10), - // }, - // Properties: map[string]any{ - // }, - // Unit: to.Ptr("Count"), - // }, - // }, - // { - // Name: to.Ptr("StaticPublicIPAddresses"), - // Type: to.Ptr("Microsoft.Quota/Quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/Quotas/"), - // Properties: &armquota.Properties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Static Public IP Addresses"), - // Value: to.Ptr("StaticPublicIPAddresses"), - // }, - // IsQuotaApplicable: to.Ptr(false), - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](10), - // }, - // Properties: map[string]any{ - // }, - // Unit: to.Ptr("Count"), - // }, - // }, - // { - // Name: to.Ptr("NetworkSecurityGroups"), - // Type: to.Ptr("Microsoft.Quota/Quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/Quotas/"), - // Properties: &armquota.Properties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Network Security Groups"), - // Value: to.Ptr("NetworkSecurityGroups"), - // }, - // IsQuotaApplicable: to.Ptr(false), - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](10), - // }, - // Properties: map[string]any{ - // }, - // Unit: to.Ptr("Count"), - // }, - // }, - // { - // Name: to.Ptr("PublicIPAddresses"), - // Type: to.Ptr("Microsoft.Quota/Quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/Quotas/"), - // Properties: &armquota.Properties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Public IP Addresses - Basic"), - // Value: to.Ptr("PublicIPAddresses"), - // }, - // IsQuotaApplicable: to.Ptr(true), - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](10), - // }, - // Properties: map[string]any{ - // }, - // Unit: to.Ptr("Count"), - // }, - // }, - // { - // Name: to.Ptr("PublicIpPrefixes"), - // Type: to.Ptr("Microsoft.Quota/Quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/Quotas/"), - // Properties: &armquota.Properties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Public Ip Prefixes"), - // Value: to.Ptr("PublicIpPrefixes"), - // }, - // IsQuotaApplicable: to.Ptr(false), - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](10), - // }, - // Properties: map[string]any{ - // }, - // Unit: to.Ptr("Count"), - // }, - // }, - // { - // Name: to.Ptr("NatGateways"), - // Type: to.Ptr("Microsoft.Quota/Quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/Quotas/"), - // Properties: &armquota.Properties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Nat Gateways"), - // Value: to.Ptr("NatGateways"), - // }, - // IsQuotaApplicable: to.Ptr(false), - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](10), - // }, - // Properties: map[string]any{ - // }, - // Unit: to.Ptr("Count"), - // }, - // }, - // { - // Name: to.Ptr("NetworkInterfaces"), - // Type: to.Ptr("Microsoft.Quota/Quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/Quotas/"), - // Properties: &armquota.Properties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Network Interfaces"), - // Value: to.Ptr("NetworkInterfaces"), - // }, - // IsQuotaApplicable: to.Ptr(false), - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](10), - // }, - // Properties: map[string]any{ - // }, - // Unit: to.Ptr("Count"), - // }, - // }, - // { - // Name: to.Ptr("PrivateEndpoints"), - // Type: to.Ptr("Microsoft.Quota/Quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/Quotas/"), - // Properties: &armquota.Properties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Private Endpoints"), - // Value: to.Ptr("PrivateEndpoints"), - // }, - // IsQuotaApplicable: to.Ptr(false), - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](10), - // }, - // Properties: map[string]any{ - // }, - // Unit: to.Ptr("Count"), - // }, - // }, - // { - // Name: to.Ptr("PrivateEndpointRedirectMaps"), - // Type: to.Ptr("Microsoft.Quota/Quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/Quotas/"), - // Properties: &armquota.Properties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Private Endpoint Redirect Maps"), - // Value: to.Ptr("PrivateEndpointRedirectMaps"), - // }, - // IsQuotaApplicable: to.Ptr(false), - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](10), - // }, - // Properties: map[string]any{ - // }, - // Unit: to.Ptr("Count"), - // }, - // }, - // { - // Name: to.Ptr("LoadBalancers"), - // Type: to.Ptr("Microsoft.Quota/Quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/Quotas/"), - // Properties: &armquota.Properties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Load Balancers"), - // Value: to.Ptr("LoadBalancers"), - // }, - // IsQuotaApplicable: to.Ptr(false), - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](10), - // }, - // Properties: map[string]any{ - // }, - // Unit: to.Ptr("Count"), - // }, - // }, - // { - // Name: to.Ptr("PrivateLinkServices"), - // Type: to.Ptr("Microsoft.Quota/Quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/Quotas/"), - // Properties: &armquota.Properties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Private Link Services"), - // Value: to.Ptr("PrivateLinkServices"), - // }, - // IsQuotaApplicable: to.Ptr(false), - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](10), - // }, - // Properties: map[string]any{ - // }, - // Unit: to.Ptr("Count"), - // }, - // }, - // { - // Name: to.Ptr("ApplicationGateways"), - // Type: to.Ptr("Microsoft.Quota/Quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/Quotas/"), - // Properties: &armquota.Properties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Application Gateways"), - // Value: to.Ptr("ApplicationGateways"), - // }, - // IsQuotaApplicable: to.Ptr(false), - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](10), - // }, - // Properties: map[string]any{ - // }, - // Unit: to.Ptr("Count"), - // }, - // }, - // { - // Name: to.Ptr("RouteTables"), - // Type: to.Ptr("Microsoft.Quota/Quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/Quotas/"), - // Properties: &armquota.Properties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Route Tables"), - // Value: to.Ptr("RouteTables"), - // }, - // IsQuotaApplicable: to.Ptr(false), - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](10), - // }, - // Properties: map[string]any{ - // }, - // Unit: to.Ptr("Count"), - // }, - // }, - // { - // Name: to.Ptr("RouteFilters"), - // Type: to.Ptr("Microsoft.Quota/Quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/Quotas/"), - // Properties: &armquota.Properties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Route Filters"), - // Value: to.Ptr("RouteFilters"), - // }, - // IsQuotaApplicable: to.Ptr(false), - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](10), - // }, - // Properties: map[string]any{ - // }, - // Unit: to.Ptr("Count"), - // }, - // }, - // { - // Name: to.Ptr("NetworkWatchers"), - // Type: to.Ptr("Microsoft.Quota/Quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/Quotas/"), - // Properties: &armquota.Properties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Network Watchers"), - // Value: to.Ptr("NetworkWatchers"), - // }, - // IsQuotaApplicable: to.Ptr(false), - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](10), - // }, - // Properties: map[string]any{ - // }, - // Unit: to.Ptr("Count"), - // }, - // }, - // { - // Name: to.Ptr("PacketCaptures"), - // Type: to.Ptr("Microsoft.Quota/Quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/Quotas/"), - // Properties: &armquota.Properties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Packet Captures"), - // Value: to.Ptr("PacketCaptures"), - // }, - // IsQuotaApplicable: to.Ptr(false), - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](10), - // }, - // Properties: map[string]any{ - // }, - // Unit: to.Ptr("Count"), - // }, - // }, - // { - // Name: to.Ptr("ApplicationSecurityGroups"), - // Type: to.Ptr("Microsoft.Quota/Quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/Quotas/"), - // Properties: &armquota.Properties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Application Security Groups."), - // Value: to.Ptr("ApplicationSecurityGroups"), - // }, - // IsQuotaApplicable: to.Ptr(false), - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](10), - // }, - // Properties: map[string]any{ - // }, - // Unit: to.Ptr("Count"), - // }, - // }, - // { - // Name: to.Ptr("DdosProtectionPlans"), - // Type: to.Ptr("Microsoft.Quota/Quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/Quotas/"), - // Properties: &armquota.Properties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("DDoS Protection Plans."), - // Value: to.Ptr("DdosProtectionPlans"), - // }, - // IsQuotaApplicable: to.Ptr(false), - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](10), - // }, - // Properties: map[string]any{ - // }, - // Unit: to.Ptr("Count"), - // }, - // }, - // { - // Name: to.Ptr("DdosCustomPolicies"), - // Type: to.Ptr("Microsoft.Quota/Quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/Quotas/"), - // Properties: &armquota.Properties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("DDoS customized policies"), - // Value: to.Ptr("DdosCustomPolicies"), - // }, - // IsQuotaApplicable: to.Ptr(false), - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](10), - // }, - // Properties: map[string]any{ - // }, - // Unit: to.Ptr("Count"), - // }, - // }, - // { - // Name: to.Ptr("ServiceEndpointPolicies"), - // Type: to.Ptr("Microsoft.Quota/Quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/Quotas/"), - // Properties: &armquota.Properties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Service Endpoint Policies"), - // Value: to.Ptr("ServiceEndpointPolicies"), - // }, - // IsQuotaApplicable: to.Ptr(false), - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](10), - // }, - // Properties: map[string]any{ - // }, - // Unit: to.Ptr("Count"), - // }, - // }, - // { - // Name: to.Ptr("NetworkIntentPolicies"), - // Type: to.Ptr("Microsoft.Quota/Quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/Quotas/"), - // Properties: &armquota.Properties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Network Intent Policies"), - // Value: to.Ptr("NetworkIntentPolicies"), - // }, - // IsQuotaApplicable: to.Ptr(false), - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](10), - // }, - // Properties: map[string]any{ - // }, - // Unit: to.Ptr("Count"), - // }, - // }, - // { - // Name: to.Ptr("StandardSkuLoadBalancers"), - // Type: to.Ptr("Microsoft.Quota/Quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/Quotas/"), - // Properties: &armquota.Properties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Standard Sku Load Balancers"), - // Value: to.Ptr("StandardSkuLoadBalancers"), - // }, - // IsQuotaApplicable: to.Ptr(false), - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](10), - // }, - // Properties: map[string]any{ - // }, - // Unit: to.Ptr("Count"), - // }, - // }, - // { - // Name: to.Ptr("StandardSkuPublicIpAddresses"), - // Type: to.Ptr("Microsoft.Quota/Quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/Quotas/"), - // Properties: &armquota.Properties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Public IP Addresses - Standard"), - // Value: to.Ptr("StandardSkuPublicIpAddresses"), - // }, - // IsQuotaApplicable: to.Ptr(true), - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](10), - // }, - // Properties: map[string]any{ - // }, - // Unit: to.Ptr("Count"), - // }, - // }, - // { - // Name: to.Ptr("DnsServersPerVirtualNetwork"), - // Type: to.Ptr("Microsoft.Quota/Quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/Quotas/"), - // Properties: &armquota.Properties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("DNS servers per Virtual Network"), - // Value: to.Ptr("DnsServersPerVirtualNetwork"), - // }, - // IsQuotaApplicable: to.Ptr(false), - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](10), - // }, - // Properties: map[string]any{ - // }, - // Unit: to.Ptr("Count"), - // }, - // }, - // { - // Name: to.Ptr("CustomDnsServersPerP2SVpnGateway"), - // Type: to.Ptr("Microsoft.Quota/Quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/Quotas/"), - // Properties: &armquota.Properties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Custom DNS servers per P2SVpnGateway"), - // Value: to.Ptr("CustomDnsServersPerP2SVpnGateway"), - // }, - // IsQuotaApplicable: to.Ptr(false), - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](10), - // }, - // Properties: map[string]any{ - // }, - // Unit: to.Ptr("Count"), - // }, - // }, - // { - // Name: to.Ptr("SubnetsPerVirtualNetwork"), - // Type: to.Ptr("Microsoft.Quota/Quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/Quotas/"), - // Properties: &armquota.Properties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Subnets per Virtual Network"), - // Value: to.Ptr("SubnetsPerVirtualNetwork"), - // }, - // IsQuotaApplicable: to.Ptr(false), - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](10), - // }, - // Properties: map[string]any{ - // }, - // Unit: to.Ptr("Count"), - // }, - // }, - // { - // Name: to.Ptr("IPConfigurationsPerVirtualNetwork"), - // Type: to.Ptr("Microsoft.Quota/Quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/Quotas/"), - // Properties: &armquota.Properties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("IP Configurations per Virtual Network"), - // Value: to.Ptr("IPConfigurationsPerVirtualNetwork"), - // }, - // IsQuotaApplicable: to.Ptr(false), - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](10), - // }, - // Properties: map[string]any{ - // }, - // Unit: to.Ptr("Count"), - // }, - // }, - // { - // Name: to.Ptr("PeeringsPerVirtualNetwork"), - // Type: to.Ptr("Microsoft.Quota/Quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/Quotas/"), - // Properties: &armquota.Properties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Peerings per Virtual Network"), - // Value: to.Ptr("PeeringsPerVirtualNetwork"), - // }, - // IsQuotaApplicable: to.Ptr(false), - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](10), - // }, - // Properties: map[string]any{ - // }, - // Unit: to.Ptr("Count"), - // }, - // }, - // { - // Name: to.Ptr("SecurityRulesPerNetworkSecurityGroup"), - // Type: to.Ptr("Microsoft.Quota/Quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/Quotas/"), - // Properties: &armquota.Properties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Security rules per Network Security Group"), - // Value: to.Ptr("SecurityRulesPerNetworkSecurityGroup"), - // }, - // IsQuotaApplicable: to.Ptr(false), - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](10), - // }, - // Properties: map[string]any{ - // }, - // Unit: to.Ptr("Count"), - // }, - // }, - // { - // Name: to.Ptr("SecurityRulesPerNetworkIntentPolicy"), - // Type: to.Ptr("Microsoft.Quota/Quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/Quotas/"), - // Properties: &armquota.Properties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Security rules per Network Intent Policy"), - // Value: to.Ptr("SecurityRulesPerNetworkIntentPolicy"), - // }, - // IsQuotaApplicable: to.Ptr(false), - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](10), - // }, - // Properties: map[string]any{ - // }, - // Unit: to.Ptr("Count"), - // }, - // }, - // { - // Name: to.Ptr("RoutesPerNetworkIntentPolicy"), - // Type: to.Ptr("Microsoft.Quota/Quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/Quotas/"), - // Properties: &armquota.Properties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Routes per Network Intent Policy"), - // Value: to.Ptr("RoutesPerNetworkIntentPolicy"), - // }, - // IsQuotaApplicable: to.Ptr(false), - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](10), - // }, - // Properties: map[string]any{ - // }, - // Unit: to.Ptr("Count"), - // }, - // }, - // { - // Name: to.Ptr("SecurityRuleAddressesOrPortsPerNetworkSecurityGroup"), - // Type: to.Ptr("Microsoft.Quota/Quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/Quotas/"), - // Properties: &armquota.Properties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Security rules addresses or ports per Network Security Group"), - // Value: to.Ptr("SecurityRuleAddressesOrPortsPerNetworkSecurityGroup"), - // }, - // IsQuotaApplicable: to.Ptr(false), - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](10), - // }, - // Properties: map[string]any{ - // }, - // Unit: to.Ptr("Count"), - // }, - // }, - // { - // Name: to.Ptr("InboundRulesPerLoadBalancer"), - // Type: to.Ptr("Microsoft.Quota/Quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/Quotas/"), - // Properties: &armquota.Properties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Inbound Rules per Load Balancer"), - // Value: to.Ptr("InboundRulesPerLoadBalancer"), - // }, - // IsQuotaApplicable: to.Ptr(false), - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](10), - // }, - // Properties: map[string]any{ - // }, - // Unit: to.Ptr("Count"), - // }, - // }, - // { - // Name: to.Ptr("FrontendIPConfigurationPerLoadBalancer"), - // Type: to.Ptr("Microsoft.Quota/Quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/Quotas/"), - // Properties: &armquota.Properties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Frontend IP Configurations per Load Balancer"), - // Value: to.Ptr("FrontendIPConfigurationPerLoadBalancer"), - // }, - // IsQuotaApplicable: to.Ptr(false), - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](10), - // }, - // Properties: map[string]any{ - // }, - // Unit: to.Ptr("Count"), - // }, - // }, - // { - // Name: to.Ptr("OutboundRulesPerLoadBalancer"), - // Type: to.Ptr("Microsoft.Quota/Quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/Quotas/"), - // Properties: &armquota.Properties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Outbound Rules per Load Balancer"), - // Value: to.Ptr("OutboundRulesPerLoadBalancer"), - // }, - // IsQuotaApplicable: to.Ptr(false), - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](10), - // }, - // Properties: map[string]any{ - // }, - // Unit: to.Ptr("Count"), - // }, - // }, - // { - // Name: to.Ptr("RoutesPerRouteTable"), - // Type: to.Ptr("Microsoft.Quota/Quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/Quotas/"), - // Properties: &armquota.Properties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Routes per Route Table"), - // Value: to.Ptr("RoutesPerRouteTable"), - // }, - // IsQuotaApplicable: to.Ptr(false), - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](10), - // }, - // Properties: map[string]any{ - // }, - // Unit: to.Ptr("Count"), - // }, - // }, - // { - // Name: to.Ptr("RoutesWithServiceTagPerRouteTable"), - // Type: to.Ptr("Microsoft.Quota/Quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/Quotas/"), - // Properties: &armquota.Properties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Routes with service tag per Route Table"), - // Value: to.Ptr("RoutesWithServiceTagPerRouteTable"), - // }, - // IsQuotaApplicable: to.Ptr(false), - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](10), - // }, - // Properties: map[string]any{ - // }, - // Unit: to.Ptr("Count"), - // }, - // }, - // { - // Name: to.Ptr("MinPublicIpInterNetworkPrefixLength"), - // Type: to.Ptr("Microsoft.Quota/Quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/Quotas/"), - // Properties: &armquota.Properties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Min Public Ip InterNetwork Prefix Length"), - // Value: to.Ptr("MinPublicIpInterNetworkPrefixLength"), - // }, - // IsQuotaApplicable: to.Ptr(true), - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](10), - // }, - // Properties: map[string]any{ - // }, - // ResourceType: to.Ptr("MinPublicIpInterNetworkPrefixLength"), - // 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/getMachineLearningServicesQuotaLimits.json -func ExampleClient_NewListPager_quotasListQuotaLimitsMachineLearningServices() { - 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.NewClient().NewListPager("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.MachineLearningServices/locations/eastus", 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.Limits = armquota.Limits{ - // Value: []*armquota.CurrentQuotaLimitBase{ - // { - // Name: to.Ptr("standardDv2Family"), - // Type: to.Ptr("Microsoft.Quota/Quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.MachineLearningServices/locations/eastus/providers/Microsoft.Quota/Quotas/standardDv2Family"), - // Properties: &armquota.Properties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Standard Dv2 Family vCPUs"), - // Value: to.Ptr("standardDv2Family"), - // }, - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](10), - // }, - // ResourceType: to.Ptr("dedicated"), - // Unit: to.Ptr("Count"), - // }, - // }, - // { - // Name: to.Ptr("totalLowPriorityCores"), - // Type: to.Ptr("Microsoft.Quota/Quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.MachineLearningServices/locations/eastus/providers/Microsoft.Quota/Quotas/totalLowPriorityCores"), - // Properties: &armquota.Properties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Total Regional Low-priority vCPUs"), - // Value: to.Ptr("totalLowPriorityCores"), - // }, - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](10), - // }, - // ResourceType: to.Ptr("lowPriority"), - // Unit: to.Ptr("Count"), - // }, - // }}, - // } - } -} 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/go.mod b/sdk/resourcemanager/quota/armquota/go.mod index 7958e0d1fefd..5ecd94678c4e 100644 --- a/sdk/resourcemanager/quota/armquota/go.mod +++ b/sdk/resourcemanager/quota/armquota/go.mod @@ -4,13 +4,13 @@ go 1.18 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.0 github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3 v3.1.0 github.com/stretchr/testify v1.10.0 ) require ( + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.2.0 // indirect github.com/AzureAD/microsoft-authentication-library-for-go v1.3.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect 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 deleted file mode 100644 index db9b5d8f3752..000000000000 --- a/sdk/resourcemanager/quota/armquota/groupquotalimits_client_example_test.go +++ /dev/null @@ -1,136 +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/GroupQuotaLimits/GetGroupQuotaLimits-Compute.json -func ExampleGroupQuotaLimitsClient_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.NewGroupQuotaLimitsClient().Get(ctx, "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", "groupquota1", "Microsoft.Compute", "cores", "location eq 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"), - // 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"), - // }, - // } -} - -// 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 deleted file mode 100644 index 5deaef304c53..000000000000 --- a/sdk/resourcemanager/quota/armquota/groupquotalimitsrequest_client_example_test.go +++ /dev/null @@ -1,217 +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/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 -func ExampleGroupQuotaLimitsRequestClient_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.NewGroupQuotaLimitsRequestClient().BeginUpdate(ctx, "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", "groupquota1", "Microsoft.Compute", "standardav2family", &armquota.GroupQuotaLimitsRequestClientBeginUpdateOptions{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/GroupQuotaLimitsRequests_Get.json -func ExampleGroupQuotaLimitsRequestClient_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.NewGroupQuotaLimitsRequestClient().Get(ctx, "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", "groupquota1", "requestId", 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.SubmittedResourceRequestStatus = armquota.SubmittedResourceRequestStatus{ - // Name: to.Ptr("requestId"), - // 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/requestId"), - // Properties: &armquota.SubmittedResourceRequestStatusProperties{ - // FaultCode: to.Ptr("ResourceNotAvailableForOffer"), - // ProvisioningState: to.Ptr(armquota.RequestStateSucceeded), - // RequestSubmitTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-03-20T05:29:34.144Z"); return t}()), - // RequestedResource: &armquota.GroupQuotaRequestBase{ - // Properties: &armquota.GroupQuotaRequestBaseProperties{ - // Name: &armquota.GroupQuotaRequestBasePropertiesName{ - // LocalizedValue: to.Ptr("standard DDv4 Family vCPUs"), - // Value: to.Ptr("standardddv4family"), - // }, - // Comments: to.Ptr(""), - // 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/GroupQuotaLimitsRequests_List.json -func ExampleGroupQuotaLimitsRequestClient_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.NewGroupQuotaLimitsRequestClient().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.SubmittedResourceRequestStatusList = armquota.SubmittedResourceRequestStatusList{ - // Value: []*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{ - // FaultCode: to.Ptr("ResourceNotAvailableForOffer"), - // ProvisioningState: to.Ptr(armquota.RequestStateSucceeded), - // RequestSubmitTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-11-18T00:12:34.004Z"); return t}()), - // RequestedResource: &armquota.GroupQuotaRequestBase{ - // Properties: &armquota.GroupQuotaRequestBaseProperties{ - // Name: &armquota.GroupQuotaRequestBasePropertiesName{ - // LocalizedValue: to.Ptr("standard DDv4 Family vCPUs"), - // Value: to.Ptr("standardddv4family"), - // }, - // Comments: to.Ptr("Contoso requires more quota."), - // Limit: to.Ptr[int64](100), - // Region: to.Ptr("westus"), - // }, - // }, - // }, - // }, - // { - // Name: to.Ptr("requestId2"), - // 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/requestId2"), - // Properties: &armquota.SubmittedResourceRequestStatusProperties{ - // FaultCode: to.Ptr(""), - // ProvisioningState: to.Ptr(armquota.RequestStateSucceeded), - // RequestSubmitTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-11-17T00:57:43.410Z"); return t}()), - // RequestedResource: &armquota.GroupQuotaRequestBase{ - // Properties: &armquota.GroupQuotaRequestBaseProperties{ - // Name: &armquota.GroupQuotaRequestBasePropertiesName{ - // LocalizedValue: to.Ptr("standardav2family"), - // Value: to.Ptr("standardav2family"), - // }, - // Comments: to.Ptr("Contoso requires more quota."), - // Limit: to.Ptr[int64](150), - // Region: to.Ptr("westus"), - // }, - // }, - // }, - // }}, - // } - } -} 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 deleted file mode 100644 index 7ba38058cd97..000000000000 --- a/sdk/resourcemanager/quota/armquota/groupquotas_client_example_test.go +++ /dev/null @@ -1,224 +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/GroupQuotas/PutGroupQuotas.json -func ExampleGroupQuotasClient_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.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"), - }, - }, - DisplayName: to.Ptr("GroupQuota1"), - }, - }, - }) - 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.GroupQuotasEntity = armquota.GroupQuotasEntity{ - // 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"), - // }, - // }, - // 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 -func ExampleGroupQuotasClient_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.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"), - }, - }, - DisplayName: to.Ptr("UpdatedGroupQuota1"), - }, - }, - }) - 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.GroupQuotasEntity = armquota.GroupQuotasEntity{ - // 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"), - // }, - // }, - // 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 -func ExampleGroupQuotasClient_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.NewGroupQuotasClient().Get(ctx, "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", "groupquota1", 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.GroupQuotasEntity = armquota.GroupQuotasEntity{ - // 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"), - // }, - // }, - // 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 -func ExampleGroupQuotasClient_BeginDelete() { - 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.NewGroupQuotasClient().BeginDelete(ctx, "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", "groupquota1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// 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 -func ExampleGroupQuotasClient_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.NewGroupQuotasClient().NewListPager("E7EC67B3-7657-4966-BFFC-41EFD36BAA09", 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.GroupQuotaList = armquota.GroupQuotaList{ - // Value: []*armquota.GroupQuotasEntity{ - // { - // 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"), - // }, - // }, - // 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 deleted file mode 100644 index c3a7b18dd3fd..000000000000 --- a/sdk/resourcemanager/quota/armquota/groupquotasubscriptionallocation_client_example_test.go +++ /dev/null @@ -1,108 +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/SubscriptionQuotaAllocation/SubscriptionQuotaAllocation_List-Compute.json -func ExampleGroupQuotaSubscriptionAllocationClient_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.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) - 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"), - // 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), - // }, - // } -} 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 deleted file mode 100644 index 2113b1175d27..000000000000 --- a/sdk/resourcemanager/quota/armquota/groupquotasubscriptionallocationrequest_client_example_test.go +++ /dev/null @@ -1,213 +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/SubscriptionQuotaAllocationRequests/SubscriptionQuotaAllocationRequests_Get-Compute.json -func ExampleGroupQuotaSubscriptionAllocationRequestClient_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.NewGroupQuotaSubscriptionAllocationRequestClient().Get(ctx, "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", "groupquota1", "AE000000-0000-0000-0000-00000000000A", 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.AllocationRequestStatus = armquota.AllocationRequestStatus{ - // Name: to.Ptr("AE000000-0000-0000-0000-00000000000A"), - // Type: to.Ptr("Microsoft.Quota/groupQuotas/quotaAllocationRequests"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/E7EC67B3-7657-4966-BFFC-41EFD36BAA09/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Quota/groupQuotas/groupquota1/quotaAllocationRequests/AE000000-0000-0000-0000-00000000000A"), - // Properties: &armquota.AllocationRequestStatusProperties{ - // FaultCode: to.Ptr("ContactSupport"), - // ProvisioningState: to.Ptr(armquota.RequestStateSucceeded), - // RequestSubmitTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-11-17T01:06:02.191Z"); return t}()), - // RequestedResource: &armquota.AllocationRequestBase{ - // Properties: &armquota.AllocationRequestBaseProperties{ - // Name: &armquota.AllocationRequestBasePropertiesName{ - // LocalizedValue: to.Ptr("standard Av2 Family vCPUs"), - // Value: to.Ptr("standardav2family"), - // }, - // Limit: to.Ptr[int64](75), - // 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/SubscriptionQuotaAllocationRequests_List-Compute.json -func ExampleGroupQuotaSubscriptionAllocationRequestClient_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.NewGroupQuotaSubscriptionAllocationRequestClient().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.AllocationRequestStatusList = armquota.AllocationRequestStatusList{ - // Value: []*armquota.AllocationRequestStatus{ - // { - // Name: to.Ptr("AE000000-0000-0000-0000-00000000000A"), - // Type: to.Ptr("Microsoft.Quota/groupQuotas/quotaAllocationRequests"), - // 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/quotaAllocationRequests/AE000000-0000-0000-0000-00000000000A"), - // Properties: &armquota.AllocationRequestStatusProperties{ - // FaultCode: to.Ptr("ContactSupport"), - // ProvisioningState: to.Ptr(armquota.RequestStateSucceeded), - // RequestSubmitTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-03-20T06:18:59.913Z"); return t}()), - // RequestedResource: &armquota.AllocationRequestBase{ - // Properties: &armquota.AllocationRequestBaseProperties{ - // Name: &armquota.AllocationRequestBasePropertiesName{ - // LocalizedValue: to.Ptr("standard Av2 Family vCPUs"), - // Value: to.Ptr("standardav2family"), - // }, - // Limit: to.Ptr[int64](75), - // 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/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 deleted file mode 100644 index 9e1bf301e43b..000000000000 --- a/sdk/resourcemanager/quota/armquota/groupquotasubscriptionrequests_client_example_test.go +++ /dev/null @@ -1,86 +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/SubscriptionRequests/SubscriptionRequests_List.json -func ExampleGroupQuotaSubscriptionRequestsClient_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.NewGroupQuotaSubscriptionRequestsClient().NewListPager("E7EC67B3-7657-4966-BFFC-41EFD36BAA09", "groupquota1", 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.GroupQuotaSubscriptionRequestStatusList = armquota.GroupQuotaSubscriptionRequestStatusList{ - // Value: []*armquota.GroupQuotaSubscriptionRequestStatus{ - // { - // Name: to.Ptr("11111111-1111-1111-1111-111111111111"), - // Type: to.Ptr("Microsoft.Quota/groupQuotas/SubscriptionRequest"), - // ID: to.Ptr("/subscriptions/11111111-1111-1111-1111-111111111111"), - // Properties: &armquota.GroupQuotaSubscriptionRequestStatusProperties{ - // ProvisioningState: to.Ptr(armquota.RequestStateSucceeded), - // RequestSubmitTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-11-17T00:56:45.009Z"); return t}()), - // SubscriptionID: to.Ptr("11111111-1111-1111-1111-111111111111"), - // }, - // }}, - // } - } -} - -// 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 -func ExampleGroupQuotaSubscriptionRequestsClient_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.NewGroupQuotaSubscriptionRequestsClient().Get(ctx, "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", "groupquota1", "00000000-0000-0000-0000-000000000000", 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.GroupQuotaSubscriptionRequestStatus = armquota.GroupQuotaSubscriptionRequestStatus{ - // Name: to.Ptr("11111111-1111-1111-1111-111111111111"), - // Type: to.Ptr("Microsoft.Quota/groupQuotas/SubscriptionRequest"), - // ID: to.Ptr("/subscriptions/11111111-1111-1111-1111-111111111111"), - // Properties: &armquota.GroupQuotaSubscriptionRequestStatusProperties{ - // ProvisioningState: to.Ptr(armquota.RequestStateSucceeded), - // RequestSubmitTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-11-17T00:56:45.009Z"); return t}()), - // SubscriptionID: to.Ptr("11111111-1111-1111-1111-111111111111"), - // }, - // } -} 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 deleted file mode 100644 index 7b740c9878ab..000000000000 --- a/sdk/resourcemanager/quota/armquota/groupquotasubscriptions_client_example_test.go +++ /dev/null @@ -1,180 +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/GroupQuotasSubscriptions/PutGroupQuotasSubscription.json -func ExampleGroupQuotaSubscriptionsClient_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.NewGroupQuotaSubscriptionsClient().BeginCreateOrUpdate(ctx, "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", "groupquota1", 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.GroupQuotaSubscriptionID = armquota.GroupQuotaSubscriptionID{ - // Name: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.Quota/groupQuotas/subscriptions"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/E7EC67B3-7657-4966-BFFC-41EFD36BAA09/providers/Microsoft.Quota/groupQuotas/groupquota1/subscriptions/00000000-0000-0000-0000-000000000000"), - // Properties: &armquota.GroupQuotaSubscriptionIDProperties{ - // ProvisioningState: to.Ptr(armquota.RequestStateSucceeded), - // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // } -} - -// 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 -func ExampleGroupQuotaSubscriptionsClient_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.NewGroupQuotaSubscriptionsClient().BeginUpdate(ctx, "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", "groupquota1", 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.GroupQuotaSubscriptionID = armquota.GroupQuotaSubscriptionID{ - // Name: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.Quota/groupQuotas/subscriptions"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/E7EC67B3-7657-4966-BFFC-41EFD36BAA09/providers/Microsoft.Quota/groupQuotas/groupquota1/subscriptions/00000000-0000-0000-0000-000000000000"), - // Properties: &armquota.GroupQuotaSubscriptionIDProperties{ - // ProvisioningState: to.Ptr(armquota.RequestStateSucceeded), - // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // } -} - -// 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 -func ExampleGroupQuotaSubscriptionsClient_BeginDelete() { - 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.NewGroupQuotaSubscriptionsClient().BeginDelete(ctx, "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", "groupquota1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// 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 -func ExampleGroupQuotaSubscriptionsClient_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.NewGroupQuotaSubscriptionsClient().Get(ctx, "E7EC67B3-7657-4966-BFFC-41EFD36BAA09", "groupquota1", 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.GroupQuotaSubscriptionID = armquota.GroupQuotaSubscriptionID{ - // Name: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.Quota/groupQuotas/subscriptions"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/E7EC67B3-7657-4966-BFFC-41EFD36BAA09/providers/Microsoft.Quota/groupQuotas/groupquota1/subscriptions/00000000-0000-0000-0000-000000000000"), - // Properties: &armquota.GroupQuotaSubscriptionIDProperties{ - // ProvisioningState: to.Ptr(armquota.RequestStateSucceeded), - // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // } -} - -// 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 -func ExampleGroupQuotaSubscriptionsClient_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.NewGroupQuotaSubscriptionsClient().NewListPager("E7EC67B3-7657-4966-BFFC-41EFD36BAA09", "groupquota1", 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.GroupQuotaSubscriptionIDList = armquota.GroupQuotaSubscriptionIDList{ - // Value: []*armquota.GroupQuotaSubscriptionID{ - // { - // Name: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.Quota/groupQuotas/subscriptions"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/E7EC67B3-7657-4966-BFFC-41EFD36BAA09/providers/Microsoft.Quota/groupQuotas/groupquota1/subscriptions/00000000-0000-0000-0000-000000000000"), - // Properties: &armquota.GroupQuotaSubscriptionIDProperties{ - // ProvisioningState: to.Ptr(armquota.RequestStateSucceeded), - // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // }, - // { - // Name: to.Ptr("11111111-1111-1111-1111-111111111111"), - // Type: to.Ptr("Microsoft.Quota/groupQuotas/subscriptions"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/E7EC67B3-7657-4966-BFFC-41EFD36BAA09/providers/Microsoft.Quota/groupQuotas/groupquota1/subscriptions/11111111-1111-1111-1111-111111111111"), - // Properties: &armquota.GroupQuotaSubscriptionIDProperties{ - // ProvisioningState: to.Ptr(armquota.RequestStateSucceeded), - // SubscriptionID: to.Ptr("11111111-1111-1111-1111-111111111111"), - // }, - // }}, - // } - } -} 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 deleted file mode 100644 index a117dc45664e..000000000000 --- a/sdk/resourcemanager/quota/armquota/operation_client_example_test.go +++ /dev/null @@ -1,190 +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/GetOperations.json -func ExampleOperationClient_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.NewOperationClient().NewListPager(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.OperationList = armquota.OperationList{ - // Value: []*armquota.OperationResponse{ - // { - // Name: to.Ptr("Microsoft.Quota/quotas/read"), - // Display: &armquota.OperationDisplay{ - // Description: to.Ptr("Get the current Service limit or quota of the specified resource"), - // Operation: to.Ptr("Get resource Quota limit"), - // Provider: to.Ptr("Microsoft.Quota"), - // Resource: to.Ptr("Resource Quota limit"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Quota/quotas/write"), - // Display: &armquota.OperationDisplay{ - // Description: to.Ptr("Creates the service limit or quota request for the specified resource"), - // Operation: to.Ptr("Creates resource Quota limit request"), - // Provider: to.Ptr("Microsoft.Quota"), - // Resource: to.Ptr("Resource Quota limit"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Quota/quotaRequests/read"), - // Display: &armquota.OperationDisplay{ - // Description: to.Ptr("Get any service limit request for the specified resource"), - // Operation: to.Ptr("Get Quota limit request"), - // Provider: to.Ptr("Microsoft.Quota"), - // Resource: to.Ptr("Resource Quota limit request"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Quota/usages/read"), - // Display: &armquota.OperationDisplay{ - // Description: to.Ptr("Get the usages for resource providers"), - // Operation: to.Ptr("Get the usages for providers"), - // Provider: to.Ptr("Microsoft.Quota"), - // Resource: to.Ptr("usages information"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Quota/operations/read"), - // Display: &armquota.OperationDisplay{ - // Description: to.Ptr("Get the Operations supported by Microsoft.Quota"), - // Operation: to.Ptr("Get the Operations supported by Microsoft.Quota"), - // Provider: to.Ptr("Microsoft.Quota"), - // Resource: to.Ptr("Read Operation"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Quota/register/action"), - // Display: &armquota.OperationDisplay{ - // Description: to.Ptr("Register the subscription with Microsoft.Quota Resource Provider"), - // Operation: to.Ptr("Register the subscription with Microsoft.Quota Resource Provider"), - // Provider: to.Ptr("Microsoft.Quota"), - // Resource: to.Ptr("Subscription registration with Resource provider"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Quota/groupQuotas/read"), - // Display: &armquota.OperationDisplay{ - // Description: to.Ptr("Get the GroupQuota"), - // Operation: to.Ptr("Get GroupQuota resource"), - // Provider: to.Ptr("Microsoft.Quota"), - // Resource: to.Ptr("GroupQuota resource"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Quota/groupQuotas/write"), - // Display: &armquota.OperationDisplay{ - // Description: to.Ptr("Creates the GroupQuota resource"), - // Operation: to.Ptr("Creates GroupQuota resource"), - // Provider: to.Ptr("Microsoft.Quota"), - // Resource: to.Ptr("GroupQuota Resource"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Quota/groupQuotas/subscriptions/read"), - // Display: &armquota.OperationDisplay{ - // Description: to.Ptr("Get the GroupQuota subscriptions"), - // Operation: to.Ptr("Get GroupQuota subscriptions"), - // Provider: to.Ptr("Microsoft.Quota"), - // Resource: to.Ptr("Subscriptions added to GroupQuota resource"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Quota/groupQuotas/subscriptions/write"), - // Display: &armquota.OperationDisplay{ - // Description: to.Ptr("Add Subscriptions to GroupQuota resource"), - // Operation: to.Ptr("Adds subscription to GroupQuota resource"), - // Provider: to.Ptr("Creates request to add subscription to GroupQuota resource"), - // Resource: to.Ptr("Subscriptions added to GroupQuota resource"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Quota/groupQuotas/groupQuotaLimits/read"), - // Display: &armquota.OperationDisplay{ - // Description: to.Ptr("Get the current GroupQuota of the specified resource"), - // Operation: to.Ptr("Get GroupQuota resource Quota limit"), - // Provider: to.Ptr("Microsoft.Quota"), - // Resource: to.Ptr("GroupQuota Resource Quota limit"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Quota/groupQuotas/groupQuotaLimits/write"), - // Display: &armquota.OperationDisplay{ - // Description: to.Ptr("Creates the GroupQuota request for the specified resource"), - // Operation: to.Ptr("Creates GroupQuota resource Quota limit request"), - // Provider: to.Ptr("Microsoft.Quota"), - // Resource: to.Ptr("GroupQuota Resource Quota limit"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Quota/groupQuotas/groupQuotaRequests/read"), - // Display: &armquota.OperationDisplay{ - // Description: to.Ptr("Get the GroupQuota request status for the specific request"), - // Operation: to.Ptr("Get GroupQuota request status"), - // Provider: to.Ptr("Microsoft.Quota"), - // Resource: to.Ptr("GroupQuota request"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Quota/groupQuotas/quotaAllocations/read"), - // Display: &armquota.OperationDisplay{ - // Description: to.Ptr("Get the current GroupQuota to Subscription Quota allocation"), - // Operation: to.Ptr("Get GroupQuota to Subscription Quota allocation"), - // Provider: to.Ptr("Microsoft.Quota"), - // Resource: to.Ptr("GroupQuota to Subscription Quota allocation"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Quota/groupQuotas/quotaAllocations/write"), - // Display: &armquota.OperationDisplay{ - // Description: to.Ptr("Creates the GroupQuota to subscription Quota limit request for the specified resource"), - // Operation: to.Ptr("Creates GroupQuota to subscription Quota limit request"), - // Provider: to.Ptr("Microsoft.Quota"), - // Resource: to.Ptr("GroupQuota to Subscription Quota allocation"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Quota/groupQuotas/quotaAllocationRequests/read"), - // Display: &armquota.OperationDisplay{ - // Description: to.Ptr("Get the GroupQuota to Subscription Quota allocation request status for the specific request"), - // Operation: to.Ptr("Get GroupQuota to Subscription Quota allocation request status"), - // Provider: to.Ptr("Microsoft.Quota"), - // Resource: to.Ptr("GroupQuota to Subscription Quota allocation request"), - // }, - // }}, - // } - } -} 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/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 deleted file mode 100644 index 91f3faeb1d3d..000000000000 --- a/sdk/resourcemanager/quota/armquota/requeststatus_client_example_test.go +++ /dev/null @@ -1,274 +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/getQuotaRequestStatusFailed.json -func ExampleRequestStatusClient_Get_quotaRequestFailed() { - 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.NewRequestStatusClient().Get(ctx, "2B5C8515-37D8-4B6A-879B-CD641A2CF605", "subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/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.RequestDetails = armquota.RequestDetails{ - // Name: to.Ptr("2B5C8515-37D8-4B6A-879B-CD641A2CF605"), - // Type: to.Ptr("Microsoft.Quota/quotaRequests"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/quotaRequests/2B5C8515-37D8-4B6A-879B-CD641A2CF605"), - // Properties: &armquota.RequestProperties{ - // Error: &armquota.ServiceErrorDetail{ - // Code: to.Ptr("ContactSupport"), - // Message: to.Ptr("Request failed, please contact support."), - // }, - // Message: to.Ptr("Request failed, please contact support."), - // ProvisioningState: to.Ptr(armquota.QuotaRequestStateSucceeded), - // RequestSubmitTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-08-19T19:23:17.904Z"); return t}()), - // Value: []*armquota.SubRequest{ - // { - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Standard NC Promo Family vCPUs"), - // Value: to.Ptr("standardNCPromoFamily"), - // }, - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](50), - // }, - // Message: to.Ptr("Request failed, please contact support."), - // ProvisioningState: to.Ptr(armquota.QuotaRequestStateSucceeded), - // SubRequestID: to.Ptr("AD07450A-DE86-4FD3-859B-107BEF218C4C"), - // }}, - // }, - // } -} - -// 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 -func ExampleRequestStatusClient_Get_quotaRequestInProgress() { - 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.NewRequestStatusClient().Get(ctx, "2B5C8515-37D8-4B6A-879B-CD641A2CF605", "subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/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.RequestDetails = armquota.RequestDetails{ - // Name: to.Ptr("2B5C8515-37D8-4B6A-879B-CD641A2CF605"), - // Type: to.Ptr("Microsoft.Quota/quotaRequests"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/quotaRequests/2B5C8515-37D8-4B6A-879B-CD641A2CF605"), - // Properties: &armquota.RequestProperties{ - // Message: to.Ptr("Request processing"), - // ProvisioningState: to.Ptr(armquota.QuotaRequestStateSucceeded), - // RequestSubmitTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-08-19T19:23:17.904Z"); return t}()), - // Value: []*armquota.SubRequest{ - // { - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Standard HCS Family vCPUs"), - // Value: to.Ptr("standardHCSFamily"), - // }, - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](50), - // }, - // Message: to.Ptr("Request completed"), - // ProvisioningState: to.Ptr(armquota.QuotaRequestStateSucceeded), - // SubRequestID: to.Ptr("AD07450A-DE86-4FD3-859B-107BEF218C4C"), - // }, - // { - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Standard NC Promo Family vCPUs"), - // Value: to.Ptr("standardNCPromoFamily"), - // }, - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](50), - // }, - // Message: to.Ptr("Request processing"), - // ProvisioningState: to.Ptr(armquota.QuotaRequestStateSucceeded), - // SubRequestID: to.Ptr("AD07450A-DE86-4FD3-859B-107BEF218C4C"), - // }}, - // }, - // } -} - -// 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 -func ExampleRequestStatusClient_Get_quotaRequestStatus() { - 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.NewRequestStatusClient().Get(ctx, "2B5C8515-37D8-4B6A-879B-CD641A2CF605", "subscriptions/D7EC67B3-7657-4966-BFFC-41EFD36BAAB3/providers/Microsoft.Compute/locations/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.RequestDetails = armquota.RequestDetails{ - // Name: to.Ptr("2B5C8515-37D8-4B6A-879B-CD641A2CF605"), - // Type: to.Ptr("Microsoft.Quota/quotaRequests"), - // ID: to.Ptr("/subscriptions/D7EC67B3-7657-4966-BFFC-41EFD36BAAB3/providers/Microsoft.Compute/locations/eastus/providers/Microsoft.Quota/quotaRequests/2B5C8515-37D8-4B6A-879B-CD641A2CF605"), - // Properties: &armquota.RequestProperties{ - // Message: to.Ptr("Request completed"), - // ProvisioningState: to.Ptr(armquota.QuotaRequestStateSucceeded), - // RequestSubmitTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-08-19T19:23:17.904Z"); return t}()), - // Value: []*armquota.SubRequest{ - // { - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Standard NC Promo Family vCPUs"), - // Value: to.Ptr("standardNCPromoFamily"), - // }, - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](50), - // }, - // Message: to.Ptr("Request completed"), - // ProvisioningState: to.Ptr(armquota.QuotaRequestStateSucceeded), - // 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/getQuotaRequestsHistory.json -func ExampleRequestStatusClient_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.NewRequestStatusClient().NewListPager("subscriptions/D7EC67B3-7657-4966-BFFC-41EFD36BAAB3/providers/Microsoft.Compute/locations/eastus", &armquota.RequestStatusClientListOptions{Filter: nil, - Top: nil, - Skiptoken: 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.RequestDetailsList = armquota.RequestDetailsList{ - // Value: []*armquota.RequestDetails{ - // { - // Name: to.Ptr("2B5C8515-37D8-4B6A-879B-CD641A2CF605"), - // Type: to.Ptr("Microsoft.Quota/quotaRequests"), - // ID: to.Ptr("/subscriptions/D7EC67B3-7657-4966-BFFC-41EFD36BAAB3/providers/Microsoft.Compute/locations/eastus/providers/Microsoft.Quota/quotaRequests/2B5C8515-37D8-4B6A-879B-CD641A2CF605"), - // Properties: &armquota.RequestProperties{ - // Message: to.Ptr("Request completed"), - // ProvisioningState: to.Ptr(armquota.QuotaRequestStateSucceeded), - // RequestSubmitTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-08-19T19:23:17.904Z"); return t}()), - // Value: []*armquota.SubRequest{ - // { - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Standard NC Promo Family vCPUs"), - // Value: to.Ptr("standardNCPromoFamily"), - // }, - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](50), - // }, - // Message: to.Ptr("Request completed"), - // ProvisioningState: to.Ptr(armquota.QuotaRequestStateSucceeded), - // SubRequestID: to.Ptr("AD07450A-DE86-4FD3-859B-107BEF218C4C"), - // }}, - // }, - // }, - // { - // Name: to.Ptr("7E73A85C-83BB-4DE4-903F-076F1A2B91D6"), - // Type: to.Ptr("Microsoft.Quota/quotaRequests"), - // ID: to.Ptr("/subscriptions/D7EC67B3-7657-4966-BFFC-41EFD36BAAB3/providers/Microsoft.Compute/locations/eastus/providers/Microsoft.Quota/quotaRequests/7E73A85C-83BB-4DE4-903F-076F1A2B91D6"), - // Properties: &armquota.RequestProperties{ - // Message: to.Ptr("Request completed"), - // ProvisioningState: to.Ptr(armquota.QuotaRequestStateSucceeded), - // RequestSubmitTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-08-18T19:23:17.904Z"); return t}()), - // Value: []*armquota.SubRequest{ - // { - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Standard NV Promo Family vCPUs"), - // Value: to.Ptr("standardNVPromoFamily"), - // }, - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](150), - // }, - // Message: to.Ptr("Request completed"), - // ProvisioningState: to.Ptr(armquota.QuotaRequestStateSucceeded), - // SubRequestID: to.Ptr("AD07450A-DE86-4FD3-859B-107BEF218C4C"), - // }}, - // }, - // }, - // { - // Name: to.Ptr("5E460077-AB53-4802-8997-A6940E0B7649"), - // Type: to.Ptr("Microsoft.Quota/quotaRequests"), - // ID: to.Ptr("/subscriptions/D7EC67B3-7657-4966-BFFC-41EFD36BAAB3/providers/Microsoft.Compute/locations/eastus/providers/Microsoft.Quota/quotaRequests/5E460077-AB53-4802-8997-A6940E0B7649"), - // Properties: &armquota.RequestProperties{ - // Error: &armquota.ServiceErrorDetail{ - // Code: to.Ptr("ResourceNotAvailableForOffer"), - // Message: to.Ptr("The resource is currently unavailable in the location for the offer type."), - // }, - // Message: to.Ptr("The resource is currently unavailable in the location for the offer type."), - // ProvisioningState: to.Ptr(armquota.QuotaRequestStateSucceeded), - // RequestSubmitTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-08-17T19:23:17.904Z"); return t}()), - // Value: []*armquota.SubRequest{ - // { - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Standard HBS Family vCPUs"), - // Value: to.Ptr("standardHBSFamily"), - // }, - // Limit: &armquota.LimitObject{ - // LimitObjectType: to.Ptr(armquota.LimitTypeLimitValue), - // Value: to.Ptr[int32](52), - // }, - // Message: to.Ptr("Request failed, please contact support."), - // ProvisioningState: to.Ptr(armquota.QuotaRequestStateSucceeded), - // SubRequestID: to.Ptr("AD07450A-DE86-4FD3-859B-107BEF218C4C"), - // }}, - // }, - // }}, - // } - } -} 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 deleted file mode 100644 index 8b165704ef08..000000000000 --- a/sdk/resourcemanager/quota/armquota/usages_client_example_test.go +++ /dev/null @@ -1,778 +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/getComputeOneSkuUsages.json -func ExampleUsagesClient_Get_quotasUsagesRequestForCompute() { - 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.NewUsagesClient().Get(ctx, "standardNDSFamily", "subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/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.CurrentUsagesBase = armquota.CurrentUsagesBase{ - // Name: to.Ptr("standardNDSFamily"), - // Type: to.Ptr("Microsoft.Quota/Usages"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/providers/Microsoft.Quota/Usages/standardNDSFamily"), - // Properties: &armquota.UsagesProperties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Standard NDS Family vCPUs"), - // Value: to.Ptr("standardNDSFamily"), - // }, - // IsQuotaApplicable: to.Ptr(true), - // Unit: to.Ptr("Count"), - // Usages: &armquota.UsagesObject{ - // UsagesType: to.Ptr(armquota.UsagesTypesIndividual), - // Value: to.Ptr[int32](10), - // }, - // }, - // } -} - -// 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 -func ExampleUsagesClient_Get_quotasUsagesRequestForNetwork() { - 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.NewUsagesClient().Get(ctx, "MinPublicIpInterNetworkPrefixLength", "subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/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.CurrentUsagesBase = armquota.CurrentUsagesBase{ - // Name: to.Ptr("MinPublicIpInterNetworkPrefixLength"), - // Type: to.Ptr("Microsoft.Quota/usages"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/usages/MinPublicIpInterNetworkPrefixLength"), - // Properties: &armquota.UsagesProperties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Min Public Ip InterNetwork Prefix Length"), - // Value: to.Ptr("MinPublicIpInterNetworkPrefixLength"), - // }, - // IsQuotaApplicable: to.Ptr(true), - // ResourceType: to.Ptr("MinPublicIpInterNetworkPrefixLength"), - // Unit: to.Ptr("Count"), - // Usages: &armquota.UsagesObject{ - // Value: to.Ptr[int32](10), - // }, - // }, - // } -} - -// 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 -func ExampleUsagesClient_NewListPager_quotasListUsagesForCompute() { - 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.NewUsagesClient().NewListPager("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus", 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.UsagesLimits = armquota.UsagesLimits{ - // Value: []*armquota.CurrentUsagesBase{ - // { - // Name: to.Ptr("standardFSv2Family"), - // Type: to.Ptr("Microsoft.Quota/Usages"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/providers/Microsoft.Quota/Usages/standardFSv2Family"), - // Properties: &armquota.UsagesProperties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Standard FSv2 Family vCPUs"), - // Value: to.Ptr("standardFSv2Family"), - // }, - // IsQuotaApplicable: to.Ptr(true), - // Unit: to.Ptr("Count"), - // Usages: &armquota.UsagesObject{ - // Value: to.Ptr[int32](10), - // }, - // }, - // }, - // { - // Name: to.Ptr("standardNDSFamily"), - // Type: to.Ptr("Microsoft.Quota/Usages"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/providers/Microsoft.Quota/Usages/standardNDSFamily"), - // Properties: &armquota.UsagesProperties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Standard NDS Family vCPUs"), - // Value: to.Ptr("standardNDSFamily"), - // }, - // IsQuotaApplicable: to.Ptr(true), - // Unit: to.Ptr("Count"), - // Usages: &armquota.UsagesObject{ - // Value: to.Ptr[int32](10), - // }, - // }, - // }, - // { - // Name: to.Ptr("standardNCSv2Family"), - // Type: to.Ptr("Microsoft.Quota/Usages"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/providers/Microsoft.Quota/Usages/standardNCSv2Family"), - // Properties: &armquota.UsagesProperties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Standard NCSv2 Family vCPUs"), - // Value: to.Ptr("standardNCSv2Family"), - // }, - // IsQuotaApplicable: to.Ptr(true), - // Unit: to.Ptr("Count"), - // Usages: &armquota.UsagesObject{ - // Value: to.Ptr[int32](10), - // }, - // }, - // }, - // { - // Name: to.Ptr("standardNCSv3Family"), - // Type: to.Ptr("Microsoft.Quota/Usages"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/providers/Microsoft.Quota/Usages/standardNCSv3Family"), - // Properties: &armquota.UsagesProperties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Standard NCSv3 Family vCPUs"), - // Value: to.Ptr("standardNCSv3Family"), - // }, - // IsQuotaApplicable: to.Ptr(true), - // Unit: to.Ptr("Count"), - // Usages: &armquota.UsagesObject{ - // Value: to.Ptr[int32](10), - // }, - // }, - // }, - // { - // Name: to.Ptr("standardLSv2Family"), - // Type: to.Ptr("Microsoft.Quota/Usages"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/providers/Microsoft.Quota/Usages/standardLSv2Family"), - // Properties: &armquota.UsagesProperties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Standard LSv2 Family vCPUs"), - // Value: to.Ptr("standardLSv2Family"), - // }, - // IsQuotaApplicable: to.Ptr(true), - // Unit: to.Ptr("Count"), - // Usages: &armquota.UsagesObject{ - // Value: to.Ptr[int32](10), - // }, - // }, - // }, - // { - // Name: to.Ptr("standardPBSFamily"), - // Type: to.Ptr("Microsoft.Quota/Usages"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/providers/Microsoft.Quota/Usages/standardPBSFamily"), - // Properties: &armquota.UsagesProperties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Standard PBS Family vCPUs"), - // Value: to.Ptr("standardPBSFamily"), - // }, - // IsQuotaApplicable: to.Ptr(true), - // Unit: to.Ptr("Count"), - // Usages: &armquota.UsagesObject{ - // Value: to.Ptr[int32](10), - // }, - // }, - // }, - // { - // Name: to.Ptr("standardEIv3Family"), - // Type: to.Ptr("Microsoft.Quota/Usages"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/providers/Microsoft.Quota/Usages/standardEIv3Family"), - // Properties: &armquota.UsagesProperties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Standard EIv3 Family vCPUs"), - // Value: to.Ptr("standardEIv3Family"), - // }, - // IsQuotaApplicable: to.Ptr(true), - // Unit: to.Ptr("Count"), - // Usages: &armquota.UsagesObject{ - // Value: to.Ptr[int32](10), - // }, - // }, - // }, - // { - // Name: to.Ptr("standardEISv3Family"), - // Type: to.Ptr("Microsoft.Quota/Usages"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/providers/Microsoft.Quota/Usages/standardEISv3Family"), - // Properties: &armquota.UsagesProperties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Standard EISv3 Family vCPUs"), - // Value: to.Ptr("standardEISv3Family"), - // }, - // IsQuotaApplicable: to.Ptr(true), - // Unit: to.Ptr("Count"), - // Usages: &armquota.UsagesObject{ - // Value: to.Ptr[int32](10), - // }, - // }, - // }, - // { - // Name: to.Ptr("standardDCSFamily"), - // Type: to.Ptr("Microsoft.Quota/Usages"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/providers/Microsoft.Quota/Usages/standardDCSFamily"), - // Properties: &armquota.UsagesProperties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Standard DCS Family vCPUs"), - // Value: to.Ptr("standardDCSFamily"), - // }, - // IsQuotaApplicable: to.Ptr(true), - // Unit: to.Ptr("Count"), - // Usages: &armquota.UsagesObject{ - // Value: to.Ptr[int32](10), - // }, - // }, - // }, - // { - // Name: to.Ptr("standardNVSv2Family"), - // Type: to.Ptr("Microsoft.Quota/Usages"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/providers/Microsoft.Quota/Usages/standardNVSv2Family"), - // Properties: &armquota.UsagesProperties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Standard NVSv2 Family vCPUs"), - // Value: to.Ptr("standardNVSv2Family"), - // }, - // IsQuotaApplicable: to.Ptr(true), - // Unit: to.Ptr("Count"), - // Usages: &armquota.UsagesObject{ - // Value: to.Ptr[int32](10), - // }, - // }, - // }, - // { - // Name: to.Ptr("standardMSv2Family"), - // Type: to.Ptr("Microsoft.Quota/Usages"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/providers/Microsoft.Quota/Usages/standardMSv2Family"), - // Properties: &armquota.UsagesProperties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Standard MSv2 Family vCPUs"), - // Value: to.Ptr("standardMSv2Family"), - // }, - // IsQuotaApplicable: to.Ptr(true), - // Unit: to.Ptr("Count"), - // Usages: &armquota.UsagesObject{ - // Value: to.Ptr[int32](10), - // }, - // }, - // }, - // { - // Name: to.Ptr("availabilitySets"), - // Type: to.Ptr("Microsoft.Quota/Usages"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/providers/Microsoft.Quota/Usages/availabilitySets"), - // Properties: &armquota.UsagesProperties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Availability Sets"), - // Value: to.Ptr("availabilitySets"), - // }, - // IsQuotaApplicable: to.Ptr(false), - // Unit: to.Ptr("Count"), - // Usages: &armquota.UsagesObject{ - // Value: to.Ptr[int32](10), - // }, - // }, - // }}, - // } - } -} - -// 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 -func ExampleUsagesClient_NewListPager_quotasListUsagesForNetwork() { - 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.NewUsagesClient().NewListPager("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus", 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.UsagesLimits = armquota.UsagesLimits{ - // Value: []*armquota.CurrentUsagesBase{ - // { - // Name: to.Ptr("VirtualNetworks"), - // Type: to.Ptr("Microsoft.Quota/usages"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/usages/"), - // Properties: &armquota.UsagesProperties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Virtual Networks"), - // Value: to.Ptr("VirtualNetworks"), - // }, - // IsQuotaApplicable: to.Ptr(false), - // Properties: map[string]any{ - // }, - // Unit: to.Ptr("Count"), - // Usages: &armquota.UsagesObject{ - // Value: to.Ptr[int32](10), - // }, - // }, - // }, - // { - // Name: to.Ptr("StaticPublicIPAddresses"), - // Type: to.Ptr("Microsoft.Quota/usages"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/usages/"), - // Properties: &armquota.UsagesProperties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Static Public IP Addresses"), - // Value: to.Ptr("StaticPublicIPAddresses"), - // }, - // IsQuotaApplicable: to.Ptr(false), - // Properties: map[string]any{ - // }, - // Unit: to.Ptr("Count"), - // Usages: &armquota.UsagesObject{ - // Value: to.Ptr[int32](10), - // }, - // }, - // }, - // { - // Name: to.Ptr("NetworkSecurityGroups"), - // Type: to.Ptr("Microsoft.Quota/usages"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/usages/"), - // Properties: &armquota.UsagesProperties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Network Security Groups"), - // Value: to.Ptr("NetworkSecurityGroups"), - // }, - // IsQuotaApplicable: to.Ptr(false), - // Properties: map[string]any{ - // }, - // Unit: to.Ptr("Count"), - // Usages: &armquota.UsagesObject{ - // Value: to.Ptr[int32](10), - // }, - // }, - // }, - // { - // Name: to.Ptr("PublicIPAddresses"), - // Type: to.Ptr("Microsoft.Quota/usages"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/usages/"), - // Properties: &armquota.UsagesProperties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Public IP Addresses - Basic"), - // Value: to.Ptr("PublicIPAddresses"), - // }, - // IsQuotaApplicable: to.Ptr(true), - // Properties: map[string]any{ - // }, - // ResourceType: to.Ptr("PublicIpAddresses"), - // Unit: to.Ptr("Count"), - // Usages: &armquota.UsagesObject{ - // Value: to.Ptr[int32](10), - // }, - // }, - // }, - // { - // Name: to.Ptr("PublicIpPrefixes"), - // Type: to.Ptr("Microsoft.Quota/usages"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/usages/"), - // Properties: &armquota.UsagesProperties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Public Ip Prefixes"), - // Value: to.Ptr("PublicIpPrefixes"), - // }, - // IsQuotaApplicable: to.Ptr(false), - // Properties: map[string]any{ - // }, - // Unit: to.Ptr("Count"), - // Usages: &armquota.UsagesObject{ - // Value: to.Ptr[int32](10), - // }, - // }, - // }, - // { - // Name: to.Ptr("NatGateways"), - // Type: to.Ptr("Microsoft.Quota/usages"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/usages/"), - // Properties: &armquota.UsagesProperties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Nat Gateways"), - // Value: to.Ptr("NatGateways"), - // }, - // IsQuotaApplicable: to.Ptr(false), - // Properties: map[string]any{ - // }, - // Unit: to.Ptr("Count"), - // Usages: &armquota.UsagesObject{ - // Value: to.Ptr[int32](10), - // }, - // }, - // }, - // { - // Name: to.Ptr("NetworkInterfaces"), - // Type: to.Ptr("Microsoft.Quota/usages"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/usages/"), - // Properties: &armquota.UsagesProperties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Network Interfaces"), - // Value: to.Ptr("NetworkInterfaces"), - // }, - // IsQuotaApplicable: to.Ptr(false), - // Properties: map[string]any{ - // }, - // Unit: to.Ptr("Count"), - // Usages: &armquota.UsagesObject{ - // Value: to.Ptr[int32](10), - // }, - // }, - // }, - // { - // Name: to.Ptr("PrivateEndpoints"), - // Type: to.Ptr("Microsoft.Quota/usages"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/usages/"), - // Properties: &armquota.UsagesProperties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Private Endpoints"), - // Value: to.Ptr("PrivateEndpoints"), - // }, - // IsQuotaApplicable: to.Ptr(false), - // Properties: map[string]any{ - // }, - // Unit: to.Ptr("Count"), - // Usages: &armquota.UsagesObject{ - // Value: to.Ptr[int32](10), - // }, - // }, - // }, - // { - // Name: to.Ptr("PrivateEndpointRedirectMaps"), - // Type: to.Ptr("Microsoft.Quota/usages"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/usages/"), - // Properties: &armquota.UsagesProperties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Private Endpoint Redirect Maps"), - // Value: to.Ptr("PrivateEndpointRedirectMaps"), - // }, - // IsQuotaApplicable: to.Ptr(false), - // Properties: map[string]any{ - // }, - // Unit: to.Ptr("Count"), - // Usages: &armquota.UsagesObject{ - // Value: to.Ptr[int32](10), - // }, - // }, - // }, - // { - // Name: to.Ptr("LoadBalancers"), - // Type: to.Ptr("Microsoft.Quota/usages"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/usages/"), - // Properties: &armquota.UsagesProperties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Load Balancers"), - // Value: to.Ptr("LoadBalancers"), - // }, - // IsQuotaApplicable: to.Ptr(false), - // Properties: map[string]any{ - // }, - // Unit: to.Ptr("Count"), - // Usages: &armquota.UsagesObject{ - // Value: to.Ptr[int32](10), - // }, - // }, - // }, - // { - // Name: to.Ptr("PrivateLinkServices"), - // Type: to.Ptr("Microsoft.Quota/usages"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/usages/"), - // Properties: &armquota.UsagesProperties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Private Link Services"), - // Value: to.Ptr("PrivateLinkServices"), - // }, - // IsQuotaApplicable: to.Ptr(false), - // Properties: map[string]any{ - // }, - // Unit: to.Ptr("Count"), - // Usages: &armquota.UsagesObject{ - // Value: to.Ptr[int32](10), - // }, - // }, - // }, - // { - // Name: to.Ptr("ApplicationGateways"), - // Type: to.Ptr("Microsoft.Quota/usages"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/usages/"), - // Properties: &armquota.UsagesProperties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Application Gateways"), - // Value: to.Ptr("ApplicationGateways"), - // }, - // IsQuotaApplicable: to.Ptr(false), - // Properties: map[string]any{ - // }, - // Unit: to.Ptr("Count"), - // Usages: &armquota.UsagesObject{ - // Value: to.Ptr[int32](10), - // }, - // }, - // }, - // { - // Name: to.Ptr("RouteTables"), - // Type: to.Ptr("Microsoft.Quota/usages"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/usages/"), - // Properties: &armquota.UsagesProperties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Route Tables"), - // Value: to.Ptr("RouteTables"), - // }, - // IsQuotaApplicable: to.Ptr(false), - // Properties: map[string]any{ - // }, - // Unit: to.Ptr("Count"), - // Usages: &armquota.UsagesObject{ - // Value: to.Ptr[int32](10), - // }, - // }, - // }, - // { - // Name: to.Ptr("RouteFilters"), - // Type: to.Ptr("Microsoft.Quota/usages"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/usages/"), - // Properties: &armquota.UsagesProperties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Route Filters"), - // Value: to.Ptr("RouteFilters"), - // }, - // IsQuotaApplicable: to.Ptr(false), - // Properties: map[string]any{ - // }, - // Unit: to.Ptr("Count"), - // Usages: &armquota.UsagesObject{ - // Value: to.Ptr[int32](10), - // }, - // }, - // }, - // { - // Name: to.Ptr("NetworkWatchers"), - // Type: to.Ptr("Microsoft.Quota/usages"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/usages/"), - // Properties: &armquota.UsagesProperties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Network Watchers"), - // Value: to.Ptr("NetworkWatchers"), - // }, - // IsQuotaApplicable: to.Ptr(false), - // Properties: map[string]any{ - // }, - // Unit: to.Ptr("Count"), - // Usages: &armquota.UsagesObject{ - // Value: to.Ptr[int32](10), - // }, - // }, - // }, - // { - // Name: to.Ptr("PacketCaptures"), - // Type: to.Ptr("Microsoft.Quota/usages"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/usages/"), - // Properties: &armquota.UsagesProperties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Packet Captures"), - // Value: to.Ptr("PacketCaptures"), - // }, - // IsQuotaApplicable: to.Ptr(false), - // Properties: map[string]any{ - // }, - // Unit: to.Ptr("Count"), - // Usages: &armquota.UsagesObject{ - // Value: to.Ptr[int32](10), - // }, - // }, - // }, - // { - // Name: to.Ptr("ApplicationSecurityGroups"), - // Type: to.Ptr("Microsoft.Quota/usages"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/usages/"), - // Properties: &armquota.UsagesProperties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Application Security Groups."), - // Value: to.Ptr("ApplicationSecurityGroups"), - // }, - // IsQuotaApplicable: to.Ptr(false), - // Properties: map[string]any{ - // }, - // Unit: to.Ptr("Count"), - // Usages: &armquota.UsagesObject{ - // Value: to.Ptr[int32](10), - // }, - // }, - // }, - // { - // Name: to.Ptr("StandardSkuLoadBalancers"), - // Type: to.Ptr("Microsoft.Quota/usages"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/usages/"), - // Properties: &armquota.UsagesProperties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Standard Sku Load Balancers"), - // Value: to.Ptr("StandardSkuLoadBalancers"), - // }, - // IsQuotaApplicable: to.Ptr(false), - // Properties: map[string]any{ - // }, - // Unit: to.Ptr("Count"), - // Usages: &armquota.UsagesObject{ - // Value: to.Ptr[int32](10), - // }, - // }, - // }, - // { - // Name: to.Ptr("StandardSkuPublicIpAddresses"), - // Type: to.Ptr("Microsoft.Quota/usages"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/usages/"), - // Properties: &armquota.UsagesProperties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Public IP Addresses - Standard"), - // Value: to.Ptr("StandardSkuPublicIpAddresses"), - // }, - // IsQuotaApplicable: to.Ptr(true), - // ResourceType: to.Ptr("PublicIpAddresses"), - // Unit: to.Ptr("Count"), - // Usages: &armquota.UsagesObject{ - // Value: to.Ptr[int32](10), - // }, - // }, - // }, - // { - // Name: to.Ptr("DnsServersPerVirtualNetwork"), - // Type: to.Ptr("Microsoft.Quota/usages"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/usages/"), - // Properties: &armquota.UsagesProperties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("DNS servers per Virtual Network"), - // Value: to.Ptr("DnsServersPerVirtualNetwork"), - // }, - // IsQuotaApplicable: to.Ptr(false), - // Properties: map[string]any{ - // }, - // Unit: to.Ptr("Count"), - // Usages: &armquota.UsagesObject{ - // Value: to.Ptr[int32](10), - // }, - // }, - // }, - // { - // Name: to.Ptr("MinPublicIpInterNetworkPrefixLength"), - // Type: to.Ptr("Microsoft.Quota/usages"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/providers/Microsoft.Quota/usages/"), - // Properties: &armquota.UsagesProperties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Min Public Ip InterNetwork Prefix Length"), - // Value: to.Ptr("MinPublicIpInterNetworkPrefixLength"), - // }, - // IsQuotaApplicable: to.Ptr(true), - // Properties: map[string]any{ - // }, - // Unit: to.Ptr("Count"), - // Usages: &armquota.UsagesObject{ - // Value: to.Ptr[int32](10), - // }, - // }, - // }}, - // } - } -} - -// 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 -func ExampleUsagesClient_NewListPager_quotasListUsagesMachineLearningServices() { - 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.NewUsagesClient().NewListPager("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.MachineLearningServices/locations/eastus", 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.UsagesLimits = armquota.UsagesLimits{ - // Value: []*armquota.CurrentUsagesBase{ - // { - // Name: to.Ptr("standardDv2Family"), - // Type: to.Ptr("Microsoft.Quota/usages"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.MachineLearningServices/locations/eastus/providers/Microsoft.Quota/usages/standardDv2Family"), - // Properties: &armquota.UsagesProperties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Standard Dv2 Family vCPUs"), - // Value: to.Ptr("standardDv2Family"), - // }, - // ResourceType: to.Ptr("dedicated"), - // Unit: to.Ptr("Count"), - // Usages: &armquota.UsagesObject{ - // Value: to.Ptr[int32](10), - // }, - // }, - // }, - // { - // Name: to.Ptr("totalLowPriorityCores"), - // Type: to.Ptr("Microsoft.Quota/usages"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.MachineLearningServices/locations/eastus/providers/Microsoft.Quota/usages/totalLowPriorityCores"), - // Properties: &armquota.UsagesProperties{ - // Name: &armquota.ResourceName{ - // LocalizedValue: to.Ptr("Total Regional Low-priority vCPUs"), - // Value: to.Ptr("totalLowPriorityCores"), - // }, - // ResourceType: to.Ptr("lowPriority"), - // Unit: to.Ptr("Count"), - // Usages: &armquota.UsagesObject{ - // Value: to.Ptr[int32](10), - // }, - // }, - // }}, - // } - } -}