From 709d6b60bd8ccae579a67f04e475f21bdd426fa5 Mon Sep 17 00:00:00 2001 From: Judy Liu Date: Wed, 20 Nov 2024 16:10:22 +0800 Subject: [PATCH] [Release] sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/1.0.0 #23766 (#23782) * update: update emitter-package(-lock).json * [Release] sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/1.0.0 generation from spec commit: d477c7caa09bf82e22c419be0a99d170552b5892 * [Release] sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/1.0.0 generation from spec commit: d477c7caa09bf82e22c419be0a99d170552b5892 * update config --- .../armdevopsinfrastructure/CHANGELOG.md | 71 +++ .../armdevopsinfrastructure/autorest.md | 13 - .../armdevopsinfrastructure/build.go | 7 - .../armdevopsinfrastructure/client_factory.go | 6 +- .../armdevopsinfrastructure/constants.go | 50 +- .../fake/imageversions_server.go | 55 +- .../armdevopsinfrastructure/fake/internal.go | 11 +- .../fake/operations_server.go | 55 +- .../fake/pools_server.go | 81 ++- .../fake/resourcedetails_server.go | 55 +- .../fake/server_factory.go | 27 +- .../fake/sku_server.go | 55 +- .../fake/subscriptionusages_server.go | 97 ++-- .../fake/time_rfc3339.go | 9 +- .../armdevopsinfrastructure/go.mod | 10 +- .../armdevopsinfrastructure/go.sum | 20 +- .../imageversions_client.go | 12 +- .../imageversions_client_example_test.go | 35 +- .../armdevopsinfrastructure/interfaces.go | 24 +- .../armdevopsinfrastructure/models.go | 261 +++------ .../armdevopsinfrastructure/models_serde.go | 353 ++---------- .../operations_client.go | 12 +- .../operations_client_example_test.go | 18 +- .../armdevopsinfrastructure/options.go | 16 +- .../polymorphic_helpers.go | 56 +- .../armdevopsinfrastructure/pools_client.go | 56 +- .../pools_client_example_test.go | 346 ++++++------ .../resourcedetails_client.go | 12 +- .../resourcedetails_client_example_test.go | 53 +- .../armdevopsinfrastructure/responses.go | 14 +- .../armdevopsinfrastructure/sku_client.go | 12 +- .../sku_client_example_test.go | 516 +++++++++--------- .../subscriptionusages_client.go | 54 +- .../subscriptionusages_client_example_test.go | 55 +- .../armdevopsinfrastructure/time_rfc3339.go | 9 +- .../armdevopsinfrastructure/tsp-location.yaml | 4 + 36 files changed, 1134 insertions(+), 1406 deletions(-) delete mode 100644 sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/autorest.md delete mode 100644 sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/build.go create mode 100644 sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/tsp-location.yaml diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/CHANGELOG.md b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/CHANGELOG.md index 30f1580b8077..ff3cd4b4c66f 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/CHANGELOG.md +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/CHANGELOG.md @@ -1,5 +1,76 @@ # Release History +## 1.0.0 (2024-11-20) +### Breaking Changes + +- Type of `AgentProfile.ResourcePredictions` has been changed from `any` to `*ResourcePredictions` +- Type of `PoolUpdateProperties.AgentProfile` has been changed from `AgentProfileUpdateClassification` to `AgentProfileClassification` +- Type of `Quota.Name` has been changed from `*string` to `*QuotaName` +- Type of `Stateful.ResourcePredictions` has been changed from `any` to `*ResourcePredictions` +- Type of `StatelessAgentProfile.ResourcePredictions` has been changed from `any` to `*ResourcePredictions` +- Function `*AgentProfileUpdate.GetAgentProfileUpdate` has been removed +- Function `*AutomaticResourcePredictionsProfileUpdate.GetResourcePredictionsProfileUpdate` has been removed +- Function `*ManualResourcePredictionsProfileUpdate.GetResourcePredictionsProfileUpdate` has been removed +- Function `*ResourcePredictionsProfileUpdate.GetResourcePredictionsProfileUpdate` has been removed +- Function `*StatefulUpdate.GetAgentProfileUpdate` has been removed +- Function `*StatelessAgentProfileUpdate.GetAgentProfileUpdate` has been removed +- Function `*SubscriptionUsagesClient.NewListByLocationPager` has been removed +- Struct `AutomaticResourcePredictionsProfileUpdate` has been removed +- Struct `ManualResourcePredictionsProfileUpdate` has been removed +- Struct `QuotaListResult` has been removed +- Struct `QuotaProperties` has been removed +- Struct `StatefulUpdate` has been removed +- Struct `StatelessAgentProfileUpdate` has been removed +- Field `Properties`, `SystemData`, `Type` of struct `Quota` has been removed + +### Features Added + +- New function `*SubscriptionUsagesClient.NewUsagesPager(string, *SubscriptionUsagesClientUsagesOptions) *runtime.Pager[SubscriptionUsagesClientUsagesResponse]` +- New struct `PagedQuota` +- New struct `ResourcePredictions` +- New field `CurrentValue`, `Limit`, `Unit` in struct `Quota` + + +## 1.0.0 (2024-11-20) +### Breaking Changes + +- Type of `AgentProfile.ResourcePredictions` has been changed from `any` to `*ResourcePredictions` +- Type of `PoolUpdateProperties.AgentProfile` has been changed from `AgentProfileUpdateClassification` to `AgentProfileClassification` +- Type of `Quota.Name` has been changed from `*string` to `*QuotaName` +- Type of `Stateful.ResourcePredictions` has been changed from `any` to `*ResourcePredictions` +- Type of `StatelessAgentProfile.ResourcePredictions` has been changed from `any` to `*ResourcePredictions` +- Enum `ActionType` has been removed +- Enum `Origin` has been removed +- Function `*AgentProfileUpdate.GetAgentProfileUpdate` has been removed +- Function `*AutomaticResourcePredictionsProfileUpdate.GetResourcePredictionsProfileUpdate` has been removed +- Function `*ManualResourcePredictionsProfileUpdate.GetResourcePredictionsProfileUpdate` has been removed +- Function `*OperationsClient.NewListPager` has been removed +- Function `*ResourcePredictionsProfileUpdate.GetResourcePredictionsProfileUpdate` has been removed +- Function `*StatefulUpdate.GetAgentProfileUpdate` has been removed +- Function `*StatelessAgentProfileUpdate.GetAgentProfileUpdate` has been removed +- Function `*SubscriptionUsagesClient.NewListByLocationPager` has been removed +- Struct `AutomaticResourcePredictionsProfileUpdate` has been removed +- Struct `ManualResourcePredictionsProfileUpdate` has been removed +- Struct `Operation` has been removed +- Struct `OperationDisplay` has been removed +- Struct `OperationListResult` has been removed +- Struct `QuotaListResult` has been removed +- Struct `QuotaProperties` has been removed +- Struct `StatefulUpdate` has been removed +- Struct `StatelessAgentProfileUpdate` has been removed +- Field `Properties`, `SystemData`, `Type` of struct `Quota` has been removed + +### Features Added + +- New function `*OperationsClient.NewlistMethodPager(*operationsClientlistMethodOptions) *runtime.Pager[operationsClientlistMethodResponse]` +- New function `PossibleactionTypeValues() []actionType` +- New function `PossibleoriginValues() []origin` +- New function `*SubscriptionUsagesClient.NewUsagesPager(string, *SubscriptionUsagesClientUsagesOptions) *runtime.Pager[SubscriptionUsagesClientUsagesResponse]` +- New struct `PagedQuota` +- New struct `ResourcePredictions` +- New field `CurrentValue`, `Limit`, `Unit` in struct `Quota` + + ## 0.1.0 (2024-05-24) ### Other Changes diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/autorest.md b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/autorest.md deleted file mode 100644 index 2ea4855f1b0b..000000000000 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/autorest.md +++ /dev/null @@ -1,13 +0,0 @@ -### AutoRest Configuration - -> see https://aka.ms/autorest - -``` yaml -azure-arm: true -require: -- https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/devopsinfrastructure/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/devopsinfrastructure/resource-manager/readme.go.md -license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.0 -tag: package-preview-2024-04 -``` \ No newline at end of file diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/build.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/build.go deleted file mode 100644 index 22c30d6f8220..000000000000 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/build.go +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. - -// This file enables 'go generate' to regenerate this specific SDK -//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate -alwaysSetBodyParamRequired -removeUnreferencedTypes resourcemanager/devopsinfrastructure/armdevopsinfrastructure - -package armdevopsinfrastructure diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/client_factory.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/client_factory.go index 09bab6db20b0..1f7ea53e09ba 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/client_factory.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/client_factory.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdevopsinfrastructure diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/constants.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/constants.go index cbed5af7fe2f..982aced6c92c 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/constants.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/constants.go @@ -1,22 +1,19 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdevopsinfrastructure const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure" - moduleVersion = "v0.1.0" + moduleVersion = "v1.0.0" ) -// ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. +// ActionType - Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. type ActionType string const ( + // ActionTypeInternal - Actions are for internal-only APIs. ActionTypeInternal ActionType = "Internal" ) @@ -69,14 +66,18 @@ func PossibleCachingTypeValues() []CachingType { } } -// CreatedByType - The type of identity that created the resource. +// CreatedByType - The kind of entity that created the resource. type CreatedByType string const ( - CreatedByTypeApplication CreatedByType = "Application" - CreatedByTypeKey CreatedByType = "Key" + // CreatedByTypeApplication - The entity was created by an application. + CreatedByTypeApplication CreatedByType = "Application" + // CreatedByTypeKey - The entity was created by a key. + CreatedByTypeKey CreatedByType = "Key" + // CreatedByTypeManagedIdentity - The entity was created by a managed identity. CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" - CreatedByTypeUser CreatedByType = "User" + // CreatedByTypeUser - The entity was created by a user. + CreatedByTypeUser CreatedByType = "User" ) // PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. @@ -111,10 +112,14 @@ func PossibleLogonTypeValues() []LogonType { type ManagedServiceIdentityType string const ( - ManagedServiceIdentityTypeNone ManagedServiceIdentityType = "None" - ManagedServiceIdentityTypeSystemAssigned ManagedServiceIdentityType = "SystemAssigned" + // ManagedServiceIdentityTypeNone - No managed identity. + ManagedServiceIdentityTypeNone ManagedServiceIdentityType = "None" + // ManagedServiceIdentityTypeSystemAssigned - System assigned managed identity. + ManagedServiceIdentityTypeSystemAssigned ManagedServiceIdentityType = "SystemAssigned" + // ManagedServiceIdentityTypeSystemAssignedUserAssigned - System and user assigned managed identity. ManagedServiceIdentityTypeSystemAssignedUserAssigned ManagedServiceIdentityType = "SystemAssigned,UserAssigned" - ManagedServiceIdentityTypeUserAssigned ManagedServiceIdentityType = "UserAssigned" + // ManagedServiceIdentityTypeUserAssigned - User assigned managed identity. + ManagedServiceIdentityTypeUserAssigned ManagedServiceIdentityType = "UserAssigned" ) // PossibleManagedServiceIdentityTypeValues returns the possible values for the ManagedServiceIdentityType const type. @@ -132,8 +137,11 @@ func PossibleManagedServiceIdentityTypeValues() []ManagedServiceIdentityType { type Origin string const ( - OriginSystem Origin = "system" - OriginUser Origin = "user" + // OriginSystem - Indicates the operation is initiated by a system. + OriginSystem Origin = "system" + // OriginUser - Indicates the operation is initiated by a user. + OriginUser Origin = "user" + // OriginUserSystem - Indicates the operation is initiated by a user or system. OriginUserSystem Origin = "user,system" ) @@ -245,11 +253,14 @@ func PossibleResourcePredictionsProfileTypeValues() []ResourcePredictionsProfile } } +// ResourceSKURestrictionsReasonCode - Describes the reason for SKU restriction. type ResourceSKURestrictionsReasonCode string const ( + // ResourceSKURestrictionsReasonCodeNotAvailableForSubscription - The restriction is not available for this subscription. ResourceSKURestrictionsReasonCodeNotAvailableForSubscription ResourceSKURestrictionsReasonCode = "NotAvailableForSubscription" - ResourceSKURestrictionsReasonCodeQuotaID ResourceSKURestrictionsReasonCode = "QuotaId" + // ResourceSKURestrictionsReasonCodeQuotaID - The restriction is due to exceeding a quota limitation. + ResourceSKURestrictionsReasonCodeQuotaID ResourceSKURestrictionsReasonCode = "QuotaId" ) // PossibleResourceSKURestrictionsReasonCodeValues returns the possible values for the ResourceSKURestrictionsReasonCode const type. @@ -260,11 +271,14 @@ func PossibleResourceSKURestrictionsReasonCodeValues() []ResourceSKURestrictions } } +// ResourceSKURestrictionsType - Describes the kind of SKU restrictions that can exist type ResourceSKURestrictionsType string const ( + // ResourceSKURestrictionsTypeLocation - SKU restricted by location. ResourceSKURestrictionsTypeLocation ResourceSKURestrictionsType = "Location" - ResourceSKURestrictionsTypeZone ResourceSKURestrictionsType = "Zone" + // ResourceSKURestrictionsTypeZone - SKU restricted by availability zone. + ResourceSKURestrictionsTypeZone ResourceSKURestrictionsType = "Zone" ) // PossibleResourceSKURestrictionsTypeValues returns the possible values for the ResourceSKURestrictionsType const type. diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/imageversions_server.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/imageversions_server.go index d9ec0b40e596..f1deb466d4ac 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/imageversions_server.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/imageversions_server.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -53,21 +49,40 @@ func (i *ImageVersionsServerTransport) Do(req *http.Request) (*http.Response, er return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return i.dispatchToMethodFake(req, method) +} - switch method { - case "ImageVersionsClient.NewListByImagePager": - resp, err = i.dispatchNewListByImagePager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (i *ImageVersionsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if imageVersionsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = imageVersionsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ImageVersionsClient.NewListByImagePager": + res.resp, res.err = i.dispatchNewListByImagePager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (i *ImageVersionsServerTransport) dispatchNewListByImagePager(req *http.Request) (*http.Response, error) { @@ -110,3 +125,9 @@ func (i *ImageVersionsServerTransport) dispatchNewListByImagePager(req *http.Req } return resp, nil } + +// set this to conditionally intercept incoming requests to ImageVersionsServerTransport +var imageVersionsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/internal.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/internal.go index 5f75802a569e..7425b6a669e2 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/internal.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/internal.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -14,6 +10,11 @@ import ( "sync" ) +type result struct { + resp *http.Response + err error +} + type nonRetriableError struct { error } diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/operations_server.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/operations_server.go index 15823a3f8cc4..80c82af6c72e 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/operations_server.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/operations_server.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -51,21 +47,40 @@ func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return o.dispatchToMethodFake(req, method) +} - switch method { - case "OperationsClient.NewListPager": - resp, err = o.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (o *OperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if operationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = operationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OperationsClient.NewListPager": + res.resp, res.err = o.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { @@ -94,3 +109,9 @@ func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*ht } return resp, nil } + +// set this to conditionally intercept incoming requests to OperationsServerTransport +var operationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/pools_server.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/pools_server.go index 9df8c0a1cbea..170370591c3f 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/pools_server.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/pools_server.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -29,7 +25,7 @@ type PoolsServer struct { BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, poolName string, resource armdevopsinfrastructure.Pool, options *armdevopsinfrastructure.PoolsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armdevopsinfrastructure.PoolsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method PoolsClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, poolName string, options *armdevopsinfrastructure.PoolsClientBeginDeleteOptions) (resp azfake.PollerResponder[armdevopsinfrastructure.PoolsClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method PoolsClient.Get @@ -82,31 +78,50 @@ func (p *PoolsServerTransport) Do(req *http.Request) (*http.Response, error) { return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return p.dispatchToMethodFake(req, method) +} - switch method { - case "PoolsClient.BeginCreateOrUpdate": - resp, err = p.dispatchBeginCreateOrUpdate(req) - case "PoolsClient.BeginDelete": - resp, err = p.dispatchBeginDelete(req) - case "PoolsClient.Get": - resp, err = p.dispatchGet(req) - case "PoolsClient.NewListByResourceGroupPager": - resp, err = p.dispatchNewListByResourceGroupPager(req) - case "PoolsClient.NewListBySubscriptionPager": - resp, err = p.dispatchNewListBySubscriptionPager(req) - case "PoolsClient.BeginUpdate": - resp, err = p.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (p *PoolsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if poolsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = poolsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "PoolsClient.BeginCreateOrUpdate": + res.resp, res.err = p.dispatchBeginCreateOrUpdate(req) + case "PoolsClient.BeginDelete": + res.resp, res.err = p.dispatchBeginDelete(req) + case "PoolsClient.Get": + res.resp, res.err = p.dispatchGet(req) + case "PoolsClient.NewListByResourceGroupPager": + res.resp, res.err = p.dispatchNewListByResourceGroupPager(req) + case "PoolsClient.NewListBySubscriptionPager": + res.resp, res.err = p.dispatchNewListBySubscriptionPager(req) + case "PoolsClient.BeginUpdate": + res.resp, res.err = p.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (p *PoolsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -190,9 +205,9 @@ func (p *PoolsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Res return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { p.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { p.beginDelete.remove(req) @@ -351,3 +366,9 @@ func (p *PoolsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Res return resp, nil } + +// set this to conditionally intercept incoming requests to PoolsServerTransport +var poolsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/resourcedetails_server.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/resourcedetails_server.go index 644027e03be0..1c8b334fc009 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/resourcedetails_server.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/resourcedetails_server.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -53,21 +49,40 @@ func (r *ResourceDetailsServerTransport) Do(req *http.Request) (*http.Response, return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return r.dispatchToMethodFake(req, method) +} - switch method { - case "ResourceDetailsClient.NewListByPoolPager": - resp, err = r.dispatchNewListByPoolPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (r *ResourceDetailsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if resourceDetailsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = resourceDetailsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ResourceDetailsClient.NewListByPoolPager": + res.resp, res.err = r.dispatchNewListByPoolPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (r *ResourceDetailsServerTransport) dispatchNewListByPoolPager(req *http.Request) (*http.Response, error) { @@ -110,3 +125,9 @@ func (r *ResourceDetailsServerTransport) dispatchNewListByPoolPager(req *http.Re } return resp, nil } + +// set this to conditionally intercept incoming requests to ResourceDetailsServerTransport +var resourceDetailsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/server_factory.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/server_factory.go index e8dc200ba92c..d2a77f346a59 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/server_factory.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/server_factory.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -19,11 +15,22 @@ import ( // ServerFactory is a fake server for instances of the armdevopsinfrastructure.ClientFactory type. type ServerFactory struct { - ImageVersionsServer ImageVersionsServer - OperationsServer OperationsServer - PoolsServer PoolsServer - ResourceDetailsServer ResourceDetailsServer - SKUServer SKUServer + // ImageVersionsServer contains the fakes for client ImageVersionsClient + ImageVersionsServer ImageVersionsServer + + // OperationsServer contains the fakes for client OperationsClient + OperationsServer OperationsServer + + // PoolsServer contains the fakes for client PoolsClient + PoolsServer PoolsServer + + // ResourceDetailsServer contains the fakes for client ResourceDetailsClient + ResourceDetailsServer ResourceDetailsServer + + // SKUServer contains the fakes for client SKUClient + SKUServer SKUServer + + // SubscriptionUsagesServer contains the fakes for client SubscriptionUsagesClient SubscriptionUsagesServer SubscriptionUsagesServer } diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/sku_server.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/sku_server.go index 7bc441779a45..77e4b048e3a6 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/sku_server.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/sku_server.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -53,21 +49,40 @@ func (s *SKUServerTransport) Do(req *http.Request) (*http.Response, error) { return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return s.dispatchToMethodFake(req, method) +} - switch method { - case "SKUClient.NewListByLocationPager": - resp, err = s.dispatchNewListByLocationPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (s *SKUServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if skuServerTransportInterceptor != nil { + res.resp, res.err, intercepted = skuServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "SKUClient.NewListByLocationPager": + res.resp, res.err = s.dispatchNewListByLocationPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (s *SKUServerTransport) dispatchNewListByLocationPager(req *http.Request) (*http.Response, error) { @@ -106,3 +121,9 @@ func (s *SKUServerTransport) dispatchNewListByLocationPager(req *http.Request) ( } return resp, nil } + +// set this to conditionally intercept incoming requests to SKUServerTransport +var skuServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/subscriptionusages_server.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/subscriptionusages_server.go index 814de64be755..3cf219301c20 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/subscriptionusages_server.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/subscriptionusages_server.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -23,9 +19,9 @@ import ( // SubscriptionUsagesServer is a fake server for instances of the armdevopsinfrastructure.SubscriptionUsagesClient type. type SubscriptionUsagesServer struct { - // NewListByLocationPager is the fake for method SubscriptionUsagesClient.NewListByLocationPager + // NewUsagesPager is the fake for method SubscriptionUsagesClient.NewUsagesPager // HTTP status codes to indicate success: http.StatusOK - NewListByLocationPager func(locationName string, options *armdevopsinfrastructure.SubscriptionUsagesClientListByLocationOptions) (resp azfake.PagerResponder[armdevopsinfrastructure.SubscriptionUsagesClientListByLocationResponse]) + NewUsagesPager func(location string, options *armdevopsinfrastructure.SubscriptionUsagesClientUsagesOptions) (resp azfake.PagerResponder[armdevopsinfrastructure.SubscriptionUsagesClientUsagesResponse]) } // NewSubscriptionUsagesServerTransport creates a new instance of SubscriptionUsagesServerTransport with the provided implementation. @@ -33,16 +29,16 @@ type SubscriptionUsagesServer struct { // azcore.ClientOptions.Transporter field in the client's constructor parameters. func NewSubscriptionUsagesServerTransport(srv *SubscriptionUsagesServer) *SubscriptionUsagesServerTransport { return &SubscriptionUsagesServerTransport{ - srv: srv, - newListByLocationPager: newTracker[azfake.PagerResponder[armdevopsinfrastructure.SubscriptionUsagesClientListByLocationResponse]](), + srv: srv, + newUsagesPager: newTracker[azfake.PagerResponder[armdevopsinfrastructure.SubscriptionUsagesClientUsagesResponse]](), } } // SubscriptionUsagesServerTransport connects instances of armdevopsinfrastructure.SubscriptionUsagesClient to instances of SubscriptionUsagesServer. // Don't use this type directly, use NewSubscriptionUsagesServerTransport instead. type SubscriptionUsagesServerTransport struct { - srv *SubscriptionUsagesServer - newListByLocationPager *tracker[azfake.PagerResponder[armdevopsinfrastructure.SubscriptionUsagesClientListByLocationResponse]] + srv *SubscriptionUsagesServer + newUsagesPager *tracker[azfake.PagerResponder[armdevopsinfrastructure.SubscriptionUsagesClientUsagesResponse]] } // Do implements the policy.Transporter interface for SubscriptionUsagesServerTransport. @@ -53,56 +49,81 @@ func (s *SubscriptionUsagesServerTransport) Do(req *http.Request) (*http.Respons return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return s.dispatchToMethodFake(req, method) +} - switch method { - case "SubscriptionUsagesClient.NewListByLocationPager": - resp, err = s.dispatchNewListByLocationPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (s *SubscriptionUsagesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if subscriptionUsagesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = subscriptionUsagesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "SubscriptionUsagesClient.NewUsagesPager": + res.resp, res.err = s.dispatchNewUsagesPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } -func (s *SubscriptionUsagesServerTransport) dispatchNewListByLocationPager(req *http.Request) (*http.Response, error) { - if s.srv.NewListByLocationPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByLocationPager not implemented")} +func (s *SubscriptionUsagesServerTransport) dispatchNewUsagesPager(req *http.Request) (*http.Response, error) { + if s.srv.NewUsagesPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewUsagesPager not implemented")} } - newListByLocationPager := s.newListByLocationPager.get(req) - if newListByLocationPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevOpsInfrastructure/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/usages` + newUsagesPager := s.newUsagesPager.get(req) + if newUsagesPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevOpsInfrastructure/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/usages` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) if matches == nil || len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } - locationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("locationName")]) + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) if err != nil { return nil, err } - resp := s.srv.NewListByLocationPager(locationNameParam, nil) - newListByLocationPager = &resp - s.newListByLocationPager.add(req, newListByLocationPager) - server.PagerResponderInjectNextLinks(newListByLocationPager, req, func(page *armdevopsinfrastructure.SubscriptionUsagesClientListByLocationResponse, createLink func() string) { + resp := s.srv.NewUsagesPager(locationParam, nil) + newUsagesPager = &resp + s.newUsagesPager.add(req, newUsagesPager) + server.PagerResponderInjectNextLinks(newUsagesPager, req, func(page *armdevopsinfrastructure.SubscriptionUsagesClientUsagesResponse, createLink func() string) { page.NextLink = to.Ptr(createLink()) }) } - resp, err := server.PagerResponderNext(newListByLocationPager, req) + resp, err := server.PagerResponderNext(newUsagesPager, req) if err != nil { return nil, err } if !contains([]int{http.StatusOK}, resp.StatusCode) { - s.newListByLocationPager.remove(req) + s.newUsagesPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } - if !server.PagerResponderMore(newListByLocationPager) { - s.newListByLocationPager.remove(req) + if !server.PagerResponderMore(newUsagesPager) { + s.newUsagesPager.remove(req) } return resp, nil } + +// set this to conditionally intercept incoming requests to SubscriptionUsagesServerTransport +var subscriptionUsagesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/time_rfc3339.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/time_rfc3339.go index 81f308b0d343..87ee11e83b32 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/time_rfc3339.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/time_rfc3339.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -60,6 +56,9 @@ func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + if len(data) == 0 { + return nil + } tzOffset := tzOffsetRegex.Match(data) hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") var layout string diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/go.mod b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/go.mod index 12db711df587..8f0f110538ce 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/go.mod +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/go.mod @@ -3,7 +3,7 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devopsinfrastructur go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 ) @@ -14,8 +14,8 @@ require ( github.com/google/uuid v1.6.0 // indirect github.com/kylelemons/godebug v1.1.0 // indirect github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect - golang.org/x/crypto v0.25.0 // indirect - golang.org/x/net v0.27.0 // indirect - golang.org/x/sys v0.22.0 // indirect - golang.org/x/text v0.16.0 // indirect + golang.org/x/crypto v0.27.0 // indirect + golang.org/x/net v0.29.0 // indirect + golang.org/x/sys v0.25.0 // indirect + golang.org/x/text v0.18.0 // indirect ) diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/go.sum b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/go.sum index 09d275cb9a37..cbddbbd9ecec 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/go.sum +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/go.sum @@ -1,5 +1,5 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 h1:GJHeeA2N7xrG3q30L2UXDyuWRzDM900/65j70wcM4Ww= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 h1:JZg6HRh6W6U4OLl6lk7BZ7BLisIzM9dG1R50zUk9C/M= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0/go.mod h1:YL1xnZ6QejvQHWJrX/AvhFl4WW4rqHVoKspWNVwFk0M= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= @@ -17,13 +17,13 @@ github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmd github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= -golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= -golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= +golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= +golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/imageversions_client.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/imageversions_client.go index 1285cf8f02d4..e67fb049e3a9 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/imageversions_client.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/imageversions_client.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdevopsinfrastructure @@ -45,7 +41,7 @@ func NewImageVersionsClient(subscriptionID string, credential azcore.TokenCreden // NewListByImagePager - List ImageVersion resources by Image // -// Generated from API version 2024-04-04-preview +// Generated from API version 2024-10-19 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - imageName - Name of the image. // - options - ImageVersionsClientListByImageOptions contains the optional parameters for the ImageVersionsClient.NewListByImagePager @@ -74,7 +70,7 @@ func (client *ImageVersionsClient) NewListByImagePager(resourceGroupName string, } // listByImageCreateRequest creates the ListByImage request. -func (client *ImageVersionsClient) listByImageCreateRequest(ctx context.Context, resourceGroupName string, imageName string, options *ImageVersionsClientListByImageOptions) (*policy.Request, error) { +func (client *ImageVersionsClient) listByImageCreateRequest(ctx context.Context, resourceGroupName string, imageName string, _ *ImageVersionsClientListByImageOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOpsInfrastructure/images/{imageName}/versions" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -93,7 +89,7 @@ func (client *ImageVersionsClient) listByImageCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-04-preview") + reqQP.Set("api-version", "2024-10-19") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/imageversions_client_example_test.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/imageversions_client_example_test.go index 9949dcb23719..7b5921223ee3 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/imageversions_client_example_test.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/imageversions_client_example_test.go @@ -1,30 +1,24 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdevopsinfrastructure_test import ( "context" - "log" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/devopsinfrastructure/resource-manager/Microsoft.DevOpsInfrastructure/preview/2024-04-04-preview/examples/ImageVersions_ListByImage.json +// Generated from example definition: 2024-10-19/ImageVersions_ListByImage.json func ExampleImageVersionsClient_NewListByImagePager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armdevopsinfrastructure.NewClientFactory("", cred, nil) + clientFactory, err := armdevopsinfrastructure.NewClientFactory("a2e95d27-c161-4b61-bda4-11512c14c2c2", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -39,16 +33,19 @@ func ExampleImageVersionsClient_NewListByImagePager() { _ = v } // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ImageVersionListResult = armdevopsinfrastructure.ImageVersionListResult{ - // Value: []*armdevopsinfrastructure.ImageVersion{ - // { - // Name: to.Ptr("2024.0417.0"), - // ID: to.Ptr("/subscriptions/a2e95d27-c161-4b61-bda4-11512c14c2c2/resourceGroups/my-resource-group/providers/Microsoft.DevOpsInfrastructure/images/windows-2022/versions/2024.0417.0"), + // page = armdevopsinfrastructure.ImageVersionsClientListByImageResponse{ + // ImageVersionListResult: armdevopsinfrastructure.ImageVersionListResult{ + // Value: []*armdevopsinfrastructure.ImageVersion{ + // { + // ID: to.Ptr("/subscriptions/a2e95d27-c161-4b61-bda4-11512c14c2c2/resourceGroups/my-resource-group/providers/Microsoft.DevOpsInfrastructure/images/windows-2022/versions/2024.0417.0"), + // Name: to.Ptr("2024.0417.0"), + // }, + // { + // ID: to.Ptr("/subscriptions/a2e95d27-c161-4b61-bda4-11512c14c2c2/resourceGroups/my-resource-group/providers/Microsoft.DevOpsInfrastructure/images/windows-2022/versions/2024.0417.1"), + // Name: to.Ptr("2024.0417.1"), + // }, // }, - // { - // Name: to.Ptr("2024.0417.1"), - // ID: to.Ptr("/subscriptions/a2e95d27-c161-4b61-bda4-11512c14c2c2/resourceGroups/my-resource-group/providers/Microsoft.DevOpsInfrastructure/images/windows-2022/versions/2024.0417.1"), - // }}, + // }, // } } } diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/interfaces.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/interfaces.go index 85e5dd582fa8..741df79d72aa 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/interfaces.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/interfaces.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdevopsinfrastructure @@ -17,15 +13,6 @@ type AgentProfileClassification interface { GetAgentProfile() *AgentProfile } -// AgentProfileUpdateClassification provides polymorphic access to related types. -// Call the interface's GetAgentProfileUpdate() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *AgentProfileUpdate, *StatefulUpdate, *StatelessAgentProfileUpdate -type AgentProfileUpdateClassification interface { - // GetAgentProfileUpdate returns the AgentProfileUpdate content of the underlying type. - GetAgentProfileUpdate() *AgentProfileUpdate -} - // FabricProfileClassification provides polymorphic access to related types. // Call the interface's GetFabricProfile() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: @@ -52,12 +39,3 @@ type ResourcePredictionsProfileClassification interface { // GetResourcePredictionsProfile returns the ResourcePredictionsProfile content of the underlying type. GetResourcePredictionsProfile() *ResourcePredictionsProfile } - -// ResourcePredictionsProfileUpdateClassification provides polymorphic access to related types. -// Call the interface's GetResourcePredictionsProfileUpdate() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *AutomaticResourcePredictionsProfileUpdate, *ManualResourcePredictionsProfileUpdate, *ResourcePredictionsProfileUpdate -type ResourcePredictionsProfileUpdateClassification interface { - // GetResourcePredictionsProfileUpdate returns the ResourcePredictionsProfileUpdate content of the underlying type. - GetResourcePredictionsProfileUpdate() *ResourcePredictionsProfileUpdate -} diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/models.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/models.go index 90f682a878c5..6ae02c449a5e 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/models.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/models.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdevopsinfrastructure @@ -16,7 +12,7 @@ type AgentProfile struct { Kind *string // Defines pool buffer/stand-by agents. - ResourcePredictions any + ResourcePredictions *ResourcePredictions // Defines how the pool buffer/stand-by agents is provided. ResourcePredictionsProfile ResourcePredictionsProfileClassification @@ -25,24 +21,10 @@ type AgentProfile struct { // GetAgentProfile implements the AgentProfileClassification interface for type AgentProfile. func (a *AgentProfile) GetAgentProfile() *AgentProfile { return a } -// AgentProfileUpdate - The agent profile of the machines in the pool. -type AgentProfileUpdate struct { - // REQUIRED; Discriminator property for AgentProfile. - Kind *string - - // Defines pool buffer/stand-by agents. - ResourcePredictions any - - // Defines how the pool buffer/stand-by agents is provided. - ResourcePredictionsProfile ResourcePredictionsProfileUpdateClassification -} - -// GetAgentProfileUpdate implements the AgentProfileUpdateClassification interface for type AgentProfileUpdate. -func (a *AgentProfileUpdate) GetAgentProfileUpdate() *AgentProfileUpdate { return a } - // AutomaticResourcePredictionsProfile - The stand-by agent scheme is determined based on historical demand. type AutomaticResourcePredictionsProfile struct { - // REQUIRED; Determines how the stand-by scheme should be provided. + // CONSTANT; The stand-by agent scheme is determined based on historical demand. + // Field has constant value ResourcePredictionsProfileTypeAutomatic, any specified value is ignored. Kind *ResourcePredictionsProfileType // Determines the balance between cost and performance. @@ -56,25 +38,10 @@ func (a *AutomaticResourcePredictionsProfile) GetResourcePredictionsProfile() *R } } -// AutomaticResourcePredictionsProfileUpdate - The stand-by agent scheme is determined based on historical demand. -type AutomaticResourcePredictionsProfileUpdate struct { - // REQUIRED; Determines how the stand-by scheme should be provided. - Kind *ResourcePredictionsProfileType - - // Determines the balance between cost and performance. - PredictionPreference *PredictionPreference -} - -// GetResourcePredictionsProfileUpdate implements the ResourcePredictionsProfileUpdateClassification interface for type AutomaticResourcePredictionsProfileUpdate. -func (a *AutomaticResourcePredictionsProfileUpdate) GetResourcePredictionsProfileUpdate() *ResourcePredictionsProfileUpdate { - return &ResourcePredictionsProfileUpdate{ - Kind: a.Kind, - } -} - // AzureDevOpsOrganizationProfile - Azure DevOps organization profile type AzureDevOpsOrganizationProfile struct { - // REQUIRED; Discriminator property for OrganizationProfile. + // CONSTANT; Azure DevOps organization profile + // Field has constant value "AzureDevOps", any specified value is ignored. Kind *string // REQUIRED; The list of Azure DevOps organizations the pool should be present in. @@ -106,8 +73,7 @@ type AzureDevOpsPermissionProfile struct { // DataDisk - The data disk of the VMSS. type DataDisk struct { // The type of caching to be enabled for the data disks. The default value for caching is readwrite. For information about - // the caching options see: - // https://blogs.msdn.microsoft.com/windowsazurestorage/2012/06/27/exploring-windows-azure-drives-disks-and-images/. + // the caching options see: https://blogs.msdn.microsoft.com/windowsazurestorage/2012/06/27/exploring-windows-azure-drives-disks-and-images/. Caching *CachingType // The initial disk size in gigabytes. @@ -146,7 +112,8 @@ type GitHubOrganization struct { // GitHubOrganizationProfile - GitHub organization profile type GitHubOrganizationProfile struct { - // REQUIRED; Discriminator property for OrganizationProfile. + // CONSTANT; GitHub organization profile + // Field has constant value "GitHub", any specified value is ignored. Kind *string // REQUIRED; The list of GitHub organizations/repositories the pool should be present in. @@ -165,12 +132,12 @@ type ImageVersion struct { // The resource-specific properties for this resource. Properties *ImageVersionProperties - // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" - ID *string - - // READ-ONLY; The name of the resource + // READ-ONLY; The name of the image version. Name *string + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData @@ -195,14 +162,10 @@ type ImageVersionProperties struct { // ManagedServiceIdentity - Managed service identity (system assigned and/or user assigned identities) type ManagedServiceIdentity struct { - // REQUIRED; Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). + // REQUIRED; The type of managed identity assigned to this resource. Type *ManagedServiceIdentityType - // The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM - // resource ids in the form: - // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. - // The dictionary values can be empty objects ({}) in - // requests. + // The identities assigned to this resource by the user. UserAssignedIdentities map[string]*UserAssignedIdentity // READ-ONLY; The service principal ID of the system assigned identity. This property will only be provided for a system assigned @@ -215,7 +178,8 @@ type ManagedServiceIdentity struct { // ManualResourcePredictionsProfile - Customer provides the stand-by agent scheme. type ManualResourcePredictionsProfile struct { - // REQUIRED; Determines how the stand-by scheme should be provided. + // CONSTANT; Customer provides the stand-by agent scheme. + // Field has constant value ResourcePredictionsProfileTypeManual, any specified value is ignored. Kind *ResourcePredictionsProfileType } @@ -226,19 +190,6 @@ func (m *ManualResourcePredictionsProfile) GetResourcePredictionsProfile() *Reso } } -// ManualResourcePredictionsProfileUpdate - Customer provides the stand-by agent scheme. -type ManualResourcePredictionsProfileUpdate struct { - // REQUIRED; Determines how the stand-by scheme should be provided. - Kind *ResourcePredictionsProfileType -} - -// GetResourcePredictionsProfileUpdate implements the ResourcePredictionsProfileUpdateClassification interface for type ManualResourcePredictionsProfileUpdate. -func (m *ManualResourcePredictionsProfileUpdate) GetResourcePredictionsProfileUpdate() *ResourcePredictionsProfileUpdate { - return &ResourcePredictionsProfileUpdate{ - Kind: m.Kind, - } -} - // NetworkProfile - The network profile of the machines in the pool. type NetworkProfile struct { // REQUIRED; The subnet id on which to put all machines created in the pool. @@ -247,14 +198,14 @@ type NetworkProfile struct { // Operation - Details of a REST API operation, returned from the Resource Provider Operations API type Operation struct { - // Localized display information for this particular operation. - Display *OperationDisplay - - // READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + // Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. ActionType *ActionType - // READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane - // operations. + // READ-ONLY; Localized display information for this particular operation. + Display *OperationDisplay + + // READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure + // Resource Manager/control-plane operations. IsDataAction *bool // READ-ONLY; The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", @@ -266,7 +217,7 @@ type Operation struct { Origin *Origin } -// OperationDisplay - Localized display information for this particular operation. +// OperationDisplay - Localized display information for and operation. type OperationDisplay struct { // READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views. Description *string @@ -287,11 +238,11 @@ type OperationDisplay struct { // OperationListResult - A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to // get the next set of results. type OperationListResult struct { - // READ-ONLY; URL to get the next set of operation list results (if there are any). - NextLink *string - - // READ-ONLY; List of operations supported by the resource provider + // REQUIRED; The Operation items on this page Value []*Operation + + // The link to the next page of items + NextLink *string } // Organization - Defines an Azure DevOps organization. @@ -324,11 +275,23 @@ type OsProfile struct { SecretsManagementSettings *SecretsManagementSettings } +// PagedQuota - Paged collection of Quota items +type PagedQuota struct { + // REQUIRED; The Quota items on this page + Value []*Quota + + // The link to the next page of items + NextLink *string +} + // Pool - Concrete tracked resource types can be created by aliasing this type using a specific property type. type Pool struct { // REQUIRED; The geo-location where the resource lives Location *string + // READ-ONLY; Name of the pool. It needs to be globally unique. + Name *string + // The managed service identities assigned to this resource. Identity *ManagedServiceIdentity @@ -338,12 +301,9 @@ type Pool struct { // Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource - Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData @@ -401,7 +361,7 @@ type PoolUpdate struct { // The managed service identities assigned to this resource. Identity *ManagedServiceIdentity - // The updatable properties of the Pool. + // The resource-specific properties for this resource. Properties *PoolUpdateProperties // Resource tags. @@ -411,7 +371,7 @@ type PoolUpdate struct { // PoolUpdateProperties - The updatable properties of the Pool. type PoolUpdateProperties struct { // Defines how the machine will be handled once it executed a job. - AgentProfile AgentProfileUpdateClassification + AgentProfile AgentProfileClassification // The resource id of the DevCenter Project the pool belongs to. DevCenterProjectResourceID *string @@ -431,29 +391,20 @@ type PoolUpdateProperties struct { // Quota - Describes Resource Quota type Quota struct { - // The resource-specific properties for this resource. - Properties *QuotaProperties + // REQUIRED; The current usage of the resource. + CurrentValue *int64 - // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + // REQUIRED; Fully qualified ARM resource id ID *string - // READ-ONLY; The name of the resource - Name *string - - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. - SystemData *SystemData - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string -} + // REQUIRED; The maximum permitted usage of the resource. + Limit *int64 -// QuotaListResult - The response of a Quota list operation. -type QuotaListResult struct { - // REQUIRED; The Quota items on this page - Value []*Quota + // REQUIRED; The unit of usage measurement. + Unit *string - // The link to the next page of items - NextLink *string + // READ-ONLY; The name of the quota. + Name *QuotaName } // QuotaName - The Quota Names @@ -465,32 +416,17 @@ type QuotaName struct { Value *string } -// QuotaProperties - Describes Resource Quota properties -type QuotaProperties struct { - // REQUIRED; The current usage of the resource. - CurrentValue *int64 - - // REQUIRED; The maximum permitted usage of the resource. - Limit *int64 - - // REQUIRED; The details of the quota. - Name *QuotaName - - // REQUIRED; The unit of usage measurement. - Unit *string -} - // ResourceDetailsObject - A ResourceDetailsObject type ResourceDetailsObject struct { // The resource-specific properties for this resource. Properties *ResourceDetailsObjectProperties - // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" - ID *string - - // READ-ONLY; The name of the resource + // READ-ONLY; The name of the resource. Name *string + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData @@ -519,6 +455,10 @@ type ResourceDetailsObjectProperties struct { Status *ResourceStatus } +// ResourcePredictions - Defines pool buffer. +type ResourcePredictions struct { +} + // ResourcePredictionsProfile - Determines how the stand-by scheme should be provided. type ResourcePredictionsProfile struct { // REQUIRED; Determines how the stand-by scheme should be provided. @@ -530,28 +470,17 @@ func (r *ResourcePredictionsProfile) GetResourcePredictionsProfile() *ResourcePr return r } -// ResourcePredictionsProfileUpdate - Determines how the stand-by scheme should be provided. -type ResourcePredictionsProfileUpdate struct { - // REQUIRED; Determines how the stand-by scheme should be provided. - Kind *ResourcePredictionsProfileType -} - -// GetResourcePredictionsProfileUpdate implements the ResourcePredictionsProfileUpdateClassification interface for type ResourcePredictionsProfileUpdate. -func (r *ResourcePredictionsProfileUpdate) GetResourcePredictionsProfileUpdate() *ResourcePredictionsProfileUpdate { - return r -} - // ResourceSKU - A ResourceSku type ResourceSKU struct { // The resource-specific properties for this resource. Properties *ResourceSKUProperties - // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" - ID *string - - // READ-ONLY; The name of the resource + // READ-ONLY; The name of the SKU. Name *string + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData @@ -664,7 +593,8 @@ type SecretsManagementSettings struct { // Stateful profile meaning that the machines will be returned to the pool after running a job. type Stateful struct { - // REQUIRED; Discriminator property for AgentProfile. + // CONSTANT; Stateful profile meaning that the machines will be returned to the pool after running a job. + // Field has constant value "Stateful", any specified value is ignored. Kind *string // How long should the machine be kept around after it ran a workload when there are no stand-by agents. The maximum is one @@ -675,7 +605,7 @@ type Stateful struct { MaxAgentLifetime *string // Defines pool buffer/stand-by agents. - ResourcePredictions any + ResourcePredictions *ResourcePredictions // Defines how the pool buffer/stand-by agents is provided. ResourcePredictionsProfile ResourcePredictionsProfileClassification @@ -690,41 +620,14 @@ func (s *Stateful) GetAgentProfile() *AgentProfile { } } -// StatefulUpdate - Stateful profile meaning that the machines will be returned to the pool after running a job. -type StatefulUpdate struct { - // REQUIRED; Discriminator property for AgentProfile. - Kind *string - - // How long should the machine be kept around after it ran a workload when there are no stand-by agents. The maximum is one - // week. - GracePeriodTimeSpan *string - - // How long should stateful machines be kept around. The maximum is one week. - MaxAgentLifetime *string - - // Defines pool buffer/stand-by agents. - ResourcePredictions any - - // Defines how the pool buffer/stand-by agents is provided. - ResourcePredictionsProfile ResourcePredictionsProfileUpdateClassification -} - -// GetAgentProfileUpdate implements the AgentProfileUpdateClassification interface for type StatefulUpdate. -func (s *StatefulUpdate) GetAgentProfileUpdate() *AgentProfileUpdate { - return &AgentProfileUpdate{ - Kind: s.Kind, - ResourcePredictions: s.ResourcePredictions, - ResourcePredictionsProfile: s.ResourcePredictionsProfile, - } -} - // StatelessAgentProfile - Stateless profile meaning that the machines will be cleaned up after running a job. type StatelessAgentProfile struct { - // REQUIRED; Discriminator property for AgentProfile. + // CONSTANT; Stateless profile meaning that the machines will be cleaned up after running a job. + // Field has constant value "Stateless", any specified value is ignored. Kind *string // Defines pool buffer/stand-by agents. - ResourcePredictions any + ResourcePredictions *ResourcePredictions // Defines how the pool buffer/stand-by agents is provided. ResourcePredictionsProfile ResourcePredictionsProfileClassification @@ -739,27 +642,6 @@ func (s *StatelessAgentProfile) GetAgentProfile() *AgentProfile { } } -// StatelessAgentProfileUpdate - Stateless profile meaning that the machines will be cleaned up after running a job. -type StatelessAgentProfileUpdate struct { - // REQUIRED; Discriminator property for AgentProfile. - Kind *string - - // Defines pool buffer/stand-by agents. - ResourcePredictions any - - // Defines how the pool buffer/stand-by agents is provided. - ResourcePredictionsProfile ResourcePredictionsProfileUpdateClassification -} - -// GetAgentProfileUpdate implements the AgentProfileUpdateClassification interface for type StatelessAgentProfileUpdate. -func (s *StatelessAgentProfileUpdate) GetAgentProfileUpdate() *AgentProfileUpdate { - return &AgentProfileUpdate{ - Kind: s.Kind, - ResourcePredictions: s.ResourcePredictions, - ResourcePredictionsProfile: s.ResourcePredictionsProfile, - } -} - // StorageProfile - The storage profile of the VMSS. type StorageProfile struct { // A list of empty data disks to attach. @@ -804,7 +686,8 @@ type VmssFabricProfile struct { // REQUIRED; The VM images of the machines in the pool. Images []*PoolImage - // REQUIRED; Discriminator property for FabricProfile. + // CONSTANT; Virtual Machine Scale Sets + // Field has constant value "Vmss", any specified value is ignored. Kind *string // REQUIRED; The Azure SKU of the machines in the pool. diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/models_serde.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/models_serde.go index 30ddb194628f..507dc3d52167 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/models_serde.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/models_serde.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdevopsinfrastructure @@ -18,8 +14,8 @@ import ( // MarshalJSON implements the json.Marshaller interface for type AgentProfile. func (a AgentProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["kind"] = a.Kind - populateAny(objectMap, "resourcePredictions", a.ResourcePredictions) + populate(objectMap, "kind", a.Kind) + populate(objectMap, "resourcePredictions", a.ResourcePredictions) populate(objectMap, "resourcePredictionsProfile", a.ResourcePredictionsProfile) return json.Marshal(objectMap) } @@ -50,41 +46,6 @@ func (a *AgentProfile) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AgentProfileUpdate. -func (a AgentProfileUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["kind"] = a.Kind - populateAny(objectMap, "resourcePredictions", a.ResourcePredictions) - populate(objectMap, "resourcePredictionsProfile", a.ResourcePredictionsProfile) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AgentProfileUpdate. -func (a *AgentProfileUpdate) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "kind": - err = unpopulate(val, "Kind", &a.Kind) - delete(rawMsg, key) - case "resourcePredictions": - err = unpopulate(val, "ResourcePredictions", &a.ResourcePredictions) - delete(rawMsg, key) - case "resourcePredictionsProfile": - a.ResourcePredictionsProfile, err = unmarshalResourcePredictionsProfileUpdateClassification(val) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type AutomaticResourcePredictionsProfile. func (a AutomaticResourcePredictionsProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -116,37 +77,6 @@ func (a *AutomaticResourcePredictionsProfile) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AutomaticResourcePredictionsProfileUpdate. -func (a AutomaticResourcePredictionsProfileUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["kind"] = ResourcePredictionsProfileTypeAutomatic - populate(objectMap, "predictionPreference", a.PredictionPreference) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AutomaticResourcePredictionsProfileUpdate. -func (a *AutomaticResourcePredictionsProfileUpdate) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "kind": - err = unpopulate(val, "Kind", &a.Kind) - delete(rawMsg, key) - case "predictionPreference": - err = unpopulate(val, "PredictionPreference", &a.PredictionPreference) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type AzureDevOpsOrganizationProfile. func (a AzureDevOpsOrganizationProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -286,7 +216,7 @@ func (d *DevOpsAzureSKU) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type FabricProfile. func (f FabricProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["kind"] = f.Kind + populate(objectMap, "kind", f.Kind) return json.Marshal(objectMap) } @@ -539,33 +469,6 @@ func (m *ManualResourcePredictionsProfile) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ManualResourcePredictionsProfileUpdate. -func (m ManualResourcePredictionsProfileUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["kind"] = ResourcePredictionsProfileTypeManual - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ManualResourcePredictionsProfileUpdate. -func (m *ManualResourcePredictionsProfileUpdate) 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", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "kind": - err = unpopulate(val, "Kind", &m.Kind) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type NetworkProfile. func (n NetworkProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -744,7 +647,7 @@ func (o *Organization) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type OrganizationProfile. func (o OrganizationProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["kind"] = o.Kind + populate(objectMap, "kind", o.Kind) return json.Marshal(objectMap) } @@ -799,6 +702,37 @@ func (o *OsProfile) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type PagedQuota. +func (p PagedQuota) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PagedQuota. +func (p *PagedQuota) 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 "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + 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 Pool. func (p Pool) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1028,7 +962,7 @@ func (p *PoolUpdateProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "agentProfile": - p.AgentProfile, err = unmarshalAgentProfileUpdateClassification(val) + p.AgentProfile, err = unmarshalAgentProfileClassification(val) delete(rawMsg, key) case "devCenterProjectResourceId": err = unpopulate(val, "DevCenterProjectResourceID", &p.DevCenterProjectResourceID) @@ -1056,11 +990,11 @@ func (p *PoolUpdateProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Quota. func (q Quota) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "currentValue", q.CurrentValue) populate(objectMap, "id", q.ID) + populate(objectMap, "limit", q.Limit) populate(objectMap, "name", q.Name) - populate(objectMap, "properties", q.Properties) - populate(objectMap, "systemData", q.SystemData) - populate(objectMap, "type", q.Type) + populate(objectMap, "unit", q.Unit) return json.Marshal(objectMap) } @@ -1073,51 +1007,20 @@ func (q *Quota) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "currentValue": + err = unpopulate(val, "CurrentValue", &q.CurrentValue) + delete(rawMsg, key) case "id": err = unpopulate(val, "ID", &q.ID) delete(rawMsg, key) + case "limit": + err = unpopulate(val, "Limit", &q.Limit) + delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &q.Name) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &q.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &q.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &q.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type QuotaListResult. -func (q QuotaListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", q.NextLink) - populate(objectMap, "value", q.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type QuotaListResult. -func (q *QuotaListResult) 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", q, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &q.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &q.Value) + case "unit": + err = unpopulate(val, "Unit", &q.Unit) delete(rawMsg, key) } if err != nil { @@ -1158,45 +1061,6 @@ func (q *QuotaName) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type QuotaProperties. -func (q QuotaProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "currentValue", q.CurrentValue) - populate(objectMap, "limit", q.Limit) - populate(objectMap, "name", q.Name) - populate(objectMap, "unit", q.Unit) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type QuotaProperties. -func (q *QuotaProperties) 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", q, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "currentValue": - err = unpopulate(val, "CurrentValue", &q.CurrentValue) - delete(rawMsg, key) - case "limit": - err = unpopulate(val, "Limit", &q.Limit) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &q.Name) - delete(rawMsg, key) - case "unit": - err = unpopulate(val, "Unit", &q.Unit) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type ResourceDetailsObject. func (r ResourceDetailsObject) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1309,7 +1173,7 @@ func (r *ResourceDetailsObjectProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ResourcePredictionsProfile. func (r ResourcePredictionsProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["kind"] = r.Kind + populate(objectMap, "kind", r.Kind) return json.Marshal(objectMap) } @@ -1333,33 +1197,6 @@ func (r *ResourcePredictionsProfile) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ResourcePredictionsProfileUpdate. -func (r ResourcePredictionsProfileUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["kind"] = r.Kind - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourcePredictionsProfileUpdate. -func (r *ResourcePredictionsProfileUpdate) 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 "kind": - err = unpopulate(val, "Kind", &r.Kind) - 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 ResourceSKU. func (r ResourceSKU) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1697,7 +1534,7 @@ func (s Stateful) MarshalJSON() ([]byte, error) { populate(objectMap, "gracePeriodTimeSpan", s.GracePeriodTimeSpan) objectMap["kind"] = "Stateful" populate(objectMap, "maxAgentLifetime", s.MaxAgentLifetime) - populateAny(objectMap, "resourcePredictions", s.ResourcePredictions) + populate(objectMap, "resourcePredictions", s.ResourcePredictions) populate(objectMap, "resourcePredictionsProfile", s.ResourcePredictionsProfile) return json.Marshal(objectMap) } @@ -1734,54 +1571,11 @@ func (s *Stateful) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type StatefulUpdate. -func (s StatefulUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "gracePeriodTimeSpan", s.GracePeriodTimeSpan) - objectMap["kind"] = "Stateful" - populate(objectMap, "maxAgentLifetime", s.MaxAgentLifetime) - populateAny(objectMap, "resourcePredictions", s.ResourcePredictions) - populate(objectMap, "resourcePredictionsProfile", s.ResourcePredictionsProfile) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type StatefulUpdate. -func (s *StatefulUpdate) 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 "gracePeriodTimeSpan": - err = unpopulate(val, "GracePeriodTimeSpan", &s.GracePeriodTimeSpan) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &s.Kind) - delete(rawMsg, key) - case "maxAgentLifetime": - err = unpopulate(val, "MaxAgentLifetime", &s.MaxAgentLifetime) - delete(rawMsg, key) - case "resourcePredictions": - err = unpopulate(val, "ResourcePredictions", &s.ResourcePredictions) - delete(rawMsg, key) - case "resourcePredictionsProfile": - s.ResourcePredictionsProfile, err = unmarshalResourcePredictionsProfileUpdateClassification(val) - 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 StatelessAgentProfile. func (s StatelessAgentProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) objectMap["kind"] = "Stateless" - populateAny(objectMap, "resourcePredictions", s.ResourcePredictions) + populate(objectMap, "resourcePredictions", s.ResourcePredictions) populate(objectMap, "resourcePredictionsProfile", s.ResourcePredictionsProfile) return json.Marshal(objectMap) } @@ -1812,41 +1606,6 @@ func (s *StatelessAgentProfile) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type StatelessAgentProfileUpdate. -func (s StatelessAgentProfileUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["kind"] = "Stateless" - populateAny(objectMap, "resourcePredictions", s.ResourcePredictions) - populate(objectMap, "resourcePredictionsProfile", s.ResourcePredictionsProfile) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type StatelessAgentProfileUpdate. -func (s *StatelessAgentProfileUpdate) 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 "kind": - err = unpopulate(val, "Kind", &s.Kind) - delete(rawMsg, key) - case "resourcePredictions": - err = unpopulate(val, "ResourcePredictions", &s.ResourcePredictions) - delete(rawMsg, key) - case "resourcePredictionsProfile": - s.ResourcePredictionsProfile, err = unmarshalResourcePredictionsProfileUpdateClassification(val) - 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 StorageProfile. func (s StorageProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -2013,16 +1772,6 @@ func populate(m map[string]any, k string, v any) { } } -func populateAny(m map[string]any, k string, v any) { - if v == nil { - return - } else if azcore.IsNullValue(v) { - m[k] = nil - } else { - m[k] = v - } -} - func unpopulate(data json.RawMessage, fn string, v any) error { if data == nil || string(data) == "null" { return nil diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/operations_client.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/operations_client.go index a5d075124522..ed41fb299331 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/operations_client.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/operations_client.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdevopsinfrastructure @@ -39,7 +35,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - List the operations for the provider // -// Generated from API version 2024-04-04-preview +// Generated from API version 2024-10-19 // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -65,14 +61,14 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption } // listCreateRequest creates the List request. -func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { +func (client *OperationsClient) listCreateRequest(ctx context.Context, _ *OperationsClientListOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.DevOpsInfrastructure/operations" req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-04-preview") + reqQP.Set("api-version", "2024-10-19") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/operations_client_example_test.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/operations_client_example_test.go index 6cae58002b52..3808c6d3cfac 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/operations_client_example_test.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/operations_client_example_test.go @@ -1,30 +1,24 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdevopsinfrastructure_test import ( "context" - "log" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/devopsinfrastructure/resource-manager/Microsoft.DevOpsInfrastructure/preview/2024-04-04-preview/examples/ListOperations.json +// Generated from example definition: 2024-10-19/ListOperations.json func ExampleOperationsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armdevopsinfrastructure.NewClientFactory("", cred, nil) + clientFactory, err := armdevopsinfrastructure.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -39,7 +33,9 @@ func ExampleOperationsClient_NewListPager() { _ = v } // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OperationListResult = armdevopsinfrastructure.OperationListResult{ + // page = armdevopsinfrastructure.OperationsClientListResponse{ + // OperationListResult: armdevopsinfrastructure.OperationListResult{ + // }, // } } } diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/options.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/options.go index f44bb303f492..2da748c0acfc 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/options.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/options.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdevopsinfrastructure @@ -21,19 +17,19 @@ type OperationsClientListOptions struct { // PoolsClientBeginCreateOrUpdateOptions contains the optional parameters for the PoolsClient.BeginCreateOrUpdate method. type PoolsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // PoolsClientBeginDeleteOptions contains the optional parameters for the PoolsClient.BeginDelete method. type PoolsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // PoolsClientBeginUpdateOptions contains the optional parameters for the PoolsClient.BeginUpdate method. type PoolsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -64,8 +60,8 @@ type SKUClientListByLocationOptions struct { // placeholder for future optional parameters } -// SubscriptionUsagesClientListByLocationOptions contains the optional parameters for the SubscriptionUsagesClient.NewListByLocationPager +// SubscriptionUsagesClientUsagesOptions contains the optional parameters for the SubscriptionUsagesClient.NewUsagesPager // method. -type SubscriptionUsagesClientListByLocationOptions struct { +type SubscriptionUsagesClientUsagesOptions struct { // placeholder for future optional parameters } diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/polymorphic_helpers.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/polymorphic_helpers.go index edcaa65c747c..d8630b660860 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/polymorphic_helpers.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/polymorphic_helpers.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdevopsinfrastructure @@ -33,29 +29,6 @@ func unmarshalAgentProfileClassification(rawMsg json.RawMessage) (AgentProfileCl return b, nil } -func unmarshalAgentProfileUpdateClassification(rawMsg json.RawMessage) (AgentProfileUpdateClassification, error) { - if rawMsg == nil || string(rawMsg) == "null" { - return nil, nil - } - var m map[string]any - if err := json.Unmarshal(rawMsg, &m); err != nil { - return nil, err - } - var b AgentProfileUpdateClassification - switch m["kind"] { - case "Stateful": - b = &StatefulUpdate{} - case "Stateless": - b = &StatelessAgentProfileUpdate{} - default: - b = &AgentProfileUpdate{} - } - if err := json.Unmarshal(rawMsg, b); err != nil { - return nil, err - } - return b, nil -} - func unmarshalFabricProfileClassification(rawMsg json.RawMessage) (FabricProfileClassification, error) { if rawMsg == nil || string(rawMsg) == "null" { return nil, nil @@ -110,35 +83,12 @@ func unmarshalResourcePredictionsProfileClassification(rawMsg json.RawMessage) ( } var b ResourcePredictionsProfileClassification switch m["kind"] { - case string(ResourcePredictionsProfileTypeAutomatic): - b = &AutomaticResourcePredictionsProfile{} case string(ResourcePredictionsProfileTypeManual): b = &ManualResourcePredictionsProfile{} - default: - b = &ResourcePredictionsProfile{} - } - if err := json.Unmarshal(rawMsg, b); err != nil { - return nil, err - } - return b, nil -} - -func unmarshalResourcePredictionsProfileUpdateClassification(rawMsg json.RawMessage) (ResourcePredictionsProfileUpdateClassification, error) { - if rawMsg == nil || string(rawMsg) == "null" { - return nil, nil - } - var m map[string]any - if err := json.Unmarshal(rawMsg, &m); err != nil { - return nil, err - } - var b ResourcePredictionsProfileUpdateClassification - switch m["kind"] { case string(ResourcePredictionsProfileTypeAutomatic): - b = &AutomaticResourcePredictionsProfileUpdate{} - case string(ResourcePredictionsProfileTypeManual): - b = &ManualResourcePredictionsProfileUpdate{} + b = &AutomaticResourcePredictionsProfile{} default: - b = &ResourcePredictionsProfileUpdate{} + b = &ResourcePredictionsProfile{} } if err := json.Unmarshal(rawMsg, b); err != nil { return nil, err diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/pools_client.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/pools_client.go index 6d6b234c092a..94873e863f47 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/pools_client.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/pools_client.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdevopsinfrastructure @@ -46,7 +42,7 @@ func NewPoolsClient(subscriptionID string, credential azcore.TokenCredential, op // BeginCreateOrUpdate - Create a Pool // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-04-04-preview +// Generated from API version 2024-10-19 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - poolName - Name of the pool. It needs to be globally unique. // - resource - Resource create parameters. @@ -73,7 +69,7 @@ func (client *PoolsClient) BeginCreateOrUpdate(ctx context.Context, resourceGrou // CreateOrUpdate - Create a Pool // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-04-04-preview +// Generated from API version 2024-10-19 func (client *PoolsClient) createOrUpdate(ctx context.Context, resourceGroupName string, poolName string, resource Pool, options *PoolsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "PoolsClient.BeginCreateOrUpdate" @@ -96,7 +92,7 @@ func (client *PoolsClient) createOrUpdate(ctx context.Context, resourceGroupName } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *PoolsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, poolName string, resource Pool, options *PoolsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *PoolsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, poolName string, resource Pool, _ *PoolsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOpsInfrastructure/pools/{poolName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -115,9 +111,10 @@ func (client *PoolsClient) createOrUpdateCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-04-preview") + reqQP.Set("api-version", "2024-10-19") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, resource); err != nil { return nil, err } @@ -127,7 +124,7 @@ func (client *PoolsClient) createOrUpdateCreateRequest(ctx context.Context, reso // BeginDelete - Delete a Pool // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-04-04-preview +// Generated from API version 2024-10-19 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - poolName - Name of the pool. It needs to be globally unique. // - options - PoolsClientBeginDeleteOptions contains the optional parameters for the PoolsClient.BeginDelete method. @@ -138,8 +135,7 @@ func (client *PoolsClient) BeginDelete(ctx context.Context, resourceGroupName st return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PoolsClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -152,7 +148,7 @@ func (client *PoolsClient) BeginDelete(ctx context.Context, resourceGroupName st // Delete - Delete a Pool // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-04-04-preview +// Generated from API version 2024-10-19 func (client *PoolsClient) deleteOperation(ctx context.Context, resourceGroupName string, poolName string, options *PoolsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "PoolsClient.BeginDelete" @@ -175,7 +171,7 @@ func (client *PoolsClient) deleteOperation(ctx context.Context, resourceGroupNam } // deleteCreateRequest creates the Delete request. -func (client *PoolsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, poolName string, options *PoolsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *PoolsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, poolName string, _ *PoolsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOpsInfrastructure/pools/{poolName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -194,7 +190,7 @@ func (client *PoolsClient) deleteCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-04-preview") + reqQP.Set("api-version", "2024-10-19") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -203,7 +199,7 @@ func (client *PoolsClient) deleteCreateRequest(ctx context.Context, resourceGrou // Get - Get a Pool // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-04-04-preview +// Generated from API version 2024-10-19 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - poolName - Name of the pool. It needs to be globally unique. // - options - PoolsClientGetOptions contains the optional parameters for the PoolsClient.Get method. @@ -230,7 +226,7 @@ func (client *PoolsClient) Get(ctx context.Context, resourceGroupName string, po } // getCreateRequest creates the Get request. -func (client *PoolsClient) getCreateRequest(ctx context.Context, resourceGroupName string, poolName string, options *PoolsClientGetOptions) (*policy.Request, error) { +func (client *PoolsClient) getCreateRequest(ctx context.Context, resourceGroupName string, poolName string, _ *PoolsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOpsInfrastructure/pools/{poolName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -249,7 +245,7 @@ func (client *PoolsClient) getCreateRequest(ctx context.Context, resourceGroupNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-04-preview") + reqQP.Set("api-version", "2024-10-19") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -266,7 +262,7 @@ func (client *PoolsClient) getHandleResponse(resp *http.Response) (PoolsClientGe // NewListByResourceGroupPager - List Pool resources by resource group // -// Generated from API version 2024-04-04-preview +// Generated from API version 2024-10-19 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - PoolsClientListByResourceGroupOptions contains the optional parameters for the PoolsClient.NewListByResourceGroupPager // method. @@ -294,7 +290,7 @@ func (client *PoolsClient) NewListByResourceGroupPager(resourceGroupName string, } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *PoolsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *PoolsClientListByResourceGroupOptions) (*policy.Request, error) { +func (client *PoolsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *PoolsClientListByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOpsInfrastructure/pools" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -309,7 +305,7 @@ func (client *PoolsClient) listByResourceGroupCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-04-preview") + reqQP.Set("api-version", "2024-10-19") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -326,7 +322,7 @@ func (client *PoolsClient) listByResourceGroupHandleResponse(resp *http.Response // NewListBySubscriptionPager - List Pool resources by subscription ID // -// Generated from API version 2024-04-04-preview +// Generated from API version 2024-10-19 // - options - PoolsClientListBySubscriptionOptions contains the optional parameters for the PoolsClient.NewListBySubscriptionPager // method. func (client *PoolsClient) NewListBySubscriptionPager(options *PoolsClientListBySubscriptionOptions) *runtime.Pager[PoolsClientListBySubscriptionResponse] { @@ -353,7 +349,7 @@ func (client *PoolsClient) NewListBySubscriptionPager(options *PoolsClientListBy } // listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *PoolsClient) listBySubscriptionCreateRequest(ctx context.Context, options *PoolsClientListBySubscriptionOptions) (*policy.Request, error) { +func (client *PoolsClient) listBySubscriptionCreateRequest(ctx context.Context, _ *PoolsClientListBySubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DevOpsInfrastructure/pools" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -364,7 +360,7 @@ func (client *PoolsClient) listBySubscriptionCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-04-preview") + reqQP.Set("api-version", "2024-10-19") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -382,7 +378,7 @@ func (client *PoolsClient) listBySubscriptionHandleResponse(resp *http.Response) // BeginUpdate - Update a Pool // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-04-04-preview +// Generated from API version 2024-10-19 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - poolName - Name of the pool. It needs to be globally unique. // - properties - The resource properties to be updated. @@ -394,8 +390,7 @@ func (client *PoolsClient) BeginUpdate(ctx context.Context, resourceGroupName st return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PoolsClientUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -408,7 +403,7 @@ func (client *PoolsClient) BeginUpdate(ctx context.Context, resourceGroupName st // Update - Update a Pool // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-04-04-preview +// Generated from API version 2024-10-19 func (client *PoolsClient) update(ctx context.Context, resourceGroupName string, poolName string, properties PoolUpdate, options *PoolsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "PoolsClient.BeginUpdate" @@ -431,7 +426,7 @@ func (client *PoolsClient) update(ctx context.Context, resourceGroupName string, } // updateCreateRequest creates the Update request. -func (client *PoolsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, poolName string, properties PoolUpdate, options *PoolsClientBeginUpdateOptions) (*policy.Request, error) { +func (client *PoolsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, poolName string, properties PoolUpdate, _ *PoolsClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOpsInfrastructure/pools/{poolName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -450,9 +445,10 @@ func (client *PoolsClient) updateCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-04-preview") + reqQP.Set("api-version", "2024-10-19") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, properties); err != nil { return nil, err } diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/pools_client_example_test.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/pools_client_example_test.go index 3f84839167f5..7212fff354d0 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/pools_client_example_test.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/pools_client_example_test.go @@ -1,95 +1,132 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdevopsinfrastructure_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/devopsinfrastructure/armdevopsinfrastructure" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/devopsinfrastructure/resource-manager/Microsoft.DevOpsInfrastructure/preview/2024-04-04-preview/examples/ListPoolsBySubscription.json -func ExamplePoolsClient_NewListBySubscriptionPager() { +// Generated from example definition: 2024-10-19/CreateOrUpdatePool.json +func ExamplePoolsClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armdevopsinfrastructure.NewClientFactory("", cred, nil) + clientFactory, err := armdevopsinfrastructure.NewClientFactory("a2e95d27-c161-4b61-bda4-11512c14c2c2", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewPoolsClient().NewListBySubscriptionPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PoolListResult = armdevopsinfrastructure.PoolListResult{ - // Value: []*armdevopsinfrastructure.Pool{ - // { - // ID: to.Ptr("/subscriptions/a2e95d27-c161-4b61-bda4-11512c14c2c2/resourceGroups/aoiresourceGroupName/providers/Microsoft.DevOpsInfrastructure/Pools/pool"), - // Location: to.Ptr("eastus"), - // }}, - // } + poller, err := clientFactory.NewPoolsClient().BeginCreateOrUpdate(ctx, "rg", "pool", armdevopsinfrastructure.Pool{ + Location: to.Ptr("eastus"), + Properties: &armdevopsinfrastructure.PoolProperties{ + ProvisioningState: to.Ptr(armdevopsinfrastructure.ProvisioningStateSucceeded), + MaximumConcurrency: to.Ptr[int32](10), + DevCenterProjectResourceID: to.Ptr("/subscriptions/222e81d0-cf38-4dab-baa5-289bf16baaa4/resourceGroups/rg-1es-devcenter/providers/Microsoft.DevCenter/projects/1ES"), + OrganizationProfile: &armdevopsinfrastructure.AzureDevOpsOrganizationProfile{ + Kind: to.Ptr("AzureDevOps"), + Organizations: []*armdevopsinfrastructure.Organization{ + { + URL: to.Ptr("https://mseng.visualstudio.com"), + }, + }, + }, + AgentProfile: &armdevopsinfrastructure.StatelessAgentProfile{ + Kind: to.Ptr("Stateless"), + }, + FabricProfile: &armdevopsinfrastructure.VmssFabricProfile{ + Kind: to.Ptr("Vmss"), + SKU: &armdevopsinfrastructure.DevOpsAzureSKU{ + Name: to.Ptr("Standard_D4ads_v5"), + }, + Images: []*armdevopsinfrastructure.PoolImage{ + { + ResourceID: to.Ptr("/MicrosoftWindowsServer/WindowsServer/2019-Datacenter/latest"), + }, + }, + }, + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res = armdevopsinfrastructure.PoolsClientCreateOrUpdateResponse{ + // Pool: &armdevopsinfrastructure.Pool{ + // Properties: &armdevopsinfrastructure.PoolProperties{ + // ProvisioningState: to.Ptr(armdevopsinfrastructure.ProvisioningStateSucceeded), + // MaximumConcurrency: to.Ptr[int32](10), + // DevCenterProjectResourceID: to.Ptr("/subscriptions/222e81d0-cf38-4dab-baa5-289bf16baaa4/resourceGroups/rg-1es-devcenter/providers/Microsoft.DevCenter/projects/1ES"), + // OrganizationProfile: &armdevopsinfrastructure.AzureDevOpsOrganizationProfile{ + // Kind: to.Ptr("AzureDevOps"), + // Organizations: []*armdevopsinfrastructure.Organization{ + // { + // URL: to.Ptr("https://mseng.visualstudio.com"), + // }, + // }, + // }, + // AgentProfile: &armdevopsinfrastructure.StatelessAgentProfile{ + // Kind: to.Ptr("Stateless"), + // }, + // FabricProfile: &armdevopsinfrastructure.VmssFabricProfile{ + // Kind: to.Ptr("Vmss"), + // SKU: &armdevopsinfrastructure.DevOpsAzureSKU{ + // Name: to.Ptr("Standard_D4ads_v5"), + // }, + // Images: []*armdevopsinfrastructure.PoolImage{ + // { + // ResourceID: to.Ptr("/MicrosoftWindowsServer/WindowsServer/2019-Datacenter/latest"), + // }, + // }, + // }, + // }, + // ID: to.Ptr("/subscriptions/a2e95d27-c161-4b61-bda4-11512c14c2c2/resourceGroups/rg/providers/Microsoft.DevOpsInfrastructure/Pools/pool"), + // Location: to.Ptr("eastus"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/devopsinfrastructure/resource-manager/Microsoft.DevOpsInfrastructure/preview/2024-04-04-preview/examples/ListPoolsBySubscriptionAndResourceGroup.json -func ExamplePoolsClient_NewListByResourceGroupPager() { +// Generated from example definition: 2024-10-19/DeletePool.json +func ExamplePoolsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armdevopsinfrastructure.NewClientFactory("", cred, nil) + clientFactory, err := armdevopsinfrastructure.NewClientFactory("a2e95d27-c161-4b61-bda4-11512c14c2c2", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewPoolsClient().NewListByResourceGroupPager("rg", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PoolListResult = armdevopsinfrastructure.PoolListResult{ - // Value: []*armdevopsinfrastructure.Pool{ - // { - // ID: to.Ptr("/subscriptions/a2e95d27-c161-4b61-bda4-11512c14c2c2/resourceGroups/rg/providers/Microsoft.DevOpsInfrastructure/Pools/pool"), - // Location: to.Ptr("eastus"), - // }}, - // } + poller, err := clientFactory.NewPoolsClient().BeginDelete(ctx, "rg", "pool", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/devopsinfrastructure/resource-manager/Microsoft.DevOpsInfrastructure/preview/2024-04-04-preview/examples/GetPool.json +// Generated from example definition: 2024-10-19/GetPool.json func ExamplePoolsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armdevopsinfrastructure.NewClientFactory("", cred, nil) + clientFactory, err := armdevopsinfrastructure.NewClientFactory("a2e95d27-c161-4b61-bda4-11512c14c2c2", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -100,161 +137,136 @@ func ExamplePoolsClient_Get() { // You could use response here. We use blank identifier for just demo purposes. _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Pool = armdevopsinfrastructure.Pool{ - // ID: to.Ptr("/subscriptions/a2e95d27-c161-4b61-bda4-11512c14c2c2/resourceGroups/rg/providers/Microsoft.DevOpsInfrastructure/Pools/pool"), - // Location: to.Ptr("eastus"), - // Properties: &armdevopsinfrastructure.PoolProperties{ - // AgentProfile: &armdevopsinfrastructure.StatelessAgentProfile{ - // Kind: to.Ptr("Stateless"), - // }, - // DevCenterProjectResourceID: to.Ptr("/subscriptions/222e81d0-cf38-4dab-baa5-289bf16baaa4/resourceGroups/rg-1es-devcenter/providers/Microsoft.DevCenter/projects/1ES"), - // FabricProfile: &armdevopsinfrastructure.VmssFabricProfile{ - // Kind: to.Ptr("Vmss"), - // Images: []*armdevopsinfrastructure.PoolImage{ - // { - // ResourceID: to.Ptr("/MicrosoftWindowsServer/WindowsServer/2019-Datacenter/latest"), - // }}, - // SKU: &armdevopsinfrastructure.DevOpsAzureSKU{ - // Name: to.Ptr("Standard_D4ads_v5"), + // res = armdevopsinfrastructure.PoolsClientGetResponse{ + // Pool: &armdevopsinfrastructure.Pool{ + // Properties: &armdevopsinfrastructure.PoolProperties{ + // ProvisioningState: to.Ptr(armdevopsinfrastructure.ProvisioningStateSucceeded), + // MaximumConcurrency: to.Ptr[int32](10), + // DevCenterProjectResourceID: to.Ptr("/subscriptions/222e81d0-cf38-4dab-baa5-289bf16baaa4/resourceGroups/rg-1es-devcenter/providers/Microsoft.DevCenter/projects/1ES"), + // OrganizationProfile: &armdevopsinfrastructure.AzureDevOpsOrganizationProfile{ + // Kind: to.Ptr("AzureDevOps"), + // Organizations: []*armdevopsinfrastructure.Organization{ + // { + // URL: to.Ptr("https://mseng.visualstudio.com"), + // }, + // }, + // }, + // AgentProfile: &armdevopsinfrastructure.StatelessAgentProfile{ + // Kind: to.Ptr("Stateless"), + // }, + // FabricProfile: &armdevopsinfrastructure.VmssFabricProfile{ + // Kind: to.Ptr("Vmss"), + // SKU: &armdevopsinfrastructure.DevOpsAzureSKU{ + // Name: to.Ptr("Standard_D4ads_v5"), + // }, + // Images: []*armdevopsinfrastructure.PoolImage{ + // { + // ResourceID: to.Ptr("/MicrosoftWindowsServer/WindowsServer/2019-Datacenter/latest"), + // }, + // }, // }, // }, - // MaximumConcurrency: to.Ptr[int32](10), - // OrganizationProfile: &armdevopsinfrastructure.AzureDevOpsOrganizationProfile{ - // Kind: to.Ptr("AzureDevOps"), - // Organizations: []*armdevopsinfrastructure.Organization{ - // { - // URL: to.Ptr("https://mseng.visualstudio.com"), - // }}, - // }, - // ProvisioningState: to.Ptr(armdevopsinfrastructure.ProvisioningStateSucceeded), + // ID: to.Ptr("/subscriptions/a2e95d27-c161-4b61-bda4-11512c14c2c2/resourceGroups/rg/providers/Microsoft.DevOpsInfrastructure/Pools/pool"), + // Location: to.Ptr("eastus"), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/devopsinfrastructure/resource-manager/Microsoft.DevOpsInfrastructure/preview/2024-04-04-preview/examples/CreateOrUpdatePool.json -func ExamplePoolsClient_BeginCreateOrUpdate() { +// Generated from example definition: 2024-10-19/ListPoolsBySubscriptionAndResourceGroup.json +func ExamplePoolsClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armdevopsinfrastructure.NewClientFactory("", cred, nil) + clientFactory, err := armdevopsinfrastructure.NewClientFactory("a2e95d27-c161-4b61-bda4-11512c14c2c2", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewPoolsClient().BeginCreateOrUpdate(ctx, "rg", "pool", armdevopsinfrastructure.Pool{ - Location: to.Ptr("eastus"), - Properties: &armdevopsinfrastructure.PoolProperties{ - AgentProfile: &armdevopsinfrastructure.StatelessAgentProfile{ - Kind: to.Ptr("Stateless"), - }, - DevCenterProjectResourceID: to.Ptr("/subscriptions/222e81d0-cf38-4dab-baa5-289bf16baaa4/resourceGroups/rg-1es-devcenter/providers/Microsoft.DevCenter/projects/1ES"), - FabricProfile: &armdevopsinfrastructure.VmssFabricProfile{ - Kind: to.Ptr("Vmss"), - Images: []*armdevopsinfrastructure.PoolImage{ - { - ResourceID: to.Ptr("/MicrosoftWindowsServer/WindowsServer/2019-Datacenter/latest"), - }}, - SKU: &armdevopsinfrastructure.DevOpsAzureSKU{ - Name: to.Ptr("Standard_D4ads_v5"), - }, - }, - MaximumConcurrency: to.Ptr[int32](10), - OrganizationProfile: &armdevopsinfrastructure.AzureDevOpsOrganizationProfile{ - Kind: to.Ptr("AzureDevOps"), - Organizations: []*armdevopsinfrastructure.Organization{ - { - URL: to.Ptr("https://mseng.visualstudio.com"), - }}, - }, - ProvisioningState: to.Ptr(armdevopsinfrastructure.ProvisioningStateSucceeded), - }, - }, 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) + pager := clientFactory.NewPoolsClient().NewListByResourceGroupPager("rg", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page = armdevopsinfrastructure.PoolsClientListByResourceGroupResponse{ + // PoolListResult: armdevopsinfrastructure.PoolListResult{ + // Value: []*armdevopsinfrastructure.Pool{ + // { + // ID: to.Ptr("/subscriptions/a2e95d27-c161-4b61-bda4-11512c14c2c2/resourceGroups/rg/providers/Microsoft.DevOpsInfrastructure/Pools/pool"), + // Location: to.Ptr("eastus"), + // }, + // }, + // }, + // } } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Pool = armdevopsinfrastructure.Pool{ - // ID: to.Ptr("/subscriptions/a2e95d27-c161-4b61-bda4-11512c14c2c2/resourceGroups/rg/providers/Microsoft.DevOpsInfrastructure/Pools/pool"), - // Location: to.Ptr("eastus"), - // Properties: &armdevopsinfrastructure.PoolProperties{ - // AgentProfile: &armdevopsinfrastructure.StatelessAgentProfile{ - // Kind: to.Ptr("Stateless"), - // }, - // DevCenterProjectResourceID: to.Ptr("/subscriptions/222e81d0-cf38-4dab-baa5-289bf16baaa4/resourceGroups/rg-1es-devcenter/providers/Microsoft.DevCenter/projects/1ES"), - // FabricProfile: &armdevopsinfrastructure.VmssFabricProfile{ - // Kind: to.Ptr("Vmss"), - // Images: []*armdevopsinfrastructure.PoolImage{ - // { - // ResourceID: to.Ptr("/MicrosoftWindowsServer/WindowsServer/2019-Datacenter/latest"), - // }}, - // SKU: &armdevopsinfrastructure.DevOpsAzureSKU{ - // Name: to.Ptr("Standard_D4ads_v5"), - // }, - // }, - // MaximumConcurrency: to.Ptr[int32](10), - // OrganizationProfile: &armdevopsinfrastructure.AzureDevOpsOrganizationProfile{ - // Kind: to.Ptr("AzureDevOps"), - // Organizations: []*armdevopsinfrastructure.Organization{ - // { - // URL: to.Ptr("https://mseng.visualstudio.com"), - // }}, - // }, - // ProvisioningState: to.Ptr(armdevopsinfrastructure.ProvisioningStateSucceeded), - // }, - // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/devopsinfrastructure/resource-manager/Microsoft.DevOpsInfrastructure/preview/2024-04-04-preview/examples/UpdatePool.json -func ExamplePoolsClient_BeginUpdate() { +// Generated from example definition: 2024-10-19/ListPoolsBySubscription.json +func ExamplePoolsClient_NewListBySubscriptionPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armdevopsinfrastructure.NewClientFactory("", cred, nil) + clientFactory, err := armdevopsinfrastructure.NewClientFactory("a2e95d27-c161-4b61-bda4-11512c14c2c2", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewPoolsClient().BeginUpdate(ctx, "rg", "pool", armdevopsinfrastructure.PoolUpdate{}, 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) + pager := clientFactory.NewPoolsClient().NewListBySubscriptionPager(nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page = armdevopsinfrastructure.PoolsClientListBySubscriptionResponse{ + // PoolListResult: armdevopsinfrastructure.PoolListResult{ + // Value: []*armdevopsinfrastructure.Pool{ + // { + // ID: to.Ptr("/subscriptions/a2e95d27-c161-4b61-bda4-11512c14c2c2/resourceGroups/aoiresourceGroupName/providers/Microsoft.DevOpsInfrastructure/Pools/pool"), + // Location: to.Ptr("eastus"), + // }, + // }, + // }, + // } } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Pool = armdevopsinfrastructure.Pool{ - // Location: to.Ptr("eastus"), - // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/devopsinfrastructure/resource-manager/Microsoft.DevOpsInfrastructure/preview/2024-04-04-preview/examples/DeletePool.json -func ExamplePoolsClient_BeginDelete() { +// Generated from example definition: 2024-10-19/UpdatePool.json +func ExamplePoolsClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armdevopsinfrastructure.NewClientFactory("", cred, nil) + clientFactory, err := armdevopsinfrastructure.NewClientFactory("a2e95d27-c161-4b61-bda4-11512c14c2c2", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewPoolsClient().BeginDelete(ctx, "rg", "pool", nil) + poller, err := clientFactory.NewPoolsClient().BeginUpdate(ctx, "rg", "pool", armdevopsinfrastructure.PoolUpdate{}, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - _, err = poller.PollUntilDone(ctx, nil) + res, err := poller.PollUntilDone(ctx, nil) if err != nil { log.Fatalf("failed to pull the result: %v", err) } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res = armdevopsinfrastructure.PoolsClientUpdateResponse{ + // Pool: &armdevopsinfrastructure.Pool{ + // Location: to.Ptr("eastus"), + // }, + // } } diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/resourcedetails_client.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/resourcedetails_client.go index 4d6fa8f44d16..a6f45ca24b4d 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/resourcedetails_client.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/resourcedetails_client.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdevopsinfrastructure @@ -45,7 +41,7 @@ func NewResourceDetailsClient(subscriptionID string, credential azcore.TokenCred // NewListByPoolPager - List ResourceDetailsObject resources by Pool // -// Generated from API version 2024-04-04-preview +// Generated from API version 2024-10-19 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - poolName - Name of the pool. It needs to be globally unique. // - options - ResourceDetailsClientListByPoolOptions contains the optional parameters for the ResourceDetailsClient.NewListByPoolPager @@ -74,7 +70,7 @@ func (client *ResourceDetailsClient) NewListByPoolPager(resourceGroupName string } // listByPoolCreateRequest creates the ListByPool request. -func (client *ResourceDetailsClient) listByPoolCreateRequest(ctx context.Context, resourceGroupName string, poolName string, options *ResourceDetailsClientListByPoolOptions) (*policy.Request, error) { +func (client *ResourceDetailsClient) listByPoolCreateRequest(ctx context.Context, resourceGroupName string, poolName string, _ *ResourceDetailsClientListByPoolOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOpsInfrastructure/pools/{poolName}/resources" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -93,7 +89,7 @@ func (client *ResourceDetailsClient) listByPoolCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-04-preview") + reqQP.Set("api-version", "2024-10-19") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/resourcedetails_client_example_test.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/resourcedetails_client_example_test.go index 2c320ed1d805..958a8be7c85a 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/resourcedetails_client_example_test.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/resourcedetails_client_example_test.go @@ -1,30 +1,24 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdevopsinfrastructure_test import ( "context" - "log" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/devopsinfrastructure/resource-manager/Microsoft.DevOpsInfrastructure/preview/2024-04-04-preview/examples/ResourceDetails_ListByPool.json +// Generated from example definition: 2024-10-19/ResourceDetails_ListByPool.json func ExampleResourceDetailsClient_NewListByPoolPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armdevopsinfrastructure.NewClientFactory("", cred, nil) + clientFactory, err := armdevopsinfrastructure.NewClientFactory("a2e95d27-c161-4b61-bda4-11512c14c2c2", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -39,26 +33,29 @@ func ExampleResourceDetailsClient_NewListByPoolPager() { _ = v } // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ResourceDetailsObjectListResult = armdevopsinfrastructure.ResourceDetailsObjectListResult{ - // Value: []*armdevopsinfrastructure.ResourceDetailsObject{ - // { - // Name: to.Ptr("dd8cc705c000000"), - // ID: to.Ptr("/subscriptions/a2e95d27-c161-4b61-bda4-11512c14c2c2/resourceGroups/my-resource-group/providers/Microsoft.DevOpsInfrastructure/pools/my-devops-pool/resources/my-dev-ops-pool:04dcde21-626e-5a7e-8659-ce12f9284b29:dd8cc705c_0"), - // Properties: &armdevopsinfrastructure.ResourceDetailsObjectProperties{ - // Image: to.Ptr("my-image"), - // ImageVersion: to.Ptr("4.0.0"), - // Status: to.Ptr(armdevopsinfrastructure.ResourceStatusReady), + // page = armdevopsinfrastructure.ResourceDetailsClientListByPoolResponse{ + // ResourceDetailsObjectListResult: armdevopsinfrastructure.ResourceDetailsObjectListResult{ + // Value: []*armdevopsinfrastructure.ResourceDetailsObject{ + // { + // ID: to.Ptr("/subscriptions/a2e95d27-c161-4b61-bda4-11512c14c2c2/resourceGroups/my-resource-group/providers/Microsoft.DevOpsInfrastructure/pools/my-devops-pool/resources/my-dev-ops-pool:04dcde21-626e-5a7e-8659-ce12f9284b29:dd8cc705c_0"), + // Name: to.Ptr("dd8cc705c000000"), + // Properties: &armdevopsinfrastructure.ResourceDetailsObjectProperties{ + // Image: to.Ptr("my-image"), + // ImageVersion: to.Ptr("4.0.0"), + // Status: to.Ptr(armdevopsinfrastructure.ResourceStatusReady), + // }, // }, - // }, - // { - // Name: to.Ptr("dd8cc705c000001"), - // ID: to.Ptr("/subscriptions/a2e95d27-c161-4b61-bda4-11512c14c2c2/resourceGroups/my-resource-group/providers/Microsoft.DevOpsInfrastructure/pools/my-devops-pool/resources/my-dev-ops-pool:04dcde21-626e-5a7e-8659-ce12f9284b29:dd8cc705c_1"), - // Properties: &armdevopsinfrastructure.ResourceDetailsObjectProperties{ - // Image: to.Ptr("my-image"), - // ImageVersion: to.Ptr("4.0.0"), - // Status: to.Ptr(armdevopsinfrastructure.ResourceStatusAllocated), + // { + // ID: to.Ptr("/subscriptions/a2e95d27-c161-4b61-bda4-11512c14c2c2/resourceGroups/my-resource-group/providers/Microsoft.DevOpsInfrastructure/pools/my-devops-pool/resources/my-dev-ops-pool:04dcde21-626e-5a7e-8659-ce12f9284b29:dd8cc705c_1"), + // Name: to.Ptr("dd8cc705c000001"), + // Properties: &armdevopsinfrastructure.ResourceDetailsObjectProperties{ + // Image: to.Ptr("my-image"), + // ImageVersion: to.Ptr("4.0.0"), + // Status: to.Ptr(armdevopsinfrastructure.ResourceStatusAllocated), + // }, // }, - // }}, + // }, + // }, // } } } diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/responses.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/responses.go index a536b94a7c60..ca74a46c3c40 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/responses.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/responses.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdevopsinfrastructure @@ -67,8 +63,8 @@ type SKUClientListByLocationResponse struct { ResourceSKUListResult } -// SubscriptionUsagesClientListByLocationResponse contains the response from method SubscriptionUsagesClient.NewListByLocationPager. -type SubscriptionUsagesClientListByLocationResponse struct { - // The response of a Quota list operation. - QuotaListResult +// SubscriptionUsagesClientUsagesResponse contains the response from method SubscriptionUsagesClient.NewUsagesPager. +type SubscriptionUsagesClientUsagesResponse struct { + // Paged collection of Quota items + PagedQuota } diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/sku_client.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/sku_client.go index 1f0bb1a197c0..1b3a6762c841 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/sku_client.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/sku_client.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdevopsinfrastructure @@ -45,7 +41,7 @@ func NewSKUClient(subscriptionID string, credential azcore.TokenCredential, opti // NewListByLocationPager - List ResourceSku resources by subscription ID // -// Generated from API version 2024-04-04-preview +// Generated from API version 2024-10-19 // - locationName - Name of the location. // - options - SKUClientListByLocationOptions contains the optional parameters for the SKUClient.NewListByLocationPager method. func (client *SKUClient) NewListByLocationPager(locationName string, options *SKUClientListByLocationOptions) *runtime.Pager[SKUClientListByLocationResponse] { @@ -72,7 +68,7 @@ func (client *SKUClient) NewListByLocationPager(locationName string, options *SK } // listByLocationCreateRequest creates the ListByLocation request. -func (client *SKUClient) listByLocationCreateRequest(ctx context.Context, locationName string, options *SKUClientListByLocationOptions) (*policy.Request, error) { +func (client *SKUClient) listByLocationCreateRequest(ctx context.Context, locationName string, _ *SKUClientListByLocationOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DevOpsInfrastructure/locations/{locationName}/skus" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -87,7 +83,7 @@ func (client *SKUClient) listByLocationCreateRequest(ctx context.Context, locati return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-04-preview") + reqQP.Set("api-version", "2024-10-19") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/sku_client_example_test.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/sku_client_example_test.go index 3ccfd416f8b2..13f94b53335b 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/sku_client_example_test.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/sku_client_example_test.go @@ -1,30 +1,24 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdevopsinfrastructure_test import ( "context" - "log" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/devopsinfrastructure/resource-manager/Microsoft.DevOpsInfrastructure/preview/2024-04-04-preview/examples/Sku_ListByLocation.json +// Generated from example definition: 2024-10-19/Sku_ListByLocation.json func ExampleSKUClient_NewListByLocationPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armdevopsinfrastructure.NewClientFactory("", cred, nil) + clientFactory, err := armdevopsinfrastructure.NewClientFactory("a2e95d27-c161-4b61-bda4-11512c14c2c2", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -39,259 +33,275 @@ func ExampleSKUClient_NewListByLocationPager() { _ = v } // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ResourceSKUListResult = armdevopsinfrastructure.ResourceSKUListResult{ - // Value: []*armdevopsinfrastructure.ResourceSKU{ - // { - // Name: to.Ptr("Basic_A0"), - // ID: to.Ptr("/subscriptions/a2e95d27-c161-4b61-bda4-11512c14c2c2/providers/Microsoft.DevOpsInfrastructure/locations/eastus/skus/Basic_A0"), - // Properties: &armdevopsinfrastructure.ResourceSKUProperties{ - // Capabilities: []*armdevopsinfrastructure.ResourceSKUCapabilities{ - // { - // Name: to.Ptr("MaxResourceVolumeMB"), - // Value: to.Ptr("20480"), - // }, - // { - // Name: to.Ptr("OSVhdSizeMB"), - // Value: to.Ptr("1047552"), - // }, - // { - // Name: to.Ptr("vCPUs"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("MemoryPreservingMaintenanceSupported"), - // Value: to.Ptr("True"), - // }, - // { - // Name: to.Ptr("HyperVGenerations"), - // Value: to.Ptr("V1"), - // }, - // { - // Name: to.Ptr("MemoryGB"), - // Value: to.Ptr("0.75"), - // }, - // { - // Name: to.Ptr("MaxDataDiskCount"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("CpuArchitectureType"), - // Value: to.Ptr("x64"), - // }, - // { - // Name: to.Ptr("LowPriorityCapable"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("PremiumIO"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("VMDeploymentTypes"), - // Value: to.Ptr("IaaS"), - // }, - // { - // Name: to.Ptr("vCPUsAvailable"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("ACUs"), - // Value: to.Ptr("50"), - // }, - // { - // Name: to.Ptr("vCPUsPerCore"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("EphemeralOSDiskSupported"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("EncryptionAtHostSupported"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("CapacityReservationSupported"), - // Value: to.Ptr("False"), + // page = armdevopsinfrastructure.SKUClientListByLocationResponse{ + // ResourceSKUListResult: armdevopsinfrastructure.ResourceSKUListResult{ + // Value: []*armdevopsinfrastructure.ResourceSKU{ + // { + // Properties: &armdevopsinfrastructure.ResourceSKUProperties{ + // ResourceType: to.Ptr("virtualMachines"), + // Tier: to.Ptr("Basic"), + // Size: to.Ptr("A0"), + // Family: to.Ptr("basicAFamily"), + // Locations: []*string{ + // to.Ptr("eastus"), // }, - // { - // Name: to.Ptr("AcceleratedNetworkingEnabled"), - // Value: to.Ptr("False"), + // LocationInfo: []*armdevopsinfrastructure.ResourceSKULocationInfo{ + // { + // Location: to.Ptr("eastus"), + // Zones: []*string{ + // }, + // ZoneDetails: []*armdevopsinfrastructure.ResourceSKUZoneDetails{ + // }, + // }, // }, - // { - // Name: to.Ptr("RdmaEnabled"), - // Value: to.Ptr("False"), + // Capabilities: []*armdevopsinfrastructure.ResourceSKUCapabilities{ + // { + // Name: to.Ptr("MaxResourceVolumeMB"), + // Value: to.Ptr("20480"), + // }, + // { + // Name: to.Ptr("OSVhdSizeMB"), + // Value: to.Ptr("1047552"), + // }, + // { + // Name: to.Ptr("vCPUs"), + // Value: to.Ptr("1"), + // }, + // { + // Name: to.Ptr("MemoryPreservingMaintenanceSupported"), + // Value: to.Ptr("True"), + // }, + // { + // Name: to.Ptr("HyperVGenerations"), + // Value: to.Ptr("V1"), + // }, + // { + // Name: to.Ptr("MemoryGB"), + // Value: to.Ptr("0.75"), + // }, + // { + // Name: to.Ptr("MaxDataDiskCount"), + // Value: to.Ptr("1"), + // }, + // { + // Name: to.Ptr("CpuArchitectureType"), + // Value: to.Ptr("x64"), + // }, + // { + // Name: to.Ptr("LowPriorityCapable"), + // Value: to.Ptr("False"), + // }, + // { + // Name: to.Ptr("PremiumIO"), + // Value: to.Ptr("False"), + // }, + // { + // Name: to.Ptr("VMDeploymentTypes"), + // Value: to.Ptr("IaaS"), + // }, + // { + // Name: to.Ptr("vCPUsAvailable"), + // Value: to.Ptr("1"), + // }, + // { + // Name: to.Ptr("ACUs"), + // Value: to.Ptr("50"), + // }, + // { + // Name: to.Ptr("vCPUsPerCore"), + // Value: to.Ptr("1"), + // }, + // { + // Name: to.Ptr("EphemeralOSDiskSupported"), + // Value: to.Ptr("False"), + // }, + // { + // Name: to.Ptr("EncryptionAtHostSupported"), + // Value: to.Ptr("False"), + // }, + // { + // Name: to.Ptr("CapacityReservationSupported"), + // Value: to.Ptr("False"), + // }, + // { + // Name: to.Ptr("AcceleratedNetworkingEnabled"), + // Value: to.Ptr("False"), + // }, + // { + // Name: to.Ptr("RdmaEnabled"), + // Value: to.Ptr("False"), + // }, + // { + // Name: to.Ptr("MaxNetworkInterfaces"), + // Value: to.Ptr("2"), + // }, // }, - // { - // Name: to.Ptr("MaxNetworkInterfaces"), - // Value: to.Ptr("2"), - // }}, - // Family: to.Ptr("basicAFamily"), - // LocationInfo: []*armdevopsinfrastructure.ResourceSKULocationInfo{ - // { - // Location: to.Ptr("eastus"), - // ZoneDetails: []*armdevopsinfrastructure.ResourceSKUZoneDetails{ - // }, - // Zones: []*string{ - // }, - // }}, - // Locations: []*string{ - // to.Ptr("eastus")}, - // ResourceType: to.Ptr("virtualMachines"), // Restrictions: []*armdevopsinfrastructure.ResourceSKURestrictions{ // { // Type: to.Ptr(armdevopsinfrastructure.ResourceSKURestrictionsTypeLocation), - // ReasonCode: to.Ptr(armdevopsinfrastructure.ResourceSKURestrictionsReasonCodeNotAvailableForSubscription), + // Values: []*string{ + // to.Ptr("eastus"), + // }, // RestrictionInfo: &armdevopsinfrastructure.ResourceSKURestrictionInfo{ // Locations: []*string{ - // to.Ptr("eastus")}, + // to.Ptr("eastus"), // }, - // Values: []*string{ - // to.Ptr("eastus")}, + // }, + // ReasonCode: to.Ptr(armdevopsinfrastructure.ResourceSKURestrictionsReasonCodeNotAvailableForSubscription), + // }, + // { + // Type: to.Ptr(armdevopsinfrastructure.ResourceSKURestrictionsTypeZone), + // Values: []*string{ + // to.Ptr("eastus"), + // }, + // RestrictionInfo: &armdevopsinfrastructure.ResourceSKURestrictionInfo{ + // Locations: []*string{ + // to.Ptr("eastus"), // }, - // { - // Type: to.Ptr(armdevopsinfrastructure.ResourceSKURestrictionsTypeZone), - // ReasonCode: to.Ptr(armdevopsinfrastructure.ResourceSKURestrictionsReasonCodeNotAvailableForSubscription), - // RestrictionInfo: &armdevopsinfrastructure.ResourceSKURestrictionInfo{ - // Locations: []*string{ - // to.Ptr("eastus")}, - // Zones: []*string{ - // to.Ptr("1"), - // to.Ptr("2"), - // to.Ptr("3")}, - // }, - // Values: []*string{ - // to.Ptr("eastus")}, - // }}, - // Size: to.Ptr("A0"), - // Tier: to.Ptr("Basic"), - // }, + // Zones: []*string{ + // to.Ptr("1"), + // to.Ptr("2"), + // to.Ptr("3"), // }, - // { - // Name: to.Ptr("Standard_A2_v2"), - // ID: to.Ptr("/subscriptions/a2e95d27-c161-4b61-bda4-11512c14c2c2/providers/Microsoft.DevOpsInfrastructure/locations/eastus/skus/Standard_A2_v2"), - // Properties: &armdevopsinfrastructure.ResourceSKUProperties{ - // Capabilities: []*armdevopsinfrastructure.ResourceSKUCapabilities{ - // { - // Name: to.Ptr("MaxResourceVolumeMB"), - // Value: to.Ptr("20480"), - // }, - // { - // Name: to.Ptr("OSVhdSizeMB"), - // Value: to.Ptr("1047552"), - // }, - // { - // Name: to.Ptr("vCPUs"), - // Value: to.Ptr("2"), - // }, - // { - // Name: to.Ptr("MemoryPreservingMaintenanceSupported"), - // Value: to.Ptr("True"), - // }, - // { - // Name: to.Ptr("HyperVGenerations"), - // Value: to.Ptr("V1"), - // }, - // { - // Name: to.Ptr("MemoryGB"), - // Value: to.Ptr("4"), - // }, - // { - // Name: to.Ptr("MaxDataDiskCount"), - // Value: to.Ptr("4"), - // }, - // { - // Name: to.Ptr("CpuArchitectureType"), - // Value: to.Ptr("x64"), - // }, - // { - // Name: to.Ptr("LowPriorityCapable"), - // Value: to.Ptr("True"), - // }, - // { - // Name: to.Ptr("PremiumIO"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("VMDeploymentTypes"), - // Value: to.Ptr("PaaS,IaaS"), - // }, - // { - // Name: to.Ptr("vCPUsAvailable"), - // Value: to.Ptr("2"), - // }, - // { - // Name: to.Ptr("ACUs"), - // Value: to.Ptr("100"), - // }, - // { - // Name: to.Ptr("vCPUsPerCore"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("CombinedTempDiskAndCachedIOPS"), - // Value: to.Ptr("2000"), - // }, - // { - // Name: to.Ptr("CombinedTempDiskAndCachedReadBytesPerSecond"), - // Value: to.Ptr("41943040"), - // }, - // { - // Name: to.Ptr("CombinedTempDiskAndCachedWriteBytesPerSecond"), - // Value: to.Ptr("20971520"), - // }, - // { - // Name: to.Ptr("UncachedDiskIOPS"), - // Value: to.Ptr("3200"), - // }, - // { - // Name: to.Ptr("UncachedDiskBytesPerSecond"), - // Value: to.Ptr("48000000"), - // }, - // { - // Name: to.Ptr("EphemeralOSDiskSupported"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("EncryptionAtHostSupported"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("CapacityReservationSupported"), - // Value: to.Ptr("True"), - // }, - // { - // Name: to.Ptr("AcceleratedNetworkingEnabled"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("RdmaEnabled"), - // Value: to.Ptr("False"), - // }, - // { - // Name: to.Ptr("MaxNetworkInterfaces"), - // Value: to.Ptr("2"), - // }}, - // Family: to.Ptr("standardAv2Family"), - // LocationInfo: []*armdevopsinfrastructure.ResourceSKULocationInfo{ - // { - // Location: to.Ptr("eastus"), - // ZoneDetails: []*armdevopsinfrastructure.ResourceSKUZoneDetails{ - // }, - // Zones: []*string{ - // to.Ptr("1"), - // to.Ptr("2"), - // to.Ptr("3")}, - // }}, - // Locations: []*string{ - // to.Ptr("eastus")}, - // ResourceType: to.Ptr("virtualMachines"), - // Restrictions: []*armdevopsinfrastructure.ResourceSKURestrictions{ - // }, - // Size: to.Ptr("A2_v2"), - // Tier: to.Ptr("Standard"), - // }, - // }}, - // } + // }, + // ReasonCode: to.Ptr(armdevopsinfrastructure.ResourceSKURestrictionsReasonCodeNotAvailableForSubscription), + // }, + // }, + // }, + // ID: to.Ptr("/subscriptions/a2e95d27-c161-4b61-bda4-11512c14c2c2/providers/Microsoft.DevOpsInfrastructure/locations/eastus/skus/Basic_A0"), + // Name: to.Ptr("Basic_A0"), + // }, + // { + // Properties: &armdevopsinfrastructure.ResourceSKUProperties{ + // ResourceType: to.Ptr("virtualMachines"), + // Tier: to.Ptr("Standard"), + // Size: to.Ptr("A2_v2"), + // Family: to.Ptr("standardAv2Family"), + // Locations: []*string{ + // to.Ptr("eastus"), + // }, + // LocationInfo: []*armdevopsinfrastructure.ResourceSKULocationInfo{ + // { + // Location: to.Ptr("eastus"), + // Zones: []*string{ + // to.Ptr("1"), + // to.Ptr("2"), + // to.Ptr("3"), + // }, + // ZoneDetails: []*armdevopsinfrastructure.ResourceSKUZoneDetails{ + // }, + // }, + // }, + // Capabilities: []*armdevopsinfrastructure.ResourceSKUCapabilities{ + // { + // Name: to.Ptr("MaxResourceVolumeMB"), + // Value: to.Ptr("20480"), + // }, + // { + // Name: to.Ptr("OSVhdSizeMB"), + // Value: to.Ptr("1047552"), + // }, + // { + // Name: to.Ptr("vCPUs"), + // Value: to.Ptr("2"), + // }, + // { + // Name: to.Ptr("MemoryPreservingMaintenanceSupported"), + // Value: to.Ptr("True"), + // }, + // { + // Name: to.Ptr("HyperVGenerations"), + // Value: to.Ptr("V1"), + // }, + // { + // Name: to.Ptr("MemoryGB"), + // Value: to.Ptr("4"), + // }, + // { + // Name: to.Ptr("MaxDataDiskCount"), + // Value: to.Ptr("4"), + // }, + // { + // Name: to.Ptr("CpuArchitectureType"), + // Value: to.Ptr("x64"), + // }, + // { + // Name: to.Ptr("LowPriorityCapable"), + // Value: to.Ptr("True"), + // }, + // { + // Name: to.Ptr("PremiumIO"), + // Value: to.Ptr("False"), + // }, + // { + // Name: to.Ptr("VMDeploymentTypes"), + // Value: to.Ptr("PaaS,IaaS"), + // }, + // { + // Name: to.Ptr("vCPUsAvailable"), + // Value: to.Ptr("2"), + // }, + // { + // Name: to.Ptr("ACUs"), + // Value: to.Ptr("100"), + // }, + // { + // Name: to.Ptr("vCPUsPerCore"), + // Value: to.Ptr("1"), + // }, + // { + // Name: to.Ptr("CombinedTempDiskAndCachedIOPS"), + // Value: to.Ptr("2000"), + // }, + // { + // Name: to.Ptr("CombinedTempDiskAndCachedReadBytesPerSecond"), + // Value: to.Ptr("41943040"), + // }, + // { + // Name: to.Ptr("CombinedTempDiskAndCachedWriteBytesPerSecond"), + // Value: to.Ptr("20971520"), + // }, + // { + // Name: to.Ptr("UncachedDiskIOPS"), + // Value: to.Ptr("3200"), + // }, + // { + // Name: to.Ptr("UncachedDiskBytesPerSecond"), + // Value: to.Ptr("48000000"), + // }, + // { + // Name: to.Ptr("EphemeralOSDiskSupported"), + // Value: to.Ptr("False"), + // }, + // { + // Name: to.Ptr("EncryptionAtHostSupported"), + // Value: to.Ptr("False"), + // }, + // { + // Name: to.Ptr("CapacityReservationSupported"), + // Value: to.Ptr("True"), + // }, + // { + // Name: to.Ptr("AcceleratedNetworkingEnabled"), + // Value: to.Ptr("False"), + // }, + // { + // Name: to.Ptr("RdmaEnabled"), + // Value: to.Ptr("False"), + // }, + // { + // Name: to.Ptr("MaxNetworkInterfaces"), + // Value: to.Ptr("2"), + // }, + // }, + // Restrictions: []*armdevopsinfrastructure.ResourceSKURestrictions{ + // }, + // }, + // ID: to.Ptr("/subscriptions/a2e95d27-c161-4b61-bda4-11512c14c2c2/providers/Microsoft.DevOpsInfrastructure/locations/eastus/skus/Standard_A2_v2"), + // Name: to.Ptr("Standard_A2_v2"), + // }, + // }, + // }, + // } } } diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/subscriptionusages_client.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/subscriptionusages_client.go index 52c4e21bf58b..f65ab469bb3e 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/subscriptionusages_client.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/subscriptionusages_client.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdevopsinfrastructure @@ -43,62 +39,62 @@ func NewSubscriptionUsagesClient(subscriptionID string, credential azcore.TokenC return client, nil } -// NewListByLocationPager - List Quota resources by subscription ID +// NewUsagesPager - List Quota resources by subscription ID // -// Generated from API version 2024-04-04-preview -// - locationName - Name of the location. -// - options - SubscriptionUsagesClientListByLocationOptions contains the optional parameters for the SubscriptionUsagesClient.NewListByLocationPager +// Generated from API version 2024-10-19 +// - location - The name of the Azure region. +// - options - SubscriptionUsagesClientUsagesOptions contains the optional parameters for the SubscriptionUsagesClient.NewUsagesPager // method. -func (client *SubscriptionUsagesClient) NewListByLocationPager(locationName string, options *SubscriptionUsagesClientListByLocationOptions) *runtime.Pager[SubscriptionUsagesClientListByLocationResponse] { - return runtime.NewPager(runtime.PagingHandler[SubscriptionUsagesClientListByLocationResponse]{ - More: func(page SubscriptionUsagesClientListByLocationResponse) bool { +func (client *SubscriptionUsagesClient) NewUsagesPager(location string, options *SubscriptionUsagesClientUsagesOptions) *runtime.Pager[SubscriptionUsagesClientUsagesResponse] { + return runtime.NewPager(runtime.PagingHandler[SubscriptionUsagesClientUsagesResponse]{ + More: func(page SubscriptionUsagesClientUsagesResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, - Fetcher: func(ctx context.Context, page *SubscriptionUsagesClientListByLocationResponse) (SubscriptionUsagesClientListByLocationResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SubscriptionUsagesClient.NewListByLocationPager") + Fetcher: func(ctx context.Context, page *SubscriptionUsagesClientUsagesResponse) (SubscriptionUsagesClientUsagesResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SubscriptionUsagesClient.NewUsagesPager") nextLink := "" if page != nil { nextLink = *page.NextLink } resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listByLocationCreateRequest(ctx, locationName, options) + return client.usagesCreateRequest(ctx, location, options) }, nil) if err != nil { - return SubscriptionUsagesClientListByLocationResponse{}, err + return SubscriptionUsagesClientUsagesResponse{}, err } - return client.listByLocationHandleResponse(resp) + return client.usagesHandleResponse(resp) }, Tracer: client.internal.Tracer(), }) } -// listByLocationCreateRequest creates the ListByLocation request. -func (client *SubscriptionUsagesClient) listByLocationCreateRequest(ctx context.Context, locationName string, options *SubscriptionUsagesClientListByLocationOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DevOpsInfrastructure/locations/{locationName}/usages" +// usagesCreateRequest creates the Usages request. +func (client *SubscriptionUsagesClient) usagesCreateRequest(ctx context.Context, location string, _ *SubscriptionUsagesClientUsagesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DevOpsInfrastructure/locations/{location}/usages" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if locationName == "" { - return nil, errors.New("parameter locationName cannot be empty") + if location == "" { + return nil, errors.New("parameter location cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{locationName}", url.PathEscape(locationName)) + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-04-preview") + reqQP.Set("api-version", "2024-10-19") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } -// listByLocationHandleResponse handles the ListByLocation response. -func (client *SubscriptionUsagesClient) listByLocationHandleResponse(resp *http.Response) (SubscriptionUsagesClientListByLocationResponse, error) { - result := SubscriptionUsagesClientListByLocationResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.QuotaListResult); err != nil { - return SubscriptionUsagesClientListByLocationResponse{}, err +// usagesHandleResponse handles the Usages response. +func (client *SubscriptionUsagesClient) usagesHandleResponse(resp *http.Response) (SubscriptionUsagesClientUsagesResponse, error) { + result := SubscriptionUsagesClientUsagesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PagedQuota); err != nil { + return SubscriptionUsagesClientUsagesResponse{}, err } return result, nil } diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/subscriptionusages_client_example_test.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/subscriptionusages_client_example_test.go index 46b092141c1a..89ea9b79654c 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/subscriptionusages_client_example_test.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/subscriptionusages_client_example_test.go @@ -1,34 +1,28 @@ -//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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdevopsinfrastructure_test import ( "context" - "log" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/33c4457b1d13f83965f4fe3367dca4a6df898100/specification/devopsinfrastructure/resource-manager/Microsoft.DevOpsInfrastructure/preview/2024-04-04-preview/examples/SubscriptionUsages_ListByLocation.json -func ExampleSubscriptionUsagesClient_NewListByLocationPager() { +// Generated from example definition: 2024-10-19/SubscriptionUsages_Usages.json +func ExampleSubscriptionUsagesClient_NewUsagesPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armdevopsinfrastructure.NewClientFactory("", cred, nil) + clientFactory, err := armdevopsinfrastructure.NewClientFactory("a2e95d27-c161-4b61-bda4-11512c14c2c2", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewSubscriptionUsagesClient().NewListByLocationPager("eastus", nil) + pager := clientFactory.NewSubscriptionUsagesClient().NewUsagesPager("eastus", nil) for pager.More() { page, err := pager.NextPage(ctx) if err != nil { @@ -39,34 +33,31 @@ func ExampleSubscriptionUsagesClient_NewListByLocationPager() { _ = v } // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.QuotaListResult = armdevopsinfrastructure.QuotaListResult{ - // Value: []*armdevopsinfrastructure.Quota{ - // { - // Name: to.Ptr("standardDADSv5Family"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/providers/Microsoft.DevOpsInfrastructure/Usages/standardDADSv5Family"), - // Properties: &armdevopsinfrastructure.QuotaProperties{ + // page = armdevopsinfrastructure.SubscriptionUsagesClientUsagesResponse{ + // PagedQuota: armdevopsinfrastructure.PagedQuota{ + // Value: []*armdevopsinfrastructure.Quota{ + // { + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/providers/Microsoft.DevOpsInfrastructure/Usages/standardDADSv5Family"), + // Unit: to.Ptr("Count"), + // CurrentValue: to.Ptr[int64](0), + // Limit: to.Ptr[int64](212), // Name: &armdevopsinfrastructure.QuotaName{ - // LocalizedValue: to.Ptr("Standard DADSv5 Family vCPUs (PME VMSS)"), // Value: to.Ptr("standardDADSv5Family"), + // LocalizedValue: to.Ptr("Standard DADSv5 Family vCPUs (PME VMSS)"), // }, - // CurrentValue: to.Ptr[int64](0), - // Limit: to.Ptr[int64](212), - // Unit: to.Ptr("Count"), // }, - // }, - // { - // Name: to.Ptr("standardDPLDSv5Family"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/providers/Microsoft.DevOpsInfrastructure/Usages/standardDPLDSv5Family"), - // Properties: &armdevopsinfrastructure.QuotaProperties{ + // { + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus/providers/Microsoft.DevOpsInfrastructure/Usages/standardDPLDSv5Family"), + // Unit: to.Ptr("Count"), + // CurrentValue: to.Ptr[int64](0), + // Limit: to.Ptr[int64](100), // Name: &armdevopsinfrastructure.QuotaName{ - // LocalizedValue: to.Ptr("Standard DPLDSv5 Family vCPUs (PME VMSS)"), // Value: to.Ptr("standardDPLDSv5Family"), + // LocalizedValue: to.Ptr("Standard DPLDSv5 Family vCPUs (PME VMSS)"), // }, - // CurrentValue: to.Ptr[int64](0), - // Limit: to.Ptr[int64](100), - // Unit: to.Ptr("Count"), // }, - // }}, + // }, + // }, // } } } diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/time_rfc3339.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/time_rfc3339.go index 4f8725b55a52..eb4674ef84aa 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/time_rfc3339.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/time_rfc3339.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdevopsinfrastructure @@ -60,6 +56,9 @@ func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + if len(data) == 0 { + return nil + } tzOffset := tzOffsetRegex.Match(data) hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") var layout string diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/tsp-location.yaml b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/tsp-location.yaml new file mode 100644 index 000000000000..77686a6437bb --- /dev/null +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/devopsinfrastructure/Microsoft.DevOpsInfrastructure.Management +commit: d477c7caa09bf82e22c419be0a99d170552b5892 +repo: Azure/azure-rest-api-specs +additionalDirectories: