diff --git a/sdk/resourcemanager/quota/armquota/CHANGELOG.md b/sdk/resourcemanager/quota/armquota/CHANGELOG.md index 04c4b5a80758..0f11e31800a8 100644 --- a/sdk/resourcemanager/quota/armquota/CHANGELOG.md +++ b/sdk/resourcemanager/quota/armquota/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 1.0.0 (2023-03-20) +### Other Changes + + ## 0.5.0 (2022-05-17) The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/quota/armquota` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html) since version 0.5.0, which contains breaking changes. diff --git a/sdk/resourcemanager/quota/armquota/autorest.md b/sdk/resourcemanager/quota/armquota/autorest.md index fd703749c0b4..7af0d5a9f422 100644 --- a/sdk/resourcemanager/quota/armquota/autorest.md +++ b/sdk/resourcemanager/quota/armquota/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/quota/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/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: 0.5.0 +module-version: 1.0.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/quota/armquota/zz_generated_client.go b/sdk/resourcemanager/quota/armquota/client.go similarity index 78% rename from sdk/resourcemanager/quota/armquota/zz_generated_client.go rename to sdk/resourcemanager/quota/armquota/client.go index 73336dda92b5..9d17beff98ac 100644 --- a/sdk/resourcemanager/quota/armquota/zz_generated_client.go +++ b/sdk/resourcemanager/quota/armquota/client.go @@ -5,6 +5,7 @@ // 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 @@ -30,8 +31,8 @@ type Client struct { } // NewClient creates a new instance of Client with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*Client, error) { if options == nil { options = &arm.ClientOptions{} @@ -59,16 +60,17 @@ func NewClient(credential azcore.TokenCredential, options *arm.ClientOptions) (* // 2. Use this PUT operation to update the quota limit. Please check the URI in location header for the detailed status of // the request. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-03-15-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. -// 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 -// URI in the GET operation for the specific resource. -// createQuotaRequest - Quota request payload. -// options - ClientBeginCreateOrUpdateOptions contains the optional parameters for the Client.BeginCreateOrUpdate method. +// +// Generated from API version 2023-02-01 +// - 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. +// - 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 +// URI in the GET operation for the specific resource. +// - createQuotaRequest - Quota request payload. +// - options - ClientBeginCreateOrUpdateOptions contains the optional parameters for the Client.BeginCreateOrUpdate method. func (client *Client) BeginCreateOrUpdate(ctx context.Context, resourceName string, scope string, createQuotaRequest CurrentQuotaLimitBase, options *ClientBeginCreateOrUpdateOptions) (*runtime.Poller[ClientCreateOrUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.createOrUpdate(ctx, resourceName, scope, createQuotaRequest, options) @@ -91,7 +93,8 @@ func (client *Client) BeginCreateOrUpdate(ctx context.Context, resourceName stri // 2. Use this PUT operation to update the quota limit. Please check the URI in location header for the detailed status of // the request. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-03-15-preview +// +// Generated from API version 2023-02-01 func (client *Client) createOrUpdate(ctx context.Context, resourceName string, scope string, createQuotaRequest CurrentQuotaLimitBase, options *ClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceName, scope, createQuotaRequest, options) if err != nil { @@ -120,7 +123,7 @@ func (client *Client) createOrUpdateCreateRequest(ctx context.Context, resourceN return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-15-preview") + reqQP.Set("api-version", "2023-02-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, createQuotaRequest) @@ -129,15 +132,16 @@ func (client *Client) createOrUpdateCreateRequest(ctx context.Context, resourceN // Get - Get the quota limit of a resource. The response can be used to determine the remaining quota to calculate a new quota // limit that can be submitted with a PUT request. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-03-15-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. -// 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 -// URI in the GET operation for the specific resource. -// options - ClientGetOptions contains the optional parameters for the Client.Get method. +// +// Generated from API version 2023-02-01 +// - 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. +// - 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 +// URI in the GET operation for the specific resource. +// - options - ClientGetOptions contains the optional parameters for the Client.Get method. func (client *Client) Get(ctx context.Context, resourceName string, scope string, options *ClientGetOptions) (ClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceName, scope, options) if err != nil { @@ -166,7 +170,7 @@ func (client *Client) getCreateRequest(ctx context.Context, resourceName string, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-15-preview") + reqQP.Set("api-version", "2023-02-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -186,13 +190,13 @@ 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. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-03-15-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 -// URI in the GET operation for the specific resource. -// options - ClientListOptions contains the optional parameters for the Client.List method. +// +// Generated from API version 2023-02-01 +// - 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 +// URI in the GET operation for the specific resource. +// - options - ClientListOptions contains the optional parameters for the Client.NewListPager method. func (client *Client) NewListPager(scope string, options *ClientListOptions) *runtime.Pager[ClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ClientListResponse]{ More: func(page ClientListResponse) bool { @@ -230,7 +234,7 @@ func (client *Client) listCreateRequest(ctx context.Context, scope string, optio return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-15-preview") + reqQP.Set("api-version", "2023-02-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -255,16 +259,17 @@ func (client *Client) listHandleResponse(resp *http.Response) (ClientListRespons // 2. Use this PUT operation to update the quota limit. Please check the URI in location header for the detailed status of // the request. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-03-15-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. -// 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 -// URI in the GET operation for the specific resource. -// createQuotaRequest - Quota requests payload. -// options - ClientBeginUpdateOptions contains the optional parameters for the Client.BeginUpdate method. +// +// Generated from API version 2023-02-01 +// - 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. +// - 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 +// URI in the GET operation for the specific resource. +// - createQuotaRequest - Quota requests payload. +// - options - ClientBeginUpdateOptions contains the optional parameters for the Client.BeginUpdate method. func (client *Client) BeginUpdate(ctx context.Context, resourceName string, scope string, createQuotaRequest CurrentQuotaLimitBase, options *ClientBeginUpdateOptions) (*runtime.Poller[ClientUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.update(ctx, resourceName, scope, createQuotaRequest, options) @@ -286,7 +291,8 @@ func (client *Client) BeginUpdate(ctx context.Context, resourceName string, scop // 2. Use this PUT operation to update the quota limit. Please check the URI in location header for the detailed status of // the request. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-03-15-preview +// +// Generated from API version 2023-02-01 func (client *Client) update(ctx context.Context, resourceName string, scope string, createQuotaRequest CurrentQuotaLimitBase, options *ClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceName, scope, createQuotaRequest, options) if err != nil { @@ -315,7 +321,7 @@ func (client *Client) updateCreateRequest(ctx context.Context, resourceName stri return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-15-preview") + reqQP.Set("api-version", "2023-02-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, createQuotaRequest) diff --git a/sdk/resourcemanager/quota/armquota/zz_generated_constants.go b/sdk/resourcemanager/quota/armquota/constants.go similarity index 98% rename from sdk/resourcemanager/quota/armquota/zz_generated_constants.go rename to sdk/resourcemanager/quota/armquota/constants.go index 1231d3e4d8a4..cef80a4d759e 100644 --- a/sdk/resourcemanager/quota/armquota/zz_generated_constants.go +++ b/sdk/resourcemanager/quota/armquota/constants.go @@ -5,12 +5,13 @@ // 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 const ( moduleName = "armquota" - moduleVersion = "v0.5.0" + moduleVersion = "v1.0.0" ) // LimitType - The limit object type. diff --git a/sdk/resourcemanager/quota/armquota/go.mod b/sdk/resourcemanager/quota/armquota/go.mod index b482958ff492..b56bbe3cb262 100644 --- a/sdk/resourcemanager/quota/armquota/go.mod +++ b/sdk/resourcemanager/quota/armquota/go.mod @@ -2,20 +2,12 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/quota/armquota go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 // indirect - github.com/golang-jwt/jwt v3.2.1+incompatible // indirect - github.com/google/uuid v1.1.1 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect - golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 // indirect - golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect golang.org/x/text v0.3.7 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/sdk/resourcemanager/quota/armquota/go.sum b/sdk/resourcemanager/quota/armquota/go.sum index ed5b814680ee..3afb578030a5 100644 --- a/sdk/resourcemanager/quota/armquota/go.sum +++ b/sdk/resourcemanager/quota/armquota/go.sum @@ -1,33 +1,15 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 h1:sVPhtT2qjO86rTUaWMr4WoES4TkjGnzcioXcnHV9s5k= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 h1:Yoicul8bnVdQrhDMTHxdEckRGX01XvwXDHUT9zYZ3k0= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0/go.mod h1:+6sju8gk8FRmSajX3Oz4G5Gm7P+mbqE9FVaXXFYTkCM= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 h1:jp0dGvZ7ZK0mgqnTSClMxa5xuRL7NZgHameVYF6BurY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 h1:WVsrXCnHlDDX8ls+tootqRE87/hL9S/g4ewig9RsD/c= -github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= -github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= -github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= -github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 h1:Qj1ukM4GlMWXNdMBuXcXfz/Kw9s1qm0CLY32QxuSImI= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4/go.mod h1:N6UoU20jOqggOuDwUaBQpluzLNDqif3kq9z2wpdYEfQ= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 h1:Tgea0cVUD0ivh5ADBX4WwuI12DUd2to3nCYe2eayMIw= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 h1:HVyaeDAYux4pnY+D/SiwmLOR36ewZ4iGQIIrtnuCjFA= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/quota/armquota/zz_generated_models.go b/sdk/resourcemanager/quota/armquota/models.go similarity index 96% rename from sdk/resourcemanager/quota/armquota/zz_generated_models.go rename to sdk/resourcemanager/quota/armquota/models.go index c3fd23834e4c..1263930d8417 100644 --- a/sdk/resourcemanager/quota/armquota/zz_generated_models.go +++ b/sdk/resourcemanager/quota/armquota/models.go @@ -5,6 +5,7 @@ // 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 @@ -27,7 +28,7 @@ type ClientGetOptions struct { // placeholder for future optional parameters } -// ClientListOptions contains the optional parameters for the Client.List method. +// ClientListOptions contains the optional parameters for the Client.NewListPager method. type ClientListOptions struct { // placeholder for future optional parameters } @@ -141,7 +142,7 @@ type LimitsResponse struct { Value []*CurrentQuotaLimitBase `json:"value,omitempty"` } -// OperationClientListOptions contains the optional parameters for the OperationClient.List method. +// OperationClientListOptions contains the optional parameters for the OperationClient.NewListPager method. type OperationClientListOptions struct { // placeholder for future optional parameters } @@ -181,9 +182,9 @@ type Properties struct { Name *ResourceName `json:"name,omitempty"` // Additional properties for the specific resource provider. - Properties interface{} `json:"properties,omitempty"` + Properties any `json:"properties,omitempty"` - // Resource type name. + // The name of the resource type. Optional field. ResourceType *string `json:"resourceType,omitempty"` // READ-ONLY; States if quota can be requested for this resource. @@ -235,9 +236,9 @@ type RequestOneResourceProperties struct { Name *ResourceName `json:"name,omitempty"` // Additional properties for the specific resource provider. - Properties interface{} `json:"properties,omitempty"` + Properties any `json:"properties,omitempty"` - // Resource type name. + // The name of the resource type. Optional field. ResourceType *string `json:"resourceType,omitempty"` // The quota limit units, such as Count and Bytes. When requesting quota, use the unit value returned in the GET response @@ -304,7 +305,7 @@ type RequestStatusClientGetOptions struct { // placeholder for future optional parameters } -// RequestStatusClientListOptions contains the optional parameters for the RequestStatusClient.List method. +// RequestStatusClientListOptions contains the optional parameters for the RequestStatusClient.NewListPager method. type RequestStatusClientListOptions struct { // FIELD SUPPORTED OPERATORS // requestSubmitTime ge, le, eq, gt, lt @@ -328,9 +329,9 @@ type RequestStatusDetails struct { Name *ResourceName `json:"name,omitempty"` // Additional properties for the specific resource provider. - Properties interface{} `json:"properties,omitempty"` + Properties any `json:"properties,omitempty"` - // Resource type name. + // The name of the resource type. Optional field. ResourceType *string `json:"resourceType,omitempty"` // The quota limit units, such as Count and Bytes. When requesting quota, use the unit value returned in the GET response @@ -440,7 +441,7 @@ type UsagesClientGetOptions struct { // placeholder for future optional parameters } -// UsagesClientListOptions contains the optional parameters for the UsagesClient.List method. +// UsagesClientListOptions contains the optional parameters for the UsagesClient.NewListPager method. type UsagesClientListOptions struct { // placeholder for future optional parameters } @@ -469,9 +470,9 @@ type UsagesProperties struct { Name *ResourceName `json:"name,omitempty"` // Additional properties for the specific resource provider. - Properties interface{} `json:"properties,omitempty"` + Properties any `json:"properties,omitempty"` - // The name of the resource type. + // The name of the resource type. Optional field. ResourceType *string `json:"resourceType,omitempty"` // The quota limit properties for this resource. diff --git a/sdk/resourcemanager/quota/armquota/models_serde.go b/sdk/resourcemanager/quota/armquota/models_serde.go new file mode 100644 index 000000000000..bbba5b2a311a --- /dev/null +++ b/sdk/resourcemanager/quota/armquota/models_serde.go @@ -0,0 +1,1101 @@ +//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 + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type CommonResourceProperties. +func (c CommonResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CommonResourceProperties. +func (c *CommonResourceProperties) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CreateGenericQuotaRequestParameters. +func (c CreateGenericQuotaRequestParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CreateGenericQuotaRequestParameters. +func (c *CreateGenericQuotaRequestParameters) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CurrentQuotaLimitBase. +func (c CurrentQuotaLimitBase) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CurrentQuotaLimitBase. +func (c *CurrentQuotaLimitBase) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CurrentUsagesBase. +func (c CurrentUsagesBase) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CurrentUsagesBase. +func (c *CurrentUsagesBase) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExceptionResponse. +func (e ExceptionResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "error", e.Error) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExceptionResponse. +func (e *ExceptionResponse) 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", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &e.Error) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LimitJSONObject. +func (l LimitJSONObject) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["limitObjectType"] = l.LimitObjectType + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LimitJSONObject. +func (l *LimitJSONObject) 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", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "limitObjectType": + err = unpopulate(val, "LimitObjectType", &l.LimitObjectType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LimitObject. +func (l LimitObject) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["limitObjectType"] = LimitTypeLimitValue + populate(objectMap, "limitType", l.LimitType) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LimitObject. +func (l *LimitObject) 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", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "limitObjectType": + err = unpopulate(val, "LimitObjectType", &l.LimitObjectType) + delete(rawMsg, key) + case "limitType": + err = unpopulate(val, "LimitType", &l.LimitType) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Limits. +func (l Limits) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Limits. +func (l *Limits) 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", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LimitsResponse. +func (l LimitsResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LimitsResponse. +func (l *LimitsResponse) 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", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", o.Description) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. +func (o *OperationDisplay) 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", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &o.Description) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationList. +func (o OperationList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationList. +func (o *OperationList) 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", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationResponse. +func (o OperationResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "display", o.Display) + populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationResponse. +func (o *OperationResponse) 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", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &o.Origin) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Properties. +func (p Properties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "isQuotaApplicable", p.IsQuotaApplicable) + populate(objectMap, "limit", p.Limit) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", &p.Properties) + populate(objectMap, "quotaPeriod", p.QuotaPeriod) + populate(objectMap, "resourceType", p.ResourceType) + populate(objectMap, "unit", p.Unit) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Properties. +func (p *Properties) 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", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "isQuotaApplicable": + err = unpopulate(val, "IsQuotaApplicable", &p.IsQuotaApplicable) + delete(rawMsg, key) + case "limit": + p.Limit, err = unmarshalLimitJSONObjectClassification(val) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "quotaPeriod": + err = unpopulate(val, "QuotaPeriod", &p.QuotaPeriod) + delete(rawMsg, key) + case "resourceType": + err = unpopulate(val, "ResourceType", &p.ResourceType) + delete(rawMsg, key) + case "unit": + err = unpopulate(val, "Unit", &p.Unit) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RequestDetails. +func (r RequestDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RequestDetails. +func (r *RequestDetails) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RequestDetailsList. +func (r RequestDetailsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RequestDetailsList. +func (r *RequestDetailsList) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RequestOneResourceProperties. +func (r RequestOneResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "currentValue", r.CurrentValue) + populate(objectMap, "error", r.Error) + populate(objectMap, "isQuotaApplicable", r.IsQuotaApplicable) + populate(objectMap, "limit", r.Limit) + populate(objectMap, "message", r.Message) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", &r.Properties) + populate(objectMap, "provisioningState", r.ProvisioningState) + populate(objectMap, "quotaPeriod", r.QuotaPeriod) + populateTimeRFC3339(objectMap, "requestSubmitTime", r.RequestSubmitTime) + populate(objectMap, "resourceType", r.ResourceType) + populate(objectMap, "unit", r.Unit) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RequestOneResourceProperties. +func (r *RequestOneResourceProperties) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "currentValue": + err = unpopulate(val, "CurrentValue", &r.CurrentValue) + delete(rawMsg, key) + case "error": + err = unpopulate(val, "Error", &r.Error) + delete(rawMsg, key) + case "isQuotaApplicable": + err = unpopulate(val, "IsQuotaApplicable", &r.IsQuotaApplicable) + delete(rawMsg, key) + case "limit": + err = unpopulate(val, "Limit", &r.Limit) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &r.Message) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &r.ProvisioningState) + delete(rawMsg, key) + case "quotaPeriod": + err = unpopulate(val, "QuotaPeriod", &r.QuotaPeriod) + delete(rawMsg, key) + case "requestSubmitTime": + err = unpopulateTimeRFC3339(val, "RequestSubmitTime", &r.RequestSubmitTime) + delete(rawMsg, key) + case "resourceType": + err = unpopulate(val, "ResourceType", &r.ResourceType) + delete(rawMsg, key) + case "unit": + err = unpopulate(val, "Unit", &r.Unit) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RequestOneResourceSubmitResponse. +func (r RequestOneResourceSubmitResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RequestOneResourceSubmitResponse. +func (r *RequestOneResourceSubmitResponse) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RequestProperties. +func (r RequestProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "error", r.Error) + populate(objectMap, "message", r.Message) + populate(objectMap, "provisioningState", r.ProvisioningState) + populateTimeRFC3339(objectMap, "requestSubmitTime", r.RequestSubmitTime) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RequestProperties. +func (r *RequestProperties) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &r.Error) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &r.Message) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &r.ProvisioningState) + delete(rawMsg, key) + case "requestSubmitTime": + err = unpopulateTimeRFC3339(val, "RequestSubmitTime", &r.RequestSubmitTime) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RequestStatusDetails. +func (r RequestStatusDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "limit", r.Limit) + populate(objectMap, "message", r.Message) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", &r.Properties) + populate(objectMap, "provisioningState", r.ProvisioningState) + populate(objectMap, "quotaPeriod", r.QuotaPeriod) + populate(objectMap, "resourceType", r.ResourceType) + populate(objectMap, "unit", r.Unit) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RequestStatusDetails. +func (r *RequestStatusDetails) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "limit": + err = unpopulate(val, "Limit", &r.Limit) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &r.Message) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &r.ProvisioningState) + delete(rawMsg, key) + case "quotaPeriod": + err = unpopulate(val, "QuotaPeriod", &r.QuotaPeriod) + delete(rawMsg, key) + case "resourceType": + err = unpopulate(val, "ResourceType", &r.ResourceType) + delete(rawMsg, key) + case "unit": + err = unpopulate(val, "Unit", &r.Unit) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RequestSubmitResponse. +func (r RequestSubmitResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RequestSubmitResponse. +func (r *RequestSubmitResponse) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RequestSubmitResponse202. +func (r RequestSubmitResponse202) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RequestSubmitResponse202. +func (r *RequestSubmitResponse202) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceName. +func (r ResourceName) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "localizedValue", r.LocalizedValue) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceName. +func (r *ResourceName) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "localizedValue": + err = unpopulate(val, "LocalizedValue", &r.LocalizedValue) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServiceError. +func (s ServiceError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "code", s.Code) + populate(objectMap, "details", s.Details) + populate(objectMap, "message", s.Message) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceError. +func (s *ServiceError) 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 "code": + err = unpopulate(val, "Code", &s.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &s.Details) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &s.Message) + 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 ServiceErrorDetail. +func (s ServiceErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "code", s.Code) + populate(objectMap, "message", s.Message) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceErrorDetail. +func (s *ServiceErrorDetail) 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 "code": + err = unpopulate(val, "Code", &s.Code) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &s.Message) + 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 SubRequest. +func (s SubRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "limit", s.Limit) + populate(objectMap, "message", s.Message) + populate(objectMap, "name", s.Name) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "resourceType", s.ResourceType) + populate(objectMap, "subRequestId", s.SubRequestID) + populate(objectMap, "unit", s.Unit) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SubRequest. +func (s *SubRequest) 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": + s.Limit, err = unmarshalLimitJSONObjectClassification(val) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &s.Message) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "resourceType": + err = unpopulate(val, "ResourceType", &s.ResourceType) + delete(rawMsg, key) + case "subRequestId": + err = unpopulate(val, "SubRequestID", &s.SubRequestID) + delete(rawMsg, key) + case "unit": + err = unpopulate(val, "Unit", &s.Unit) + 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 UsagesLimits. +func (u UsagesLimits) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", u.NextLink) + populate(objectMap, "value", u.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UsagesLimits. +func (u *UsagesLimits) 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", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &u.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &u.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UsagesObject. +func (u UsagesObject) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "usagesType", u.UsagesType) + populate(objectMap, "value", u.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UsagesObject. +func (u *UsagesObject) 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", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "usagesType": + err = unpopulate(val, "UsagesType", &u.UsagesType) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &u.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UsagesProperties. +func (u UsagesProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "isQuotaApplicable", u.IsQuotaApplicable) + populate(objectMap, "name", u.Name) + populate(objectMap, "properties", &u.Properties) + populate(objectMap, "quotaPeriod", u.QuotaPeriod) + populate(objectMap, "resourceType", u.ResourceType) + populate(objectMap, "unit", u.Unit) + populate(objectMap, "usages", u.Usages) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UsagesProperties. +func (u *UsagesProperties) 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", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "isQuotaApplicable": + err = unpopulate(val, "IsQuotaApplicable", &u.IsQuotaApplicable) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &u.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &u.Properties) + delete(rawMsg, key) + case "quotaPeriod": + err = unpopulate(val, "QuotaPeriod", &u.QuotaPeriod) + delete(rawMsg, key) + case "resourceType": + err = unpopulate(val, "ResourceType", &u.ResourceType) + delete(rawMsg, key) + case "unit": + err = unpopulate(val, "Unit", &u.Unit) + delete(rawMsg, key) + case "usages": + err = unpopulate(val, "Usages", &u.Usages) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +func populate(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, fn string, v any) error { + if data == nil { + return nil + } + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + return nil +} diff --git a/sdk/resourcemanager/quota/armquota/zz_generated_operation_client.go b/sdk/resourcemanager/quota/armquota/operation_client.go similarity index 89% rename from sdk/resourcemanager/quota/armquota/zz_generated_operation_client.go rename to sdk/resourcemanager/quota/armquota/operation_client.go index 819d72032195..109ee7541e1d 100644 --- a/sdk/resourcemanager/quota/armquota/zz_generated_operation_client.go +++ b/sdk/resourcemanager/quota/armquota/operation_client.go @@ -5,6 +5,7 @@ // 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 @@ -27,8 +28,8 @@ type OperationClient struct { } // NewOperationClient creates a new instance of OperationClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewOperationClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -49,9 +50,9 @@ func NewOperationClient(credential azcore.TokenCredential, options *arm.ClientOp } // NewListPager - List all the operations supported by the Microsoft.Quota resource provider. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-03-15-preview -// options - OperationClientListOptions contains the optional parameters for the OperationClient.List method. +// +// Generated from API version 2023-02-01 +// - 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]{ More: func(page OperationClientListResponse) bool { @@ -88,7 +89,7 @@ func (client *OperationClient) listCreateRequest(ctx context.Context, options *O return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-15-preview") + reqQP.Set("api-version", "2023-02-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/quota/armquota/zz_generated_polymorphic_helpers.go b/sdk/resourcemanager/quota/armquota/polymorphic_helpers.go similarity index 95% rename from sdk/resourcemanager/quota/armquota/zz_generated_polymorphic_helpers.go rename to sdk/resourcemanager/quota/armquota/polymorphic_helpers.go index fbef19a4ec6c..5f715f42100b 100644 --- a/sdk/resourcemanager/quota/armquota/zz_generated_polymorphic_helpers.go +++ b/sdk/resourcemanager/quota/armquota/polymorphic_helpers.go @@ -5,6 +5,7 @@ // 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 @@ -14,7 +15,7 @@ func unmarshalLimitJSONObjectClassification(rawMsg json.RawMessage) (LimitJSONOb if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } diff --git a/sdk/resourcemanager/quota/armquota/zz_generated_requeststatus_client.go b/sdk/resourcemanager/quota/armquota/requeststatus_client.go similarity index 80% rename from sdk/resourcemanager/quota/armquota/zz_generated_requeststatus_client.go rename to sdk/resourcemanager/quota/armquota/requeststatus_client.go index fa2eeec6b46a..7240bc12c911 100644 --- a/sdk/resourcemanager/quota/armquota/zz_generated_requeststatus_client.go +++ b/sdk/resourcemanager/quota/armquota/requeststatus_client.go @@ -5,6 +5,7 @@ // 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 @@ -31,8 +32,8 @@ type RequestStatusClient struct { } // NewRequestStatusClient creates a new instance of RequestStatusClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewRequestStatusClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*RequestStatusClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -56,13 +57,14 @@ func NewRequestStatusClient(credential azcore.TokenCredential, options *arm.Clie // location. The quota request ID id is returned in the response of the PUT // operation. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-03-15-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 -// resource URI for the List GET operation. If a {resourceName} is added after /quotas, then it's the target Azure resource -// URI in the GET operation for the specific resource. -// options - RequestStatusClientGetOptions contains the optional parameters for the RequestStatusClient.Get method. +// +// Generated from API version 2023-02-01 +// - 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 +// resource URI for the List GET operation. If a {resourceName} is added after /quotas, then it's the target Azure resource +// URI in the GET operation for the specific resource. +// - options - RequestStatusClientGetOptions contains the optional parameters for the RequestStatusClient.Get method. func (client *RequestStatusClient) Get(ctx context.Context, id string, scope string, options *RequestStatusClientGetOptions) (RequestStatusClientGetResponse, error) { req, err := client.getCreateRequest(ctx, id, scope, options) if err != nil { @@ -91,7 +93,7 @@ func (client *RequestStatusClient) getCreateRequest(ctx context.Context, id stri return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-15-preview") + reqQP.Set("api-version", "2023-02-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -108,13 +110,13 @@ 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. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-03-15-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 -// URI in the GET operation for the specific resource. -// options - RequestStatusClientListOptions contains the optional parameters for the RequestStatusClient.List method. +// +// Generated from API version 2023-02-01 +// - 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 +// URI in the GET operation for the specific resource. +// - options - RequestStatusClientListOptions contains the optional parameters for the RequestStatusClient.NewListPager method. func (client *RequestStatusClient) NewListPager(scope string, options *RequestStatusClientListOptions) *runtime.Pager[RequestStatusClientListResponse] { return runtime.NewPager(runtime.PagingHandler[RequestStatusClientListResponse]{ More: func(page RequestStatusClientListResponse) bool { @@ -152,7 +154,7 @@ func (client *RequestStatusClient) listCreateRequest(ctx context.Context, scope return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-15-preview") + reqQP.Set("api-version", "2023-02-01") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } diff --git a/sdk/resourcemanager/quota/armquota/zz_generated_response_types.go b/sdk/resourcemanager/quota/armquota/response_types.go similarity index 88% rename from sdk/resourcemanager/quota/armquota/zz_generated_response_types.go rename to sdk/resourcemanager/quota/armquota/response_types.go index 58fd5b63550e..c25e5db06c93 100644 --- a/sdk/resourcemanager/quota/armquota/zz_generated_response_types.go +++ b/sdk/resourcemanager/quota/armquota/response_types.go @@ -5,10 +5,11 @@ // 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 -// ClientCreateOrUpdateResponse contains the response from method Client.CreateOrUpdate. +// ClientCreateOrUpdateResponse contains the response from method Client.BeginCreateOrUpdate. type ClientCreateOrUpdateResponse struct { CurrentQuotaLimitBase } @@ -20,19 +21,19 @@ type ClientGetResponse struct { ETag *string } -// ClientListResponse contains the response from method Client.List. +// ClientListResponse contains the response from method Client.NewListPager. type ClientListResponse struct { Limits // ETag contains the information returned from the ETag header response. ETag *string } -// ClientUpdateResponse contains the response from method Client.Update. +// ClientUpdateResponse contains the response from method Client.BeginUpdate. type ClientUpdateResponse struct { CurrentQuotaLimitBase } -// OperationClientListResponse contains the response from method OperationClient.List. +// OperationClientListResponse contains the response from method OperationClient.NewListPager. type OperationClientListResponse struct { OperationList } @@ -42,7 +43,7 @@ type RequestStatusClientGetResponse struct { RequestDetails } -// RequestStatusClientListResponse contains the response from method RequestStatusClient.List. +// RequestStatusClientListResponse contains the response from method RequestStatusClient.NewListPager. type RequestStatusClientListResponse struct { RequestDetailsList } @@ -54,7 +55,7 @@ type UsagesClientGetResponse struct { ETag *string } -// UsagesClientListResponse contains the response from method UsagesClient.List. +// UsagesClientListResponse contains the response from method UsagesClient.NewListPager. type UsagesClientListResponse struct { UsagesLimits // ETag contains the information returned from the ETag header response. diff --git a/sdk/resourcemanager/quota/armquota/zz_generated_time_rfc3339.go b/sdk/resourcemanager/quota/armquota/time_rfc3339.go similarity index 96% rename from sdk/resourcemanager/quota/armquota/zz_generated_time_rfc3339.go rename to sdk/resourcemanager/quota/armquota/time_rfc3339.go index 17b21ebc789f..748fd6448ffc 100644 --- a/sdk/resourcemanager/quota/armquota/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/quota/armquota/time_rfc3339.go @@ -5,6 +5,7 @@ // 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 @@ -61,7 +62,7 @@ func (t *timeRFC3339) Parse(layout, value string) error { return err } -func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { +func populateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return } else if azcore.IsNullValue(t) { diff --git a/sdk/resourcemanager/quota/armquota/zz_generated_usages_client.go b/sdk/resourcemanager/quota/armquota/usages_client.go similarity index 77% rename from sdk/resourcemanager/quota/armquota/zz_generated_usages_client.go rename to sdk/resourcemanager/quota/armquota/usages_client.go index c63565b6630e..b095fa6b53da 100644 --- a/sdk/resourcemanager/quota/armquota/zz_generated_usages_client.go +++ b/sdk/resourcemanager/quota/armquota/usages_client.go @@ -5,6 +5,7 @@ // 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 @@ -30,8 +31,8 @@ type UsagesClient struct { } // NewUsagesClient creates a new instance of UsagesClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewUsagesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*UsagesClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -53,15 +54,16 @@ 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 2021-03-15-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. -// 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 -// URI in the GET operation for the specific resource. -// options - UsagesClientGetOptions contains the optional parameters for the UsagesClient.Get method. +// +// Generated from API version 2023-02-01 +// - 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. +// - 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 +// URI in the GET operation for the specific resource. +// - options - UsagesClientGetOptions contains the optional parameters for the UsagesClient.Get method. func (client *UsagesClient) Get(ctx context.Context, resourceName string, scope string, options *UsagesClientGetOptions) (UsagesClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceName, scope, options) if err != nil { @@ -90,7 +92,7 @@ func (client *UsagesClient) getCreateRequest(ctx context.Context, resourceName s return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-15-preview") + reqQP.Set("api-version", "2023-02-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -109,13 +111,13 @@ func (client *UsagesClient) getHandleResponse(resp *http.Response) (UsagesClient } // NewListPager - Get a list of current usage for all resources for the scope specified. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-03-15-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 -// URI in the GET operation for the specific resource. -// options - UsagesClientListOptions contains the optional parameters for the UsagesClient.List method. +// +// Generated from API version 2023-02-01 +// - 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 +// URI in the GET operation for the specific resource. +// - options - UsagesClientListOptions contains the optional parameters for the UsagesClient.NewListPager method. func (client *UsagesClient) NewListPager(scope string, options *UsagesClientListOptions) *runtime.Pager[UsagesClientListResponse] { return runtime.NewPager(runtime.PagingHandler[UsagesClientListResponse]{ More: func(page UsagesClientListResponse) bool { @@ -153,7 +155,7 @@ func (client *UsagesClient) listCreateRequest(ctx context.Context, scope string, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-15-preview") + reqQP.Set("api-version", "2023-02-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/quota/armquota/ze_generated_example_quota_client_test.go b/sdk/resourcemanager/quota/armquota/ze_generated_example_quota_client_test.go deleted file mode 100644 index 03f77f418fe5..000000000000 --- a/sdk/resourcemanager/quota/armquota/ze_generated_example_quota_client_test.go +++ /dev/null @@ -1,140 +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. - -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/tree/main/specification/quota/resource-manager/Microsoft.Quota/preview/2021-03-15-preview/examples/getComputeOneSkuQuotaLimit.json -func ExampleClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armquota.NewClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/quota/resource-manager/Microsoft.Quota/preview/2021-03-15-preview/examples/putNetworkOneSkuQuotaRequest.json -func ExampleClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armquota.NewClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/quota/resource-manager/Microsoft.Quota/preview/2021-03-15-preview/examples/patchComputeQuotaRequest.json -func ExampleClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armquota.NewClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/quota/resource-manager/Microsoft.Quota/preview/2021-03-15-preview/examples/getComputeQuotaLimits.json -func ExampleClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armquota.NewClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/quota/armquota/ze_generated_example_quotaoperation_client_test.go b/sdk/resourcemanager/quota/armquota/ze_generated_example_quotaoperation_client_test.go deleted file mode 100644 index f6afc44c8e92..000000000000 --- a/sdk/resourcemanager/quota/armquota/ze_generated_example_quotaoperation_client_test.go +++ /dev/null @@ -1,41 +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. - -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/tree/main/specification/quota/resource-manager/Microsoft.Quota/preview/2021-03-15-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() - client, err := armquota.NewOperationClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/quota/armquota/ze_generated_example_quotarequeststatus_client_test.go b/sdk/resourcemanager/quota/armquota/ze_generated_example_quotarequeststatus_client_test.go deleted file mode 100644 index 82df9582be97..000000000000 --- a/sdk/resourcemanager/quota/armquota/ze_generated_example_quotarequeststatus_client_test.go +++ /dev/null @@ -1,67 +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. - -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/tree/main/specification/quota/resource-manager/Microsoft.Quota/preview/2021-03-15-preview/examples/getQuotaRequestStatusFailed.json -func ExampleRequestStatusClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armquota.NewRequestStatusClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/quota/resource-manager/Microsoft.Quota/preview/2021-03-15-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() - client, err := armquota.NewRequestStatusClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("subscriptions/D7EC67B3-7657-4966-BFFC-41EFD36BAAB3/providers/Microsoft.Compute/locations/eastus", - &armquota.RequestStatusClientListOptions{Filter: nil, - Top: nil, - Skiptoken: nil, - }) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/quota/armquota/ze_generated_example_usages_client_test.go b/sdk/resourcemanager/quota/armquota/ze_generated_example_usages_client_test.go deleted file mode 100644 index 48c053803d0d..000000000000 --- a/sdk/resourcemanager/quota/armquota/ze_generated_example_usages_client_test.go +++ /dev/null @@ -1,64 +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. - -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/tree/main/specification/quota/resource-manager/Microsoft.Quota/preview/2021-03-15-preview/examples/getComputeOneSkuUsages.json -func ExampleUsagesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armquota.NewUsagesClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/quota/resource-manager/Microsoft.Quota/preview/2021-03-15-preview/examples/getComputeUsages.json -func ExampleUsagesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armquota.NewUsagesClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/quota/armquota/zz_generated_models_serde.go b/sdk/resourcemanager/quota/armquota/zz_generated_models_serde.go deleted file mode 100644 index 3d04897db6f2..000000000000 --- a/sdk/resourcemanager/quota/armquota/zz_generated_models_serde.go +++ /dev/null @@ -1,255 +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. - -package armquota - -import ( - "encoding/json" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" -) - -// MarshalJSON implements the json.Marshaller interface for type CurrentQuotaLimitBase. -func (c CurrentQuotaLimitBase) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", c.ID) - populate(objectMap, "name", c.Name) - populate(objectMap, "properties", c.Properties) - populate(objectMap, "type", c.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type LimitObject. -func (l LimitObject) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["limitObjectType"] = LimitTypeLimitValue - populate(objectMap, "limitType", l.LimitType) - populate(objectMap, "value", l.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type LimitObject. -func (l *LimitObject) 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", l, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "limitObjectType": - err = unpopulate(val, "LimitObjectType", &l.LimitObjectType) - delete(rawMsg, key) - case "limitType": - err = unpopulate(val, "LimitType", &l.LimitType) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &l.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Properties. -func (p Properties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "isQuotaApplicable", p.IsQuotaApplicable) - populate(objectMap, "limit", p.Limit) - populate(objectMap, "name", p.Name) - populate(objectMap, "properties", &p.Properties) - populate(objectMap, "quotaPeriod", p.QuotaPeriod) - populate(objectMap, "resourceType", p.ResourceType) - populate(objectMap, "unit", p.Unit) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Properties. -func (p *Properties) 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", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "isQuotaApplicable": - err = unpopulate(val, "IsQuotaApplicable", &p.IsQuotaApplicable) - delete(rawMsg, key) - case "limit": - p.Limit, err = unmarshalLimitJSONObjectClassification(val) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &p.Properties) - delete(rawMsg, key) - case "quotaPeriod": - err = unpopulate(val, "QuotaPeriod", &p.QuotaPeriod) - delete(rawMsg, key) - case "resourceType": - err = unpopulate(val, "ResourceType", &p.ResourceType) - delete(rawMsg, key) - case "unit": - err = unpopulate(val, "Unit", &p.Unit) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RequestOneResourceProperties. -func (r *RequestOneResourceProperties) 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", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "currentValue": - err = unpopulate(val, "CurrentValue", &r.CurrentValue) - delete(rawMsg, key) - case "error": - err = unpopulate(val, "Error", &r.Error) - delete(rawMsg, key) - case "isQuotaApplicable": - err = unpopulate(val, "IsQuotaApplicable", &r.IsQuotaApplicable) - delete(rawMsg, key) - case "limit": - err = unpopulate(val, "Limit", &r.Limit) - delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &r.Message) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &r.Properties) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &r.ProvisioningState) - delete(rawMsg, key) - case "quotaPeriod": - err = unpopulate(val, "QuotaPeriod", &r.QuotaPeriod) - delete(rawMsg, key) - case "requestSubmitTime": - err = unpopulateTimeRFC3339(val, "RequestSubmitTime", &r.RequestSubmitTime) - delete(rawMsg, key) - case "resourceType": - err = unpopulate(val, "ResourceType", &r.ResourceType) - delete(rawMsg, key) - case "unit": - err = unpopulate(val, "Unit", &r.Unit) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RequestProperties. -func (r *RequestProperties) 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", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "error": - err = unpopulate(val, "Error", &r.Error) - delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &r.Message) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &r.ProvisioningState) - delete(rawMsg, key) - case "requestSubmitTime": - err = unpopulateTimeRFC3339(val, "RequestSubmitTime", &r.RequestSubmitTime) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &r.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SubRequest. -func (s *SubRequest) 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": - s.Limit, err = unmarshalLimitJSONObjectClassification(val) - delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &s.Message) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) - delete(rawMsg, key) - case "resourceType": - err = unpopulate(val, "ResourceType", &s.ResourceType) - delete(rawMsg, key) - case "subRequestId": - err = unpopulate(val, "SubRequestID", &s.SubRequestID) - delete(rawMsg, key) - case "unit": - err = unpopulate(val, "Unit", &s.Unit) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -func populate(m map[string]interface{}, k string, v interface{}) { - if v == nil { - return - } else if azcore.IsNullValue(v) { - m[k] = nil - } else if !reflect.ValueOf(v).IsNil() { - m[k] = v - } -} - -func unpopulate(data json.RawMessage, fn string, v interface{}) error { - if data == nil { - return nil - } - if err := json.Unmarshal(data, v); err != nil { - return fmt.Errorf("struct field %s: %v", fn, err) - } - return nil -}