diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/CHANGELOG.md b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/CHANGELOG.md index 96e36af4f892..d3259f55e6f4 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/CHANGELOG.md +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/CHANGELOG.md @@ -1,5 +1,32 @@ # Release History +## 1.0.0 (2024-10-07) +### Breaking Changes + +- Type of `PoolUpdateProperties.AgentProfile` has been changed from `AgentProfileUpdateClassification` to `AgentProfileClassification` +- Type of `Quota.Name` has been changed from `*string` to `*QuotaName` +- 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 field `CurrentValue`, `Limit`, `Unit` in struct `Quota` + + ## 0.1.0 (2024-05-24) The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html). diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/autorest.md b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/autorest.md index 2ea4855f1b0b..12217e9693a3 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/autorest.md +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/autorest.md @@ -5,9 +5,8 @@ ``` 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 +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/devopsinfrastructure/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/devopsinfrastructure/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.0 -tag: package-preview-2024-04 +module-version: 1.0.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/constants.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/constants.go index cbed5af7fe2f..6989a5b35c3a 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/constants.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/constants.go @@ -10,7 +10,7 @@ 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. @@ -245,11 +245,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 +263,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/subscriptionusages_server.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/subscriptionusages_server.go index 814de64be755..9b4253943743 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/subscriptionusages_server.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/subscriptionusages_server.go @@ -23,9 +23,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 +33,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. @@ -57,8 +57,8 @@ func (s *SubscriptionUsagesServerTransport) Do(req *http.Request) (*http.Respons var err error switch method { - case "SubscriptionUsagesClient.NewListByLocationPager": - resp, err = s.dispatchNewListByLocationPager(req) + case "SubscriptionUsagesClient.NewUsagesPager": + resp, err = s.dispatchNewUsagesPager(req) default: err = fmt.Errorf("unhandled API %s", method) } @@ -70,39 +70,39 @@ func (s *SubscriptionUsagesServerTransport) Do(req *http.Request) (*http.Respons return resp, nil } -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 } diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/go.mod b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/go.mod index 12db711df587..ff7f3e32c722 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/go.mod +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/go.mod @@ -2,20 +2,10 @@ 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/azidentity v1.7.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect - github.com/golang-jwt/jwt/v5 v5.2.1 // indirect - 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 ) diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/go.sum b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/go.sum index 09d275cb9a37..917448a001b7 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/go.sum +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/go.sum @@ -1,29 +1,12 @@ 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/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= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0/go.mod h1:iZDifYGJTIgIIkYRNWPENUnqx6bJ2xnSDFI2tjwZNuY= -github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU= -github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= -github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= -github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= -github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= -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/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= 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..75e4c4f9100a 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/imageversions_client.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/imageversions_client.go @@ -45,7 +45,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 @@ -93,7 +93,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 deleted file mode 100644 index 9949dcb23719..000000000000 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/imageversions_client_example_test.go +++ /dev/null @@ -1,54 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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" -) - -// 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 -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) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewImageVersionsClient().NewListByImagePager("my-resource-group", "windows-2022", 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.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"), - // }, - // { - // 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..b8df99bb1347 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/interfaces.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/interfaces.go @@ -17,15 +17,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 +43,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..4a82cb1ab798 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/models.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/models.go @@ -25,21 +25,6 @@ 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. @@ -56,22 +41,6 @@ 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. @@ -226,19 +195,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. @@ -324,6 +280,15 @@ 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 @@ -401,7 +366,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 +376,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 +396,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,21 +421,6 @@ 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. @@ -530,17 +471,6 @@ 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. @@ -690,34 +620,6 @@ 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. @@ -739,27 +641,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. diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/models_serde.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/models_serde.go index 30ddb194628f..f7299128de07 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/models_serde.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/models_serde.go @@ -50,41 +50,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 +81,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) @@ -539,33 +473,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) @@ -799,6 +706,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 +966,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 +994,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 +1011,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 +1065,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) @@ -1333,33 +1201,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) @@ -1734,49 +1575,6 @@ 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) @@ -1812,41 +1610,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) diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/operations_client.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/operations_client.go index a5d075124522..53412a758146 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/operations_client.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/operations_client.go @@ -39,7 +39,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]{ @@ -72,7 +72,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * 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 deleted file mode 100644 index 6cae58002b52..000000000000 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/operations_client_example_test.go +++ /dev/null @@ -1,45 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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" -) - -// 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 -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) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOperationsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OperationListResult = armdevopsinfrastructure.OperationListResult{ - // } - } -} diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/options.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/options.go index f44bb303f492..4229efc22a16 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/options.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/options.go @@ -64,8 +64,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..9f0cc41ea0aa 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/polymorphic_helpers.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/polymorphic_helpers.go @@ -33,29 +33,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 @@ -122,26 +99,3 @@ func unmarshalResourcePredictionsProfileClassification(rawMsg json.RawMessage) ( } 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{} - default: - b = &ResourcePredictionsProfileUpdate{} - } - if err := json.Unmarshal(rawMsg, b); err != nil { - return nil, err - } - return b, nil -} diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/pools_client.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/pools_client.go index 6d6b234c092a..b46b387ca2ba 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/pools_client.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/pools_client.go @@ -46,7 +46,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 +73,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" @@ -115,7 +115,7 @@ 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"} if err := runtime.MarshalAsJSON(req, resource); err != nil { @@ -127,7 +127,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. @@ -152,7 +152,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" @@ -194,7 +194,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 +203,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. @@ -249,7 +249,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 +266,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. @@ -309,7 +309,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 +326,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] { @@ -364,7 +364,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 +382,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. @@ -408,7 +408,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" @@ -450,7 +450,7 @@ 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"} if err := runtime.MarshalAsJSON(req, properties); err != nil { diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/pools_client_example_test.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/pools_client_example_test.go deleted file mode 100644 index 3f84839167f5..000000000000 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/pools_client_example_test.go +++ /dev/null @@ -1,260 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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" -) - -// 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() { - 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) - 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"), - // }}, - // } - } -} - -// 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() { - 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) - 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"), - // }}, - // } - } -} - -// 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 -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) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPoolsClient().Get(ctx, "rg", "pool", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.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/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) - 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) - } - // 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() { - 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) - 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) - } - // 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() { - 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) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - 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) - } -} diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/resourcedetails_client.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/resourcedetails_client.go index 4d6fa8f44d16..97bd76b196f4 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/resourcedetails_client.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/resourcedetails_client.go @@ -45,7 +45,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 @@ -93,7 +93,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 deleted file mode 100644 index 2c320ed1d805..000000000000 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/resourcedetails_client_example_test.go +++ /dev/null @@ -1,64 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// 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" -) - -// 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 -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) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewResourceDetailsClient().NewListByPoolPager("my-resource-group", "my-dev-ops-pool", 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.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), - // }, - // }, - // { - // 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), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/responses.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/responses.go index a536b94a7c60..6acca5cf2e33 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/responses.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/responses.go @@ -67,8 +67,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..0c5bea12b905 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/sku_client.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/sku_client.go @@ -45,7 +45,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] { @@ -87,7 +87,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 deleted file mode 100644 index 3ccfd416f8b2..000000000000 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/sku_client_example_test.go +++ /dev/null @@ -1,297 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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" -) - -// 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 -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) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSKUClient().NewListByLocationPager("eastus", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.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"), - // }, - // { - // 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("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), - // RestrictionInfo: &armdevopsinfrastructure.ResourceSKURestrictionInfo{ - // Locations: []*string{ - // to.Ptr("eastus")}, - // }, - // Values: []*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"), - // }, - // }, - // { - // 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"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/subscriptionusages_client.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/subscriptionusages_client.go index 52c4e21bf58b..6a8480d4e339 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/subscriptionusages_client.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/subscriptionusages_client.go @@ -43,62 +43,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, options *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 deleted file mode 100644 index 46b092141c1a..000000000000 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/subscriptionusages_client_example_test.go +++ /dev/null @@ -1,72 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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" -) - -// 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() { - 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) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSubscriptionUsagesClient().NewListByLocationPager("eastus", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.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{ - // Name: &armdevopsinfrastructure.QuotaName{ - // LocalizedValue: to.Ptr("Standard DADSv5 Family vCPUs (PME VMSS)"), - // Value: to.Ptr("standardDADSv5Family"), - // }, - // 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{ - // Name: &armdevopsinfrastructure.QuotaName{ - // LocalizedValue: to.Ptr("Standard DPLDSv5 Family vCPUs (PME VMSS)"), - // Value: to.Ptr("standardDPLDSv5Family"), - // }, - // CurrentValue: to.Ptr[int64](0), - // Limit: to.Ptr[int64](100), - // Unit: to.Ptr("Count"), - // }, - // }}, - // } - } -}