diff --git a/sdk/resourcemanager/standbypool/armstandbypool/CHANGELOG.md b/sdk/resourcemanager/standbypool/armstandbypool/CHANGELOG.md index 6eae06204d16..715d2f53ffc1 100644 --- a/sdk/resourcemanager/standbypool/armstandbypool/CHANGELOG.md +++ b/sdk/resourcemanager/standbypool/armstandbypool/CHANGELOG.md @@ -1,5 +1,38 @@ # Release History +## 1.0.0 (2024-09-26) +### Breaking Changes + +- Type of `StandbyContainerGroupPoolResourceUpdateProperties.ContainerGroupProperties` has been changed from `*ContainerGroupPropertiesUpdate` to `*ContainerGroupProperties` +- Type of `StandbyContainerGroupPoolResourceUpdateProperties.ElasticityProfile` has been changed from `*StandbyContainerGroupPoolElasticityProfileUpdate` to `*StandbyContainerGroupPoolElasticityProfile` +- Type of `StandbyVirtualMachinePoolResourceUpdateProperties.ElasticityProfile` has been changed from `*StandbyVirtualMachinePoolElasticityProfileUpdate` to `*StandbyVirtualMachinePoolElasticityProfile` +- Struct `ContainerGroupProfileUpdate` has been removed +- Struct `ContainerGroupPropertiesUpdate` has been removed +- Struct `StandbyContainerGroupPoolElasticityProfileUpdate` has been removed +- Struct `StandbyVirtualMachinePoolElasticityProfileUpdate` has been removed + +### Features Added + +- New function `*ClientFactory.NewStandbyContainerGroupPoolRuntimeViewsClient() *StandbyContainerGroupPoolRuntimeViewsClient` +- New function `*ClientFactory.NewStandbyVirtualMachinePoolRuntimeViewsClient() *StandbyVirtualMachinePoolRuntimeViewsClient` +- New function `NewStandbyContainerGroupPoolRuntimeViewsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*StandbyContainerGroupPoolRuntimeViewsClient, error)` +- New function `*StandbyContainerGroupPoolRuntimeViewsClient.Get(context.Context, string, string, string, *StandbyContainerGroupPoolRuntimeViewsClientGetOptions) (StandbyContainerGroupPoolRuntimeViewsClientGetResponse, error)` +- New function `*StandbyContainerGroupPoolRuntimeViewsClient.NewListByStandbyPoolPager(string, string, *StandbyContainerGroupPoolRuntimeViewsClientListByStandbyPoolOptions) *runtime.Pager[StandbyContainerGroupPoolRuntimeViewsClientListByStandbyPoolResponse]` +- New function `NewStandbyVirtualMachinePoolRuntimeViewsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*StandbyVirtualMachinePoolRuntimeViewsClient, error)` +- New function `*StandbyVirtualMachinePoolRuntimeViewsClient.Get(context.Context, string, string, string, *StandbyVirtualMachinePoolRuntimeViewsClientGetOptions) (StandbyVirtualMachinePoolRuntimeViewsClientGetResponse, error)` +- New function `*StandbyVirtualMachinePoolRuntimeViewsClient.NewListByStandbyPoolPager(string, string, *StandbyVirtualMachinePoolRuntimeViewsClientListByStandbyPoolOptions) *runtime.Pager[StandbyVirtualMachinePoolRuntimeViewsClientListByStandbyPoolResponse]` +- New struct `ContainerGroupInstanceCountSummary` +- New struct `PoolResourceStateCount` +- New struct `StandbyContainerGroupPoolRuntimeViewResource` +- New struct `StandbyContainerGroupPoolRuntimeViewResourceListResult` +- New struct `StandbyContainerGroupPoolRuntimeViewResourceProperties` +- New struct `StandbyVirtualMachinePoolRuntimeViewResource` +- New struct `StandbyVirtualMachinePoolRuntimeViewResourceListResult` +- New struct `StandbyVirtualMachinePoolRuntimeViewResourceProperties` +- New struct `VirtualMachineInstanceCountSummary` +- New field `MinReadyCapacity` in struct `StandbyVirtualMachinePoolElasticityProfile` + + ## 0.1.0 (2024-04-26) The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/standbypool/armstandbypool` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html). diff --git a/sdk/resourcemanager/standbypool/armstandbypool/README.md b/sdk/resourcemanager/standbypool/armstandbypool/README.md index a37fe9df92f7..fa0daf2e4da5 100644 --- a/sdk/resourcemanager/standbypool/armstandbypool/README.md +++ b/sdk/resourcemanager/standbypool/armstandbypool/README.md @@ -57,7 +57,7 @@ clientFactory, err := armstandbypool.NewClientFactory(, cred, & A client groups a set of related APIs, providing access to its functionality. Create one or more clients to access the APIs you require using client factory. ```go -client := clientFactory.NewStandbyContainerGroupPoolsClient() +client := clientFactory.NewStandbyContainerGroupPoolRuntimeViewsClient() ``` ## Fakes diff --git a/sdk/resourcemanager/standbypool/armstandbypool/autorest.md b/sdk/resourcemanager/standbypool/armstandbypool/autorest.md deleted file mode 100644 index c64752b8fde1..000000000000 --- a/sdk/resourcemanager/standbypool/armstandbypool/autorest.md +++ /dev/null @@ -1,13 +0,0 @@ -### AutoRest Configuration - -> see https://aka.ms/autorest - -``` yaml -azure-arm: true -require: -- https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/standbypool/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/standbypool/resource-manager/readme.go.md -license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.0 -tag: package-preview-2023-12 -``` \ No newline at end of file diff --git a/sdk/resourcemanager/standbypool/armstandbypool/build.go b/sdk/resourcemanager/standbypool/armstandbypool/build.go deleted file mode 100644 index 565f9ca5565a..000000000000 --- a/sdk/resourcemanager/standbypool/armstandbypool/build.go +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. - -// This file enables 'go generate' to regenerate this specific SDK -//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate -alwaysSetBodyParamRequired -removeUnreferencedTypes resourcemanager/standbypool/armstandbypool - -package armstandbypool diff --git a/sdk/resourcemanager/standbypool/armstandbypool/client_factory.go b/sdk/resourcemanager/standbypool/armstandbypool/client_factory.go index c0042b9f6503..d7daae318c0a 100644 --- a/sdk/resourcemanager/standbypool/armstandbypool/client_factory.go +++ b/sdk/resourcemanager/standbypool/armstandbypool/client_factory.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armstandbypool @@ -43,6 +39,14 @@ func (c *ClientFactory) NewOperationsClient() *OperationsClient { } } +// NewStandbyContainerGroupPoolRuntimeViewsClient creates a new instance of StandbyContainerGroupPoolRuntimeViewsClient. +func (c *ClientFactory) NewStandbyContainerGroupPoolRuntimeViewsClient() *StandbyContainerGroupPoolRuntimeViewsClient { + return &StandbyContainerGroupPoolRuntimeViewsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + // NewStandbyContainerGroupPoolsClient creates a new instance of StandbyContainerGroupPoolsClient. func (c *ClientFactory) NewStandbyContainerGroupPoolsClient() *StandbyContainerGroupPoolsClient { return &StandbyContainerGroupPoolsClient{ @@ -51,6 +55,14 @@ func (c *ClientFactory) NewStandbyContainerGroupPoolsClient() *StandbyContainerG } } +// NewStandbyVirtualMachinePoolRuntimeViewsClient creates a new instance of StandbyVirtualMachinePoolRuntimeViewsClient. +func (c *ClientFactory) NewStandbyVirtualMachinePoolRuntimeViewsClient() *StandbyVirtualMachinePoolRuntimeViewsClient { + return &StandbyVirtualMachinePoolRuntimeViewsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + // NewStandbyVirtualMachinePoolsClient creates a new instance of StandbyVirtualMachinePoolsClient. func (c *ClientFactory) NewStandbyVirtualMachinePoolsClient() *StandbyVirtualMachinePoolsClient { return &StandbyVirtualMachinePoolsClient{ diff --git a/sdk/resourcemanager/standbypool/armstandbypool/constants.go b/sdk/resourcemanager/standbypool/armstandbypool/constants.go index 9728ccc985e3..2eec7cc967ca 100644 --- a/sdk/resourcemanager/standbypool/armstandbypool/constants.go +++ b/sdk/resourcemanager/standbypool/armstandbypool/constants.go @@ -1,22 +1,19 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armstandbypool const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/standbypool/armstandbypool" - moduleVersion = "v0.1.0" + moduleVersion = "v1.0.0" ) -// ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. +// ActionType - Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. type ActionType string const ( + // ActionTypeInternal - Actions are for internal-only APIs. ActionTypeInternal ActionType = "Internal" ) @@ -27,14 +24,18 @@ func PossibleActionTypeValues() []ActionType { } } -// CreatedByType - The type of identity that created the resource. +// CreatedByType - The kind of entity that created the resource. type CreatedByType string const ( - CreatedByTypeApplication CreatedByType = "Application" - CreatedByTypeKey CreatedByType = "Key" + // CreatedByTypeApplication - The entity was created by an application. + CreatedByTypeApplication CreatedByType = "Application" + // CreatedByTypeKey - The entity was created by a key. + CreatedByTypeKey CreatedByType = "Key" + // CreatedByTypeManagedIdentity - The entity was created by a managed identity. CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" - CreatedByTypeUser CreatedByType = "User" + // CreatedByTypeUser - The entity was created by a user. + CreatedByTypeUser CreatedByType = "User" ) // PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. @@ -52,8 +53,11 @@ func PossibleCreatedByTypeValues() []CreatedByType { type Origin string const ( - OriginSystem Origin = "system" - OriginUser Origin = "user" + // OriginSystem - Indicates the operation is initiated by a system. + OriginSystem Origin = "system" + // OriginUser - Indicates the operation is initiated by a user. + OriginUser Origin = "user" + // OriginUserSystem - Indicates the operation is initiated by a user or system. OriginUserSystem Origin = "user,system" ) diff --git a/sdk/resourcemanager/standbypool/armstandbypool/fake/internal.go b/sdk/resourcemanager/standbypool/armstandbypool/fake/internal.go index 5f75802a569e..56a8f624f5f3 100644 --- a/sdk/resourcemanager/standbypool/armstandbypool/fake/internal.go +++ b/sdk/resourcemanager/standbypool/armstandbypool/fake/internal.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake diff --git a/sdk/resourcemanager/standbypool/armstandbypool/fake/operations_server.go b/sdk/resourcemanager/standbypool/armstandbypool/fake/operations_server.go index ffec2bd32982..9a882bb6131f 100644 --- a/sdk/resourcemanager/standbypool/armstandbypool/fake/operations_server.go +++ b/sdk/resourcemanager/standbypool/armstandbypool/fake/operations_server.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -51,6 +47,10 @@ func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } + return o.dispatchToMethodFake(req, method) +} + +func (o *OperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { var resp *http.Response var err error @@ -61,11 +61,7 @@ func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error err = fmt.Errorf("unhandled API %s", method) } - if err != nil { - return nil, err - } - - return resp, nil + return resp, err } func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { diff --git a/sdk/resourcemanager/standbypool/armstandbypool/fake/server_factory.go b/sdk/resourcemanager/standbypool/armstandbypool/fake/server_factory.go index 79ac195cdfd2..2883f591764f 100644 --- a/sdk/resourcemanager/standbypool/armstandbypool/fake/server_factory.go +++ b/sdk/resourcemanager/standbypool/armstandbypool/fake/server_factory.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -19,10 +15,23 @@ import ( // ServerFactory is a fake server for instances of the armstandbypool.ClientFactory type. type ServerFactory struct { - OperationsServer OperationsServer + // OperationsServer contains the fakes for client OperationsClient + OperationsServer OperationsServer + + // StandbyContainerGroupPoolRuntimeViewsServer contains the fakes for client StandbyContainerGroupPoolRuntimeViewsClient + StandbyContainerGroupPoolRuntimeViewsServer StandbyContainerGroupPoolRuntimeViewsServer + + // StandbyContainerGroupPoolsServer contains the fakes for client StandbyContainerGroupPoolsClient StandbyContainerGroupPoolsServer StandbyContainerGroupPoolsServer + + // StandbyVirtualMachinePoolRuntimeViewsServer contains the fakes for client StandbyVirtualMachinePoolRuntimeViewsClient + StandbyVirtualMachinePoolRuntimeViewsServer StandbyVirtualMachinePoolRuntimeViewsServer + + // StandbyVirtualMachinePoolsServer contains the fakes for client StandbyVirtualMachinePoolsClient StandbyVirtualMachinePoolsServer StandbyVirtualMachinePoolsServer - StandbyVirtualMachinesServer StandbyVirtualMachinesServer + + // StandbyVirtualMachinesServer contains the fakes for client StandbyVirtualMachinesClient + StandbyVirtualMachinesServer StandbyVirtualMachinesServer } // NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. @@ -37,12 +46,14 @@ func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { // ServerFactoryTransport connects instances of armstandbypool.ClientFactory to instances of ServerFactory. // Don't use this type directly, use NewServerFactoryTransport instead. type ServerFactoryTransport struct { - srv *ServerFactory - trMu sync.Mutex - trOperationsServer *OperationsServerTransport - trStandbyContainerGroupPoolsServer *StandbyContainerGroupPoolsServerTransport - trStandbyVirtualMachinePoolsServer *StandbyVirtualMachinePoolsServerTransport - trStandbyVirtualMachinesServer *StandbyVirtualMachinesServerTransport + srv *ServerFactory + trMu sync.Mutex + trOperationsServer *OperationsServerTransport + trStandbyContainerGroupPoolRuntimeViewsServer *StandbyContainerGroupPoolRuntimeViewsServerTransport + trStandbyContainerGroupPoolsServer *StandbyContainerGroupPoolsServerTransport + trStandbyVirtualMachinePoolRuntimeViewsServer *StandbyVirtualMachinePoolRuntimeViewsServerTransport + trStandbyVirtualMachinePoolsServer *StandbyVirtualMachinePoolsServerTransport + trStandbyVirtualMachinesServer *StandbyVirtualMachinesServerTransport } // Do implements the policy.Transporter interface for ServerFactoryTransport. @@ -61,11 +72,21 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { case "OperationsClient": initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) resp, err = s.trOperationsServer.Do(req) + case "StandbyContainerGroupPoolRuntimeViewsClient": + initServer(s, &s.trStandbyContainerGroupPoolRuntimeViewsServer, func() *StandbyContainerGroupPoolRuntimeViewsServerTransport { + return NewStandbyContainerGroupPoolRuntimeViewsServerTransport(&s.srv.StandbyContainerGroupPoolRuntimeViewsServer) + }) + resp, err = s.trStandbyContainerGroupPoolRuntimeViewsServer.Do(req) case "StandbyContainerGroupPoolsClient": initServer(s, &s.trStandbyContainerGroupPoolsServer, func() *StandbyContainerGroupPoolsServerTransport { return NewStandbyContainerGroupPoolsServerTransport(&s.srv.StandbyContainerGroupPoolsServer) }) resp, err = s.trStandbyContainerGroupPoolsServer.Do(req) + case "StandbyVirtualMachinePoolRuntimeViewsClient": + initServer(s, &s.trStandbyVirtualMachinePoolRuntimeViewsServer, func() *StandbyVirtualMachinePoolRuntimeViewsServerTransport { + return NewStandbyVirtualMachinePoolRuntimeViewsServerTransport(&s.srv.StandbyVirtualMachinePoolRuntimeViewsServer) + }) + resp, err = s.trStandbyVirtualMachinePoolRuntimeViewsServer.Do(req) case "StandbyVirtualMachinePoolsClient": initServer(s, &s.trStandbyVirtualMachinePoolsServer, func() *StandbyVirtualMachinePoolsServerTransport { return NewStandbyVirtualMachinePoolsServerTransport(&s.srv.StandbyVirtualMachinePoolsServer) diff --git a/sdk/resourcemanager/standbypool/armstandbypool/fake/standbycontainergrouppoolruntimeviews_server.go b/sdk/resourcemanager/standbypool/armstandbypool/fake/standbycontainergrouppoolruntimeviews_server.go new file mode 100644 index 000000000000..70e38faf4686 --- /dev/null +++ b/sdk/resourcemanager/standbypool/armstandbypool/fake/standbycontainergrouppoolruntimeviews_server.go @@ -0,0 +1,152 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/standbypool/armstandbypool" + "net/http" + "net/url" + "regexp" +) + +// StandbyContainerGroupPoolRuntimeViewsServer is a fake server for instances of the armstandbypool.StandbyContainerGroupPoolRuntimeViewsClient type. +type StandbyContainerGroupPoolRuntimeViewsServer struct { + // Get is the fake for method StandbyContainerGroupPoolRuntimeViewsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, standbyContainerGroupPoolName string, runtimeView string, options *armstandbypool.StandbyContainerGroupPoolRuntimeViewsClientGetOptions) (resp azfake.Responder[armstandbypool.StandbyContainerGroupPoolRuntimeViewsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByStandbyPoolPager is the fake for method StandbyContainerGroupPoolRuntimeViewsClient.NewListByStandbyPoolPager + // HTTP status codes to indicate success: http.StatusOK + NewListByStandbyPoolPager func(resourceGroupName string, standbyContainerGroupPoolName string, options *armstandbypool.StandbyContainerGroupPoolRuntimeViewsClientListByStandbyPoolOptions) (resp azfake.PagerResponder[armstandbypool.StandbyContainerGroupPoolRuntimeViewsClientListByStandbyPoolResponse]) +} + +// NewStandbyContainerGroupPoolRuntimeViewsServerTransport creates a new instance of StandbyContainerGroupPoolRuntimeViewsServerTransport with the provided implementation. +// The returned StandbyContainerGroupPoolRuntimeViewsServerTransport instance is connected to an instance of armstandbypool.StandbyContainerGroupPoolRuntimeViewsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewStandbyContainerGroupPoolRuntimeViewsServerTransport(srv *StandbyContainerGroupPoolRuntimeViewsServer) *StandbyContainerGroupPoolRuntimeViewsServerTransport { + return &StandbyContainerGroupPoolRuntimeViewsServerTransport{ + srv: srv, + newListByStandbyPoolPager: newTracker[azfake.PagerResponder[armstandbypool.StandbyContainerGroupPoolRuntimeViewsClientListByStandbyPoolResponse]](), + } +} + +// StandbyContainerGroupPoolRuntimeViewsServerTransport connects instances of armstandbypool.StandbyContainerGroupPoolRuntimeViewsClient to instances of StandbyContainerGroupPoolRuntimeViewsServer. +// Don't use this type directly, use NewStandbyContainerGroupPoolRuntimeViewsServerTransport instead. +type StandbyContainerGroupPoolRuntimeViewsServerTransport struct { + srv *StandbyContainerGroupPoolRuntimeViewsServer + newListByStandbyPoolPager *tracker[azfake.PagerResponder[armstandbypool.StandbyContainerGroupPoolRuntimeViewsClientListByStandbyPoolResponse]] +} + +// Do implements the policy.Transporter interface for StandbyContainerGroupPoolRuntimeViewsServerTransport. +func (s *StandbyContainerGroupPoolRuntimeViewsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return s.dispatchToMethodFake(req, method) +} + +func (s *StandbyContainerGroupPoolRuntimeViewsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + var resp *http.Response + var err error + + switch method { + case "StandbyContainerGroupPoolRuntimeViewsClient.Get": + resp, err = s.dispatchGet(req) + case "StandbyContainerGroupPoolRuntimeViewsClient.NewListByStandbyPoolPager": + resp, err = s.dispatchNewListByStandbyPoolPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + return resp, err +} + +func (s *StandbyContainerGroupPoolRuntimeViewsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if s.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StandbyPool/standbyContainerGroupPools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/runtimeViews/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + standbyContainerGroupPoolNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("standbyContainerGroupPoolName")]) + if err != nil { + return nil, err + } + runtimeViewParam, err := url.PathUnescape(matches[regex.SubexpIndex("runtimeView")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Get(req.Context(), resourceGroupNameParam, standbyContainerGroupPoolNameParam, runtimeViewParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).StandbyContainerGroupPoolRuntimeViewResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *StandbyContainerGroupPoolRuntimeViewsServerTransport) dispatchNewListByStandbyPoolPager(req *http.Request) (*http.Response, error) { + if s.srv.NewListByStandbyPoolPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByStandbyPoolPager not implemented")} + } + newListByStandbyPoolPager := s.newListByStandbyPoolPager.get(req) + if newListByStandbyPoolPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StandbyPool/standbyContainerGroupPools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/runtimeViews` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + standbyContainerGroupPoolNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("standbyContainerGroupPoolName")]) + if err != nil { + return nil, err + } + resp := s.srv.NewListByStandbyPoolPager(resourceGroupNameParam, standbyContainerGroupPoolNameParam, nil) + newListByStandbyPoolPager = &resp + s.newListByStandbyPoolPager.add(req, newListByStandbyPoolPager) + server.PagerResponderInjectNextLinks(newListByStandbyPoolPager, req, func(page *armstandbypool.StandbyContainerGroupPoolRuntimeViewsClientListByStandbyPoolResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByStandbyPoolPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + s.newListByStandbyPoolPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByStandbyPoolPager) { + s.newListByStandbyPoolPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/standbypool/armstandbypool/fake/standbycontainergrouppools_server.go b/sdk/resourcemanager/standbypool/armstandbypool/fake/standbycontainergrouppools_server.go index 0f5e80c66d75..792826dc3f33 100644 --- a/sdk/resourcemanager/standbypool/armstandbypool/fake/standbycontainergrouppools_server.go +++ b/sdk/resourcemanager/standbypool/armstandbypool/fake/standbycontainergrouppools_server.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -80,6 +76,10 @@ func (s *StandbyContainerGroupPoolsServerTransport) Do(req *http.Request) (*http return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } + return s.dispatchToMethodFake(req, method) +} + +func (s *StandbyContainerGroupPoolsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { var resp *http.Response var err error @@ -100,11 +100,7 @@ func (s *StandbyContainerGroupPoolsServerTransport) Do(req *http.Request) (*http err = fmt.Errorf("unhandled API %s", method) } - if err != nil { - return nil, err - } - - return resp, nil + return resp, err } func (s *StandbyContainerGroupPoolsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { diff --git a/sdk/resourcemanager/standbypool/armstandbypool/fake/standbyvirtualmachinepoolruntimeviews_server.go b/sdk/resourcemanager/standbypool/armstandbypool/fake/standbyvirtualmachinepoolruntimeviews_server.go new file mode 100644 index 000000000000..835b9bade3b5 --- /dev/null +++ b/sdk/resourcemanager/standbypool/armstandbypool/fake/standbyvirtualmachinepoolruntimeviews_server.go @@ -0,0 +1,152 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/standbypool/armstandbypool" + "net/http" + "net/url" + "regexp" +) + +// StandbyVirtualMachinePoolRuntimeViewsServer is a fake server for instances of the armstandbypool.StandbyVirtualMachinePoolRuntimeViewsClient type. +type StandbyVirtualMachinePoolRuntimeViewsServer struct { + // Get is the fake for method StandbyVirtualMachinePoolRuntimeViewsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, standbyVirtualMachinePoolName string, runtimeView string, options *armstandbypool.StandbyVirtualMachinePoolRuntimeViewsClientGetOptions) (resp azfake.Responder[armstandbypool.StandbyVirtualMachinePoolRuntimeViewsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByStandbyPoolPager is the fake for method StandbyVirtualMachinePoolRuntimeViewsClient.NewListByStandbyPoolPager + // HTTP status codes to indicate success: http.StatusOK + NewListByStandbyPoolPager func(resourceGroupName string, standbyVirtualMachinePoolName string, options *armstandbypool.StandbyVirtualMachinePoolRuntimeViewsClientListByStandbyPoolOptions) (resp azfake.PagerResponder[armstandbypool.StandbyVirtualMachinePoolRuntimeViewsClientListByStandbyPoolResponse]) +} + +// NewStandbyVirtualMachinePoolRuntimeViewsServerTransport creates a new instance of StandbyVirtualMachinePoolRuntimeViewsServerTransport with the provided implementation. +// The returned StandbyVirtualMachinePoolRuntimeViewsServerTransport instance is connected to an instance of armstandbypool.StandbyVirtualMachinePoolRuntimeViewsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewStandbyVirtualMachinePoolRuntimeViewsServerTransport(srv *StandbyVirtualMachinePoolRuntimeViewsServer) *StandbyVirtualMachinePoolRuntimeViewsServerTransport { + return &StandbyVirtualMachinePoolRuntimeViewsServerTransport{ + srv: srv, + newListByStandbyPoolPager: newTracker[azfake.PagerResponder[armstandbypool.StandbyVirtualMachinePoolRuntimeViewsClientListByStandbyPoolResponse]](), + } +} + +// StandbyVirtualMachinePoolRuntimeViewsServerTransport connects instances of armstandbypool.StandbyVirtualMachinePoolRuntimeViewsClient to instances of StandbyVirtualMachinePoolRuntimeViewsServer. +// Don't use this type directly, use NewStandbyVirtualMachinePoolRuntimeViewsServerTransport instead. +type StandbyVirtualMachinePoolRuntimeViewsServerTransport struct { + srv *StandbyVirtualMachinePoolRuntimeViewsServer + newListByStandbyPoolPager *tracker[azfake.PagerResponder[armstandbypool.StandbyVirtualMachinePoolRuntimeViewsClientListByStandbyPoolResponse]] +} + +// Do implements the policy.Transporter interface for StandbyVirtualMachinePoolRuntimeViewsServerTransport. +func (s *StandbyVirtualMachinePoolRuntimeViewsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return s.dispatchToMethodFake(req, method) +} + +func (s *StandbyVirtualMachinePoolRuntimeViewsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + var resp *http.Response + var err error + + switch method { + case "StandbyVirtualMachinePoolRuntimeViewsClient.Get": + resp, err = s.dispatchGet(req) + case "StandbyVirtualMachinePoolRuntimeViewsClient.NewListByStandbyPoolPager": + resp, err = s.dispatchNewListByStandbyPoolPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + return resp, err +} + +func (s *StandbyVirtualMachinePoolRuntimeViewsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if s.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StandbyPool/standbyVirtualMachinePools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/runtimeViews/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + standbyVirtualMachinePoolNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("standbyVirtualMachinePoolName")]) + if err != nil { + return nil, err + } + runtimeViewParam, err := url.PathUnescape(matches[regex.SubexpIndex("runtimeView")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Get(req.Context(), resourceGroupNameParam, standbyVirtualMachinePoolNameParam, runtimeViewParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).StandbyVirtualMachinePoolRuntimeViewResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *StandbyVirtualMachinePoolRuntimeViewsServerTransport) dispatchNewListByStandbyPoolPager(req *http.Request) (*http.Response, error) { + if s.srv.NewListByStandbyPoolPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByStandbyPoolPager not implemented")} + } + newListByStandbyPoolPager := s.newListByStandbyPoolPager.get(req) + if newListByStandbyPoolPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StandbyPool/standbyVirtualMachinePools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/runtimeViews` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + standbyVirtualMachinePoolNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("standbyVirtualMachinePoolName")]) + if err != nil { + return nil, err + } + resp := s.srv.NewListByStandbyPoolPager(resourceGroupNameParam, standbyVirtualMachinePoolNameParam, nil) + newListByStandbyPoolPager = &resp + s.newListByStandbyPoolPager.add(req, newListByStandbyPoolPager) + server.PagerResponderInjectNextLinks(newListByStandbyPoolPager, req, func(page *armstandbypool.StandbyVirtualMachinePoolRuntimeViewsClientListByStandbyPoolResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByStandbyPoolPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + s.newListByStandbyPoolPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByStandbyPoolPager) { + s.newListByStandbyPoolPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/standbypool/armstandbypool/fake/standbyvirtualmachinepools_server.go b/sdk/resourcemanager/standbypool/armstandbypool/fake/standbyvirtualmachinepools_server.go index b41175afbbfe..49b3ac00dcf8 100644 --- a/sdk/resourcemanager/standbypool/armstandbypool/fake/standbyvirtualmachinepools_server.go +++ b/sdk/resourcemanager/standbypool/armstandbypool/fake/standbyvirtualmachinepools_server.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -80,6 +76,10 @@ func (s *StandbyVirtualMachinePoolsServerTransport) Do(req *http.Request) (*http return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } + return s.dispatchToMethodFake(req, method) +} + +func (s *StandbyVirtualMachinePoolsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { var resp *http.Response var err error @@ -100,11 +100,7 @@ func (s *StandbyVirtualMachinePoolsServerTransport) Do(req *http.Request) (*http err = fmt.Errorf("unhandled API %s", method) } - if err != nil { - return nil, err - } - - return resp, nil + return resp, err } func (s *StandbyVirtualMachinePoolsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { diff --git a/sdk/resourcemanager/standbypool/armstandbypool/fake/standbyvirtualmachines_server.go b/sdk/resourcemanager/standbypool/armstandbypool/fake/standbyvirtualmachines_server.go index 54c472156135..e6d922df6faa 100644 --- a/sdk/resourcemanager/standbypool/armstandbypool/fake/standbyvirtualmachines_server.go +++ b/sdk/resourcemanager/standbypool/armstandbypool/fake/standbyvirtualmachines_server.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -58,6 +54,10 @@ func (s *StandbyVirtualMachinesServerTransport) Do(req *http.Request) (*http.Res return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } + return s.dispatchToMethodFake(req, method) +} + +func (s *StandbyVirtualMachinesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { var resp *http.Response var err error @@ -70,11 +70,7 @@ func (s *StandbyVirtualMachinesServerTransport) Do(req *http.Request) (*http.Res err = fmt.Errorf("unhandled API %s", method) } - if err != nil { - return nil, err - } - - return resp, nil + return resp, err } func (s *StandbyVirtualMachinesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { diff --git a/sdk/resourcemanager/standbypool/armstandbypool/fake/time_rfc3339.go b/sdk/resourcemanager/standbypool/armstandbypool/fake/time_rfc3339.go index 81f308b0d343..87ee11e83b32 100644 --- a/sdk/resourcemanager/standbypool/armstandbypool/fake/time_rfc3339.go +++ b/sdk/resourcemanager/standbypool/armstandbypool/fake/time_rfc3339.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -60,6 +56,9 @@ func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + if len(data) == 0 { + return nil + } tzOffset := tzOffsetRegex.Match(data) hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") var layout string diff --git a/sdk/resourcemanager/standbypool/armstandbypool/models.go b/sdk/resourcemanager/standbypool/armstandbypool/models.go index 7e0504e9dc02..aaf9ef0d79b8 100644 --- a/sdk/resourcemanager/standbypool/armstandbypool/models.go +++ b/sdk/resourcemanager/standbypool/armstandbypool/models.go @@ -1,15 +1,18 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armstandbypool import "time" +// ContainerGroupInstanceCountSummary - Displays the counts of container groups in each state, as known by the StandbyPool +// resource provider. +type ContainerGroupInstanceCountSummary struct { + // REQUIRED; The count of pooled resources in each state. + InstanceCountsByState []*PoolResourceStateCount +} + // ContainerGroupProfile - Details of the ContainerGroupProfile. type ContainerGroupProfile struct { // REQUIRED; Specifies container group profile id of standby container groups. @@ -19,15 +22,6 @@ type ContainerGroupProfile struct { Revision *int64 } -// ContainerGroupProfileUpdate - Details of the ContainerGroupProfile. -type ContainerGroupProfileUpdate struct { - // Specifies container group profile id of standby container groups. - ID *string - - // Specifies revision of container group profile. - Revision *int64 -} - // ContainerGroupProperties - Details of the ContainerGroupProperties. type ContainerGroupProperties struct { // REQUIRED; Specifies container group profile of standby container groups. @@ -37,25 +31,16 @@ type ContainerGroupProperties struct { SubnetIDs []*Subnet } -// ContainerGroupPropertiesUpdate - Details of the ContainerGroupProperties. -type ContainerGroupPropertiesUpdate struct { - // Specifies container group profile of standby container groups. - ContainerGroupProfile *ContainerGroupProfileUpdate - - // Specifies subnet Ids for container group. - SubnetIDs []*Subnet -} - // Operation - Details of a REST API operation, returned from the Resource Provider Operations API type Operation struct { - // Localized display information for this particular operation. - Display *OperationDisplay - - // READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + // Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. ActionType *ActionType - // READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane - // operations. + // READ-ONLY; Localized display information for this particular operation. + Display *OperationDisplay + + // READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure + // Resource Manager/control-plane operations. IsDataAction *bool // READ-ONLY; The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", @@ -67,7 +52,7 @@ type Operation struct { Origin *Origin } -// OperationDisplay - Localized display information for this particular operation. +// OperationDisplay - Localized display information for and operation. type OperationDisplay struct { // READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views. Description *string @@ -88,11 +73,20 @@ type OperationDisplay struct { // OperationListResult - A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to // get the next set of results. type OperationListResult struct { - // READ-ONLY; URL to get the next set of operation list results (if there are any). + // REQUIRED; The Operation items on this page + Value []*Operation + + // The link to the next page of items NextLink *string +} - // READ-ONLY; List of operations supported by the resource provider - Value []*Operation +// PoolResourceStateCount - Displays the counts of pooled resources in each state, as known by the StandbyPool resource provider. +type PoolResourceStateCount struct { + // REQUIRED; The count of pooled resources in the given state. + Count *int64 + + // REQUIRED; The state that the pooled resources count is for. + State *string } // StandbyContainerGroupPoolElasticityProfile - Specifies the elasticity profile of the standby container group pools. @@ -104,15 +98,6 @@ type StandbyContainerGroupPoolElasticityProfile struct { RefillPolicy *RefillPolicy } -// StandbyContainerGroupPoolElasticityProfileUpdate - Specifies the elasticity profile of the standby container group pools. -type StandbyContainerGroupPoolElasticityProfileUpdate struct { - // Specifies maximum number of standby container groups in the standby pool. - MaxReadyCapacity *int64 - - // Specifies refill policy of the pool. - RefillPolicy *RefillPolicy -} - // StandbyContainerGroupPoolResource - A StandbyContainerGroupPoolResource. type StandbyContainerGroupPoolResource struct { // REQUIRED; The geo-location where the resource lives @@ -124,12 +109,12 @@ type StandbyContainerGroupPoolResource struct { // Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" - ID *string - - // READ-ONLY; The name of the resource + // READ-ONLY; Name of the standby container group pool Name *string + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData @@ -142,7 +127,7 @@ type StandbyContainerGroupPoolResourceListResult struct { // REQUIRED; The StandbyContainerGroupPoolResource items on this page Value []*StandbyContainerGroupPoolResource - // READ-ONLY; The link to the next page of items + // The link to the next page of items NextLink *string } @@ -160,7 +145,7 @@ type StandbyContainerGroupPoolResourceProperties struct { // StandbyContainerGroupPoolResourceUpdate - The type used for update operations of the StandbyContainerGroupPoolResource. type StandbyContainerGroupPoolResourceUpdate struct { - // The updatable properties of the StandbyContainerGroupPoolResource. + // The resource-specific properties for this resource. Properties *StandbyContainerGroupPoolResourceUpdateProperties // Resource tags. @@ -170,22 +155,61 @@ type StandbyContainerGroupPoolResourceUpdate struct { // StandbyContainerGroupPoolResourceUpdateProperties - The updatable properties of the StandbyContainerGroupPoolResource. type StandbyContainerGroupPoolResourceUpdateProperties struct { // Specifies container group properties of standby container group pools. - ContainerGroupProperties *ContainerGroupPropertiesUpdate + ContainerGroupProperties *ContainerGroupProperties // Specifies elasticity profile of standby container group pools. - ElasticityProfile *StandbyContainerGroupPoolElasticityProfileUpdate + ElasticityProfile *StandbyContainerGroupPoolElasticityProfile +} + +// StandbyContainerGroupPoolRuntimeViewResource - Contains information about a standby container group pool as last known +// by the StandbyPool resource provider. +type StandbyContainerGroupPoolRuntimeViewResource struct { + // The resource-specific properties for this resource. + Properties *StandbyContainerGroupPoolRuntimeViewResourceProperties + + // READ-ONLY; The unique identifier for the runtime view. The input string should be the word 'latest', which will get the + // latest runtime view of the pool, otherwise the request will fail with NotFound exception. + Name *string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// StandbyContainerGroupPoolRuntimeViewResourceListResult - The response of a StandbyContainerGroupPoolRuntimeViewResource +// list operation. +type StandbyContainerGroupPoolRuntimeViewResourceListResult struct { + // REQUIRED; The StandbyContainerGroupPoolRuntimeViewResource items on this page + Value []*StandbyContainerGroupPoolRuntimeViewResource + + // The link to the next page of items + NextLink *string +} + +// StandbyContainerGroupPoolRuntimeViewResourceProperties - Contains information about a standby pool as last known by the +// StandbyPool resource provider. +type StandbyContainerGroupPoolRuntimeViewResourceProperties struct { + // READ-ONLY; A list containing the counts of container groups in each possible state, as known by the StandbyPool resource + // provider. + InstanceCountSummary []*ContainerGroupInstanceCountSummary + + // READ-ONLY; Displays the provisioning state of the standby pool + ProvisioningState *ProvisioningState } // StandbyVirtualMachinePoolElasticityProfile - Details of the elasticity profile. type StandbyVirtualMachinePoolElasticityProfile struct { // REQUIRED; Specifies the maximum number of virtual machines in the standby virtual machine pool. MaxReadyCapacity *int64 -} -// StandbyVirtualMachinePoolElasticityProfileUpdate - Details of the elasticity profile. -type StandbyVirtualMachinePoolElasticityProfileUpdate struct { - // Specifies the maximum number of virtual machines in the standby virtual machine pool. - MaxReadyCapacity *int64 + // Specifies the desired minimum number of virtual machines in the standby virtual machine pool. MinReadyCapacity cannot exceed + // MaxReadyCapacity. + MinReadyCapacity *int64 } // StandbyVirtualMachinePoolResource - A StandbyVirtualMachinePoolResource. @@ -199,12 +223,12 @@ type StandbyVirtualMachinePoolResource struct { // Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" - ID *string - - // READ-ONLY; The name of the resource + // READ-ONLY; Name of the standby virtual machine pool Name *string + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData @@ -217,7 +241,7 @@ type StandbyVirtualMachinePoolResourceListResult struct { // REQUIRED; The StandbyVirtualMachinePoolResource items on this page Value []*StandbyVirtualMachinePoolResource - // READ-ONLY; The link to the next page of items + // The link to the next page of items NextLink *string } @@ -238,7 +262,7 @@ type StandbyVirtualMachinePoolResourceProperties struct { // StandbyVirtualMachinePoolResourceUpdate - The type used for update operations of the StandbyVirtualMachinePoolResource. type StandbyVirtualMachinePoolResourceUpdate struct { - // The updatable properties of the StandbyVirtualMachinePoolResource. + // The resource-specific properties for this resource. Properties *StandbyVirtualMachinePoolResourceUpdateProperties // Resource tags. @@ -251,24 +275,68 @@ type StandbyVirtualMachinePoolResourceUpdateProperties struct { AttachedVirtualMachineScaleSetID *string // Specifies the elasticity profile of the standby virtual machine pools. - ElasticityProfile *StandbyVirtualMachinePoolElasticityProfileUpdate + ElasticityProfile *StandbyVirtualMachinePoolElasticityProfile // Specifies the desired state of virtual machines in the pool. VirtualMachineState *VirtualMachineState } +// StandbyVirtualMachinePoolRuntimeViewResource - Contains information about a standby virtual machine pool as last known +// by the StandbyPool resource provider. +type StandbyVirtualMachinePoolRuntimeViewResource struct { + // The resource-specific properties for this resource. + Properties *StandbyVirtualMachinePoolRuntimeViewResourceProperties + + // READ-ONLY; The unique identifier for the runtime view. The input string should be the word 'latest', which will get the + // latest runtime view of the pool, otherwise the request will fail with NotFound exception. + Name *string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// StandbyVirtualMachinePoolRuntimeViewResourceListResult - The response of a StandbyVirtualMachinePoolRuntimeViewResource +// list operation. +type StandbyVirtualMachinePoolRuntimeViewResourceListResult struct { + // REQUIRED; The StandbyVirtualMachinePoolRuntimeViewResource items on this page + Value []*StandbyVirtualMachinePoolRuntimeViewResource + + // The link to the next page of items + NextLink *string +} + +// StandbyVirtualMachinePoolRuntimeViewResourceProperties - Contains information about a standby pool as last known by the +// StandbyPool resource provider. +type StandbyVirtualMachinePoolRuntimeViewResourceProperties struct { + // READ-ONLY; A list containing the counts of virtual machines in each possible power state for each zone if enabled, as known + // by the StandbyPool resource provider. + // If zones are not enabled on the attached VMSS, the list will contain a single entry with null zone values. + // Note: any updates to pool resources outside of StandbyPoolRP (i.e deleting a VM through portal) are not reflected here. + // Note: any resources in the Running state may still be installing extensions / not fully provisioned. + InstanceCountSummary []*VirtualMachineInstanceCountSummary + + // READ-ONLY; Displays the provisioning state of the standby pool + ProvisioningState *ProvisioningState +} + // StandbyVirtualMachineResource - Concrete proxy resource types can be created by aliasing this type using a specific property // type. type StandbyVirtualMachineResource struct { // The resource-specific properties for this resource. Properties *StandbyVirtualMachineResourceProperties - // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" - ID *string - - // READ-ONLY; The name of the resource + // READ-ONLY; Name of the standby virtual machine Name *string + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData @@ -281,7 +349,7 @@ type StandbyVirtualMachineResourceListResult struct { // REQUIRED; The StandbyVirtualMachineResource items on this page Value []*StandbyVirtualMachineResource - // READ-ONLY; The link to the next page of items + // The link to the next page of items NextLink *string } @@ -320,3 +388,15 @@ type SystemData struct { // The type of identity that last modified the resource. LastModifiedByType *CreatedByType } + +// VirtualMachineInstanceCountSummary - Contains the counts of VMs in each power state in a given zone, fault domain, as known +// by the StandbyPool resource provider. +// Note: any updates to pool resources outside of StandbyPoolRP (i.e deleting a VM through portal) are not reflected here. +// Note: any resources in the Running state may still be installing extensions / not fully provisioned. +type VirtualMachineInstanceCountSummary struct { + // REQUIRED; The count of pooled resources in each state for the given zone. + InstanceCountsByState []*PoolResourceStateCount + + // The zone that the provided counts are in. This is null if zones are not enabled on the attached VMSS. + Zone *int64 +} diff --git a/sdk/resourcemanager/standbypool/armstandbypool/models_serde.go b/sdk/resourcemanager/standbypool/armstandbypool/models_serde.go index 6ada58efb903..68608bfe94b4 100644 --- a/sdk/resourcemanager/standbypool/armstandbypool/models_serde.go +++ b/sdk/resourcemanager/standbypool/armstandbypool/models_serde.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armstandbypool @@ -15,16 +11,15 @@ import ( "reflect" ) -// MarshalJSON implements the json.Marshaller interface for type ContainerGroupProfile. -func (c ContainerGroupProfile) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ContainerGroupInstanceCountSummary. +func (c ContainerGroupInstanceCountSummary) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", c.ID) - populate(objectMap, "revision", c.Revision) + populate(objectMap, "instanceCountsByState", c.InstanceCountsByState) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerGroupProfile. -func (c *ContainerGroupProfile) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerGroupInstanceCountSummary. +func (c *ContainerGroupInstanceCountSummary) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -32,11 +27,8 @@ func (c *ContainerGroupProfile) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &c.ID) - delete(rawMsg, key) - case "revision": - err = unpopulate(val, "Revision", &c.Revision) + case "instanceCountsByState": + err = unpopulate(val, "InstanceCountsByState", &c.InstanceCountsByState) delete(rawMsg, key) } if err != nil { @@ -46,16 +38,16 @@ func (c *ContainerGroupProfile) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ContainerGroupProfileUpdate. -func (c ContainerGroupProfileUpdate) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ContainerGroupProfile. +func (c ContainerGroupProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", c.ID) populate(objectMap, "revision", c.Revision) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerGroupProfileUpdate. -func (c *ContainerGroupProfileUpdate) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerGroupProfile. +func (c *ContainerGroupProfile) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -108,37 +100,6 @@ func (c *ContainerGroupProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ContainerGroupPropertiesUpdate. -func (c ContainerGroupPropertiesUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "containerGroupProfile", c.ContainerGroupProfile) - populate(objectMap, "subnetIds", c.SubnetIDs) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerGroupPropertiesUpdate. -func (c *ContainerGroupPropertiesUpdate) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "containerGroupProfile": - err = unpopulate(val, "ContainerGroupProfile", &c.ContainerGroupProfile) - delete(rawMsg, key) - case "subnetIds": - err = unpopulate(val, "SubnetIDs", &c.SubnetIDs) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type Operation. func (o Operation) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -252,47 +213,47 @@ func (o *OperationListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type StandbyContainerGroupPoolElasticityProfile. -func (s StandbyContainerGroupPoolElasticityProfile) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PoolResourceStateCount. +func (p PoolResourceStateCount) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "maxReadyCapacity", s.MaxReadyCapacity) - populate(objectMap, "refillPolicy", s.RefillPolicy) + populate(objectMap, "count", p.Count) + populate(objectMap, "state", p.State) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type StandbyContainerGroupPoolElasticityProfile. -func (s *StandbyContainerGroupPoolElasticityProfile) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PoolResourceStateCount. +func (p *PoolResourceStateCount) 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) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "maxReadyCapacity": - err = unpopulate(val, "MaxReadyCapacity", &s.MaxReadyCapacity) + case "count": + err = unpopulate(val, "Count", &p.Count) delete(rawMsg, key) - case "refillPolicy": - err = unpopulate(val, "RefillPolicy", &s.RefillPolicy) + case "state": + err = unpopulate(val, "State", &p.State) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type StandbyContainerGroupPoolElasticityProfileUpdate. -func (s StandbyContainerGroupPoolElasticityProfileUpdate) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type StandbyContainerGroupPoolElasticityProfile. +func (s StandbyContainerGroupPoolElasticityProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "maxReadyCapacity", s.MaxReadyCapacity) populate(objectMap, "refillPolicy", s.RefillPolicy) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type StandbyContainerGroupPoolElasticityProfileUpdate. -func (s *StandbyContainerGroupPoolElasticityProfileUpdate) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type StandbyContainerGroupPoolElasticityProfile. +func (s *StandbyContainerGroupPoolElasticityProfile) 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) @@ -493,15 +454,19 @@ func (s *StandbyContainerGroupPoolResourceUpdateProperties) UnmarshalJSON(data [ return nil } -// MarshalJSON implements the json.Marshaller interface for type StandbyVirtualMachinePoolElasticityProfile. -func (s StandbyVirtualMachinePoolElasticityProfile) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type StandbyContainerGroupPoolRuntimeViewResource. +func (s StandbyContainerGroupPoolRuntimeViewResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "maxReadyCapacity", s.MaxReadyCapacity) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "type", s.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type StandbyVirtualMachinePoolElasticityProfile. -func (s *StandbyVirtualMachinePoolElasticityProfile) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type StandbyContainerGroupPoolRuntimeViewResource. +func (s *StandbyContainerGroupPoolRuntimeViewResource) 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) @@ -509,8 +474,82 @@ func (s *StandbyVirtualMachinePoolElasticityProfile) UnmarshalJSON(data []byte) for key, val := range rawMsg { var err error switch key { - case "maxReadyCapacity": - err = unpopulate(val, "MaxReadyCapacity", &s.MaxReadyCapacity) + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + 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 StandbyContainerGroupPoolRuntimeViewResourceListResult. +func (s StandbyContainerGroupPoolRuntimeViewResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StandbyContainerGroupPoolRuntimeViewResourceListResult. +func (s *StandbyContainerGroupPoolRuntimeViewResourceListResult) 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 "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + 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 StandbyContainerGroupPoolRuntimeViewResourceProperties. +func (s StandbyContainerGroupPoolRuntimeViewResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "instanceCountSummary", s.InstanceCountSummary) + populate(objectMap, "provisioningState", s.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StandbyContainerGroupPoolRuntimeViewResourceProperties. +func (s *StandbyContainerGroupPoolRuntimeViewResourceProperties) 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 "instanceCountSummary": + err = unpopulate(val, "InstanceCountSummary", &s.InstanceCountSummary) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) delete(rawMsg, key) } if err != nil { @@ -520,15 +559,16 @@ func (s *StandbyVirtualMachinePoolElasticityProfile) UnmarshalJSON(data []byte) return nil } -// MarshalJSON implements the json.Marshaller interface for type StandbyVirtualMachinePoolElasticityProfileUpdate. -func (s StandbyVirtualMachinePoolElasticityProfileUpdate) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type StandbyVirtualMachinePoolElasticityProfile. +func (s StandbyVirtualMachinePoolElasticityProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "maxReadyCapacity", s.MaxReadyCapacity) + populate(objectMap, "minReadyCapacity", s.MinReadyCapacity) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type StandbyVirtualMachinePoolElasticityProfileUpdate. -func (s *StandbyVirtualMachinePoolElasticityProfileUpdate) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type StandbyVirtualMachinePoolElasticityProfile. +func (s *StandbyVirtualMachinePoolElasticityProfile) 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) @@ -539,6 +579,9 @@ func (s *StandbyVirtualMachinePoolElasticityProfileUpdate) UnmarshalJSON(data [] case "maxReadyCapacity": err = unpopulate(val, "MaxReadyCapacity", &s.MaxReadyCapacity) delete(rawMsg, key) + case "minReadyCapacity": + err = unpopulate(val, "MinReadyCapacity", &s.MinReadyCapacity) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -734,6 +777,111 @@ func (s *StandbyVirtualMachinePoolResourceUpdateProperties) UnmarshalJSON(data [ return nil } +// MarshalJSON implements the json.Marshaller interface for type StandbyVirtualMachinePoolRuntimeViewResource. +func (s StandbyVirtualMachinePoolRuntimeViewResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StandbyVirtualMachinePoolRuntimeViewResource. +func (s *StandbyVirtualMachinePoolRuntimeViewResource) 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 "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + 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 StandbyVirtualMachinePoolRuntimeViewResourceListResult. +func (s StandbyVirtualMachinePoolRuntimeViewResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StandbyVirtualMachinePoolRuntimeViewResourceListResult. +func (s *StandbyVirtualMachinePoolRuntimeViewResourceListResult) 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 "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + 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 StandbyVirtualMachinePoolRuntimeViewResourceProperties. +func (s StandbyVirtualMachinePoolRuntimeViewResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "instanceCountSummary", s.InstanceCountSummary) + populate(objectMap, "provisioningState", s.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StandbyVirtualMachinePoolRuntimeViewResourceProperties. +func (s *StandbyVirtualMachinePoolRuntimeViewResourceProperties) 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 "instanceCountSummary": + err = unpopulate(val, "InstanceCountSummary", &s.InstanceCountSummary) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + 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 StandbyVirtualMachineResource. func (s StandbyVirtualMachineResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -913,6 +1061,37 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineInstanceCountSummary. +func (v VirtualMachineInstanceCountSummary) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "instanceCountsByState", v.InstanceCountsByState) + populate(objectMap, "zone", v.Zone) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineInstanceCountSummary. +func (v *VirtualMachineInstanceCountSummary) 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", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "instanceCountsByState": + err = unpopulate(val, "InstanceCountsByState", &v.InstanceCountsByState) + delete(rawMsg, key) + case "zone": + err = unpopulate(val, "Zone", &v.Zone) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + func populate(m map[string]any, k string, v any) { if v == nil { return diff --git a/sdk/resourcemanager/standbypool/armstandbypool/operations_client.go b/sdk/resourcemanager/standbypool/armstandbypool/operations_client.go index d42322d11641..c1f9becb7960 100644 --- a/sdk/resourcemanager/standbypool/armstandbypool/operations_client.go +++ b/sdk/resourcemanager/standbypool/armstandbypool/operations_client.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armstandbypool @@ -39,7 +35,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - List the operations for the provider // -// Generated from API version 2023-12-01-preview +// Generated from API version 2024-03-01 // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -65,14 +61,14 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption } // listCreateRequest creates the List request. -func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { +func (client *OperationsClient) listCreateRequest(ctx context.Context, _ *OperationsClientListOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.StandbyPool/operations" req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-12-01-preview") + reqQP.Set("api-version", "2024-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/standbypool/armstandbypool/operations_client_example_test.go b/sdk/resourcemanager/standbypool/armstandbypool/operations_client_example_test.go index 1293c0bb9277..1e4f38ef6dca 100644 --- a/sdk/resourcemanager/standbypool/armstandbypool/operations_client_example_test.go +++ b/sdk/resourcemanager/standbypool/armstandbypool/operations_client_example_test.go @@ -1,30 +1,24 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armstandbypool_test import ( "context" - "log" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/standbypool/armstandbypool" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/standbypool/resource-manager/Microsoft.StandbyPool/preview/2023-12-01-preview/examples/Operations_List.json +// Generated from example definition: 2024-03-01/Operations_List.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 := armstandbypool.NewClientFactory("", cred, nil) + clientFactory, err := armstandbypool.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -39,20 +33,24 @@ func ExampleOperationsClient_NewListPager() { _ = v } // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OperationListResult = armstandbypool.OperationListResult{ - // Value: []*armstandbypool.Operation{ - // { - // Name: to.Ptr("Microsoft.StandbyPool/standbyContainerGroupPools/write"), - // ActionType: to.Ptr(armstandbypool.ActionTypeInternal), - // Display: &armstandbypool.OperationDisplay{ - // Description: to.Ptr("Create a StandbyContainerGroupPools Resource"), - // Operation: to.Ptr("StandbyContainerGroupPools_Create"), - // Provider: to.Ptr("Microsoft.StandbyPool"), - // Resource: to.Ptr("standbyContainerGroupPools"), + // page = armstandbypool.OperationsClientListResponse{ + // OperationListResult: armstandbypool.OperationListResult{ + // Value: []*armstandbypool.Operation{ + // { + // Name: to.Ptr("Microsoft.StandbyPool/standbyContainerGroupPools/write"), + // IsDataAction: to.Ptr(true), + // Display: &armstandbypool.OperationDisplay{ + // Provider: to.Ptr("Microsoft.StandbyPool"), + // Resource: to.Ptr("standbyContainerGroupPools"), + // Operation: to.Ptr("StandbyContainerGroupPools_Create"), + // Description: to.Ptr("Create a StandbyContainerGroupPools Resource"), + // }, + // Origin: to.Ptr(armstandbypool.OriginUser), + // ActionType: to.Ptr(armstandbypool.ActionTypeInternal), // }, - // IsDataAction: to.Ptr(true), - // Origin: to.Ptr(armstandbypool.OriginUser), - // }}, + // }, + // NextLink: to.Ptr("https://example.com/providers/Microsoft.StandbyPool/operations"), + // }, // } } } diff --git a/sdk/resourcemanager/standbypool/armstandbypool/options.go b/sdk/resourcemanager/standbypool/armstandbypool/options.go index 9c96fe7d61da..b282b85942c8 100644 --- a/sdk/resourcemanager/standbypool/armstandbypool/options.go +++ b/sdk/resourcemanager/standbypool/armstandbypool/options.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armstandbypool @@ -13,17 +9,29 @@ type OperationsClientListOptions struct { // placeholder for future optional parameters } +// StandbyContainerGroupPoolRuntimeViewsClientGetOptions contains the optional parameters for the StandbyContainerGroupPoolRuntimeViewsClient.Get +// method. +type StandbyContainerGroupPoolRuntimeViewsClientGetOptions struct { + // placeholder for future optional parameters +} + +// StandbyContainerGroupPoolRuntimeViewsClientListByStandbyPoolOptions contains the optional parameters for the StandbyContainerGroupPoolRuntimeViewsClient.NewListByStandbyPoolPager +// method. +type StandbyContainerGroupPoolRuntimeViewsClientListByStandbyPoolOptions struct { + // placeholder for future optional parameters +} + // StandbyContainerGroupPoolsClientBeginCreateOrUpdateOptions contains the optional parameters for the StandbyContainerGroupPoolsClient.BeginCreateOrUpdate // method. type StandbyContainerGroupPoolsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // StandbyContainerGroupPoolsClientBeginDeleteOptions contains the optional parameters for the StandbyContainerGroupPoolsClient.BeginDelete // method. type StandbyContainerGroupPoolsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -51,17 +59,29 @@ type StandbyContainerGroupPoolsClientUpdateOptions struct { // placeholder for future optional parameters } +// StandbyVirtualMachinePoolRuntimeViewsClientGetOptions contains the optional parameters for the StandbyVirtualMachinePoolRuntimeViewsClient.Get +// method. +type StandbyVirtualMachinePoolRuntimeViewsClientGetOptions struct { + // placeholder for future optional parameters +} + +// StandbyVirtualMachinePoolRuntimeViewsClientListByStandbyPoolOptions contains the optional parameters for the StandbyVirtualMachinePoolRuntimeViewsClient.NewListByStandbyPoolPager +// method. +type StandbyVirtualMachinePoolRuntimeViewsClientListByStandbyPoolOptions struct { + // placeholder for future optional parameters +} + // StandbyVirtualMachinePoolsClientBeginCreateOrUpdateOptions contains the optional parameters for the StandbyVirtualMachinePoolsClient.BeginCreateOrUpdate // method. type StandbyVirtualMachinePoolsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // StandbyVirtualMachinePoolsClientBeginDeleteOptions contains the optional parameters for the StandbyVirtualMachinePoolsClient.BeginDelete // method. type StandbyVirtualMachinePoolsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } diff --git a/sdk/resourcemanager/standbypool/armstandbypool/responses.go b/sdk/resourcemanager/standbypool/armstandbypool/responses.go index dfefa3073208..a085c3b1f795 100644 --- a/sdk/resourcemanager/standbypool/armstandbypool/responses.go +++ b/sdk/resourcemanager/standbypool/armstandbypool/responses.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armstandbypool @@ -14,6 +10,18 @@ type OperationsClientListResponse struct { OperationListResult } +// StandbyContainerGroupPoolRuntimeViewsClientGetResponse contains the response from method StandbyContainerGroupPoolRuntimeViewsClient.Get. +type StandbyContainerGroupPoolRuntimeViewsClientGetResponse struct { + // Contains information about a standby container group pool as last known by the StandbyPool resource provider. + StandbyContainerGroupPoolRuntimeViewResource +} + +// StandbyContainerGroupPoolRuntimeViewsClientListByStandbyPoolResponse contains the response from method StandbyContainerGroupPoolRuntimeViewsClient.NewListByStandbyPoolPager. +type StandbyContainerGroupPoolRuntimeViewsClientListByStandbyPoolResponse struct { + // The response of a StandbyContainerGroupPoolRuntimeViewResource list operation. + StandbyContainerGroupPoolRuntimeViewResourceListResult +} + // StandbyContainerGroupPoolsClientCreateOrUpdateResponse contains the response from method StandbyContainerGroupPoolsClient.BeginCreateOrUpdate. type StandbyContainerGroupPoolsClientCreateOrUpdateResponse struct { // A StandbyContainerGroupPoolResource. @@ -49,6 +57,18 @@ type StandbyContainerGroupPoolsClientUpdateResponse struct { StandbyContainerGroupPoolResource } +// StandbyVirtualMachinePoolRuntimeViewsClientGetResponse contains the response from method StandbyVirtualMachinePoolRuntimeViewsClient.Get. +type StandbyVirtualMachinePoolRuntimeViewsClientGetResponse struct { + // Contains information about a standby virtual machine pool as last known by the StandbyPool resource provider. + StandbyVirtualMachinePoolRuntimeViewResource +} + +// StandbyVirtualMachinePoolRuntimeViewsClientListByStandbyPoolResponse contains the response from method StandbyVirtualMachinePoolRuntimeViewsClient.NewListByStandbyPoolPager. +type StandbyVirtualMachinePoolRuntimeViewsClientListByStandbyPoolResponse struct { + // The response of a StandbyVirtualMachinePoolRuntimeViewResource list operation. + StandbyVirtualMachinePoolRuntimeViewResourceListResult +} + // StandbyVirtualMachinePoolsClientCreateOrUpdateResponse contains the response from method StandbyVirtualMachinePoolsClient.BeginCreateOrUpdate. type StandbyVirtualMachinePoolsClientCreateOrUpdateResponse struct { // A StandbyVirtualMachinePoolResource. diff --git a/sdk/resourcemanager/standbypool/armstandbypool/standbycontainergrouppoolruntimeviews_client.go b/sdk/resourcemanager/standbypool/armstandbypool/standbycontainergrouppoolruntimeviews_client.go new file mode 100644 index 000000000000..b7db3da18b5f --- /dev/null +++ b/sdk/resourcemanager/standbypool/armstandbypool/standbycontainergrouppoolruntimeviews_client.go @@ -0,0 +1,176 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armstandbypool + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// StandbyContainerGroupPoolRuntimeViewsClient contains the methods for the StandbyContainerGroupPoolRuntimeViews group. +// Don't use this type directly, use NewStandbyContainerGroupPoolRuntimeViewsClient() instead. +type StandbyContainerGroupPoolRuntimeViewsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewStandbyContainerGroupPoolRuntimeViewsClient creates a new instance of StandbyContainerGroupPoolRuntimeViewsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewStandbyContainerGroupPoolRuntimeViewsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*StandbyContainerGroupPoolRuntimeViewsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &StandbyContainerGroupPoolRuntimeViewsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Get a StandbyContainerGroupPoolRuntimeViewResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-03-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - standbyContainerGroupPoolName - Name of the standby container group pool +// - runtimeView - The unique identifier for the runtime view. The input string should be the word 'latest', which will get +// the latest runtime view of the pool, otherwise the request will fail with NotFound exception. +// - options - StandbyContainerGroupPoolRuntimeViewsClientGetOptions contains the optional parameters for the StandbyContainerGroupPoolRuntimeViewsClient.Get +// method. +func (client *StandbyContainerGroupPoolRuntimeViewsClient) Get(ctx context.Context, resourceGroupName string, standbyContainerGroupPoolName string, runtimeView string, options *StandbyContainerGroupPoolRuntimeViewsClientGetOptions) (StandbyContainerGroupPoolRuntimeViewsClientGetResponse, error) { + var err error + const operationName = "StandbyContainerGroupPoolRuntimeViewsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, standbyContainerGroupPoolName, runtimeView, options) + if err != nil { + return StandbyContainerGroupPoolRuntimeViewsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return StandbyContainerGroupPoolRuntimeViewsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return StandbyContainerGroupPoolRuntimeViewsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *StandbyContainerGroupPoolRuntimeViewsClient) getCreateRequest(ctx context.Context, resourceGroupName string, standbyContainerGroupPoolName string, runtimeView string, _ *StandbyContainerGroupPoolRuntimeViewsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName}/runtimeViews/{runtimeView}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if standbyContainerGroupPoolName == "" { + return nil, errors.New("parameter standbyContainerGroupPoolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{standbyContainerGroupPoolName}", url.PathEscape(standbyContainerGroupPoolName)) + if runtimeView == "" { + return nil, errors.New("parameter runtimeView cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{runtimeView}", url.PathEscape(runtimeView)) + 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-03-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *StandbyContainerGroupPoolRuntimeViewsClient) getHandleResponse(resp *http.Response) (StandbyContainerGroupPoolRuntimeViewsClientGetResponse, error) { + result := StandbyContainerGroupPoolRuntimeViewsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.StandbyContainerGroupPoolRuntimeViewResource); err != nil { + return StandbyContainerGroupPoolRuntimeViewsClientGetResponse{}, err + } + return result, nil +} + +// NewListByStandbyPoolPager - List StandbyContainerGroupPoolRuntimeViewResource resources by StandbyContainerGroupPoolResource +// +// Generated from API version 2024-03-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - standbyContainerGroupPoolName - Name of the standby container group pool +// - options - StandbyContainerGroupPoolRuntimeViewsClientListByStandbyPoolOptions contains the optional parameters for the +// StandbyContainerGroupPoolRuntimeViewsClient.NewListByStandbyPoolPager method. +func (client *StandbyContainerGroupPoolRuntimeViewsClient) NewListByStandbyPoolPager(resourceGroupName string, standbyContainerGroupPoolName string, options *StandbyContainerGroupPoolRuntimeViewsClientListByStandbyPoolOptions) *runtime.Pager[StandbyContainerGroupPoolRuntimeViewsClientListByStandbyPoolResponse] { + return runtime.NewPager(runtime.PagingHandler[StandbyContainerGroupPoolRuntimeViewsClientListByStandbyPoolResponse]{ + More: func(page StandbyContainerGroupPoolRuntimeViewsClientListByStandbyPoolResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *StandbyContainerGroupPoolRuntimeViewsClientListByStandbyPoolResponse) (StandbyContainerGroupPoolRuntimeViewsClientListByStandbyPoolResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "StandbyContainerGroupPoolRuntimeViewsClient.NewListByStandbyPoolPager") + 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.listByStandbyPoolCreateRequest(ctx, resourceGroupName, standbyContainerGroupPoolName, options) + }, nil) + if err != nil { + return StandbyContainerGroupPoolRuntimeViewsClientListByStandbyPoolResponse{}, err + } + return client.listByStandbyPoolHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByStandbyPoolCreateRequest creates the ListByStandbyPool request. +func (client *StandbyContainerGroupPoolRuntimeViewsClient) listByStandbyPoolCreateRequest(ctx context.Context, resourceGroupName string, standbyContainerGroupPoolName string, _ *StandbyContainerGroupPoolRuntimeViewsClientListByStandbyPoolOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName}/runtimeViews" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if standbyContainerGroupPoolName == "" { + return nil, errors.New("parameter standbyContainerGroupPoolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{standbyContainerGroupPoolName}", url.PathEscape(standbyContainerGroupPoolName)) + 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-03-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByStandbyPoolHandleResponse handles the ListByStandbyPool response. +func (client *StandbyContainerGroupPoolRuntimeViewsClient) listByStandbyPoolHandleResponse(resp *http.Response) (StandbyContainerGroupPoolRuntimeViewsClientListByStandbyPoolResponse, error) { + result := StandbyContainerGroupPoolRuntimeViewsClientListByStandbyPoolResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.StandbyContainerGroupPoolRuntimeViewResourceListResult); err != nil { + return StandbyContainerGroupPoolRuntimeViewsClientListByStandbyPoolResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/standbypool/armstandbypool/standbycontainergrouppoolruntimeviews_client_example_test.go b/sdk/resourcemanager/standbypool/armstandbypool/standbycontainergrouppoolruntimeviews_client_example_test.go new file mode 100644 index 000000000000..4f86c5ef010c --- /dev/null +++ b/sdk/resourcemanager/standbypool/armstandbypool/standbycontainergrouppoolruntimeviews_client_example_test.go @@ -0,0 +1,134 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armstandbypool_test + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/standbypool/armstandbypool" + "log" +) + +// Generated from example definition: 2024-03-01/StandbyContainerGroupPoolRuntimeViews_Get.json +func ExampleStandbyContainerGroupPoolRuntimeViewsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armstandbypool.NewClientFactory("00000000-0000-0000-0000-000000000009", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewStandbyContainerGroupPoolRuntimeViewsClient().Get(ctx, "rgstandbypool", "pool", "latest", 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 = armstandbypool.StandbyContainerGroupPoolRuntimeViewsClientGetResponse{ + // StandbyContainerGroupPoolRuntimeViewResource: &armstandbypool.StandbyContainerGroupPoolRuntimeViewResource{ + // Properties: &armstandbypool.StandbyContainerGroupPoolRuntimeViewResourceProperties{ + // InstanceCountSummary: []*armstandbypool.ContainerGroupInstanceCountSummary{ + // { + // InstanceCountsByState: []*armstandbypool.PoolResourceStateCount{ + // { + // State: to.Ptr("creating"), + // Count: to.Ptr[int64](100), + // }, + // { + // State: to.Ptr("running"), + // Count: to.Ptr[int64](500), + // }, + // { + // State: to.Ptr("deleting"), + // Count: to.Ptr[int64](20), + // }, + // }, + // }, + // }, + // ProvisioningState: to.Ptr(armstandbypool.ProvisioningStateSucceeded), + // }, + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000009/resourceGroups/rgstandbypool/providers/Microsoft.StandbyPool/standbyContainerGroupPools/pool/runtimeViews/latest"), + // Name: to.Ptr("pool"), + // Type: to.Ptr("Microsoft.StandbyPool/standbyContainerGroupPools/runtimeViews"), + // SystemData: &armstandbypool.SystemData{ + // CreatedBy: to.Ptr("pooluser@microsoft.com"), + // CreatedByType: to.Ptr(armstandbypool.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-07T16:33:22.210Z"); return t}()), + // LastModifiedBy: to.Ptr("pooluser@microsoft.com"), + // LastModifiedByType: to.Ptr(armstandbypool.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-07T16:33:22.210Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2024-03-01/StandbyContainerGroupPoolRuntimeViews_ListByStandbyPool.json +func ExampleStandbyContainerGroupPoolRuntimeViewsClient_NewListByStandbyPoolPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armstandbypool.NewClientFactory("00000000-0000-0000-0000-000000000009", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewStandbyContainerGroupPoolRuntimeViewsClient().NewListByStandbyPoolPager("rgstandbypool", "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 = armstandbypool.StandbyContainerGroupPoolRuntimeViewsClientListByStandbyPoolResponse{ + // StandbyContainerGroupPoolRuntimeViewResourceListResult: armstandbypool.StandbyContainerGroupPoolRuntimeViewResourceListResult{ + // Value: []*armstandbypool.StandbyContainerGroupPoolRuntimeViewResource{ + // { + // Properties: &armstandbypool.StandbyContainerGroupPoolRuntimeViewResourceProperties{ + // InstanceCountSummary: []*armstandbypool.ContainerGroupInstanceCountSummary{ + // { + // InstanceCountsByState: []*armstandbypool.PoolResourceStateCount{ + // { + // State: to.Ptr("creating"), + // Count: to.Ptr[int64](100), + // }, + // { + // State: to.Ptr("running"), + // Count: to.Ptr[int64](500), + // }, + // { + // State: to.Ptr("deleting"), + // Count: to.Ptr[int64](20), + // }, + // }, + // }, + // }, + // ProvisioningState: to.Ptr(armstandbypool.ProvisioningStateSucceeded), + // }, + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000009/resourceGroups/rgstandbypool/providers/Microsoft.StandbyPool/standbyContainerGroupPools/pool/runtimeViews/latest"), + // Name: to.Ptr("pool"), + // Type: to.Ptr("Microsoft.StandbyPool/standbyContainerGroupPools/runtimeViews"), + // SystemData: &armstandbypool.SystemData{ + // CreatedBy: to.Ptr("pooluser@microsoft.com"), + // CreatedByType: to.Ptr(armstandbypool.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-07T16:33:22.210Z"); return t}()), + // LastModifiedBy: to.Ptr("pooluser@microsoft.com"), + // LastModifiedByType: to.Ptr(armstandbypool.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-07T16:33:22.210Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} diff --git a/sdk/resourcemanager/standbypool/armstandbypool/standbycontainergrouppools_client.go b/sdk/resourcemanager/standbypool/armstandbypool/standbycontainergrouppools_client.go index 909d02439519..9d3abf61f731 100644 --- a/sdk/resourcemanager/standbypool/armstandbypool/standbycontainergrouppools_client.go +++ b/sdk/resourcemanager/standbypool/armstandbypool/standbycontainergrouppools_client.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armstandbypool @@ -46,7 +42,7 @@ func NewStandbyContainerGroupPoolsClient(subscriptionID string, credential azcor // BeginCreateOrUpdate - Create a StandbyContainerGroupPoolResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-12-01-preview +// Generated from API version 2024-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - standbyContainerGroupPoolName - Name of the standby container group pool // - resource - Resource create parameters. @@ -73,7 +69,7 @@ func (client *StandbyContainerGroupPoolsClient) BeginCreateOrUpdate(ctx context. // CreateOrUpdate - Create a StandbyContainerGroupPoolResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-12-01-preview +// Generated from API version 2024-03-01 func (client *StandbyContainerGroupPoolsClient) createOrUpdate(ctx context.Context, resourceGroupName string, standbyContainerGroupPoolName string, resource StandbyContainerGroupPoolResource, options *StandbyContainerGroupPoolsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "StandbyContainerGroupPoolsClient.BeginCreateOrUpdate" @@ -96,7 +92,7 @@ func (client *StandbyContainerGroupPoolsClient) createOrUpdate(ctx context.Conte } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *StandbyContainerGroupPoolsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, standbyContainerGroupPoolName string, resource StandbyContainerGroupPoolResource, options *StandbyContainerGroupPoolsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *StandbyContainerGroupPoolsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, standbyContainerGroupPoolName string, resource StandbyContainerGroupPoolResource, _ *StandbyContainerGroupPoolsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -115,9 +111,10 @@ func (client *StandbyContainerGroupPoolsClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-12-01-preview") + reqQP.Set("api-version", "2024-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, resource); err != nil { return nil, err } @@ -127,7 +124,7 @@ func (client *StandbyContainerGroupPoolsClient) createOrUpdateCreateRequest(ctx // BeginDelete - Delete a StandbyContainerGroupPoolResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-12-01-preview +// Generated from API version 2024-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - standbyContainerGroupPoolName - Name of the standby container group pool // - options - StandbyContainerGroupPoolsClientBeginDeleteOptions contains the optional parameters for the StandbyContainerGroupPoolsClient.BeginDelete @@ -139,8 +136,7 @@ func (client *StandbyContainerGroupPoolsClient) BeginDelete(ctx context.Context, return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[StandbyContainerGroupPoolsClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -153,7 +149,7 @@ func (client *StandbyContainerGroupPoolsClient) BeginDelete(ctx context.Context, // Delete - Delete a StandbyContainerGroupPoolResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-12-01-preview +// Generated from API version 2024-03-01 func (client *StandbyContainerGroupPoolsClient) deleteOperation(ctx context.Context, resourceGroupName string, standbyContainerGroupPoolName string, options *StandbyContainerGroupPoolsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "StandbyContainerGroupPoolsClient.BeginDelete" @@ -176,7 +172,7 @@ func (client *StandbyContainerGroupPoolsClient) deleteOperation(ctx context.Cont } // deleteCreateRequest creates the Delete request. -func (client *StandbyContainerGroupPoolsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, standbyContainerGroupPoolName string, options *StandbyContainerGroupPoolsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *StandbyContainerGroupPoolsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, standbyContainerGroupPoolName string, _ *StandbyContainerGroupPoolsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -195,7 +191,7 @@ func (client *StandbyContainerGroupPoolsClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-12-01-preview") + reqQP.Set("api-version", "2024-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -204,7 +200,7 @@ func (client *StandbyContainerGroupPoolsClient) deleteCreateRequest(ctx context. // Get - Get a StandbyContainerGroupPoolResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-12-01-preview +// Generated from API version 2024-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - standbyContainerGroupPoolName - Name of the standby container group pool // - options - StandbyContainerGroupPoolsClientGetOptions contains the optional parameters for the StandbyContainerGroupPoolsClient.Get @@ -232,7 +228,7 @@ func (client *StandbyContainerGroupPoolsClient) Get(ctx context.Context, resourc } // getCreateRequest creates the Get request. -func (client *StandbyContainerGroupPoolsClient) getCreateRequest(ctx context.Context, resourceGroupName string, standbyContainerGroupPoolName string, options *StandbyContainerGroupPoolsClientGetOptions) (*policy.Request, error) { +func (client *StandbyContainerGroupPoolsClient) getCreateRequest(ctx context.Context, resourceGroupName string, standbyContainerGroupPoolName string, _ *StandbyContainerGroupPoolsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -251,7 +247,7 @@ func (client *StandbyContainerGroupPoolsClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-12-01-preview") + reqQP.Set("api-version", "2024-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -268,7 +264,7 @@ func (client *StandbyContainerGroupPoolsClient) getHandleResponse(resp *http.Res // NewListByResourceGroupPager - List StandbyContainerGroupPoolResource resources by resource group // -// Generated from API version 2023-12-01-preview +// Generated from API version 2024-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - StandbyContainerGroupPoolsClientListByResourceGroupOptions contains the optional parameters for the StandbyContainerGroupPoolsClient.NewListByResourceGroupPager // method. @@ -296,7 +292,7 @@ func (client *StandbyContainerGroupPoolsClient) NewListByResourceGroupPager(reso } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *StandbyContainerGroupPoolsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *StandbyContainerGroupPoolsClientListByResourceGroupOptions) (*policy.Request, error) { +func (client *StandbyContainerGroupPoolsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *StandbyContainerGroupPoolsClientListByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -311,7 +307,7 @@ func (client *StandbyContainerGroupPoolsClient) listByResourceGroupCreateRequest return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-12-01-preview") + reqQP.Set("api-version", "2024-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -328,7 +324,7 @@ func (client *StandbyContainerGroupPoolsClient) listByResourceGroupHandleRespons // NewListBySubscriptionPager - List StandbyContainerGroupPoolResource resources by subscription ID // -// Generated from API version 2023-12-01-preview +// Generated from API version 2024-03-01 // - options - StandbyContainerGroupPoolsClientListBySubscriptionOptions contains the optional parameters for the StandbyContainerGroupPoolsClient.NewListBySubscriptionPager // method. func (client *StandbyContainerGroupPoolsClient) NewListBySubscriptionPager(options *StandbyContainerGroupPoolsClientListBySubscriptionOptions) *runtime.Pager[StandbyContainerGroupPoolsClientListBySubscriptionResponse] { @@ -355,7 +351,7 @@ func (client *StandbyContainerGroupPoolsClient) NewListBySubscriptionPager(optio } // listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *StandbyContainerGroupPoolsClient) listBySubscriptionCreateRequest(ctx context.Context, options *StandbyContainerGroupPoolsClientListBySubscriptionOptions) (*policy.Request, error) { +func (client *StandbyContainerGroupPoolsClient) listBySubscriptionCreateRequest(ctx context.Context, _ *StandbyContainerGroupPoolsClientListBySubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.StandbyPool/standbyContainerGroupPools" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -366,7 +362,7 @@ func (client *StandbyContainerGroupPoolsClient) listBySubscriptionCreateRequest( return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-12-01-preview") + reqQP.Set("api-version", "2024-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -384,7 +380,7 @@ func (client *StandbyContainerGroupPoolsClient) listBySubscriptionHandleResponse // Update - Update a StandbyContainerGroupPoolResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-12-01-preview +// Generated from API version 2024-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - standbyContainerGroupPoolName - Name of the standby container group pool // - properties - The resource properties to be updated. @@ -413,7 +409,7 @@ func (client *StandbyContainerGroupPoolsClient) Update(ctx context.Context, reso } // updateCreateRequest creates the Update request. -func (client *StandbyContainerGroupPoolsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, standbyContainerGroupPoolName string, properties StandbyContainerGroupPoolResourceUpdate, options *StandbyContainerGroupPoolsClientUpdateOptions) (*policy.Request, error) { +func (client *StandbyContainerGroupPoolsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, standbyContainerGroupPoolName string, properties StandbyContainerGroupPoolResourceUpdate, _ *StandbyContainerGroupPoolsClientUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -432,9 +428,10 @@ func (client *StandbyContainerGroupPoolsClient) updateCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-12-01-preview") + reqQP.Set("api-version", "2024-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, properties); err != nil { return nil, err } diff --git a/sdk/resourcemanager/standbypool/armstandbypool/standbycontainergrouppools_client_example_test.go b/sdk/resourcemanager/standbypool/armstandbypool/standbycontainergrouppools_client_example_test.go index 7094a15278c7..a1e2771f95c6 100644 --- a/sdk/resourcemanager/standbypool/armstandbypool/standbycontainergrouppools_client_example_test.go +++ b/sdk/resourcemanager/standbypool/armstandbypool/standbycontainergrouppools_client_example_test.go @@ -1,153 +1,126 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armstandbypool_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/standbypool/armstandbypool" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/standbypool/resource-manager/Microsoft.StandbyPool/preview/2023-12-01-preview/examples/StandbyContainerGroupPools_ListBySubscription.json -func ExampleStandbyContainerGroupPoolsClient_NewListBySubscriptionPager() { +// Generated from example definition: 2024-03-01/StandbyContainerGroupPools_CreateOrUpdate.json +func ExampleStandbyContainerGroupPoolsClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstandbypool.NewClientFactory("", cred, nil) + clientFactory, err := armstandbypool.NewClientFactory("00000000-0000-0000-0000-000000000009", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewStandbyContainerGroupPoolsClient().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.StandbyContainerGroupPoolResourceListResult = armstandbypool.StandbyContainerGroupPoolResourceListResult{ - // Value: []*armstandbypool.StandbyContainerGroupPoolResource{ - // { - // Name: to.Ptr("pool"), - // Type: to.Ptr("Microsoft.StandbyPool/standbyContainerGroupPools"), - // ID: to.Ptr("/subscriptions/8CC31D61-82D7-4B2B-B9DC-6B924DE7D229/resourceGroups/rgstandbypool/providers/Microsoft.StandbyPool/standbyContainerGroupPools/pool"), - // SystemData: &armstandbypool.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-07T16:33:22.210Z"); return t}()), - // CreatedBy: to.Ptr("pooluser@microsoft.com"), - // CreatedByType: to.Ptr(armstandbypool.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-07T16:33:22.210Z"); return t}()), - // LastModifiedBy: to.Ptr("pooluser@microsoft.com"), - // LastModifiedByType: to.Ptr(armstandbypool.CreatedByTypeUser), - // }, - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armstandbypool.StandbyContainerGroupPoolResourceProperties{ - // ContainerGroupProperties: &armstandbypool.ContainerGroupProperties{ - // ContainerGroupProfile: &armstandbypool.ContainerGroupProfile{ - // ID: to.Ptr("/subscriptions/8CC31D61-82D7-4B2B-B9DC-6B924DE7D229/resourceGroups/rgstandbypool/providers/Microsoft.ContainerInstance/containerGroupProfiles/cgProfile"), - // Revision: to.Ptr[int64](1), - // }, - // SubnetIDs: []*armstandbypool.Subnet{ - // { - // ID: to.Ptr("/subscriptions/8cf6c1b6-c80f-437c-87ad-45fbaff54f73/resourceGroups/rgstandbypool/providers/Microsoft.Network/virtualNetworks/cgSubnet/subnets/cgSubnet"), - // }}, - // }, - // ElasticityProfile: &armstandbypool.StandbyContainerGroupPoolElasticityProfile{ - // MaxReadyCapacity: to.Ptr[int64](688), - // RefillPolicy: to.Ptr(armstandbypool.RefillPolicyAlways), - // }, - // ProvisioningState: to.Ptr(armstandbypool.ProvisioningStateSucceeded), - // }, - // }}, - // } + poller, err := clientFactory.NewStandbyContainerGroupPoolsClient().BeginCreateOrUpdate(ctx, "rgstandbypool", "pool", armstandbypool.StandbyContainerGroupPoolResource{ + Properties: &armstandbypool.StandbyContainerGroupPoolResourceProperties{ + ElasticityProfile: &armstandbypool.StandbyContainerGroupPoolElasticityProfile{ + MaxReadyCapacity: to.Ptr[int64](688), + RefillPolicy: to.Ptr(armstandbypool.RefillPolicyAlways), + }, + ContainerGroupProperties: &armstandbypool.ContainerGroupProperties{ + ContainerGroupProfile: &armstandbypool.ContainerGroupProfile{ + ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000009/resourceGroups/rgstandbypool/providers/Microsoft.ContainerInstance/containerGroupProfiles/cgProfile"), + Revision: to.Ptr[int64](1), + }, + SubnetIDs: []*armstandbypool.Subnet{ + { + ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000009/resourceGroups/rgstandbypool/providers/Microsoft.Network/virtualNetworks/cgSubnet/subnets/cgSubnet"), + }, + }, + }, + }, + Tags: map[string]*string{}, + Location: to.Ptr("West US"), + }, 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 = armstandbypool.StandbyContainerGroupPoolsClientCreateOrUpdateResponse{ + // StandbyContainerGroupPoolResource: &armstandbypool.StandbyContainerGroupPoolResource{ + // Properties: &armstandbypool.StandbyContainerGroupPoolResourceProperties{ + // ElasticityProfile: &armstandbypool.StandbyContainerGroupPoolElasticityProfile{ + // MaxReadyCapacity: to.Ptr[int64](688), + // RefillPolicy: to.Ptr(armstandbypool.RefillPolicyAlways), + // }, + // ProvisioningState: to.Ptr(armstandbypool.ProvisioningStateSucceeded), + // ContainerGroupProperties: &armstandbypool.ContainerGroupProperties{ + // ContainerGroupProfile: &armstandbypool.ContainerGroupProfile{ + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000009/resourceGroups/rgstandbypool/providers/Microsoft.ContainerInstance/containerGroupProfiles/cgProfile"), + // Revision: to.Ptr[int64](1), + // }, + // SubnetIDs: []*armstandbypool.Subnet{ + // { + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000009/resourceGroups/rgstandbypool/providers/Microsoft.Network/virtualNetworks/cgSubnet/subnets/cgSubnet"), + // }, + // }, + // }, + // }, + // Tags: map[string]*string{ + // }, + // Location: to.Ptr("West US"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000009/resourceGroups/rgstandbypool/providers/Microsoft.StandbyPool/standbyContainerGroupPools/pool"), + // Name: to.Ptr("pool"), + // Type: to.Ptr("Microsoft.StandbyPool/standbyContainerGroupPools"), + // SystemData: &armstandbypool.SystemData{ + // CreatedBy: to.Ptr("pooluser@microsoft.com"), + // CreatedByType: to.Ptr(armstandbypool.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-07T16:33:22.210Z"); return t}()), + // LastModifiedBy: to.Ptr("pooluser@microsoft.com"), + // LastModifiedByType: to.Ptr(armstandbypool.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-07T16:33:22.210Z"); return t}()), + // }, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/standbypool/resource-manager/Microsoft.StandbyPool/preview/2023-12-01-preview/examples/StandbyContainerGroupPools_ListByResourceGroup.json -func ExampleStandbyContainerGroupPoolsClient_NewListByResourceGroupPager() { +// Generated from example definition: 2024-03-01/StandbyContainerGroupPools_Delete.json +func ExampleStandbyContainerGroupPoolsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstandbypool.NewClientFactory("", cred, nil) + clientFactory, err := armstandbypool.NewClientFactory("00000000-0000-0000-0000-000000000009", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewStandbyContainerGroupPoolsClient().NewListByResourceGroupPager("rgstandbypool", 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.StandbyContainerGroupPoolResourceListResult = armstandbypool.StandbyContainerGroupPoolResourceListResult{ - // Value: []*armstandbypool.StandbyContainerGroupPoolResource{ - // { - // Name: to.Ptr("pool"), - // Type: to.Ptr("Microsoft.StandbyPool/standbyContainerGroupPools"), - // ID: to.Ptr("/subscriptions/8CC31D61-82D7-4B2B-B9DC-6B924DE7D229/resourceGroups/rgstandbypool/providers/Microsoft.StandbyPool/standbyContainerGroupPools/pool"), - // SystemData: &armstandbypool.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-07T16:33:22.210Z"); return t}()), - // CreatedBy: to.Ptr("pooluser@microsoft.com"), - // CreatedByType: to.Ptr(armstandbypool.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-07T16:33:22.210Z"); return t}()), - // LastModifiedBy: to.Ptr("pooluser@microsoft.com"), - // LastModifiedByType: to.Ptr(armstandbypool.CreatedByTypeUser), - // }, - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armstandbypool.StandbyContainerGroupPoolResourceProperties{ - // ContainerGroupProperties: &armstandbypool.ContainerGroupProperties{ - // ContainerGroupProfile: &armstandbypool.ContainerGroupProfile{ - // ID: to.Ptr("/subscriptions/8CC31D61-82D7-4B2B-B9DC-6B924DE7D229/resourceGroups/rgstandbypool/providers/Microsoft.ContainerInstance/containerGroupProfiles/cgProfile"), - // Revision: to.Ptr[int64](1), - // }, - // SubnetIDs: []*armstandbypool.Subnet{ - // { - // ID: to.Ptr("/subscriptions/8cf6c1b6-c80f-437c-87ad-45fbaff54f73/resourceGroups/rgstandbypool/providers/Microsoft.Network/virtualNetworks/cgSubnet/subnets/cgSubnet"), - // }}, - // }, - // ElasticityProfile: &armstandbypool.StandbyContainerGroupPoolElasticityProfile{ - // MaxReadyCapacity: to.Ptr[int64](688), - // RefillPolicy: to.Ptr(armstandbypool.RefillPolicyAlways), - // }, - // ProvisioningState: to.Ptr(armstandbypool.ProvisioningStateSucceeded), - // }, - // }}, - // } + poller, err := clientFactory.NewStandbyContainerGroupPoolsClient().BeginDelete(ctx, "rgstandbypool", "pool", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/standbypool/resource-manager/Microsoft.StandbyPool/preview/2023-12-01-preview/examples/StandbyContainerGroupPools_Get.json +// Generated from example definition: 2024-03-01/StandbyContainerGroupPools_Get.json func ExampleStandbyContainerGroupPoolsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstandbypool.NewClientFactory("", cred, nil) + clientFactory, err := armstandbypool.NewClientFactory("00000000-0000-0000-0000-000000000009", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -158,146 +131,206 @@ func ExampleStandbyContainerGroupPoolsClient_Get() { // You could use response here. We use blank identifier for just demo purposes. _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.StandbyContainerGroupPoolResource = armstandbypool.StandbyContainerGroupPoolResource{ - // Name: to.Ptr("pool"), - // Type: to.Ptr("Microsoft.StandbyPool/standbyContainerGroupPools"), - // ID: to.Ptr("/subscriptions/8CC31D61-82D7-4B2B-B9DC-6B924DE7D229/resourceGroups/rgstandbypool/providers/Microsoft.StandbyPool/standbyContainerGroupPools/pool"), - // SystemData: &armstandbypool.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-07T16:33:22.210Z"); return t}()), - // CreatedBy: to.Ptr("pooluser@microsoft.com"), - // CreatedByType: to.Ptr(armstandbypool.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-07T16:33:22.210Z"); return t}()), - // LastModifiedBy: to.Ptr("pooluser@microsoft.com"), - // LastModifiedByType: to.Ptr(armstandbypool.CreatedByTypeUser), - // }, - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armstandbypool.StandbyContainerGroupPoolResourceProperties{ - // ContainerGroupProperties: &armstandbypool.ContainerGroupProperties{ - // ContainerGroupProfile: &armstandbypool.ContainerGroupProfile{ - // ID: to.Ptr("/subscriptions/8CC31D61-82D7-4B2B-B9DC-6B924DE7D229/resourceGroups/rgstandbypool/providers/Microsoft.ContainerInstance/containerGroupProfiles/cgProfile"), - // Revision: to.Ptr[int64](1), + // res = armstandbypool.StandbyContainerGroupPoolsClientGetResponse{ + // StandbyContainerGroupPoolResource: &armstandbypool.StandbyContainerGroupPoolResource{ + // Properties: &armstandbypool.StandbyContainerGroupPoolResourceProperties{ + // ElasticityProfile: &armstandbypool.StandbyContainerGroupPoolElasticityProfile{ + // MaxReadyCapacity: to.Ptr[int64](688), + // RefillPolicy: to.Ptr(armstandbypool.RefillPolicyAlways), + // }, + // ProvisioningState: to.Ptr(armstandbypool.ProvisioningStateSucceeded), + // ContainerGroupProperties: &armstandbypool.ContainerGroupProperties{ + // ContainerGroupProfile: &armstandbypool.ContainerGroupProfile{ + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000009/resourceGroups/rgstandbypool/providers/Microsoft.ContainerInstance/containerGroupProfiles/cgProfile"), + // Revision: to.Ptr[int64](1), + // }, + // SubnetIDs: []*armstandbypool.Subnet{ + // { + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000009/resourceGroups/rgstandbypool/providers/Microsoft.Network/virtualNetworks/cgSubnet/subnets/cgSubnet"), + // }, + // }, // }, - // SubnetIDs: []*armstandbypool.Subnet{ - // { - // ID: to.Ptr("/subscriptions/8cf6c1b6-c80f-437c-87ad-45fbaff54f73/resourceGroups/rgstandbypool/providers/Microsoft.Network/virtualNetworks/cgSubnet/subnets/cgSubnet"), - // }}, // }, - // ElasticityProfile: &armstandbypool.StandbyContainerGroupPoolElasticityProfile{ - // MaxReadyCapacity: to.Ptr[int64](688), - // RefillPolicy: to.Ptr(armstandbypool.RefillPolicyAlways), + // Tags: map[string]*string{ + // }, + // Location: to.Ptr("West US"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000009/resourceGroups/rgstandbypool/providers/Microsoft.StandbyPool/standbyContainerGroupPools/pool"), + // Name: to.Ptr("pool"), + // Type: to.Ptr("Microsoft.StandbyPool/standbyContainerGroupPools"), + // SystemData: &armstandbypool.SystemData{ + // CreatedBy: to.Ptr("pooluser@microsoft.com"), + // CreatedByType: to.Ptr(armstandbypool.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-07T16:33:22.210Z"); return t}()), + // LastModifiedBy: to.Ptr("pooluser@microsoft.com"), + // LastModifiedByType: to.Ptr(armstandbypool.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-07T16:33:22.210Z"); return t}()), // }, - // ProvisioningState: to.Ptr(armstandbypool.ProvisioningStateSucceeded), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/standbypool/resource-manager/Microsoft.StandbyPool/preview/2023-12-01-preview/examples/StandbyContainerGroupPools_CreateOrUpdate.json -func ExampleStandbyContainerGroupPoolsClient_BeginCreateOrUpdate() { +// Generated from example definition: 2024-03-01/StandbyContainerGroupPools_ListByResourceGroup.json +func ExampleStandbyContainerGroupPoolsClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstandbypool.NewClientFactory("", cred, nil) + clientFactory, err := armstandbypool.NewClientFactory("00000000-0000-0000-0000-000000000009", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewStandbyContainerGroupPoolsClient().BeginCreateOrUpdate(ctx, "rgstandbypool", "pool", armstandbypool.StandbyContainerGroupPoolResource{ - Location: to.Ptr("West US"), - Tags: map[string]*string{}, - Properties: &armstandbypool.StandbyContainerGroupPoolResourceProperties{ - ContainerGroupProperties: &armstandbypool.ContainerGroupProperties{ - ContainerGroupProfile: &armstandbypool.ContainerGroupProfile{ - ID: to.Ptr("/subscriptions/8CC31D61-82D7-4B2B-B9DC-6B924DE7D229/resourceGroups/rgstandbypool/providers/Microsoft.ContainerInstance/containerGroupProfiles/cgProfile"), - Revision: to.Ptr[int64](1), - }, - SubnetIDs: []*armstandbypool.Subnet{ - { - ID: to.Ptr("/subscriptions/8cf6c1b6-c80f-437c-87ad-45fbaff54f73/resourceGroups/rgstandbypool/providers/Microsoft.Network/virtualNetworks/cgSubnet/subnets/cgSubnet"), - }}, - }, - ElasticityProfile: &armstandbypool.StandbyContainerGroupPoolElasticityProfile{ - MaxReadyCapacity: to.Ptr[int64](688), - RefillPolicy: to.Ptr(armstandbypool.RefillPolicyAlways), - }, - }, - }, nil) + pager := clientFactory.NewStandbyContainerGroupPoolsClient().NewListByResourceGroupPager("rgstandbypool", 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 = armstandbypool.StandbyContainerGroupPoolsClientListByResourceGroupResponse{ + // StandbyContainerGroupPoolResourceListResult: armstandbypool.StandbyContainerGroupPoolResourceListResult{ + // Value: []*armstandbypool.StandbyContainerGroupPoolResource{ + // { + // Properties: &armstandbypool.StandbyContainerGroupPoolResourceProperties{ + // ElasticityProfile: &armstandbypool.StandbyContainerGroupPoolElasticityProfile{ + // MaxReadyCapacity: to.Ptr[int64](688), + // RefillPolicy: to.Ptr(armstandbypool.RefillPolicyAlways), + // }, + // ProvisioningState: to.Ptr(armstandbypool.ProvisioningStateSucceeded), + // ContainerGroupProperties: &armstandbypool.ContainerGroupProperties{ + // ContainerGroupProfile: &armstandbypool.ContainerGroupProfile{ + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000009/resourceGroups/rgstandbypool/providers/Microsoft.ContainerInstance/containerGroupProfiles/cgProfile"), + // Revision: to.Ptr[int64](1), + // }, + // SubnetIDs: []*armstandbypool.Subnet{ + // { + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000009/resourceGroups/rgstandbypool/providers/Microsoft.Network/virtualNetworks/cgSubnet/subnets/cgSubnet"), + // }, + // }, + // }, + // }, + // Tags: map[string]*string{ + // }, + // Location: to.Ptr("West US"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000009/resourceGroups/rgstandbypool/providers/Microsoft.StandbyPool/standbyContainerGroupPools/pool"), + // Name: to.Ptr("pool"), + // Type: to.Ptr("Microsoft.StandbyPool/standbyContainerGroupPools"), + // SystemData: &armstandbypool.SystemData{ + // CreatedBy: to.Ptr("pooluser@microsoft.com"), + // CreatedByType: to.Ptr(armstandbypool.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-07T16:33:22.210Z"); return t}()), + // LastModifiedBy: to.Ptr("pooluser@microsoft.com"), + // LastModifiedByType: to.Ptr(armstandbypool.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-07T16:33:22.210Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} + +// Generated from example definition: 2024-03-01/StandbyContainerGroupPools_ListBySubscription.json +func ExampleStandbyContainerGroupPoolsClient_NewListBySubscriptionPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { - log.Fatalf("failed to finish the request: %v", err) + log.Fatalf("failed to obtain a credential: %v", err) } - res, err := poller.PollUntilDone(ctx, nil) + ctx := context.Background() + clientFactory, err := armstandbypool.NewClientFactory("00000000-0000-0000-0000-000000000009", cred, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewStandbyContainerGroupPoolsClient().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 = armstandbypool.StandbyContainerGroupPoolsClientListBySubscriptionResponse{ + // StandbyContainerGroupPoolResourceListResult: armstandbypool.StandbyContainerGroupPoolResourceListResult{ + // Value: []*armstandbypool.StandbyContainerGroupPoolResource{ + // { + // Properties: &armstandbypool.StandbyContainerGroupPoolResourceProperties{ + // ElasticityProfile: &armstandbypool.StandbyContainerGroupPoolElasticityProfile{ + // MaxReadyCapacity: to.Ptr[int64](688), + // RefillPolicy: to.Ptr(armstandbypool.RefillPolicyAlways), + // }, + // ProvisioningState: to.Ptr(armstandbypool.ProvisioningStateSucceeded), + // ContainerGroupProperties: &armstandbypool.ContainerGroupProperties{ + // ContainerGroupProfile: &armstandbypool.ContainerGroupProfile{ + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000009/resourceGroups/rgstandbypool/providers/Microsoft.ContainerInstance/containerGroupProfiles/cgProfile"), + // Revision: to.Ptr[int64](1), + // }, + // SubnetIDs: []*armstandbypool.Subnet{ + // { + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000009/resourceGroups/rgstandbypool/providers/Microsoft.Network/virtualNetworks/cgSubnet/subnets/cgSubnet"), + // }, + // }, + // }, + // }, + // Tags: map[string]*string{ + // }, + // Location: to.Ptr("West US"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000009/resourceGroups/rgstandbypool/providers/Microsoft.StandbyPool/standbyContainerGroupPools/pool"), + // Name: to.Ptr("pool"), + // Type: to.Ptr("Microsoft.StandbyPool/standbyContainerGroupPools"), + // SystemData: &armstandbypool.SystemData{ + // CreatedBy: to.Ptr("pooluser@microsoft.com"), + // CreatedByType: to.Ptr(armstandbypool.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-07T16:33:22.210Z"); return t}()), + // LastModifiedBy: to.Ptr("pooluser@microsoft.com"), + // LastModifiedByType: to.Ptr(armstandbypool.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-07T16:33:22.210Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } } - // 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.StandbyContainerGroupPoolResource = armstandbypool.StandbyContainerGroupPoolResource{ - // Name: to.Ptr("pool"), - // Type: to.Ptr("Microsoft.StandbyPool/standbyContainerGroupPools"), - // ID: to.Ptr("/subscriptions/8CC31D61-82D7-4B2B-B9DC-6B924DE7D229/resourceGroups/rgstandbypool/providers/Microsoft.StandbyPool/standbyContainerGroupPools/pool"), - // SystemData: &armstandbypool.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-07T16:33:22.210Z"); return t}()), - // CreatedBy: to.Ptr("pooluser@microsoft.com"), - // CreatedByType: to.Ptr(armstandbypool.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-07T16:33:22.210Z"); return t}()), - // LastModifiedBy: to.Ptr("pooluser@microsoft.com"), - // LastModifiedByType: to.Ptr(armstandbypool.CreatedByTypeUser), - // }, - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armstandbypool.StandbyContainerGroupPoolResourceProperties{ - // ContainerGroupProperties: &armstandbypool.ContainerGroupProperties{ - // ContainerGroupProfile: &armstandbypool.ContainerGroupProfile{ - // ID: to.Ptr("/subscriptions/8CC31D61-82D7-4B2B-B9DC-6B924DE7D229/resourceGroups/rgstandbypool/providers/Microsoft.ContainerInstance/containerGroupProfiles/cgProfile"), - // Revision: to.Ptr[int64](1), - // }, - // SubnetIDs: []*armstandbypool.Subnet{ - // { - // ID: to.Ptr("/subscriptions/8cf6c1b6-c80f-437c-87ad-45fbaff54f73/resourceGroups/rgstandbypool/providers/Microsoft.Network/virtualNetworks/cgSubnet/subnets/cgSubnet"), - // }}, - // }, - // ElasticityProfile: &armstandbypool.StandbyContainerGroupPoolElasticityProfile{ - // MaxReadyCapacity: to.Ptr[int64](688), - // RefillPolicy: to.Ptr(armstandbypool.RefillPolicyAlways), - // }, - // ProvisioningState: to.Ptr(armstandbypool.ProvisioningStateSucceeded), - // }, - // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/standbypool/resource-manager/Microsoft.StandbyPool/preview/2023-12-01-preview/examples/StandbyContainerGroupPools_Update.json +// Generated from example definition: 2024-03-01/StandbyContainerGroupPools_Update.json func ExampleStandbyContainerGroupPoolsClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstandbypool.NewClientFactory("", cred, nil) + clientFactory, err := armstandbypool.NewClientFactory("00000000-0000-0000-0000-000000000009", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewStandbyContainerGroupPoolsClient().Update(ctx, "rgstandbypool", "pool", armstandbypool.StandbyContainerGroupPoolResourceUpdate{ + Tags: map[string]*string{}, Properties: &armstandbypool.StandbyContainerGroupPoolResourceUpdateProperties{ - ContainerGroupProperties: &armstandbypool.ContainerGroupPropertiesUpdate{ - ContainerGroupProfile: &armstandbypool.ContainerGroupProfileUpdate{ - ID: to.Ptr("/subscriptions/8CC31D61-82D7-4B2B-B9DC-6B924DE7D229/resourceGroups/rgstandbypool/providers/Microsoft.ContainerInstance/containerGroupProfiles/cgProfile"), + ElasticityProfile: &armstandbypool.StandbyContainerGroupPoolElasticityProfile{ + MaxReadyCapacity: to.Ptr[int64](1743), + RefillPolicy: to.Ptr(armstandbypool.RefillPolicyAlways), + }, + ContainerGroupProperties: &armstandbypool.ContainerGroupProperties{ + ContainerGroupProfile: &armstandbypool.ContainerGroupProfile{ + ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000009/resourceGroups/rgstandbypool/providers/Microsoft.ContainerInstance/containerGroupProfiles/cgProfile"), Revision: to.Ptr[int64](2), }, SubnetIDs: []*armstandbypool.Subnet{ { - ID: to.Ptr("/subscriptions/8cf6c1b6-c80f-437c-87ad-45fbaff54f73/resourceGroups/rgstandbypool/providers/Microsoft.Network/virtualNetworks/cgSubnet/subnets/cgSubnet"), - }}, - }, - ElasticityProfile: &armstandbypool.StandbyContainerGroupPoolElasticityProfileUpdate{ - MaxReadyCapacity: to.Ptr[int64](1743), - RefillPolicy: to.Ptr(armstandbypool.RefillPolicyAlways), + ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000009/resourceGroups/rgstandbypool/providers/Microsoft.Network/virtualNetworks/cgSubnet/subnets/cgSubnet"), + }, + }, }, }, - Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -305,58 +338,40 @@ func ExampleStandbyContainerGroupPoolsClient_Update() { // 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.StandbyContainerGroupPoolResource = armstandbypool.StandbyContainerGroupPoolResource{ - // Name: to.Ptr("pool"), - // Type: to.Ptr("Microsoft.StandbyPool/standbyContainerGroupPools"), - // ID: to.Ptr("/subscriptions/8CC31D61-82D7-4B2B-B9DC-6B924DE7D229/resourceGroups/rgstandbypool/providers/Microsoft.StandbyPool/standbyContainerGroupPools/pool"), - // SystemData: &armstandbypool.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-07T16:33:22.210Z"); return t}()), - // CreatedBy: to.Ptr("pooluser@microsoft.com"), - // CreatedByType: to.Ptr(armstandbypool.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-07T16:33:22.210Z"); return t}()), - // LastModifiedBy: to.Ptr("pooluser@microsoft.com"), - // LastModifiedByType: to.Ptr(armstandbypool.CreatedByTypeUser), - // }, - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armstandbypool.StandbyContainerGroupPoolResourceProperties{ - // ContainerGroupProperties: &armstandbypool.ContainerGroupProperties{ - // ContainerGroupProfile: &armstandbypool.ContainerGroupProfile{ - // ID: to.Ptr("/subscriptions/8CC31D61-82D7-4B2B-B9DC-6B924DE7D229/resourceGroups/rgstandbypool/providers/Microsoft.ContainerInstance/containerGroupProfiles/cgProfile"), - // Revision: to.Ptr[int64](2), + // res = armstandbypool.StandbyContainerGroupPoolsClientUpdateResponse{ + // StandbyContainerGroupPoolResource: &armstandbypool.StandbyContainerGroupPoolResource{ + // Properties: &armstandbypool.StandbyContainerGroupPoolResourceProperties{ + // ElasticityProfile: &armstandbypool.StandbyContainerGroupPoolElasticityProfile{ + // MaxReadyCapacity: to.Ptr[int64](1743), + // RefillPolicy: to.Ptr(armstandbypool.RefillPolicyAlways), // }, - // SubnetIDs: []*armstandbypool.Subnet{ - // { - // ID: to.Ptr("/subscriptions/8cf6c1b6-c80f-437c-87ad-45fbaff54f73/resourceGroups/rgstandbypool/providers/Microsoft.Network/virtualNetworks/cgSubnet/subnets/cgSubnet"), - // }}, + // ProvisioningState: to.Ptr(armstandbypool.ProvisioningStateSucceeded), + // ContainerGroupProperties: &armstandbypool.ContainerGroupProperties{ + // ContainerGroupProfile: &armstandbypool.ContainerGroupProfile{ + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000009/resourceGroups/rgstandbypool/providers/Microsoft.ContainerInstance/containerGroupProfiles/cgProfile"), + // Revision: to.Ptr[int64](2), + // }, + // SubnetIDs: []*armstandbypool.Subnet{ + // { + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000009/resourceGroups/rgstandbypool/providers/Microsoft.Network/virtualNetworks/cgSubnet/subnets/cgSubnet"), + // }, + // }, + // }, + // }, + // Tags: map[string]*string{ // }, - // ElasticityProfile: &armstandbypool.StandbyContainerGroupPoolElasticityProfile{ - // MaxReadyCapacity: to.Ptr[int64](1743), - // RefillPolicy: to.Ptr(armstandbypool.RefillPolicyAlways), + // Location: to.Ptr("West US"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000009/resourceGroups/rgstandbypool/providers/Microsoft.StandbyPool/standbyContainerGroupPools/pool"), + // Name: to.Ptr("pool"), + // Type: to.Ptr("Microsoft.StandbyPool/standbyContainerGroupPools"), + // SystemData: &armstandbypool.SystemData{ + // CreatedBy: to.Ptr("pooluser@microsoft.com"), + // CreatedByType: to.Ptr(armstandbypool.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-07T16:33:22.210Z"); return t}()), + // LastModifiedBy: to.Ptr("pooluser@microsoft.com"), + // LastModifiedByType: to.Ptr(armstandbypool.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-07T16:33:22.210Z"); return t}()), // }, - // ProvisioningState: to.Ptr(armstandbypool.ProvisioningStateSucceeded), // }, // } } - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/standbypool/resource-manager/Microsoft.StandbyPool/preview/2023-12-01-preview/examples/StandbyContainerGroupPools_Delete.json -func ExampleStandbyContainerGroupPoolsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armstandbypool.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewStandbyContainerGroupPoolsClient().BeginDelete(ctx, "rgstandbypool", "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/standbypool/armstandbypool/standbyvirtualmachinepoolruntimeviews_client.go b/sdk/resourcemanager/standbypool/armstandbypool/standbyvirtualmachinepoolruntimeviews_client.go new file mode 100644 index 000000000000..ccd46ce74d86 --- /dev/null +++ b/sdk/resourcemanager/standbypool/armstandbypool/standbyvirtualmachinepoolruntimeviews_client.go @@ -0,0 +1,176 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armstandbypool + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// StandbyVirtualMachinePoolRuntimeViewsClient contains the methods for the StandbyVirtualMachinePoolRuntimeViews group. +// Don't use this type directly, use NewStandbyVirtualMachinePoolRuntimeViewsClient() instead. +type StandbyVirtualMachinePoolRuntimeViewsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewStandbyVirtualMachinePoolRuntimeViewsClient creates a new instance of StandbyVirtualMachinePoolRuntimeViewsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewStandbyVirtualMachinePoolRuntimeViewsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*StandbyVirtualMachinePoolRuntimeViewsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &StandbyVirtualMachinePoolRuntimeViewsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Get a StandbyVirtualMachinePoolRuntimeViewResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-03-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - standbyVirtualMachinePoolName - Name of the standby virtual machine pool +// - runtimeView - The unique identifier for the runtime view. The input string should be the word 'latest', which will get +// the latest runtime view of the pool, otherwise the request will fail with NotFound exception. +// - options - StandbyVirtualMachinePoolRuntimeViewsClientGetOptions contains the optional parameters for the StandbyVirtualMachinePoolRuntimeViewsClient.Get +// method. +func (client *StandbyVirtualMachinePoolRuntimeViewsClient) Get(ctx context.Context, resourceGroupName string, standbyVirtualMachinePoolName string, runtimeView string, options *StandbyVirtualMachinePoolRuntimeViewsClientGetOptions) (StandbyVirtualMachinePoolRuntimeViewsClientGetResponse, error) { + var err error + const operationName = "StandbyVirtualMachinePoolRuntimeViewsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, standbyVirtualMachinePoolName, runtimeView, options) + if err != nil { + return StandbyVirtualMachinePoolRuntimeViewsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return StandbyVirtualMachinePoolRuntimeViewsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return StandbyVirtualMachinePoolRuntimeViewsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *StandbyVirtualMachinePoolRuntimeViewsClient) getCreateRequest(ctx context.Context, resourceGroupName string, standbyVirtualMachinePoolName string, runtimeView string, _ *StandbyVirtualMachinePoolRuntimeViewsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}/runtimeViews/{runtimeView}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if standbyVirtualMachinePoolName == "" { + return nil, errors.New("parameter standbyVirtualMachinePoolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{standbyVirtualMachinePoolName}", url.PathEscape(standbyVirtualMachinePoolName)) + if runtimeView == "" { + return nil, errors.New("parameter runtimeView cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{runtimeView}", url.PathEscape(runtimeView)) + 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-03-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *StandbyVirtualMachinePoolRuntimeViewsClient) getHandleResponse(resp *http.Response) (StandbyVirtualMachinePoolRuntimeViewsClientGetResponse, error) { + result := StandbyVirtualMachinePoolRuntimeViewsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.StandbyVirtualMachinePoolRuntimeViewResource); err != nil { + return StandbyVirtualMachinePoolRuntimeViewsClientGetResponse{}, err + } + return result, nil +} + +// NewListByStandbyPoolPager - List StandbyVirtualMachinePoolRuntimeViewResource resources by StandbyVirtualMachinePoolResource +// +// Generated from API version 2024-03-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - standbyVirtualMachinePoolName - Name of the standby virtual machine pool +// - options - StandbyVirtualMachinePoolRuntimeViewsClientListByStandbyPoolOptions contains the optional parameters for the +// StandbyVirtualMachinePoolRuntimeViewsClient.NewListByStandbyPoolPager method. +func (client *StandbyVirtualMachinePoolRuntimeViewsClient) NewListByStandbyPoolPager(resourceGroupName string, standbyVirtualMachinePoolName string, options *StandbyVirtualMachinePoolRuntimeViewsClientListByStandbyPoolOptions) *runtime.Pager[StandbyVirtualMachinePoolRuntimeViewsClientListByStandbyPoolResponse] { + return runtime.NewPager(runtime.PagingHandler[StandbyVirtualMachinePoolRuntimeViewsClientListByStandbyPoolResponse]{ + More: func(page StandbyVirtualMachinePoolRuntimeViewsClientListByStandbyPoolResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *StandbyVirtualMachinePoolRuntimeViewsClientListByStandbyPoolResponse) (StandbyVirtualMachinePoolRuntimeViewsClientListByStandbyPoolResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "StandbyVirtualMachinePoolRuntimeViewsClient.NewListByStandbyPoolPager") + 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.listByStandbyPoolCreateRequest(ctx, resourceGroupName, standbyVirtualMachinePoolName, options) + }, nil) + if err != nil { + return StandbyVirtualMachinePoolRuntimeViewsClientListByStandbyPoolResponse{}, err + } + return client.listByStandbyPoolHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByStandbyPoolCreateRequest creates the ListByStandbyPool request. +func (client *StandbyVirtualMachinePoolRuntimeViewsClient) listByStandbyPoolCreateRequest(ctx context.Context, resourceGroupName string, standbyVirtualMachinePoolName string, _ *StandbyVirtualMachinePoolRuntimeViewsClientListByStandbyPoolOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}/runtimeViews" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if standbyVirtualMachinePoolName == "" { + return nil, errors.New("parameter standbyVirtualMachinePoolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{standbyVirtualMachinePoolName}", url.PathEscape(standbyVirtualMachinePoolName)) + 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-03-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByStandbyPoolHandleResponse handles the ListByStandbyPool response. +func (client *StandbyVirtualMachinePoolRuntimeViewsClient) listByStandbyPoolHandleResponse(resp *http.Response) (StandbyVirtualMachinePoolRuntimeViewsClientListByStandbyPoolResponse, error) { + result := StandbyVirtualMachinePoolRuntimeViewsClientListByStandbyPoolResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.StandbyVirtualMachinePoolRuntimeViewResourceListResult); err != nil { + return StandbyVirtualMachinePoolRuntimeViewsClientListByStandbyPoolResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/standbypool/armstandbypool/standbyvirtualmachinepoolruntimeviews_client_example_test.go b/sdk/resourcemanager/standbypool/armstandbypool/standbyvirtualmachinepoolruntimeviews_client_example_test.go new file mode 100644 index 000000000000..a69bc1efb231 --- /dev/null +++ b/sdk/resourcemanager/standbypool/armstandbypool/standbyvirtualmachinepoolruntimeviews_client_example_test.go @@ -0,0 +1,276 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armstandbypool_test + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/standbypool/armstandbypool" + "log" +) + +// Generated from example definition: 2024-03-01/StandbyVirtualMachinePoolRuntimeViews_Get.json +func ExampleStandbyVirtualMachinePoolRuntimeViewsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armstandbypool.NewClientFactory("00000000-0000-0000-0000-000000000009", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewStandbyVirtualMachinePoolRuntimeViewsClient().Get(ctx, "rgstandbypool", "pool", "latest", 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 = armstandbypool.StandbyVirtualMachinePoolRuntimeViewsClientGetResponse{ + // StandbyVirtualMachinePoolRuntimeViewResource: &armstandbypool.StandbyVirtualMachinePoolRuntimeViewResource{ + // Properties: &armstandbypool.StandbyVirtualMachinePoolRuntimeViewResourceProperties{ + // InstanceCountSummary: []*armstandbypool.VirtualMachineInstanceCountSummary{ + // { + // Zone: to.Ptr[int64](1), + // InstanceCountsByState: []*armstandbypool.PoolResourceStateCount{ + // { + // State: to.Ptr("creating"), + // Count: to.Ptr[int64](100), + // }, + // { + // State: to.Ptr("running"), + // Count: to.Ptr[int64](20), + // }, + // { + // State: to.Ptr("deallocating"), + // Count: to.Ptr[int64](10), + // }, + // { + // State: to.Ptr("deallocated"), + // Count: to.Ptr[int64](100), + // }, + // { + // State: to.Ptr("starting"), + // Count: to.Ptr[int64](0), + // }, + // { + // State: to.Ptr("deleting"), + // Count: to.Ptr[int64](0), + // }, + // }, + // }, + // { + // Zone: to.Ptr[int64](2), + // InstanceCountsByState: []*armstandbypool.PoolResourceStateCount{ + // { + // State: to.Ptr("creating"), + // Count: to.Ptr[int64](100), + // }, + // { + // State: to.Ptr("running"), + // Count: to.Ptr[int64](20), + // }, + // { + // State: to.Ptr("deallocating"), + // Count: to.Ptr[int64](10), + // }, + // { + // State: to.Ptr("deallocated"), + // Count: to.Ptr[int64](100), + // }, + // { + // State: to.Ptr("starting"), + // Count: to.Ptr[int64](0), + // }, + // { + // State: to.Ptr("deleting"), + // Count: to.Ptr[int64](0), + // }, + // }, + // }, + // { + // Zone: to.Ptr[int64](3), + // InstanceCountsByState: []*armstandbypool.PoolResourceStateCount{ + // { + // State: to.Ptr("creating"), + // Count: to.Ptr[int64](100), + // }, + // { + // State: to.Ptr("running"), + // Count: to.Ptr[int64](20), + // }, + // { + // State: to.Ptr("deallocating"), + // Count: to.Ptr[int64](10), + // }, + // { + // State: to.Ptr("deallocated"), + // Count: to.Ptr[int64](100), + // }, + // { + // State: to.Ptr("starting"), + // Count: to.Ptr[int64](0), + // }, + // { + // State: to.Ptr("deleting"), + // Count: to.Ptr[int64](0), + // }, + // }, + // }, + // }, + // ProvisioningState: to.Ptr(armstandbypool.ProvisioningStateSucceeded), + // }, + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000009/resourceGroups/rgstandbypool/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/pool/runtimeViews/latest"), + // Name: to.Ptr("pool"), + // Type: to.Ptr("Microsoft.StandbyPool/standbyVirtualMachinePools/runtimeViews"), + // SystemData: &armstandbypool.SystemData{ + // CreatedBy: to.Ptr("pooluser@microsoft.com"), + // CreatedByType: to.Ptr(armstandbypool.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-14T23:31:59.679Z"); return t}()), + // LastModifiedBy: to.Ptr("pooluser@microsoft.com"), + // LastModifiedByType: to.Ptr(armstandbypool.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-14T23:31:59.679Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2024-03-01/StandbyVirtualMachinePoolRuntimeViews_ListByStandbyPool.json +func ExampleStandbyVirtualMachinePoolRuntimeViewsClient_NewListByStandbyPoolPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armstandbypool.NewClientFactory("00000000-0000-0000-0000-000000000009", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewStandbyVirtualMachinePoolRuntimeViewsClient().NewListByStandbyPoolPager("rgstandbypool", "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 = armstandbypool.StandbyVirtualMachinePoolRuntimeViewsClientListByStandbyPoolResponse{ + // StandbyVirtualMachinePoolRuntimeViewResourceListResult: armstandbypool.StandbyVirtualMachinePoolRuntimeViewResourceListResult{ + // Value: []*armstandbypool.StandbyVirtualMachinePoolRuntimeViewResource{ + // { + // Properties: &armstandbypool.StandbyVirtualMachinePoolRuntimeViewResourceProperties{ + // InstanceCountSummary: []*armstandbypool.VirtualMachineInstanceCountSummary{ + // { + // Zone: to.Ptr[int64](1), + // InstanceCountsByState: []*armstandbypool.PoolResourceStateCount{ + // { + // State: to.Ptr("creating"), + // Count: to.Ptr[int64](100), + // }, + // { + // State: to.Ptr("running"), + // Count: to.Ptr[int64](20), + // }, + // { + // State: to.Ptr("deallocating"), + // Count: to.Ptr[int64](10), + // }, + // { + // State: to.Ptr("deallocated"), + // Count: to.Ptr[int64](100), + // }, + // { + // State: to.Ptr("starting"), + // Count: to.Ptr[int64](0), + // }, + // { + // State: to.Ptr("deleting"), + // Count: to.Ptr[int64](0), + // }, + // }, + // }, + // { + // Zone: to.Ptr[int64](2), + // InstanceCountsByState: []*armstandbypool.PoolResourceStateCount{ + // { + // State: to.Ptr("creating"), + // Count: to.Ptr[int64](100), + // }, + // { + // State: to.Ptr("running"), + // Count: to.Ptr[int64](20), + // }, + // { + // State: to.Ptr("deallocating"), + // Count: to.Ptr[int64](10), + // }, + // { + // State: to.Ptr("deallocated"), + // Count: to.Ptr[int64](100), + // }, + // { + // State: to.Ptr("starting"), + // Count: to.Ptr[int64](0), + // }, + // { + // State: to.Ptr("deleting"), + // Count: to.Ptr[int64](0), + // }, + // }, + // }, + // { + // Zone: to.Ptr[int64](3), + // InstanceCountsByState: []*armstandbypool.PoolResourceStateCount{ + // { + // State: to.Ptr("creating"), + // Count: to.Ptr[int64](100), + // }, + // { + // State: to.Ptr("running"), + // Count: to.Ptr[int64](20), + // }, + // { + // State: to.Ptr("deallocating"), + // Count: to.Ptr[int64](10), + // }, + // { + // State: to.Ptr("deallocated"), + // Count: to.Ptr[int64](100), + // }, + // { + // State: to.Ptr("starting"), + // Count: to.Ptr[int64](0), + // }, + // { + // State: to.Ptr("deleting"), + // Count: to.Ptr[int64](0), + // }, + // }, + // }, + // }, + // ProvisioningState: to.Ptr(armstandbypool.ProvisioningStateSucceeded), + // }, + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000009/resourceGroups/rgstandbypool/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/pool/runtimeViews/latest"), + // Name: to.Ptr("pool"), + // Type: to.Ptr("Microsoft.StandbyPool/standbyVirtualMachinePools/runtimeViews"), + // SystemData: &armstandbypool.SystemData{ + // CreatedBy: to.Ptr("pooluser@microsoft.com"), + // CreatedByType: to.Ptr(armstandbypool.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-07T16:33:22.210Z"); return t}()), + // LastModifiedBy: to.Ptr("pooluser@microsoft.com"), + // LastModifiedByType: to.Ptr(armstandbypool.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-07T16:33:22.210Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} diff --git a/sdk/resourcemanager/standbypool/armstandbypool/standbyvirtualmachinepools_client.go b/sdk/resourcemanager/standbypool/armstandbypool/standbyvirtualmachinepools_client.go index 845ed9315a91..7a0bc58ae523 100644 --- a/sdk/resourcemanager/standbypool/armstandbypool/standbyvirtualmachinepools_client.go +++ b/sdk/resourcemanager/standbypool/armstandbypool/standbyvirtualmachinepools_client.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armstandbypool @@ -46,7 +42,7 @@ func NewStandbyVirtualMachinePoolsClient(subscriptionID string, credential azcor // BeginCreateOrUpdate - Create a StandbyVirtualMachinePoolResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-12-01-preview +// Generated from API version 2024-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - standbyVirtualMachinePoolName - Name of the standby virtual machine pool // - resource - Resource create parameters. @@ -73,7 +69,7 @@ func (client *StandbyVirtualMachinePoolsClient) BeginCreateOrUpdate(ctx context. // CreateOrUpdate - Create a StandbyVirtualMachinePoolResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-12-01-preview +// Generated from API version 2024-03-01 func (client *StandbyVirtualMachinePoolsClient) createOrUpdate(ctx context.Context, resourceGroupName string, standbyVirtualMachinePoolName string, resource StandbyVirtualMachinePoolResource, options *StandbyVirtualMachinePoolsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "StandbyVirtualMachinePoolsClient.BeginCreateOrUpdate" @@ -96,7 +92,7 @@ func (client *StandbyVirtualMachinePoolsClient) createOrUpdate(ctx context.Conte } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *StandbyVirtualMachinePoolsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, standbyVirtualMachinePoolName string, resource StandbyVirtualMachinePoolResource, options *StandbyVirtualMachinePoolsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *StandbyVirtualMachinePoolsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, standbyVirtualMachinePoolName string, resource StandbyVirtualMachinePoolResource, _ *StandbyVirtualMachinePoolsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -115,9 +111,10 @@ func (client *StandbyVirtualMachinePoolsClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-12-01-preview") + reqQP.Set("api-version", "2024-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, resource); err != nil { return nil, err } @@ -127,7 +124,7 @@ func (client *StandbyVirtualMachinePoolsClient) createOrUpdateCreateRequest(ctx // BeginDelete - Delete a StandbyVirtualMachinePoolResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-12-01-preview +// Generated from API version 2024-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - standbyVirtualMachinePoolName - Name of the standby virtual machine pool // - options - StandbyVirtualMachinePoolsClientBeginDeleteOptions contains the optional parameters for the StandbyVirtualMachinePoolsClient.BeginDelete @@ -139,8 +136,7 @@ func (client *StandbyVirtualMachinePoolsClient) BeginDelete(ctx context.Context, return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[StandbyVirtualMachinePoolsClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -153,7 +149,7 @@ func (client *StandbyVirtualMachinePoolsClient) BeginDelete(ctx context.Context, // Delete - Delete a StandbyVirtualMachinePoolResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-12-01-preview +// Generated from API version 2024-03-01 func (client *StandbyVirtualMachinePoolsClient) deleteOperation(ctx context.Context, resourceGroupName string, standbyVirtualMachinePoolName string, options *StandbyVirtualMachinePoolsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "StandbyVirtualMachinePoolsClient.BeginDelete" @@ -176,7 +172,7 @@ func (client *StandbyVirtualMachinePoolsClient) deleteOperation(ctx context.Cont } // deleteCreateRequest creates the Delete request. -func (client *StandbyVirtualMachinePoolsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, standbyVirtualMachinePoolName string, options *StandbyVirtualMachinePoolsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *StandbyVirtualMachinePoolsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, standbyVirtualMachinePoolName string, _ *StandbyVirtualMachinePoolsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -195,7 +191,7 @@ func (client *StandbyVirtualMachinePoolsClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-12-01-preview") + reqQP.Set("api-version", "2024-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -204,7 +200,7 @@ func (client *StandbyVirtualMachinePoolsClient) deleteCreateRequest(ctx context. // Get - Get a StandbyVirtualMachinePoolResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-12-01-preview +// Generated from API version 2024-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - standbyVirtualMachinePoolName - Name of the standby virtual machine pool // - options - StandbyVirtualMachinePoolsClientGetOptions contains the optional parameters for the StandbyVirtualMachinePoolsClient.Get @@ -232,7 +228,7 @@ func (client *StandbyVirtualMachinePoolsClient) Get(ctx context.Context, resourc } // getCreateRequest creates the Get request. -func (client *StandbyVirtualMachinePoolsClient) getCreateRequest(ctx context.Context, resourceGroupName string, standbyVirtualMachinePoolName string, options *StandbyVirtualMachinePoolsClientGetOptions) (*policy.Request, error) { +func (client *StandbyVirtualMachinePoolsClient) getCreateRequest(ctx context.Context, resourceGroupName string, standbyVirtualMachinePoolName string, _ *StandbyVirtualMachinePoolsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -251,7 +247,7 @@ func (client *StandbyVirtualMachinePoolsClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-12-01-preview") + reqQP.Set("api-version", "2024-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -268,7 +264,7 @@ func (client *StandbyVirtualMachinePoolsClient) getHandleResponse(resp *http.Res // NewListByResourceGroupPager - List StandbyVirtualMachinePoolResource resources by resource group // -// Generated from API version 2023-12-01-preview +// Generated from API version 2024-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - StandbyVirtualMachinePoolsClientListByResourceGroupOptions contains the optional parameters for the StandbyVirtualMachinePoolsClient.NewListByResourceGroupPager // method. @@ -296,7 +292,7 @@ func (client *StandbyVirtualMachinePoolsClient) NewListByResourceGroupPager(reso } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *StandbyVirtualMachinePoolsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *StandbyVirtualMachinePoolsClientListByResourceGroupOptions) (*policy.Request, error) { +func (client *StandbyVirtualMachinePoolsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *StandbyVirtualMachinePoolsClientListByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -311,7 +307,7 @@ func (client *StandbyVirtualMachinePoolsClient) listByResourceGroupCreateRequest return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-12-01-preview") + reqQP.Set("api-version", "2024-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -328,7 +324,7 @@ func (client *StandbyVirtualMachinePoolsClient) listByResourceGroupHandleRespons // NewListBySubscriptionPager - List StandbyVirtualMachinePoolResource resources by subscription ID // -// Generated from API version 2023-12-01-preview +// Generated from API version 2024-03-01 // - options - StandbyVirtualMachinePoolsClientListBySubscriptionOptions contains the optional parameters for the StandbyVirtualMachinePoolsClient.NewListBySubscriptionPager // method. func (client *StandbyVirtualMachinePoolsClient) NewListBySubscriptionPager(options *StandbyVirtualMachinePoolsClientListBySubscriptionOptions) *runtime.Pager[StandbyVirtualMachinePoolsClientListBySubscriptionResponse] { @@ -355,7 +351,7 @@ func (client *StandbyVirtualMachinePoolsClient) NewListBySubscriptionPager(optio } // listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *StandbyVirtualMachinePoolsClient) listBySubscriptionCreateRequest(ctx context.Context, options *StandbyVirtualMachinePoolsClientListBySubscriptionOptions) (*policy.Request, error) { +func (client *StandbyVirtualMachinePoolsClient) listBySubscriptionCreateRequest(ctx context.Context, _ *StandbyVirtualMachinePoolsClientListBySubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -366,7 +362,7 @@ func (client *StandbyVirtualMachinePoolsClient) listBySubscriptionCreateRequest( return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-12-01-preview") + reqQP.Set("api-version", "2024-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -384,7 +380,7 @@ func (client *StandbyVirtualMachinePoolsClient) listBySubscriptionHandleResponse // Update - Update a StandbyVirtualMachinePoolResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-12-01-preview +// Generated from API version 2024-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - standbyVirtualMachinePoolName - Name of the standby virtual machine pool // - properties - The resource properties to be updated. @@ -413,7 +409,7 @@ func (client *StandbyVirtualMachinePoolsClient) Update(ctx context.Context, reso } // updateCreateRequest creates the Update request. -func (client *StandbyVirtualMachinePoolsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, standbyVirtualMachinePoolName string, properties StandbyVirtualMachinePoolResourceUpdate, options *StandbyVirtualMachinePoolsClientUpdateOptions) (*policy.Request, error) { +func (client *StandbyVirtualMachinePoolsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, standbyVirtualMachinePoolName string, properties StandbyVirtualMachinePoolResourceUpdate, _ *StandbyVirtualMachinePoolsClientUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -432,9 +428,10 @@ func (client *StandbyVirtualMachinePoolsClient) updateCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-12-01-preview") + reqQP.Set("api-version", "2024-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, properties); err != nil { return nil, err } diff --git a/sdk/resourcemanager/standbypool/armstandbypool/standbyvirtualmachinepools_client_example_test.go b/sdk/resourcemanager/standbypool/armstandbypool/standbyvirtualmachinepools_client_example_test.go index 094fb75d93c2..8630519ab777 100644 --- a/sdk/resourcemanager/standbypool/armstandbypool/standbyvirtualmachinepools_client_example_test.go +++ b/sdk/resourcemanager/standbypool/armstandbypool/standbyvirtualmachinepools_client_example_test.go @@ -1,135 +1,108 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armstandbypool_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/standbypool/armstandbypool" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/standbypool/resource-manager/Microsoft.StandbyPool/preview/2023-12-01-preview/examples/StandbyVirtualMachinePools_ListBySubscription.json -func ExampleStandbyVirtualMachinePoolsClient_NewListBySubscriptionPager() { +// Generated from example definition: 2024-03-01/StandbyVirtualMachinePools_CreateOrUpdate.json +func ExampleStandbyVirtualMachinePoolsClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstandbypool.NewClientFactory("", cred, nil) + clientFactory, err := armstandbypool.NewClientFactory("00000000-0000-0000-0000-000000000009", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewStandbyVirtualMachinePoolsClient().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.StandbyVirtualMachinePoolResourceListResult = armstandbypool.StandbyVirtualMachinePoolResourceListResult{ - // Value: []*armstandbypool.StandbyVirtualMachinePoolResource{ - // { - // Name: to.Ptr("pool"), - // Type: to.Ptr("Microsoft.StandbyPool/standbyVirtualMachinePools"), - // ID: to.Ptr("/subscriptions/8CC31D61-82D7-4B2B-B9DC-6B924DE7D229/resourceGroups/rgstandbypool/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/pool"), - // SystemData: &armstandbypool.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-07T16:33:22.210Z"); return t}()), - // CreatedBy: to.Ptr("pooluser@microsoft.com"), - // CreatedByType: to.Ptr(armstandbypool.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-07T16:33:22.210Z"); return t}()), - // LastModifiedBy: to.Ptr("pooluser@microsoft.com"), - // LastModifiedByType: to.Ptr(armstandbypool.CreatedByTypeUser), - // }, - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armstandbypool.StandbyVirtualMachinePoolResourceProperties{ - // AttachedVirtualMachineScaleSetID: to.Ptr("/subscriptions/8CC31D61-82D7-4B2B-B9DC-6B924DE7D229/resourceGroups/rgstandbypool/providers/Microsoft.Compute/virtualMachineScaleSets/myVmss"), - // ElasticityProfile: &armstandbypool.StandbyVirtualMachinePoolElasticityProfile{ - // MaxReadyCapacity: to.Ptr[int64](304), - // }, - // ProvisioningState: to.Ptr(armstandbypool.ProvisioningStateSucceeded), - // VirtualMachineState: to.Ptr(armstandbypool.VirtualMachineStateRunning), - // }, - // }}, - // } + poller, err := clientFactory.NewStandbyVirtualMachinePoolsClient().BeginCreateOrUpdate(ctx, "rgstandbypool", "pool", armstandbypool.StandbyVirtualMachinePoolResource{ + Properties: &armstandbypool.StandbyVirtualMachinePoolResourceProperties{ + ElasticityProfile: &armstandbypool.StandbyVirtualMachinePoolElasticityProfile{ + MaxReadyCapacity: to.Ptr[int64](304), + MinReadyCapacity: to.Ptr[int64](300), + }, + VirtualMachineState: to.Ptr(armstandbypool.VirtualMachineStateRunning), + AttachedVirtualMachineScaleSetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000009/resourceGroups/rgstandbypool/providers/Microsoft.Compute/virtualMachineScaleSets/myVmss"), + }, + Tags: map[string]*string{}, + Location: to.Ptr("West US"), + }, 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 = armstandbypool.StandbyVirtualMachinePoolsClientCreateOrUpdateResponse{ + // StandbyVirtualMachinePoolResource: &armstandbypool.StandbyVirtualMachinePoolResource{ + // Properties: &armstandbypool.StandbyVirtualMachinePoolResourceProperties{ + // ElasticityProfile: &armstandbypool.StandbyVirtualMachinePoolElasticityProfile{ + // MaxReadyCapacity: to.Ptr[int64](304), + // MinReadyCapacity: to.Ptr[int64](300), + // }, + // VirtualMachineState: to.Ptr(armstandbypool.VirtualMachineStateRunning), + // AttachedVirtualMachineScaleSetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000009/resourceGroups/rgstandbypool/providers/Microsoft.Compute/virtualMachineScaleSets/myVmss"), + // ProvisioningState: to.Ptr(armstandbypool.ProvisioningStateSucceeded), + // }, + // Tags: map[string]*string{ + // }, + // Location: to.Ptr("West US"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000009/resourceGroups/rgstandbypool/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/pool"), + // Name: to.Ptr("pool"), + // Type: to.Ptr("Microsoft.StandbyPool/standbyVirtualMachinePools"), + // SystemData: &armstandbypool.SystemData{ + // CreatedBy: to.Ptr("pooluser@microsoft.com"), + // CreatedByType: to.Ptr(armstandbypool.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-07T16:33:22.210Z"); return t}()), + // LastModifiedBy: to.Ptr("pooluser@microsoft.com"), + // LastModifiedByType: to.Ptr(armstandbypool.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-07T16:33:22.210Z"); return t}()), + // }, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/standbypool/resource-manager/Microsoft.StandbyPool/preview/2023-12-01-preview/examples/StandbyVirtualMachinePools_ListByResourceGroup.json -func ExampleStandbyVirtualMachinePoolsClient_NewListByResourceGroupPager() { +// Generated from example definition: 2024-03-01/StandbyVirtualMachinePools_Delete.json +func ExampleStandbyVirtualMachinePoolsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstandbypool.NewClientFactory("", cred, nil) + clientFactory, err := armstandbypool.NewClientFactory("00000000-0000-0000-0000-000000000009", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewStandbyVirtualMachinePoolsClient().NewListByResourceGroupPager("rgstandbypool", 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.StandbyVirtualMachinePoolResourceListResult = armstandbypool.StandbyVirtualMachinePoolResourceListResult{ - // Value: []*armstandbypool.StandbyVirtualMachinePoolResource{ - // { - // Name: to.Ptr("pool"), - // Type: to.Ptr("Microsoft.StandbyPool/standbyVirtualMachinePools"), - // ID: to.Ptr("/subscriptions/8CC31D61-82D7-4B2B-B9DC-6B924DE7D229/resourceGroups/rgstandbypool/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/pool"), - // SystemData: &armstandbypool.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-07T16:33:22.210Z"); return t}()), - // CreatedBy: to.Ptr("pooluser@microsoft.com"), - // CreatedByType: to.Ptr(armstandbypool.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-07T16:33:22.210Z"); return t}()), - // LastModifiedBy: to.Ptr("pooluser@microsoft.com"), - // LastModifiedByType: to.Ptr(armstandbypool.CreatedByTypeUser), - // }, - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armstandbypool.StandbyVirtualMachinePoolResourceProperties{ - // AttachedVirtualMachineScaleSetID: to.Ptr("/subscriptions/8CC31D61-82D7-4B2B-B9DC-6B924DE7D229/resourceGroups/rgstandbypool/providers/Microsoft.Compute/virtualMachineScaleSets/myVmss"), - // ElasticityProfile: &armstandbypool.StandbyVirtualMachinePoolElasticityProfile{ - // MaxReadyCapacity: to.Ptr[int64](304), - // }, - // ProvisioningState: to.Ptr(armstandbypool.ProvisioningStateSucceeded), - // VirtualMachineState: to.Ptr(armstandbypool.VirtualMachineStateRunning), - // }, - // }}, - // } + poller, err := clientFactory.NewStandbyVirtualMachinePoolsClient().BeginDelete(ctx, "rgstandbypool", "pool", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/standbypool/resource-manager/Microsoft.StandbyPool/preview/2023-12-01-preview/examples/StandbyVirtualMachinePools_Get.json +// Generated from example definition: 2024-03-01/StandbyVirtualMachinePools_Get.json func ExampleStandbyVirtualMachinePoolsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstandbypool.NewClientFactory("", cred, nil) + clientFactory, err := armstandbypool.NewClientFactory("00000000-0000-0000-0000-000000000009", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -140,110 +113,169 @@ func ExampleStandbyVirtualMachinePoolsClient_Get() { // You could use response here. We use blank identifier for just demo purposes. _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.StandbyVirtualMachinePoolResource = armstandbypool.StandbyVirtualMachinePoolResource{ - // Name: to.Ptr("pool"), - // Type: to.Ptr("Microsoft.StandbyPool/standbyVirtualMachinePools"), - // ID: to.Ptr("/subscriptions/8CC31D61-82D7-4B2B-B9DC-6B924DE7D229/resourceGroups/rgstandbypool/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/pool"), - // SystemData: &armstandbypool.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-07T16:33:22.210Z"); return t}()), - // CreatedBy: to.Ptr("pooluser@microsoft.com"), - // CreatedByType: to.Ptr(armstandbypool.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-07T16:33:22.210Z"); return t}()), - // LastModifiedBy: to.Ptr("pooluser@microsoft.com"), - // LastModifiedByType: to.Ptr(armstandbypool.CreatedByTypeUser), - // }, - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armstandbypool.StandbyVirtualMachinePoolResourceProperties{ - // AttachedVirtualMachineScaleSetID: to.Ptr("/subscriptions/8CC31D61-82D7-4B2B-B9DC-6B924DE7D229/resourceGroups/rgstandbypool/providers/Microsoft.Compute/virtualMachineScaleSets/myVmss"), - // ElasticityProfile: &armstandbypool.StandbyVirtualMachinePoolElasticityProfile{ - // MaxReadyCapacity: to.Ptr[int64](304), + // res = armstandbypool.StandbyVirtualMachinePoolsClientGetResponse{ + // StandbyVirtualMachinePoolResource: &armstandbypool.StandbyVirtualMachinePoolResource{ + // Properties: &armstandbypool.StandbyVirtualMachinePoolResourceProperties{ + // ElasticityProfile: &armstandbypool.StandbyVirtualMachinePoolElasticityProfile{ + // MaxReadyCapacity: to.Ptr[int64](304), + // MinReadyCapacity: to.Ptr[int64](300), + // }, + // VirtualMachineState: to.Ptr(armstandbypool.VirtualMachineStateRunning), + // AttachedVirtualMachineScaleSetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000009/resourceGroups/rgstandbypool/providers/Microsoft.Compute/virtualMachineScaleSets/myVmss"), + // ProvisioningState: to.Ptr(armstandbypool.ProvisioningStateSucceeded), + // }, + // Tags: map[string]*string{ + // }, + // Location: to.Ptr("West US"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000009/resourceGroups/rgstandbypool/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/pool"), + // Name: to.Ptr("pool"), + // Type: to.Ptr("Microsoft.StandbyPool/standbyVirtualMachinePools"), + // SystemData: &armstandbypool.SystemData{ + // CreatedBy: to.Ptr("pooluser@microsoft.com"), + // CreatedByType: to.Ptr(armstandbypool.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-07T16:33:22.210Z"); return t}()), + // LastModifiedBy: to.Ptr("pooluser@microsoft.com"), + // LastModifiedByType: to.Ptr(armstandbypool.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-07T16:33:22.210Z"); return t}()), // }, - // ProvisioningState: to.Ptr(armstandbypool.ProvisioningStateSucceeded), - // VirtualMachineState: to.Ptr(armstandbypool.VirtualMachineStateRunning), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/standbypool/resource-manager/Microsoft.StandbyPool/preview/2023-12-01-preview/examples/StandbyVirtualMachinePools_CreateOrUpdate.json -func ExampleStandbyVirtualMachinePoolsClient_BeginCreateOrUpdate() { +// Generated from example definition: 2024-03-01/StandbyVirtualMachinePools_ListByResourceGroup.json +func ExampleStandbyVirtualMachinePoolsClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstandbypool.NewClientFactory("", cred, nil) + clientFactory, err := armstandbypool.NewClientFactory("00000000-0000-0000-0000-000000000009", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewStandbyVirtualMachinePoolsClient().BeginCreateOrUpdate(ctx, "rgstandbypool", "pool", armstandbypool.StandbyVirtualMachinePoolResource{ - Location: to.Ptr("West US"), - Tags: map[string]*string{}, - Properties: &armstandbypool.StandbyVirtualMachinePoolResourceProperties{ - AttachedVirtualMachineScaleSetID: to.Ptr("/subscriptions/8CC31D61-82D7-4B2B-B9DC-6B924DE7D229/resourceGroups/rgstandbypool/providers/Microsoft.Compute/virtualMachineScaleSets/myVmss"), - ElasticityProfile: &armstandbypool.StandbyVirtualMachinePoolElasticityProfile{ - MaxReadyCapacity: to.Ptr[int64](304), - }, - VirtualMachineState: to.Ptr(armstandbypool.VirtualMachineStateRunning), - }, - }, nil) + pager := clientFactory.NewStandbyVirtualMachinePoolsClient().NewListByResourceGroupPager("rgstandbypool", 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 = armstandbypool.StandbyVirtualMachinePoolsClientListByResourceGroupResponse{ + // StandbyVirtualMachinePoolResourceListResult: armstandbypool.StandbyVirtualMachinePoolResourceListResult{ + // Value: []*armstandbypool.StandbyVirtualMachinePoolResource{ + // { + // Properties: &armstandbypool.StandbyVirtualMachinePoolResourceProperties{ + // ElasticityProfile: &armstandbypool.StandbyVirtualMachinePoolElasticityProfile{ + // MaxReadyCapacity: to.Ptr[int64](304), + // }, + // VirtualMachineState: to.Ptr(armstandbypool.VirtualMachineStateRunning), + // AttachedVirtualMachineScaleSetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000009/resourceGroups/rgstandbypool/providers/Microsoft.Compute/virtualMachineScaleSets/myVmss"), + // ProvisioningState: to.Ptr(armstandbypool.ProvisioningStateSucceeded), + // }, + // Tags: map[string]*string{ + // }, + // Location: to.Ptr("West US"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000009/resourceGroups/rgstandbypool/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/pool"), + // Name: to.Ptr("pool"), + // Type: to.Ptr("Microsoft.StandbyPool/standbyVirtualMachinePools"), + // SystemData: &armstandbypool.SystemData{ + // CreatedBy: to.Ptr("pooluser@microsoft.com"), + // CreatedByType: to.Ptr(armstandbypool.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-07T16:33:22.210Z"); return t}()), + // LastModifiedBy: to.Ptr("pooluser@microsoft.com"), + // LastModifiedByType: to.Ptr(armstandbypool.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-07T16:33:22.210Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://example.com/subscriptions/00000000-0000-0000-0000-000000000009/resourceGroups/rgstandbypool/providers/Microsoft.StandbyPool/standbyVirtualMachinePools"), + // }, + // } + } +} + +// Generated from example definition: 2024-03-01/StandbyVirtualMachinePools_ListBySubscription.json +func ExampleStandbyVirtualMachinePoolsClient_NewListBySubscriptionPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { - log.Fatalf("failed to finish the request: %v", err) + log.Fatalf("failed to obtain a credential: %v", err) } - res, err := poller.PollUntilDone(ctx, nil) + ctx := context.Background() + clientFactory, err := armstandbypool.NewClientFactory("00000000-0000-0000-0000-000000000009", cred, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewStandbyVirtualMachinePoolsClient().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 = armstandbypool.StandbyVirtualMachinePoolsClientListBySubscriptionResponse{ + // StandbyVirtualMachinePoolResourceListResult: armstandbypool.StandbyVirtualMachinePoolResourceListResult{ + // Value: []*armstandbypool.StandbyVirtualMachinePoolResource{ + // { + // Properties: &armstandbypool.StandbyVirtualMachinePoolResourceProperties{ + // ElasticityProfile: &armstandbypool.StandbyVirtualMachinePoolElasticityProfile{ + // MaxReadyCapacity: to.Ptr[int64](304), + // MinReadyCapacity: to.Ptr[int64](300), + // }, + // VirtualMachineState: to.Ptr(armstandbypool.VirtualMachineStateRunning), + // AttachedVirtualMachineScaleSetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000009/resourceGroups/rgstandbypool/providers/Microsoft.Compute/virtualMachineScaleSets/myVmss"), + // ProvisioningState: to.Ptr(armstandbypool.ProvisioningStateSucceeded), + // }, + // Tags: map[string]*string{ + // }, + // Location: to.Ptr("West US"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000009/resourceGroups/rgstandbypool/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/pool"), + // Name: to.Ptr("pool"), + // Type: to.Ptr("Microsoft.StandbyPool/standbyVirtualMachinePools"), + // SystemData: &armstandbypool.SystemData{ + // CreatedBy: to.Ptr("pooluser@microsoft.com"), + // CreatedByType: to.Ptr(armstandbypool.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-07T16:33:22.210Z"); return t}()), + // LastModifiedBy: to.Ptr("pooluser@microsoft.com"), + // LastModifiedByType: to.Ptr(armstandbypool.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-07T16:33:22.210Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://example.com/subscriptions/00000000-0000-0000-0000-000000000009/resourceGroups/rgstandbypool/providers/Microsoft.StandbyPool/standbyVirtualMachinePools"), + // }, + // } } - // 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.StandbyVirtualMachinePoolResource = armstandbypool.StandbyVirtualMachinePoolResource{ - // Name: to.Ptr("pool"), - // Type: to.Ptr("Microsoft.StandbyPool/standbyVirtualMachinePools"), - // ID: to.Ptr("/subscriptions/8CC31D61-82D7-4B2B-B9DC-6B924DE7D229/resourceGroups/rgstandbypool/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/pool"), - // SystemData: &armstandbypool.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-07T16:33:22.210Z"); return t}()), - // CreatedBy: to.Ptr("pooluser@microsoft.com"), - // CreatedByType: to.Ptr(armstandbypool.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-07T16:33:22.210Z"); return t}()), - // LastModifiedBy: to.Ptr("pooluser@microsoft.com"), - // LastModifiedByType: to.Ptr(armstandbypool.CreatedByTypeUser), - // }, - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armstandbypool.StandbyVirtualMachinePoolResourceProperties{ - // AttachedVirtualMachineScaleSetID: to.Ptr("/subscriptions/8CC31D61-82D7-4B2B-B9DC-6B924DE7D229/resourceGroups/rgstandbypool/providers/Microsoft.Compute/virtualMachineScaleSets/myVmss"), - // ElasticityProfile: &armstandbypool.StandbyVirtualMachinePoolElasticityProfile{ - // MaxReadyCapacity: to.Ptr[int64](304), - // }, - // ProvisioningState: to.Ptr(armstandbypool.ProvisioningStateSucceeded), - // VirtualMachineState: to.Ptr(armstandbypool.VirtualMachineStateRunning), - // }, - // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/standbypool/resource-manager/Microsoft.StandbyPool/preview/2023-12-01-preview/examples/StandbyVirtualMachinePools_Update.json +// Generated from example definition: 2024-03-01/StandbyVirtualMachinePools_Update.json func ExampleStandbyVirtualMachinePoolsClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstandbypool.NewClientFactory("", cred, nil) + clientFactory, err := armstandbypool.NewClientFactory("00000000-0000-0000-0000-000000000009", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewStandbyVirtualMachinePoolsClient().Update(ctx, "rgstandbypool", "pool", armstandbypool.StandbyVirtualMachinePoolResourceUpdate{ + Tags: map[string]*string{}, Properties: &armstandbypool.StandbyVirtualMachinePoolResourceUpdateProperties{ - AttachedVirtualMachineScaleSetID: to.Ptr("/subscriptions/8CC31D61-82D7-4B2B-B9DC-6B924DE7D229/resourceGroups/rgstandbypool/providers/Microsoft.Compute/virtualMachineScaleSets/myVmss"), - ElasticityProfile: &armstandbypool.StandbyVirtualMachinePoolElasticityProfileUpdate{ + ElasticityProfile: &armstandbypool.StandbyVirtualMachinePoolElasticityProfile{ MaxReadyCapacity: to.Ptr[int64](304), + MinReadyCapacity: to.Ptr[int64](300), }, - VirtualMachineState: to.Ptr(armstandbypool.VirtualMachineStateRunning), + VirtualMachineState: to.Ptr(armstandbypool.VirtualMachineStateRunning), + AttachedVirtualMachineScaleSetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000009/resourceGroups/rgstandbypool/providers/Microsoft.Compute/virtualMachineScaleSets/myVmss"), }, - Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -251,49 +283,31 @@ func ExampleStandbyVirtualMachinePoolsClient_Update() { // 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.StandbyVirtualMachinePoolResource = armstandbypool.StandbyVirtualMachinePoolResource{ - // Name: to.Ptr("pool"), - // Type: to.Ptr("Microsoft.StandbyPool/standbyVirtualMachinePools"), - // ID: to.Ptr("/subscriptions/8CC31D61-82D7-4B2B-B9DC-6B924DE7D229/resourceGroups/rgstandbypool/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/pool"), - // SystemData: &armstandbypool.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-07T16:33:22.210Z"); return t}()), - // CreatedBy: to.Ptr("pooluser@microsoft.com"), - // CreatedByType: to.Ptr(armstandbypool.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-07T16:33:22.210Z"); return t}()), - // LastModifiedBy: to.Ptr("pooluser@microsoft.com"), - // LastModifiedByType: to.Ptr(armstandbypool.CreatedByTypeUser), - // }, - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armstandbypool.StandbyVirtualMachinePoolResourceProperties{ - // AttachedVirtualMachineScaleSetID: to.Ptr("/subscriptions/8CC31D61-82D7-4B2B-B9DC-6B924DE7D229/resourceGroups/rgstandbypool/providers/Microsoft.Compute/virtualMachineScaleSets/myVmss"), - // ElasticityProfile: &armstandbypool.StandbyVirtualMachinePoolElasticityProfile{ - // MaxReadyCapacity: to.Ptr[int64](304), + // res = armstandbypool.StandbyVirtualMachinePoolsClientUpdateResponse{ + // StandbyVirtualMachinePoolResource: &armstandbypool.StandbyVirtualMachinePoolResource{ + // Properties: &armstandbypool.StandbyVirtualMachinePoolResourceProperties{ + // ElasticityProfile: &armstandbypool.StandbyVirtualMachinePoolElasticityProfile{ + // MaxReadyCapacity: to.Ptr[int64](304), + // MinReadyCapacity: to.Ptr[int64](300), + // }, + // VirtualMachineState: to.Ptr(armstandbypool.VirtualMachineStateRunning), + // AttachedVirtualMachineScaleSetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000009/resourceGroups/rgstandbypool/providers/Microsoft.Compute/virtualMachineScaleSets/myVmss"), + // ProvisioningState: to.Ptr(armstandbypool.ProvisioningStateSucceeded), + // }, + // Tags: map[string]*string{ + // }, + // Location: to.Ptr("West US"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000009/resourceGroups/rgstandbypool/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/pool"), + // Name: to.Ptr("pool"), + // Type: to.Ptr("Microsoft.StandbyPool/standbyVirtualMachinePools"), + // SystemData: &armstandbypool.SystemData{ + // CreatedBy: to.Ptr("pooluser@microsoft.com"), + // CreatedByType: to.Ptr(armstandbypool.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-07T16:33:22.210Z"); return t}()), + // LastModifiedBy: to.Ptr("pooluser@microsoft.com"), + // LastModifiedByType: to.Ptr(armstandbypool.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-07T16:33:22.210Z"); return t}()), // }, - // ProvisioningState: to.Ptr(armstandbypool.ProvisioningStateSucceeded), - // VirtualMachineState: to.Ptr(armstandbypool.VirtualMachineStateRunning), // }, // } } - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/standbypool/resource-manager/Microsoft.StandbyPool/preview/2023-12-01-preview/examples/StandbyVirtualMachinePools_Delete.json -func ExampleStandbyVirtualMachinePoolsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armstandbypool.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewStandbyVirtualMachinePoolsClient().BeginDelete(ctx, "rgstandbypool", "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/standbypool/armstandbypool/standbyvirtualmachines_client.go b/sdk/resourcemanager/standbypool/armstandbypool/standbyvirtualmachines_client.go index fbdc18c6f5de..a02b769c2274 100644 --- a/sdk/resourcemanager/standbypool/armstandbypool/standbyvirtualmachines_client.go +++ b/sdk/resourcemanager/standbypool/armstandbypool/standbyvirtualmachines_client.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armstandbypool @@ -46,7 +42,7 @@ func NewStandbyVirtualMachinesClient(subscriptionID string, credential azcore.To // Get - Get a StandbyVirtualMachineResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-12-01-preview +// Generated from API version 2024-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - standbyVirtualMachinePoolName - Name of the standby virtual machine pool // - standbyVirtualMachineName - Name of the standby virtual machine @@ -75,7 +71,7 @@ func (client *StandbyVirtualMachinesClient) Get(ctx context.Context, resourceGro } // getCreateRequest creates the Get request. -func (client *StandbyVirtualMachinesClient) getCreateRequest(ctx context.Context, resourceGroupName string, standbyVirtualMachinePoolName string, standbyVirtualMachineName string, options *StandbyVirtualMachinesClientGetOptions) (*policy.Request, error) { +func (client *StandbyVirtualMachinesClient) getCreateRequest(ctx context.Context, resourceGroupName string, standbyVirtualMachinePoolName string, standbyVirtualMachineName string, _ *StandbyVirtualMachinesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}/standbyVirtualMachines/{standbyVirtualMachineName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -98,7 +94,7 @@ func (client *StandbyVirtualMachinesClient) getCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-12-01-preview") + reqQP.Set("api-version", "2024-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -115,7 +111,7 @@ func (client *StandbyVirtualMachinesClient) getHandleResponse(resp *http.Respons // NewListByStandbyVirtualMachinePoolResourcePager - List StandbyVirtualMachineResource resources by StandbyVirtualMachinePoolResource // -// Generated from API version 2023-12-01-preview +// Generated from API version 2024-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - standbyVirtualMachinePoolName - Name of the standby virtual machine pool // - options - StandbyVirtualMachinesClientListByStandbyVirtualMachinePoolResourceOptions contains the optional parameters for @@ -144,7 +140,7 @@ func (client *StandbyVirtualMachinesClient) NewListByStandbyVirtualMachinePoolRe } // listByStandbyVirtualMachinePoolResourceCreateRequest creates the ListByStandbyVirtualMachinePoolResource request. -func (client *StandbyVirtualMachinesClient) listByStandbyVirtualMachinePoolResourceCreateRequest(ctx context.Context, resourceGroupName string, standbyVirtualMachinePoolName string, options *StandbyVirtualMachinesClientListByStandbyVirtualMachinePoolResourceOptions) (*policy.Request, error) { +func (client *StandbyVirtualMachinesClient) listByStandbyVirtualMachinePoolResourceCreateRequest(ctx context.Context, resourceGroupName string, standbyVirtualMachinePoolName string, _ *StandbyVirtualMachinesClientListByStandbyVirtualMachinePoolResourceOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}/standbyVirtualMachines" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -163,7 +159,7 @@ func (client *StandbyVirtualMachinesClient) listByStandbyVirtualMachinePoolResou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-12-01-preview") + reqQP.Set("api-version", "2024-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/standbypool/armstandbypool/standbyvirtualmachines_client_example_test.go b/sdk/resourcemanager/standbypool/armstandbypool/standbyvirtualmachines_client_example_test.go index 9b2c64b15a9b..54a13581096c 100644 --- a/sdk/resourcemanager/standbypool/armstandbypool/standbyvirtualmachines_client_example_test.go +++ b/sdk/resourcemanager/standbypool/armstandbypool/standbyvirtualmachines_client_example_test.go @@ -1,30 +1,63 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armstandbypool_test import ( "context" - "log" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/standbypool/armstandbypool" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/standbypool/resource-manager/Microsoft.StandbyPool/preview/2023-12-01-preview/examples/StandbyVirtualMachines_ListByStandbyVirtualMachinePoolResource.json +// Generated from example definition: 2024-03-01/StandbyVirtualMachines_Get.json +func ExampleStandbyVirtualMachinesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armstandbypool.NewClientFactory("00000000-0000-0000-0000-000000000009", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewStandbyVirtualMachinesClient().Get(ctx, "rgstandbypool", "pool", "virtualMachine", 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 = armstandbypool.StandbyVirtualMachinesClientGetResponse{ + // StandbyVirtualMachineResource: &armstandbypool.StandbyVirtualMachineResource{ + // Properties: &armstandbypool.StandbyVirtualMachineResourceProperties{ + // VirtualMachineResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000009/resourceGroups/rgstandbypool/provider/Microsoft.Compute/virtualMachines/virtualMachine"), + // ProvisioningState: to.Ptr(armstandbypool.ProvisioningStateSucceeded), + // }, + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000009/resourceGroups/rgstandbypool/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/pool/standbyVirtualMachines/virtualMachine"), + // Name: to.Ptr("pool"), + // Type: to.Ptr("Microsoft.StandbyPool/standbyVirtualMachinePools/virtualMachines"), + // SystemData: &armstandbypool.SystemData{ + // CreatedBy: to.Ptr("pooluser@microsoft.com"), + // CreatedByType: to.Ptr(armstandbypool.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-07T16:33:22.210Z"); return t}()), + // LastModifiedBy: to.Ptr("pooluser@microsoft.com"), + // LastModifiedByType: to.Ptr(armstandbypool.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-07T16:33:22.210Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2024-03-01/StandbyVirtualMachines_ListByStandbyVirtualMachinePoolResource.json func ExampleStandbyVirtualMachinesClient_NewListByStandbyVirtualMachinePoolResourcePager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armstandbypool.NewClientFactory("", cred, nil) + clientFactory, err := armstandbypool.NewClientFactory("00000000-0000-0000-0000-000000000009", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -39,62 +72,29 @@ func ExampleStandbyVirtualMachinesClient_NewListByStandbyVirtualMachinePoolResou _ = 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.StandbyVirtualMachineResourceListResult = armstandbypool.StandbyVirtualMachineResourceListResult{ - // Value: []*armstandbypool.StandbyVirtualMachineResource{ - // { - // Name: to.Ptr("pool"), - // Type: to.Ptr("Microsoft.StandbyPool/standbyVirtualMachinePools/virtualMachines"), - // ID: to.Ptr("/subscriptions/8CC31D61-82D7-4B2B-B9DC-6B924DE7D229/resourceGroups/rgstandbypool/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/pool/standbyVirtualMachines/virtualMachine"), - // SystemData: &armstandbypool.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-07T16:33:22.210Z"); return t}()), - // CreatedBy: to.Ptr("pooluser@microsoft.com"), - // CreatedByType: to.Ptr(armstandbypool.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-07T16:33:22.210Z"); return t}()), - // LastModifiedBy: to.Ptr("pooluser@microsoft.com"), - // LastModifiedByType: to.Ptr(armstandbypool.CreatedByTypeUser), - // }, - // Properties: &armstandbypool.StandbyVirtualMachineResourceProperties{ - // ProvisioningState: to.Ptr(armstandbypool.ProvisioningStateSucceeded), - // VirtualMachineResourceID: to.Ptr("/subscriptions/8CC31D61-82D7-4B2B-B9DC-6B924DE7D229/resourceGroups/rgstandbypool/provider/Microsoft.Compute/virtualMachines/virtualMachine"), + // page = armstandbypool.StandbyVirtualMachinesClientListByStandbyVirtualMachinePoolResourceResponse{ + // StandbyVirtualMachineResourceListResult: armstandbypool.StandbyVirtualMachineResourceListResult{ + // Value: []*armstandbypool.StandbyVirtualMachineResource{ + // { + // Properties: &armstandbypool.StandbyVirtualMachineResourceProperties{ + // VirtualMachineResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000009/resourceGroups/rgstandbypool/provider/Microsoft.Compute/virtualMachines/virtualMachine"), + // ProvisioningState: to.Ptr(armstandbypool.ProvisioningStateSucceeded), + // }, + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000009/resourceGroups/rgstandbypool/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/pool/standbyVirtualMachines/virtualMachine"), + // Name: to.Ptr("pool"), + // Type: to.Ptr("Microsoft.StandbyPool/standbyVirtualMachinePools/virtualMachines"), + // SystemData: &armstandbypool.SystemData{ + // CreatedBy: to.Ptr("pooluser@microsoft.com"), + // CreatedByType: to.Ptr(armstandbypool.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-07T16:33:22.210Z"); return t}()), + // LastModifiedBy: to.Ptr("pooluser@microsoft.com"), + // LastModifiedByType: to.Ptr(armstandbypool.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-07T16:33:22.210Z"); return t}()), + // }, // }, - // }}, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, // } } } - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/standbypool/resource-manager/Microsoft.StandbyPool/preview/2023-12-01-preview/examples/StandbyVirtualMachines_Get.json -func ExampleStandbyVirtualMachinesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armstandbypool.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewStandbyVirtualMachinesClient().Get(ctx, "rgstandbypool", "pool", "virtualMachine", 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.StandbyVirtualMachineResource = armstandbypool.StandbyVirtualMachineResource{ - // Name: to.Ptr("pool"), - // Type: to.Ptr("Microsoft.StandbyPool/standbyVirtualMachinePools/virtualMachines"), - // ID: to.Ptr("/subscriptions/8CC31D61-82D7-4B2B-B9DC-6B924DE7D229/resourceGroups/rgstandbypool/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/pool/standbyVirtualMachines/virtualMachine"), - // SystemData: &armstandbypool.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-07T16:33:22.210Z"); return t}()), - // CreatedBy: to.Ptr("pooluser@microsoft.com"), - // CreatedByType: to.Ptr(armstandbypool.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-07T16:33:22.210Z"); return t}()), - // LastModifiedBy: to.Ptr("pooluser@microsoft.com"), - // LastModifiedByType: to.Ptr(armstandbypool.CreatedByTypeUser), - // }, - // Properties: &armstandbypool.StandbyVirtualMachineResourceProperties{ - // ProvisioningState: to.Ptr(armstandbypool.ProvisioningStateSucceeded), - // VirtualMachineResourceID: to.Ptr("/subscriptions/8CC31D61-82D7-4B2B-B9DC-6B924DE7D229/resourceGroups/rgstandbypool/provider/Microsoft.Compute/virtualMachines/virtualMachine"), - // }, - // } -} diff --git a/sdk/resourcemanager/standbypool/armstandbypool/time_rfc3339.go b/sdk/resourcemanager/standbypool/armstandbypool/time_rfc3339.go index 33bd0cce2a7e..ba614c081c4f 100644 --- a/sdk/resourcemanager/standbypool/armstandbypool/time_rfc3339.go +++ b/sdk/resourcemanager/standbypool/armstandbypool/time_rfc3339.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armstandbypool @@ -60,6 +56,9 @@ func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + if len(data) == 0 { + return nil + } tzOffset := tzOffsetRegex.Match(data) hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") var layout string diff --git a/sdk/resourcemanager/standbypool/armstandbypool/tsp-location.yaml b/sdk/resourcemanager/standbypool/armstandbypool/tsp-location.yaml new file mode 100644 index 000000000000..10840906cfb3 --- /dev/null +++ b/sdk/resourcemanager/standbypool/armstandbypool/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/standbypool/StandbyPool.Management +commit: 3ca7edabc2edf1117b7d912ba34f2694721e3ff3 +repo: Azure/azure-rest-api-specs +additionalDirectories: