diff --git a/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/CHANGELOG.md b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/CHANGELOG.md new file mode 100644 index 000000000000..07c3a055c432 --- /dev/null +++ b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 0.1.0 (2024-11-29) +### Other Changes + +The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html). + +To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/go/mgmt). \ No newline at end of file diff --git a/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/LICENSE.txt b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/LICENSE.txt new file mode 100644 index 000000000000..dc0c2ffb3dc1 --- /dev/null +++ b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Microsoft Corporation. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/README.md b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/README.md new file mode 100644 index 000000000000..71798fcdb727 --- /dev/null +++ b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/README.md @@ -0,0 +1,90 @@ +# Azure Commonedgesitemanageroperations Module for Go + +The `armcommonedgesitemanageroperations` module provides operations for working with Azure Commonedgesitemanageroperations. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations) + +# Getting started + +## Prerequisites + +- an [Azure subscription](https://azure.microsoft.com/free/) +- Go 1.18 or above (You could download and install the latest version of Go from [here](https://go.dev/doc/install). It will replace the existing Go on your machine. If you want to install multiple Go versions on the same machine, you could refer this [doc](https://go.dev/doc/manage-install).) + +## Install the package + +This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for versioning and dependency management. + +Install the Azure Commonedgesitemanageroperations module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Commonedgesitemanageroperations. The `azidentity` module provides facilities for various ways of authenticating with Azure including client/secret, certificate, managed identity, and more. + +```go +cred, err := azidentity.NewDefaultAzureCredential(nil) +``` + +For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). + +## Client Factory + +Azure Commonedgesitemanageroperations module consists of one or more clients. We provide a client factory which could be used to create any client in this module. + +```go +clientFactory, err := armcommonedgesitemanageroperations.NewClientFactory(, cred, nil) +``` + +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). + +```go +options := arm.ClientOptions { + ClientOptions: azcore.ClientOptions { + Cloud: cloud.AzureChina, + }, +} +clientFactory, err := armcommonedgesitemanageroperations.NewClientFactory(, cred, &options) +``` + +## Clients + +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.() +``` + +## Fakes + +The fake package contains types used for constructing in-memory fake servers used in unit tests. +This allows writing tests to cover various success/error conditions without the need for connecting to a live service. + +Please see https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/samples/fakes for details and examples on how to use fakes. + +## Provide Feedback + +If you encounter bugs or have suggestions, please +[open an issue](https://github.com/Azure/azure-sdk-for-go/issues) and assign the `Commonedgesitemanageroperations` label. + +# Contributing + +This project welcomes contributions and suggestions. Most contributions require +you to agree to a Contributor License Agreement (CLA) declaring that you have +the right to, and actually do, grant us the rights to use your contribution. +For details, visit [https://cla.microsoft.com](https://cla.microsoft.com). + +When you submit a pull request, a CLA-bot will automatically determine whether +you need to provide a CLA and decorate the PR appropriately (e.g., label, +comment). Simply follow the instructions provided by the bot. You will only +need to do this once across all repos using our CLA. + +This project has adopted the +[Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). +For more information, see the +[Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) +or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any +additional questions or comments. \ No newline at end of file diff --git a/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/ci.yml b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/ci.yml new file mode 100644 index 000000000000..c93e7e50c045 --- /dev/null +++ b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/ci.yml @@ -0,0 +1,28 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. +trigger: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/ + +extends: + template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + IncludeRelease: true + ServiceDirectory: 'resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations' diff --git a/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/client_factory.go b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/client_factory.go new file mode 100644 index 000000000000..70cf2a807c53 --- /dev/null +++ b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/client_factory.go @@ -0,0 +1,37 @@ +// 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 armcommonedgesitemanageroperations + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" +) + +// ClientFactory is a client factory used to create any client in this module. +// Don't use this type directly, use NewClientFactory instead. +type ClientFactory struct { + internal *arm.Client +} + +// NewClientFactory creates a new instance of ClientFactory with the specified values. +// The parameter values will be propagated to any client created from this factory. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewClientFactory(credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { + internal, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + return &ClientFactory{ + internal: internal, + }, nil +} + +// NewOperationsClient creates a new instance of OperationsClient. +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + return &OperationsClient{ + internal: c.internal, + } +} diff --git a/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/constants.go b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/constants.go new file mode 100644 index 000000000000..e8557d10db4a --- /dev/null +++ b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/constants.go @@ -0,0 +1,47 @@ +// 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 armcommonedgesitemanageroperations + +const ( + moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations" + moduleVersion = "v0.1.0" +) + +// 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" +) + +// PossibleActionTypeValues returns the possible values for the ActionType const type. +func PossibleActionTypeValues() []ActionType { + return []ActionType{ + ActionTypeInternal, + } +} + +// Origin - The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default +// value is "user,system" +type Origin string + +const ( + // 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" +) + +// PossibleOriginValues returns the possible values for the Origin const type. +func PossibleOriginValues() []Origin { + return []Origin{ + OriginSystem, + OriginUser, + OriginUserSystem, + } +} diff --git a/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/fake/internal.go b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/fake/internal.go new file mode 100644 index 000000000000..7425b6a669e2 --- /dev/null +++ b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/fake/internal.go @@ -0,0 +1,65 @@ +// 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 ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "net/http" + "sync" +) + +type result struct { + resp *http.Response + err error +} + +type nonRetriableError struct { + error +} + +func (nonRetriableError) NonRetriable() { + // marker method +} + +func contains[T comparable](s []T, v T) bool { + for _, vv := range s { + if vv == v { + return true + } + } + return false +} + +func newTracker[T any]() *tracker[T] { + return &tracker[T]{ + items: map[string]*T{}, + } +} + +type tracker[T any] struct { + items map[string]*T + mu sync.Mutex +} + +func (p *tracker[T]) get(req *http.Request) *T { + p.mu.Lock() + defer p.mu.Unlock() + if item, ok := p.items[server.SanitizePagerPollerPath(req.URL.Path)]; ok { + return item + } + return nil +} + +func (p *tracker[T]) add(req *http.Request, item *T) { + p.mu.Lock() + defer p.mu.Unlock() + p.items[server.SanitizePagerPollerPath(req.URL.Path)] = item +} + +func (p *tracker[T]) remove(req *http.Request) { + p.mu.Lock() + defer p.mu.Unlock() + delete(p.items, server.SanitizePagerPollerPath(req.URL.Path)) +} diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/operations_server.go b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/fake/operations_server.go similarity index 53% rename from sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/operations_server.go rename to sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/fake/operations_server.go index 1848d7f7e300..7de928cb204c 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/operations_server.go +++ b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/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 @@ -15,32 +11,32 @@ import ( "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/workloadssapvirtualinstance/armworkloadssapvirtualinstance" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations" "net/http" ) -// OperationsServer is a fake server for instances of the armworkloadssapvirtualinstance.OperationsClient type. +// OperationsServer is a fake server for instances of the armcommonedgesitemanageroperations.OperationsClient type. type OperationsServer struct { // NewListPager is the fake for method OperationsClient.NewListPager // HTTP status codes to indicate success: http.StatusOK - NewListPager func(options *armworkloadssapvirtualinstance.OperationsClientListOptions) (resp azfake.PagerResponder[armworkloadssapvirtualinstance.OperationsClientListResponse]) + NewListPager func(options *armcommonedgesitemanageroperations.OperationsClientListOptions) (resp azfake.PagerResponder[armcommonedgesitemanageroperations.OperationsClientListResponse]) } // NewOperationsServerTransport creates a new instance of OperationsServerTransport with the provided implementation. -// The returned OperationsServerTransport instance is connected to an instance of armworkloadssapvirtualinstance.OperationsClient via the +// The returned OperationsServerTransport instance is connected to an instance of armcommonedgesitemanageroperations.OperationsClient via the // azcore.ClientOptions.Transporter field in the client's constructor parameters. func NewOperationsServerTransport(srv *OperationsServer) *OperationsServerTransport { return &OperationsServerTransport{ srv: srv, - newListPager: newTracker[azfake.PagerResponder[armworkloadssapvirtualinstance.OperationsClientListResponse]](), + newListPager: newTracker[azfake.PagerResponder[armcommonedgesitemanageroperations.OperationsClientListResponse]](), } } -// OperationsServerTransport connects instances of armworkloadssapvirtualinstance.OperationsClient to instances of OperationsServer. +// OperationsServerTransport connects instances of armcommonedgesitemanageroperations.OperationsClient to instances of OperationsServer. // Don't use this type directly, use NewOperationsServerTransport instead. type OperationsServerTransport struct { srv *OperationsServer - newListPager *tracker[azfake.PagerResponder[armworkloadssapvirtualinstance.OperationsClientListResponse]] + newListPager *tracker[azfake.PagerResponder[armcommonedgesitemanageroperations.OperationsClientListResponse]] } // Do implements the policy.Transporter interface for OperationsServerTransport. @@ -51,21 +47,40 @@ func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return o.dispatchToMethodFake(req, method) +} - switch method { - case "OperationsClient.NewListPager": - resp, err = o.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (o *OperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if operationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = operationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OperationsClient.NewListPager": + res.resp, res.err = o.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { @@ -77,7 +92,7 @@ func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*ht resp := o.srv.NewListPager(nil) newListPager = &resp o.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armworkloadssapvirtualinstance.OperationsClientListResponse, createLink func() string) { + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armcommonedgesitemanageroperations.OperationsClientListResponse, createLink func() string) { page.NextLink = to.Ptr(createLink()) }) } @@ -94,3 +109,9 @@ func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*ht } return resp, nil } + +// set this to conditionally intercept incoming requests to OperationsServerTransport +var operationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/fake/server_factory.go b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/fake/server_factory.go new file mode 100644 index 000000000000..04f376b5276f --- /dev/null +++ b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/fake/server_factory.go @@ -0,0 +1,72 @@ +// 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 ( + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" + "sync" +) + +// ServerFactory is a fake server for instances of the armcommonedgesitemanageroperations.ClientFactory type. +type ServerFactory struct { + // OperationsServer contains the fakes for client OperationsClient + OperationsServer OperationsServer +} + +// NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. +// The returned ServerFactoryTransport instance is connected to an instance of armcommonedgesitemanageroperations.ClientFactory via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { + return &ServerFactoryTransport{ + srv: srv, + } +} + +// ServerFactoryTransport connects instances of armcommonedgesitemanageroperations.ClientFactory to instances of ServerFactory. +// Don't use this type directly, use NewServerFactoryTransport instead. +type ServerFactoryTransport struct { + srv *ServerFactory + trMu sync.Mutex + trOperationsServer *OperationsServerTransport +} + +// Do implements the policy.Transporter interface for ServerFactoryTransport. +func (s *ServerFactoryTransport) 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")} + } + + client := method[:strings.Index(method, ".")] + var resp *http.Response + var err error + + switch client { + case "OperationsClient": + initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) + resp, err = s.trOperationsServer.Do(req) + default: + err = fmt.Errorf("unhandled client %s", client) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func initServer[T any](s *ServerFactoryTransport, dst **T, src func() *T) { + s.trMu.Lock() + if *dst == nil { + *dst = src() + } + s.trMu.Unlock() +} diff --git a/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/go.mod b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/go.mod new file mode 100644 index 000000000000..836dffd74f7b --- /dev/null +++ b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/go.mod @@ -0,0 +1,21 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations + +go 1.18 + +require ( + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 +) + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect + github.com/golang-jwt/jwt/v5 v5.2.1 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/kylelemons/godebug v1.1.0 // indirect + github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect + golang.org/x/crypto v0.27.0 // indirect + golang.org/x/net v0.29.0 // indirect + golang.org/x/sys v0.25.0 // indirect + golang.org/x/text v0.18.0 // indirect +) diff --git a/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/go.sum b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/go.sum new file mode 100644 index 000000000000..cbddbbd9ecec --- /dev/null +++ b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/go.sum @@ -0,0 +1,29 @@ +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 h1:JZg6HRh6W6U4OLl6lk7BZ7BLisIzM9dG1R50zUk9C/M= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0/go.mod h1:YL1xnZ6QejvQHWJrX/AvhFl4WW4rqHVoKspWNVwFk0M= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0/go.mod h1:iZDifYGJTIgIIkYRNWPENUnqx6bJ2xnSDFI2tjwZNuY= +github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU= +github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= +github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= +github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= +github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= +golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/models.go b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/models.go new file mode 100644 index 000000000000..ca31869cc55f --- /dev/null +++ b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/models.go @@ -0,0 +1,54 @@ +// 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 armcommonedgesitemanageroperations + +// Operation - Details of a REST API operation, returned from the Resource Provider Operations API +type Operation struct { + // Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + ActionType *ActionType + + // 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", + // "Microsoft.Compute/virtualMachines/capture/action" + Name *string + + // READ-ONLY; The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default + // value is "user,system" + Origin *Origin +} + +// 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 + + // READ-ONLY; The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual + // Machine", "Restart Virtual Machine". + Operation *string + + // READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft + // Compute". + Provider *string + + // READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job + // Schedule Collections". + Resource *string +} + +// 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 { + // REQUIRED; The Operation items on this page + Value []*Operation + + // The link to the next page of items + NextLink *string +} diff --git a/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/models_serde.go b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/models_serde.go new file mode 100644 index 000000000000..90a3c297f88b --- /dev/null +++ b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/models_serde.go @@ -0,0 +1,145 @@ +// 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 armcommonedgesitemanageroperations + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actionType", o.ActionType) + populate(objectMap, "display", o.Display) + populate(objectMap, "isDataAction", o.IsDataAction) + populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. +func (o *Operation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionType": + err = unpopulate(val, "ActionType", &o.ActionType) + delete(rawMsg, key) + case "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "isDataAction": + err = unpopulate(val, "IsDataAction", &o.IsDataAction) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &o.Origin) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", o.Description) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. +func (o *OperationDisplay) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &o.Description) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. +func (o *OperationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +func populate(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, fn string, v any) error { + if data == nil || string(data) == "null" { + return nil + } + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + return nil +} diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/operations_client.go b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/operations_client.go similarity index 85% rename from sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/operations_client.go rename to sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/operations_client.go index 0e03894c5f2c..ac7ee1e62067 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/operations_client.go +++ b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/operations_client.go @@ -1,12 +1,8 @@ -//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 armhybridconnectivity +package armcommonedgesitemanageroperations import ( "context" @@ -37,9 +33,9 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO return client, nil } -// NewListPager - Lists the available Hybrid Connectivity REST API operations. +// NewListPager - List the operations for the provider // -// Generated from API version 2023-03-15 +// Generated from API version 2024-02-01-preview // - 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) { - urlPath := "/providers/Microsoft.HybridConnectivity/operations" +func (client *OperationsClient) listCreateRequest(ctx context.Context, _ *OperationsClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Edge/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-03-15") + reqQP.Set("api-version", "2024-02-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/operations_client_example_test.go b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/operations_client_example_test.go new file mode 100644 index 000000000000..4ecc002d340c --- /dev/null +++ b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/operations_client_example_test.go @@ -0,0 +1,85 @@ +// 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 armcommonedgesitemanageroperations_test + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations" + "log" +) + +// Generated from example definition: 2024-02-01-preview/Operations_List_MaximumSet_Gen.json +func ExampleOperationsClient_NewListPager_operationsListMaximumSetGenGeneratedByMaximumSetRule() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcommonedgesitemanageroperations.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewOperationsClient().NewListPager(nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page = armcommonedgesitemanageroperations.OperationsClientListResponse{ + // OperationListResult: armcommonedgesitemanageroperations.OperationListResult{ + // Value: []*armcommonedgesitemanageroperations.Operation{ + // { + // Name: to.Ptr("jaczxpiqtdkz"), + // IsDataAction: to.Ptr(true), + // Display: &armcommonedgesitemanageroperations.OperationDisplay{ + // Provider: to.Ptr("oapgkefpoeegxjy"), + // Resource: to.Ptr("zyprevbuvdzgvb"), + // Operation: to.Ptr("heesmjbscdhwik"), + // Description: to.Ptr("ezjkmigqsov"), + // }, + // Origin: to.Ptr(armcommonedgesitemanageroperations.OriginUser), + // ActionType: to.Ptr(armcommonedgesitemanageroperations.ActionTypeInternal), + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} + +// Generated from example definition: 2024-02-01-preview/Operations_List_MinimumSet_Gen.json +func ExampleOperationsClient_NewListPager_operationsListMaximumSetGenGeneratedByMinimumSetRule() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcommonedgesitemanageroperations.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewOperationsClient().NewListPager(nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page = armcommonedgesitemanageroperations.OperationsClientListResponse{ + // OperationListResult: armcommonedgesitemanageroperations.OperationListResult{ + // }, + // } + } +} diff --git a/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/options.go b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/options.go new file mode 100644 index 000000000000..356d8c2d1002 --- /dev/null +++ b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/options.go @@ -0,0 +1,10 @@ +// 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 armcommonedgesitemanageroperations + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} diff --git a/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/responses.go b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/responses.go new file mode 100644 index 000000000000..c3ea5c30c19c --- /dev/null +++ b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/responses.go @@ -0,0 +1,11 @@ +// 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 armcommonedgesitemanageroperations + +// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. +type OperationsClientListResponse struct { + // A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. + OperationListResult +} diff --git a/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/tsp-location.yaml b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/tsp-location.yaml new file mode 100644 index 000000000000..52ed48691cdc --- /dev/null +++ b/sdk/resourcemanager/commonedgesitemanageroperations/armcommonedgesitemanageroperations/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/edge/Microsoft.Edge.Management +commit: 405438c72094a0a43fbcba18a56aa71110b78db8 +repo: Azure/azure-rest-api-specs +additionalDirectories: \ No newline at end of file diff --git a/sdk/resourcemanager/computefleet/armcomputefleet/CHANGELOG.md b/sdk/resourcemanager/computefleet/armcomputefleet/CHANGELOG.md index d91bbac6cf58..8b4e95ca16fa 100644 --- a/sdk/resourcemanager/computefleet/armcomputefleet/CHANGELOG.md +++ b/sdk/resourcemanager/computefleet/armcomputefleet/CHANGELOG.md @@ -1,5 +1,15 @@ # Release History +## 2.0.0 (2024-11-29) +### Breaking Changes + +- `ManagedServiceIdentityTypeSystemAndUserAssigned` from enum `ManagedServiceIdentityType` has been removed + +### Features Added + +- New value `ManagedServiceIdentityTypeSystemAssignedUserAssigned` added to enum type `ManagedServiceIdentityType` + + ## 1.0.0 (2024-10-22) ### Breaking Changes diff --git a/sdk/resourcemanager/computefleet/armcomputefleet/README.md b/sdk/resourcemanager/computefleet/armcomputefleet/README.md index d92afe0f9bd2..4cc26831f84d 100644 --- a/sdk/resourcemanager/computefleet/armcomputefleet/README.md +++ b/sdk/resourcemanager/computefleet/armcomputefleet/README.md @@ -18,7 +18,7 @@ This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for ve Install the Azure Compute Fleet module: ```sh -go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/computefleet/armcomputefleet +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/computefleet/armcomputefleet/v2 ``` ## Authorization diff --git a/sdk/resourcemanager/computefleet/armcomputefleet/constants.go b/sdk/resourcemanager/computefleet/armcomputefleet/constants.go index 9a5b1d23be3c..61d7925319d2 100644 --- a/sdk/resourcemanager/computefleet/armcomputefleet/constants.go +++ b/sdk/resourcemanager/computefleet/armcomputefleet/constants.go @@ -6,7 +6,7 @@ package armcomputefleet const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/computefleet/armcomputefleet" - moduleVersion = "v1.0.0" + moduleVersion = "v2.0.0" ) // AcceleratorManufacturer - Accelerator manufacturers supported by Azure VMs. @@ -449,10 +449,10 @@ type ManagedServiceIdentityType string const ( // ManagedServiceIdentityTypeNone - No managed identity. ManagedServiceIdentityTypeNone ManagedServiceIdentityType = "None" - // ManagedServiceIdentityTypeSystemAndUserAssigned - System and user assigned managed identity. - ManagedServiceIdentityTypeSystemAndUserAssigned ManagedServiceIdentityType = "SystemAssigned,UserAssigned" // ManagedServiceIdentityTypeSystemAssigned - System assigned managed identity. ManagedServiceIdentityTypeSystemAssigned ManagedServiceIdentityType = "SystemAssigned" + // ManagedServiceIdentityTypeSystemAssignedUserAssigned - System and user assigned managed identity. + ManagedServiceIdentityTypeSystemAssignedUserAssigned ManagedServiceIdentityType = "SystemAssigned,UserAssigned" // ManagedServiceIdentityTypeUserAssigned - User assigned managed identity. ManagedServiceIdentityTypeUserAssigned ManagedServiceIdentityType = "UserAssigned" ) @@ -461,8 +461,8 @@ const ( func PossibleManagedServiceIdentityTypeValues() []ManagedServiceIdentityType { return []ManagedServiceIdentityType{ ManagedServiceIdentityTypeNone, - ManagedServiceIdentityTypeSystemAndUserAssigned, ManagedServiceIdentityTypeSystemAssigned, + ManagedServiceIdentityTypeSystemAssignedUserAssigned, ManagedServiceIdentityTypeUserAssigned, } } diff --git a/sdk/resourcemanager/computefleet/armcomputefleet/fake/fleets_server.go b/sdk/resourcemanager/computefleet/armcomputefleet/fake/fleets_server.go index 50095603add1..efd507989a10 100644 --- a/sdk/resourcemanager/computefleet/armcomputefleet/fake/fleets_server.go +++ b/sdk/resourcemanager/computefleet/armcomputefleet/fake/fleets_server.go @@ -12,7 +12,7 @@ import ( "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/computefleet/armcomputefleet" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/computefleet/armcomputefleet/v2" "net/http" "net/url" "regexp" @@ -25,7 +25,7 @@ type FleetsServer struct { BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, fleetName string, resource armcomputefleet.Fleet, options *armcomputefleet.FleetsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armcomputefleet.FleetsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method FleetsClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, fleetName string, options *armcomputefleet.FleetsClientBeginDeleteOptions) (resp azfake.PollerResponder[armcomputefleet.FleetsClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method FleetsClient.Get @@ -88,29 +88,48 @@ func (f *FleetsServerTransport) Do(req *http.Request) (*http.Response, error) { } func (f *FleetsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error - - switch method { - case "FleetsClient.BeginCreateOrUpdate": - resp, err = f.dispatchBeginCreateOrUpdate(req) - case "FleetsClient.BeginDelete": - resp, err = f.dispatchBeginDelete(req) - case "FleetsClient.Get": - resp, err = f.dispatchGet(req) - case "FleetsClient.NewListByResourceGroupPager": - resp, err = f.dispatchNewListByResourceGroupPager(req) - case "FleetsClient.NewListBySubscriptionPager": - resp, err = f.dispatchNewListBySubscriptionPager(req) - case "FleetsClient.NewListVirtualMachineScaleSetsPager": - resp, err = f.dispatchNewListVirtualMachineScaleSetsPager(req) - case "FleetsClient.BeginUpdate": - resp, err = f.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - return resp, err + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if fleetsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = fleetsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "FleetsClient.BeginCreateOrUpdate": + res.resp, res.err = f.dispatchBeginCreateOrUpdate(req) + case "FleetsClient.BeginDelete": + res.resp, res.err = f.dispatchBeginDelete(req) + case "FleetsClient.Get": + res.resp, res.err = f.dispatchGet(req) + case "FleetsClient.NewListByResourceGroupPager": + res.resp, res.err = f.dispatchNewListByResourceGroupPager(req) + case "FleetsClient.NewListBySubscriptionPager": + res.resp, res.err = f.dispatchNewListBySubscriptionPager(req) + case "FleetsClient.NewListVirtualMachineScaleSetsPager": + res.resp, res.err = f.dispatchNewListVirtualMachineScaleSetsPager(req) + case "FleetsClient.BeginUpdate": + res.resp, res.err = f.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (f *FleetsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -194,9 +213,9 @@ func (f *FleetsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Re return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { f.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { f.beginDelete.remove(req) @@ -396,3 +415,9 @@ func (f *FleetsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Re return resp, nil } + +// set this to conditionally intercept incoming requests to FleetsServerTransport +var fleetsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/computefleet/armcomputefleet/fake/internal.go b/sdk/resourcemanager/computefleet/armcomputefleet/fake/internal.go index 56a8f624f5f3..7425b6a669e2 100644 --- a/sdk/resourcemanager/computefleet/armcomputefleet/fake/internal.go +++ b/sdk/resourcemanager/computefleet/armcomputefleet/fake/internal.go @@ -10,6 +10,11 @@ import ( "sync" ) +type result struct { + resp *http.Response + err error +} + type nonRetriableError struct { error } diff --git a/sdk/resourcemanager/computefleet/armcomputefleet/fake/operations_server.go b/sdk/resourcemanager/computefleet/armcomputefleet/fake/operations_server.go index a86d89fb4a63..1ca70f29e52a 100644 --- a/sdk/resourcemanager/computefleet/armcomputefleet/fake/operations_server.go +++ b/sdk/resourcemanager/computefleet/armcomputefleet/fake/operations_server.go @@ -11,7 +11,7 @@ import ( "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/computefleet/armcomputefleet" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/computefleet/armcomputefleet/v2" "net/http" ) @@ -51,17 +51,36 @@ func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error } func (o *OperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error + resultChan := make(chan result) + defer close(resultChan) - switch method { - case "OperationsClient.NewListPager": - resp, err = o.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + go func() { + var intercepted bool + var res result + if operationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = operationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OperationsClient.NewListPager": + res.resp, res.err = o.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() - return resp, err + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { @@ -90,3 +109,9 @@ func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*ht } return resp, nil } + +// set this to conditionally intercept incoming requests to OperationsServerTransport +var operationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/computefleet/armcomputefleet/fleets_client_example_test.go b/sdk/resourcemanager/computefleet/armcomputefleet/fleets_client_example_test.go index 1499fe058820..eaa30bab6889 100644 --- a/sdk/resourcemanager/computefleet/armcomputefleet/fleets_client_example_test.go +++ b/sdk/resourcemanager/computefleet/armcomputefleet/fleets_client_example_test.go @@ -8,7 +8,7 @@ import ( "context" "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/computefleet/armcomputefleet" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/computefleet/armcomputefleet/v2" "log" ) diff --git a/sdk/resourcemanager/computefleet/armcomputefleet/go.mod b/sdk/resourcemanager/computefleet/armcomputefleet/go.mod index 43724ff7ef95..044b494f3b84 100644 --- a/sdk/resourcemanager/computefleet/armcomputefleet/go.mod +++ b/sdk/resourcemanager/computefleet/armcomputefleet/go.mod @@ -1,9 +1,9 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/computefleet/armcomputefleet +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/computefleet/armcomputefleet/v2 go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 ) @@ -14,8 +14,8 @@ require ( github.com/google/uuid v1.6.0 // indirect github.com/kylelemons/godebug v1.1.0 // indirect github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect - golang.org/x/crypto v0.25.0 // indirect - golang.org/x/net v0.27.0 // indirect - golang.org/x/sys v0.22.0 // indirect - golang.org/x/text v0.16.0 // indirect + golang.org/x/crypto v0.27.0 // indirect + golang.org/x/net v0.29.0 // indirect + golang.org/x/sys v0.25.0 // indirect + golang.org/x/text v0.18.0 // indirect ) diff --git a/sdk/resourcemanager/computefleet/armcomputefleet/go.sum b/sdk/resourcemanager/computefleet/armcomputefleet/go.sum index 09d275cb9a37..cbddbbd9ecec 100644 --- a/sdk/resourcemanager/computefleet/armcomputefleet/go.sum +++ b/sdk/resourcemanager/computefleet/armcomputefleet/go.sum @@ -1,5 +1,5 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 h1:GJHeeA2N7xrG3q30L2UXDyuWRzDM900/65j70wcM4Ww= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 h1:JZg6HRh6W6U4OLl6lk7BZ7BLisIzM9dG1R50zUk9C/M= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0/go.mod h1:YL1xnZ6QejvQHWJrX/AvhFl4WW4rqHVoKspWNVwFk0M= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= @@ -17,13 +17,13 @@ github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmd github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= -golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= -golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= +golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= +golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/computefleet/armcomputefleet/models.go b/sdk/resourcemanager/computefleet/armcomputefleet/models.go index caf2d6bf4392..5f1d6a67da41 100644 --- a/sdk/resourcemanager/computefleet/armcomputefleet/models.go +++ b/sdk/resourcemanager/computefleet/armcomputefleet/models.go @@ -908,6 +908,7 @@ type VMAttributes struct { LocalStorageInGiB *VMAttributeMinMaxDouble // Specifies whether the VMSize supporting local storage should be used to build Fleet or not. + // Included - Default if not specified as most Azure VMs support local storage. LocalStorageSupport *VMAttributeSupport // The range of memory in GiB per vCPU specified from min to max. Optional parameter. Either Min or Max is required if specified. diff --git a/sdk/resourcemanager/computefleet/armcomputefleet/operations_client_example_test.go b/sdk/resourcemanager/computefleet/armcomputefleet/operations_client_example_test.go index 9ba1df570e27..306f65f68a20 100644 --- a/sdk/resourcemanager/computefleet/armcomputefleet/operations_client_example_test.go +++ b/sdk/resourcemanager/computefleet/armcomputefleet/operations_client_example_test.go @@ -7,7 +7,7 @@ package armcomputefleet_test import ( "context" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/computefleet/armcomputefleet" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/computefleet/armcomputefleet/v2" "log" ) diff --git a/sdk/resourcemanager/computefleet/armcomputefleet/tsp-location.yaml b/sdk/resourcemanager/computefleet/armcomputefleet/tsp-location.yaml index c8d950e137b2..318837ff80d6 100644 --- a/sdk/resourcemanager/computefleet/armcomputefleet/tsp-location.yaml +++ b/sdk/resourcemanager/computefleet/armcomputefleet/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/azurefleet/AzureFleet.Management -commit: c120171b3684d88562fa26ae7db5d22b7bfa95d8 +commit: 405438c72094a0a43fbcba18a56aa71110b78db8 repo: Azure/azure-rest-api-specs -additionalDirectories: +additionalDirectories: \ No newline at end of file diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/CHANGELOG.md b/sdk/resourcemanager/connectedcache/armconnectedcache/CHANGELOG.md index 04b0ce1c62da..e3047f872220 100644 --- a/sdk/resourcemanager/connectedcache/armconnectedcache/CHANGELOG.md +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 0.1.1 (2024-11-29) +### Other Changes + + ## 0.1.0 (2024-11-20) ### Other Changes diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/constants.go b/sdk/resourcemanager/connectedcache/armconnectedcache/constants.go index 9a67cde6c50a..d82fb049fd35 100644 --- a/sdk/resourcemanager/connectedcache/armconnectedcache/constants.go +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/constants.go @@ -6,7 +6,7 @@ package armconnectedcache const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/connectedcache/armconnectedcache" - moduleVersion = "v0.1.0" + moduleVersion = "v0.1.1" ) // ActionType - Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. diff --git a/sdk/resourcemanager/connectedcache/armconnectedcache/tsp-location.yaml b/sdk/resourcemanager/connectedcache/armconnectedcache/tsp-location.yaml index 1ebce821159f..1669fc98aaa5 100644 --- a/sdk/resourcemanager/connectedcache/armconnectedcache/tsp-location.yaml +++ b/sdk/resourcemanager/connectedcache/armconnectedcache/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/connectedcache/ConnectedCache.Management -commit: d477c7caa09bf82e22c419be0a99d170552b5892 +commit: 405438c72094a0a43fbcba18a56aa71110b78db8 repo: Azure/azure-rest-api-specs -additionalDirectories: +additionalDirectories: \ No newline at end of file diff --git a/sdk/resourcemanager/contoso/armcontoso/CHANGELOG.md b/sdk/resourcemanager/contoso/armcontoso/CHANGELOG.md new file mode 100644 index 000000000000..c5bbe8ba19a1 --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 0.1.0 (2024-11-29) +### Other Changes + +The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/contoso/armcontoso` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html). + +To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/go/mgmt). \ No newline at end of file diff --git a/sdk/resourcemanager/contoso/armcontoso/LICENSE.txt b/sdk/resourcemanager/contoso/armcontoso/LICENSE.txt new file mode 100644 index 000000000000..dc0c2ffb3dc1 --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Microsoft Corporation. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/resourcemanager/contoso/armcontoso/README.md b/sdk/resourcemanager/contoso/armcontoso/README.md new file mode 100644 index 000000000000..de0732ba86be --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/README.md @@ -0,0 +1,90 @@ +# Azure Contoso Module for Go + +The `armcontoso` module provides operations for working with Azure Contoso. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/contoso/armcontoso) + +# Getting started + +## Prerequisites + +- an [Azure subscription](https://azure.microsoft.com/free/) +- Go 1.18 or above (You could download and install the latest version of Go from [here](https://go.dev/doc/install). It will replace the existing Go on your machine. If you want to install multiple Go versions on the same machine, you could refer this [doc](https://go.dev/doc/manage-install).) + +## Install the package + +This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for versioning and dependency management. + +Install the Azure Contoso module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/contoso/armcontoso +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Contoso. The `azidentity` module provides facilities for various ways of authenticating with Azure including client/secret, certificate, managed identity, and more. + +```go +cred, err := azidentity.NewDefaultAzureCredential(nil) +``` + +For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). + +## Client Factory + +Azure Contoso module consists of one or more clients. We provide a client factory which could be used to create any client in this module. + +```go +clientFactory, err := armcontoso.NewClientFactory(, cred, nil) +``` + +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). + +```go +options := arm.ClientOptions { + ClientOptions: azcore.ClientOptions { + Cloud: cloud.AzureChina, + }, +} +clientFactory, err := armcontoso.NewClientFactory(, cred, &options) +``` + +## Clients + +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.NewEmployeesClient() +``` + +## Fakes + +The fake package contains types used for constructing in-memory fake servers used in unit tests. +This allows writing tests to cover various success/error conditions without the need for connecting to a live service. + +Please see https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/samples/fakes for details and examples on how to use fakes. + +## Provide Feedback + +If you encounter bugs or have suggestions, please +[open an issue](https://github.com/Azure/azure-sdk-for-go/issues) and assign the `Contoso` label. + +# Contributing + +This project welcomes contributions and suggestions. Most contributions require +you to agree to a Contributor License Agreement (CLA) declaring that you have +the right to, and actually do, grant us the rights to use your contribution. +For details, visit [https://cla.microsoft.com](https://cla.microsoft.com). + +When you submit a pull request, a CLA-bot will automatically determine whether +you need to provide a CLA and decorate the PR appropriately (e.g., label, +comment). Simply follow the instructions provided by the bot. You will only +need to do this once across all repos using our CLA. + +This project has adopted the +[Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). +For more information, see the +[Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) +or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any +additional questions or comments. \ No newline at end of file diff --git a/sdk/resourcemanager/contoso/armcontoso/ci.yml b/sdk/resourcemanager/contoso/armcontoso/ci.yml new file mode 100644 index 000000000000..a068465b72a2 --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/ci.yml @@ -0,0 +1,28 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. +trigger: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/contoso/armcontoso/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/contoso/armcontoso/ + +extends: + template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + IncludeRelease: true + ServiceDirectory: 'resourcemanager/contoso/armcontoso' diff --git a/sdk/resourcemanager/contoso/armcontoso/client_factory.go b/sdk/resourcemanager/contoso/armcontoso/client_factory.go new file mode 100644 index 000000000000..0a0944ec82c6 --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/client_factory.go @@ -0,0 +1,48 @@ +// 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 armcontoso + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" +) + +// ClientFactory is a client factory used to create any client in this module. +// Don't use this type directly, use NewClientFactory instead. +type ClientFactory struct { + subscriptionID string + internal *arm.Client +} + +// NewClientFactory creates a new instance of ClientFactory with the specified values. +// The parameter values will be propagated to any client created from this factory. +// - 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 NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { + internal, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + return &ClientFactory{ + subscriptionID: subscriptionID, + internal: internal, + }, nil +} + +// NewEmployeesClient creates a new instance of EmployeesClient. +func (c *ClientFactory) NewEmployeesClient() *EmployeesClient { + return &EmployeesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewOperationsClient creates a new instance of OperationsClient. +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + return &OperationsClient{ + internal: c.internal, + } +} diff --git a/sdk/resourcemanager/contoso/armcontoso/constants.go b/sdk/resourcemanager/contoso/armcontoso/constants.go new file mode 100644 index 000000000000..35ca72f6b867 --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/constants.go @@ -0,0 +1,104 @@ +// 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 armcontoso + +const ( + moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/contoso/armcontoso" + moduleVersion = "v0.1.0" +) + +// 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" +) + +// PossibleActionTypeValues returns the possible values for the ActionType const type. +func PossibleActionTypeValues() []ActionType { + return []ActionType{ + ActionTypeInternal, + } +} + +// CreatedByType - The kind of entity that created the resource. +type CreatedByType string + +const ( + // 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 - The entity was created by a user. + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{ + CreatedByTypeApplication, + CreatedByTypeKey, + CreatedByTypeManagedIdentity, + CreatedByTypeUser, + } +} + +// Origin - The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default +// value is "user,system" +type Origin string + +const ( + // 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" +) + +// PossibleOriginValues returns the possible values for the Origin const type. +func PossibleOriginValues() []Origin { + return []Origin{ + OriginSystem, + OriginUser, + OriginUserSystem, + } +} + +// ProvisioningState - The resource provisioning state. +type ProvisioningState string + +const ( + // ProvisioningStateAccepted - The resource create request has been accepted + ProvisioningStateAccepted ProvisioningState = "Accepted" + // ProvisioningStateCanceled - Resource creation was canceled. + ProvisioningStateCanceled ProvisioningState = "Canceled" + // ProvisioningStateDeleting - The resource is being deleted + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed - Resource creation failed. + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateProvisioning - The resource is being provisioned + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + // ProvisioningStateSucceeded - Resource has been created. + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + // ProvisioningStateUpdating - The resource is updating + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +// PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ + ProvisioningStateAccepted, + ProvisioningStateCanceled, + ProvisioningStateDeleting, + ProvisioningStateFailed, + ProvisioningStateProvisioning, + ProvisioningStateSucceeded, + ProvisioningStateUpdating, + } +} diff --git a/sdk/resourcemanager/contoso/armcontoso/employees_client.go b/sdk/resourcemanager/contoso/armcontoso/employees_client.go new file mode 100644 index 000000000000..311519c051e9 --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/employees_client.go @@ -0,0 +1,444 @@ +// 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 armcontoso + +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" +) + +// EmployeesClient contains the methods for the Employees group. +// Don't use this type directly, use NewEmployeesClient() instead. +type EmployeesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewEmployeesClient creates a new instance of EmployeesClient 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 NewEmployeesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*EmployeesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &EmployeesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create a Employee +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - employeeName - The name of the Employee +// - resource - Resource create parameters. +// - options - EmployeesClientBeginCreateOrUpdateOptions contains the optional parameters for the EmployeesClient.BeginCreateOrUpdate +// method. +func (client *EmployeesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, employeeName string, resource Employee, options *EmployeesClientBeginCreateOrUpdateOptions) (*runtime.Poller[EmployeesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, employeeName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[EmployeesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[EmployeesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create a Employee +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-10-01-preview +func (client *EmployeesClient) createOrUpdate(ctx context.Context, resourceGroupName string, employeeName string, resource Employee, options *EmployeesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "EmployeesClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, employeeName, resource, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *EmployeesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, employeeName string, resource Employee, _ *EmployeesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Contoso/employees/{employeeName}" + 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 employeeName == "" { + return nil, errors.New("parameter employeeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{employeeName}", url.PathEscape(employeeName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-10-01-preview") + 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 + } + return req, nil +} + +// BeginDelete - Delete a Employee +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - employeeName - The name of the Employee +// - options - EmployeesClientBeginDeleteOptions contains the optional parameters for the EmployeesClient.BeginDelete method. +func (client *EmployeesClient) BeginDelete(ctx context.Context, resourceGroupName string, employeeName string, options *EmployeesClientBeginDeleteOptions) (*runtime.Poller[EmployeesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, employeeName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[EmployeesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[EmployeesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete a Employee +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-10-01-preview +func (client *EmployeesClient) deleteOperation(ctx context.Context, resourceGroupName string, employeeName string, options *EmployeesClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "EmployeesClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, employeeName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *EmployeesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, employeeName string, _ *EmployeesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Contoso/employees/{employeeName}" + 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 employeeName == "" { + return nil, errors.New("parameter employeeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{employeeName}", url.PathEscape(employeeName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a Employee +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - employeeName - The name of the Employee +// - options - EmployeesClientGetOptions contains the optional parameters for the EmployeesClient.Get method. +func (client *EmployeesClient) Get(ctx context.Context, resourceGroupName string, employeeName string, options *EmployeesClientGetOptions) (EmployeesClientGetResponse, error) { + var err error + const operationName = "EmployeesClient.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, employeeName, options) + if err != nil { + return EmployeesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return EmployeesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return EmployeesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *EmployeesClient) getCreateRequest(ctx context.Context, resourceGroupName string, employeeName string, _ *EmployeesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Contoso/employees/{employeeName}" + 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 employeeName == "" { + return nil, errors.New("parameter employeeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{employeeName}", url.PathEscape(employeeName)) + 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", "2021-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *EmployeesClient) getHandleResponse(resp *http.Response) (EmployeesClientGetResponse, error) { + result := EmployeesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Employee); err != nil { + return EmployeesClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - List Employee resources by resource group +// +// Generated from API version 2021-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - EmployeesClientListByResourceGroupOptions contains the optional parameters for the EmployeesClient.NewListByResourceGroupPager +// method. +func (client *EmployeesClient) NewListByResourceGroupPager(resourceGroupName string, options *EmployeesClientListByResourceGroupOptions) *runtime.Pager[EmployeesClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[EmployeesClientListByResourceGroupResponse]{ + More: func(page EmployeesClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *EmployeesClientListByResourceGroupResponse) (EmployeesClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "EmployeesClient.NewListByResourceGroupPager") + 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.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return EmployeesClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *EmployeesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *EmployeesClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Contoso/employees" + 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)) + 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", "2021-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *EmployeesClient) listByResourceGroupHandleResponse(resp *http.Response) (EmployeesClientListByResourceGroupResponse, error) { + result := EmployeesClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EmployeeListResult); err != nil { + return EmployeesClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - List Employee resources by subscription ID +// +// Generated from API version 2021-10-01-preview +// - options - EmployeesClientListBySubscriptionOptions contains the optional parameters for the EmployeesClient.NewListBySubscriptionPager +// method. +func (client *EmployeesClient) NewListBySubscriptionPager(options *EmployeesClientListBySubscriptionOptions) *runtime.Pager[EmployeesClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[EmployeesClientListBySubscriptionResponse]{ + More: func(page EmployeesClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *EmployeesClientListBySubscriptionResponse) (EmployeesClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "EmployeesClient.NewListBySubscriptionPager") + 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.listBySubscriptionCreateRequest(ctx, options) + }, nil) + if err != nil { + return EmployeesClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *EmployeesClient) listBySubscriptionCreateRequest(ctx context.Context, _ *EmployeesClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Contoso/employees" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + 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", "2021-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *EmployeesClient) listBySubscriptionHandleResponse(resp *http.Response) (EmployeesClientListBySubscriptionResponse, error) { + result := EmployeesClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EmployeeListResult); err != nil { + return EmployeesClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// Update - Update a Employee +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - employeeName - The name of the Employee +// - properties - The resource properties to be updated. +// - options - EmployeesClientUpdateOptions contains the optional parameters for the EmployeesClient.Update method. +func (client *EmployeesClient) Update(ctx context.Context, resourceGroupName string, employeeName string, properties Employee, options *EmployeesClientUpdateOptions) (EmployeesClientUpdateResponse, error) { + var err error + const operationName = "EmployeesClient.Update" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, employeeName, properties, options) + if err != nil { + return EmployeesClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return EmployeesClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return EmployeesClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *EmployeesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, employeeName string, properties Employee, _ *EmployeesClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Contoso/employees/{employeeName}" + 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 employeeName == "" { + return nil, errors.New("parameter employeeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{employeeName}", url.PathEscape(employeeName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-10-01-preview") + 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 + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *EmployeesClient) updateHandleResponse(resp *http.Response) (EmployeesClientUpdateResponse, error) { + result := EmployeesClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Employee); err != nil { + return EmployeesClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/contoso/armcontoso/employees_client_example_test.go b/sdk/resourcemanager/contoso/armcontoso/employees_client_example_test.go new file mode 100644 index 000000000000..6ab59a44808c --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/employees_client_example_test.go @@ -0,0 +1,302 @@ +// 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 armcontoso_test + +import ( + "context" + "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/contoso/armcontoso" + "log" +) + +// Generated from example definition: 2021-10-01-preview/Employees_CreateOrUpdate.json +func ExampleEmployeesClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontoso.NewClientFactory("11809CA1-E126-4017-945E-AA795CD5C5A9", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewEmployeesClient().BeginCreateOrUpdate(ctx, "rgopenapi", "9KF-f-8b", armcontoso.Employee{ + Properties: &armcontoso.EmployeeProperties{ + Age: to.Ptr[int32](30), + City: to.Ptr("gydhnntudughbmxlkyzrskcdkotrxn"), + Profile: []byte("ms"), + }, + Tags: map[string]*string{ + "key2913": to.Ptr("urperxmkkhhkp"), + }, + Location: to.Ptr("itajgxyqozseoygnl"), + }, 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 = armcontoso.EmployeesClientCreateOrUpdateResponse{ + // Employee: &armcontoso.Employee{ + // Properties: &armcontoso.EmployeeProperties{ + // Age: to.Ptr[int32](30), + // City: to.Ptr("gydhnntudughbmxlkyzrskcdkotrxn"), + // Profile: []byte("ms"), + // ProvisioningState: to.Ptr(armcontoso.ProvisioningStateSucceeded), + // }, + // Tags: map[string]*string{ + // "key2913": to.Ptr("urperxmkkhhkp"), + // }, + // Location: to.Ptr("itajgxyqozseoygnl"), + // ID: to.Ptr("/subscriptions/11809CA1-E126-4017-945E-AA795CD5C5A9/resourceGroups/rgopenapi/providers/Microsoft.Contoso/employees/le-8MU--J3W6q8D386p3-iT3"), + // Name: to.Ptr("xepyxhpb"), + // Type: to.Ptr("svvamxrdnnv"), + // SystemData: &armcontoso.SystemData{ + // CreatedBy: to.Ptr("iewyxsnriqktsvp"), + // CreatedByType: to.Ptr(armcontoso.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-19T00:28:48.610Z"); return t}()), + // LastModifiedBy: to.Ptr("xrchbnnuzierzpxw"), + // LastModifiedByType: to.Ptr(armcontoso.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-19T00:28:48.610Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2021-10-01-preview/Employees_Delete.json +func ExampleEmployeesClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontoso.NewClientFactory("11809CA1-E126-4017-945E-AA795CD5C5A9", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewEmployeesClient().BeginDelete(ctx, "rgopenapi", "5vX--BxSu3ux48rI4O9OQ569", 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: 2021-10-01-preview/Employees_Get.json +func ExampleEmployeesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontoso.NewClientFactory("11809CA1-E126-4017-945E-AA795CD5C5A9", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewEmployeesClient().Get(ctx, "rgopenapi", "le-8MU--J3W6q8D386p3-iT3", 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 = armcontoso.EmployeesClientGetResponse{ + // Employee: &armcontoso.Employee{ + // Properties: &armcontoso.EmployeeProperties{ + // Age: to.Ptr[int32](30), + // City: to.Ptr("gydhnntudughbmxlkyzrskcdkotrxn"), + // Profile: []byte("ms"), + // ProvisioningState: to.Ptr(armcontoso.ProvisioningStateSucceeded), + // }, + // Tags: map[string]*string{ + // "key2913": to.Ptr("urperxmkkhhkp"), + // }, + // Location: to.Ptr("itajgxyqozseoygnl"), + // ID: to.Ptr("/subscriptions/11809CA1-E126-4017-945E-AA795CD5C5A9/resourceGroups/rgopenapi/providers/Microsoft.Contoso/employees/le-8MU--J3W6q8D386p3-iT3"), + // Name: to.Ptr("xepyxhpb"), + // Type: to.Ptr("svvamxrdnnv"), + // SystemData: &armcontoso.SystemData{ + // CreatedBy: to.Ptr("iewyxsnriqktsvp"), + // CreatedByType: to.Ptr(armcontoso.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-19T00:28:48.610Z"); return t}()), + // LastModifiedBy: to.Ptr("xrchbnnuzierzpxw"), + // LastModifiedByType: to.Ptr(armcontoso.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-19T00:28:48.610Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2021-10-01-preview/Employees_ListByResourceGroup.json +func ExampleEmployeesClient_NewListByResourceGroupPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontoso.NewClientFactory("11809CA1-E126-4017-945E-AA795CD5C5A9", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewEmployeesClient().NewListByResourceGroupPager("rgopenapi", 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 = armcontoso.EmployeesClientListByResourceGroupResponse{ + // EmployeeListResult: armcontoso.EmployeeListResult{ + // Value: []*armcontoso.Employee{ + // { + // Properties: &armcontoso.EmployeeProperties{ + // Age: to.Ptr[int32](30), + // City: to.Ptr("gydhnntudughbmxlkyzrskcdkotrxn"), + // Profile: []byte("ms"), + // ProvisioningState: to.Ptr(armcontoso.ProvisioningStateSucceeded), + // }, + // Tags: map[string]*string{ + // "key2913": to.Ptr("urperxmkkhhkp"), + // }, + // Location: to.Ptr("itajgxyqozseoygnl"), + // ID: to.Ptr("/subscriptions/11809CA1-E126-4017-945E-AA795CD5C5A9/resourceGroups/rgopenapi/providers/Microsoft.Contoso/employees/test"), + // Name: to.Ptr("xepyxhpb"), + // Type: to.Ptr("svvamxrdnnv"), + // SystemData: &armcontoso.SystemData{ + // CreatedBy: to.Ptr("iewyxsnriqktsvp"), + // CreatedByType: to.Ptr(armcontoso.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-19T00:28:48.610Z"); return t}()), + // LastModifiedBy: to.Ptr("xrchbnnuzierzpxw"), + // LastModifiedByType: to.Ptr(armcontoso.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-19T00:28:48.610Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} + +// Generated from example definition: 2021-10-01-preview/Employees_ListBySubscription.json +func ExampleEmployeesClient_NewListBySubscriptionPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontoso.NewClientFactory("11809CA1-E126-4017-945E-AA795CD5C5A9", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewEmployeesClient().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 = armcontoso.EmployeesClientListBySubscriptionResponse{ + // EmployeeListResult: armcontoso.EmployeeListResult{ + // Value: []*armcontoso.Employee{ + // { + // Properties: &armcontoso.EmployeeProperties{ + // Age: to.Ptr[int32](30), + // City: to.Ptr("gydhnntudughbmxlkyzrskcdkotrxn"), + // Profile: []byte("ms"), + // ProvisioningState: to.Ptr(armcontoso.ProvisioningStateSucceeded), + // }, + // Tags: map[string]*string{ + // "key2913": to.Ptr("urperxmkkhhkp"), + // }, + // Location: to.Ptr("itajgxyqozseoygnl"), + // ID: to.Ptr("/subscriptions/11809CA1-E126-4017-945E-AA795CD5C5A9/resourceGroups/rgopenapi/providers/Microsoft.Contoso/employees/test"), + // Name: to.Ptr("xepyxhpb"), + // Type: to.Ptr("svvamxrdnnv"), + // SystemData: &armcontoso.SystemData{ + // CreatedBy: to.Ptr("iewyxsnriqktsvp"), + // CreatedByType: to.Ptr(armcontoso.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-19T00:28:48.610Z"); return t}()), + // LastModifiedBy: to.Ptr("xrchbnnuzierzpxw"), + // LastModifiedByType: to.Ptr(armcontoso.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-19T00:28:48.610Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} + +// Generated from example definition: 2021-10-01-preview/Employees_Update.json +func ExampleEmployeesClient_Update() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontoso.NewClientFactory("11809CA1-E126-4017-945E-AA795CD5C5A9", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewEmployeesClient().Update(ctx, "rgopenapi", "-XhyNJ--", armcontoso.Employee{ + Tags: map[string]*string{ + "key7952": to.Ptr("no"), + }, + Properties: &armcontoso.EmployeeProperties{ + Age: to.Ptr[int32](24), + City: to.Ptr("uyfg"), + Profile: []byte("oapgijcswfkruiuuzbwco"), + }, + }, 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 = armcontoso.EmployeesClientUpdateResponse{ + // Employee: &armcontoso.Employee{ + // Properties: &armcontoso.EmployeeProperties{ + // Age: to.Ptr[int32](30), + // City: to.Ptr("gydhnntudughbmxlkyzrskcdkotrxn"), + // Profile: []byte("ms"), + // ProvisioningState: to.Ptr(armcontoso.ProvisioningStateSucceeded), + // }, + // Tags: map[string]*string{ + // "key2913": to.Ptr("urperxmkkhhkp"), + // }, + // Location: to.Ptr("itajgxyqozseoygnl"), + // ID: to.Ptr("/subscriptions/11809CA1-E126-4017-945E-AA795CD5C5A9/resourceGroups/contoso/providers/Microsoft.Contoso/employees/test"), + // Name: to.Ptr("xepyxhpb"), + // Type: to.Ptr("svvamxrdnnv"), + // SystemData: &armcontoso.SystemData{ + // CreatedBy: to.Ptr("iewyxsnriqktsvp"), + // CreatedByType: to.Ptr(armcontoso.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-19T00:28:48.610Z"); return t}()), + // LastModifiedBy: to.Ptr("xrchbnnuzierzpxw"), + // LastModifiedByType: to.Ptr(armcontoso.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-19T00:28:48.610Z"); return t}()), + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/contoso/armcontoso/fake/employees_server.go b/sdk/resourcemanager/contoso/armcontoso/fake/employees_server.go new file mode 100644 index 000000000000..cd478a5d611e --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/fake/employees_server.go @@ -0,0 +1,361 @@ +// 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/contoso/armcontoso" + "net/http" + "net/url" + "regexp" +) + +// EmployeesServer is a fake server for instances of the armcontoso.EmployeesClient type. +type EmployeesServer struct { + // BeginCreateOrUpdate is the fake for method EmployeesClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, employeeName string, resource armcontoso.Employee, options *armcontoso.EmployeesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armcontoso.EmployeesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method EmployeesClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, employeeName string, options *armcontoso.EmployeesClientBeginDeleteOptions) (resp azfake.PollerResponder[armcontoso.EmployeesClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method EmployeesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, employeeName string, options *armcontoso.EmployeesClientGetOptions) (resp azfake.Responder[armcontoso.EmployeesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method EmployeesClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armcontoso.EmployeesClientListByResourceGroupOptions) (resp azfake.PagerResponder[armcontoso.EmployeesClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method EmployeesClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armcontoso.EmployeesClientListBySubscriptionOptions) (resp azfake.PagerResponder[armcontoso.EmployeesClientListBySubscriptionResponse]) + + // Update is the fake for method EmployeesClient.Update + // HTTP status codes to indicate success: http.StatusOK + Update func(ctx context.Context, resourceGroupName string, employeeName string, properties armcontoso.Employee, options *armcontoso.EmployeesClientUpdateOptions) (resp azfake.Responder[armcontoso.EmployeesClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewEmployeesServerTransport creates a new instance of EmployeesServerTransport with the provided implementation. +// The returned EmployeesServerTransport instance is connected to an instance of armcontoso.EmployeesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewEmployeesServerTransport(srv *EmployeesServer) *EmployeesServerTransport { + return &EmployeesServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armcontoso.EmployeesClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armcontoso.EmployeesClientDeleteResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armcontoso.EmployeesClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armcontoso.EmployeesClientListBySubscriptionResponse]](), + } +} + +// EmployeesServerTransport connects instances of armcontoso.EmployeesClient to instances of EmployeesServer. +// Don't use this type directly, use NewEmployeesServerTransport instead. +type EmployeesServerTransport struct { + srv *EmployeesServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armcontoso.EmployeesClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armcontoso.EmployeesClientDeleteResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armcontoso.EmployeesClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armcontoso.EmployeesClientListBySubscriptionResponse]] +} + +// Do implements the policy.Transporter interface for EmployeesServerTransport. +func (e *EmployeesServerTransport) 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 e.dispatchToMethodFake(req, method) +} + +func (e *EmployeesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if employeesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = employeesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "EmployeesClient.BeginCreateOrUpdate": + res.resp, res.err = e.dispatchBeginCreateOrUpdate(req) + case "EmployeesClient.BeginDelete": + res.resp, res.err = e.dispatchBeginDelete(req) + case "EmployeesClient.Get": + res.resp, res.err = e.dispatchGet(req) + case "EmployeesClient.NewListByResourceGroupPager": + res.resp, res.err = e.dispatchNewListByResourceGroupPager(req) + case "EmployeesClient.NewListBySubscriptionPager": + res.resp, res.err = e.dispatchNewListBySubscriptionPager(req) + case "EmployeesClient.Update": + res.resp, res.err = e.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (e *EmployeesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if e.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := e.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Contoso/employees/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[armcontoso.Employee](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + employeeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("employeeName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, employeeNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + e.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + e.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + e.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (e *EmployeesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if e.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := e.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Contoso/employees/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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 + } + employeeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("employeeName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.BeginDelete(req.Context(), resourceGroupNameParam, employeeNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + e.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + e.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + e.beginDelete.remove(req) + } + + return resp, nil +} + +func (e *EmployeesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if e.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\.Contoso/employees/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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 + } + employeeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("employeeName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.Get(req.Context(), resourceGroupNameParam, employeeNameParam, 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).Employee, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (e *EmployeesServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if e.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := e.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Contoso/employees` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resp := e.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) + newListByResourceGroupPager = &resp + e.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armcontoso.EmployeesClientListByResourceGroupResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + e.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + e.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (e *EmployeesServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if e.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := e.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Contoso/employees` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resp := e.srv.NewListBySubscriptionPager(nil) + newListBySubscriptionPager = &resp + e.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armcontoso.EmployeesClientListBySubscriptionResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + e.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + e.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (e *EmployeesServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { + if e.srv.Update == nil { + return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Contoso/employees/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[armcontoso.Employee](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + employeeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("employeeName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.Update(req.Context(), resourceGroupNameParam, employeeNameParam, body, 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).Employee, req) + if err != nil { + return nil, err + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to EmployeesServerTransport +var employeesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/contoso/armcontoso/fake/internal.go b/sdk/resourcemanager/contoso/armcontoso/fake/internal.go new file mode 100644 index 000000000000..7425b6a669e2 --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/fake/internal.go @@ -0,0 +1,65 @@ +// 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 ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "net/http" + "sync" +) + +type result struct { + resp *http.Response + err error +} + +type nonRetriableError struct { + error +} + +func (nonRetriableError) NonRetriable() { + // marker method +} + +func contains[T comparable](s []T, v T) bool { + for _, vv := range s { + if vv == v { + return true + } + } + return false +} + +func newTracker[T any]() *tracker[T] { + return &tracker[T]{ + items: map[string]*T{}, + } +} + +type tracker[T any] struct { + items map[string]*T + mu sync.Mutex +} + +func (p *tracker[T]) get(req *http.Request) *T { + p.mu.Lock() + defer p.mu.Unlock() + if item, ok := p.items[server.SanitizePagerPollerPath(req.URL.Path)]; ok { + return item + } + return nil +} + +func (p *tracker[T]) add(req *http.Request, item *T) { + p.mu.Lock() + defer p.mu.Unlock() + p.items[server.SanitizePagerPollerPath(req.URL.Path)] = item +} + +func (p *tracker[T]) remove(req *http.Request) { + p.mu.Lock() + defer p.mu.Unlock() + delete(p.items, server.SanitizePagerPollerPath(req.URL.Path)) +} diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/operations_server.go b/sdk/resourcemanager/contoso/armcontoso/fake/operations_server.go similarity index 80% rename from sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/operations_server.go rename to sdk/resourcemanager/contoso/armcontoso/fake/operations_server.go index 80c82af6c72e..c33444bdc46a 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/operations_server.go +++ b/sdk/resourcemanager/contoso/armcontoso/fake/operations_server.go @@ -11,32 +11,32 @@ import ( "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/devopsinfrastructure/armdevopsinfrastructure" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/contoso/armcontoso" "net/http" ) -// OperationsServer is a fake server for instances of the armdevopsinfrastructure.OperationsClient type. +// OperationsServer is a fake server for instances of the armcontoso.OperationsClient type. type OperationsServer struct { // NewListPager is the fake for method OperationsClient.NewListPager // HTTP status codes to indicate success: http.StatusOK - NewListPager func(options *armdevopsinfrastructure.OperationsClientListOptions) (resp azfake.PagerResponder[armdevopsinfrastructure.OperationsClientListResponse]) + NewListPager func(options *armcontoso.OperationsClientListOptions) (resp azfake.PagerResponder[armcontoso.OperationsClientListResponse]) } // NewOperationsServerTransport creates a new instance of OperationsServerTransport with the provided implementation. -// The returned OperationsServerTransport instance is connected to an instance of armdevopsinfrastructure.OperationsClient via the +// The returned OperationsServerTransport instance is connected to an instance of armcontoso.OperationsClient via the // azcore.ClientOptions.Transporter field in the client's constructor parameters. func NewOperationsServerTransport(srv *OperationsServer) *OperationsServerTransport { return &OperationsServerTransport{ srv: srv, - newListPager: newTracker[azfake.PagerResponder[armdevopsinfrastructure.OperationsClientListResponse]](), + newListPager: newTracker[azfake.PagerResponder[armcontoso.OperationsClientListResponse]](), } } -// OperationsServerTransport connects instances of armdevopsinfrastructure.OperationsClient to instances of OperationsServer. +// OperationsServerTransport connects instances of armcontoso.OperationsClient to instances of OperationsServer. // Don't use this type directly, use NewOperationsServerTransport instead. type OperationsServerTransport struct { srv *OperationsServer - newListPager *tracker[azfake.PagerResponder[armdevopsinfrastructure.OperationsClientListResponse]] + newListPager *tracker[azfake.PagerResponder[armcontoso.OperationsClientListResponse]] } // Do implements the policy.Transporter interface for OperationsServerTransport. @@ -92,7 +92,7 @@ func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*ht resp := o.srv.NewListPager(nil) newListPager = &resp o.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armdevopsinfrastructure.OperationsClientListResponse, createLink func() string) { + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armcontoso.OperationsClientListResponse, createLink func() string) { page.NextLink = to.Ptr(createLink()) }) } diff --git a/sdk/resourcemanager/contoso/armcontoso/fake/server_factory.go b/sdk/resourcemanager/contoso/armcontoso/fake/server_factory.go new file mode 100644 index 000000000000..9ddfd8463c5a --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/fake/server_factory.go @@ -0,0 +1,79 @@ +// 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 ( + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" + "sync" +) + +// ServerFactory is a fake server for instances of the armcontoso.ClientFactory type. +type ServerFactory struct { + // EmployeesServer contains the fakes for client EmployeesClient + EmployeesServer EmployeesServer + + // OperationsServer contains the fakes for client OperationsClient + OperationsServer OperationsServer +} + +// NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. +// The returned ServerFactoryTransport instance is connected to an instance of armcontoso.ClientFactory via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { + return &ServerFactoryTransport{ + srv: srv, + } +} + +// ServerFactoryTransport connects instances of armcontoso.ClientFactory to instances of ServerFactory. +// Don't use this type directly, use NewServerFactoryTransport instead. +type ServerFactoryTransport struct { + srv *ServerFactory + trMu sync.Mutex + trEmployeesServer *EmployeesServerTransport + trOperationsServer *OperationsServerTransport +} + +// Do implements the policy.Transporter interface for ServerFactoryTransport. +func (s *ServerFactoryTransport) 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")} + } + + client := method[:strings.Index(method, ".")] + var resp *http.Response + var err error + + switch client { + case "EmployeesClient": + initServer(s, &s.trEmployeesServer, func() *EmployeesServerTransport { return NewEmployeesServerTransport(&s.srv.EmployeesServer) }) + resp, err = s.trEmployeesServer.Do(req) + case "OperationsClient": + initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) + resp, err = s.trOperationsServer.Do(req) + default: + err = fmt.Errorf("unhandled client %s", client) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func initServer[T any](s *ServerFactoryTransport, dst **T, src func() *T) { + s.trMu.Lock() + if *dst == nil { + *dst = src() + } + s.trMu.Unlock() +} diff --git a/sdk/resourcemanager/contoso/armcontoso/fake/time_rfc3339.go b/sdk/resourcemanager/contoso/armcontoso/fake/time_rfc3339.go new file mode 100644 index 000000000000..87ee11e83b32 --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/fake/time_rfc3339.go @@ -0,0 +1,109 @@ +// 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 ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "regexp" + "strings" + "time" +) + +// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) + +const ( + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` +) + +type dateTimeRFC3339 time.Time + +func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t dateTimeRFC3339) MarshalText() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT + } + return t.Parse(layout, string(data)) +} + +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 + if tzOffset && hasT { + layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = dateTimeRFC3339(p) + return err +} + +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + +func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*dateTimeRFC3339)(t) +} + +func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || string(data) == "null" { + return nil + } + var aux dateTimeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/contoso/armcontoso/go.mod b/sdk/resourcemanager/contoso/armcontoso/go.mod new file mode 100644 index 000000000000..be8cf57f99ca --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/go.mod @@ -0,0 +1,21 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/contoso/armcontoso + +go 1.18 + +require ( + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 +) + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect + github.com/golang-jwt/jwt/v5 v5.2.1 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/kylelemons/godebug v1.1.0 // indirect + github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect + golang.org/x/crypto v0.27.0 // indirect + golang.org/x/net v0.29.0 // indirect + golang.org/x/sys v0.25.0 // indirect + golang.org/x/text v0.18.0 // indirect +) diff --git a/sdk/resourcemanager/contoso/armcontoso/go.sum b/sdk/resourcemanager/contoso/armcontoso/go.sum new file mode 100644 index 000000000000..cbddbbd9ecec --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/go.sum @@ -0,0 +1,29 @@ +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 h1:JZg6HRh6W6U4OLl6lk7BZ7BLisIzM9dG1R50zUk9C/M= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0/go.mod h1:YL1xnZ6QejvQHWJrX/AvhFl4WW4rqHVoKspWNVwFk0M= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0/go.mod h1:iZDifYGJTIgIIkYRNWPENUnqx6bJ2xnSDFI2tjwZNuY= +github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU= +github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= +github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= +github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= +github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= +golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/contoso/armcontoso/models.go b/sdk/resourcemanager/contoso/armcontoso/models.go new file mode 100644 index 000000000000..707e3fe63289 --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/models.go @@ -0,0 +1,125 @@ +// 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 armcontoso + +import "time" + +// Employee resource +type Employee struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // The resource-specific properties for this resource. + Properties *EmployeeProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; The name of the Employee + 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 +} + +// EmployeeListResult - The response of a Employee list operation. +type EmployeeListResult struct { + // REQUIRED; The Employee items on this page + Value []*Employee + + // The link to the next page of items + NextLink *string +} + +// EmployeeProperties - Employee properties +type EmployeeProperties struct { + // Age of employee + Age *int32 + + // City of employee + City *string + + // Profile of employee + Profile []byte + + // READ-ONLY; The status of the last operation. + ProvisioningState *ProvisioningState +} + +// Operation - Details of a REST API operation, returned from the Resource Provider Operations API +type Operation struct { + // Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + ActionType *ActionType + + // 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", + // "Microsoft.Compute/virtualMachines/capture/action" + Name *string + + // READ-ONLY; The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default + // value is "user,system" + Origin *Origin +} + +// 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 + + // READ-ONLY; The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual + // Machine", "Restart Virtual Machine". + Operation *string + + // READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft + // Compute". + Provider *string + + // READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job + // Schedule Collections". + Resource *string +} + +// 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 { + // REQUIRED; The Operation items on this page + Value []*Operation + + // The link to the next page of items + NextLink *string +} + +// SystemData - Metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // The timestamp of resource creation (UTC). + CreatedAt *time.Time + + // The identity that created the resource. + CreatedBy *string + + // The type of identity that created the resource. + CreatedByType *CreatedByType + + // The timestamp of resource last modification (UTC) + LastModifiedAt *time.Time + + // The identity that last modified the resource. + LastModifiedBy *string + + // The type of identity that last modified the resource. + LastModifiedByType *CreatedByType +} diff --git a/sdk/resourcemanager/contoso/armcontoso/models_serde.go b/sdk/resourcemanager/contoso/armcontoso/models_serde.go new file mode 100644 index 000000000000..b3254af63ba4 --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/models_serde.go @@ -0,0 +1,328 @@ +// 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 armcontoso + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type Employee. +func (e Employee) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", e.ID) + populate(objectMap, "location", e.Location) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "systemData", e.SystemData) + populate(objectMap, "tags", e.Tags) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Employee. +func (e *Employee) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &e.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &e.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &e.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EmployeeListResult. +func (e EmployeeListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EmployeeListResult. +func (e *EmployeeListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &e.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &e.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EmployeeProperties. +func (e EmployeeProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "age", e.Age) + populate(objectMap, "city", e.City) + populateByteArray(objectMap, "profile", e.Profile, func() any { + return runtime.EncodeByteArray(e.Profile, runtime.Base64URLFormat) + }) + populate(objectMap, "provisioningState", e.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EmployeeProperties. +func (e *EmployeeProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "age": + err = unpopulate(val, "Age", &e.Age) + delete(rawMsg, key) + case "city": + err = unpopulate(val, "City", &e.City) + delete(rawMsg, key) + case "profile": + if val != nil && string(val) != "null" { + err = runtime.DecodeByteArray(string(val), &e.Profile, runtime.Base64URLFormat) + } + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &e.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actionType", o.ActionType) + populate(objectMap, "display", o.Display) + populate(objectMap, "isDataAction", o.IsDataAction) + populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. +func (o *Operation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionType": + err = unpopulate(val, "ActionType", &o.ActionType) + delete(rawMsg, key) + case "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "isDataAction": + err = unpopulate(val, "IsDataAction", &o.IsDataAction) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &o.Origin) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", o.Description) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. +func (o *OperationDisplay) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &o.Description) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. +func (o *OperationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateDateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) 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 "createdAt": + err = unpopulateDateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, "CreatedByType", &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +func populate(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func populateByteArray[T any](m map[string]any, k string, b []T, convert func() any) { + if azcore.IsNullValue(b) { + m[k] = nil + } else if len(b) == 0 { + return + } else { + m[k] = convert() + } +} + +func unpopulate(data json.RawMessage, fn string, v any) error { + if data == nil || string(data) == "null" { + return nil + } + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + return nil +} diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/operations_client.go b/sdk/resourcemanager/contoso/armcontoso/operations_client.go similarity index 84% rename from sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/operations_client.go rename to sdk/resourcemanager/contoso/armcontoso/operations_client.go index b8bc3adcba32..2a060162ef11 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/operations_client.go +++ b/sdk/resourcemanager/contoso/armcontoso/operations_client.go @@ -1,12 +1,8 @@ -//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 armworkloadssapvirtualinstance +package armcontoso import ( "context" @@ -37,9 +33,9 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO return client, nil } -// NewListPager - Lists all the available API operations under this PR +// NewListPager - List the operations for the provider // -// Generated from API version 2023-10-01-preview +// Generated from API version 2021-10-01-preview // - 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) { - urlPath := "/providers/Microsoft.Workloads/operations" +func (client *OperationsClient) listCreateRequest(ctx context.Context, _ *OperationsClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Contoso/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-10-01-preview") + reqQP.Set("api-version", "2021-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/contoso/armcontoso/operations_client_example_test.go b/sdk/resourcemanager/contoso/armcontoso/operations_client_example_test.go new file mode 100644 index 000000000000..1dfcba0118e7 --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/operations_client_example_test.go @@ -0,0 +1,56 @@ +// 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 armcontoso_test + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/contoso/armcontoso" + "log" +) + +// Generated from example definition: 2021-10-01-preview/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 := armcontoso.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewOperationsClient().NewListPager(nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page = armcontoso.OperationsClientListResponse{ + // OperationListResult: armcontoso.OperationListResult{ + // Value: []*armcontoso.Operation{ + // { + // Name: to.Ptr("ymeow"), + // IsDataAction: to.Ptr(true), + // Display: &armcontoso.OperationDisplay{ + // Provider: to.Ptr("qxyznq"), + // Resource: to.Ptr("bqfwkox"), + // Operation: to.Ptr("td"), + // Description: to.Ptr("yvgkhsuwartgxb"), + // }, + // Origin: to.Ptr(armcontoso.OriginUser), + // ActionType: to.Ptr(armcontoso.ActionTypeInternal), + // }, + // }, + // NextLink: to.Ptr("https://sample.com/nextLink"), + // }, + // } + } +} diff --git a/sdk/resourcemanager/contoso/armcontoso/options.go b/sdk/resourcemanager/contoso/armcontoso/options.go new file mode 100644 index 000000000000..11fee1c76771 --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/options.go @@ -0,0 +1,45 @@ +// 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 armcontoso + +// EmployeesClientBeginCreateOrUpdateOptions contains the optional parameters for the EmployeesClient.BeginCreateOrUpdate +// method. +type EmployeesClientBeginCreateOrUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// EmployeesClientBeginDeleteOptions contains the optional parameters for the EmployeesClient.BeginDelete method. +type EmployeesClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// EmployeesClientGetOptions contains the optional parameters for the EmployeesClient.Get method. +type EmployeesClientGetOptions struct { + // placeholder for future optional parameters +} + +// EmployeesClientListByResourceGroupOptions contains the optional parameters for the EmployeesClient.NewListByResourceGroupPager +// method. +type EmployeesClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// EmployeesClientListBySubscriptionOptions contains the optional parameters for the EmployeesClient.NewListBySubscriptionPager +// method. +type EmployeesClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// EmployeesClientUpdateOptions contains the optional parameters for the EmployeesClient.Update method. +type EmployeesClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} diff --git a/sdk/resourcemanager/contoso/armcontoso/responses.go b/sdk/resourcemanager/contoso/armcontoso/responses.go new file mode 100644 index 000000000000..9b28221cf0cb --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/responses.go @@ -0,0 +1,46 @@ +// 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 armcontoso + +// EmployeesClientCreateOrUpdateResponse contains the response from method EmployeesClient.BeginCreateOrUpdate. +type EmployeesClientCreateOrUpdateResponse struct { + // Employee resource + Employee +} + +// EmployeesClientDeleteResponse contains the response from method EmployeesClient.BeginDelete. +type EmployeesClientDeleteResponse struct { + // placeholder for future response values +} + +// EmployeesClientGetResponse contains the response from method EmployeesClient.Get. +type EmployeesClientGetResponse struct { + // Employee resource + Employee +} + +// EmployeesClientListByResourceGroupResponse contains the response from method EmployeesClient.NewListByResourceGroupPager. +type EmployeesClientListByResourceGroupResponse struct { + // The response of a Employee list operation. + EmployeeListResult +} + +// EmployeesClientListBySubscriptionResponse contains the response from method EmployeesClient.NewListBySubscriptionPager. +type EmployeesClientListBySubscriptionResponse struct { + // The response of a Employee list operation. + EmployeeListResult +} + +// EmployeesClientUpdateResponse contains the response from method EmployeesClient.Update. +type EmployeesClientUpdateResponse struct { + // Employee resource + Employee +} + +// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. +type OperationsClientListResponse struct { + // A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. + OperationListResult +} diff --git a/sdk/resourcemanager/contoso/armcontoso/time_rfc3339.go b/sdk/resourcemanager/contoso/armcontoso/time_rfc3339.go new file mode 100644 index 000000000000..fd129d84c771 --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/time_rfc3339.go @@ -0,0 +1,109 @@ +// 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 armcontoso + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "regexp" + "strings" + "time" +) + +// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) + +const ( + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` +) + +type dateTimeRFC3339 time.Time + +func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t dateTimeRFC3339) MarshalText() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT + } + return t.Parse(layout, string(data)) +} + +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 + if tzOffset && hasT { + layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = dateTimeRFC3339(p) + return err +} + +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + +func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*dateTimeRFC3339)(t) +} + +func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || string(data) == "null" { + return nil + } + var aux dateTimeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/contoso/armcontoso/tsp-location.yaml b/sdk/resourcemanager/contoso/armcontoso/tsp-location.yaml new file mode 100644 index 000000000000..c92ed17e9fcf --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/contosowidgetmanager/Contoso.Management +commit: 405438c72094a0a43fbcba18a56aa71110b78db8 +repo: Azure/azure-rest-api-specs +additionalDirectories: \ No newline at end of file diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/CHANGELOG.md b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/CHANGELOG.md index ff3cd4b4c66f..62954d81291a 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/CHANGELOG.md +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/CHANGELOG.md @@ -1,5 +1,22 @@ # Release History +## 2.0.0 (2024-11-29) +### Breaking Changes + +- Enum `ActionType` has been removed +- Enum `Origin` has been removed +- Function `*OperationsClient.NewListPager` has been removed +- Struct `Operation` has been removed +- Struct `OperationDisplay` has been removed +- Struct `OperationListResult` has been removed + +### Features Added + +- New function `*OperationsClient.NewlistMethodPager(*operationsClientlistMethodOptions) *runtime.Pager[operationsClientlistMethodResponse]` +- New function `PossibleactionTypeValues() []actionType` +- New function `PossibleoriginValues() []origin` + + ## 1.0.0 (2024-11-20) ### Breaking Changes diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/README.md b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/README.md index 68d09e53333c..c814ff08d58f 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/README.md +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/README.md @@ -18,7 +18,7 @@ This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for ve Install the Azure DevOps Infrastructure module: ```sh -go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/v2 ``` ## Authorization diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/constants.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/constants.go index 982aced6c92c..a0ab853cc64b 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/constants.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/constants.go @@ -6,24 +6,9 @@ package armdevopsinfrastructure const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure" - moduleVersion = "v1.0.0" + moduleVersion = "v2.0.0" ) -// 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" -) - -// PossibleActionTypeValues returns the possible values for the ActionType const type. -func PossibleActionTypeValues() []ActionType { - return []ActionType{ - ActionTypeInternal, - } -} - // AzureDevOpsPermissionType - Determines who has admin permissions to the Azure DevOps pool. type AzureDevOpsPermissionType string @@ -132,28 +117,6 @@ func PossibleManagedServiceIdentityTypeValues() []ManagedServiceIdentityType { } } -// Origin - The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default -// value is "user,system" -type Origin string - -const ( - // 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" -) - -// PossibleOriginValues returns the possible values for the Origin const type. -func PossibleOriginValues() []Origin { - return []Origin{ - OriginSystem, - OriginUser, - OriginUserSystem, - } -} - // OsDiskStorageAccountType - The storage account type of the OS disk. type OsDiskStorageAccountType string @@ -360,3 +323,40 @@ func PossibleStorageAccountTypeValues() []StorageAccountType { StorageAccountTypeStandardSSDZRS, } } + +// 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" +) + +// PossibleactionTypeValues returns the possible values for the actionType const type. +func PossibleactionTypeValues() []actionType { + return []actionType{ + actionTypeInternal, + } +} + +// origin - The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default +// value is "user,system" +type origin string + +const ( + // 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" +) + +// PossibleoriginValues returns the possible values for the origin const type. +func PossibleoriginValues() []origin { + return []origin{ + originSystem, + originUser, + originUserSystem, + } +} diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/imageversions_server.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/imageversions_server.go index f1deb466d4ac..4c0f2c1f9c14 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/imageversions_server.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/imageversions_server.go @@ -11,7 +11,7 @@ import ( "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/devopsinfrastructure/armdevopsinfrastructure" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/v2" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/pools_server.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/pools_server.go index 170370591c3f..125b7c92f4ad 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/pools_server.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/pools_server.go @@ -12,7 +12,7 @@ import ( "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/devopsinfrastructure/armdevopsinfrastructure" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/v2" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/resourcedetails_server.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/resourcedetails_server.go index 1c8b334fc009..f14ae88b42ff 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/resourcedetails_server.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/resourcedetails_server.go @@ -11,7 +11,7 @@ import ( "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/devopsinfrastructure/armdevopsinfrastructure" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/v2" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/sku_server.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/sku_server.go index 77e4b048e3a6..4359211f9425 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/sku_server.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/sku_server.go @@ -11,7 +11,7 @@ import ( "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/devopsinfrastructure/armdevopsinfrastructure" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/v2" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/subscriptionusages_server.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/subscriptionusages_server.go index 3cf219301c20..69b483b72d23 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/subscriptionusages_server.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/subscriptionusages_server.go @@ -11,7 +11,7 @@ import ( "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/devopsinfrastructure/armdevopsinfrastructure" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/v2" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/go.mod b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/go.mod index 8f0f110538ce..c7f226691dea 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/go.mod +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/go.mod @@ -1,4 +1,4 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/v2 go 1.18 diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/imageversions_client_example_test.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/imageversions_client_example_test.go index 7b5921223ee3..77af3e989662 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/imageversions_client_example_test.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/imageversions_client_example_test.go @@ -7,7 +7,7 @@ package armdevopsinfrastructure_test import ( "context" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/v2" "log" ) diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/models.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/models.go index 6ae02c449a5e..c4277557d087 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/models.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/models.go @@ -196,55 +196,6 @@ type NetworkProfile struct { SubnetID *string } -// Operation - Details of a REST API operation, returned from the Resource Provider Operations API -type Operation struct { - // Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. - ActionType *ActionType - - // 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", - // "Microsoft.Compute/virtualMachines/capture/action" - Name *string - - // READ-ONLY; The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default - // value is "user,system" - Origin *Origin -} - -// 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 - - // READ-ONLY; The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual - // Machine", "Restart Virtual Machine". - Operation *string - - // READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft - // Compute". - Provider *string - - // READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job - // Schedule Collections". - Resource *string -} - -// 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 { - // REQUIRED; The Operation items on this page - Value []*Operation - - // The link to the next page of items - NextLink *string -} - // Organization - Defines an Azure DevOps organization. type Organization struct { // REQUIRED; The Azure DevOps organization URL in which the pool should be created. @@ -709,3 +660,52 @@ func (v *VmssFabricProfile) GetFabricProfile() *FabricProfile { Kind: v.Kind, } } + +// operation - Details of a REST API operation, returned from the Resource Provider Operations API +type operation struct { + // Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + ActionType *actionType + + // 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", + // "Microsoft.Compute/virtualMachines/capture/action" + Name *string + + // READ-ONLY; The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default + // value is "user,system" + Origin *origin +} + +// 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 + + // READ-ONLY; The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual + // Machine", "Restart Virtual Machine". + Operation *string + + // READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft + // Compute". + Provider *string + + // READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job + // Schedule Collections". + Resource *string +} + +// 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 { + // REQUIRED; The Operation items on this page + Value []*operation + + // The link to the next page of items + NextLink *string +} diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/models_serde.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/models_serde.go index 507dc3d52167..c6524c45675c 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/models_serde.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/models_serde.go @@ -496,119 +496,6 @@ func (n *NetworkProfile) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type Operation. -func (o Operation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "actionType", o.ActionType) - populate(objectMap, "display", o.Display) - populate(objectMap, "isDataAction", o.IsDataAction) - populate(objectMap, "name", o.Name) - populate(objectMap, "origin", o.Origin) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. -func (o *Operation) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "actionType": - err = unpopulate(val, "ActionType", &o.ActionType) - delete(rawMsg, key) - case "display": - err = unpopulate(val, "Display", &o.Display) - delete(rawMsg, key) - case "isDataAction": - err = unpopulate(val, "IsDataAction", &o.IsDataAction) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &o.Name) - delete(rawMsg, key) - case "origin": - err = unpopulate(val, "Origin", &o.Origin) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. -func (o OperationDisplay) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "description", o.Description) - populate(objectMap, "operation", o.Operation) - populate(objectMap, "provider", o.Provider) - populate(objectMap, "resource", o.Resource) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. -func (o *OperationDisplay) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "description": - err = unpopulate(val, "Description", &o.Description) - delete(rawMsg, key) - case "operation": - err = unpopulate(val, "Operation", &o.Operation) - delete(rawMsg, key) - case "provider": - err = unpopulate(val, "Provider", &o.Provider) - delete(rawMsg, key) - case "resource": - err = unpopulate(val, "Resource", &o.Resource) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type OperationListResult. -func (o OperationListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", o.NextLink) - populate(objectMap, "value", o.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. -func (o *OperationListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &o.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &o.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type Organization. func (o Organization) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1762,6 +1649,119 @@ func (v *VmssFabricProfile) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type operation. +func (o operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actionType", o.ActionType) + populate(objectMap, "display", o.Display) + populate(objectMap, "isDataAction", o.IsDataAction) + populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type operation. +func (o *operation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionType": + err = unpopulate(val, "ActionType", &o.ActionType) + delete(rawMsg, key) + case "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "isDataAction": + err = unpopulate(val, "IsDataAction", &o.IsDataAction) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &o.Origin) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type operationDisplay. +func (o operationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", o.Description) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type operationDisplay. +func (o *operationDisplay) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &o.Description) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type operationListResult. +func (o operationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type operationListResult. +func (o *operationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + func populate(m map[string]any, k string, v any) { if v == nil { return diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/operations_client.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/operations_client.go index ed41fb299331..73470df5c364 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/operations_client.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/operations_client.go @@ -33,17 +33,18 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO return client, nil } -// NewListPager - List the operations for the provider +// NewlistMethodPager - List the operations for the provider // // Generated from API version 2024-10-19 -// - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. -func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ - More: func(page OperationsClientListResponse) bool { +// - options - operationsClientlistMethodOptions contains the optional parameters for the OperationsClient.NewlistMethodPager +// method. +func (client *OperationsClient) NewlistMethodPager(options *operationsClientlistMethodOptions) *runtime.Pager[operationsClientlistMethodResponse] { + return runtime.NewPager(runtime.PagingHandler[operationsClientlistMethodResponse]{ + More: func(page operationsClientlistMethodResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, - Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OperationsClient.NewListPager") + Fetcher: func(ctx context.Context, page *operationsClientlistMethodResponse) (operationsClientlistMethodResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OperationsClient.NewlistMethodPager") nextLink := "" if page != nil { nextLink = *page.NextLink @@ -52,7 +53,7 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption return client.listCreateRequest(ctx, options) }, nil) if err != nil { - return OperationsClientListResponse{}, err + return operationsClientlistMethodResponse{}, err } return client.listHandleResponse(resp) }, @@ -60,8 +61,8 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption }) } -// listCreateRequest creates the List request. -func (client *OperationsClient) listCreateRequest(ctx context.Context, _ *OperationsClientListOptions) (*policy.Request, error) { +// listCreateRequest creates the listMethod request. +func (client *OperationsClient) listCreateRequest(ctx context.Context, _ *operationsClientlistMethodOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.DevOpsInfrastructure/operations" req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { @@ -74,11 +75,11 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, _ *Operat return req, nil } -// listHandleResponse handles the List response. -func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) { - result := OperationsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { - return OperationsClientListResponse{}, err +// listHandleResponse handles the listMethod response. +func (client *OperationsClient) listHandleResponse(resp *http.Response) (operationsClientlistMethodResponse, error) { + result := operationsClientlistMethodResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.operationListResult); err != nil { + return operationsClientlistMethodResponse{}, err } return result, nil } diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/operations_client_example_test.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/operations_client_example_test.go index 3808c6d3cfac..f5e5c190b9a3 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/operations_client_example_test.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/operations_client_example_test.go @@ -7,12 +7,12 @@ package armdevopsinfrastructure_test import ( "context" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/v2" "log" ) // Generated from example definition: 2024-10-19/ListOperations.json -func ExampleOperationsClient_NewListPager() { +func ExampleOperationsClient_NewlistMethodPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) @@ -22,7 +22,7 @@ func ExampleOperationsClient_NewListPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewOperationsClient().NewListPager(nil) + pager := clientFactory.NewOperationsClient().NewlistMethodPager(nil) for pager.More() { page, err := pager.NextPage(ctx) if err != nil { @@ -33,8 +33,8 @@ 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 = armdevopsinfrastructure.OperationsClientListResponse{ - // OperationListResult: armdevopsinfrastructure.OperationListResult{ + // page = armdevopsinfrastructure.operationsClientlistMethodResponse{ + // operationListResult: armdevopsinfrastructure.operationListResult{ // }, // } } diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/options.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/options.go index 2da748c0acfc..49acca481a13 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/options.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/options.go @@ -10,11 +10,6 @@ type ImageVersionsClientListByImageOptions struct { // placeholder for future optional parameters } -// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. -type OperationsClientListOptions struct { - // placeholder for future optional parameters -} - // PoolsClientBeginCreateOrUpdateOptions contains the optional parameters for the PoolsClient.BeginCreateOrUpdate method. type PoolsClientBeginCreateOrUpdateOptions struct { // Resumes the long-running operation from the provided token. @@ -65,3 +60,8 @@ type SKUClientListByLocationOptions struct { type SubscriptionUsagesClientUsagesOptions struct { // placeholder for future optional parameters } + +// operationsClientlistMethodOptions contains the optional parameters for the OperationsClient.NewlistMethodPager method. +type operationsClientlistMethodOptions struct { + // placeholder for future optional parameters +} diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/pools_client_example_test.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/pools_client_example_test.go index 7212fff354d0..3b298f06b0ae 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/pools_client_example_test.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/pools_client_example_test.go @@ -8,7 +8,7 @@ import ( "context" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/v2" "log" ) diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/resourcedetails_client_example_test.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/resourcedetails_client_example_test.go index 958a8be7c85a..003465138cb7 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/resourcedetails_client_example_test.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/resourcedetails_client_example_test.go @@ -7,7 +7,7 @@ package armdevopsinfrastructure_test import ( "context" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/v2" "log" ) diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/responses.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/responses.go index ca74a46c3c40..98c03270abff 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/responses.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/responses.go @@ -10,12 +10,6 @@ type ImageVersionsClientListByImageResponse struct { ImageVersionListResult } -// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. -type OperationsClientListResponse struct { - // A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. - OperationListResult -} - // PoolsClientCreateOrUpdateResponse contains the response from method PoolsClient.BeginCreateOrUpdate. type PoolsClientCreateOrUpdateResponse struct { // Concrete tracked resource types can be created by aliasing this type using a specific property type. @@ -68,3 +62,9 @@ type SubscriptionUsagesClientUsagesResponse struct { // Paged collection of Quota items PagedQuota } + +// operationsClientlistMethodResponse contains the response from method OperationsClient.NewlistMethodPager. +type operationsClientlistMethodResponse struct { + // A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. + operationListResult +} diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/sku_client_example_test.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/sku_client_example_test.go index 13f94b53335b..5fa0c7d1ec2e 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/sku_client_example_test.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/sku_client_example_test.go @@ -7,7 +7,7 @@ package armdevopsinfrastructure_test import ( "context" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/v2" "log" ) diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/subscriptionusages_client_example_test.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/subscriptionusages_client_example_test.go index 89ea9b79654c..239f43825fd0 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/subscriptionusages_client_example_test.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/subscriptionusages_client_example_test.go @@ -7,7 +7,7 @@ package armdevopsinfrastructure_test import ( "context" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/v2" "log" ) diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/tsp-location.yaml b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/tsp-location.yaml index 77686a6437bb..825b14b2a50e 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/tsp-location.yaml +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/devopsinfrastructure/Microsoft.DevOpsInfrastructure.Management -commit: d477c7caa09bf82e22c419be0a99d170552b5892 +commit: 405438c72094a0a43fbcba18a56aa71110b78db8 repo: Azure/azure-rest-api-specs -additionalDirectories: +additionalDirectories: \ No newline at end of file diff --git a/sdk/resourcemanager/durabletask/armdurabletask/CHANGELOG.md b/sdk/resourcemanager/durabletask/armdurabletask/CHANGELOG.md new file mode 100644 index 000000000000..914274603f09 --- /dev/null +++ b/sdk/resourcemanager/durabletask/armdurabletask/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 0.1.0 (2024-11-29) +### Other Changes + +The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/durabletask/armdurabletask` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html). + +To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/go/mgmt). \ No newline at end of file diff --git a/sdk/resourcemanager/durabletask/armdurabletask/LICENSE.txt b/sdk/resourcemanager/durabletask/armdurabletask/LICENSE.txt new file mode 100644 index 000000000000..dc0c2ffb3dc1 --- /dev/null +++ b/sdk/resourcemanager/durabletask/armdurabletask/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Microsoft Corporation. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/resourcemanager/durabletask/armdurabletask/README.md b/sdk/resourcemanager/durabletask/armdurabletask/README.md new file mode 100644 index 000000000000..2e67416415e4 --- /dev/null +++ b/sdk/resourcemanager/durabletask/armdurabletask/README.md @@ -0,0 +1,90 @@ +# Azure Durabletask Module for Go + +The `armdurabletask` module provides operations for working with Azure Durabletask. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/durabletask/armdurabletask) + +# Getting started + +## Prerequisites + +- an [Azure subscription](https://azure.microsoft.com/free/) +- Go 1.18 or above (You could download and install the latest version of Go from [here](https://go.dev/doc/install). It will replace the existing Go on your machine. If you want to install multiple Go versions on the same machine, you could refer this [doc](https://go.dev/doc/manage-install).) + +## Install the package + +This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for versioning and dependency management. + +Install the Azure Durabletask module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/durabletask/armdurabletask +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Durabletask. The `azidentity` module provides facilities for various ways of authenticating with Azure including client/secret, certificate, managed identity, and more. + +```go +cred, err := azidentity.NewDefaultAzureCredential(nil) +``` + +For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). + +## Client Factory + +Azure Durabletask module consists of one or more clients. We provide a client factory which could be used to create any client in this module. + +```go +clientFactory, err := armdurabletask.NewClientFactory(, cred, nil) +``` + +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). + +```go +options := arm.ClientOptions { + ClientOptions: azcore.ClientOptions { + Cloud: cloud.AzureChina, + }, +} +clientFactory, err := armdurabletask.NewClientFactory(, cred, &options) +``` + +## Clients + +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.NewSchedulersClient() +``` + +## Fakes + +The fake package contains types used for constructing in-memory fake servers used in unit tests. +This allows writing tests to cover various success/error conditions without the need for connecting to a live service. + +Please see https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/samples/fakes for details and examples on how to use fakes. + +## Provide Feedback + +If you encounter bugs or have suggestions, please +[open an issue](https://github.com/Azure/azure-sdk-for-go/issues) and assign the `Durabletask` label. + +# Contributing + +This project welcomes contributions and suggestions. Most contributions require +you to agree to a Contributor License Agreement (CLA) declaring that you have +the right to, and actually do, grant us the rights to use your contribution. +For details, visit [https://cla.microsoft.com](https://cla.microsoft.com). + +When you submit a pull request, a CLA-bot will automatically determine whether +you need to provide a CLA and decorate the PR appropriately (e.g., label, +comment). Simply follow the instructions provided by the bot. You will only +need to do this once across all repos using our CLA. + +This project has adopted the +[Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). +For more information, see the +[Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) +or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any +additional questions or comments. \ No newline at end of file diff --git a/sdk/resourcemanager/durabletask/armdurabletask/ci.yml b/sdk/resourcemanager/durabletask/armdurabletask/ci.yml new file mode 100644 index 000000000000..10ccccb34798 --- /dev/null +++ b/sdk/resourcemanager/durabletask/armdurabletask/ci.yml @@ -0,0 +1,28 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. +trigger: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/durabletask/armdurabletask/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/durabletask/armdurabletask/ + +extends: + template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + IncludeRelease: true + ServiceDirectory: 'resourcemanager/durabletask/armdurabletask' diff --git a/sdk/resourcemanager/durabletask/armdurabletask/client_factory.go b/sdk/resourcemanager/durabletask/armdurabletask/client_factory.go new file mode 100644 index 000000000000..033693e3a42f --- /dev/null +++ b/sdk/resourcemanager/durabletask/armdurabletask/client_factory.go @@ -0,0 +1,56 @@ +// 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 armdurabletask + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" +) + +// ClientFactory is a client factory used to create any client in this module. +// Don't use this type directly, use NewClientFactory instead. +type ClientFactory struct { + subscriptionID string + internal *arm.Client +} + +// NewClientFactory creates a new instance of ClientFactory with the specified values. +// The parameter values will be propagated to any client created from this factory. +// - 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 NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { + internal, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + return &ClientFactory{ + subscriptionID: subscriptionID, + internal: internal, + }, nil +} + +// NewOperationsClient creates a new instance of OperationsClient. +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + return &OperationsClient{ + internal: c.internal, + } +} + +// NewSchedulersClient creates a new instance of SchedulersClient. +func (c *ClientFactory) NewSchedulersClient() *SchedulersClient { + return &SchedulersClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewTaskHubsClient creates a new instance of TaskHubsClient. +func (c *ClientFactory) NewTaskHubsClient() *TaskHubsClient { + return &TaskHubsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} diff --git a/sdk/resourcemanager/durabletask/armdurabletask/constants.go b/sdk/resourcemanager/durabletask/armdurabletask/constants.go new file mode 100644 index 000000000000..768812617398 --- /dev/null +++ b/sdk/resourcemanager/durabletask/armdurabletask/constants.go @@ -0,0 +1,122 @@ +// 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 armdurabletask + +const ( + moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/durabletask/armdurabletask" + moduleVersion = "v0.1.0" +) + +// 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" +) + +// PossibleActionTypeValues returns the possible values for the ActionType const type. +func PossibleActionTypeValues() []ActionType { + return []ActionType{ + ActionTypeInternal, + } +} + +// CreatedByType - The kind of entity that created the resource. +type CreatedByType string + +const ( + // 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 - The entity was created by a user. + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{ + CreatedByTypeApplication, + CreatedByTypeKey, + CreatedByTypeManagedIdentity, + CreatedByTypeUser, + } +} + +// Origin - The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default +// value is "user,system" +type Origin string + +const ( + // 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" +) + +// PossibleOriginValues returns the possible values for the Origin const type. +func PossibleOriginValues() []Origin { + return []Origin{ + OriginSystem, + OriginUser, + OriginUserSystem, + } +} + +// ProvisioningState - The status of the current operation +type ProvisioningState string + +const ( + // ProvisioningStateAccepted - The resource create request has been accepted + ProvisioningStateAccepted ProvisioningState = "Accepted" + // ProvisioningStateCanceled - Resource creation was canceled. + ProvisioningStateCanceled ProvisioningState = "Canceled" + // ProvisioningStateDeleting - The resource is being deleted + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed - Resource creation failed. + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateProvisioning - The resource is being provisioned + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + // ProvisioningStateSucceeded - Resource has been created. + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + // ProvisioningStateUpdating - The resource is updating + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +// PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ + ProvisioningStateAccepted, + ProvisioningStateCanceled, + ProvisioningStateDeleting, + ProvisioningStateFailed, + ProvisioningStateProvisioning, + ProvisioningStateSucceeded, + ProvisioningStateUpdating, + } +} + +// RedundancyState - The state of the resource redundancy +type RedundancyState string + +const ( + // RedundancyStateNone - The resource is not redundant + RedundancyStateNone RedundancyState = "None" + // RedundancyStateZone - The resource is zone redundant + RedundancyStateZone RedundancyState = "Zone" +) + +// PossibleRedundancyStateValues returns the possible values for the RedundancyState const type. +func PossibleRedundancyStateValues() []RedundancyState { + return []RedundancyState{ + RedundancyStateNone, + RedundancyStateZone, + } +} diff --git a/sdk/resourcemanager/durabletask/armdurabletask/fake/internal.go b/sdk/resourcemanager/durabletask/armdurabletask/fake/internal.go new file mode 100644 index 000000000000..7425b6a669e2 --- /dev/null +++ b/sdk/resourcemanager/durabletask/armdurabletask/fake/internal.go @@ -0,0 +1,65 @@ +// 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 ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "net/http" + "sync" +) + +type result struct { + resp *http.Response + err error +} + +type nonRetriableError struct { + error +} + +func (nonRetriableError) NonRetriable() { + // marker method +} + +func contains[T comparable](s []T, v T) bool { + for _, vv := range s { + if vv == v { + return true + } + } + return false +} + +func newTracker[T any]() *tracker[T] { + return &tracker[T]{ + items: map[string]*T{}, + } +} + +type tracker[T any] struct { + items map[string]*T + mu sync.Mutex +} + +func (p *tracker[T]) get(req *http.Request) *T { + p.mu.Lock() + defer p.mu.Unlock() + if item, ok := p.items[server.SanitizePagerPollerPath(req.URL.Path)]; ok { + return item + } + return nil +} + +func (p *tracker[T]) add(req *http.Request, item *T) { + p.mu.Lock() + defer p.mu.Unlock() + p.items[server.SanitizePagerPollerPath(req.URL.Path)] = item +} + +func (p *tracker[T]) remove(req *http.Request) { + p.mu.Lock() + defer p.mu.Unlock() + delete(p.items, server.SanitizePagerPollerPath(req.URL.Path)) +} diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/operations_server.go b/sdk/resourcemanager/durabletask/armdurabletask/fake/operations_server.go similarity index 56% rename from sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/operations_server.go rename to sdk/resourcemanager/durabletask/armdurabletask/fake/operations_server.go index 3a4100f996de..d147c87663ca 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/operations_server.go +++ b/sdk/resourcemanager/durabletask/armdurabletask/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 @@ -15,32 +11,32 @@ import ( "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/hybridconnectivity/armhybridconnectivity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/durabletask/armdurabletask" "net/http" ) -// OperationsServer is a fake server for instances of the armhybridconnectivity.OperationsClient type. +// OperationsServer is a fake server for instances of the armdurabletask.OperationsClient type. type OperationsServer struct { // NewListPager is the fake for method OperationsClient.NewListPager // HTTP status codes to indicate success: http.StatusOK - NewListPager func(options *armhybridconnectivity.OperationsClientListOptions) (resp azfake.PagerResponder[armhybridconnectivity.OperationsClientListResponse]) + NewListPager func(options *armdurabletask.OperationsClientListOptions) (resp azfake.PagerResponder[armdurabletask.OperationsClientListResponse]) } // NewOperationsServerTransport creates a new instance of OperationsServerTransport with the provided implementation. -// The returned OperationsServerTransport instance is connected to an instance of armhybridconnectivity.OperationsClient via the +// The returned OperationsServerTransport instance is connected to an instance of armdurabletask.OperationsClient via the // azcore.ClientOptions.Transporter field in the client's constructor parameters. func NewOperationsServerTransport(srv *OperationsServer) *OperationsServerTransport { return &OperationsServerTransport{ srv: srv, - newListPager: newTracker[azfake.PagerResponder[armhybridconnectivity.OperationsClientListResponse]](), + newListPager: newTracker[azfake.PagerResponder[armdurabletask.OperationsClientListResponse]](), } } -// OperationsServerTransport connects instances of armhybridconnectivity.OperationsClient to instances of OperationsServer. +// OperationsServerTransport connects instances of armdurabletask.OperationsClient to instances of OperationsServer. // Don't use this type directly, use NewOperationsServerTransport instead. type OperationsServerTransport struct { srv *OperationsServer - newListPager *tracker[azfake.PagerResponder[armhybridconnectivity.OperationsClientListResponse]] + newListPager *tracker[azfake.PagerResponder[armdurabletask.OperationsClientListResponse]] } // Do implements the policy.Transporter interface for OperationsServerTransport. @@ -51,21 +47,40 @@ func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return o.dispatchToMethodFake(req, method) +} - switch method { - case "OperationsClient.NewListPager": - resp, err = o.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (o *OperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if operationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = operationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OperationsClient.NewListPager": + res.resp, res.err = o.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { @@ -77,7 +92,7 @@ func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*ht resp := o.srv.NewListPager(nil) newListPager = &resp o.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armhybridconnectivity.OperationsClientListResponse, createLink func() string) { + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armdurabletask.OperationsClientListResponse, createLink func() string) { page.NextLink = to.Ptr(createLink()) }) } @@ -94,3 +109,9 @@ func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*ht } return resp, nil } + +// set this to conditionally intercept incoming requests to OperationsServerTransport +var operationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/durabletask/armdurabletask/fake/schedulers_server.go b/sdk/resourcemanager/durabletask/armdurabletask/fake/schedulers_server.go new file mode 100644 index 000000000000..98c282491c57 --- /dev/null +++ b/sdk/resourcemanager/durabletask/armdurabletask/fake/schedulers_server.go @@ -0,0 +1,374 @@ +// 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/durabletask/armdurabletask" + "net/http" + "net/url" + "regexp" +) + +// SchedulersServer is a fake server for instances of the armdurabletask.SchedulersClient type. +type SchedulersServer struct { + // BeginCreateOrUpdate is the fake for method SchedulersClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, schedulerName string, resource armdurabletask.Scheduler, options *armdurabletask.SchedulersClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armdurabletask.SchedulersClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method SchedulersClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, schedulerName string, options *armdurabletask.SchedulersClientBeginDeleteOptions) (resp azfake.PollerResponder[armdurabletask.SchedulersClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method SchedulersClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, schedulerName string, options *armdurabletask.SchedulersClientGetOptions) (resp azfake.Responder[armdurabletask.SchedulersClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method SchedulersClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armdurabletask.SchedulersClientListByResourceGroupOptions) (resp azfake.PagerResponder[armdurabletask.SchedulersClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method SchedulersClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armdurabletask.SchedulersClientListBySubscriptionOptions) (resp azfake.PagerResponder[armdurabletask.SchedulersClientListBySubscriptionResponse]) + + // BeginUpdate is the fake for method SchedulersClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, schedulerName string, properties armdurabletask.Scheduler, options *armdurabletask.SchedulersClientBeginUpdateOptions) (resp azfake.PollerResponder[armdurabletask.SchedulersClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewSchedulersServerTransport creates a new instance of SchedulersServerTransport with the provided implementation. +// The returned SchedulersServerTransport instance is connected to an instance of armdurabletask.SchedulersClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewSchedulersServerTransport(srv *SchedulersServer) *SchedulersServerTransport { + return &SchedulersServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armdurabletask.SchedulersClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armdurabletask.SchedulersClientDeleteResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armdurabletask.SchedulersClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armdurabletask.SchedulersClientListBySubscriptionResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armdurabletask.SchedulersClientUpdateResponse]](), + } +} + +// SchedulersServerTransport connects instances of armdurabletask.SchedulersClient to instances of SchedulersServer. +// Don't use this type directly, use NewSchedulersServerTransport instead. +type SchedulersServerTransport struct { + srv *SchedulersServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armdurabletask.SchedulersClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armdurabletask.SchedulersClientDeleteResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armdurabletask.SchedulersClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armdurabletask.SchedulersClientListBySubscriptionResponse]] + beginUpdate *tracker[azfake.PollerResponder[armdurabletask.SchedulersClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for SchedulersServerTransport. +func (s *SchedulersServerTransport) 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 *SchedulersServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if schedulersServerTransportInterceptor != nil { + res.resp, res.err, intercepted = schedulersServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "SchedulersClient.BeginCreateOrUpdate": + res.resp, res.err = s.dispatchBeginCreateOrUpdate(req) + case "SchedulersClient.BeginDelete": + res.resp, res.err = s.dispatchBeginDelete(req) + case "SchedulersClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "SchedulersClient.NewListByResourceGroupPager": + res.resp, res.err = s.dispatchNewListByResourceGroupPager(req) + case "SchedulersClient.NewListBySubscriptionPager": + res.resp, res.err = s.dispatchNewListBySubscriptionPager(req) + case "SchedulersClient.BeginUpdate": + res.resp, res.err = s.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (s *SchedulersServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if s.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := s.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DurableTask/schedulers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[armdurabletask.Scheduler](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + schedulerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("schedulerName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, schedulerNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + s.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + s.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + s.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (s *SchedulersServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if s.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := s.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DurableTask/schedulers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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 + } + schedulerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("schedulerName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginDelete(req.Context(), resourceGroupNameParam, schedulerNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + s.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + s.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + s.beginDelete.remove(req) + } + + return resp, nil +} + +func (s *SchedulersServerTransport) 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\.DurableTask/schedulers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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 + } + schedulerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("schedulerName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Get(req.Context(), resourceGroupNameParam, schedulerNameParam, 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).Scheduler, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SchedulersServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if s.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := s.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DurableTask/schedulers` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resp := s.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) + newListByResourceGroupPager = &resp + s.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armdurabletask.SchedulersClientListByResourceGroupResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + s.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + s.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (s *SchedulersServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if s.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := s.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DurableTask/schedulers` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resp := s.srv.NewListBySubscriptionPager(nil) + newListBySubscriptionPager = &resp + s.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armdurabletask.SchedulersClientListBySubscriptionResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + s.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + s.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (s *SchedulersServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if s.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := s.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DurableTask/schedulers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[armdurabletask.Scheduler](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + schedulerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("schedulerName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginUpdate(req.Context(), resourceGroupNameParam, schedulerNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + s.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + s.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + s.beginUpdate.remove(req) + } + + return resp, nil +} + +// set this to conditionally intercept incoming requests to SchedulersServerTransport +var schedulersServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/durabletask/armdurabletask/fake/server_factory.go b/sdk/resourcemanager/durabletask/armdurabletask/fake/server_factory.go new file mode 100644 index 000000000000..c848fe8a7065 --- /dev/null +++ b/sdk/resourcemanager/durabletask/armdurabletask/fake/server_factory.go @@ -0,0 +1,86 @@ +// 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 ( + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" + "sync" +) + +// ServerFactory is a fake server for instances of the armdurabletask.ClientFactory type. +type ServerFactory struct { + // OperationsServer contains the fakes for client OperationsClient + OperationsServer OperationsServer + + // SchedulersServer contains the fakes for client SchedulersClient + SchedulersServer SchedulersServer + + // TaskHubsServer contains the fakes for client TaskHubsClient + TaskHubsServer TaskHubsServer +} + +// NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. +// The returned ServerFactoryTransport instance is connected to an instance of armdurabletask.ClientFactory via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { + return &ServerFactoryTransport{ + srv: srv, + } +} + +// ServerFactoryTransport connects instances of armdurabletask.ClientFactory to instances of ServerFactory. +// Don't use this type directly, use NewServerFactoryTransport instead. +type ServerFactoryTransport struct { + srv *ServerFactory + trMu sync.Mutex + trOperationsServer *OperationsServerTransport + trSchedulersServer *SchedulersServerTransport + trTaskHubsServer *TaskHubsServerTransport +} + +// Do implements the policy.Transporter interface for ServerFactoryTransport. +func (s *ServerFactoryTransport) 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")} + } + + client := method[:strings.Index(method, ".")] + var resp *http.Response + var err error + + switch client { + case "OperationsClient": + initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) + resp, err = s.trOperationsServer.Do(req) + case "SchedulersClient": + initServer(s, &s.trSchedulersServer, func() *SchedulersServerTransport { return NewSchedulersServerTransport(&s.srv.SchedulersServer) }) + resp, err = s.trSchedulersServer.Do(req) + case "TaskHubsClient": + initServer(s, &s.trTaskHubsServer, func() *TaskHubsServerTransport { return NewTaskHubsServerTransport(&s.srv.TaskHubsServer) }) + resp, err = s.trTaskHubsServer.Do(req) + default: + err = fmt.Errorf("unhandled client %s", client) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func initServer[T any](s *ServerFactoryTransport, dst **T, src func() *T) { + s.trMu.Lock() + if *dst == nil { + *dst = src() + } + s.trMu.Unlock() +} diff --git a/sdk/resourcemanager/durabletask/armdurabletask/fake/taskhubs_server.go b/sdk/resourcemanager/durabletask/armdurabletask/fake/taskhubs_server.go new file mode 100644 index 000000000000..07438a60184c --- /dev/null +++ b/sdk/resourcemanager/durabletask/armdurabletask/fake/taskhubs_server.go @@ -0,0 +1,293 @@ +// 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/durabletask/armdurabletask" + "net/http" + "net/url" + "regexp" +) + +// TaskHubsServer is a fake server for instances of the armdurabletask.TaskHubsClient type. +type TaskHubsServer struct { + // BeginCreateOrUpdate is the fake for method TaskHubsClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, schedulerName string, taskHubName string, resource armdurabletask.TaskHub, options *armdurabletask.TaskHubsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armdurabletask.TaskHubsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method TaskHubsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, schedulerName string, taskHubName string, options *armdurabletask.TaskHubsClientBeginDeleteOptions) (resp azfake.PollerResponder[armdurabletask.TaskHubsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method TaskHubsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, schedulerName string, taskHubName string, options *armdurabletask.TaskHubsClientGetOptions) (resp azfake.Responder[armdurabletask.TaskHubsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListBySchedulerPager is the fake for method TaskHubsClient.NewListBySchedulerPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySchedulerPager func(resourceGroupName string, schedulerName string, options *armdurabletask.TaskHubsClientListBySchedulerOptions) (resp azfake.PagerResponder[armdurabletask.TaskHubsClientListBySchedulerResponse]) +} + +// NewTaskHubsServerTransport creates a new instance of TaskHubsServerTransport with the provided implementation. +// The returned TaskHubsServerTransport instance is connected to an instance of armdurabletask.TaskHubsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewTaskHubsServerTransport(srv *TaskHubsServer) *TaskHubsServerTransport { + return &TaskHubsServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armdurabletask.TaskHubsClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armdurabletask.TaskHubsClientDeleteResponse]](), + newListBySchedulerPager: newTracker[azfake.PagerResponder[armdurabletask.TaskHubsClientListBySchedulerResponse]](), + } +} + +// TaskHubsServerTransport connects instances of armdurabletask.TaskHubsClient to instances of TaskHubsServer. +// Don't use this type directly, use NewTaskHubsServerTransport instead. +type TaskHubsServerTransport struct { + srv *TaskHubsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armdurabletask.TaskHubsClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armdurabletask.TaskHubsClientDeleteResponse]] + newListBySchedulerPager *tracker[azfake.PagerResponder[armdurabletask.TaskHubsClientListBySchedulerResponse]] +} + +// Do implements the policy.Transporter interface for TaskHubsServerTransport. +func (t *TaskHubsServerTransport) 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 t.dispatchToMethodFake(req, method) +} + +func (t *TaskHubsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if taskHubsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = taskHubsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "TaskHubsClient.BeginCreateOrUpdate": + res.resp, res.err = t.dispatchBeginCreateOrUpdate(req) + case "TaskHubsClient.BeginDelete": + res.resp, res.err = t.dispatchBeginDelete(req) + case "TaskHubsClient.Get": + res.resp, res.err = t.dispatchGet(req) + case "TaskHubsClient.NewListBySchedulerPager": + res.resp, res.err = t.dispatchNewListBySchedulerPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (t *TaskHubsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if t.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := t.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DurableTask/schedulers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/taskHubs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armdurabletask.TaskHub](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + schedulerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("schedulerName")]) + if err != nil { + return nil, err + } + taskHubNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("taskHubName")]) + if err != nil { + return nil, err + } + respr, errRespr := t.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, schedulerNameParam, taskHubNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + t.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + t.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + t.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (t *TaskHubsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if t.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := t.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DurableTask/schedulers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/taskHubs/(?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 + } + schedulerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("schedulerName")]) + if err != nil { + return nil, err + } + taskHubNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("taskHubName")]) + if err != nil { + return nil, err + } + respr, errRespr := t.srv.BeginDelete(req.Context(), resourceGroupNameParam, schedulerNameParam, taskHubNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + t.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + t.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + t.beginDelete.remove(req) + } + + return resp, nil +} + +func (t *TaskHubsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if t.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\.DurableTask/schedulers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/taskHubs/(?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 + } + schedulerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("schedulerName")]) + if err != nil { + return nil, err + } + taskHubNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("taskHubName")]) + if err != nil { + return nil, err + } + respr, errRespr := t.srv.Get(req.Context(), resourceGroupNameParam, schedulerNameParam, taskHubNameParam, 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).TaskHub, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (t *TaskHubsServerTransport) dispatchNewListBySchedulerPager(req *http.Request) (*http.Response, error) { + if t.srv.NewListBySchedulerPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySchedulerPager not implemented")} + } + newListBySchedulerPager := t.newListBySchedulerPager.get(req) + if newListBySchedulerPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DurableTask/schedulers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/taskHubs` + 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 + } + schedulerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("schedulerName")]) + if err != nil { + return nil, err + } + resp := t.srv.NewListBySchedulerPager(resourceGroupNameParam, schedulerNameParam, nil) + newListBySchedulerPager = &resp + t.newListBySchedulerPager.add(req, newListBySchedulerPager) + server.PagerResponderInjectNextLinks(newListBySchedulerPager, req, func(page *armdurabletask.TaskHubsClientListBySchedulerResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListBySchedulerPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + t.newListBySchedulerPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySchedulerPager) { + t.newListBySchedulerPager.remove(req) + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to TaskHubsServerTransport +var taskHubsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/durabletask/armdurabletask/fake/time_rfc3339.go b/sdk/resourcemanager/durabletask/armdurabletask/fake/time_rfc3339.go new file mode 100644 index 000000000000..87ee11e83b32 --- /dev/null +++ b/sdk/resourcemanager/durabletask/armdurabletask/fake/time_rfc3339.go @@ -0,0 +1,109 @@ +// 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 ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "regexp" + "strings" + "time" +) + +// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) + +const ( + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` +) + +type dateTimeRFC3339 time.Time + +func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t dateTimeRFC3339) MarshalText() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT + } + return t.Parse(layout, string(data)) +} + +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 + if tzOffset && hasT { + layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = dateTimeRFC3339(p) + return err +} + +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + +func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*dateTimeRFC3339)(t) +} + +func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || string(data) == "null" { + return nil + } + var aux dateTimeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/durabletask/armdurabletask/go.mod b/sdk/resourcemanager/durabletask/armdurabletask/go.mod new file mode 100644 index 000000000000..f77beed24400 --- /dev/null +++ b/sdk/resourcemanager/durabletask/armdurabletask/go.mod @@ -0,0 +1,21 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/durabletask/armdurabletask + +go 1.18 + +require ( + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 +) + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect + github.com/golang-jwt/jwt/v5 v5.2.1 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/kylelemons/godebug v1.1.0 // indirect + github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect + golang.org/x/crypto v0.27.0 // indirect + golang.org/x/net v0.29.0 // indirect + golang.org/x/sys v0.25.0 // indirect + golang.org/x/text v0.18.0 // indirect +) diff --git a/sdk/resourcemanager/durabletask/armdurabletask/go.sum b/sdk/resourcemanager/durabletask/armdurabletask/go.sum new file mode 100644 index 000000000000..cbddbbd9ecec --- /dev/null +++ b/sdk/resourcemanager/durabletask/armdurabletask/go.sum @@ -0,0 +1,29 @@ +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 h1:JZg6HRh6W6U4OLl6lk7BZ7BLisIzM9dG1R50zUk9C/M= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0/go.mod h1:YL1xnZ6QejvQHWJrX/AvhFl4WW4rqHVoKspWNVwFk0M= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0/go.mod h1:iZDifYGJTIgIIkYRNWPENUnqx6bJ2xnSDFI2tjwZNuY= +github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU= +github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= +github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= +github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= +github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= +golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/durabletask/armdurabletask/models.go b/sdk/resourcemanager/durabletask/armdurabletask/models.go new file mode 100644 index 000000000000..214506bc8410 --- /dev/null +++ b/sdk/resourcemanager/durabletask/armdurabletask/models.go @@ -0,0 +1,173 @@ +// 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 armdurabletask + +import "time" + +// Operation - Details of a REST API operation, returned from the Resource Provider Operations API +type Operation struct { + // Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + ActionType *ActionType + + // 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", + // "Microsoft.Compute/virtualMachines/capture/action" + Name *string + + // READ-ONLY; The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default + // value is "user,system" + Origin *Origin +} + +// 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 + + // READ-ONLY; The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual + // Machine", "Restart Virtual Machine". + Operation *string + + // READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft + // Compute". + Provider *string + + // READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job + // Schedule Collections". + Resource *string +} + +// 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 { + // REQUIRED; The Operation items on this page + Value []*Operation + + // The link to the next page of items + NextLink *string +} + +// Scheduler - A Durable Task Scheduler resource +type Scheduler struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // The resource-specific properties for this resource. + Properties *SchedulerProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; The name of the Scheduler + 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 +} + +// SchedulerListResult - The response of a Scheduler list operation. +type SchedulerListResult struct { + // REQUIRED; The Scheduler items on this page + Value []*Scheduler + + // The link to the next page of items + NextLink *string +} + +// SchedulerProperties - Details of the Scheduler +type SchedulerProperties struct { + // REQUIRED; IP allow list for durable task scheduler. Values can be IPv4, IPv6 or CIDR + IPAllowlist []*string + + // REQUIRED; SKU of the durable task scheduler + SKU *SchedulerSKU + + // READ-ONLY; URL of the durable task scheduler + Endpoint *string + + // READ-ONLY; The status of the last operation + ProvisioningState *ProvisioningState +} + +// SchedulerSKU - The SKU (Stock Keeping Unit) assigned to this durable task scheduler +type SchedulerSKU struct { + // REQUIRED; The name of the SKU + Name *string + + // The SKU capacity. This allows scale out/in for the resource and impacts zone redundancy + Capacity *int32 + + // READ-ONLY; Indicates whether the current SKU configuration is zone redundant + RedundancyState *RedundancyState +} + +// SystemData - Metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // The timestamp of resource creation (UTC). + CreatedAt *time.Time + + // The identity that created the resource. + CreatedBy *string + + // The type of identity that created the resource. + CreatedByType *CreatedByType + + // The timestamp of resource last modification (UTC) + LastModifiedAt *time.Time + + // The identity that last modified the resource. + LastModifiedBy *string + + // The type of identity that last modified the resource. + LastModifiedByType *CreatedByType +} + +// TaskHub - A Task Hub resource belonging to the scheduler +type TaskHub struct { + // The resource-specific properties for this resource. + Properties *TaskHubProperties + + // READ-ONLY; The name of the TaskHub + 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 +} + +// TaskHubListResult - The response of a TaskHub list operation. +type TaskHubListResult struct { + // REQUIRED; The TaskHub items on this page + Value []*TaskHub + + // The link to the next page of items + NextLink *string +} + +// TaskHubProperties - The properties of Task Hub +type TaskHubProperties struct { + // READ-ONLY; URL of the durable task scheduler dashboard + DashboardURL *string + + // READ-ONLY; The status of the last operation + ProvisioningState *ProvisioningState +} diff --git a/sdk/resourcemanager/durabletask/armdurabletask/models_serde.go b/sdk/resourcemanager/durabletask/armdurabletask/models_serde.go new file mode 100644 index 000000000000..26f2e2d7d9fb --- /dev/null +++ b/sdk/resourcemanager/durabletask/armdurabletask/models_serde.go @@ -0,0 +1,453 @@ +// 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 armdurabletask + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actionType", o.ActionType) + populate(objectMap, "display", o.Display) + populate(objectMap, "isDataAction", o.IsDataAction) + populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. +func (o *Operation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionType": + err = unpopulate(val, "ActionType", &o.ActionType) + delete(rawMsg, key) + case "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "isDataAction": + err = unpopulate(val, "IsDataAction", &o.IsDataAction) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &o.Origin) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", o.Description) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. +func (o *OperationDisplay) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &o.Description) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. +func (o *OperationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Scheduler. +func (s Scheduler) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", s.ID) + populate(objectMap, "location", s.Location) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "tags", s.Tags) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Scheduler. +func (s *Scheduler) 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 "location": + err = unpopulate(val, "Location", &s.Location) + 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 "tags": + err = unpopulate(val, "Tags", &s.Tags) + 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 SchedulerListResult. +func (s SchedulerListResult) 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 SchedulerListResult. +func (s *SchedulerListResult) 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 SchedulerProperties. +func (s SchedulerProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "endpoint", s.Endpoint) + populate(objectMap, "ipAllowlist", s.IPAllowlist) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "sku", s.SKU) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SchedulerProperties. +func (s *SchedulerProperties) 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 "endpoint": + err = unpopulate(val, "Endpoint", &s.Endpoint) + delete(rawMsg, key) + case "ipAllowlist": + err = unpopulate(val, "IPAllowlist", &s.IPAllowlist) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &s.SKU) + 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 SchedulerSKU. +func (s SchedulerSKU) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "capacity", s.Capacity) + populate(objectMap, "name", s.Name) + populate(objectMap, "redundancyState", s.RedundancyState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SchedulerSKU. +func (s *SchedulerSKU) 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 "capacity": + err = unpopulate(val, "Capacity", &s.Capacity) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "redundancyState": + err = unpopulate(val, "RedundancyState", &s.RedundancyState) + 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 SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateDateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) 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 "createdAt": + err = unpopulateDateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, "CreatedByType", &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) + 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 TaskHub. +func (t TaskHub) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", t.ID) + populate(objectMap, "name", t.Name) + populate(objectMap, "properties", t.Properties) + populate(objectMap, "systemData", t.SystemData) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TaskHub. +func (t *TaskHub) 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", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &t.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &t.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &t.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TaskHubListResult. +func (t TaskHubListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", t.NextLink) + populate(objectMap, "value", t.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TaskHubListResult. +func (t *TaskHubListResult) 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", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &t.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &t.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TaskHubProperties. +func (t TaskHubProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dashboardUrl", t.DashboardURL) + populate(objectMap, "provisioningState", t.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TaskHubProperties. +func (t *TaskHubProperties) 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", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dashboardUrl": + err = unpopulate(val, "DashboardURL", &t.DashboardURL) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &t.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +func populate(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, fn string, v any) error { + if data == nil || string(data) == "null" { + return nil + } + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + return nil +} diff --git a/sdk/resourcemanager/durabletask/armdurabletask/operations_client.go b/sdk/resourcemanager/durabletask/armdurabletask/operations_client.go new file mode 100644 index 000000000000..e04bf17dd55d --- /dev/null +++ b/sdk/resourcemanager/durabletask/armdurabletask/operations_client.go @@ -0,0 +1,84 @@ +// 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 armdurabletask + +import ( + "context" + "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" +) + +// OperationsClient contains the methods for the Operations group. +// Don't use this type directly, use NewOperationsClient() instead. +type OperationsClient struct { + internal *arm.Client +} + +// NewOperationsClient creates a new instance of OperationsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &OperationsClient{ + internal: cl, + } + return client, nil +} + +// NewListPager - List the operations for the provider +// +// Generated from API version 2024-10-01-preview +// - 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]{ + More: func(page OperationsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OperationsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, nil) + if err != nil { + return OperationsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *OperationsClient) listCreateRequest(ctx context.Context, _ *OperationsClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.DurableTask/operations" + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) { + result := OperationsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { + return OperationsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/durabletask/armdurabletask/operations_client_example_test.go b/sdk/resourcemanager/durabletask/armdurabletask/operations_client_example_test.go new file mode 100644 index 000000000000..b6a09b3c04bf --- /dev/null +++ b/sdk/resourcemanager/durabletask/armdurabletask/operations_client_example_test.go @@ -0,0 +1,56 @@ +// 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 armdurabletask_test + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/durabletask/armdurabletask" + "log" +) + +// Generated from example definition: 2024-10-01-preview/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 := armdurabletask.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewOperationsClient().NewListPager(nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page = armdurabletask.OperationsClientListResponse{ + // OperationListResult: armdurabletask.OperationListResult{ + // Value: []*armdurabletask.Operation{ + // { + // Name: to.Ptr("jqsgzvpbtspnikfz"), + // IsDataAction: to.Ptr(true), + // Display: &armdurabletask.OperationDisplay{ + // Provider: to.Ptr("bosyazksbxugcbsdipxwmdc"), + // Resource: to.Ptr("texxqckghuv"), + // Operation: to.Ptr("cwgwrxyusyqdrcbxrlmnjzpwxatuk"), + // Description: to.Ptr("mqzopqigvcyggcvezqgvyufbd"), + // }, + // Origin: to.Ptr(armdurabletask.OriginUser), + // ActionType: to.Ptr(armdurabletask.ActionTypeInternal), + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/akpblld"), + // }, + // } + } +} diff --git a/sdk/resourcemanager/durabletask/armdurabletask/options.go b/sdk/resourcemanager/durabletask/armdurabletask/options.go new file mode 100644 index 000000000000..0b89a2fa1e01 --- /dev/null +++ b/sdk/resourcemanager/durabletask/armdurabletask/options.go @@ -0,0 +1,68 @@ +// 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 armdurabletask + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// SchedulersClientBeginCreateOrUpdateOptions contains the optional parameters for the SchedulersClient.BeginCreateOrUpdate +// method. +type SchedulersClientBeginCreateOrUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// SchedulersClientBeginDeleteOptions contains the optional parameters for the SchedulersClient.BeginDelete method. +type SchedulersClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// SchedulersClientBeginUpdateOptions contains the optional parameters for the SchedulersClient.BeginUpdate method. +type SchedulersClientBeginUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// SchedulersClientGetOptions contains the optional parameters for the SchedulersClient.Get method. +type SchedulersClientGetOptions struct { + // placeholder for future optional parameters +} + +// SchedulersClientListByResourceGroupOptions contains the optional parameters for the SchedulersClient.NewListByResourceGroupPager +// method. +type SchedulersClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// SchedulersClientListBySubscriptionOptions contains the optional parameters for the SchedulersClient.NewListBySubscriptionPager +// method. +type SchedulersClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// TaskHubsClientBeginCreateOrUpdateOptions contains the optional parameters for the TaskHubsClient.BeginCreateOrUpdate method. +type TaskHubsClientBeginCreateOrUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// TaskHubsClientBeginDeleteOptions contains the optional parameters for the TaskHubsClient.BeginDelete method. +type TaskHubsClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// TaskHubsClientGetOptions contains the optional parameters for the TaskHubsClient.Get method. +type TaskHubsClientGetOptions struct { + // placeholder for future optional parameters +} + +// TaskHubsClientListBySchedulerOptions contains the optional parameters for the TaskHubsClient.NewListBySchedulerPager method. +type TaskHubsClientListBySchedulerOptions struct { + // placeholder for future optional parameters +} diff --git a/sdk/resourcemanager/durabletask/armdurabletask/responses.go b/sdk/resourcemanager/durabletask/armdurabletask/responses.go new file mode 100644 index 000000000000..98a93ab5ca8b --- /dev/null +++ b/sdk/resourcemanager/durabletask/armdurabletask/responses.go @@ -0,0 +1,69 @@ +// 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 armdurabletask + +// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. +type OperationsClientListResponse struct { + // A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. + OperationListResult +} + +// SchedulersClientCreateOrUpdateResponse contains the response from method SchedulersClient.BeginCreateOrUpdate. +type SchedulersClientCreateOrUpdateResponse struct { + // A Durable Task Scheduler resource + Scheduler +} + +// SchedulersClientDeleteResponse contains the response from method SchedulersClient.BeginDelete. +type SchedulersClientDeleteResponse struct { + // placeholder for future response values +} + +// SchedulersClientGetResponse contains the response from method SchedulersClient.Get. +type SchedulersClientGetResponse struct { + // A Durable Task Scheduler resource + Scheduler +} + +// SchedulersClientListByResourceGroupResponse contains the response from method SchedulersClient.NewListByResourceGroupPager. +type SchedulersClientListByResourceGroupResponse struct { + // The response of a Scheduler list operation. + SchedulerListResult +} + +// SchedulersClientListBySubscriptionResponse contains the response from method SchedulersClient.NewListBySubscriptionPager. +type SchedulersClientListBySubscriptionResponse struct { + // The response of a Scheduler list operation. + SchedulerListResult +} + +// SchedulersClientUpdateResponse contains the response from method SchedulersClient.BeginUpdate. +type SchedulersClientUpdateResponse struct { + // A Durable Task Scheduler resource + Scheduler +} + +// TaskHubsClientCreateOrUpdateResponse contains the response from method TaskHubsClient.BeginCreateOrUpdate. +type TaskHubsClientCreateOrUpdateResponse struct { + // A Task Hub resource belonging to the scheduler + TaskHub +} + +// TaskHubsClientDeleteResponse contains the response from method TaskHubsClient.BeginDelete. +type TaskHubsClientDeleteResponse struct { + // placeholder for future response values +} + +// TaskHubsClientGetResponse contains the response from method TaskHubsClient.Get. +type TaskHubsClientGetResponse struct { + // A Task Hub resource belonging to the scheduler + TaskHub +} + +// TaskHubsClientListBySchedulerResponse contains the response from method TaskHubsClient.NewListBySchedulerPager. +type TaskHubsClientListBySchedulerResponse struct { + // The response of a TaskHub list operation. + TaskHubListResult +} diff --git a/sdk/resourcemanager/durabletask/armdurabletask/schedulers_client.go b/sdk/resourcemanager/durabletask/armdurabletask/schedulers_client.go new file mode 100644 index 000000000000..73494324aaf6 --- /dev/null +++ b/sdk/resourcemanager/durabletask/armdurabletask/schedulers_client.go @@ -0,0 +1,455 @@ +// 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 armdurabletask + +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" +) + +// SchedulersClient contains the methods for the Schedulers group. +// Don't use this type directly, use NewSchedulersClient() instead. +type SchedulersClient struct { + internal *arm.Client + subscriptionID string +} + +// NewSchedulersClient creates a new instance of SchedulersClient 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 NewSchedulersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SchedulersClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SchedulersClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create or update a Scheduler +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - schedulerName - The name of the Scheduler +// - resource - Resource create parameters. +// - options - SchedulersClientBeginCreateOrUpdateOptions contains the optional parameters for the SchedulersClient.BeginCreateOrUpdate +// method. +func (client *SchedulersClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, schedulerName string, resource Scheduler, options *SchedulersClientBeginCreateOrUpdateOptions) (*runtime.Poller[SchedulersClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, schedulerName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SchedulersClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SchedulersClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create or update a Scheduler +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +func (client *SchedulersClient) createOrUpdate(ctx context.Context, resourceGroupName string, schedulerName string, resource Scheduler, options *SchedulersClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "SchedulersClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, schedulerName, resource, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *SchedulersClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, schedulerName string, resource Scheduler, _ *SchedulersClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}" + 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 schedulerName == "" { + return nil, errors.New("parameter schedulerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{schedulerName}", url.PathEscape(schedulerName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-10-01-preview") + 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 + } + return req, nil +} + +// BeginDelete - Delete a Scheduler +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - schedulerName - The name of the Scheduler +// - options - SchedulersClientBeginDeleteOptions contains the optional parameters for the SchedulersClient.BeginDelete method. +func (client *SchedulersClient) BeginDelete(ctx context.Context, resourceGroupName string, schedulerName string, options *SchedulersClientBeginDeleteOptions) (*runtime.Poller[SchedulersClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, schedulerName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SchedulersClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SchedulersClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete a Scheduler +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +func (client *SchedulersClient) deleteOperation(ctx context.Context, resourceGroupName string, schedulerName string, options *SchedulersClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "SchedulersClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, schedulerName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *SchedulersClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, schedulerName string, _ *SchedulersClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}" + 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 schedulerName == "" { + return nil, errors.New("parameter schedulerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{schedulerName}", url.PathEscape(schedulerName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a Scheduler +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - schedulerName - The name of the Scheduler +// - options - SchedulersClientGetOptions contains the optional parameters for the SchedulersClient.Get method. +func (client *SchedulersClient) Get(ctx context.Context, resourceGroupName string, schedulerName string, options *SchedulersClientGetOptions) (SchedulersClientGetResponse, error) { + var err error + const operationName = "SchedulersClient.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, schedulerName, options) + if err != nil { + return SchedulersClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SchedulersClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SchedulersClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *SchedulersClient) getCreateRequest(ctx context.Context, resourceGroupName string, schedulerName string, _ *SchedulersClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}" + 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 schedulerName == "" { + return nil, errors.New("parameter schedulerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{schedulerName}", url.PathEscape(schedulerName)) + 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-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *SchedulersClient) getHandleResponse(resp *http.Response) (SchedulersClientGetResponse, error) { + result := SchedulersClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Scheduler); err != nil { + return SchedulersClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - List Schedulers by resource group +// +// Generated from API version 2024-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - SchedulersClientListByResourceGroupOptions contains the optional parameters for the SchedulersClient.NewListByResourceGroupPager +// method. +func (client *SchedulersClient) NewListByResourceGroupPager(resourceGroupName string, options *SchedulersClientListByResourceGroupOptions) *runtime.Pager[SchedulersClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[SchedulersClientListByResourceGroupResponse]{ + More: func(page SchedulersClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SchedulersClientListByResourceGroupResponse) (SchedulersClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SchedulersClient.NewListByResourceGroupPager") + 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.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return SchedulersClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *SchedulersClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *SchedulersClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers" + 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)) + 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-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *SchedulersClient) listByResourceGroupHandleResponse(resp *http.Response) (SchedulersClientListByResourceGroupResponse, error) { + result := SchedulersClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SchedulerListResult); err != nil { + return SchedulersClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - List Schedulers by subscription +// +// Generated from API version 2024-10-01-preview +// - options - SchedulersClientListBySubscriptionOptions contains the optional parameters for the SchedulersClient.NewListBySubscriptionPager +// method. +func (client *SchedulersClient) NewListBySubscriptionPager(options *SchedulersClientListBySubscriptionOptions) *runtime.Pager[SchedulersClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[SchedulersClientListBySubscriptionResponse]{ + More: func(page SchedulersClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SchedulersClientListBySubscriptionResponse) (SchedulersClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SchedulersClient.NewListBySubscriptionPager") + 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.listBySubscriptionCreateRequest(ctx, options) + }, nil) + if err != nil { + return SchedulersClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *SchedulersClient) listBySubscriptionCreateRequest(ctx context.Context, _ *SchedulersClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DurableTask/schedulers" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + 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-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *SchedulersClient) listBySubscriptionHandleResponse(resp *http.Response) (SchedulersClientListBySubscriptionResponse, error) { + result := SchedulersClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SchedulerListResult); err != nil { + return SchedulersClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// BeginUpdate - Update a Scheduler +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - schedulerName - The name of the Scheduler +// - properties - The resource properties to be updated. +// - options - SchedulersClientBeginUpdateOptions contains the optional parameters for the SchedulersClient.BeginUpdate method. +func (client *SchedulersClient) BeginUpdate(ctx context.Context, resourceGroupName string, schedulerName string, properties Scheduler, options *SchedulersClientBeginUpdateOptions) (*runtime.Poller[SchedulersClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, schedulerName, properties, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SchedulersClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SchedulersClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Update a Scheduler +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +func (client *SchedulersClient) update(ctx context.Context, resourceGroupName string, schedulerName string, properties Scheduler, options *SchedulersClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "SchedulersClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, schedulerName, properties, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateCreateRequest creates the Update request. +func (client *SchedulersClient) updateCreateRequest(ctx context.Context, resourceGroupName string, schedulerName string, properties Scheduler, _ *SchedulersClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}" + 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 schedulerName == "" { + return nil, errors.New("parameter schedulerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{schedulerName}", url.PathEscape(schedulerName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-10-01-preview") + 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 + } + return req, nil +} diff --git a/sdk/resourcemanager/durabletask/armdurabletask/schedulers_client_example_test.go b/sdk/resourcemanager/durabletask/armdurabletask/schedulers_client_example_test.go new file mode 100644 index 000000000000..72474d070a4b --- /dev/null +++ b/sdk/resourcemanager/durabletask/armdurabletask/schedulers_client_example_test.go @@ -0,0 +1,347 @@ +// 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 armdurabletask_test + +import ( + "context" + "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/durabletask/armdurabletask" + "log" +) + +// Generated from example definition: 2024-10-01-preview/Schedulers_CreateOrUpdate.json +func ExampleSchedulersClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdurabletask.NewClientFactory("EE9BD735-67CE-4A90-89C4-439D3F6A4C93", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSchedulersClient().BeginCreateOrUpdate(ctx, "rgopenapi", "testscheduler", armdurabletask.Scheduler{ + Location: to.Ptr("northcentralus"), + Properties: &armdurabletask.SchedulerProperties{ + IPAllowlist: []*string{ + to.Ptr("10.0.0.0/8"), + }, + SKU: &armdurabletask.SchedulerSKU{ + Name: to.Ptr("Dedicated"), + }, + }, + Tags: map[string]*string{ + "key7131": to.Ptr("ryohwcoiccwsnewjigfmijz"), + "key2138": to.Ptr("fjaeecgnvqd"), + }, + }, 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 = armdurabletask.SchedulersClientCreateOrUpdateResponse{ + // Scheduler: &armdurabletask.Scheduler{ + // Location: to.Ptr("northcentralus"), + // Properties: &armdurabletask.SchedulerProperties{ + // ProvisioningState: to.Ptr(armdurabletask.ProvisioningStateSucceeded), + // Endpoint: to.Ptr("https://test.northcentralus.1.durabletask.io"), + // IPAllowlist: []*string{ + // to.Ptr("10.0.0.0/8"), + // }, + // SKU: &armdurabletask.SchedulerSKU{ + // Name: to.Ptr("Dedicated"), + // Capacity: to.Ptr[int32](3), + // RedundancyState: to.Ptr(armdurabletask.RedundancyStateZone), + // }, + // }, + // Tags: map[string]*string{ + // "key7131": to.Ptr("ryohwcoiccwsnewjigfmijz"), + // "key2138": to.Ptr("fjaeecgnvqd"), + // }, + // ID: to.Ptr("/subscriptions/EE9BD735-67CE-4A90-89C4-439D3F6A4C93/resourceGroups/rgopenapi/providers/Microsoft.DurableTask/schedulers/testscheduler"), + // Name: to.Ptr("fwxpolhofploqzwdooyg"), + // Type: to.Ptr("vwqdbpynxwfhiopdypuabwvfohnr"), + // SystemData: &armdurabletask.SystemData{ + // CreatedBy: to.Ptr("tenmbevaunjzikxowqexrsx"), + // CreatedByType: to.Ptr(armdurabletask.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-17T15:34:17.365Z"); return t}()), + // LastModifiedBy: to.Ptr("xfvdcegtj"), + // LastModifiedByType: to.Ptr(armdurabletask.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-17T15:34:17.366Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2024-10-01-preview/Schedulers_Delete.json +func ExampleSchedulersClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdurabletask.NewClientFactory("EE9BD735-67CE-4A90-89C4-439D3F6A4C93", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSchedulersClient().BeginDelete(ctx, "rgopenapi", "testscheduler", 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: 2024-10-01-preview/Schedulers_Get.json +func ExampleSchedulersClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdurabletask.NewClientFactory("EE9BD735-67CE-4A90-89C4-439D3F6A4C93", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSchedulersClient().Get(ctx, "rgopenapi", "testscheduler", 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 = armdurabletask.SchedulersClientGetResponse{ + // Scheduler: &armdurabletask.Scheduler{ + // Location: to.Ptr("northcentralus"), + // Properties: &armdurabletask.SchedulerProperties{ + // ProvisioningState: to.Ptr(armdurabletask.ProvisioningStateSucceeded), + // Endpoint: to.Ptr("https://test.northcentralus.1.durabletask.io"), + // IPAllowlist: []*string{ + // to.Ptr("10.0.0.0/8"), + // }, + // SKU: &armdurabletask.SchedulerSKU{ + // Name: to.Ptr("Dedicated"), + // Capacity: to.Ptr[int32](3), + // RedundancyState: to.Ptr(armdurabletask.RedundancyStateZone), + // }, + // }, + // Tags: map[string]*string{ + // "key7131": to.Ptr("ryohwcoiccwsnewjigfmijz"), + // "key2138": to.Ptr("fjaeecgnvqd"), + // }, + // ID: to.Ptr("/subscriptions/EE9BD735-67CE-4A90-89C4-439D3F6A4C93/resourceGroups/rgopenapi/providers/Microsoft.DurableTask/schedulers/testscheduler"), + // Name: to.Ptr("testscheduler"), + // Type: to.Ptr("vwqdbpynxwfhiopdypuabwvfohnr"), + // SystemData: &armdurabletask.SystemData{ + // CreatedBy: to.Ptr("tenmbevaunjzikxowqexrsx"), + // CreatedByType: to.Ptr(armdurabletask.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-17T15:34:17.365Z"); return t}()), + // LastModifiedBy: to.Ptr("xfvdcegtj"), + // LastModifiedByType: to.Ptr(armdurabletask.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-17T15:34:17.366Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2024-10-01-preview/Schedulers_ListByResourceGroup.json +func ExampleSchedulersClient_NewListByResourceGroupPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdurabletask.NewClientFactory("EE9BD735-67CE-4A90-89C4-439D3F6A4C93", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewSchedulersClient().NewListByResourceGroupPager("rgopenapi", 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 = armdurabletask.SchedulersClientListByResourceGroupResponse{ + // SchedulerListResult: armdurabletask.SchedulerListResult{ + // Value: []*armdurabletask.Scheduler{ + // { + // ID: to.Ptr("/subscriptions/EE9BD735-67CE-4A90-89C4-439D3F6A4C93/resourceGroups/rgopenapi/providers/Microsoft.DurableTask/schedulers/testscheduler"), + // Location: to.Ptr("northcentralus"), + // Properties: &armdurabletask.SchedulerProperties{ + // ProvisioningState: to.Ptr(armdurabletask.ProvisioningStateSucceeded), + // Endpoint: to.Ptr("https://test.northcentralus.1.durabletask.io"), + // IPAllowlist: []*string{ + // to.Ptr("10.0.0.0/8"), + // }, + // SKU: &armdurabletask.SchedulerSKU{ + // Name: to.Ptr("Dedicated"), + // Capacity: to.Ptr[int32](3), + // RedundancyState: to.Ptr(armdurabletask.RedundancyStateZone), + // }, + // }, + // Tags: map[string]*string{ + // "key2138": to.Ptr("fjaeecgnvqd"), + // }, + // Name: to.Ptr("testscheduler"), + // Type: to.Ptr("tglszobjxdhauglzxuqozeg"), + // SystemData: &armdurabletask.SystemData{ + // CreatedBy: to.Ptr("tenmbevaunjzikxowqexrsx"), + // CreatedByType: to.Ptr(armdurabletask.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-17T15:34:17.365Z"); return t}()), + // LastModifiedBy: to.Ptr("xfvdcegtj"), + // LastModifiedByType: to.Ptr(armdurabletask.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-17T15:34:17.366Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} + +// Generated from example definition: 2024-10-01-preview/Schedulers_ListBySubscription.json +func ExampleSchedulersClient_NewListBySubscriptionPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdurabletask.NewClientFactory("EE9BD735-67CE-4A90-89C4-439D3F6A4C93", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewSchedulersClient().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 = armdurabletask.SchedulersClientListBySubscriptionResponse{ + // SchedulerListResult: armdurabletask.SchedulerListResult{ + // Value: []*armdurabletask.Scheduler{ + // { + // ID: to.Ptr("/subscriptions/EE9BD735-67CE-4A90-89C4-439D3F6A4C93/resourceGroups/rgopenapi/providers/Microsoft.DurableTask/schedulers/testscheduler"), + // Location: to.Ptr("northcentralus"), + // Properties: &armdurabletask.SchedulerProperties{ + // ProvisioningState: to.Ptr(armdurabletask.ProvisioningStateSucceeded), + // Endpoint: to.Ptr("https://test.northcentralus.1.durabletask.io"), + // IPAllowlist: []*string{ + // to.Ptr("10.0.0.0/8"), + // }, + // SKU: &armdurabletask.SchedulerSKU{ + // Name: to.Ptr("Dedicated"), + // Capacity: to.Ptr[int32](3), + // RedundancyState: to.Ptr(armdurabletask.RedundancyStateZone), + // }, + // }, + // Tags: map[string]*string{ + // "key2138": to.Ptr("fjaeecgnvqd"), + // }, + // Name: to.Ptr("testscheduler"), + // Type: to.Ptr("tglszobjxdhauglzxuqozeg"), + // SystemData: &armdurabletask.SystemData{ + // CreatedBy: to.Ptr("tenmbevaunjzikxowqexrsx"), + // CreatedByType: to.Ptr(armdurabletask.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-17T15:34:17.365Z"); return t}()), + // LastModifiedBy: to.Ptr("xfvdcegtj"), + // LastModifiedByType: to.Ptr(armdurabletask.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-17T15:34:17.366Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} + +// Generated from example definition: 2024-10-01-preview/Schedulers_Update.json +func ExampleSchedulersClient_BeginUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdurabletask.NewClientFactory("EE9BD735-67CE-4A90-89C4-439D3F6A4C93", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSchedulersClient().BeginUpdate(ctx, "rgopenapi", "testscheduler", armdurabletask.Scheduler{ + Tags: map[string]*string{ + "key8653": to.Ptr("lr"), + }, + Properties: &armdurabletask.SchedulerProperties{ + IPAllowlist: []*string{ + to.Ptr("10.0.0.0/8"), + }, + SKU: &armdurabletask.SchedulerSKU{ + Name: to.Ptr("Dedicated"), + Capacity: to.Ptr[int32](10), + }, + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res = armdurabletask.SchedulersClientUpdateResponse{ + // Scheduler: &armdurabletask.Scheduler{ + // Location: to.Ptr("northcentralus"), + // Properties: &armdurabletask.SchedulerProperties{ + // ProvisioningState: to.Ptr(armdurabletask.ProvisioningStateSucceeded), + // Endpoint: to.Ptr("https://test.northcentralus.1.durabletask.io"), + // IPAllowlist: []*string{ + // to.Ptr("10.0.0.0/8"), + // }, + // SKU: &armdurabletask.SchedulerSKU{ + // Name: to.Ptr("Dedicated"), + // Capacity: to.Ptr[int32](3), + // RedundancyState: to.Ptr(armdurabletask.RedundancyStateZone), + // }, + // }, + // Tags: map[string]*string{ + // "key7131": to.Ptr("ryohwcoiccwsnewjigfmijz"), + // "key2138": to.Ptr("fjaeecgnvqd"), + // }, + // ID: to.Ptr("/subscriptions/EE9BD735-67CE-4A90-89C4-439D3F6A4C93/resourceGroups/rgopenapi/providers/Microsoft.DurableTask/schedulers/testscheduler"), + // Name: to.Ptr("testscheduler"), + // Type: to.Ptr("vwqdbpynxwfhiopdypuabwvfohnr"), + // SystemData: &armdurabletask.SystemData{ + // CreatedBy: to.Ptr("tenmbevaunjzikxowqexrsx"), + // CreatedByType: to.Ptr(armdurabletask.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-17T15:34:17.365Z"); return t}()), + // LastModifiedBy: to.Ptr("xfvdcegtj"), + // LastModifiedByType: to.Ptr(armdurabletask.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-17T15:34:17.366Z"); return t}()), + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/durabletask/armdurabletask/taskhubs_client.go b/sdk/resourcemanager/durabletask/armdurabletask/taskhubs_client.go new file mode 100644 index 000000000000..f03e53eb2ca6 --- /dev/null +++ b/sdk/resourcemanager/durabletask/armdurabletask/taskhubs_client.go @@ -0,0 +1,340 @@ +// 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 armdurabletask + +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" +) + +// TaskHubsClient contains the methods for the TaskHubs group. +// Don't use this type directly, use NewTaskHubsClient() instead. +type TaskHubsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewTaskHubsClient creates a new instance of TaskHubsClient 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 NewTaskHubsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*TaskHubsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &TaskHubsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create or Update a Task Hub +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - schedulerName - The name of the Scheduler +// - taskHubName - The name of the TaskHub +// - resource - Resource create parameters. +// - options - TaskHubsClientBeginCreateOrUpdateOptions contains the optional parameters for the TaskHubsClient.BeginCreateOrUpdate +// method. +func (client *TaskHubsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, schedulerName string, taskHubName string, resource TaskHub, options *TaskHubsClientBeginCreateOrUpdateOptions) (*runtime.Poller[TaskHubsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, schedulerName, taskHubName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[TaskHubsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[TaskHubsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create or Update a Task Hub +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +func (client *TaskHubsClient) createOrUpdate(ctx context.Context, resourceGroupName string, schedulerName string, taskHubName string, resource TaskHub, options *TaskHubsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "TaskHubsClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, schedulerName, taskHubName, resource, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *TaskHubsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, schedulerName string, taskHubName string, resource TaskHub, _ *TaskHubsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}/taskHubs/{taskHubName}" + 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 schedulerName == "" { + return nil, errors.New("parameter schedulerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{schedulerName}", url.PathEscape(schedulerName)) + if taskHubName == "" { + return nil, errors.New("parameter taskHubName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{taskHubName}", url.PathEscape(taskHubName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-10-01-preview") + 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 + } + return req, nil +} + +// BeginDelete - Delete a Task Hub +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - schedulerName - The name of the Scheduler +// - taskHubName - The name of the TaskHub +// - options - TaskHubsClientBeginDeleteOptions contains the optional parameters for the TaskHubsClient.BeginDelete method. +func (client *TaskHubsClient) BeginDelete(ctx context.Context, resourceGroupName string, schedulerName string, taskHubName string, options *TaskHubsClientBeginDeleteOptions) (*runtime.Poller[TaskHubsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, schedulerName, taskHubName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[TaskHubsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[TaskHubsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete a Task Hub +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +func (client *TaskHubsClient) deleteOperation(ctx context.Context, resourceGroupName string, schedulerName string, taskHubName string, options *TaskHubsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "TaskHubsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, schedulerName, taskHubName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *TaskHubsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, schedulerName string, taskHubName string, _ *TaskHubsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}/taskHubs/{taskHubName}" + 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 schedulerName == "" { + return nil, errors.New("parameter schedulerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{schedulerName}", url.PathEscape(schedulerName)) + if taskHubName == "" { + return nil, errors.New("parameter taskHubName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{taskHubName}", url.PathEscape(taskHubName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a Task Hub +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - schedulerName - The name of the Scheduler +// - taskHubName - The name of the TaskHub +// - options - TaskHubsClientGetOptions contains the optional parameters for the TaskHubsClient.Get method. +func (client *TaskHubsClient) Get(ctx context.Context, resourceGroupName string, schedulerName string, taskHubName string, options *TaskHubsClientGetOptions) (TaskHubsClientGetResponse, error) { + var err error + const operationName = "TaskHubsClient.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, schedulerName, taskHubName, options) + if err != nil { + return TaskHubsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return TaskHubsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return TaskHubsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *TaskHubsClient) getCreateRequest(ctx context.Context, resourceGroupName string, schedulerName string, taskHubName string, _ *TaskHubsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}/taskHubs/{taskHubName}" + 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 schedulerName == "" { + return nil, errors.New("parameter schedulerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{schedulerName}", url.PathEscape(schedulerName)) + if taskHubName == "" { + return nil, errors.New("parameter taskHubName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{taskHubName}", url.PathEscape(taskHubName)) + 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-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *TaskHubsClient) getHandleResponse(resp *http.Response) (TaskHubsClientGetResponse, error) { + result := TaskHubsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TaskHub); err != nil { + return TaskHubsClientGetResponse{}, err + } + return result, nil +} + +// NewListBySchedulerPager - List Task Hubs +// +// Generated from API version 2024-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - schedulerName - The name of the Scheduler +// - options - TaskHubsClientListBySchedulerOptions contains the optional parameters for the TaskHubsClient.NewListBySchedulerPager +// method. +func (client *TaskHubsClient) NewListBySchedulerPager(resourceGroupName string, schedulerName string, options *TaskHubsClientListBySchedulerOptions) *runtime.Pager[TaskHubsClientListBySchedulerResponse] { + return runtime.NewPager(runtime.PagingHandler[TaskHubsClientListBySchedulerResponse]{ + More: func(page TaskHubsClientListBySchedulerResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *TaskHubsClientListBySchedulerResponse) (TaskHubsClientListBySchedulerResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "TaskHubsClient.NewListBySchedulerPager") + 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.listBySchedulerCreateRequest(ctx, resourceGroupName, schedulerName, options) + }, nil) + if err != nil { + return TaskHubsClientListBySchedulerResponse{}, err + } + return client.listBySchedulerHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySchedulerCreateRequest creates the ListByScheduler request. +func (client *TaskHubsClient) listBySchedulerCreateRequest(ctx context.Context, resourceGroupName string, schedulerName string, _ *TaskHubsClientListBySchedulerOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}/taskHubs" + 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 schedulerName == "" { + return nil, errors.New("parameter schedulerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{schedulerName}", url.PathEscape(schedulerName)) + 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-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySchedulerHandleResponse handles the ListByScheduler response. +func (client *TaskHubsClient) listBySchedulerHandleResponse(resp *http.Response) (TaskHubsClientListBySchedulerResponse, error) { + result := TaskHubsClientListBySchedulerResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TaskHubListResult); err != nil { + return TaskHubsClientListBySchedulerResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/durabletask/armdurabletask/taskhubs_client_example_test.go b/sdk/resourcemanager/durabletask/armdurabletask/taskhubs_client_example_test.go new file mode 100644 index 000000000000..08af105cf7ba --- /dev/null +++ b/sdk/resourcemanager/durabletask/armdurabletask/taskhubs_client_example_test.go @@ -0,0 +1,166 @@ +// 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 armdurabletask_test + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/durabletask/armdurabletask" + "log" +) + +// Generated from example definition: 2024-10-01-preview/TaskHubs_CreateOrUpdate.json +func ExampleTaskHubsClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdurabletask.NewClientFactory("EE9BD735-67CE-4A90-89C4-439D3F6A4C93", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewTaskHubsClient().BeginCreateOrUpdate(ctx, "rgopenapi", "testscheduler", "testtaskhub", armdurabletask.TaskHub{ + Properties: &armdurabletask.TaskHubProperties{}, + }, 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 = armdurabletask.TaskHubsClientCreateOrUpdateResponse{ + // TaskHub: &armdurabletask.TaskHub{ + // Properties: &armdurabletask.TaskHubProperties{ + // ProvisioningState: to.Ptr(armdurabletask.ProvisioningStateSucceeded), + // DashboardURL: to.Ptr("https://test-db.northcentralus.1.durabletask.io/taskhubs/testtaskhub"), + // }, + // ID: to.Ptr("/subscriptions/EE9BD735-67CE-4A90-89C4-439D3F6A4C93/resourceGroups/rgopenapi/providers/Microsoft.DurableTask/schedulers/testscheduler/taskHubs/testtaskhub"), + // Name: to.Ptr("testtaskhub"), + // Type: to.Ptr("afoounwhp"), + // SystemData: &armdurabletask.SystemData{ + // CreatedBy: to.Ptr("tenmbevaunjzikxowqexrsx"), + // CreatedByType: to.Ptr(armdurabletask.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-17T15:34:17.365Z"); return t}()), + // LastModifiedBy: to.Ptr("xfvdcegtj"), + // LastModifiedByType: to.Ptr(armdurabletask.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-17T15:34:17.366Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2024-10-01-preview/TaskHubs_Delete.json +func ExampleTaskHubsClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdurabletask.NewClientFactory("EE9BD735-67CE-4A90-89C4-439D3F6A4C93", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewTaskHubsClient().BeginDelete(ctx, "rgopenapi", "testscheduler", "testtuskhub", 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: 2024-10-01-preview/TaskHubs_Get.json +func ExampleTaskHubsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdurabletask.NewClientFactory("EE9BD735-67CE-4A90-89C4-439D3F6A4C93", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewTaskHubsClient().Get(ctx, "rgopenapi", "testscheduler", "testtuskhub", 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 = armdurabletask.TaskHubsClientGetResponse{ + // TaskHub: &armdurabletask.TaskHub{ + // Properties: &armdurabletask.TaskHubProperties{ + // ProvisioningState: to.Ptr(armdurabletask.ProvisioningStateSucceeded), + // DashboardURL: to.Ptr("https://test-db.northcentralus.1.durabletask.io/taskhubs/testtaskhub"), + // }, + // ID: to.Ptr("/subscriptions/EE9BD735-67CE-4A90-89C4-439D3F6A4C93/resourceGroups/rgopenapi/providers/Microsoft.DurableTask/schedulers/testscheduler/taskHubs/testtaskhub"), + // Name: to.Ptr("testtaskhub"), + // Type: to.Ptr("afoounwhp"), + // SystemData: &armdurabletask.SystemData{ + // CreatedBy: to.Ptr("tenmbevaunjzikxowqexrsx"), + // CreatedByType: to.Ptr(armdurabletask.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-17T15:34:17.365Z"); return t}()), + // LastModifiedBy: to.Ptr("xfvdcegtj"), + // LastModifiedByType: to.Ptr(armdurabletask.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-17T15:34:17.366Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2024-10-01-preview/TaskHubs_ListByScheduler.json +func ExampleTaskHubsClient_NewListBySchedulerPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdurabletask.NewClientFactory("EE9BD735-67CE-4A90-89C4-439D3F6A4C93", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewTaskHubsClient().NewListBySchedulerPager("rgopenapi", "testtaskhub", 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 = armdurabletask.TaskHubsClientListBySchedulerResponse{ + // TaskHubListResult: armdurabletask.TaskHubListResult{ + // Value: []*armdurabletask.TaskHub{ + // { + // ID: to.Ptr("/subscriptions/EE9BD735-67CE-4A90-89C4-439D3F6A4C93/resourceGroups/rgopenapi/providers/Microsoft.DurableTask/schedulers/testscheduler/taskHubs/testtaskhub"), + // Properties: &armdurabletask.TaskHubProperties{ + // ProvisioningState: to.Ptr(armdurabletask.ProvisioningStateSucceeded), + // DashboardURL: to.Ptr("https://test-db.northcentralus.1.durabletask.io/taskhubs/testtaskhub"), + // }, + // Name: to.Ptr("testtaskhub"), + // Type: to.Ptr("enkfjxsqktqyeiibofppkxruyb"), + // SystemData: &armdurabletask.SystemData{ + // CreatedBy: to.Ptr("tenmbevaunjzikxowqexrsx"), + // CreatedByType: to.Ptr(armdurabletask.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-17T15:34:17.365Z"); return t}()), + // LastModifiedBy: to.Ptr("xfvdcegtj"), + // LastModifiedByType: to.Ptr(armdurabletask.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-17T15:34:17.366Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} diff --git a/sdk/resourcemanager/durabletask/armdurabletask/time_rfc3339.go b/sdk/resourcemanager/durabletask/armdurabletask/time_rfc3339.go new file mode 100644 index 000000000000..3324a2c277ad --- /dev/null +++ b/sdk/resourcemanager/durabletask/armdurabletask/time_rfc3339.go @@ -0,0 +1,109 @@ +// 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 armdurabletask + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "regexp" + "strings" + "time" +) + +// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) + +const ( + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` +) + +type dateTimeRFC3339 time.Time + +func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t dateTimeRFC3339) MarshalText() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT + } + return t.Parse(layout, string(data)) +} + +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 + if tzOffset && hasT { + layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = dateTimeRFC3339(p) + return err +} + +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + +func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*dateTimeRFC3339)(t) +} + +func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || string(data) == "null" { + return nil + } + var aux dateTimeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/durabletask/armdurabletask/tsp-location.yaml b/sdk/resourcemanager/durabletask/armdurabletask/tsp-location.yaml new file mode 100644 index 000000000000..1c2f9799d711 --- /dev/null +++ b/sdk/resourcemanager/durabletask/armdurabletask/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/durabletask/DurableTask.Management +commit: 405438c72094a0a43fbcba18a56aa71110b78db8 +repo: Azure/azure-rest-api-specs +additionalDirectories: \ No newline at end of file diff --git a/sdk/resourcemanager/edgezones/armedgezones/CHANGELOG.md b/sdk/resourcemanager/edgezones/armedgezones/CHANGELOG.md index ca1869b2b5e7..42744496efbc 100644 --- a/sdk/resourcemanager/edgezones/armedgezones/CHANGELOG.md +++ b/sdk/resourcemanager/edgezones/armedgezones/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 0.1.1 (2024-11-29) +### Other Changes + + ## 0.1.0 (2024-07-08) ### Other Changes diff --git a/sdk/resourcemanager/edgezones/armedgezones/constants.go b/sdk/resourcemanager/edgezones/armedgezones/constants.go index 63895bc68229..252cf1ee0675 100644 --- a/sdk/resourcemanager/edgezones/armedgezones/constants.go +++ b/sdk/resourcemanager/edgezones/armedgezones/constants.go @@ -6,7 +6,7 @@ package armedgezones const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/edgezones/armedgezones" - moduleVersion = "v0.1.0" + moduleVersion = "v0.1.1" ) // ActionType - Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. diff --git a/sdk/resourcemanager/edgezones/armedgezones/extendedzones_client_example_test.go b/sdk/resourcemanager/edgezones/armedgezones/extendedzones_client_example_test.go new file mode 100644 index 000000000000..fd5ddbe17eca --- /dev/null +++ b/sdk/resourcemanager/edgezones/armedgezones/extendedzones_client_example_test.go @@ -0,0 +1,199 @@ +// 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 armedgezones_test + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/edgezones/armedgezones" + "log" +) + +// Generated from example definition: 2024-04-01-preview/ExtendedZones_Get.json +func ExampleExtendedZonesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armedgezones.NewClientFactory("a1ffc958-d2c7-493e-9f1e-125a0477f536", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewExtendedZonesClient().Get(ctx, "losangeles", 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 = armedgezones.ExtendedZonesClientGetResponse{ + // ExtendedZone: &armedgezones.ExtendedZone{ + // ID: to.Ptr("/subscriptions/a1ffc958-d2c7-493e-9f1e-125a0477f536/providers/Microsoft.EdgeZones/extendedZones/losangeles"), + // Name: to.Ptr("losangeles"), + // Type: to.Ptr("Microsoft.EdgeZones/extendedZones"), + // Properties: &armedgezones.ExtendedZoneProperties{ + // ProvisioningState: to.Ptr(armedgezones.ProvisioningStateSucceeded), + // RegistrationState: to.Ptr(armedgezones.RegistrationStateNotRegistered), + // DisplayName: to.Ptr("Los Angeles"), + // RegionalDisplayName: to.Ptr("(US) Los Angeles"), + // RegionType: to.Ptr("Physical"), + // RegionCategory: to.Ptr("Other"), + // Geography: to.Ptr("usa"), + // GeographyGroup: to.Ptr("US"), + // Longitude: to.Ptr("-118.23537"), + // Latitude: to.Ptr("34.058414"), + // HomeLocation: to.Ptr("westus"), + // }, + // }, + // } +} + +// Generated from example definition: 2024-04-01-preview/ExtendedZones_ListBySubscription.json +func ExampleExtendedZonesClient_NewListBySubscriptionPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armedgezones.NewClientFactory("a1ffc958-d2c7-493e-9f1e-125a0477f536", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewExtendedZonesClient().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 = armedgezones.ExtendedZonesClientListBySubscriptionResponse{ + // ExtendedZoneListResult: armedgezones.ExtendedZoneListResult{ + // Value: []*armedgezones.ExtendedZone{ + // { + // ID: to.Ptr("/subscriptions/a1ffc958-d2c7-493e-9f1e-125a0477f536/providers/Microsoft.EdgeZones/extendedZones/redmond"), + // Name: to.Ptr("redmond"), + // Type: to.Ptr("Microsoft.EdgeZones/extendedZones"), + // Properties: &armedgezones.ExtendedZoneProperties{ + // ProvisioningState: to.Ptr(armedgezones.ProvisioningStateSucceeded), + // RegistrationState: to.Ptr(armedgezones.RegistrationStateNotRegistered), + // DisplayName: to.Ptr("Redmond"), + // RegionalDisplayName: to.Ptr("(US) Redmond"), + // RegionType: to.Ptr("Physical"), + // RegionCategory: to.Ptr("Other"), + // Geography: to.Ptr("usa"), + // GeographyGroup: to.Ptr("US"), + // Longitude: to.Ptr("-122.03197"), + // Latitude: to.Ptr("47.69106"), + // HomeLocation: to.Ptr("westus"), + // }, + // }, + // { + // ID: to.Ptr("/subscriptions/a1ffc958-d2c7-493e-9f1e-125a0477f536/providers/Microsoft.EdgeZones/extendedZones/losangeles"), + // Name: to.Ptr("losangeles"), + // Type: to.Ptr("Microsoft.EdgeZones/extendedZones"), + // Properties: &armedgezones.ExtendedZoneProperties{ + // ProvisioningState: to.Ptr(armedgezones.ProvisioningStateSucceeded), + // RegistrationState: to.Ptr(armedgezones.RegistrationStateNotRegistered), + // DisplayName: to.Ptr("Los Angeles"), + // RegionalDisplayName: to.Ptr("(US) Los Angeles"), + // RegionType: to.Ptr("Physical"), + // RegionCategory: to.Ptr("Other"), + // Geography: to.Ptr("usa"), + // GeographyGroup: to.Ptr("US"), + // Longitude: to.Ptr("-118.23537"), + // Latitude: to.Ptr("34.058414"), + // HomeLocation: to.Ptr("westus"), + // }, + // }, + // }, + // }, + // } + } +} + +// Generated from example definition: 2024-04-01-preview/ExtendedZones_Register.json +func ExampleExtendedZonesClient_Register() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armedgezones.NewClientFactory("a1ffc958-d2c7-493e-9f1e-125a0477f536", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewExtendedZonesClient().Register(ctx, "losangeles", 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 = armedgezones.ExtendedZonesClientRegisterResponse{ + // ExtendedZone: &armedgezones.ExtendedZone{ + // ID: to.Ptr("/subscriptions/a1ffc958-d2c7-493e-9f1e-125a0477f536/providers/Microsoft.EdgeZones/extendedZones/losangeles"), + // Name: to.Ptr("losangeles"), + // Type: to.Ptr("Microsoft.EdgeZones/extendedZones"), + // Properties: &armedgezones.ExtendedZoneProperties{ + // ProvisioningState: to.Ptr(armedgezones.ProvisioningStateSucceeded), + // RegistrationState: to.Ptr(armedgezones.RegistrationStatePendingRegister), + // DisplayName: to.Ptr("Los Angeles"), + // RegionalDisplayName: to.Ptr("(US) Los Angeles"), + // RegionType: to.Ptr("Physical"), + // RegionCategory: to.Ptr("Other"), + // Geography: to.Ptr("usa"), + // GeographyGroup: to.Ptr("US"), + // Longitude: to.Ptr("-118.23537"), + // Latitude: to.Ptr("34.058414"), + // HomeLocation: to.Ptr("westus"), + // }, + // }, + // } +} + +// Generated from example definition: 2024-04-01-preview/ExtendedZones_Unregister.json +func ExampleExtendedZonesClient_Unregister() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armedgezones.NewClientFactory("a1ffc958-d2c7-493e-9f1e-125a0477f536", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewExtendedZonesClient().Unregister(ctx, "losangeles", 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 = armedgezones.ExtendedZonesClientUnregisterResponse{ + // ExtendedZone: &armedgezones.ExtendedZone{ + // ID: to.Ptr("/subscriptions/a1ffc958-d2c7-493e-9f1e-125a0477f536/providers/Microsoft.EdgeZones/extendedZones/losangeles"), + // Name: to.Ptr("losangeles"), + // Type: to.Ptr("Microsoft.EdgeZones/extendedZones"), + // Properties: &armedgezones.ExtendedZoneProperties{ + // ProvisioningState: to.Ptr(armedgezones.ProvisioningStateSucceeded), + // RegistrationState: to.Ptr(armedgezones.RegistrationStatePendingUnregister), + // DisplayName: to.Ptr("Los Angeles"), + // RegionalDisplayName: to.Ptr("(US) Los Angeles"), + // RegionType: to.Ptr("Physical"), + // RegionCategory: to.Ptr("Other"), + // Geography: to.Ptr("usa"), + // GeographyGroup: to.Ptr("US"), + // Longitude: to.Ptr("-118.23537"), + // Latitude: to.Ptr("34.058414"), + // HomeLocation: to.Ptr("westus"), + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/edgezones/armedgezones/fake/extendedzones_server.go b/sdk/resourcemanager/edgezones/armedgezones/fake/extendedzones_server.go index a7afa6c3916b..d11517be93d7 100644 --- a/sdk/resourcemanager/edgezones/armedgezones/fake/extendedzones_server.go +++ b/sdk/resourcemanager/edgezones/armedgezones/fake/extendedzones_server.go @@ -66,23 +66,42 @@ func (e *ExtendedZonesServerTransport) Do(req *http.Request) (*http.Response, er } func (e *ExtendedZonesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error - - switch method { - case "ExtendedZonesClient.Get": - resp, err = e.dispatchGet(req) - case "ExtendedZonesClient.NewListBySubscriptionPager": - resp, err = e.dispatchNewListBySubscriptionPager(req) - case "ExtendedZonesClient.Register": - resp, err = e.dispatchRegister(req) - case "ExtendedZonesClient.Unregister": - resp, err = e.dispatchUnregister(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - return resp, err + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if extendedZonesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = extendedZonesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ExtendedZonesClient.Get": + res.resp, res.err = e.dispatchGet(req) + case "ExtendedZonesClient.NewListBySubscriptionPager": + res.resp, res.err = e.dispatchNewListBySubscriptionPager(req) + case "ExtendedZonesClient.Register": + res.resp, res.err = e.dispatchRegister(req) + case "ExtendedZonesClient.Unregister": + res.resp, res.err = e.dispatchUnregister(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (e *ExtendedZonesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -204,3 +223,9 @@ func (e *ExtendedZonesServerTransport) dispatchUnregister(req *http.Request) (*h } return resp, nil } + +// set this to conditionally intercept incoming requests to ExtendedZonesServerTransport +var extendedZonesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/edgezones/armedgezones/fake/internal.go b/sdk/resourcemanager/edgezones/armedgezones/fake/internal.go index 56a8f624f5f3..7425b6a669e2 100644 --- a/sdk/resourcemanager/edgezones/armedgezones/fake/internal.go +++ b/sdk/resourcemanager/edgezones/armedgezones/fake/internal.go @@ -10,6 +10,11 @@ import ( "sync" ) +type result struct { + resp *http.Response + err error +} + type nonRetriableError struct { error } diff --git a/sdk/resourcemanager/edgezones/armedgezones/fake/operations_server.go b/sdk/resourcemanager/edgezones/armedgezones/fake/operations_server.go index ce9c5fa14931..63dddb8e075e 100644 --- a/sdk/resourcemanager/edgezones/armedgezones/fake/operations_server.go +++ b/sdk/resourcemanager/edgezones/armedgezones/fake/operations_server.go @@ -51,17 +51,36 @@ func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error } func (o *OperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error + resultChan := make(chan result) + defer close(resultChan) - switch method { - case "OperationsClient.NewListPager": - resp, err = o.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + go func() { + var intercepted bool + var res result + if operationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = operationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OperationsClient.NewListPager": + res.resp, res.err = o.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() - return resp, err + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { @@ -90,3 +109,9 @@ func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*ht } return resp, nil } + +// set this to conditionally intercept incoming requests to OperationsServerTransport +var operationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/edgezones/armedgezones/go.mod b/sdk/resourcemanager/edgezones/armedgezones/go.mod index 44e2bc978470..8dccee942ca0 100644 --- a/sdk/resourcemanager/edgezones/armedgezones/go.mod +++ b/sdk/resourcemanager/edgezones/armedgezones/go.mod @@ -3,14 +3,14 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/edgezones/armedgezo go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3 v3.0.0 github.com/stretchr/testify v1.9.0 ) require ( - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.2.0 // indirect github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect @@ -19,9 +19,9 @@ require ( github.com/kylelemons/godebug v1.1.0 // indirect github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - golang.org/x/crypto v0.25.0 // indirect - golang.org/x/net v0.27.0 // indirect - golang.org/x/sys v0.22.0 // indirect - golang.org/x/text v0.16.0 // indirect + golang.org/x/crypto v0.27.0 // indirect + golang.org/x/net v0.29.0 // indirect + golang.org/x/sys v0.25.0 // indirect + golang.org/x/text v0.18.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/resourcemanager/edgezones/armedgezones/go.sum b/sdk/resourcemanager/edgezones/armedgezones/go.sum index 62db0b470914..768880efbd66 100644 --- a/sdk/resourcemanager/edgezones/armedgezones/go.sum +++ b/sdk/resourcemanager/edgezones/armedgezones/go.sum @@ -1,5 +1,5 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 h1:GJHeeA2N7xrG3q30L2UXDyuWRzDM900/65j70wcM4Ww= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 h1:JZg6HRh6W6U4OLl6lk7BZ7BLisIzM9dG1R50zUk9C/M= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0/go.mod h1:YL1xnZ6QejvQHWJrX/AvhFl4WW4rqHVoKspWNVwFk0M= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= @@ -29,15 +29,15 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= -golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= -golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= +golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= +golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/edgezones/armedgezones/models.go b/sdk/resourcemanager/edgezones/armedgezones/models.go index 8545bdd4066e..90dfe1bb9687 100644 --- a/sdk/resourcemanager/edgezones/armedgezones/models.go +++ b/sdk/resourcemanager/edgezones/armedgezones/models.go @@ -74,7 +74,7 @@ type Operation struct { // Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. ActionType *ActionType - // Localized display information for this particular operation. + // 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 @@ -92,17 +92,19 @@ type Operation struct { // OperationDisplay - Localized display information for and operation. type OperationDisplay struct { - // The short, localized friendly description of the operation; suitable for tool tips and detailed views. + // READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views. Description *string - // The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", - // "Restart Virtual Machine". + // READ-ONLY; The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual + // Machine", "Restart Virtual Machine". Operation *string - // The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". + // READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft + // Compute". Provider *string - // The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections". + // READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job + // Schedule Collections". Resource *string } diff --git a/sdk/resourcemanager/edgezones/armedgezones/operations_client_example_test.go b/sdk/resourcemanager/edgezones/armedgezones/operations_client_example_test.go new file mode 100644 index 000000000000..bee1cac63758 --- /dev/null +++ b/sdk/resourcemanager/edgezones/armedgezones/operations_client_example_test.go @@ -0,0 +1,51 @@ +// 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 armedgezones_test + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/edgezones/armedgezones" + "log" +) + +// Generated from example definition: 2024-04-01-preview/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 := armedgezones.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewOperationsClient().NewListPager(nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page = armedgezones.OperationsClientListResponse{ + // OperationListResult: armedgezones.OperationListResult{ + // Value: []*armedgezones.Operation{ + // { + // Name: to.Ptr("Microsoft.EdgeZones/extendedZones/read"), + // Display: &armedgezones.OperationDisplay{ + // Provider: to.Ptr("Microsoft.EdgeZones"), + // Resource: to.Ptr("extendedZones"), + // Operation: to.Ptr("read"), + // }, + // }, + // }, + // }, + // } + } +} diff --git a/sdk/resourcemanager/edgezones/armedgezones/tsp-location.yaml b/sdk/resourcemanager/edgezones/armedgezones/tsp-location.yaml index 5f0bfa9f57a2..483b5e0ca100 100644 --- a/sdk/resourcemanager/edgezones/armedgezones/tsp-location.yaml +++ b/sdk/resourcemanager/edgezones/armedgezones/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/edgezones/EdgeZones.Management -commit: ab064e0047ec560a700d6b501097d99471ad817b -repo: https://github.com/Azure/azure-rest-api-specs -additionalDirectories: +commit: 405438c72094a0a43fbcba18a56aa71110b78db8 +repo: Azure/azure-rest-api-specs +additionalDirectories: \ No newline at end of file diff --git a/sdk/resourcemanager/fabric/armfabric/CHANGELOG.md b/sdk/resourcemanager/fabric/armfabric/CHANGELOG.md index ca9847d062ac..90432900188e 100644 --- a/sdk/resourcemanager/fabric/armfabric/CHANGELOG.md +++ b/sdk/resourcemanager/fabric/armfabric/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 1.0.1 (2024-11-29) +### Other Changes + + ## 1.0.0 (2024-10-22) ### Other Changes diff --git a/sdk/resourcemanager/fabric/armfabric/capacities_client.go b/sdk/resourcemanager/fabric/armfabric/capacities_client.go index 53232ffbf5ad..6cd856168d2b 100644 --- a/sdk/resourcemanager/fabric/armfabric/capacities_client.go +++ b/sdk/resourcemanager/fabric/armfabric/capacities_client.go @@ -43,7 +43,7 @@ func NewCapacitiesClient(subscriptionID string, credential azcore.TokenCredentia // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2023-11-01 -// - location - The location name. +// - location - The name of the Azure region. // - body - The CheckAvailability request // - options - CapacitiesClientCheckNameAvailabilityOptions contains the optional parameters for the CapacitiesClient.CheckNameAvailability // method. diff --git a/sdk/resourcemanager/fabric/armfabric/constants.go b/sdk/resourcemanager/fabric/armfabric/constants.go index c6bf0e2ecc4f..8309196d2560 100644 --- a/sdk/resourcemanager/fabric/armfabric/constants.go +++ b/sdk/resourcemanager/fabric/armfabric/constants.go @@ -6,7 +6,7 @@ package armfabric const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/fabric/armfabric" - moduleVersion = "v1.0.0" + moduleVersion = "v1.0.1" ) // ActionType - Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. diff --git a/sdk/resourcemanager/fabric/armfabric/fake/capacities_server.go b/sdk/resourcemanager/fabric/armfabric/fake/capacities_server.go index e9598083e361..ba8e867decd9 100644 --- a/sdk/resourcemanager/fabric/armfabric/fake/capacities_server.go +++ b/sdk/resourcemanager/fabric/armfabric/fake/capacities_server.go @@ -29,7 +29,7 @@ type CapacitiesServer struct { BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, capacityName string, resource armfabric.Capacity, options *armfabric.CapacitiesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armfabric.CapacitiesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method CapacitiesClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, capacityName string, options *armfabric.CapacitiesClientBeginDeleteOptions) (resp azfake.PollerResponder[armfabric.CapacitiesClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method CapacitiesClient.Get @@ -53,11 +53,11 @@ type CapacitiesServer struct { NewListSKUsForCapacityPager func(resourceGroupName string, capacityName string, options *armfabric.CapacitiesClientListSKUsForCapacityOptions) (resp azfake.PagerResponder[armfabric.CapacitiesClientListSKUsForCapacityResponse]) // BeginResume is the fake for method CapacitiesClient.BeginResume - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginResume func(ctx context.Context, resourceGroupName string, capacityName string, options *armfabric.CapacitiesClientBeginResumeOptions) (resp azfake.PollerResponder[armfabric.CapacitiesClientResumeResponse], errResp azfake.ErrorResponder) // BeginSuspend is the fake for method CapacitiesClient.BeginSuspend - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginSuspend func(ctx context.Context, resourceGroupName string, capacityName string, options *armfabric.CapacitiesClientBeginSuspendOptions) (resp azfake.PollerResponder[armfabric.CapacitiesClientSuspendResponse], errResp azfake.ErrorResponder) // BeginUpdate is the fake for method CapacitiesClient.BeginUpdate @@ -110,37 +110,56 @@ func (c *CapacitiesServerTransport) Do(req *http.Request) (*http.Response, error } func (c *CapacitiesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error - - switch method { - case "CapacitiesClient.CheckNameAvailability": - resp, err = c.dispatchCheckNameAvailability(req) - case "CapacitiesClient.BeginCreateOrUpdate": - resp, err = c.dispatchBeginCreateOrUpdate(req) - case "CapacitiesClient.BeginDelete": - resp, err = c.dispatchBeginDelete(req) - case "CapacitiesClient.Get": - resp, err = c.dispatchGet(req) - case "CapacitiesClient.NewListByResourceGroupPager": - resp, err = c.dispatchNewListByResourceGroupPager(req) - case "CapacitiesClient.NewListBySubscriptionPager": - resp, err = c.dispatchNewListBySubscriptionPager(req) - case "CapacitiesClient.NewListSKUsPager": - resp, err = c.dispatchNewListSKUsPager(req) - case "CapacitiesClient.NewListSKUsForCapacityPager": - resp, err = c.dispatchNewListSKUsForCapacityPager(req) - case "CapacitiesClient.BeginResume": - resp, err = c.dispatchBeginResume(req) - case "CapacitiesClient.BeginSuspend": - resp, err = c.dispatchBeginSuspend(req) - case "CapacitiesClient.BeginUpdate": - resp, err = c.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - return resp, err + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if capacitiesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = capacitiesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "CapacitiesClient.CheckNameAvailability": + res.resp, res.err = c.dispatchCheckNameAvailability(req) + case "CapacitiesClient.BeginCreateOrUpdate": + res.resp, res.err = c.dispatchBeginCreateOrUpdate(req) + case "CapacitiesClient.BeginDelete": + res.resp, res.err = c.dispatchBeginDelete(req) + case "CapacitiesClient.Get": + res.resp, res.err = c.dispatchGet(req) + case "CapacitiesClient.NewListByResourceGroupPager": + res.resp, res.err = c.dispatchNewListByResourceGroupPager(req) + case "CapacitiesClient.NewListBySubscriptionPager": + res.resp, res.err = c.dispatchNewListBySubscriptionPager(req) + case "CapacitiesClient.NewListSKUsPager": + res.resp, res.err = c.dispatchNewListSKUsPager(req) + case "CapacitiesClient.NewListSKUsForCapacityPager": + res.resp, res.err = c.dispatchNewListSKUsForCapacityPager(req) + case "CapacitiesClient.BeginResume": + res.resp, res.err = c.dispatchBeginResume(req) + case "CapacitiesClient.BeginSuspend": + res.resp, res.err = c.dispatchBeginSuspend(req) + case "CapacitiesClient.BeginUpdate": + res.resp, res.err = c.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (c *CapacitiesServerTransport) dispatchCheckNameAvailability(req *http.Request) (*http.Response, error) { @@ -257,9 +276,9 @@ func (c *CapacitiesServerTransport) dispatchBeginDelete(req *http.Request) (*htt return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { c.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { c.beginDelete.remove(req) @@ -478,9 +497,9 @@ func (c *CapacitiesServerTransport) dispatchBeginResume(req *http.Request) (*htt return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { c.beginResume.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginResume) { c.beginResume.remove(req) @@ -522,9 +541,9 @@ func (c *CapacitiesServerTransport) dispatchBeginSuspend(req *http.Request) (*ht return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { c.beginSuspend.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginSuspend) { c.beginSuspend.remove(req) @@ -580,3 +599,9 @@ func (c *CapacitiesServerTransport) dispatchBeginUpdate(req *http.Request) (*htt return resp, nil } + +// set this to conditionally intercept incoming requests to CapacitiesServerTransport +var capacitiesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/fabric/armfabric/fake/internal.go b/sdk/resourcemanager/fabric/armfabric/fake/internal.go index 56a8f624f5f3..7425b6a669e2 100644 --- a/sdk/resourcemanager/fabric/armfabric/fake/internal.go +++ b/sdk/resourcemanager/fabric/armfabric/fake/internal.go @@ -10,6 +10,11 @@ import ( "sync" ) +type result struct { + resp *http.Response + err error +} + type nonRetriableError struct { error } diff --git a/sdk/resourcemanager/fabric/armfabric/fake/operations_server.go b/sdk/resourcemanager/fabric/armfabric/fake/operations_server.go index aef0b331c388..b37b6f368961 100644 --- a/sdk/resourcemanager/fabric/armfabric/fake/operations_server.go +++ b/sdk/resourcemanager/fabric/armfabric/fake/operations_server.go @@ -51,17 +51,36 @@ func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error } func (o *OperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error + resultChan := make(chan result) + defer close(resultChan) - switch method { - case "OperationsClient.NewListPager": - resp, err = o.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + go func() { + var intercepted bool + var res result + if operationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = operationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OperationsClient.NewListPager": + res.resp, res.err = o.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() - return resp, err + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { @@ -90,3 +109,9 @@ func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*ht } return resp, nil } + +// set this to conditionally intercept incoming requests to OperationsServerTransport +var operationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/fabric/armfabric/go.mod b/sdk/resourcemanager/fabric/armfabric/go.mod index 1e24f5ceafeb..509f96a997b1 100644 --- a/sdk/resourcemanager/fabric/armfabric/go.mod +++ b/sdk/resourcemanager/fabric/armfabric/go.mod @@ -3,7 +3,7 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/fabric/armfabric go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 ) @@ -14,8 +14,8 @@ require ( github.com/google/uuid v1.6.0 // indirect github.com/kylelemons/godebug v1.1.0 // indirect github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect - golang.org/x/crypto v0.25.0 // indirect - golang.org/x/net v0.27.0 // indirect - golang.org/x/sys v0.22.0 // indirect - golang.org/x/text v0.16.0 // indirect + golang.org/x/crypto v0.27.0 // indirect + golang.org/x/net v0.29.0 // indirect + golang.org/x/sys v0.25.0 // indirect + golang.org/x/text v0.18.0 // indirect ) diff --git a/sdk/resourcemanager/fabric/armfabric/go.sum b/sdk/resourcemanager/fabric/armfabric/go.sum index 09d275cb9a37..cbddbbd9ecec 100644 --- a/sdk/resourcemanager/fabric/armfabric/go.sum +++ b/sdk/resourcemanager/fabric/armfabric/go.sum @@ -1,5 +1,5 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 h1:GJHeeA2N7xrG3q30L2UXDyuWRzDM900/65j70wcM4Ww= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 h1:JZg6HRh6W6U4OLl6lk7BZ7BLisIzM9dG1R50zUk9C/M= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0/go.mod h1:YL1xnZ6QejvQHWJrX/AvhFl4WW4rqHVoKspWNVwFk0M= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= @@ -17,13 +17,13 @@ github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmd github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= -golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= -golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= +golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= +golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/fabric/armfabric/tsp-location.yaml b/sdk/resourcemanager/fabric/armfabric/tsp-location.yaml index 9c366cac6466..78b01af6ca63 100644 --- a/sdk/resourcemanager/fabric/armfabric/tsp-location.yaml +++ b/sdk/resourcemanager/fabric/armfabric/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/fabric/Microsoft.Fabric.Management -commit: 366aaa13cdd218b9adac716680e49473673410c8 +commit: 405438c72094a0a43fbcba18a56aa71110b78db8 repo: Azure/azure-rest-api-specs -additionalDirectories: +additionalDirectories: \ No newline at end of file diff --git a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/CHANGELOG.md b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/CHANGELOG.md index 9076ff31acee..b8b01795d89b 100644 --- a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/CHANGELOG.md +++ b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 1.0.1 (2024-11-29) +### Other Changes + + ## 1.0.0 (2024-11-20) ### Breaking Changes diff --git a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/constants.go b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/constants.go index d400bac39794..54c4f05cdb32 100644 --- a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/constants.go +++ b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/constants.go @@ -6,7 +6,7 @@ package armhealthdataaiservices const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices" - moduleVersion = "v1.0.0" + moduleVersion = "v1.0.1" ) // ActionType - Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. diff --git a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/tsp-location.yaml b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/tsp-location.yaml index d2f75c664dcb..4b2dd8d723f4 100644 --- a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/tsp-location.yaml +++ b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/healthdataaiservices/HealthDataAIServices.Management -commit: d477c7caa09bf82e22c419be0a99d170552b5892 +commit: 405438c72094a0a43fbcba18a56aa71110b78db8 repo: Azure/azure-rest-api-specs -additionalDirectories: +additionalDirectories: \ No newline at end of file diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/CHANGELOG.md b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/CHANGELOG.md index 05715bd58097..7af3d1c49149 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/CHANGELOG.md +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/CHANGELOG.md @@ -1,5 +1,116 @@ # Release History +## 2.0.0 (2024-11-29) +### Breaking Changes + +- Function `NewClientFactory` parameter(s) have been changed from `(azcore.TokenCredential, *arm.ClientOptions)` to `(string, azcore.TokenCredential, *arm.ClientOptions)` +- Type of `ErrorAdditionalInfo.Info` has been changed from `any` to `*ErrorAdditionalInfoInfo` +- Enum `ActionType` has been removed +- Enum `Origin` has been removed +- Enum `ProvisioningState` has been removed +- Enum `ServiceName` has been removed +- Enum `Type` has been removed +- Function `*ClientFactory.NewEndpointsClient` has been removed +- Function `*ClientFactory.NewOperationsClient` has been removed +- Function `*ClientFactory.NewServiceConfigurationsClient` has been removed +- Function `NewEndpointsClient` has been removed +- Function `*EndpointsClient.CreateOrUpdate` has been removed +- Function `*EndpointsClient.Delete` has been removed +- Function `*EndpointsClient.Get` has been removed +- Function `*EndpointsClient.ListCredentials` has been removed +- Function `*EndpointsClient.ListIngressGatewayCredentials` has been removed +- Function `*EndpointsClient.ListManagedProxyDetails` has been removed +- Function `*EndpointsClient.NewListPager` has been removed +- Function `*EndpointsClient.Update` has been removed +- Function `NewOperationsClient` has been removed +- Function `*OperationsClient.NewListPager` has been removed +- Function `NewServiceConfigurationsClient` has been removed +- Function `*ServiceConfigurationsClient.CreateOrupdate` has been removed +- Function `*ServiceConfigurationsClient.Delete` has been removed +- Function `*ServiceConfigurationsClient.Get` has been removed +- Function `*ServiceConfigurationsClient.NewListByEndpointResourcePager` has been removed +- Function `*ServiceConfigurationsClient.Update` has been removed +- Struct `AADProfileProperties` has been removed +- Struct `EndpointAccessResource` has been removed +- Struct `EndpointProperties` has been removed +- Struct `EndpointResource` has been removed +- Struct `EndpointsList` has been removed +- Struct `ErrorResponse` has been removed +- Struct `IngressGatewayResource` has been removed +- Struct `IngressProfileProperties` has been removed +- Struct `ListCredentialsRequest` has been removed +- Struct `ListIngressGatewayCredentialsRequest` has been removed +- Struct `ManagedProxyRequest` has been removed +- Struct `ManagedProxyResource` has been removed +- Struct `Operation` has been removed +- Struct `OperationDisplay` has been removed +- Struct `OperationListResult` has been removed +- Struct `ProxyResource` has been removed +- Struct `RelayNamespaceAccessProperties` has been removed +- Struct `Resource` has been removed +- Struct `ServiceConfigurationList` has been removed +- Struct `ServiceConfigurationProperties` has been removed +- Struct `ServiceConfigurationPropertiesPatch` has been removed +- Struct `ServiceConfigurationResource` has been removed +- Struct `ServiceConfigurationResourcePatch` has been removed + +### Features Added + +- New enum type `CloudNativeType` with values `CloudNativeTypeEc2` +- New enum type `HostType` with values `HostTypeAWS` +- New enum type `ResourceProvisioningState` with values `ResourceProvisioningStateCanceled`, `ResourceProvisioningStateFailed`, `ResourceProvisioningStateSucceeded` +- New enum type `SolutionConfigurationStatus` with values `SolutionConfigurationStatusCompleted`, `SolutionConfigurationStatusFailed`, `SolutionConfigurationStatusInProgress`, `SolutionConfigurationStatusNew` +- New function `*ClientFactory.NewGenerateAwsTemplateClient() *GenerateAwsTemplateClient` +- New function `*ClientFactory.NewInventoryClient() *InventoryClient` +- New function `*ClientFactory.NewPublicCloudConnectorsClient() *PublicCloudConnectorsClient` +- New function `*ClientFactory.NewSolutionConfigurationsClient() *SolutionConfigurationsClient` +- New function `*ClientFactory.NewSolutionTypesClient() *SolutionTypesClient` +- New function `NewGenerateAwsTemplateClient(string, azcore.TokenCredential, *arm.ClientOptions) (*GenerateAwsTemplateClient, error)` +- New function `*GenerateAwsTemplateClient.Post(context.Context, GenerateAwsTemplateRequest, *GenerateAwsTemplateClientPostOptions) (GenerateAwsTemplateClientPostResponse, error)` +- New function `NewInventoryClient(azcore.TokenCredential, *arm.ClientOptions) (*InventoryClient, error)` +- New function `*InventoryClient.Get(context.Context, string, string, string, *InventoryClientGetOptions) (InventoryClientGetResponse, error)` +- New function `*InventoryClient.NewListBySolutionConfigurationPager(string, string, *InventoryClientListBySolutionConfigurationOptions) *runtime.Pager[InventoryClientListBySolutionConfigurationResponse]` +- New function `NewPublicCloudConnectorsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*PublicCloudConnectorsClient, error)` +- New function `*PublicCloudConnectorsClient.BeginCreateOrUpdate(context.Context, string, string, PublicCloudConnector, *PublicCloudConnectorsClientBeginCreateOrUpdateOptions) (*runtime.Poller[PublicCloudConnectorsClientCreateOrUpdateResponse], error)` +- New function `*PublicCloudConnectorsClient.Delete(context.Context, string, string, *PublicCloudConnectorsClientDeleteOptions) (PublicCloudConnectorsClientDeleteResponse, error)` +- New function `*PublicCloudConnectorsClient.Get(context.Context, string, string, *PublicCloudConnectorsClientGetOptions) (PublicCloudConnectorsClientGetResponse, error)` +- New function `*PublicCloudConnectorsClient.NewListByResourceGroupPager(string, *PublicCloudConnectorsClientListByResourceGroupOptions) *runtime.Pager[PublicCloudConnectorsClientListByResourceGroupResponse]` +- New function `*PublicCloudConnectorsClient.NewListBySubscriptionPager(*PublicCloudConnectorsClientListBySubscriptionOptions) *runtime.Pager[PublicCloudConnectorsClientListBySubscriptionResponse]` +- New function `*PublicCloudConnectorsClient.BeginTestPermissions(context.Context, string, string, *PublicCloudConnectorsClientBeginTestPermissionsOptions) (*runtime.Poller[PublicCloudConnectorsClientTestPermissionsResponse], error)` +- New function `*PublicCloudConnectorsClient.Update(context.Context, string, string, PublicCloudConnector, *PublicCloudConnectorsClientUpdateOptions) (PublicCloudConnectorsClientUpdateResponse, error)` +- New function `NewSolutionConfigurationsClient(azcore.TokenCredential, *arm.ClientOptions) (*SolutionConfigurationsClient, error)` +- New function `*SolutionConfigurationsClient.CreateOrUpdate(context.Context, string, string, SolutionConfiguration, *SolutionConfigurationsClientCreateOrUpdateOptions) (SolutionConfigurationsClientCreateOrUpdateResponse, error)` +- New function `*SolutionConfigurationsClient.Delete(context.Context, string, string, *SolutionConfigurationsClientDeleteOptions) (SolutionConfigurationsClientDeleteResponse, error)` +- New function `*SolutionConfigurationsClient.Get(context.Context, string, string, *SolutionConfigurationsClientGetOptions) (SolutionConfigurationsClientGetResponse, error)` +- New function `*SolutionConfigurationsClient.NewListPager(string, *SolutionConfigurationsClientListOptions) *runtime.Pager[SolutionConfigurationsClientListResponse]` +- New function `*SolutionConfigurationsClient.BeginSyncNow(context.Context, string, string, *SolutionConfigurationsClientBeginSyncNowOptions) (*runtime.Poller[SolutionConfigurationsClientSyncNowResponse], error)` +- New function `*SolutionConfigurationsClient.Update(context.Context, string, string, SolutionConfiguration, *SolutionConfigurationsClientUpdateOptions) (SolutionConfigurationsClientUpdateResponse, error)` +- New function `NewSolutionTypesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*SolutionTypesClient, error)` +- New function `*SolutionTypesClient.Get(context.Context, string, string, *SolutionTypesClientGetOptions) (SolutionTypesClientGetResponse, error)` +- New function `*SolutionTypesClient.NewListByResourceGroupPager(string, *SolutionTypesClientListByResourceGroupOptions) *runtime.Pager[SolutionTypesClientListByResourceGroupResponse]` +- New function `*SolutionTypesClient.NewListBySubscriptionPager(*SolutionTypesClientListBySubscriptionOptions) *runtime.Pager[SolutionTypesClientListBySubscriptionResponse]` +- New struct `AwsCloudProfile` +- New struct `ErrorAdditionalInfoInfo` +- New struct `GenerateAwsTemplateRequest` +- New struct `InventoryProperties` +- New struct `InventoryResource` +- New struct `InventoryResourceListResult` +- New struct `OperationStatusResult` +- New struct `PostResponse` +- New struct `PublicCloudConnector` +- New struct `PublicCloudConnectorListResult` +- New struct `PublicCloudConnectorProperties` +- New struct `SolutionConfiguration` +- New struct `SolutionConfigurationListResult` +- New struct `SolutionConfigurationProperties` +- New struct `SolutionSettings` +- New struct `SolutionTypeProperties` +- New struct `SolutionTypeResource` +- New struct `SolutionTypeResourceListResult` +- New struct `SolutionTypeSettings` +- New struct `SolutionTypeSettingsProperties` + + ## 1.1.0 (2023-11-24) ### Features Added diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/README.md b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/README.md index 22ab09b89fd9..189958555abd 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/README.md +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/README.md @@ -18,7 +18,7 @@ This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for ve Install the Azure Arc Connectivity module: ```sh -go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/v2 ``` ## Authorization @@ -55,7 +55,7 @@ clientFactory, err := armhybridconnectivity.NewClientFactory(, 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.NewEndpointsClient() +client := clientFactory.NewGenerateAwsTemplateClient() ``` ## Fakes diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/autorest.md b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/autorest.md deleted file mode 100644 index afd5f368e2c3..000000000000 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/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/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/hybridconnectivity/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/hybridconnectivity/resource-manager/readme.go.md -license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.1.0 -tag: package-2023-03 -``` \ No newline at end of file diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/build.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/build.go deleted file mode 100644 index 8a77e9ffb103..000000000000 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/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 resourcemanager/hybridconnectivity/armhybridconnectivity - -package armhybridconnectivity diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/client_factory.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/client_factory.go index 89c044c9cb1d..51ff59f8bdb0 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/client_factory.go +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/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 armhybridconnectivity @@ -16,39 +12,60 @@ import ( // ClientFactory is a client factory used to create any client in this module. // Don't use this type directly, use NewClientFactory instead. type ClientFactory struct { - credential azcore.TokenCredential - options *arm.ClientOptions + subscriptionID string + internal *arm.Client } // NewClientFactory creates a new instance of ClientFactory with the specified values. // The parameter values will be propagated to any client created from this factory. +// - 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 NewClientFactory(credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { - _, err := arm.NewClient(moduleName, moduleVersion, credential, options) +func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { + internal, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } return &ClientFactory{ - credential: credential, - options: options.Clone(), + subscriptionID: subscriptionID, + internal: internal, }, nil } -// NewEndpointsClient creates a new instance of EndpointsClient. -func (c *ClientFactory) NewEndpointsClient() *EndpointsClient { - subClient, _ := NewEndpointsClient(c.credential, c.options) - return subClient +// NewGenerateAwsTemplateClient creates a new instance of GenerateAwsTemplateClient. +func (c *ClientFactory) NewGenerateAwsTemplateClient() *GenerateAwsTemplateClient { + return &GenerateAwsTemplateClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewInventoryClient creates a new instance of InventoryClient. +func (c *ClientFactory) NewInventoryClient() *InventoryClient { + return &InventoryClient{ + internal: c.internal, + } +} + +// NewPublicCloudConnectorsClient creates a new instance of PublicCloudConnectorsClient. +func (c *ClientFactory) NewPublicCloudConnectorsClient() *PublicCloudConnectorsClient { + return &PublicCloudConnectorsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } -// NewOperationsClient creates a new instance of OperationsClient. -func (c *ClientFactory) NewOperationsClient() *OperationsClient { - subClient, _ := NewOperationsClient(c.credential, c.options) - return subClient +// NewSolutionConfigurationsClient creates a new instance of SolutionConfigurationsClient. +func (c *ClientFactory) NewSolutionConfigurationsClient() *SolutionConfigurationsClient { + return &SolutionConfigurationsClient{ + internal: c.internal, + } } -// NewServiceConfigurationsClient creates a new instance of ServiceConfigurationsClient. -func (c *ClientFactory) NewServiceConfigurationsClient() *ServiceConfigurationsClient { - subClient, _ := NewServiceConfigurationsClient(c.credential, c.options) - return subClient +// NewSolutionTypesClient creates a new instance of SolutionTypesClient. +func (c *ClientFactory) NewSolutionTypesClient() *SolutionTypesClient { + return &SolutionTypesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/constants.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/constants.go index 1cbb8bab1855..33c27e09ae97 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/constants.go +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/constants.go @@ -1,40 +1,41 @@ -//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 armhybridconnectivity const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity" - moduleVersion = "v1.1.0" + moduleVersion = "v2.0.0" ) -// ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. -type ActionType string +// CloudNativeType - Cloud Native Type enum. +type CloudNativeType string const ( - ActionTypeInternal ActionType = "Internal" + // CloudNativeTypeEc2 - ec2 enum. + CloudNativeTypeEc2 CloudNativeType = "ec2" ) -// PossibleActionTypeValues returns the possible values for the ActionType const type. -func PossibleActionTypeValues() []ActionType { - return []ActionType{ - ActionTypeInternal, +// PossibleCloudNativeTypeValues returns the possible values for the CloudNativeType const type. +func PossibleCloudNativeTypeValues() []CloudNativeType { + return []CloudNativeType{ + CloudNativeTypeEc2, } } -// 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. @@ -47,75 +48,62 @@ func PossibleCreatedByTypeValues() []CreatedByType { } } -// Origin - The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default -// value is "user,system" -type Origin string - -const ( - OriginSystem Origin = "system" - OriginUser Origin = "user" - OriginUserSystem Origin = "user,system" -) - -// PossibleOriginValues returns the possible values for the Origin const type. -func PossibleOriginValues() []Origin { - return []Origin{ - OriginSystem, - OriginUser, - OriginUserSystem, - } -} - -// ProvisioningState - The resource provisioning state. -type ProvisioningState string +// HostType - Enum of host cloud the public cloud connector is referencing. +type HostType string const ( - ProvisioningStateCanceled ProvisioningState = "Canceled" - ProvisioningStateCreating ProvisioningState = "Creating" - ProvisioningStateFailed ProvisioningState = "Failed" - ProvisioningStateSucceeded ProvisioningState = "Succeeded" - ProvisioningStateUpdating ProvisioningState = "Updating" + // HostTypeAWS - AWS state + HostTypeAWS HostType = "AWS" ) -// PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. -func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{ - ProvisioningStateCanceled, - ProvisioningStateCreating, - ProvisioningStateFailed, - ProvisioningStateSucceeded, - ProvisioningStateUpdating, +// PossibleHostTypeValues returns the possible values for the HostType const type. +func PossibleHostTypeValues() []HostType { + return []HostType{ + HostTypeAWS, } } -// ServiceName - Name of the service. -type ServiceName string +// ResourceProvisioningState - The provisioning state of a resource type. +type ResourceProvisioningState string const ( - ServiceNameSSH ServiceName = "SSH" - ServiceNameWAC ServiceName = "WAC" + // ResourceProvisioningStateCanceled - Resource creation was canceled. + ResourceProvisioningStateCanceled ResourceProvisioningState = "Canceled" + // ResourceProvisioningStateFailed - Resource creation failed. + ResourceProvisioningStateFailed ResourceProvisioningState = "Failed" + // ResourceProvisioningStateSucceeded - Resource has been created. + ResourceProvisioningStateSucceeded ResourceProvisioningState = "Succeeded" ) -// PossibleServiceNameValues returns the possible values for the ServiceName const type. -func PossibleServiceNameValues() []ServiceName { - return []ServiceName{ - ServiceNameSSH, - ServiceNameWAC, +// PossibleResourceProvisioningStateValues returns the possible values for the ResourceProvisioningState const type. +func PossibleResourceProvisioningStateValues() []ResourceProvisioningState { + return []ResourceProvisioningState{ + ResourceProvisioningStateCanceled, + ResourceProvisioningStateFailed, + ResourceProvisioningStateSucceeded, } } -// Type - The type of endpoint. -type Type string +// SolutionConfigurationStatus - Solution Configuration Status. +type SolutionConfigurationStatus string const ( - TypeCustom Type = "custom" - TypeDefault Type = "default" + // SolutionConfigurationStatusCompleted - Canceled status + SolutionConfigurationStatusCompleted SolutionConfigurationStatus = "Completed" + // SolutionConfigurationStatusFailed - Failed status + SolutionConfigurationStatusFailed SolutionConfigurationStatus = "Failed" + // SolutionConfigurationStatusInProgress - InProgress status + SolutionConfigurationStatusInProgress SolutionConfigurationStatus = "InProgress" + // SolutionConfigurationStatusNew - New status + SolutionConfigurationStatusNew SolutionConfigurationStatus = "New" ) -// PossibleTypeValues returns the possible values for the Type const type. -func PossibleTypeValues() []Type { - return []Type{ - TypeCustom, - TypeDefault, +// PossibleSolutionConfigurationStatusValues returns the possible values for the SolutionConfigurationStatus const type. +func PossibleSolutionConfigurationStatusValues() []SolutionConfigurationStatus { + return []SolutionConfigurationStatus{ + SolutionConfigurationStatusCompleted, + SolutionConfigurationStatusFailed, + SolutionConfigurationStatusInProgress, + SolutionConfigurationStatusNew, } } diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/endpoints_client.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/endpoints_client.go deleted file mode 100644 index cb3b0cba148a..000000000000 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/endpoints_client.go +++ /dev/null @@ -1,494 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armhybridconnectivity - -import ( - "context" - "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" - "strconv" - "strings" -) - -// EndpointsClient contains the methods for the Endpoints group. -// Don't use this type directly, use NewEndpointsClient() instead. -type EndpointsClient struct { - internal *arm.Client -} - -// NewEndpointsClient creates a new instance of EndpointsClient with the specified values. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewEndpointsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*EndpointsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &EndpointsClient{ - internal: cl, - } - return client, nil -} - -// CreateOrUpdate - Create or update the endpoint to the target resource. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-03-15 -// - resourceURI - The fully qualified Azure Resource manager identifier of the resource to be connected. -// - endpointName - The endpoint name. -// - endpointResource - Endpoint details -// - options - EndpointsClientCreateOrUpdateOptions contains the optional parameters for the EndpointsClient.CreateOrUpdate -// method. -func (client *EndpointsClient) CreateOrUpdate(ctx context.Context, resourceURI string, endpointName string, endpointResource EndpointResource, options *EndpointsClientCreateOrUpdateOptions) (EndpointsClientCreateOrUpdateResponse, error) { - var err error - const operationName = "EndpointsClient.CreateOrUpdate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createOrUpdateCreateRequest(ctx, resourceURI, endpointName, endpointResource, options) - if err != nil { - return EndpointsClientCreateOrUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return EndpointsClientCreateOrUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return EndpointsClientCreateOrUpdateResponse{}, err - } - resp, err := client.createOrUpdateHandleResponse(httpResp) - return resp, err -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *EndpointsClient) createOrUpdateCreateRequest(ctx context.Context, resourceURI string, endpointName string, endpointResource EndpointResource, options *EndpointsClientCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}" - urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) - urlPath = strings.ReplaceAll(urlPath, "{endpointName}", endpointName) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, endpointResource); err != nil { - return nil, err - } - return req, nil -} - -// createOrUpdateHandleResponse handles the CreateOrUpdate response. -func (client *EndpointsClient) createOrUpdateHandleResponse(resp *http.Response) (EndpointsClientCreateOrUpdateResponse, error) { - result := EndpointsClientCreateOrUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.EndpointResource); err != nil { - return EndpointsClientCreateOrUpdateResponse{}, err - } - return result, nil -} - -// Delete - Deletes the endpoint access to the target resource. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-03-15 -// - resourceURI - The fully qualified Azure Resource manager identifier of the resource to be connected. -// - endpointName - The endpoint name. -// - options - EndpointsClientDeleteOptions contains the optional parameters for the EndpointsClient.Delete method. -func (client *EndpointsClient) Delete(ctx context.Context, resourceURI string, endpointName string, options *EndpointsClientDeleteOptions) (EndpointsClientDeleteResponse, error) { - var err error - const operationName = "EndpointsClient.Delete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, resourceURI, endpointName, options) - if err != nil { - return EndpointsClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return EndpointsClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return EndpointsClientDeleteResponse{}, err - } - return EndpointsClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *EndpointsClient) deleteCreateRequest(ctx context.Context, resourceURI string, endpointName string, options *EndpointsClientDeleteOptions) (*policy.Request, error) { - urlPath := "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}" - urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) - urlPath = strings.ReplaceAll(urlPath, "{endpointName}", endpointName) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Gets the endpoint to the resource. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-03-15 -// - resourceURI - The fully qualified Azure Resource manager identifier of the resource to be connected. -// - endpointName - The endpoint name. -// - options - EndpointsClientGetOptions contains the optional parameters for the EndpointsClient.Get method. -func (client *EndpointsClient) Get(ctx context.Context, resourceURI string, endpointName string, options *EndpointsClientGetOptions) (EndpointsClientGetResponse, error) { - var err error - const operationName = "EndpointsClient.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, resourceURI, endpointName, options) - if err != nil { - return EndpointsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return EndpointsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return EndpointsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *EndpointsClient) getCreateRequest(ctx context.Context, resourceURI string, endpointName string, options *EndpointsClientGetOptions) (*policy.Request, error) { - urlPath := "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}" - urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) - urlPath = strings.ReplaceAll(urlPath, "{endpointName}", endpointName) - 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-03-15") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *EndpointsClient) getHandleResponse(resp *http.Response) (EndpointsClientGetResponse, error) { - result := EndpointsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.EndpointResource); err != nil { - return EndpointsClientGetResponse{}, err - } - return result, nil -} - -// NewListPager - List of endpoints to the target resource. -// -// Generated from API version 2023-03-15 -// - resourceURI - The fully qualified Azure Resource manager identifier of the resource to be connected. -// - options - EndpointsClientListOptions contains the optional parameters for the EndpointsClient.NewListPager method. -func (client *EndpointsClient) NewListPager(resourceURI string, options *EndpointsClientListOptions) *runtime.Pager[EndpointsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[EndpointsClientListResponse]{ - More: func(page EndpointsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *EndpointsClientListResponse) (EndpointsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "EndpointsClient.NewListPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, resourceURI, options) - }, nil) - if err != nil { - return EndpointsClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *EndpointsClient) listCreateRequest(ctx context.Context, resourceURI string, options *EndpointsClientListOptions) (*policy.Request, error) { - urlPath := "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints" - urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) - 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-03-15") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *EndpointsClient) listHandleResponse(resp *http.Response) (EndpointsClientListResponse, error) { - result := EndpointsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.EndpointsList); err != nil { - return EndpointsClientListResponse{}, err - } - return result, nil -} - -// ListCredentials - Gets the endpoint access credentials to the resource. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-03-15 -// - resourceURI - The fully qualified Azure Resource manager identifier of the resource to be connected. -// - endpointName - The endpoint name. -// - options - EndpointsClientListCredentialsOptions contains the optional parameters for the EndpointsClient.ListCredentials -// method. -func (client *EndpointsClient) ListCredentials(ctx context.Context, resourceURI string, endpointName string, options *EndpointsClientListCredentialsOptions) (EndpointsClientListCredentialsResponse, error) { - var err error - const operationName = "EndpointsClient.ListCredentials" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.listCredentialsCreateRequest(ctx, resourceURI, endpointName, options) - if err != nil { - return EndpointsClientListCredentialsResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return EndpointsClientListCredentialsResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return EndpointsClientListCredentialsResponse{}, err - } - resp, err := client.listCredentialsHandleResponse(httpResp) - return resp, err -} - -// listCredentialsCreateRequest creates the ListCredentials request. -func (client *EndpointsClient) listCredentialsCreateRequest(ctx context.Context, resourceURI string, endpointName string, options *EndpointsClientListCredentialsOptions) (*policy.Request, error) { - urlPath := "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/listCredentials" - urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) - urlPath = strings.ReplaceAll(urlPath, "{endpointName}", endpointName) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15") - if options != nil && options.Expiresin != nil { - reqQP.Set("expiresin", strconv.FormatInt(*options.Expiresin, 10)) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.ListCredentialsRequest != nil { - if err := runtime.MarshalAsJSON(req, *options.ListCredentialsRequest); err != nil { - return nil, err - } - return req, nil - } - return req, nil -} - -// listCredentialsHandleResponse handles the ListCredentials response. -func (client *EndpointsClient) listCredentialsHandleResponse(resp *http.Response) (EndpointsClientListCredentialsResponse, error) { - result := EndpointsClientListCredentialsResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.EndpointAccessResource); err != nil { - return EndpointsClientListCredentialsResponse{}, err - } - return result, nil -} - -// ListIngressGatewayCredentials - Gets the ingress gateway endpoint credentials -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-03-15 -// - resourceURI - The fully qualified Azure Resource manager identifier of the resource to be connected. -// - endpointName - The endpoint name. -// - options - EndpointsClientListIngressGatewayCredentialsOptions contains the optional parameters for the EndpointsClient.ListIngressGatewayCredentials -// method. -func (client *EndpointsClient) ListIngressGatewayCredentials(ctx context.Context, resourceURI string, endpointName string, options *EndpointsClientListIngressGatewayCredentialsOptions) (EndpointsClientListIngressGatewayCredentialsResponse, error) { - var err error - const operationName = "EndpointsClient.ListIngressGatewayCredentials" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.listIngressGatewayCredentialsCreateRequest(ctx, resourceURI, endpointName, options) - if err != nil { - return EndpointsClientListIngressGatewayCredentialsResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return EndpointsClientListIngressGatewayCredentialsResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return EndpointsClientListIngressGatewayCredentialsResponse{}, err - } - resp, err := client.listIngressGatewayCredentialsHandleResponse(httpResp) - return resp, err -} - -// listIngressGatewayCredentialsCreateRequest creates the ListIngressGatewayCredentials request. -func (client *EndpointsClient) listIngressGatewayCredentialsCreateRequest(ctx context.Context, resourceURI string, endpointName string, options *EndpointsClientListIngressGatewayCredentialsOptions) (*policy.Request, error) { - urlPath := "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/listIngressGatewayCredentials" - urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) - urlPath = strings.ReplaceAll(urlPath, "{endpointName}", endpointName) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15") - if options != nil && options.Expiresin != nil { - reqQP.Set("expiresin", strconv.FormatInt(*options.Expiresin, 10)) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.ListIngressGatewayCredentialsRequest != nil { - if err := runtime.MarshalAsJSON(req, *options.ListIngressGatewayCredentialsRequest); err != nil { - return nil, err - } - return req, nil - } - return req, nil -} - -// listIngressGatewayCredentialsHandleResponse handles the ListIngressGatewayCredentials response. -func (client *EndpointsClient) listIngressGatewayCredentialsHandleResponse(resp *http.Response) (EndpointsClientListIngressGatewayCredentialsResponse, error) { - result := EndpointsClientListIngressGatewayCredentialsResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.IngressGatewayResource); err != nil { - return EndpointsClientListIngressGatewayCredentialsResponse{}, err - } - return result, nil -} - -// ListManagedProxyDetails - Fetches the managed proxy details -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-03-15 -// - resourceURI - The fully qualified Azure Resource manager identifier of the resource to be connected. -// - endpointName - The endpoint name. -// - managedProxyRequest - Object of type ManagedProxyRequest -// - options - EndpointsClientListManagedProxyDetailsOptions contains the optional parameters for the EndpointsClient.ListManagedProxyDetails -// method. -func (client *EndpointsClient) ListManagedProxyDetails(ctx context.Context, resourceURI string, endpointName string, managedProxyRequest ManagedProxyRequest, options *EndpointsClientListManagedProxyDetailsOptions) (EndpointsClientListManagedProxyDetailsResponse, error) { - var err error - const operationName = "EndpointsClient.ListManagedProxyDetails" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.listManagedProxyDetailsCreateRequest(ctx, resourceURI, endpointName, managedProxyRequest, options) - if err != nil { - return EndpointsClientListManagedProxyDetailsResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return EndpointsClientListManagedProxyDetailsResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return EndpointsClientListManagedProxyDetailsResponse{}, err - } - resp, err := client.listManagedProxyDetailsHandleResponse(httpResp) - return resp, err -} - -// listManagedProxyDetailsCreateRequest creates the ListManagedProxyDetails request. -func (client *EndpointsClient) listManagedProxyDetailsCreateRequest(ctx context.Context, resourceURI string, endpointName string, managedProxyRequest ManagedProxyRequest, options *EndpointsClientListManagedProxyDetailsOptions) (*policy.Request, error) { - urlPath := "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/listManagedProxyDetails" - urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) - urlPath = strings.ReplaceAll(urlPath, "{endpointName}", endpointName) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, managedProxyRequest); err != nil { - return nil, err - } - return req, nil -} - -// listManagedProxyDetailsHandleResponse handles the ListManagedProxyDetails response. -func (client *EndpointsClient) listManagedProxyDetailsHandleResponse(resp *http.Response) (EndpointsClientListManagedProxyDetailsResponse, error) { - result := EndpointsClientListManagedProxyDetailsResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ManagedProxyResource); err != nil { - return EndpointsClientListManagedProxyDetailsResponse{}, err - } - return result, nil -} - -// Update - Update the endpoint to the target resource. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-03-15 -// - resourceURI - The fully qualified Azure Resource manager identifier of the resource to be connected. -// - endpointName - The endpoint name. -// - endpointResource - Endpoint details -// - options - EndpointsClientUpdateOptions contains the optional parameters for the EndpointsClient.Update method. -func (client *EndpointsClient) Update(ctx context.Context, resourceURI string, endpointName string, endpointResource EndpointResource, options *EndpointsClientUpdateOptions) (EndpointsClientUpdateResponse, error) { - var err error - const operationName = "EndpointsClient.Update" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.updateCreateRequest(ctx, resourceURI, endpointName, endpointResource, options) - if err != nil { - return EndpointsClientUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return EndpointsClientUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return EndpointsClientUpdateResponse{}, err - } - resp, err := client.updateHandleResponse(httpResp) - return resp, err -} - -// updateCreateRequest creates the Update request. -func (client *EndpointsClient) updateCreateRequest(ctx context.Context, resourceURI string, endpointName string, endpointResource EndpointResource, options *EndpointsClientUpdateOptions) (*policy.Request, error) { - urlPath := "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}" - urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) - urlPath = strings.ReplaceAll(urlPath, "{endpointName}", endpointName) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, endpointResource); err != nil { - return nil, err - } - return req, nil -} - -// updateHandleResponse handles the Update response. -func (client *EndpointsClient) updateHandleResponse(resp *http.Response) (EndpointsClientUpdateResponse, error) { - result := EndpointsClientUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.EndpointResource); err != nil { - return EndpointsClientUpdateResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/endpoints_client_example_test.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/endpoints_client_example_test.go deleted file mode 100644 index 977b6e8aca9a..000000000000 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/endpoints_client_example_test.go +++ /dev/null @@ -1,340 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armhybridconnectivity_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/hybridconnectivity/armhybridconnectivity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/examples/EndpointsList.json -func ExampleEndpointsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridconnectivity.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewEndpointsClient().NewListPager("subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine", 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.EndpointsList = armhybridconnectivity.EndpointsList{ - // Value: []*armhybridconnectivity.EndpointResource{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.HybridConnectivity/endpoints"), - // ID: to.Ptr("/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default"), - // Properties: &armhybridconnectivity.EndpointProperties{ - // Type: to.Ptr(armhybridconnectivity.TypeDefault), - // }, - // }, - // { - // Name: to.Ptr("custom"), - // Type: to.Ptr("Microsoft.HybridConnectivity/endpoints"), - // ID: to.Ptr("/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/custom"), - // Properties: &armhybridconnectivity.EndpointProperties{ - // Type: to.Ptr(armhybridconnectivity.TypeCustom), - // ResourceID: to.Ptr("/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.Relay/namespaces/custom-relay-namespace"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/examples/EndpointsGetCustom.json -func ExampleEndpointsClient_Get_hybridConnectivityEndpointsGetCustom() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridconnectivity.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewEndpointsClient().Get(ctx, "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine", "custom", 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.EndpointResource = armhybridconnectivity.EndpointResource{ - // Name: to.Ptr("custom"), - // Type: to.Ptr("Microsoft.HybridConnectivity/endpoints"), - // ID: to.Ptr("/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/custom"), - // Properties: &armhybridconnectivity.EndpointProperties{ - // Type: to.Ptr(armhybridconnectivity.TypeCustom), - // ResourceID: to.Ptr("/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.Relay/namespaces/custom-relay-namespace"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/examples/EndpointsGetDefault.json -func ExampleEndpointsClient_Get_hybridConnectivityEndpointsGetDefault() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridconnectivity.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewEndpointsClient().Get(ctx, "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine", "default", 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.EndpointResource = armhybridconnectivity.EndpointResource{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.HybridConnectivity/endpoints"), - // ID: to.Ptr("/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default"), - // Properties: &armhybridconnectivity.EndpointProperties{ - // Type: to.Ptr(armhybridconnectivity.TypeDefault), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/examples/EndpointsPutCustom.json -func ExampleEndpointsClient_CreateOrUpdate_hybridConnectivityEndpointsPutCustom() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridconnectivity.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewEndpointsClient().CreateOrUpdate(ctx, "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine", "custom", armhybridconnectivity.EndpointResource{ - Properties: &armhybridconnectivity.EndpointProperties{ - Type: to.Ptr(armhybridconnectivity.TypeCustom), - ResourceID: to.Ptr("/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.Relay/namespaces/custom-relay-namespace"), - }, - }, 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.EndpointResource = armhybridconnectivity.EndpointResource{ - // Name: to.Ptr("custom"), - // Type: to.Ptr("Microsoft.HybridConnectivity/endpoints"), - // ID: to.Ptr("/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/custom"), - // Properties: &armhybridconnectivity.EndpointProperties{ - // Type: to.Ptr(armhybridconnectivity.TypeCustom), - // ProvisioningState: to.Ptr("Succeeded"), - // ResourceID: to.Ptr("/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.Relay/namespaces/custom-relay-namespace"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/examples/EndpointsPutDefault.json -func ExampleEndpointsClient_CreateOrUpdate_hybridConnectivityEndpointsPutDefault() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridconnectivity.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewEndpointsClient().CreateOrUpdate(ctx, "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine", "default", armhybridconnectivity.EndpointResource{ - Properties: &armhybridconnectivity.EndpointProperties{ - Type: to.Ptr(armhybridconnectivity.TypeDefault), - }, - }, 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.EndpointResource = armhybridconnectivity.EndpointResource{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.HybridConnectivity/endpoints"), - // ID: to.Ptr("/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default"), - // Properties: &armhybridconnectivity.EndpointProperties{ - // Type: to.Ptr(armhybridconnectivity.TypeDefault), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/examples/EndpointsPatchDefault.json -func ExampleEndpointsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridconnectivity.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewEndpointsClient().Update(ctx, "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine", "default", armhybridconnectivity.EndpointResource{ - Properties: &armhybridconnectivity.EndpointProperties{ - Type: to.Ptr(armhybridconnectivity.TypeDefault), - }, - }, 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.EndpointResource = armhybridconnectivity.EndpointResource{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.HybridConnectivity/endpoints"), - // ID: to.Ptr("/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default"), - // Properties: &armhybridconnectivity.EndpointProperties{ - // Type: to.Ptr(armhybridconnectivity.TypeDefault), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/examples/EndpointsDeleteDefault.json -func ExampleEndpointsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridconnectivity.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewEndpointsClient().Delete(ctx, "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine", "default", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/examples/EndpointsPostListCredentials.json -func ExampleEndpointsClient_ListCredentials() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridconnectivity.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewEndpointsClient().ListCredentials(ctx, "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine", "default", &armhybridconnectivity.EndpointsClientListCredentialsOptions{Expiresin: to.Ptr[int64](10800), - ListCredentialsRequest: &armhybridconnectivity.ListCredentialsRequest{ - ServiceName: to.Ptr(armhybridconnectivity.ServiceNameSSH), - }, - }) - 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.EndpointAccessResource = armhybridconnectivity.EndpointAccessResource{ - // Relay: &armhybridconnectivity.RelayNamespaceAccessProperties{ - // AccessKey: to.Ptr("SharedAccessSignature sr=http%3A%2F%2Fazgnrelay-eastus-l1.servicebus.windows.net%2Fmicrosoft.kubernetes%2Fconnectedclusters%2Fa0e1fd7d1d974ddf6b11a952d67679c9f12c006eee16861857a8268da4eb1498%2F1619989456957411072%2F&sig=WxDwPF6AmmODaMHNnBGDSm773UG%2B%2Be"), - // ExpiresOn: to.Ptr[int64](1620000256), - // HybridConnectionName: to.Ptr("microsoft.kubernetes/connectedclusters/a0e1fd7d1d974ddf6b11a952d67679c9f12c006eee16861857a8268da4eb1498/1619989456957411072"), - // NamespaceName: to.Ptr("azgnrelay-eastus-l1"), - // NamespaceNameSuffix: to.Ptr("servicebus.windows.net"), - // ServiceConfigurationToken: to.Ptr("SSHvjqH=pTlKql=RtMGw/-k5VFBxSYHIiq5ZgbGFcLkNrDNz5fDsinCN2zkG"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/examples/EndpointsPostListIngressGatewayCredentials.json -func ExampleEndpointsClient_ListIngressGatewayCredentials() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridconnectivity.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewEndpointsClient().ListIngressGatewayCredentials(ctx, "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/arcGroup/providers/Microsoft.ArcPlaceHolder/ProvisionedClusters/cluster0", "default", &armhybridconnectivity.EndpointsClientListIngressGatewayCredentialsOptions{Expiresin: to.Ptr[int64](10800), - ListIngressGatewayCredentialsRequest: 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.IngressGatewayResource = armhybridconnectivity.IngressGatewayResource{ - // Ingress: &armhybridconnectivity.IngressProfileProperties{ - // AADProfile: &armhybridconnectivity.AADProfileProperties{ - // ServerID: to.Ptr("6256c85f-0aad-4d50-b960-e6e9b21efe35"), - // TenantID: to.Ptr("hy657tgh-8d16-42db-81b7-1234hygt67hy5"), - // }, - // Hostname: to.Ptr("clusterhostname"), - // }, - // Relay: &armhybridconnectivity.RelayNamespaceAccessProperties{ - // AccessKey: to.Ptr("SharedAccessSignature sr=http%3A%2F%2Fazgnrelay-eastus-l1.servicebus.windows.net%2Fmicrosoft.provisionedcluster%hci"), - // ExpiresOn: to.Ptr[int64](1620000256), - // HybridConnectionName: to.Ptr("microsoft.arcplaceholder/provisionedclusters/000/1619989456957411072"), - // NamespaceName: to.Ptr("relaynamespace"), - // NamespaceNameSuffix: to.Ptr("servicebus.windows.net"), - // ServiceConfigurationToken: to.Ptr("SSHvjqH=pTlKql=RtMGw/-k5VFBxSYHIiq5ZgbGFcLkNrDNz5fDsinCN2zkG"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/examples/EndpointsPostListManagedProxyDetails.json -func ExampleEndpointsClient_ListManagedProxyDetails() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridconnectivity.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewEndpointsClient().ListManagedProxyDetails(ctx, "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/arcGroup/providers/Microsoft.Compute/virtualMachines/vm00006", "default", armhybridconnectivity.ManagedProxyRequest{ - Hostname: to.Ptr("r.proxy.arc.com"), - Service: to.Ptr("127.0.0.1:65035"), - ServiceName: to.Ptr(armhybridconnectivity.ServiceNameWAC), - }, 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.ManagedProxyResource = armhybridconnectivity.ManagedProxyResource{ - // ExpiresOn: to.Ptr[int64](1620000256), - // Proxy: to.Ptr("uid.r.proxy.arc.com"), - // } -} diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/endpoints_server.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/endpoints_server.go deleted file mode 100644 index a85842630ea2..000000000000 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/endpoints_server.go +++ /dev/null @@ -1,448 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity" - "net/http" - "net/url" - "reflect" - "regexp" - "strconv" -) - -// EndpointsServer is a fake server for instances of the armhybridconnectivity.EndpointsClient type. -type EndpointsServer struct { - // CreateOrUpdate is the fake for method EndpointsClient.CreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK - CreateOrUpdate func(ctx context.Context, resourceURI string, endpointName string, endpointResource armhybridconnectivity.EndpointResource, options *armhybridconnectivity.EndpointsClientCreateOrUpdateOptions) (resp azfake.Responder[armhybridconnectivity.EndpointsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method EndpointsClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceURI string, endpointName string, options *armhybridconnectivity.EndpointsClientDeleteOptions) (resp azfake.Responder[armhybridconnectivity.EndpointsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method EndpointsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceURI string, endpointName string, options *armhybridconnectivity.EndpointsClientGetOptions) (resp azfake.Responder[armhybridconnectivity.EndpointsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method EndpointsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceURI string, options *armhybridconnectivity.EndpointsClientListOptions) (resp azfake.PagerResponder[armhybridconnectivity.EndpointsClientListResponse]) - - // ListCredentials is the fake for method EndpointsClient.ListCredentials - // HTTP status codes to indicate success: http.StatusOK - ListCredentials func(ctx context.Context, resourceURI string, endpointName string, options *armhybridconnectivity.EndpointsClientListCredentialsOptions) (resp azfake.Responder[armhybridconnectivity.EndpointsClientListCredentialsResponse], errResp azfake.ErrorResponder) - - // ListIngressGatewayCredentials is the fake for method EndpointsClient.ListIngressGatewayCredentials - // HTTP status codes to indicate success: http.StatusOK - ListIngressGatewayCredentials func(ctx context.Context, resourceURI string, endpointName string, options *armhybridconnectivity.EndpointsClientListIngressGatewayCredentialsOptions) (resp azfake.Responder[armhybridconnectivity.EndpointsClientListIngressGatewayCredentialsResponse], errResp azfake.ErrorResponder) - - // ListManagedProxyDetails is the fake for method EndpointsClient.ListManagedProxyDetails - // HTTP status codes to indicate success: http.StatusOK - ListManagedProxyDetails func(ctx context.Context, resourceURI string, endpointName string, managedProxyRequest armhybridconnectivity.ManagedProxyRequest, options *armhybridconnectivity.EndpointsClientListManagedProxyDetailsOptions) (resp azfake.Responder[armhybridconnectivity.EndpointsClientListManagedProxyDetailsResponse], errResp azfake.ErrorResponder) - - // Update is the fake for method EndpointsClient.Update - // HTTP status codes to indicate success: http.StatusOK - Update func(ctx context.Context, resourceURI string, endpointName string, endpointResource armhybridconnectivity.EndpointResource, options *armhybridconnectivity.EndpointsClientUpdateOptions) (resp azfake.Responder[armhybridconnectivity.EndpointsClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewEndpointsServerTransport creates a new instance of EndpointsServerTransport with the provided implementation. -// The returned EndpointsServerTransport instance is connected to an instance of armhybridconnectivity.EndpointsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewEndpointsServerTransport(srv *EndpointsServer) *EndpointsServerTransport { - return &EndpointsServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armhybridconnectivity.EndpointsClientListResponse]](), - } -} - -// EndpointsServerTransport connects instances of armhybridconnectivity.EndpointsClient to instances of EndpointsServer. -// Don't use this type directly, use NewEndpointsServerTransport instead. -type EndpointsServerTransport struct { - srv *EndpointsServer - newListPager *tracker[azfake.PagerResponder[armhybridconnectivity.EndpointsClientListResponse]] -} - -// Do implements the policy.Transporter interface for EndpointsServerTransport. -func (e *EndpointsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "EndpointsClient.CreateOrUpdate": - resp, err = e.dispatchCreateOrUpdate(req) - case "EndpointsClient.Delete": - resp, err = e.dispatchDelete(req) - case "EndpointsClient.Get": - resp, err = e.dispatchGet(req) - case "EndpointsClient.NewListPager": - resp, err = e.dispatchNewListPager(req) - case "EndpointsClient.ListCredentials": - resp, err = e.dispatchListCredentials(req) - case "EndpointsClient.ListIngressGatewayCredentials": - resp, err = e.dispatchListIngressGatewayCredentials(req) - case "EndpointsClient.ListManagedProxyDetails": - resp, err = e.dispatchListManagedProxyDetails(req) - case "EndpointsClient.Update": - resp, err = e.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (e *EndpointsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { - if e.srv.CreateOrUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} - } - const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/endpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armhybridconnectivity.EndpointResource](req) - if err != nil { - return nil, err - } - resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) - if err != nil { - return nil, err - } - endpointNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("endpointName")]) - if err != nil { - return nil, err - } - respr, errRespr := e.srv.CreateOrUpdate(req.Context(), resourceURIParam, endpointNameParam, body, 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).EndpointResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (e *EndpointsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if e.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/endpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) - if err != nil { - return nil, err - } - endpointNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("endpointName")]) - if err != nil { - return nil, err - } - respr, errRespr := e.srv.Delete(req.Context(), resourceURIParam, endpointNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} - -func (e *EndpointsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if e.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/endpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) - if err != nil { - return nil, err - } - endpointNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("endpointName")]) - if err != nil { - return nil, err - } - respr, errRespr := e.srv.Get(req.Context(), resourceURIParam, endpointNameParam, 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).EndpointResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (e *EndpointsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if e.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := e.newListPager.get(req) - if newListPager == nil { - const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/endpoints` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) - if err != nil { - return nil, err - } - resp := e.srv.NewListPager(resourceURIParam, nil) - newListPager = &resp - e.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armhybridconnectivity.EndpointsClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - e.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - e.newListPager.remove(req) - } - return resp, nil -} - -func (e *EndpointsServerTransport) dispatchListCredentials(req *http.Request) (*http.Response, error) { - if e.srv.ListCredentials == nil { - return nil, &nonRetriableError{errors.New("fake for method ListCredentials not implemented")} - } - const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/endpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listCredentials` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - body, err := server.UnmarshalRequestAsJSON[armhybridconnectivity.ListCredentialsRequest](req) - if err != nil { - return nil, err - } - resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) - if err != nil { - return nil, err - } - endpointNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("endpointName")]) - if err != nil { - return nil, err - } - expiresinUnescaped, err := url.QueryUnescape(qp.Get("expiresin")) - if err != nil { - return nil, err - } - expiresinParam, err := parseOptional(expiresinUnescaped, func(v string) (int64, error) { - p, parseErr := strconv.ParseInt(v, 10, 64) - if parseErr != nil { - return 0, parseErr - } - return p, nil - }) - if err != nil { - return nil, err - } - var options *armhybridconnectivity.EndpointsClientListCredentialsOptions - if expiresinParam != nil || !reflect.ValueOf(body).IsZero() { - options = &armhybridconnectivity.EndpointsClientListCredentialsOptions{ - Expiresin: expiresinParam, - ListCredentialsRequest: &body, - } - } - respr, errRespr := e.srv.ListCredentials(req.Context(), resourceURIParam, endpointNameParam, options) - 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).EndpointAccessResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (e *EndpointsServerTransport) dispatchListIngressGatewayCredentials(req *http.Request) (*http.Response, error) { - if e.srv.ListIngressGatewayCredentials == nil { - return nil, &nonRetriableError{errors.New("fake for method ListIngressGatewayCredentials not implemented")} - } - const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/endpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listIngressGatewayCredentials` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - body, err := server.UnmarshalRequestAsJSON[armhybridconnectivity.ListIngressGatewayCredentialsRequest](req) - if err != nil { - return nil, err - } - resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) - if err != nil { - return nil, err - } - endpointNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("endpointName")]) - if err != nil { - return nil, err - } - expiresinUnescaped, err := url.QueryUnescape(qp.Get("expiresin")) - if err != nil { - return nil, err - } - expiresinParam, err := parseOptional(expiresinUnescaped, func(v string) (int64, error) { - p, parseErr := strconv.ParseInt(v, 10, 64) - if parseErr != nil { - return 0, parseErr - } - return p, nil - }) - if err != nil { - return nil, err - } - var options *armhybridconnectivity.EndpointsClientListIngressGatewayCredentialsOptions - if expiresinParam != nil || !reflect.ValueOf(body).IsZero() { - options = &armhybridconnectivity.EndpointsClientListIngressGatewayCredentialsOptions{ - Expiresin: expiresinParam, - ListIngressGatewayCredentialsRequest: &body, - } - } - respr, errRespr := e.srv.ListIngressGatewayCredentials(req.Context(), resourceURIParam, endpointNameParam, options) - 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).IngressGatewayResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (e *EndpointsServerTransport) dispatchListManagedProxyDetails(req *http.Request) (*http.Response, error) { - if e.srv.ListManagedProxyDetails == nil { - return nil, &nonRetriableError{errors.New("fake for method ListManagedProxyDetails not implemented")} - } - const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/endpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listManagedProxyDetails` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armhybridconnectivity.ManagedProxyRequest](req) - if err != nil { - return nil, err - } - resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) - if err != nil { - return nil, err - } - endpointNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("endpointName")]) - if err != nil { - return nil, err - } - respr, errRespr := e.srv.ListManagedProxyDetails(req.Context(), resourceURIParam, endpointNameParam, body, 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).ManagedProxyResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (e *EndpointsServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { - if e.srv.Update == nil { - return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} - } - const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/endpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armhybridconnectivity.EndpointResource](req) - if err != nil { - return nil, err - } - resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) - if err != nil { - return nil, err - } - endpointNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("endpointName")]) - if err != nil { - return nil, err - } - respr, errRespr := e.srv.Update(req.Context(), resourceURIParam, endpointNameParam, body, 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).EndpointResource, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/generateawstemplate_server.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/generateawstemplate_server.go new file mode 100644 index 000000000000..f2cf85b83c7b --- /dev/null +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/generateawstemplate_server.go @@ -0,0 +1,116 @@ +// 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/resourcemanager/hybridconnectivity/armhybridconnectivity/v2" + "net/http" + "regexp" +) + +// GenerateAwsTemplateServer is a fake server for instances of the armhybridconnectivity.GenerateAwsTemplateClient type. +type GenerateAwsTemplateServer struct { + // Post is the fake for method GenerateAwsTemplateClient.Post + // HTTP status codes to indicate success: http.StatusOK + Post func(ctx context.Context, generateAwsTemplateRequest armhybridconnectivity.GenerateAwsTemplateRequest, options *armhybridconnectivity.GenerateAwsTemplateClientPostOptions) (resp azfake.Responder[armhybridconnectivity.GenerateAwsTemplateClientPostResponse], errResp azfake.ErrorResponder) +} + +// NewGenerateAwsTemplateServerTransport creates a new instance of GenerateAwsTemplateServerTransport with the provided implementation. +// The returned GenerateAwsTemplateServerTransport instance is connected to an instance of armhybridconnectivity.GenerateAwsTemplateClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewGenerateAwsTemplateServerTransport(srv *GenerateAwsTemplateServer) *GenerateAwsTemplateServerTransport { + return &GenerateAwsTemplateServerTransport{srv: srv} +} + +// GenerateAwsTemplateServerTransport connects instances of armhybridconnectivity.GenerateAwsTemplateClient to instances of GenerateAwsTemplateServer. +// Don't use this type directly, use NewGenerateAwsTemplateServerTransport instead. +type GenerateAwsTemplateServerTransport struct { + srv *GenerateAwsTemplateServer +} + +// Do implements the policy.Transporter interface for GenerateAwsTemplateServerTransport. +func (g *GenerateAwsTemplateServerTransport) 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 g.dispatchToMethodFake(req, method) +} + +func (g *GenerateAwsTemplateServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if generateAwsTemplateServerTransportInterceptor != nil { + res.resp, res.err, intercepted = generateAwsTemplateServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "GenerateAwsTemplateClient.Post": + res.resp, res.err = g.dispatchPost(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (g *GenerateAwsTemplateServerTransport) dispatchPost(req *http.Request) (*http.Response, error) { + if g.srv.Post == nil { + return nil, &nonRetriableError{errors.New("fake for method Post not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/generateAwsTemplate` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armhybridconnectivity.GenerateAwsTemplateRequest](req) + if err != nil { + return nil, err + } + respr, errRespr := g.srv.Post(req.Context(), body, 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).PostResponse, req) + if err != nil { + return nil, err + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to GenerateAwsTemplateServerTransport +var generateAwsTemplateServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/internal.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/internal.go index 4d8bd36394ec..7425b6a669e2 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/internal.go +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/internal.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -14,6 +10,11 @@ import ( "sync" ) +type result struct { + resp *http.Response + err error +} + type nonRetriableError struct { error } @@ -31,17 +32,6 @@ func contains[T comparable](s []T, v T) bool { return false } -func parseOptional[T any](v string, parse func(v string) (T, error)) (*T, error) { - if v == "" { - return nil, nil - } - t, err := parse(v) - if err != nil { - return nil, err - } - return &t, err -} - func newTracker[T any]() *tracker[T] { return &tracker[T]{ items: map[string]*T{}, diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/inventory_server.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/inventory_server.go new file mode 100644 index 000000000000..e1da9bf65d5c --- /dev/null +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/inventory_server.go @@ -0,0 +1,177 @@ +// 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/hybridconnectivity/armhybridconnectivity/v2" + "net/http" + "net/url" + "regexp" +) + +// InventoryServer is a fake server for instances of the armhybridconnectivity.InventoryClient type. +type InventoryServer struct { + // Get is the fake for method InventoryClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceURI string, solutionConfiguration string, inventoryID string, options *armhybridconnectivity.InventoryClientGetOptions) (resp azfake.Responder[armhybridconnectivity.InventoryClientGetResponse], errResp azfake.ErrorResponder) + + // NewListBySolutionConfigurationPager is the fake for method InventoryClient.NewListBySolutionConfigurationPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySolutionConfigurationPager func(resourceURI string, solutionConfiguration string, options *armhybridconnectivity.InventoryClientListBySolutionConfigurationOptions) (resp azfake.PagerResponder[armhybridconnectivity.InventoryClientListBySolutionConfigurationResponse]) +} + +// NewInventoryServerTransport creates a new instance of InventoryServerTransport with the provided implementation. +// The returned InventoryServerTransport instance is connected to an instance of armhybridconnectivity.InventoryClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewInventoryServerTransport(srv *InventoryServer) *InventoryServerTransport { + return &InventoryServerTransport{ + srv: srv, + newListBySolutionConfigurationPager: newTracker[azfake.PagerResponder[armhybridconnectivity.InventoryClientListBySolutionConfigurationResponse]](), + } +} + +// InventoryServerTransport connects instances of armhybridconnectivity.InventoryClient to instances of InventoryServer. +// Don't use this type directly, use NewInventoryServerTransport instead. +type InventoryServerTransport struct { + srv *InventoryServer + newListBySolutionConfigurationPager *tracker[azfake.PagerResponder[armhybridconnectivity.InventoryClientListBySolutionConfigurationResponse]] +} + +// Do implements the policy.Transporter interface for InventoryServerTransport. +func (i *InventoryServerTransport) 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 i.dispatchToMethodFake(req, method) +} + +func (i *InventoryServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if inventoryServerTransportInterceptor != nil { + res.resp, res.err, intercepted = inventoryServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "InventoryClient.Get": + res.resp, res.err = i.dispatchGet(req) + case "InventoryClient.NewListBySolutionConfigurationPager": + res.resp, res.err = i.dispatchNewListBySolutionConfigurationPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (i *InventoryServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if i.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/solutionConfigurations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/inventory/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) + if err != nil { + return nil, err + } + solutionConfigurationParam, err := url.PathUnescape(matches[regex.SubexpIndex("solutionConfiguration")]) + if err != nil { + return nil, err + } + inventoryIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("inventoryId")]) + if err != nil { + return nil, err + } + respr, errRespr := i.srv.Get(req.Context(), resourceURIParam, solutionConfigurationParam, inventoryIDParam, 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).InventoryResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (i *InventoryServerTransport) dispatchNewListBySolutionConfigurationPager(req *http.Request) (*http.Response, error) { + if i.srv.NewListBySolutionConfigurationPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySolutionConfigurationPager not implemented")} + } + newListBySolutionConfigurationPager := i.newListBySolutionConfigurationPager.get(req) + if newListBySolutionConfigurationPager == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/solutionConfigurations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/inventory` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) + if err != nil { + return nil, err + } + solutionConfigurationParam, err := url.PathUnescape(matches[regex.SubexpIndex("solutionConfiguration")]) + if err != nil { + return nil, err + } + resp := i.srv.NewListBySolutionConfigurationPager(resourceURIParam, solutionConfigurationParam, nil) + newListBySolutionConfigurationPager = &resp + i.newListBySolutionConfigurationPager.add(req, newListBySolutionConfigurationPager) + server.PagerResponderInjectNextLinks(newListBySolutionConfigurationPager, req, func(page *armhybridconnectivity.InventoryClientListBySolutionConfigurationResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListBySolutionConfigurationPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + i.newListBySolutionConfigurationPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySolutionConfigurationPager) { + i.newListBySolutionConfigurationPager.remove(req) + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to InventoryServerTransport +var inventoryServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/publiccloudconnectors_server.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/publiccloudconnectors_server.go new file mode 100644 index 000000000000..62b43565e4ed --- /dev/null +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/publiccloudconnectors_server.go @@ -0,0 +1,400 @@ +// 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/hybridconnectivity/armhybridconnectivity/v2" + "net/http" + "net/url" + "regexp" +) + +// PublicCloudConnectorsServer is a fake server for instances of the armhybridconnectivity.PublicCloudConnectorsClient type. +type PublicCloudConnectorsServer struct { + // BeginCreateOrUpdate is the fake for method PublicCloudConnectorsClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, publicCloudConnector string, resource armhybridconnectivity.PublicCloudConnector, options *armhybridconnectivity.PublicCloudConnectorsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armhybridconnectivity.PublicCloudConnectorsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // Delete is the fake for method PublicCloudConnectorsClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, resourceGroupName string, publicCloudConnector string, options *armhybridconnectivity.PublicCloudConnectorsClientDeleteOptions) (resp azfake.Responder[armhybridconnectivity.PublicCloudConnectorsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method PublicCloudConnectorsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, publicCloudConnector string, options *armhybridconnectivity.PublicCloudConnectorsClientGetOptions) (resp azfake.Responder[armhybridconnectivity.PublicCloudConnectorsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method PublicCloudConnectorsClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armhybridconnectivity.PublicCloudConnectorsClientListByResourceGroupOptions) (resp azfake.PagerResponder[armhybridconnectivity.PublicCloudConnectorsClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method PublicCloudConnectorsClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armhybridconnectivity.PublicCloudConnectorsClientListBySubscriptionOptions) (resp azfake.PagerResponder[armhybridconnectivity.PublicCloudConnectorsClientListBySubscriptionResponse]) + + // BeginTestPermissions is the fake for method PublicCloudConnectorsClient.BeginTestPermissions + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginTestPermissions func(ctx context.Context, resourceGroupName string, publicCloudConnector string, options *armhybridconnectivity.PublicCloudConnectorsClientBeginTestPermissionsOptions) (resp azfake.PollerResponder[armhybridconnectivity.PublicCloudConnectorsClientTestPermissionsResponse], errResp azfake.ErrorResponder) + + // Update is the fake for method PublicCloudConnectorsClient.Update + // HTTP status codes to indicate success: http.StatusOK + Update func(ctx context.Context, resourceGroupName string, publicCloudConnector string, properties armhybridconnectivity.PublicCloudConnector, options *armhybridconnectivity.PublicCloudConnectorsClientUpdateOptions) (resp azfake.Responder[armhybridconnectivity.PublicCloudConnectorsClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewPublicCloudConnectorsServerTransport creates a new instance of PublicCloudConnectorsServerTransport with the provided implementation. +// The returned PublicCloudConnectorsServerTransport instance is connected to an instance of armhybridconnectivity.PublicCloudConnectorsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewPublicCloudConnectorsServerTransport(srv *PublicCloudConnectorsServer) *PublicCloudConnectorsServerTransport { + return &PublicCloudConnectorsServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armhybridconnectivity.PublicCloudConnectorsClientCreateOrUpdateResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armhybridconnectivity.PublicCloudConnectorsClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armhybridconnectivity.PublicCloudConnectorsClientListBySubscriptionResponse]](), + beginTestPermissions: newTracker[azfake.PollerResponder[armhybridconnectivity.PublicCloudConnectorsClientTestPermissionsResponse]](), + } +} + +// PublicCloudConnectorsServerTransport connects instances of armhybridconnectivity.PublicCloudConnectorsClient to instances of PublicCloudConnectorsServer. +// Don't use this type directly, use NewPublicCloudConnectorsServerTransport instead. +type PublicCloudConnectorsServerTransport struct { + srv *PublicCloudConnectorsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armhybridconnectivity.PublicCloudConnectorsClientCreateOrUpdateResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armhybridconnectivity.PublicCloudConnectorsClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armhybridconnectivity.PublicCloudConnectorsClientListBySubscriptionResponse]] + beginTestPermissions *tracker[azfake.PollerResponder[armhybridconnectivity.PublicCloudConnectorsClientTestPermissionsResponse]] +} + +// Do implements the policy.Transporter interface for PublicCloudConnectorsServerTransport. +func (p *PublicCloudConnectorsServerTransport) 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 p.dispatchToMethodFake(req, method) +} + +func (p *PublicCloudConnectorsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if publicCloudConnectorsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = publicCloudConnectorsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "PublicCloudConnectorsClient.BeginCreateOrUpdate": + res.resp, res.err = p.dispatchBeginCreateOrUpdate(req) + case "PublicCloudConnectorsClient.Delete": + res.resp, res.err = p.dispatchDelete(req) + case "PublicCloudConnectorsClient.Get": + res.resp, res.err = p.dispatchGet(req) + case "PublicCloudConnectorsClient.NewListByResourceGroupPager": + res.resp, res.err = p.dispatchNewListByResourceGroupPager(req) + case "PublicCloudConnectorsClient.NewListBySubscriptionPager": + res.resp, res.err = p.dispatchNewListBySubscriptionPager(req) + case "PublicCloudConnectorsClient.BeginTestPermissions": + res.resp, res.err = p.dispatchBeginTestPermissions(req) + case "PublicCloudConnectorsClient.Update": + res.resp, res.err = p.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (p *PublicCloudConnectorsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if p.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := p.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/publicCloudConnectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[armhybridconnectivity.PublicCloudConnector](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + publicCloudConnectorParam, err := url.PathUnescape(matches[regex.SubexpIndex("publicCloudConnector")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, publicCloudConnectorParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + p.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + p.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + p.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (p *PublicCloudConnectorsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { + if p.srv.Delete == nil { + return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/publicCloudConnectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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 + } + publicCloudConnectorParam, err := url.PathUnescape(matches[regex.SubexpIndex("publicCloudConnector")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.Delete(req.Context(), resourceGroupNameParam, publicCloudConnectorParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + return resp, nil +} + +func (p *PublicCloudConnectorsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if p.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\.HybridConnectivity/publicCloudConnectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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 + } + publicCloudConnectorParam, err := url.PathUnescape(matches[regex.SubexpIndex("publicCloudConnector")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, publicCloudConnectorParam, 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).PublicCloudConnector, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (p *PublicCloudConnectorsServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if p.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := p.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/publicCloudConnectors` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resp := p.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) + newListByResourceGroupPager = &resp + p.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armhybridconnectivity.PublicCloudConnectorsClientListByResourceGroupResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + p.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + p.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (p *PublicCloudConnectorsServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if p.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := p.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/publicCloudConnectors` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resp := p.srv.NewListBySubscriptionPager(nil) + newListBySubscriptionPager = &resp + p.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armhybridconnectivity.PublicCloudConnectorsClientListBySubscriptionResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + p.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + p.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (p *PublicCloudConnectorsServerTransport) dispatchBeginTestPermissions(req *http.Request) (*http.Response, error) { + if p.srv.BeginTestPermissions == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginTestPermissions not implemented")} + } + beginTestPermissions := p.beginTestPermissions.get(req) + if beginTestPermissions == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/publicCloudConnectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/testPermissions` + 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 + } + publicCloudConnectorParam, err := url.PathUnescape(matches[regex.SubexpIndex("publicCloudConnector")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginTestPermissions(req.Context(), resourceGroupNameParam, publicCloudConnectorParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginTestPermissions = &respr + p.beginTestPermissions.add(req, beginTestPermissions) + } + + resp, err := server.PollerResponderNext(beginTestPermissions, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + p.beginTestPermissions.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginTestPermissions) { + p.beginTestPermissions.remove(req) + } + + return resp, nil +} + +func (p *PublicCloudConnectorsServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { + if p.srv.Update == nil { + return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/publicCloudConnectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[armhybridconnectivity.PublicCloudConnector](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + publicCloudConnectorParam, err := url.PathUnescape(matches[regex.SubexpIndex("publicCloudConnector")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.Update(req.Context(), resourceGroupNameParam, publicCloudConnectorParam, body, 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).PublicCloudConnector, req) + if err != nil { + return nil, err + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to PublicCloudConnectorsServerTransport +var publicCloudConnectorsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/server_factory.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/server_factory.go index 34efe6c74a09..451a0fa8ad2d 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/server_factory.go +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/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,9 +15,20 @@ import ( // ServerFactory is a fake server for instances of the armhybridconnectivity.ClientFactory type. type ServerFactory struct { - EndpointsServer EndpointsServer - OperationsServer OperationsServer - ServiceConfigurationsServer ServiceConfigurationsServer + // GenerateAwsTemplateServer contains the fakes for client GenerateAwsTemplateClient + GenerateAwsTemplateServer GenerateAwsTemplateServer + + // InventoryServer contains the fakes for client InventoryClient + InventoryServer InventoryServer + + // PublicCloudConnectorsServer contains the fakes for client PublicCloudConnectorsClient + PublicCloudConnectorsServer PublicCloudConnectorsServer + + // SolutionConfigurationsServer contains the fakes for client SolutionConfigurationsClient + SolutionConfigurationsServer SolutionConfigurationsServer + + // SolutionTypesServer contains the fakes for client SolutionTypesClient + SolutionTypesServer SolutionTypesServer } // NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. @@ -36,11 +43,13 @@ func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { // ServerFactoryTransport connects instances of armhybridconnectivity.ClientFactory to instances of ServerFactory. // Don't use this type directly, use NewServerFactoryTransport instead. type ServerFactoryTransport struct { - srv *ServerFactory - trMu sync.Mutex - trEndpointsServer *EndpointsServerTransport - trOperationsServer *OperationsServerTransport - trServiceConfigurationsServer *ServiceConfigurationsServerTransport + srv *ServerFactory + trMu sync.Mutex + trGenerateAwsTemplateServer *GenerateAwsTemplateServerTransport + trInventoryServer *InventoryServerTransport + trPublicCloudConnectorsServer *PublicCloudConnectorsServerTransport + trSolutionConfigurationsServer *SolutionConfigurationsServerTransport + trSolutionTypesServer *SolutionTypesServerTransport } // Do implements the policy.Transporter interface for ServerFactoryTransport. @@ -56,17 +65,29 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { var err error switch client { - case "EndpointsClient": - initServer(s, &s.trEndpointsServer, func() *EndpointsServerTransport { return NewEndpointsServerTransport(&s.srv.EndpointsServer) }) - resp, err = s.trEndpointsServer.Do(req) - case "OperationsClient": - initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) - resp, err = s.trOperationsServer.Do(req) - case "ServiceConfigurationsClient": - initServer(s, &s.trServiceConfigurationsServer, func() *ServiceConfigurationsServerTransport { - return NewServiceConfigurationsServerTransport(&s.srv.ServiceConfigurationsServer) + case "GenerateAwsTemplateClient": + initServer(s, &s.trGenerateAwsTemplateServer, func() *GenerateAwsTemplateServerTransport { + return NewGenerateAwsTemplateServerTransport(&s.srv.GenerateAwsTemplateServer) + }) + resp, err = s.trGenerateAwsTemplateServer.Do(req) + case "InventoryClient": + initServer(s, &s.trInventoryServer, func() *InventoryServerTransport { return NewInventoryServerTransport(&s.srv.InventoryServer) }) + resp, err = s.trInventoryServer.Do(req) + case "PublicCloudConnectorsClient": + initServer(s, &s.trPublicCloudConnectorsServer, func() *PublicCloudConnectorsServerTransport { + return NewPublicCloudConnectorsServerTransport(&s.srv.PublicCloudConnectorsServer) + }) + resp, err = s.trPublicCloudConnectorsServer.Do(req) + case "SolutionConfigurationsClient": + initServer(s, &s.trSolutionConfigurationsServer, func() *SolutionConfigurationsServerTransport { + return NewSolutionConfigurationsServerTransport(&s.srv.SolutionConfigurationsServer) + }) + resp, err = s.trSolutionConfigurationsServer.Do(req) + case "SolutionTypesClient": + initServer(s, &s.trSolutionTypesServer, func() *SolutionTypesServerTransport { + return NewSolutionTypesServerTransport(&s.srv.SolutionTypesServer) }) - resp, err = s.trServiceConfigurationsServer.Do(req) + resp, err = s.trSolutionTypesServer.Do(req) default: err = fmt.Errorf("unhandled client %s", client) } diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/serviceconfigurations_server.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/serviceconfigurations_server.go deleted file mode 100644 index bc2e11c98848..000000000000 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/serviceconfigurations_server.go +++ /dev/null @@ -1,293 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity" - "net/http" - "net/url" - "regexp" -) - -// ServiceConfigurationsServer is a fake server for instances of the armhybridconnectivity.ServiceConfigurationsClient type. -type ServiceConfigurationsServer struct { - // CreateOrupdate is the fake for method ServiceConfigurationsClient.CreateOrupdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - CreateOrupdate func(ctx context.Context, resourceURI string, endpointName string, serviceConfigurationName string, serviceConfigurationResource armhybridconnectivity.ServiceConfigurationResource, options *armhybridconnectivity.ServiceConfigurationsClientCreateOrupdateOptions) (resp azfake.Responder[armhybridconnectivity.ServiceConfigurationsClientCreateOrupdateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method ServiceConfigurationsClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceURI string, endpointName string, serviceConfigurationName string, options *armhybridconnectivity.ServiceConfigurationsClientDeleteOptions) (resp azfake.Responder[armhybridconnectivity.ServiceConfigurationsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method ServiceConfigurationsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceURI string, endpointName string, serviceConfigurationName string, options *armhybridconnectivity.ServiceConfigurationsClientGetOptions) (resp azfake.Responder[armhybridconnectivity.ServiceConfigurationsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListByEndpointResourcePager is the fake for method ServiceConfigurationsClient.NewListByEndpointResourcePager - // HTTP status codes to indicate success: http.StatusOK - NewListByEndpointResourcePager func(resourceURI string, endpointName string, options *armhybridconnectivity.ServiceConfigurationsClientListByEndpointResourceOptions) (resp azfake.PagerResponder[armhybridconnectivity.ServiceConfigurationsClientListByEndpointResourceResponse]) - - // Update is the fake for method ServiceConfigurationsClient.Update - // HTTP status codes to indicate success: http.StatusOK - Update func(ctx context.Context, resourceURI string, endpointName string, serviceConfigurationName string, serviceConfigurationResource armhybridconnectivity.ServiceConfigurationResourcePatch, options *armhybridconnectivity.ServiceConfigurationsClientUpdateOptions) (resp azfake.Responder[armhybridconnectivity.ServiceConfigurationsClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewServiceConfigurationsServerTransport creates a new instance of ServiceConfigurationsServerTransport with the provided implementation. -// The returned ServiceConfigurationsServerTransport instance is connected to an instance of armhybridconnectivity.ServiceConfigurationsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewServiceConfigurationsServerTransport(srv *ServiceConfigurationsServer) *ServiceConfigurationsServerTransport { - return &ServiceConfigurationsServerTransport{ - srv: srv, - newListByEndpointResourcePager: newTracker[azfake.PagerResponder[armhybridconnectivity.ServiceConfigurationsClientListByEndpointResourceResponse]](), - } -} - -// ServiceConfigurationsServerTransport connects instances of armhybridconnectivity.ServiceConfigurationsClient to instances of ServiceConfigurationsServer. -// Don't use this type directly, use NewServiceConfigurationsServerTransport instead. -type ServiceConfigurationsServerTransport struct { - srv *ServiceConfigurationsServer - newListByEndpointResourcePager *tracker[azfake.PagerResponder[armhybridconnectivity.ServiceConfigurationsClientListByEndpointResourceResponse]] -} - -// Do implements the policy.Transporter interface for ServiceConfigurationsServerTransport. -func (s *ServiceConfigurationsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "ServiceConfigurationsClient.CreateOrupdate": - resp, err = s.dispatchCreateOrupdate(req) - case "ServiceConfigurationsClient.Delete": - resp, err = s.dispatchDelete(req) - case "ServiceConfigurationsClient.Get": - resp, err = s.dispatchGet(req) - case "ServiceConfigurationsClient.NewListByEndpointResourcePager": - resp, err = s.dispatchNewListByEndpointResourcePager(req) - case "ServiceConfigurationsClient.Update": - resp, err = s.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (s *ServiceConfigurationsServerTransport) dispatchCreateOrupdate(req *http.Request) (*http.Response, error) { - if s.srv.CreateOrupdate == nil { - return nil, &nonRetriableError{errors.New("fake for method CreateOrupdate not implemented")} - } - const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/endpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/serviceConfigurations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - 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) - } - body, err := server.UnmarshalRequestAsJSON[armhybridconnectivity.ServiceConfigurationResource](req) - if err != nil { - return nil, err - } - resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) - if err != nil { - return nil, err - } - endpointNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("endpointName")]) - if err != nil { - return nil, err - } - serviceConfigurationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("serviceConfigurationName")]) - if err != nil { - return nil, err - } - respr, errRespr := s.srv.CreateOrupdate(req.Context(), resourceURIParam, endpointNameParam, serviceConfigurationNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ServiceConfigurationResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (s *ServiceConfigurationsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if s.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/endpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/serviceConfigurations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - 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) - } - resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) - if err != nil { - return nil, err - } - endpointNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("endpointName")]) - if err != nil { - return nil, err - } - serviceConfigurationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("serviceConfigurationName")]) - if err != nil { - return nil, err - } - respr, errRespr := s.srv.Delete(req.Context(), resourceURIParam, endpointNameParam, serviceConfigurationNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} - -func (s *ServiceConfigurationsServerTransport) 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 = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/endpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/serviceConfigurations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - 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) - } - resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) - if err != nil { - return nil, err - } - endpointNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("endpointName")]) - if err != nil { - return nil, err - } - serviceConfigurationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("serviceConfigurationName")]) - if err != nil { - return nil, err - } - respr, errRespr := s.srv.Get(req.Context(), resourceURIParam, endpointNameParam, serviceConfigurationNameParam, 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).ServiceConfigurationResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (s *ServiceConfigurationsServerTransport) dispatchNewListByEndpointResourcePager(req *http.Request) (*http.Response, error) { - if s.srv.NewListByEndpointResourcePager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByEndpointResourcePager not implemented")} - } - newListByEndpointResourcePager := s.newListByEndpointResourcePager.get(req) - if newListByEndpointResourcePager == nil { - const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/endpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/serviceConfigurations` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) - if err != nil { - return nil, err - } - endpointNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("endpointName")]) - if err != nil { - return nil, err - } - resp := s.srv.NewListByEndpointResourcePager(resourceURIParam, endpointNameParam, nil) - newListByEndpointResourcePager = &resp - s.newListByEndpointResourcePager.add(req, newListByEndpointResourcePager) - server.PagerResponderInjectNextLinks(newListByEndpointResourcePager, req, func(page *armhybridconnectivity.ServiceConfigurationsClientListByEndpointResourceResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListByEndpointResourcePager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - s.newListByEndpointResourcePager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByEndpointResourcePager) { - s.newListByEndpointResourcePager.remove(req) - } - return resp, nil -} - -func (s *ServiceConfigurationsServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { - if s.srv.Update == nil { - return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} - } - const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/endpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/serviceConfigurations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - 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) - } - body, err := server.UnmarshalRequestAsJSON[armhybridconnectivity.ServiceConfigurationResourcePatch](req) - if err != nil { - return nil, err - } - resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) - if err != nil { - return nil, err - } - endpointNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("endpointName")]) - if err != nil { - return nil, err - } - serviceConfigurationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("serviceConfigurationName")]) - if err != nil { - return nil, err - } - respr, errRespr := s.srv.Update(req.Context(), resourceURIParam, endpointNameParam, serviceConfigurationNameParam, body, 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).ServiceConfigurationResource, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/solutionconfigurations_server.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/solutionconfigurations_server.go new file mode 100644 index 000000000000..153f931b0d21 --- /dev/null +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/solutionconfigurations_server.go @@ -0,0 +1,346 @@ +// 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/hybridconnectivity/armhybridconnectivity/v2" + "net/http" + "net/url" + "regexp" +) + +// SolutionConfigurationsServer is a fake server for instances of the armhybridconnectivity.SolutionConfigurationsClient type. +type SolutionConfigurationsServer struct { + // CreateOrUpdate is the fake for method SolutionConfigurationsClient.CreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + CreateOrUpdate func(ctx context.Context, resourceURI string, solutionConfiguration string, resource armhybridconnectivity.SolutionConfiguration, options *armhybridconnectivity.SolutionConfigurationsClientCreateOrUpdateOptions) (resp azfake.Responder[armhybridconnectivity.SolutionConfigurationsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // Delete is the fake for method SolutionConfigurationsClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, resourceURI string, solutionConfiguration string, options *armhybridconnectivity.SolutionConfigurationsClientDeleteOptions) (resp azfake.Responder[armhybridconnectivity.SolutionConfigurationsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method SolutionConfigurationsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceURI string, solutionConfiguration string, options *armhybridconnectivity.SolutionConfigurationsClientGetOptions) (resp azfake.Responder[armhybridconnectivity.SolutionConfigurationsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method SolutionConfigurationsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceURI string, options *armhybridconnectivity.SolutionConfigurationsClientListOptions) (resp azfake.PagerResponder[armhybridconnectivity.SolutionConfigurationsClientListResponse]) + + // BeginSyncNow is the fake for method SolutionConfigurationsClient.BeginSyncNow + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginSyncNow func(ctx context.Context, resourceURI string, solutionConfiguration string, options *armhybridconnectivity.SolutionConfigurationsClientBeginSyncNowOptions) (resp azfake.PollerResponder[armhybridconnectivity.SolutionConfigurationsClientSyncNowResponse], errResp azfake.ErrorResponder) + + // Update is the fake for method SolutionConfigurationsClient.Update + // HTTP status codes to indicate success: http.StatusOK + Update func(ctx context.Context, resourceURI string, solutionConfiguration string, properties armhybridconnectivity.SolutionConfiguration, options *armhybridconnectivity.SolutionConfigurationsClientUpdateOptions) (resp azfake.Responder[armhybridconnectivity.SolutionConfigurationsClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewSolutionConfigurationsServerTransport creates a new instance of SolutionConfigurationsServerTransport with the provided implementation. +// The returned SolutionConfigurationsServerTransport instance is connected to an instance of armhybridconnectivity.SolutionConfigurationsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewSolutionConfigurationsServerTransport(srv *SolutionConfigurationsServer) *SolutionConfigurationsServerTransport { + return &SolutionConfigurationsServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armhybridconnectivity.SolutionConfigurationsClientListResponse]](), + beginSyncNow: newTracker[azfake.PollerResponder[armhybridconnectivity.SolutionConfigurationsClientSyncNowResponse]](), + } +} + +// SolutionConfigurationsServerTransport connects instances of armhybridconnectivity.SolutionConfigurationsClient to instances of SolutionConfigurationsServer. +// Don't use this type directly, use NewSolutionConfigurationsServerTransport instead. +type SolutionConfigurationsServerTransport struct { + srv *SolutionConfigurationsServer + newListPager *tracker[azfake.PagerResponder[armhybridconnectivity.SolutionConfigurationsClientListResponse]] + beginSyncNow *tracker[azfake.PollerResponder[armhybridconnectivity.SolutionConfigurationsClientSyncNowResponse]] +} + +// Do implements the policy.Transporter interface for SolutionConfigurationsServerTransport. +func (s *SolutionConfigurationsServerTransport) 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 *SolutionConfigurationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if solutionConfigurationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = solutionConfigurationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "SolutionConfigurationsClient.CreateOrUpdate": + res.resp, res.err = s.dispatchCreateOrUpdate(req) + case "SolutionConfigurationsClient.Delete": + res.resp, res.err = s.dispatchDelete(req) + case "SolutionConfigurationsClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "SolutionConfigurationsClient.NewListPager": + res.resp, res.err = s.dispatchNewListPager(req) + case "SolutionConfigurationsClient.BeginSyncNow": + res.resp, res.err = s.dispatchBeginSyncNow(req) + case "SolutionConfigurationsClient.Update": + res.resp, res.err = s.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (s *SolutionConfigurationsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { + if s.srv.CreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/solutionConfigurations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armhybridconnectivity.SolutionConfiguration](req) + if err != nil { + return nil, err + } + resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) + if err != nil { + return nil, err + } + solutionConfigurationParam, err := url.PathUnescape(matches[regex.SubexpIndex("solutionConfiguration")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.CreateOrUpdate(req.Context(), resourceURIParam, solutionConfigurationParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SolutionConfiguration, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SolutionConfigurationsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { + if s.srv.Delete == nil { + return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/solutionConfigurations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) + if err != nil { + return nil, err + } + solutionConfigurationParam, err := url.PathUnescape(matches[regex.SubexpIndex("solutionConfiguration")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Delete(req.Context(), resourceURIParam, solutionConfigurationParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SolutionConfigurationsServerTransport) 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 = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/solutionConfigurations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) + if err != nil { + return nil, err + } + solutionConfigurationParam, err := url.PathUnescape(matches[regex.SubexpIndex("solutionConfiguration")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Get(req.Context(), resourceURIParam, solutionConfigurationParam, 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).SolutionConfiguration, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SolutionConfigurationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if s.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := s.newListPager.get(req) + if newListPager == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/solutionConfigurations` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) + if err != nil { + return nil, err + } + resp := s.srv.NewListPager(resourceURIParam, nil) + newListPager = &resp + s.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armhybridconnectivity.SolutionConfigurationsClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + s.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + s.newListPager.remove(req) + } + return resp, nil +} + +func (s *SolutionConfigurationsServerTransport) dispatchBeginSyncNow(req *http.Request) (*http.Response, error) { + if s.srv.BeginSyncNow == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginSyncNow not implemented")} + } + beginSyncNow := s.beginSyncNow.get(req) + if beginSyncNow == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/solutionConfigurations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/syncNow` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) + if err != nil { + return nil, err + } + solutionConfigurationParam, err := url.PathUnescape(matches[regex.SubexpIndex("solutionConfiguration")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginSyncNow(req.Context(), resourceURIParam, solutionConfigurationParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginSyncNow = &respr + s.beginSyncNow.add(req, beginSyncNow) + } + + resp, err := server.PollerResponderNext(beginSyncNow, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + s.beginSyncNow.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginSyncNow) { + s.beginSyncNow.remove(req) + } + + return resp, nil +} + +func (s *SolutionConfigurationsServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { + if s.srv.Update == nil { + return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/solutionConfigurations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armhybridconnectivity.SolutionConfiguration](req) + if err != nil { + return nil, err + } + resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) + if err != nil { + return nil, err + } + solutionConfigurationParam, err := url.PathUnescape(matches[regex.SubexpIndex("solutionConfiguration")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Update(req.Context(), resourceURIParam, solutionConfigurationParam, body, 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).SolutionConfiguration, req) + if err != nil { + return nil, err + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to SolutionConfigurationsServerTransport +var solutionConfigurationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/solutiontypes_server.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/solutiontypes_server.go new file mode 100644 index 000000000000..903608c8da9a --- /dev/null +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/solutiontypes_server.go @@ -0,0 +1,210 @@ +// 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/hybridconnectivity/armhybridconnectivity/v2" + "net/http" + "net/url" + "regexp" +) + +// SolutionTypesServer is a fake server for instances of the armhybridconnectivity.SolutionTypesClient type. +type SolutionTypesServer struct { + // Get is the fake for method SolutionTypesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, solutionType string, options *armhybridconnectivity.SolutionTypesClientGetOptions) (resp azfake.Responder[armhybridconnectivity.SolutionTypesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method SolutionTypesClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armhybridconnectivity.SolutionTypesClientListByResourceGroupOptions) (resp azfake.PagerResponder[armhybridconnectivity.SolutionTypesClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method SolutionTypesClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armhybridconnectivity.SolutionTypesClientListBySubscriptionOptions) (resp azfake.PagerResponder[armhybridconnectivity.SolutionTypesClientListBySubscriptionResponse]) +} + +// NewSolutionTypesServerTransport creates a new instance of SolutionTypesServerTransport with the provided implementation. +// The returned SolutionTypesServerTransport instance is connected to an instance of armhybridconnectivity.SolutionTypesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewSolutionTypesServerTransport(srv *SolutionTypesServer) *SolutionTypesServerTransport { + return &SolutionTypesServerTransport{ + srv: srv, + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armhybridconnectivity.SolutionTypesClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armhybridconnectivity.SolutionTypesClientListBySubscriptionResponse]](), + } +} + +// SolutionTypesServerTransport connects instances of armhybridconnectivity.SolutionTypesClient to instances of SolutionTypesServer. +// Don't use this type directly, use NewSolutionTypesServerTransport instead. +type SolutionTypesServerTransport struct { + srv *SolutionTypesServer + newListByResourceGroupPager *tracker[azfake.PagerResponder[armhybridconnectivity.SolutionTypesClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armhybridconnectivity.SolutionTypesClientListBySubscriptionResponse]] +} + +// Do implements the policy.Transporter interface for SolutionTypesServerTransport. +func (s *SolutionTypesServerTransport) 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 *SolutionTypesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if solutionTypesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = solutionTypesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "SolutionTypesClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "SolutionTypesClient.NewListByResourceGroupPager": + res.resp, res.err = s.dispatchNewListByResourceGroupPager(req) + case "SolutionTypesClient.NewListBySubscriptionPager": + res.resp, res.err = s.dispatchNewListBySubscriptionPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (s *SolutionTypesServerTransport) 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\.HybridConnectivity/solutionTypes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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 + } + solutionTypeParam, err := url.PathUnescape(matches[regex.SubexpIndex("solutionType")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Get(req.Context(), resourceGroupNameParam, solutionTypeParam, 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).SolutionTypeResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SolutionTypesServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if s.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := s.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/solutionTypes` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resp := s.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) + newListByResourceGroupPager = &resp + s.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armhybridconnectivity.SolutionTypesClientListByResourceGroupResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + s.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + s.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (s *SolutionTypesServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if s.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := s.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/solutionTypes` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resp := s.srv.NewListBySubscriptionPager(nil) + newListBySubscriptionPager = &resp + s.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armhybridconnectivity.SolutionTypesClientListBySubscriptionResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + s.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + s.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to SolutionTypesServerTransport +var solutionTypesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/time_rfc3339.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/time_rfc3339.go index b0535a7b63e6..87ee11e83b32 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/time_rfc3339.go +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/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 @@ -19,12 +15,16 @@ import ( ) // Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. -var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) const ( - utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` - utcDateTime = "2006-01-02T15:04:05.999999999" - dateTimeJSON = `"` + time.RFC3339Nano + `"` + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` ) type dateTimeRFC3339 time.Time @@ -40,17 +40,36 @@ func (t dateTimeRFC3339) MarshalText() ([]byte, error) { } func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcDateTimeJSON - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT } return t.Parse(layout, string(data)) } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - layout := utcDateTime - if tzOffsetRegex.Match(data) { + if len(data) == 0 { + return nil + } + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT } return t.Parse(layout, string(data)) } @@ -61,6 +80,10 @@ func (t *dateTimeRFC3339) Parse(layout, value string) error { return err } +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return @@ -74,7 +97,7 @@ func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { } func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { + if data == nil || string(data) == "null" { return nil } var aux dateTimeRFC3339 diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/generateawstemplate_client.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/generateawstemplate_client.go new file mode 100644 index 000000000000..76eba82d7603 --- /dev/null +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/generateawstemplate_client.go @@ -0,0 +1,100 @@ +// 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 armhybridconnectivity + +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" +) + +// GenerateAwsTemplateClient contains the methods for the GenerateAwsTemplate group. +// Don't use this type directly, use NewGenerateAwsTemplateClient() instead. +type GenerateAwsTemplateClient struct { + internal *arm.Client + subscriptionID string +} + +// NewGenerateAwsTemplateClient creates a new instance of GenerateAwsTemplateClient 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 NewGenerateAwsTemplateClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*GenerateAwsTemplateClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &GenerateAwsTemplateClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Post - Retrieve AWS Cloud Formation template +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-12-01 +// - generateAwsTemplateRequest - ConnectorId and SolutionTypes and their properties to Generate AWS CFT Template. +// - options - GenerateAwsTemplateClientPostOptions contains the optional parameters for the GenerateAwsTemplateClient.Post +// method. +func (client *GenerateAwsTemplateClient) Post(ctx context.Context, generateAwsTemplateRequest GenerateAwsTemplateRequest, options *GenerateAwsTemplateClientPostOptions) (GenerateAwsTemplateClientPostResponse, error) { + var err error + const operationName = "GenerateAwsTemplateClient.Post" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.postCreateRequest(ctx, generateAwsTemplateRequest, options) + if err != nil { + return GenerateAwsTemplateClientPostResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return GenerateAwsTemplateClientPostResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return GenerateAwsTemplateClientPostResponse{}, err + } + resp, err := client.postHandleResponse(httpResp) + return resp, err +} + +// postCreateRequest creates the Post request. +func (client *GenerateAwsTemplateClient) postCreateRequest(ctx context.Context, generateAwsTemplateRequest GenerateAwsTemplateRequest, _ *GenerateAwsTemplateClientPostOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.HybridConnectivity/generateAwsTemplate" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-12-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, generateAwsTemplateRequest); err != nil { + return nil, err + } + return req, nil +} + +// postHandleResponse handles the Post response. +func (client *GenerateAwsTemplateClient) postHandleResponse(resp *http.Response) (GenerateAwsTemplateClientPostResponse, error) { + result := GenerateAwsTemplateClientPostResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PostResponse); err != nil { + return GenerateAwsTemplateClientPostResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/generateawstemplate_client_example_test.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/generateawstemplate_client_example_test.go new file mode 100644 index 000000000000..f987419102f2 --- /dev/null +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/generateawstemplate_client_example_test.go @@ -0,0 +1,45 @@ +// 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 armhybridconnectivity_test + +import ( + "context" + "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/hybridconnectivity/armhybridconnectivity/v2" + "log" +) + +// Generated from example definition: 2024-12-01/GenerateAwsTemplate_Post.json +func ExampleGenerateAwsTemplateClient_Post() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhybridconnectivity.NewClientFactory("5ACC4579-DB34-4C2F-8F8C-25061168F342", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewGenerateAwsTemplateClient().Post(ctx, armhybridconnectivity.GenerateAwsTemplateRequest{ + ConnectorID: to.Ptr("pnxcfjidglabnwxit"), + SolutionTypes: []*armhybridconnectivity.SolutionTypeSettings{ + { + SolutionType: to.Ptr("hjyownzpfxwiufmd"), + SolutionSettings: &armhybridconnectivity.SolutionSettings{}, + }, + }, + }, 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 = armhybridconnectivity.GenerateAwsTemplateClientPostResponse{ + // PostResponse: &armhybridconnectivity.PostResponse{ + // }, + // } +} diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/go.mod b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/go.mod index ab785662b81f..bebcb8a9fdca 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/go.mod +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/go.mod @@ -1,9 +1,9 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/v2 go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 ) @@ -14,8 +14,8 @@ require ( github.com/google/uuid v1.6.0 // indirect github.com/kylelemons/godebug v1.1.0 // indirect github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect - golang.org/x/crypto v0.25.0 // indirect - golang.org/x/net v0.27.0 // indirect - golang.org/x/sys v0.22.0 // indirect - golang.org/x/text v0.16.0 // indirect + golang.org/x/crypto v0.27.0 // indirect + golang.org/x/net v0.29.0 // indirect + golang.org/x/sys v0.25.0 // indirect + golang.org/x/text v0.18.0 // indirect ) diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/go.sum b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/go.sum index 09d275cb9a37..cbddbbd9ecec 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/go.sum +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/go.sum @@ -1,5 +1,5 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 h1:GJHeeA2N7xrG3q30L2UXDyuWRzDM900/65j70wcM4Ww= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 h1:JZg6HRh6W6U4OLl6lk7BZ7BLisIzM9dG1R50zUk9C/M= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0/go.mod h1:YL1xnZ6QejvQHWJrX/AvhFl4WW4rqHVoKspWNVwFk0M= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= @@ -17,13 +17,13 @@ github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmd github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= -golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= -golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= +golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= +golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/inventory_client.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/inventory_client.go new file mode 100644 index 000000000000..44c273d7b0b8 --- /dev/null +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/inventory_client.go @@ -0,0 +1,157 @@ +// 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 armhybridconnectivity + +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" +) + +// InventoryClient contains the methods for the Inventory group. +// Don't use this type directly, use NewInventoryClient() instead. +type InventoryClient struct { + internal *arm.Client +} + +// NewInventoryClient creates a new instance of InventoryClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewInventoryClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*InventoryClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &InventoryClient{ + internal: cl, + } + return client, nil +} + +// Get - Get a InventoryResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-12-01 +// - resourceURI - The fully qualified Azure Resource manager identifier of the resource. +// - solutionConfiguration - Represent Solution Configuration Resource. +// - inventoryID - Inventory resource +// - options - InventoryClientGetOptions contains the optional parameters for the InventoryClient.Get method. +func (client *InventoryClient) Get(ctx context.Context, resourceURI string, solutionConfiguration string, inventoryID string, options *InventoryClientGetOptions) (InventoryClientGetResponse, error) { + var err error + const operationName = "InventoryClient.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, resourceURI, solutionConfiguration, inventoryID, options) + if err != nil { + return InventoryClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return InventoryClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return InventoryClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *InventoryClient) getCreateRequest(ctx context.Context, resourceURI string, solutionConfiguration string, inventoryID string, _ *InventoryClientGetOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration}/inventory/{inventoryId}" + urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) + if solutionConfiguration == "" { + return nil, errors.New("parameter solutionConfiguration cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{solutionConfiguration}", url.PathEscape(solutionConfiguration)) + if inventoryID == "" { + return nil, errors.New("parameter inventoryID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{inventoryId}", url.PathEscape(inventoryID)) + 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-12-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *InventoryClient) getHandleResponse(resp *http.Response) (InventoryClientGetResponse, error) { + result := InventoryClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.InventoryResource); err != nil { + return InventoryClientGetResponse{}, err + } + return result, nil +} + +// NewListBySolutionConfigurationPager - List InventoryResource resources by SolutionConfiguration +// +// Generated from API version 2024-12-01 +// - resourceURI - The fully qualified Azure Resource manager identifier of the resource. +// - solutionConfiguration - Represent Solution Configuration Resource. +// - options - InventoryClientListBySolutionConfigurationOptions contains the optional parameters for the InventoryClient.NewListBySolutionConfigurationPager +// method. +func (client *InventoryClient) NewListBySolutionConfigurationPager(resourceURI string, solutionConfiguration string, options *InventoryClientListBySolutionConfigurationOptions) *runtime.Pager[InventoryClientListBySolutionConfigurationResponse] { + return runtime.NewPager(runtime.PagingHandler[InventoryClientListBySolutionConfigurationResponse]{ + More: func(page InventoryClientListBySolutionConfigurationResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *InventoryClientListBySolutionConfigurationResponse) (InventoryClientListBySolutionConfigurationResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "InventoryClient.NewListBySolutionConfigurationPager") + 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.listBySolutionConfigurationCreateRequest(ctx, resourceURI, solutionConfiguration, options) + }, nil) + if err != nil { + return InventoryClientListBySolutionConfigurationResponse{}, err + } + return client.listBySolutionConfigurationHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySolutionConfigurationCreateRequest creates the ListBySolutionConfiguration request. +func (client *InventoryClient) listBySolutionConfigurationCreateRequest(ctx context.Context, resourceURI string, solutionConfiguration string, _ *InventoryClientListBySolutionConfigurationOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration}/inventory" + urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) + if solutionConfiguration == "" { + return nil, errors.New("parameter solutionConfiguration cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{solutionConfiguration}", url.PathEscape(solutionConfiguration)) + 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-12-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySolutionConfigurationHandleResponse handles the ListBySolutionConfiguration response. +func (client *InventoryClient) listBySolutionConfigurationHandleResponse(resp *http.Response) (InventoryClientListBySolutionConfigurationResponse, error) { + result := InventoryClientListBySolutionConfigurationResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.InventoryResourceListResult); err != nil { + return InventoryClientListBySolutionConfigurationResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/inventory_client_example_test.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/inventory_client_example_test.go new file mode 100644 index 000000000000..580b829cba69 --- /dev/null +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/inventory_client_example_test.go @@ -0,0 +1,108 @@ +// 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 armhybridconnectivity_test + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/v2" + "log" +) + +// Generated from example definition: 2024-12-01/Inventory_Get.json +func ExampleInventoryClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhybridconnectivity.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewInventoryClient().Get(ctx, "ymuj", "zarfsraogroxlaqjjnwixtn", "xofprmcboosrbd", 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 = armhybridconnectivity.InventoryClientGetResponse{ + // InventoryResource: &armhybridconnectivity.InventoryResource{ + // Properties: &armhybridconnectivity.InventoryProperties{ + // CloudNativeType: to.Ptr(armhybridconnectivity.CloudNativeTypeEc2), + // CloudNativeResourceID: to.Ptr("ljnxclzxficxhdkr"), + // AzureResourceID: to.Ptr("ttzebbjzatugawuqxdupzmxkt"), + // Status: to.Ptr(armhybridconnectivity.SolutionConfigurationStatusNew), + // StatusDetails: to.Ptr("wxvnfzivtx"), + // ProvisioningState: to.Ptr(armhybridconnectivity.ResourceProvisioningStateSucceeded), + // }, + // ID: to.Ptr("/subscriptions/testSubcrptions/resourceGroups/testResourceGroup/providers/Microsoft.HybridConnectivity/SolutionConfigurations/qpwubemzmootxmtlxaerir/Inventory/xipjenocwvsqhhrplwmxwl"), + // Name: to.Ptr("xipjenocwvsqhhrplwmxwl"), + // Type: to.Ptr("jahwzrspsufypeouigsywjrx"), + // SystemData: &armhybridconnectivity.SystemData{ + // CreatedBy: to.Ptr("rpxzkcrobprrdvuoqxz"), + // CreatedByType: to.Ptr(armhybridconnectivity.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-18T22:52:07.890Z"); return t}()), + // LastModifiedBy: to.Ptr("jidegyskxi"), + // LastModifiedByType: to.Ptr(armhybridconnectivity.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-18T22:52:07.890Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2024-12-01/Inventory_ListBySolutionConfiguration.json +func ExampleInventoryClient_NewListBySolutionConfigurationPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhybridconnectivity.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewInventoryClient().NewListBySolutionConfigurationPager("ymuj", "wsxt", 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 = armhybridconnectivity.InventoryClientListBySolutionConfigurationResponse{ + // InventoryResourceListResult: armhybridconnectivity.InventoryResourceListResult{ + // Value: []*armhybridconnectivity.InventoryResource{ + // { + // Properties: &armhybridconnectivity.InventoryProperties{ + // CloudNativeType: to.Ptr(armhybridconnectivity.CloudNativeTypeEc2), + // CloudNativeResourceID: to.Ptr("ljnxclzxficxhdkr"), + // AzureResourceID: to.Ptr("ttzebbjzatugawuqxdupzmxkt"), + // Status: to.Ptr(armhybridconnectivity.SolutionConfigurationStatusNew), + // StatusDetails: to.Ptr("wxvnfzivtx"), + // ProvisioningState: to.Ptr(armhybridconnectivity.ResourceProvisioningStateSucceeded), + // }, + // ID: to.Ptr("/subscriptions/testSubcrptions/resourceGroups/testResourceGroup/providers/Microsoft.HybridConnectivity/SolutionConfigurations/qpwubemzmootxmtlxaerir/Inventory/xipjenocwvsqhhrplwmxwl"), + // Name: to.Ptr("xipjenocwvsqhhrplwmxwl"), + // Type: to.Ptr("jahwzrspsufypeouigsywjrx"), + // SystemData: &armhybridconnectivity.SystemData{ + // CreatedBy: to.Ptr("rpxzkcrobprrdvuoqxz"), + // CreatedByType: to.Ptr(armhybridconnectivity.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-18T22:52:07.890Z"); return t}()), + // LastModifiedBy: to.Ptr("jidegyskxi"), + // LastModifiedByType: to.Ptr(armhybridconnectivity.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-18T22:52:07.890Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/models.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/models.go index f4d4786c2664..ac5c190c4836 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/models.go +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/models.go @@ -1,78 +1,36 @@ -//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 armhybridconnectivity import "time" -// AADProfileProperties - The AAD Profile -type AADProfileProperties struct { - // REQUIRED; The arc ingress gateway server app id. - ServerID *string - - // REQUIRED; The target resource home tenant id. - TenantID *string -} - -// EndpointAccessResource - The endpoint access for the target resource. -type EndpointAccessResource struct { - // Azure relay hybrid connection access properties - Relay *RelayNamespaceAccessProperties -} - -// EndpointProperties - Endpoint details -type EndpointProperties struct { - // REQUIRED; The type of endpoint. - Type *Type - - // The resource Id of the connectivity endpoint (optional). - ResourceID *string - - // READ-ONLY; The resource provisioning state. - ProvisioningState *string -} - -// EndpointResource - The endpoint for the target resource. -type EndpointResource struct { - // The endpoint properties. - Properties *EndpointProperties +// AwsCloudProfile - cloud profile for AWS. +type AwsCloudProfile struct { + // REQUIRED; Account id for the AWS account. + AccountID *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 - Name *string - - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. - SystemData *SystemData + // List of AWS accounts which need to be excluded. + ExcludedAccounts []*string - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string -} - -// EndpointsList - The list of endpoints. -type EndpointsList struct { - // The link used to get the next page of endpoints list. - NextLink *string - - // The list of endpoint. - Value []*EndpointResource + // Boolean value that indicates whether the account is organizational or not. True represents organization account, whereas + // false represents a single account. + IsOrganizationalAccount *bool } // ErrorAdditionalInfo - The resource management error additional info. type ErrorAdditionalInfo struct { // READ-ONLY; The additional info. - Info any + Info *ErrorAdditionalInfoInfo // READ-ONLY; The additional info type. Type *string } +type ErrorAdditionalInfoInfo struct { +} + // ErrorDetail - The error detail. type ErrorDetail struct { // READ-ONLY; The error additional info. @@ -91,123 +49,110 @@ type ErrorDetail struct { Target *string } -// ErrorResponse - Common error response for all Azure Resource Manager APIs to return error details for failed operations. -// (This also follows the OData error response format.). -type ErrorResponse struct { - // The error object. - Error *ErrorDetail +// GenerateAwsTemplateRequest - ConnectorId and SolutionTypes and their properties to Generate AWS CFT Template. +type GenerateAwsTemplateRequest struct { + // REQUIRED; The name of public cloud connector + ConnectorID *string + + // The list of solution types and their settings + SolutionTypes []*SolutionTypeSettings } -// IngressGatewayResource - The ingress gateway access credentials -type IngressGatewayResource struct { - // Ingress gateway profile - Ingress *IngressProfileProperties +// InventoryProperties - Definition of inventory. +type InventoryProperties struct { + // Gets or sets the mapped azure resource id. + AzureResourceID *string - // Azure relay hybrid connection access properties - Relay *RelayNamespaceAccessProperties -} + // Gets or sets the cloud native resource name. + CloudNativeResourceID *string -// IngressProfileProperties - Ingress gateway profile -type IngressProfileProperties struct { - // REQUIRED; The AAD Profile - AADProfile *AADProfileProperties + // Gets or sets the cloud native resource type. + CloudNativeType *CloudNativeType - // REQUIRED; The ingress hostname. - Hostname *string -} + // Gets or sets the status of the inventory. + Status *SolutionConfigurationStatus -// ListCredentialsRequest - The details of the service for which credentials needs to be returned. -type ListCredentialsRequest struct { - // The name of the service. If not provided, the request will by pass the generation of service configuration token - ServiceName *ServiceName -} + // Gets or sets the status details. + StatusDetails *string -// ListIngressGatewayCredentialsRequest - Represent ListIngressGatewayCredentials Request object. -type ListIngressGatewayCredentialsRequest struct { - // The name of the service. - ServiceName *ServiceName + // READ-ONLY; The resource provisioning state. + ProvisioningState *ResourceProvisioningState } -// ManagedProxyRequest - Represent ManageProxy Request object. -type ManagedProxyRequest struct { - // REQUIRED; The name of the service. - Service *string +// InventoryResource - Concrete proxy resource types can be created by aliasing this type using a specific property type. +type InventoryResource struct { + // The resource-specific properties for this resource. + Properties *InventoryProperties - // The target host name. - Hostname *string + // READ-ONLY; Inventory resource + Name *string - // The name of the service. It is an optional property, if not provided, service configuration tokens issue code would be - // by passed. - ServiceName *ServiceName + // 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 } -// ManagedProxyResource - Managed Proxy -type ManagedProxyResource struct { - // REQUIRED; The expiration time of short lived proxy name in unix epoch. - ExpiresOn *int64 +// InventoryResourceListResult - The response of a InventoryResource list operation. +type InventoryResourceListResult struct { + // REQUIRED; The InventoryResource items on this page + Value []*InventoryResource - // REQUIRED; The short lived proxy name. - Proxy *string + // The link to the next page of items + NextLink *string } -// 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 +// OperationStatusResult - The current status of an async operation. +type OperationStatusResult struct { + // REQUIRED; Operation status. + Status *string - // READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. - ActionType *ActionType + // The end time of the operation. + EndTime *time.Time - // READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane - // operations. - IsDataAction *bool + // If present, details of the operation error. + Error *ErrorDetail - // READ-ONLY; The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", - // "Microsoft.Compute/virtualMachines/capture/action" - Name *string + // Fully qualified ID for the async operation. + ID *string - // READ-ONLY; The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default - // value is "user,system" - Origin *Origin -} + // Name of the async operation. + Name *string -// OperationDisplay - Localized display information for this particular operation. -type OperationDisplay struct { - // READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views. - Description *string + // The operations list. + Operations []*OperationStatusResult - // READ-ONLY; The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual - // Machine", "Restart Virtual Machine". - Operation *string + // Percent of the operation that is complete. + PercentComplete *float64 - // READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft - // Compute". - Provider *string + // The start time of the operation. + StartTime *time.Time +} - // READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job - // Schedule Collections". - Resource *string +type PostResponse struct { } -// OperationListResult - A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to -// get the next set of results. -type OperationListResult struct { - // READ-ONLY; URL to get the next set of operation list results (if there are any). - NextLink *string +// PublicCloudConnector - Public Cloud Connector +type PublicCloudConnector struct { + // REQUIRED; The geo-location where the resource lives + Location *string - // READ-ONLY; List of operations supported by the resource provider - Value []*Operation -} + // The resource-specific properties for this resource. + Properties *PublicCloudConnectorProperties -// ProxyResource - The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a -// location -type ProxyResource struct { - // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" - ID *string + // Resource tags. + Tags map[string]*string - // READ-ONLY; The name of the resource + // READ-ONLY; Represent public cloud connectors resource. Name *string + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData @@ -215,35 +160,41 @@ type ProxyResource struct { Type *string } -// RelayNamespaceAccessProperties - Azure relay hybrid connection access properties -type RelayNamespaceAccessProperties struct { - // REQUIRED; Azure Relay hybrid connection name for the resource. - HybridConnectionName *string +// PublicCloudConnectorListResult - The response of a PublicCloudConnector list operation. +type PublicCloudConnectorListResult struct { + // REQUIRED; The PublicCloudConnector items on this page + Value []*PublicCloudConnector - // REQUIRED; The namespace name. - NamespaceName *string + // The link to the next page of items + NextLink *string +} - // REQUIRED; The suffix domain name of relay namespace. - NamespaceNameSuffix *string +// PublicCloudConnectorProperties - Properties of public cloud connectors. +type PublicCloudConnectorProperties struct { + // REQUIRED; Cloud profile for AWS. + AwsCloudProfile *AwsCloudProfile - // The expiration of access key in unix time. - ExpiresOn *int64 + // REQUIRED; Host cloud the public cloud connector. + HostType *HostType - // The token to access the enabled service. - ServiceConfigurationToken *string + // READ-ONLY; Connector primary identifier. + ConnectorPrimaryIdentifier *string - // READ-ONLY; Access key for hybrid connection. - AccessKey *string + // READ-ONLY; The resource provisioning state. + ProvisioningState *ResourceProvisioningState } -// Resource - Common fields that are returned in the response for all Azure Resource Manager resources -type Resource struct { - // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" - ID *string +// SolutionConfiguration - Solution Configuration +type SolutionConfiguration struct { + // The resource-specific properties for this resource. + Properties *SolutionConfigurationProperties - // READ-ONLY; The name of the resource + // READ-ONLY; Represent Solution Configuration Resource. Name *string + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData @@ -251,47 +202,67 @@ type Resource struct { Type *string } -// ServiceConfigurationList - The paginated list of serviceConfigurations -type ServiceConfigurationList struct { - // The link to fetch the next page of connected cluster - NextLink *string +// SolutionConfigurationListResult - The response of a SolutionConfiguration list operation. +type SolutionConfigurationListResult struct { + // REQUIRED; The SolutionConfiguration items on this page + Value []*SolutionConfiguration - // The list of service configuration - Value []*ServiceConfigurationResource + // The link to the next page of items + NextLink *string } -// ServiceConfigurationProperties - Service configuration details -type ServiceConfigurationProperties struct { - // REQUIRED; Name of the service. - ServiceName *ServiceName +// SolutionConfigurationProperties - Solution configuration resource. +type SolutionConfigurationProperties struct { + // REQUIRED; The type of the solution + SolutionType *string - // The port on which service is enabled. - Port *int64 + // Solution settings + SolutionSettings *SolutionSettings - // The resource Id of the connectivity endpoint (optional). - ResourceID *string + // READ-ONLY; The last time resources were inventoried + LastSyncTime *time.Time // READ-ONLY; The resource provisioning state. - ProvisioningState *ProvisioningState + ProvisioningState *ResourceProvisioningState + + // READ-ONLY; The status of solution configurations + Status *SolutionConfigurationStatus + + // READ-ONLY; The detailed message of status details + StatusDetails *string } -// ServiceConfigurationPropertiesPatch - Service configuration details -type ServiceConfigurationPropertiesPatch struct { - // The port on which service is enabled. - Port *int64 +// SolutionSettings - Solution settings +type SolutionSettings struct { + AdditionalProperties map[string]*string } -// ServiceConfigurationResource - The service configuration details associated with the target resource. -type ServiceConfigurationResource struct { - // The service configuration properties. - Properties *ServiceConfigurationProperties +// SolutionTypeProperties - Definition of Solution type resource. +type SolutionTypeProperties struct { + // Short description of solution type. + Description *string - // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" - ID *string + // Array of solution settings and its description. + SolutionSettings []*SolutionTypeSettingsProperties - // READ-ONLY; The name of the resource + // The name of the solution type. + SolutionType *string + + // The locations this solution is supported in. + SupportedAzureRegions []*string +} + +// SolutionTypeResource - Concrete proxy resource types can be created by aliasing this type using a specific property type. +type SolutionTypeResource struct { + // The resource-specific properties for this resource. + Properties *SolutionTypeProperties + + // READ-ONLY; Solution Type resource Name *string + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData @@ -299,10 +270,43 @@ type ServiceConfigurationResource struct { Type *string } -// ServiceConfigurationResourcePatch - The service details under service configuration for the target endpoint resource. -type ServiceConfigurationResourcePatch struct { - // The service configuration properties. - Properties *ServiceConfigurationPropertiesPatch +// SolutionTypeResourceListResult - The response of a SolutionTypeResource list operation. +type SolutionTypeResourceListResult struct { + // REQUIRED; The SolutionTypeResource items on this page + Value []*SolutionTypeResource + + // The link to the next page of items + NextLink *string +} + +// SolutionTypeSettings - The properties of Solution Type +type SolutionTypeSettings struct { + // REQUIRED; The type of the solution + SolutionType *string + + // Solution settings + SolutionSettings *SolutionSettings +} + +// SolutionTypeSettingsProperties - Represent Solution settings properties description array. +type SolutionTypeSettingsProperties struct { + // REQUIRED; Array of allowed values for this solution settings property. + AllowedValues []*string + + // REQUIRED; Default value for this solution settings property. + DefaultValue *string + + // REQUIRED; Description of solution setting property. + Description *string + + // REQUIRED; The UI friendly name of the solution setting property. + DisplayName *string + + // REQUIRED; The name of the solution setting property. + Name *string + + // REQUIRED; Type of the solution setting property, represented as a string. + Type *string } // SystemData - Metadata pertaining to creation and last modification of the resource. diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/models_serde.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/models_serde.go index 90a6217fa5f1..8efd3836ed69 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/models_serde.go +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/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 armhybridconnectivity @@ -15,16 +11,17 @@ import ( "reflect" ) -// MarshalJSON implements the json.Marshaller interface for type AADProfileProperties. -func (a AADProfileProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AwsCloudProfile. +func (a AwsCloudProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "serverId", a.ServerID) - populate(objectMap, "tenantId", a.TenantID) + populate(objectMap, "accountId", a.AccountID) + populate(objectMap, "excludedAccounts", a.ExcludedAccounts) + populate(objectMap, "isOrganizationalAccount", a.IsOrganizationalAccount) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AADProfileProperties. -func (a *AADProfileProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AwsCloudProfile. +func (a *AwsCloudProfile) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -32,151 +29,18 @@ func (a *AADProfileProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "serverId": - err = unpopulate(val, "ServerID", &a.ServerID) - delete(rawMsg, key) - case "tenantId": - err = unpopulate(val, "TenantID", &a.TenantID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type EndpointAccessResource. -func (e EndpointAccessResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "relay", e.Relay) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EndpointAccessResource. -func (e *EndpointAccessResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "relay": - err = unpopulate(val, "Relay", &e.Relay) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type EndpointProperties. -func (e EndpointProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "provisioningState", e.ProvisioningState) - populate(objectMap, "resourceId", e.ResourceID) - populate(objectMap, "type", e.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EndpointProperties. -func (e *EndpointProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &e.ProvisioningState) - delete(rawMsg, key) - case "resourceId": - err = unpopulate(val, "ResourceID", &e.ResourceID) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &e.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type EndpointResource. -func (e EndpointResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", e.ID) - populate(objectMap, "name", e.Name) - populate(objectMap, "properties", e.Properties) - populate(objectMap, "systemData", e.SystemData) - populate(objectMap, "type", e.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EndpointResource. -func (e *EndpointResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &e.ID) + case "accountId": + err = unpopulate(val, "AccountID", &a.AccountID) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &e.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &e.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &e.SystemData) + case "excludedAccounts": + err = unpopulate(val, "ExcludedAccounts", &a.ExcludedAccounts) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &e.Type) + case "isOrganizationalAccount": + err = unpopulate(val, "IsOrganizationalAccount", &a.IsOrganizationalAccount) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type EndpointsList. -func (e EndpointsList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", e.NextLink) - populate(objectMap, "value", e.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EndpointsList. -func (e *EndpointsList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &e.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &e.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil @@ -185,7 +49,7 @@ func (e *EndpointsList) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateAny(objectMap, "info", e.Info) + populate(objectMap, "info", e.Info) populate(objectMap, "type", e.Type) return json.Marshal(objectMap) } @@ -256,43 +120,51 @@ func (e *ErrorDetail) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorResponse. -func (e ErrorResponse) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GenerateAwsTemplateRequest. +func (g GenerateAwsTemplateRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "error", e.Error) + populate(objectMap, "connectorId", g.ConnectorID) + populate(objectMap, "solutionTypes", g.SolutionTypes) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. -func (e *ErrorResponse) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GenerateAwsTemplateRequest. +func (g *GenerateAwsTemplateRequest) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { - case "error": - err = unpopulate(val, "Error", &e.Error) + case "connectorId": + err = unpopulate(val, "ConnectorID", &g.ConnectorID) + delete(rawMsg, key) + case "solutionTypes": + err = unpopulate(val, "SolutionTypes", &g.SolutionTypes) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type IngressGatewayResource. -func (i IngressGatewayResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type InventoryProperties. +func (i InventoryProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "ingress", i.Ingress) - populate(objectMap, "relay", i.Relay) + populate(objectMap, "azureResourceId", i.AzureResourceID) + populate(objectMap, "cloudNativeResourceId", i.CloudNativeResourceID) + populate(objectMap, "cloudNativeType", i.CloudNativeType) + populate(objectMap, "provisioningState", i.ProvisioningState) + populate(objectMap, "status", i.Status) + populate(objectMap, "statusDetails", i.StatusDetails) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type IngressGatewayResource. -func (i *IngressGatewayResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type InventoryProperties. +func (i *InventoryProperties) 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", i, err) @@ -300,11 +172,23 @@ func (i *IngressGatewayResource) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "ingress": - err = unpopulate(val, "Ingress", &i.Ingress) + case "azureResourceId": + err = unpopulate(val, "AzureResourceID", &i.AzureResourceID) + delete(rawMsg, key) + case "cloudNativeResourceId": + err = unpopulate(val, "CloudNativeResourceID", &i.CloudNativeResourceID) + delete(rawMsg, key) + case "cloudNativeType": + err = unpopulate(val, "CloudNativeType", &i.CloudNativeType) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &i.ProvisioningState) delete(rawMsg, key) - case "relay": - err = unpopulate(val, "Relay", &i.Relay) + case "status": + err = unpopulate(val, "Status", &i.Status) + delete(rawMsg, key) + case "statusDetails": + err = unpopulate(val, "StatusDetails", &i.StatusDetails) delete(rawMsg, key) } if err != nil { @@ -314,16 +198,19 @@ func (i *IngressGatewayResource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type IngressProfileProperties. -func (i IngressProfileProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type InventoryResource. +func (i InventoryResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "aadProfile", i.AADProfile) - populate(objectMap, "hostname", i.Hostname) + populate(objectMap, "id", i.ID) + populate(objectMap, "name", i.Name) + populate(objectMap, "properties", i.Properties) + populate(objectMap, "systemData", i.SystemData) + populate(objectMap, "type", i.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type IngressProfileProperties. -func (i *IngressProfileProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type InventoryResource. +func (i *InventoryResource) 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", i, err) @@ -331,11 +218,20 @@ func (i *IngressProfileProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "aadProfile": - err = unpopulate(val, "AADProfile", &i.AADProfile) + case "id": + err = unpopulate(val, "ID", &i.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &i.Properties) delete(rawMsg, key) - case "hostname": - err = unpopulate(val, "Hostname", &i.Hostname) + case "systemData": + err = unpopulate(val, "SystemData", &i.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) delete(rawMsg, key) } if err != nil { @@ -345,374 +241,424 @@ func (i *IngressProfileProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ListCredentialsRequest. -func (l ListCredentialsRequest) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type InventoryResourceListResult. +func (i InventoryResourceListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "serviceName", l.ServiceName) + populate(objectMap, "nextLink", i.NextLink) + populate(objectMap, "value", i.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ListCredentialsRequest. -func (l *ListCredentialsRequest) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type InventoryResourceListResult. +func (i *InventoryResourceListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "serviceName": - err = unpopulate(val, "ServiceName", &l.ServiceName) + case "nextLink": + err = unpopulate(val, "NextLink", &i.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &i.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ListIngressGatewayCredentialsRequest. -func (l ListIngressGatewayCredentialsRequest) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OperationStatusResult. +func (o OperationStatusResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "serviceName", l.ServiceName) + populateDateTimeRFC3339(objectMap, "endTime", o.EndTime) + populate(objectMap, "error", o.Error) + populate(objectMap, "id", o.ID) + populate(objectMap, "name", o.Name) + populate(objectMap, "operations", o.Operations) + populate(objectMap, "percentComplete", o.PercentComplete) + populateDateTimeRFC3339(objectMap, "startTime", o.StartTime) + populate(objectMap, "status", o.Status) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ListIngressGatewayCredentialsRequest. -func (l *ListIngressGatewayCredentialsRequest) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationStatusResult. +func (o *OperationStatusResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { - case "serviceName": - err = unpopulate(val, "ServiceName", &l.ServiceName) + case "endTime": + err = unpopulateDateTimeRFC3339(val, "EndTime", &o.EndTime) + delete(rawMsg, key) + case "error": + err = unpopulate(val, "Error", &o.Error) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &o.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "operations": + err = unpopulate(val, "Operations", &o.Operations) + delete(rawMsg, key) + case "percentComplete": + err = unpopulate(val, "PercentComplete", &o.PercentComplete) + delete(rawMsg, key) + case "startTime": + err = unpopulateDateTimeRFC3339(val, "StartTime", &o.StartTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &o.Status) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ManagedProxyRequest. -func (m ManagedProxyRequest) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PublicCloudConnector. +func (p PublicCloudConnector) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "hostname", m.Hostname) - populate(objectMap, "service", m.Service) - populate(objectMap, "serviceName", m.ServiceName) + populate(objectMap, "id", p.ID) + populate(objectMap, "location", p.Location) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "tags", p.Tags) + populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedProxyRequest. -func (m *ManagedProxyRequest) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PublicCloudConnector. +func (p *PublicCloudConnector) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "hostname": - err = unpopulate(val, "Hostname", &m.Hostname) + case "id": + err = unpopulate(val, "ID", &p.ID) delete(rawMsg, key) - case "service": - err = unpopulate(val, "Service", &m.Service) + case "location": + err = unpopulate(val, "Location", &p.Location) delete(rawMsg, key) - case "serviceName": - err = unpopulate(val, "ServiceName", &m.ServiceName) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &p.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ManagedProxyResource. -func (m ManagedProxyResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PublicCloudConnectorListResult. +func (p PublicCloudConnectorListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "expiresOn", m.ExpiresOn) - populate(objectMap, "proxy", m.Proxy) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedProxyResource. -func (m *ManagedProxyResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PublicCloudConnectorListResult. +func (p *PublicCloudConnectorListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "expiresOn": - err = unpopulate(val, "ExpiresOn", &m.ExpiresOn) + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) delete(rawMsg, key) - case "proxy": - err = unpopulate(val, "Proxy", &m.Proxy) + case "value": + err = unpopulate(val, "Value", &p.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type Operation. -func (o Operation) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PublicCloudConnectorProperties. +func (p PublicCloudConnectorProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "actionType", o.ActionType) - populate(objectMap, "display", o.Display) - populate(objectMap, "isDataAction", o.IsDataAction) - populate(objectMap, "name", o.Name) - populate(objectMap, "origin", o.Origin) + populate(objectMap, "awsCloudProfile", p.AwsCloudProfile) + populate(objectMap, "connectorPrimaryIdentifier", p.ConnectorPrimaryIdentifier) + populate(objectMap, "hostType", p.HostType) + populate(objectMap, "provisioningState", p.ProvisioningState) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. -func (o *Operation) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PublicCloudConnectorProperties. +func (p *PublicCloudConnectorProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "actionType": - err = unpopulate(val, "ActionType", &o.ActionType) + case "awsCloudProfile": + err = unpopulate(val, "AwsCloudProfile", &p.AwsCloudProfile) delete(rawMsg, key) - case "display": - err = unpopulate(val, "Display", &o.Display) + case "connectorPrimaryIdentifier": + err = unpopulate(val, "ConnectorPrimaryIdentifier", &p.ConnectorPrimaryIdentifier) delete(rawMsg, key) - case "isDataAction": - err = unpopulate(val, "IsDataAction", &o.IsDataAction) + case "hostType": + err = unpopulate(val, "HostType", &p.HostType) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &o.Name) - delete(rawMsg, key) - case "origin": - err = unpopulate(val, "Origin", &o.Origin) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. -func (o OperationDisplay) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SolutionConfiguration. +func (s SolutionConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "description", o.Description) - populate(objectMap, "operation", o.Operation) - populate(objectMap, "provider", o.Provider) - populate(objectMap, "resource", o.Resource) + 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 OperationDisplay. -func (o *OperationDisplay) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SolutionConfiguration. +func (s *SolutionConfiguration) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "description": - err = unpopulate(val, "Description", &o.Description) + case "id": + err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) - case "operation": - err = unpopulate(val, "Operation", &o.Operation) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) - case "provider": - err = unpopulate(val, "Provider", &o.Provider) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) delete(rawMsg, key) - case "resource": - err = unpopulate(val, "Resource", &o.Resource) + case "type": + err = unpopulate(val, "Type", &s.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OperationListResult. -func (o OperationListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SolutionConfigurationListResult. +func (s SolutionConfigurationListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", o.NextLink) - populate(objectMap, "value", o.Value) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. -func (o *OperationListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SolutionConfigurationListResult. +func (s *SolutionConfigurationListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + 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", &o.NextLink) + err = unpopulate(val, "NextLink", &s.NextLink) delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &o.Value) + err = unpopulate(val, "Value", &s.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ProxyResource. -func (p ProxyResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SolutionConfigurationProperties. +func (s SolutionConfigurationProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) - populate(objectMap, "systemData", p.SystemData) - populate(objectMap, "type", p.Type) + populateDateTimeRFC3339(objectMap, "lastSyncTime", s.LastSyncTime) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "solutionSettings", s.SolutionSettings) + populate(objectMap, "solutionType", s.SolutionType) + populate(objectMap, "status", s.Status) + populate(objectMap, "statusDetails", s.StatusDetails) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProxyResource. -func (p *ProxyResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SolutionConfigurationProperties. +func (s *SolutionConfigurationProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + 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", &p.ID) + case "lastSyncTime": + err = unpopulateDateTimeRFC3339(val, "LastSyncTime", &s.LastSyncTime) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &p.SystemData) + case "solutionSettings": + err = unpopulate(val, "SolutionSettings", &s.SolutionSettings) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) + case "solutionType": + err = unpopulate(val, "SolutionType", &s.SolutionType) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &s.Status) + delete(rawMsg, key) + case "statusDetails": + err = unpopulate(val, "StatusDetails", &s.StatusDetails) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RelayNamespaceAccessProperties. -func (r RelayNamespaceAccessProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SolutionSettings. +func (s SolutionSettings) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "accessKey", r.AccessKey) - populate(objectMap, "expiresOn", r.ExpiresOn) - populate(objectMap, "hybridConnectionName", r.HybridConnectionName) - populate(objectMap, "namespaceName", r.NamespaceName) - populate(objectMap, "namespaceNameSuffix", r.NamespaceNameSuffix) - populate(objectMap, "serviceConfigurationToken", r.ServiceConfigurationToken) + if s.AdditionalProperties != nil { + for key, val := range s.AdditionalProperties { + objectMap[key] = val + } + } return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RelayNamespaceAccessProperties. -func (r *RelayNamespaceAccessProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SolutionSettings. +func (s *SolutionSettings) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "accessKey": - err = unpopulate(val, "AccessKey", &r.AccessKey) - delete(rawMsg, key) - case "expiresOn": - err = unpopulate(val, "ExpiresOn", &r.ExpiresOn) - delete(rawMsg, key) - case "hybridConnectionName": - err = unpopulate(val, "HybridConnectionName", &r.HybridConnectionName) - delete(rawMsg, key) - case "namespaceName": - err = unpopulate(val, "NamespaceName", &r.NamespaceName) - delete(rawMsg, key) - case "namespaceNameSuffix": - err = unpopulate(val, "NamespaceNameSuffix", &r.NamespaceNameSuffix) - delete(rawMsg, key) - case "serviceConfigurationToken": - err = unpopulate(val, "ServiceConfigurationToken", &r.ServiceConfigurationToken) + default: + if s.AdditionalProperties == nil { + s.AdditionalProperties = map[string]*string{} + } + if val != nil { + var aux string + err = json.Unmarshal(val, &aux) + s.AdditionalProperties[key] = &aux + } delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type Resource. -func (r Resource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SolutionTypeProperties. +func (s SolutionTypeProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", r.ID) - populate(objectMap, "name", r.Name) - populate(objectMap, "systemData", r.SystemData) - populate(objectMap, "type", r.Type) + populate(objectMap, "description", s.Description) + populate(objectMap, "solutionSettings", s.SolutionSettings) + populate(objectMap, "solutionType", s.SolutionType) + populate(objectMap, "supportedAzureRegions", s.SupportedAzureRegions) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Resource. -func (r *Resource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SolutionTypeProperties. +func (s *SolutionTypeProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + 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", &r.ID) + case "description": + err = unpopulate(val, "Description", &s.Description) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) + case "solutionSettings": + err = unpopulate(val, "SolutionSettings", &s.SolutionSettings) delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &r.SystemData) + case "solutionType": + err = unpopulate(val, "SolutionType", &s.SolutionType) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) + case "supportedAzureRegions": + err = unpopulate(val, "SupportedAzureRegions", &s.SupportedAzureRegions) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ServiceConfigurationList. -func (s ServiceConfigurationList) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SolutionTypeResource. +func (s SolutionTypeResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", s.NextLink) - populate(objectMap, "value", s.Value) + 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 ServiceConfigurationList. -func (s *ServiceConfigurationList) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SolutionTypeResource. +func (s *SolutionTypeResource) 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) @@ -720,11 +666,20 @@ func (s *ServiceConfigurationList) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &s.NextLink) + case "id": + err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &s.Value) + 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 { @@ -734,18 +689,16 @@ func (s *ServiceConfigurationList) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ServiceConfigurationProperties. -func (s ServiceConfigurationProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SolutionTypeResourceListResult. +func (s SolutionTypeResourceListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "port", s.Port) - populate(objectMap, "provisioningState", s.ProvisioningState) - populate(objectMap, "resourceId", s.ResourceID) - populate(objectMap, "serviceName", s.ServiceName) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceConfigurationProperties. -func (s *ServiceConfigurationProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SolutionTypeResourceListResult. +func (s *SolutionTypeResourceListResult) 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) @@ -753,17 +706,11 @@ func (s *ServiceConfigurationProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "port": - err = unpopulate(val, "Port", &s.Port) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) - delete(rawMsg, key) - case "resourceId": - err = unpopulate(val, "ResourceID", &s.ResourceID) + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) delete(rawMsg, key) - case "serviceName": - err = unpopulate(val, "ServiceName", &s.ServiceName) + case "value": + err = unpopulate(val, "Value", &s.Value) delete(rawMsg, key) } if err != nil { @@ -773,15 +720,16 @@ func (s *ServiceConfigurationProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ServiceConfigurationPropertiesPatch. -func (s ServiceConfigurationPropertiesPatch) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SolutionTypeSettings. +func (s SolutionTypeSettings) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "port", s.Port) + populate(objectMap, "solutionSettings", s.SolutionSettings) + populate(objectMap, "solutionType", s.SolutionType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceConfigurationPropertiesPatch. -func (s *ServiceConfigurationPropertiesPatch) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SolutionTypeSettings. +func (s *SolutionTypeSettings) 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) @@ -789,8 +737,11 @@ func (s *ServiceConfigurationPropertiesPatch) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "port": - err = unpopulate(val, "Port", &s.Port) + case "solutionSettings": + err = unpopulate(val, "SolutionSettings", &s.SolutionSettings) + delete(rawMsg, key) + case "solutionType": + err = unpopulate(val, "SolutionType", &s.SolutionType) delete(rawMsg, key) } if err != nil { @@ -800,19 +751,20 @@ func (s *ServiceConfigurationPropertiesPatch) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ServiceConfigurationResource. -func (s ServiceConfigurationResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SolutionTypeSettingsProperties. +func (s SolutionTypeSettingsProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", s.ID) + populate(objectMap, "allowedValues", s.AllowedValues) + populate(objectMap, "defaultValue", s.DefaultValue) + populate(objectMap, "description", s.Description) + populate(objectMap, "displayName", s.DisplayName) 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 ServiceConfigurationResource. -func (s *ServiceConfigurationResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SolutionTypeSettingsProperties. +func (s *SolutionTypeSettingsProperties) 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) @@ -820,17 +772,20 @@ func (s *ServiceConfigurationResource) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &s.ID) + case "allowedValues": + err = unpopulate(val, "AllowedValues", &s.AllowedValues) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) + case "defaultValue": + err = unpopulate(val, "DefaultValue", &s.DefaultValue) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &s.Properties) + case "description": + err = unpopulate(val, "Description", &s.Description) delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &s.SystemData) + case "displayName": + err = unpopulate(val, "DisplayName", &s.DisplayName) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &s.Type) @@ -843,33 +798,6 @@ func (s *ServiceConfigurationResource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ServiceConfigurationResourcePatch. -func (s ServiceConfigurationResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "properties", s.Properties) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceConfigurationResourcePatch. -func (s *ServiceConfigurationResourcePatch) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "properties": - err = unpopulate(val, "Properties", &s.Properties) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type SystemData. func (s SystemData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -927,18 +855,8 @@ func populate(m map[string]any, k string, v any) { } } -func populateAny(m map[string]any, k string, v any) { - if v == nil { - return - } else if azcore.IsNullValue(v) { - m[k] = nil - } else { - m[k] = v - } -} - func unpopulate(data json.RawMessage, fn string, v any) error { - if data == nil { + if data == nil || string(data) == "null" { return nil } if err := json.Unmarshal(data, v); err != nil { diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/operations_client_example_test.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/operations_client_example_test.go deleted file mode 100644 index c6b38498e358..000000000000 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/operations_client_example_test.go +++ /dev/null @@ -1,126 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armhybridconnectivity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/examples/OperationsList.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 := armhybridconnectivity.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOperationsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OperationListResult = armhybridconnectivity.OperationListResult{ - // Value: []*armhybridconnectivity.Operation{ - // { - // Name: to.Ptr("Microsoft.HybridConnectivity/operations/read"), - // Display: &armhybridconnectivity.OperationDisplay{ - // Description: to.Ptr("Get the list of Operations"), - // Operation: to.Ptr("Get operations"), - // Provider: to.Ptr("Microsoft.HybridConnectivity"), - // Resource: to.Ptr("Operations"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.HybridConnectivity/endpoints/read"), - // Display: &armhybridconnectivity.OperationDisplay{ - // Description: to.Ptr("Get or list of endpoints to the target resource."), - // Operation: to.Ptr("Get/List endpoints"), - // Provider: to.Ptr("Microsoft.HybridConnectivity"), - // Resource: to.Ptr("endpoints"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.HybridConnectivity/endpoints/write"), - // Display: &armhybridconnectivity.OperationDisplay{ - // Description: to.Ptr("Create or update the endpoint to the target resource."), - // Operation: to.Ptr("Create/Update endpoint"), - // Provider: to.Ptr("Microsoft.HybridConnectivity"), - // Resource: to.Ptr("endpoints"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.HybridConnectivity/endpoints/delete"), - // Display: &armhybridconnectivity.OperationDisplay{ - // Description: to.Ptr("Deletes the endpoint access to the target resource."), - // Operation: to.Ptr("Delete endpoint"), - // Provider: to.Ptr("Microsoft.HybridConnectivity"), - // Resource: to.Ptr("endpoints"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.HybridConnectivity/endpoints/listCredentials/action"), - // Display: &armhybridconnectivity.OperationDisplay{ - // Description: to.Ptr("List the endpoint access credentials to the resource."), - // Operation: to.Ptr("List credentials for endpoint access"), - // Provider: to.Ptr("Microsoft.HybridConnectivity"), - // Resource: to.Ptr("endpoints"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.HybridConnectivity/endpoints/listIngressGatewayCredentials/action"), - // Display: &armhybridconnectivity.OperationDisplay{ - // Description: to.Ptr("List the ingress gateway credentials to the resource."), - // Operation: to.Ptr("List credentials for ingress gateway"), - // Provider: to.Ptr("Microsoft.HybridConnectivity"), - // Resource: to.Ptr("endpoints"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.HybridConnectivity/register/action"), - // Display: &armhybridconnectivity.OperationDisplay{ - // Description: to.Ptr("Register the subscription for Microsoft.HybridConnectivity"), - // Operation: to.Ptr("Register the Microsoft.HybridConnectivity"), - // Provider: to.Ptr("Microsoft.HybridConnectivity"), - // Resource: to.Ptr("Microsoft.HybridConnectivity"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.HybridConnectivity/unregister/action"), - // Display: &armhybridconnectivity.OperationDisplay{ - // Description: to.Ptr("Unregister the subscription for Microsoft.HybridConnectivity"), - // Operation: to.Ptr("Unregister the Microsoft.HybridConnectivity"), - // Provider: to.Ptr("Microsoft.HybridConnectivity"), - // Resource: to.Ptr("Microsoft.HybridConnectivity"), - // }, - // IsDataAction: to.Ptr(false), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/options.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/options.go index 9ea1b3fdaa4a..0f314024cec9 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/options.go +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/options.go @@ -1,91 +1,115 @@ -//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 armhybridconnectivity -// EndpointsClientCreateOrUpdateOptions contains the optional parameters for the EndpointsClient.CreateOrUpdate method. -type EndpointsClientCreateOrUpdateOptions struct { +// GenerateAwsTemplateClientPostOptions contains the optional parameters for the GenerateAwsTemplateClient.Post method. +type GenerateAwsTemplateClientPostOptions struct { // placeholder for future optional parameters } -// EndpointsClientDeleteOptions contains the optional parameters for the EndpointsClient.Delete method. -type EndpointsClientDeleteOptions struct { +// InventoryClientGetOptions contains the optional parameters for the InventoryClient.Get method. +type InventoryClientGetOptions struct { // placeholder for future optional parameters } -// EndpointsClientGetOptions contains the optional parameters for the EndpointsClient.Get method. -type EndpointsClientGetOptions struct { +// InventoryClientListBySolutionConfigurationOptions contains the optional parameters for the InventoryClient.NewListBySolutionConfigurationPager +// method. +type InventoryClientListBySolutionConfigurationOptions struct { // placeholder for future optional parameters } -// EndpointsClientListCredentialsOptions contains the optional parameters for the EndpointsClient.ListCredentials method. -type EndpointsClientListCredentialsOptions struct { - // The is how long the endpoint access token is valid (in seconds). - Expiresin *int64 - - // Object of type ListCredentialsRequest - ListCredentialsRequest *ListCredentialsRequest +// PublicCloudConnectorsClientBeginCreateOrUpdateOptions contains the optional parameters for the PublicCloudConnectorsClient.BeginCreateOrUpdate +// method. +type PublicCloudConnectorsClientBeginCreateOrUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string } -// EndpointsClientListIngressGatewayCredentialsOptions contains the optional parameters for the EndpointsClient.ListIngressGatewayCredentials +// PublicCloudConnectorsClientBeginTestPermissionsOptions contains the optional parameters for the PublicCloudConnectorsClient.BeginTestPermissions // method. -type EndpointsClientListIngressGatewayCredentialsOptions struct { - // The is how long the endpoint access token is valid (in seconds). - Expiresin *int64 +type PublicCloudConnectorsClientBeginTestPermissionsOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// PublicCloudConnectorsClientDeleteOptions contains the optional parameters for the PublicCloudConnectorsClient.Delete method. +type PublicCloudConnectorsClientDeleteOptions struct { + // placeholder for future optional parameters +} - // Object of type ListIngressGatewayCredentialsRequest - ListIngressGatewayCredentialsRequest *ListIngressGatewayCredentialsRequest +// PublicCloudConnectorsClientGetOptions contains the optional parameters for the PublicCloudConnectorsClient.Get method. +type PublicCloudConnectorsClientGetOptions struct { + // placeholder for future optional parameters } -// EndpointsClientListManagedProxyDetailsOptions contains the optional parameters for the EndpointsClient.ListManagedProxyDetails +// PublicCloudConnectorsClientListByResourceGroupOptions contains the optional parameters for the PublicCloudConnectorsClient.NewListByResourceGroupPager // method. -type EndpointsClientListManagedProxyDetailsOptions struct { +type PublicCloudConnectorsClientListByResourceGroupOptions struct { // placeholder for future optional parameters } -// EndpointsClientListOptions contains the optional parameters for the EndpointsClient.NewListPager method. -type EndpointsClientListOptions struct { +// PublicCloudConnectorsClientListBySubscriptionOptions contains the optional parameters for the PublicCloudConnectorsClient.NewListBySubscriptionPager +// method. +type PublicCloudConnectorsClientListBySubscriptionOptions struct { // placeholder for future optional parameters } -// EndpointsClientUpdateOptions contains the optional parameters for the EndpointsClient.Update method. -type EndpointsClientUpdateOptions struct { +// PublicCloudConnectorsClientUpdateOptions contains the optional parameters for the PublicCloudConnectorsClient.Update method. +type PublicCloudConnectorsClientUpdateOptions struct { // placeholder for future optional parameters } -// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. -type OperationsClientListOptions struct { +// SolutionConfigurationsClientBeginSyncNowOptions contains the optional parameters for the SolutionConfigurationsClient.BeginSyncNow +// method. +type SolutionConfigurationsClientBeginSyncNowOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// SolutionConfigurationsClientCreateOrUpdateOptions contains the optional parameters for the SolutionConfigurationsClient.CreateOrUpdate +// method. +type SolutionConfigurationsClientCreateOrUpdateOptions struct { // placeholder for future optional parameters } -// ServiceConfigurationsClientCreateOrupdateOptions contains the optional parameters for the ServiceConfigurationsClient.CreateOrupdate +// SolutionConfigurationsClientDeleteOptions contains the optional parameters for the SolutionConfigurationsClient.Delete // method. -type ServiceConfigurationsClientCreateOrupdateOptions struct { +type SolutionConfigurationsClientDeleteOptions struct { // placeholder for future optional parameters } -// ServiceConfigurationsClientDeleteOptions contains the optional parameters for the ServiceConfigurationsClient.Delete method. -type ServiceConfigurationsClientDeleteOptions struct { +// SolutionConfigurationsClientGetOptions contains the optional parameters for the SolutionConfigurationsClient.Get method. +type SolutionConfigurationsClientGetOptions struct { // placeholder for future optional parameters } -// ServiceConfigurationsClientGetOptions contains the optional parameters for the ServiceConfigurationsClient.Get method. -type ServiceConfigurationsClientGetOptions struct { +// SolutionConfigurationsClientListOptions contains the optional parameters for the SolutionConfigurationsClient.NewListPager +// method. +type SolutionConfigurationsClientListOptions struct { // placeholder for future optional parameters } -// ServiceConfigurationsClientListByEndpointResourceOptions contains the optional parameters for the ServiceConfigurationsClient.NewListByEndpointResourcePager +// SolutionConfigurationsClientUpdateOptions contains the optional parameters for the SolutionConfigurationsClient.Update // method. -type ServiceConfigurationsClientListByEndpointResourceOptions struct { +type SolutionConfigurationsClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// SolutionTypesClientGetOptions contains the optional parameters for the SolutionTypesClient.Get method. +type SolutionTypesClientGetOptions struct { // placeholder for future optional parameters } -// ServiceConfigurationsClientUpdateOptions contains the optional parameters for the ServiceConfigurationsClient.Update method. -type ServiceConfigurationsClientUpdateOptions struct { +// SolutionTypesClientListByResourceGroupOptions contains the optional parameters for the SolutionTypesClient.NewListByResourceGroupPager +// method. +type SolutionTypesClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// SolutionTypesClientListBySubscriptionOptions contains the optional parameters for the SolutionTypesClient.NewListBySubscriptionPager +// method. +type SolutionTypesClientListBySubscriptionOptions struct { // placeholder for future optional parameters } diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/publiccloudconnectors_client.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/publiccloudconnectors_client.go new file mode 100644 index 000000000000..28eb57d5d6ce --- /dev/null +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/publiccloudconnectors_client.go @@ -0,0 +1,502 @@ +// 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 armhybridconnectivity + +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" +) + +// PublicCloudConnectorsClient contains the methods for the PublicCloudConnectors group. +// Don't use this type directly, use NewPublicCloudConnectorsClient() instead. +type PublicCloudConnectorsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewPublicCloudConnectorsClient creates a new instance of PublicCloudConnectorsClient 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 NewPublicCloudConnectorsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PublicCloudConnectorsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &PublicCloudConnectorsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create a PublicCloudConnector +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-12-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - publicCloudConnector - Represent public cloud connectors resource. +// - resource - Resource create parameters. +// - options - PublicCloudConnectorsClientBeginCreateOrUpdateOptions contains the optional parameters for the PublicCloudConnectorsClient.BeginCreateOrUpdate +// method. +func (client *PublicCloudConnectorsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, publicCloudConnector string, resource PublicCloudConnector, options *PublicCloudConnectorsClientBeginCreateOrUpdateOptions) (*runtime.Poller[PublicCloudConnectorsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, publicCloudConnector, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PublicCloudConnectorsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PublicCloudConnectorsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create a PublicCloudConnector +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-12-01 +func (client *PublicCloudConnectorsClient) createOrUpdate(ctx context.Context, resourceGroupName string, publicCloudConnector string, resource PublicCloudConnector, options *PublicCloudConnectorsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "PublicCloudConnectorsClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, publicCloudConnector, resource, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *PublicCloudConnectorsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, publicCloudConnector string, resource PublicCloudConnector, _ *PublicCloudConnectorsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/publicCloudConnectors/{publicCloudConnector}" + 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 publicCloudConnector == "" { + return nil, errors.New("parameter publicCloudConnector cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{publicCloudConnector}", url.PathEscape(publicCloudConnector)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-12-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 + } + return req, nil +} + +// Delete - Delete a PublicCloudConnector +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-12-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - publicCloudConnector - Represent public cloud connectors resource. +// - options - PublicCloudConnectorsClientDeleteOptions contains the optional parameters for the PublicCloudConnectorsClient.Delete +// method. +func (client *PublicCloudConnectorsClient) Delete(ctx context.Context, resourceGroupName string, publicCloudConnector string, options *PublicCloudConnectorsClientDeleteOptions) (PublicCloudConnectorsClientDeleteResponse, error) { + var err error + const operationName = "PublicCloudConnectorsClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, publicCloudConnector, options) + if err != nil { + return PublicCloudConnectorsClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PublicCloudConnectorsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return PublicCloudConnectorsClientDeleteResponse{}, err + } + return PublicCloudConnectorsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *PublicCloudConnectorsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, publicCloudConnector string, _ *PublicCloudConnectorsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/publicCloudConnectors/{publicCloudConnector}" + 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 publicCloudConnector == "" { + return nil, errors.New("parameter publicCloudConnector cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{publicCloudConnector}", url.PathEscape(publicCloudConnector)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-12-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a PublicCloudConnector +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-12-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - publicCloudConnector - Represent public cloud connectors resource. +// - options - PublicCloudConnectorsClientGetOptions contains the optional parameters for the PublicCloudConnectorsClient.Get +// method. +func (client *PublicCloudConnectorsClient) Get(ctx context.Context, resourceGroupName string, publicCloudConnector string, options *PublicCloudConnectorsClientGetOptions) (PublicCloudConnectorsClientGetResponse, error) { + var err error + const operationName = "PublicCloudConnectorsClient.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, publicCloudConnector, options) + if err != nil { + return PublicCloudConnectorsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PublicCloudConnectorsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PublicCloudConnectorsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *PublicCloudConnectorsClient) getCreateRequest(ctx context.Context, resourceGroupName string, publicCloudConnector string, _ *PublicCloudConnectorsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/publicCloudConnectors/{publicCloudConnector}" + 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 publicCloudConnector == "" { + return nil, errors.New("parameter publicCloudConnector cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{publicCloudConnector}", url.PathEscape(publicCloudConnector)) + 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-12-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PublicCloudConnectorsClient) getHandleResponse(resp *http.Response) (PublicCloudConnectorsClientGetResponse, error) { + result := PublicCloudConnectorsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PublicCloudConnector); err != nil { + return PublicCloudConnectorsClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - List PublicCloudConnector resources by resource group +// +// Generated from API version 2024-12-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - PublicCloudConnectorsClientListByResourceGroupOptions contains the optional parameters for the PublicCloudConnectorsClient.NewListByResourceGroupPager +// method. +func (client *PublicCloudConnectorsClient) NewListByResourceGroupPager(resourceGroupName string, options *PublicCloudConnectorsClientListByResourceGroupOptions) *runtime.Pager[PublicCloudConnectorsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[PublicCloudConnectorsClientListByResourceGroupResponse]{ + More: func(page PublicCloudConnectorsClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PublicCloudConnectorsClientListByResourceGroupResponse) (PublicCloudConnectorsClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PublicCloudConnectorsClient.NewListByResourceGroupPager") + 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.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return PublicCloudConnectorsClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *PublicCloudConnectorsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *PublicCloudConnectorsClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/publicCloudConnectors" + 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)) + 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-12-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *PublicCloudConnectorsClient) listByResourceGroupHandleResponse(resp *http.Response) (PublicCloudConnectorsClientListByResourceGroupResponse, error) { + result := PublicCloudConnectorsClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PublicCloudConnectorListResult); err != nil { + return PublicCloudConnectorsClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - List PublicCloudConnector resources by subscription ID +// +// Generated from API version 2024-12-01 +// - options - PublicCloudConnectorsClientListBySubscriptionOptions contains the optional parameters for the PublicCloudConnectorsClient.NewListBySubscriptionPager +// method. +func (client *PublicCloudConnectorsClient) NewListBySubscriptionPager(options *PublicCloudConnectorsClientListBySubscriptionOptions) *runtime.Pager[PublicCloudConnectorsClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[PublicCloudConnectorsClientListBySubscriptionResponse]{ + More: func(page PublicCloudConnectorsClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PublicCloudConnectorsClientListBySubscriptionResponse) (PublicCloudConnectorsClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PublicCloudConnectorsClient.NewListBySubscriptionPager") + 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.listBySubscriptionCreateRequest(ctx, options) + }, nil) + if err != nil { + return PublicCloudConnectorsClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *PublicCloudConnectorsClient) listBySubscriptionCreateRequest(ctx context.Context, _ *PublicCloudConnectorsClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.HybridConnectivity/publicCloudConnectors" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + 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-12-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *PublicCloudConnectorsClient) listBySubscriptionHandleResponse(resp *http.Response) (PublicCloudConnectorsClientListBySubscriptionResponse, error) { + result := PublicCloudConnectorsClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PublicCloudConnectorListResult); err != nil { + return PublicCloudConnectorsClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// BeginTestPermissions - A long-running resource action. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-12-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - publicCloudConnector - Represent public cloud connectors resource. +// - options - PublicCloudConnectorsClientBeginTestPermissionsOptions contains the optional parameters for the PublicCloudConnectorsClient.BeginTestPermissions +// method. +func (client *PublicCloudConnectorsClient) BeginTestPermissions(ctx context.Context, resourceGroupName string, publicCloudConnector string, options *PublicCloudConnectorsClientBeginTestPermissionsOptions) (*runtime.Poller[PublicCloudConnectorsClientTestPermissionsResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.testPermissions(ctx, resourceGroupName, publicCloudConnector, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PublicCloudConnectorsClientTestPermissionsResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PublicCloudConnectorsClientTestPermissionsResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// TestPermissions - A long-running resource action. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-12-01 +func (client *PublicCloudConnectorsClient) testPermissions(ctx context.Context, resourceGroupName string, publicCloudConnector string, options *PublicCloudConnectorsClientBeginTestPermissionsOptions) (*http.Response, error) { + var err error + const operationName = "PublicCloudConnectorsClient.BeginTestPermissions" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.testPermissionsCreateRequest(ctx, resourceGroupName, publicCloudConnector, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// testPermissionsCreateRequest creates the TestPermissions request. +func (client *PublicCloudConnectorsClient) testPermissionsCreateRequest(ctx context.Context, resourceGroupName string, publicCloudConnector string, _ *PublicCloudConnectorsClientBeginTestPermissionsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/publicCloudConnectors/{publicCloudConnector}/testPermissions" + 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 publicCloudConnector == "" { + return nil, errors.New("parameter publicCloudConnector cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{publicCloudConnector}", url.PathEscape(publicCloudConnector)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-12-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Update - Update a PublicCloudConnector +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-12-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - publicCloudConnector - Represent public cloud connectors resource. +// - properties - The resource properties to be updated. +// - options - PublicCloudConnectorsClientUpdateOptions contains the optional parameters for the PublicCloudConnectorsClient.Update +// method. +func (client *PublicCloudConnectorsClient) Update(ctx context.Context, resourceGroupName string, publicCloudConnector string, properties PublicCloudConnector, options *PublicCloudConnectorsClientUpdateOptions) (PublicCloudConnectorsClientUpdateResponse, error) { + var err error + const operationName = "PublicCloudConnectorsClient.Update" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, publicCloudConnector, properties, options) + if err != nil { + return PublicCloudConnectorsClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PublicCloudConnectorsClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PublicCloudConnectorsClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *PublicCloudConnectorsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, publicCloudConnector string, properties PublicCloudConnector, _ *PublicCloudConnectorsClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/publicCloudConnectors/{publicCloudConnector}" + 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 publicCloudConnector == "" { + return nil, errors.New("parameter publicCloudConnector cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{publicCloudConnector}", url.PathEscape(publicCloudConnector)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-12-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 + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *PublicCloudConnectorsClient) updateHandleResponse(resp *http.Response) (PublicCloudConnectorsClientUpdateResponse, error) { + result := PublicCloudConnectorsClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PublicCloudConnector); err != nil { + return PublicCloudConnectorsClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/publiccloudconnectors_client_example_test.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/publiccloudconnectors_client_example_test.go new file mode 100644 index 000000000000..a820f6cb942c --- /dev/null +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/publiccloudconnectors_client_example_test.go @@ -0,0 +1,405 @@ +// 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 armhybridconnectivity_test + +import ( + "context" + "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/hybridconnectivity/armhybridconnectivity/v2" + "log" +) + +// Generated from example definition: 2024-12-01/PublicCloudConnectors_CreateOrUpdate.json +func ExamplePublicCloudConnectorsClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhybridconnectivity.NewClientFactory("5ACC4579-DB34-4C2F-8F8C-25061168F342", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewPublicCloudConnectorsClient().BeginCreateOrUpdate(ctx, "rgpublicCloud", "advjwoakdusalamomg", armhybridconnectivity.PublicCloudConnector{ + Properties: &armhybridconnectivity.PublicCloudConnectorProperties{ + AwsCloudProfile: &armhybridconnectivity.AwsCloudProfile{ + AccountID: to.Ptr("snbnuxckevyqpm"), + ExcludedAccounts: []*string{ + to.Ptr("rwgqpukglvbqmogqcliqolucp"), + }, + IsOrganizationalAccount: to.Ptr(true), + }, + HostType: to.Ptr(armhybridconnectivity.HostTypeAWS), + }, + Tags: map[string]*string{}, + Location: to.Ptr("jpiglusfxynfcewcjwvvnn"), + }, 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 = armhybridconnectivity.PublicCloudConnectorsClientCreateOrUpdateResponse{ + // PublicCloudConnector: &armhybridconnectivity.PublicCloudConnector{ + // Properties: &armhybridconnectivity.PublicCloudConnectorProperties{ + // AwsCloudProfile: &armhybridconnectivity.AwsCloudProfile{ + // AccountID: to.Ptr("snbnuxckevyqpm"), + // ExcludedAccounts: []*string{ + // to.Ptr("rwgqpukglvbqmogqcliqolucp"), + // }, + // IsOrganizationalAccount: to.Ptr(true), + // }, + // HostType: to.Ptr(armhybridconnectivity.HostTypeAWS), + // ProvisioningState: to.Ptr(armhybridconnectivity.ResourceProvisioningStateSucceeded), + // ConnectorPrimaryIdentifier: to.Ptr("20a4e2be-8158-4b9e-b512-7a1af6f827de"), + // }, + // Tags: map[string]*string{ + // }, + // Location: to.Ptr("jpiglusfxynfcewcjwvvnn"), + // ID: to.Ptr("/subscriptions/5ACC4579-DB34-4C2F-8F8C-25061168F342/providers/Microsoft.HybridConnectivity/PublicCloudConnectors/esixipkbydb"), + // Name: to.Ptr("esixipkbydb"), + // Type: to.Ptr("eelsjvqvkdxdncptsobrswhulnm"), + // SystemData: &armhybridconnectivity.SystemData{ + // CreatedBy: to.Ptr("rpxzkcrobprrdvuoqxz"), + // CreatedByType: to.Ptr(armhybridconnectivity.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-18T22:52:07.890Z"); return t}()), + // LastModifiedBy: to.Ptr("jidegyskxi"), + // LastModifiedByType: to.Ptr(armhybridconnectivity.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-18T22:52:07.890Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2024-12-01/PublicCloudConnectors_Delete.json +func ExamplePublicCloudConnectorsClient_Delete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhybridconnectivity.NewClientFactory("5ACC4579-DB34-4C2F-8F8C-25061168F342", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewPublicCloudConnectorsClient().Delete(ctx, "rgpublicCloud", "skcfyjvflkhibdywjay", 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 = armhybridconnectivity.PublicCloudConnectorsClientDeleteResponse{ + // } +} + +// Generated from example definition: 2024-12-01/PublicCloudConnectors_Get.json +func ExamplePublicCloudConnectorsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhybridconnectivity.NewClientFactory("5ACC4579-DB34-4C2F-8F8C-25061168F342", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewPublicCloudConnectorsClient().Get(ctx, "rgpublicCloud", "rzygvnpsnrdylwzdbsscjazvamyxmh", 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 = armhybridconnectivity.PublicCloudConnectorsClientGetResponse{ + // PublicCloudConnector: &armhybridconnectivity.PublicCloudConnector{ + // Properties: &armhybridconnectivity.PublicCloudConnectorProperties{ + // AwsCloudProfile: &armhybridconnectivity.AwsCloudProfile{ + // AccountID: to.Ptr("snbnuxckevyqpm"), + // ExcludedAccounts: []*string{ + // to.Ptr("rwgqpukglvbqmogqcliqolucp"), + // }, + // IsOrganizationalAccount: to.Ptr(true), + // }, + // HostType: to.Ptr(armhybridconnectivity.HostTypeAWS), + // ProvisioningState: to.Ptr(armhybridconnectivity.ResourceProvisioningStateSucceeded), + // ConnectorPrimaryIdentifier: to.Ptr("20a4e2be-8158-4b9e-b512-7a1af6f827de"), + // }, + // Tags: map[string]*string{ + // }, + // Location: to.Ptr("jpiglusfxynfcewcjwvvnn"), + // ID: to.Ptr("/subscriptions/5ACC4579-DB34-4C2F-8F8C-25061168F342/providers/Microsoft.HybridConnectivity/PublicCloudConnectors/esixipkbydb"), + // Name: to.Ptr("esixipkbydb"), + // Type: to.Ptr("eelsjvqvkdxdncptsobrswhulnm"), + // SystemData: &armhybridconnectivity.SystemData{ + // CreatedBy: to.Ptr("rpxzkcrobprrdvuoqxz"), + // CreatedByType: to.Ptr(armhybridconnectivity.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-18T22:52:07.890Z"); return t}()), + // LastModifiedBy: to.Ptr("jidegyskxi"), + // LastModifiedByType: to.Ptr(armhybridconnectivity.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-18T22:52:07.890Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2024-12-01/PublicCloudConnectors_ListByResourceGroup.json +func ExamplePublicCloudConnectorsClient_NewListByResourceGroupPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhybridconnectivity.NewClientFactory("5ACC4579-DB34-4C2F-8F8C-25061168F342", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewPublicCloudConnectorsClient().NewListByResourceGroupPager("rgpublicCloud", 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 = armhybridconnectivity.PublicCloudConnectorsClientListByResourceGroupResponse{ + // PublicCloudConnectorListResult: armhybridconnectivity.PublicCloudConnectorListResult{ + // Value: []*armhybridconnectivity.PublicCloudConnector{ + // { + // Properties: &armhybridconnectivity.PublicCloudConnectorProperties{ + // AwsCloudProfile: &armhybridconnectivity.AwsCloudProfile{ + // ExcludedAccounts: []*string{ + // to.Ptr("rwgqpukglvbqmogqcliqolucp"), + // }, + // AccountID: to.Ptr("troiiavknxmcpczvxwjhrdue"), + // IsOrganizationalAccount: to.Ptr(true), + // }, + // HostType: to.Ptr(armhybridconnectivity.HostTypeAWS), + // ProvisioningState: to.Ptr(armhybridconnectivity.ResourceProvisioningStateSucceeded), + // ConnectorPrimaryIdentifier: to.Ptr("20a4e2be-8158-4b9e-b512-7a1af6f827de"), + // }, + // Tags: map[string]*string{ + // }, + // Location: to.Ptr("jpiglusfxynfcewcjwvvnn"), + // ID: to.Ptr("/subscriptions/5ACC4579-DB34-4C2F-8F8C-25061168F342/providers/Microsoft.HybridConnectivity/PublicCloudConnectors/esixipkbydb"), + // Name: to.Ptr("esixipkbydb"), + // Type: to.Ptr("eelsjvqvkdxdncptsobrswhulnm"), + // SystemData: &armhybridconnectivity.SystemData{ + // CreatedBy: to.Ptr("rpxzkcrobprrdvuoqxz"), + // CreatedByType: to.Ptr(armhybridconnectivity.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-18T22:52:07.890Z"); return t}()), + // LastModifiedBy: to.Ptr("jidegyskxi"), + // LastModifiedByType: to.Ptr(armhybridconnectivity.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-18T22:52:07.890Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} + +// Generated from example definition: 2024-12-01/PublicCloudConnectors_ListBySubscription.json +func ExamplePublicCloudConnectorsClient_NewListBySubscriptionPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhybridconnectivity.NewClientFactory("5ACC4579-DB34-4C2F-8F8C-25061168F342", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewPublicCloudConnectorsClient().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 = armhybridconnectivity.PublicCloudConnectorsClientListBySubscriptionResponse{ + // PublicCloudConnectorListResult: armhybridconnectivity.PublicCloudConnectorListResult{ + // Value: []*armhybridconnectivity.PublicCloudConnector{ + // { + // Properties: &armhybridconnectivity.PublicCloudConnectorProperties{ + // AwsCloudProfile: &armhybridconnectivity.AwsCloudProfile{ + // ExcludedAccounts: []*string{ + // to.Ptr("rwgqpukglvbqmogqcliqolucp"), + // }, + // AccountID: to.Ptr("troiiavknxmcpczvxwjhrdue"), + // IsOrganizationalAccount: to.Ptr(true), + // }, + // HostType: to.Ptr(armhybridconnectivity.HostTypeAWS), + // ProvisioningState: to.Ptr(armhybridconnectivity.ResourceProvisioningStateSucceeded), + // ConnectorPrimaryIdentifier: to.Ptr("20a4e2be-8158-4b9e-b512-7a1af6f827de"), + // }, + // Tags: map[string]*string{ + // }, + // Location: to.Ptr("jpiglusfxynfcewcjwvvnn"), + // ID: to.Ptr("/subscriptions/5ACC4579-DB34-4C2F-8F8C-25061168F342/providers/Microsoft.HybridConnectivity/PublicCloudConnectors/esixipkbydb"), + // Name: to.Ptr("esixipkbydb"), + // Type: to.Ptr("eelsjvqvkdxdncptsobrswhulnm"), + // SystemData: &armhybridconnectivity.SystemData{ + // CreatedBy: to.Ptr("rpxzkcrobprrdvuoqxz"), + // CreatedByType: to.Ptr(armhybridconnectivity.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-18T22:52:07.890Z"); return t}()), + // LastModifiedBy: to.Ptr("jidegyskxi"), + // LastModifiedByType: to.Ptr(armhybridconnectivity.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-18T22:52:07.890Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} + +// Generated from example definition: 2024-12-01/PublicCloudConnectors_TestPermissions.json +func ExamplePublicCloudConnectorsClient_BeginTestPermissions() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhybridconnectivity.NewClientFactory("5ACC4579-DB34-4C2F-8F8C-25061168F342", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewPublicCloudConnectorsClient().BeginTestPermissions(ctx, "rgpublicCloud", "rzygvnpsnrdylwzdbsscjazvamyxmh", 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 = armhybridconnectivity.PublicCloudConnectorsClientTestPermissionsResponse{ + // OperationStatusResult: &armhybridconnectivity.OperationStatusResult{ + // ID: to.Ptr("/subscriptions/5ACC4579-DB34-4C2F-8F8C-25061168F342/providers/Microsoft.HybridConnectivity/PublicCloudConnectors/esixipkbydb"), + // Name: to.Ptr("ppeygvsnaspxmpwalpmkqva"), + // Status: to.Ptr("toyjllkvm"), + // PercentComplete: to.Ptr[float64](81), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-10-02T18:38:19.143Z"); return t}()), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-10-02T18:38:19.143Z"); return t}()), + // Operations: []*armhybridconnectivity.OperationStatusResult{ + // { + // ID: to.Ptr("/subscriptions/5ACC4579-DB34-4C2F-8F8C-25061168F342/providers/Microsoft.HybridConnectivity/PublicCloudConnectors/esixipkbydb"), + // Name: to.Ptr("svqtraeuwvyvblujlvqilypwpdrt"), + // Status: to.Ptr("bevmrejij"), + // PercentComplete: to.Ptr[float64](15), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-10-02T18:38:19.143Z"); return t}()), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-10-02T18:38:19.143Z"); return t}()), + // Operations: []*armhybridconnectivity.OperationStatusResult{ + // }, + // Error: &armhybridconnectivity.ErrorDetail{ + // Code: to.Ptr("ykzvluyqiftfsumgvwzdh"), + // Message: to.Ptr("krbjgtqkjgiux"), + // Target: to.Ptr("nsaucxt"), + // Details: []*armhybridconnectivity.ErrorDetail{ + // }, + // AdditionalInfo: []*armhybridconnectivity.ErrorAdditionalInfo{ + // { + // Type: to.Ptr("qivvrewsjvcildjgwwytgimwklh"), + // Info: &armhybridconnectivity.ErrorAdditionalInfoInfo{ + // }, + // }, + // }, + // }, + // }, + // }, + // Error: &armhybridconnectivity.ErrorDetail{ + // Code: to.Ptr("ykzvluyqiftfsumgvwzdh"), + // Message: to.Ptr("krbjgtqkjgiux"), + // Target: to.Ptr("nsaucxt"), + // Details: []*armhybridconnectivity.ErrorDetail{ + // }, + // AdditionalInfo: []*armhybridconnectivity.ErrorAdditionalInfo{ + // { + // Type: to.Ptr("qivvrewsjvcildjgwwytgimwklh"), + // Info: &armhybridconnectivity.ErrorAdditionalInfoInfo{ + // }, + // }, + // }, + // }, + // }, + // } +} + +// Generated from example definition: 2024-12-01/PublicCloudConnectors_Update.json +func ExamplePublicCloudConnectorsClient_Update() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhybridconnectivity.NewClientFactory("5ACC4579-DB34-4C2F-8F8C-25061168F342", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewPublicCloudConnectorsClient().Update(ctx, "rgpublicCloud", "svtirlbyqpepbzyessjenlueeznhg", armhybridconnectivity.PublicCloudConnector{ + Tags: map[string]*string{}, + Properties: &armhybridconnectivity.PublicCloudConnectorProperties{ + AwsCloudProfile: &armhybridconnectivity.AwsCloudProfile{ + ExcludedAccounts: []*string{ + to.Ptr("zrbtd"), + }, + }, + }, + }, 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 = armhybridconnectivity.PublicCloudConnectorsClientUpdateResponse{ + // PublicCloudConnector: &armhybridconnectivity.PublicCloudConnector{ + // Properties: &armhybridconnectivity.PublicCloudConnectorProperties{ + // AwsCloudProfile: &armhybridconnectivity.AwsCloudProfile{ + // AccountID: to.Ptr("snbnuxckevyqpm"), + // ExcludedAccounts: []*string{ + // to.Ptr("zrbtd"), + // }, + // IsOrganizationalAccount: to.Ptr(true), + // }, + // HostType: to.Ptr(armhybridconnectivity.HostTypeAWS), + // ProvisioningState: to.Ptr(armhybridconnectivity.ResourceProvisioningStateSucceeded), + // ConnectorPrimaryIdentifier: to.Ptr("20a4e2be-8158-4b9e-b512-7a1af6f827de"), + // }, + // Tags: map[string]*string{ + // }, + // Location: to.Ptr("jpiglusfxynfcewcjwvvnn"), + // ID: to.Ptr("/subscriptions/5ACC4579-DB34-4C2F-8F8C-25061168F342/providers/Microsoft.HybridConnectivity/PublicCloudConnectors/esixipkbydb"), + // Name: to.Ptr("esixipkbydb"), + // Type: to.Ptr("eelsjvqvkdxdncptsobrswhulnm"), + // SystemData: &armhybridconnectivity.SystemData{ + // CreatedBy: to.Ptr("rpxzkcrobprrdvuoqxz"), + // CreatedByType: to.Ptr(armhybridconnectivity.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-18T22:52:07.890Z"); return t}()), + // LastModifiedBy: to.Ptr("jidegyskxi"), + // LastModifiedByType: to.Ptr(armhybridconnectivity.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-18T22:52:07.890Z"); return t}()), + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/response_types.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/response_types.go deleted file mode 100644 index 56d2a363d1d4..000000000000 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/response_types.go +++ /dev/null @@ -1,91 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armhybridconnectivity - -// EndpointsClientCreateOrUpdateResponse contains the response from method EndpointsClient.CreateOrUpdate. -type EndpointsClientCreateOrUpdateResponse struct { - // The endpoint for the target resource. - EndpointResource -} - -// EndpointsClientDeleteResponse contains the response from method EndpointsClient.Delete. -type EndpointsClientDeleteResponse struct { - // placeholder for future response values -} - -// EndpointsClientGetResponse contains the response from method EndpointsClient.Get. -type EndpointsClientGetResponse struct { - // The endpoint for the target resource. - EndpointResource -} - -// EndpointsClientListCredentialsResponse contains the response from method EndpointsClient.ListCredentials. -type EndpointsClientListCredentialsResponse struct { - // The endpoint access for the target resource. - EndpointAccessResource -} - -// EndpointsClientListIngressGatewayCredentialsResponse contains the response from method EndpointsClient.ListIngressGatewayCredentials. -type EndpointsClientListIngressGatewayCredentialsResponse struct { - // The ingress gateway access credentials - IngressGatewayResource -} - -// EndpointsClientListManagedProxyDetailsResponse contains the response from method EndpointsClient.ListManagedProxyDetails. -type EndpointsClientListManagedProxyDetailsResponse struct { - // Managed Proxy - ManagedProxyResource -} - -// EndpointsClientListResponse contains the response from method EndpointsClient.NewListPager. -type EndpointsClientListResponse struct { - // The list of endpoints. - EndpointsList -} - -// EndpointsClientUpdateResponse contains the response from method EndpointsClient.Update. -type EndpointsClientUpdateResponse struct { - // The endpoint for the target resource. - EndpointResource -} - -// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. -type OperationsClientListResponse struct { - // A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. - OperationListResult -} - -// ServiceConfigurationsClientCreateOrupdateResponse contains the response from method ServiceConfigurationsClient.CreateOrupdate. -type ServiceConfigurationsClientCreateOrupdateResponse struct { - // The service configuration details associated with the target resource. - ServiceConfigurationResource -} - -// ServiceConfigurationsClientDeleteResponse contains the response from method ServiceConfigurationsClient.Delete. -type ServiceConfigurationsClientDeleteResponse struct { - // placeholder for future response values -} - -// ServiceConfigurationsClientGetResponse contains the response from method ServiceConfigurationsClient.Get. -type ServiceConfigurationsClientGetResponse struct { - // The service configuration details associated with the target resource. - ServiceConfigurationResource -} - -// ServiceConfigurationsClientListByEndpointResourceResponse contains the response from method ServiceConfigurationsClient.NewListByEndpointResourcePager. -type ServiceConfigurationsClientListByEndpointResourceResponse struct { - // The paginated list of serviceConfigurations - ServiceConfigurationList -} - -// ServiceConfigurationsClientUpdateResponse contains the response from method ServiceConfigurationsClient.Update. -type ServiceConfigurationsClientUpdateResponse struct { - // The service configuration details associated with the target resource. - ServiceConfigurationResource -} diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/responses.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/responses.go new file mode 100644 index 000000000000..d259242f57c0 --- /dev/null +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/responses.go @@ -0,0 +1,116 @@ +// 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 armhybridconnectivity + +// GenerateAwsTemplateClientPostResponse contains the response from method GenerateAwsTemplateClient.Post. +type GenerateAwsTemplateClientPostResponse struct { + PostResponse +} + +// InventoryClientGetResponse contains the response from method InventoryClient.Get. +type InventoryClientGetResponse struct { + // Concrete proxy resource types can be created by aliasing this type using a specific property type. + InventoryResource +} + +// InventoryClientListBySolutionConfigurationResponse contains the response from method InventoryClient.NewListBySolutionConfigurationPager. +type InventoryClientListBySolutionConfigurationResponse struct { + // The response of a InventoryResource list operation. + InventoryResourceListResult +} + +// PublicCloudConnectorsClientCreateOrUpdateResponse contains the response from method PublicCloudConnectorsClient.BeginCreateOrUpdate. +type PublicCloudConnectorsClientCreateOrUpdateResponse struct { + // Public Cloud Connector + PublicCloudConnector +} + +// PublicCloudConnectorsClientDeleteResponse contains the response from method PublicCloudConnectorsClient.Delete. +type PublicCloudConnectorsClientDeleteResponse struct { + // placeholder for future response values +} + +// PublicCloudConnectorsClientGetResponse contains the response from method PublicCloudConnectorsClient.Get. +type PublicCloudConnectorsClientGetResponse struct { + // Public Cloud Connector + PublicCloudConnector +} + +// PublicCloudConnectorsClientListByResourceGroupResponse contains the response from method PublicCloudConnectorsClient.NewListByResourceGroupPager. +type PublicCloudConnectorsClientListByResourceGroupResponse struct { + // The response of a PublicCloudConnector list operation. + PublicCloudConnectorListResult +} + +// PublicCloudConnectorsClientListBySubscriptionResponse contains the response from method PublicCloudConnectorsClient.NewListBySubscriptionPager. +type PublicCloudConnectorsClientListBySubscriptionResponse struct { + // The response of a PublicCloudConnector list operation. + PublicCloudConnectorListResult +} + +// PublicCloudConnectorsClientTestPermissionsResponse contains the response from method PublicCloudConnectorsClient.BeginTestPermissions. +type PublicCloudConnectorsClientTestPermissionsResponse struct { + // The current status of an async operation. + OperationStatusResult +} + +// PublicCloudConnectorsClientUpdateResponse contains the response from method PublicCloudConnectorsClient.Update. +type PublicCloudConnectorsClientUpdateResponse struct { + // Public Cloud Connector + PublicCloudConnector +} + +// SolutionConfigurationsClientCreateOrUpdateResponse contains the response from method SolutionConfigurationsClient.CreateOrUpdate. +type SolutionConfigurationsClientCreateOrUpdateResponse struct { + // Solution Configuration + SolutionConfiguration +} + +// SolutionConfigurationsClientDeleteResponse contains the response from method SolutionConfigurationsClient.Delete. +type SolutionConfigurationsClientDeleteResponse struct { + // placeholder for future response values +} + +// SolutionConfigurationsClientGetResponse contains the response from method SolutionConfigurationsClient.Get. +type SolutionConfigurationsClientGetResponse struct { + // Solution Configuration + SolutionConfiguration +} + +// SolutionConfigurationsClientListResponse contains the response from method SolutionConfigurationsClient.NewListPager. +type SolutionConfigurationsClientListResponse struct { + // The response of a SolutionConfiguration list operation. + SolutionConfigurationListResult +} + +// SolutionConfigurationsClientSyncNowResponse contains the response from method SolutionConfigurationsClient.BeginSyncNow. +type SolutionConfigurationsClientSyncNowResponse struct { + // The current status of an async operation. + OperationStatusResult +} + +// SolutionConfigurationsClientUpdateResponse contains the response from method SolutionConfigurationsClient.Update. +type SolutionConfigurationsClientUpdateResponse struct { + // Solution Configuration + SolutionConfiguration +} + +// SolutionTypesClientGetResponse contains the response from method SolutionTypesClient.Get. +type SolutionTypesClientGetResponse struct { + // Concrete proxy resource types can be created by aliasing this type using a specific property type. + SolutionTypeResource +} + +// SolutionTypesClientListByResourceGroupResponse contains the response from method SolutionTypesClient.NewListByResourceGroupPager. +type SolutionTypesClientListByResourceGroupResponse struct { + // The response of a SolutionTypeResource list operation. + SolutionTypeResourceListResult +} + +// SolutionTypesClientListBySubscriptionResponse contains the response from method SolutionTypesClient.NewListBySubscriptionPager. +type SolutionTypesClientListBySubscriptionResponse struct { + // The response of a SolutionTypeResource list operation. + SolutionTypeResourceListResult +} diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/serviceconfigurations_client.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/serviceconfigurations_client.go deleted file mode 100644 index a760822737fb..000000000000 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/serviceconfigurations_client.go +++ /dev/null @@ -1,320 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armhybridconnectivity - -import ( - "context" - "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" - "strings" -) - -// ServiceConfigurationsClient contains the methods for the ServiceConfigurations group. -// Don't use this type directly, use NewServiceConfigurationsClient() instead. -type ServiceConfigurationsClient struct { - internal *arm.Client -} - -// NewServiceConfigurationsClient creates a new instance of ServiceConfigurationsClient with the specified values. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewServiceConfigurationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ServiceConfigurationsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ServiceConfigurationsClient{ - internal: cl, - } - return client, nil -} - -// CreateOrupdate - Create or update a service in serviceConfiguration for the endpoint resource. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-03-15 -// - resourceURI - The fully qualified Azure Resource manager identifier of the resource to be connected. -// - endpointName - The endpoint name. -// - serviceConfigurationName - The service name. -// - serviceConfigurationResource - Service details -// - options - ServiceConfigurationsClientCreateOrupdateOptions contains the optional parameters for the ServiceConfigurationsClient.CreateOrupdate -// method. -func (client *ServiceConfigurationsClient) CreateOrupdate(ctx context.Context, resourceURI string, endpointName string, serviceConfigurationName string, serviceConfigurationResource ServiceConfigurationResource, options *ServiceConfigurationsClientCreateOrupdateOptions) (ServiceConfigurationsClientCreateOrupdateResponse, error) { - var err error - const operationName = "ServiceConfigurationsClient.CreateOrupdate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createOrupdateCreateRequest(ctx, resourceURI, endpointName, serviceConfigurationName, serviceConfigurationResource, options) - if err != nil { - return ServiceConfigurationsClientCreateOrupdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ServiceConfigurationsClientCreateOrupdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return ServiceConfigurationsClientCreateOrupdateResponse{}, err - } - resp, err := client.createOrupdateHandleResponse(httpResp) - return resp, err -} - -// createOrupdateCreateRequest creates the CreateOrupdate request. -func (client *ServiceConfigurationsClient) createOrupdateCreateRequest(ctx context.Context, resourceURI string, endpointName string, serviceConfigurationName string, serviceConfigurationResource ServiceConfigurationResource, options *ServiceConfigurationsClientCreateOrupdateOptions) (*policy.Request, error) { - urlPath := "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/serviceConfigurations/{serviceConfigurationName}" - urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) - urlPath = strings.ReplaceAll(urlPath, "{endpointName}", endpointName) - urlPath = strings.ReplaceAll(urlPath, "{serviceConfigurationName}", serviceConfigurationName) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, serviceConfigurationResource); err != nil { - return nil, err - } - return req, nil -} - -// createOrupdateHandleResponse handles the CreateOrupdate response. -func (client *ServiceConfigurationsClient) createOrupdateHandleResponse(resp *http.Response) (ServiceConfigurationsClientCreateOrupdateResponse, error) { - result := ServiceConfigurationsClientCreateOrupdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ServiceConfigurationResource); err != nil { - return ServiceConfigurationsClientCreateOrupdateResponse{}, err - } - return result, nil -} - -// Delete - Deletes the service details to the target resource. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-03-15 -// - resourceURI - The fully qualified Azure Resource manager identifier of the resource to be connected. -// - endpointName - The endpoint name. -// - serviceConfigurationName - The service name. -// - options - ServiceConfigurationsClientDeleteOptions contains the optional parameters for the ServiceConfigurationsClient.Delete -// method. -func (client *ServiceConfigurationsClient) Delete(ctx context.Context, resourceURI string, endpointName string, serviceConfigurationName string, options *ServiceConfigurationsClientDeleteOptions) (ServiceConfigurationsClientDeleteResponse, error) { - var err error - const operationName = "ServiceConfigurationsClient.Delete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, resourceURI, endpointName, serviceConfigurationName, options) - if err != nil { - return ServiceConfigurationsClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ServiceConfigurationsClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return ServiceConfigurationsClientDeleteResponse{}, err - } - return ServiceConfigurationsClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *ServiceConfigurationsClient) deleteCreateRequest(ctx context.Context, resourceURI string, endpointName string, serviceConfigurationName string, options *ServiceConfigurationsClientDeleteOptions) (*policy.Request, error) { - urlPath := "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/serviceConfigurations/{serviceConfigurationName}" - urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) - urlPath = strings.ReplaceAll(urlPath, "{endpointName}", endpointName) - urlPath = strings.ReplaceAll(urlPath, "{serviceConfigurationName}", serviceConfigurationName) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Gets the details about the service to the resource. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-03-15 -// - resourceURI - The fully qualified Azure Resource manager identifier of the resource to be connected. -// - endpointName - The endpoint name. -// - serviceConfigurationName - The service name. -// - options - ServiceConfigurationsClientGetOptions contains the optional parameters for the ServiceConfigurationsClient.Get -// method. -func (client *ServiceConfigurationsClient) Get(ctx context.Context, resourceURI string, endpointName string, serviceConfigurationName string, options *ServiceConfigurationsClientGetOptions) (ServiceConfigurationsClientGetResponse, error) { - var err error - const operationName = "ServiceConfigurationsClient.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, resourceURI, endpointName, serviceConfigurationName, options) - if err != nil { - return ServiceConfigurationsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ServiceConfigurationsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ServiceConfigurationsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *ServiceConfigurationsClient) getCreateRequest(ctx context.Context, resourceURI string, endpointName string, serviceConfigurationName string, options *ServiceConfigurationsClientGetOptions) (*policy.Request, error) { - urlPath := "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/serviceConfigurations/{serviceConfigurationName}" - urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) - urlPath = strings.ReplaceAll(urlPath, "{endpointName}", endpointName) - urlPath = strings.ReplaceAll(urlPath, "{serviceConfigurationName}", serviceConfigurationName) - 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-03-15") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *ServiceConfigurationsClient) getHandleResponse(resp *http.Response) (ServiceConfigurationsClientGetResponse, error) { - result := ServiceConfigurationsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ServiceConfigurationResource); err != nil { - return ServiceConfigurationsClientGetResponse{}, err - } - return result, nil -} - -// NewListByEndpointResourcePager - API to enumerate registered services in service configurations under a Endpoint Resource -// -// Generated from API version 2023-03-15 -// - resourceURI - The fully qualified Azure Resource manager identifier of the resource to be connected. -// - endpointName - The endpoint name. -// - options - ServiceConfigurationsClientListByEndpointResourceOptions contains the optional parameters for the ServiceConfigurationsClient.NewListByEndpointResourcePager -// method. -func (client *ServiceConfigurationsClient) NewListByEndpointResourcePager(resourceURI string, endpointName string, options *ServiceConfigurationsClientListByEndpointResourceOptions) *runtime.Pager[ServiceConfigurationsClientListByEndpointResourceResponse] { - return runtime.NewPager(runtime.PagingHandler[ServiceConfigurationsClientListByEndpointResourceResponse]{ - More: func(page ServiceConfigurationsClientListByEndpointResourceResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *ServiceConfigurationsClientListByEndpointResourceResponse) (ServiceConfigurationsClientListByEndpointResourceResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ServiceConfigurationsClient.NewListByEndpointResourcePager") - 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.listByEndpointResourceCreateRequest(ctx, resourceURI, endpointName, options) - }, nil) - if err != nil { - return ServiceConfigurationsClientListByEndpointResourceResponse{}, err - } - return client.listByEndpointResourceHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByEndpointResourceCreateRequest creates the ListByEndpointResource request. -func (client *ServiceConfigurationsClient) listByEndpointResourceCreateRequest(ctx context.Context, resourceURI string, endpointName string, options *ServiceConfigurationsClientListByEndpointResourceOptions) (*policy.Request, error) { - urlPath := "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/serviceConfigurations" - urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) - urlPath = strings.ReplaceAll(urlPath, "{endpointName}", endpointName) - 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-03-15") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByEndpointResourceHandleResponse handles the ListByEndpointResource response. -func (client *ServiceConfigurationsClient) listByEndpointResourceHandleResponse(resp *http.Response) (ServiceConfigurationsClientListByEndpointResourceResponse, error) { - result := ServiceConfigurationsClientListByEndpointResourceResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ServiceConfigurationList); err != nil { - return ServiceConfigurationsClientListByEndpointResourceResponse{}, err - } - return result, nil -} - -// Update - Update the service details in the service configurations of the target resource. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-03-15 -// - resourceURI - The fully qualified Azure Resource manager identifier of the resource to be connected. -// - endpointName - The endpoint name. -// - serviceConfigurationName - The service name. -// - serviceConfigurationResource - Service details -// - options - ServiceConfigurationsClientUpdateOptions contains the optional parameters for the ServiceConfigurationsClient.Update -// method. -func (client *ServiceConfigurationsClient) Update(ctx context.Context, resourceURI string, endpointName string, serviceConfigurationName string, serviceConfigurationResource ServiceConfigurationResourcePatch, options *ServiceConfigurationsClientUpdateOptions) (ServiceConfigurationsClientUpdateResponse, error) { - var err error - const operationName = "ServiceConfigurationsClient.Update" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.updateCreateRequest(ctx, resourceURI, endpointName, serviceConfigurationName, serviceConfigurationResource, options) - if err != nil { - return ServiceConfigurationsClientUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ServiceConfigurationsClientUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ServiceConfigurationsClientUpdateResponse{}, err - } - resp, err := client.updateHandleResponse(httpResp) - return resp, err -} - -// updateCreateRequest creates the Update request. -func (client *ServiceConfigurationsClient) updateCreateRequest(ctx context.Context, resourceURI string, endpointName string, serviceConfigurationName string, serviceConfigurationResource ServiceConfigurationResourcePatch, options *ServiceConfigurationsClientUpdateOptions) (*policy.Request, error) { - urlPath := "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/serviceConfigurations/{serviceConfigurationName}" - urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) - urlPath = strings.ReplaceAll(urlPath, "{endpointName}", endpointName) - urlPath = strings.ReplaceAll(urlPath, "{serviceConfigurationName}", serviceConfigurationName) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, serviceConfigurationResource); err != nil { - return nil, err - } - return req, nil -} - -// updateHandleResponse handles the Update response. -func (client *ServiceConfigurationsClient) updateHandleResponse(resp *http.Response) (ServiceConfigurationsClientUpdateResponse, error) { - result := ServiceConfigurationsClientUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ServiceConfigurationResource); err != nil { - return ServiceConfigurationsClientUpdateResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/serviceconfigurations_client_example_test.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/serviceconfigurations_client_example_test.go deleted file mode 100644 index 59b2813f785e..000000000000 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/serviceconfigurations_client_example_test.go +++ /dev/null @@ -1,235 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armhybridconnectivity_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/hybridconnectivity/armhybridconnectivity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/examples/ServiceConfigurationsList.json -func ExampleServiceConfigurationsClient_NewListByEndpointResourcePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridconnectivity.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewServiceConfigurationsClient().NewListByEndpointResourcePager("subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default", "default", 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.ServiceConfigurationList = armhybridconnectivity.ServiceConfigurationList{ - // Value: []*armhybridconnectivity.ServiceConfigurationResource{ - // { - // Type: to.Ptr("Microsoft.HybridConnectivity/endpoints/serviceConfigurations"), - // ID: to.Ptr("/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default/serviceconfigurations/SSH"), - // Properties: &armhybridconnectivity.ServiceConfigurationProperties{ - // Port: to.Ptr[int64](22), - // ServiceName: to.Ptr(armhybridconnectivity.ServiceNameSSH), - // }, - // }, - // { - // Type: to.Ptr("Microsoft.HybridConnectivity/endpoints/serviceConfigurations"), - // ID: to.Ptr("/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default/serviceconfigurations/WAC"), - // Properties: &armhybridconnectivity.ServiceConfigurationProperties{ - // Port: to.Ptr[int64](6516), - // ServiceName: to.Ptr(armhybridconnectivity.ServiceNameWAC), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/examples/ServiceConfigurationsGetSSH.json -func ExampleServiceConfigurationsClient_Get_hybridConnectivityEndpointsServiceconfigurationsGetSsh() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridconnectivity.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServiceConfigurationsClient().Get(ctx, "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default", "default", "SSH", 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.ServiceConfigurationResource = armhybridconnectivity.ServiceConfigurationResource{ - // Type: to.Ptr("Microsoft.HybridConnectivity/endpoints/serviceConfigurations"), - // ID: to.Ptr("/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default/serviceconfigurations/SSH"), - // Properties: &armhybridconnectivity.ServiceConfigurationProperties{ - // Port: to.Ptr[int64](22), - // ServiceName: to.Ptr(armhybridconnectivity.ServiceNameSSH), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/examples/ServiceConfigurationsGetWAC.json -func ExampleServiceConfigurationsClient_Get_hybridConnectivityEndpointsServiceconfigurationsGetWac() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridconnectivity.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServiceConfigurationsClient().Get(ctx, "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default", "default", "WAC", 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.ServiceConfigurationResource = armhybridconnectivity.ServiceConfigurationResource{ - // Type: to.Ptr("Microsoft.HybridConnectivity/endpoints/serviceConfigurations"), - // ID: to.Ptr("/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default/serviceconfigurations/WAC"), - // Properties: &armhybridconnectivity.ServiceConfigurationProperties{ - // Port: to.Ptr[int64](6516), - // ServiceName: to.Ptr(armhybridconnectivity.ServiceNameWAC), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/examples/ServiceConfigurationsPutSSH.json -func ExampleServiceConfigurationsClient_CreateOrupdate_serviceConfigurationsPutSsh() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridconnectivity.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServiceConfigurationsClient().CreateOrupdate(ctx, "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default", "default", "SSH", armhybridconnectivity.ServiceConfigurationResource{ - Properties: &armhybridconnectivity.ServiceConfigurationProperties{ - Port: to.Ptr[int64](22), - ServiceName: to.Ptr(armhybridconnectivity.ServiceNameSSH), - }, - }, 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.ServiceConfigurationResource = armhybridconnectivity.ServiceConfigurationResource{ - // Type: to.Ptr("Microsoft.HybridConnectivity/endpoints/serviceConfigurations"), - // ID: to.Ptr("/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default/serviceconfigurations/SSH"), - // Properties: &armhybridconnectivity.ServiceConfigurationProperties{ - // Port: to.Ptr[int64](22), - // ProvisioningState: to.Ptr(armhybridconnectivity.ProvisioningStateSucceeded), - // ServiceName: to.Ptr(armhybridconnectivity.ServiceNameSSH), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/examples/ServiceConfigurationsPutWAC.json -func ExampleServiceConfigurationsClient_CreateOrupdate_serviceConfigurationsPutWac() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridconnectivity.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServiceConfigurationsClient().CreateOrupdate(ctx, "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default", "default", "WAC", armhybridconnectivity.ServiceConfigurationResource{ - Properties: &armhybridconnectivity.ServiceConfigurationProperties{ - Port: to.Ptr[int64](6516), - ServiceName: to.Ptr(armhybridconnectivity.ServiceNameWAC), - }, - }, 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.ServiceConfigurationResource = armhybridconnectivity.ServiceConfigurationResource{ - // Type: to.Ptr("Microsoft.HybridConnectivity/endpoints/serviceConfigurations"), - // ID: to.Ptr("/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default/serviceconfigurations/WAC"), - // Properties: &armhybridconnectivity.ServiceConfigurationProperties{ - // Port: to.Ptr[int64](6516), - // ProvisioningState: to.Ptr(armhybridconnectivity.ProvisioningStateSucceeded), - // ServiceName: to.Ptr(armhybridconnectivity.ServiceNameWAC), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/examples/ServiceConfigurationsPatchSSH.json -func ExampleServiceConfigurationsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridconnectivity.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServiceConfigurationsClient().Update(ctx, "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default", "default", "SSH", armhybridconnectivity.ServiceConfigurationResourcePatch{ - Properties: &armhybridconnectivity.ServiceConfigurationPropertiesPatch{ - Port: to.Ptr[int64](22), - }, - }, 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.ServiceConfigurationResource = armhybridconnectivity.ServiceConfigurationResource{ - // ID: to.Ptr("/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default/serviceConfigurations/SSH"), - // Properties: &armhybridconnectivity.ServiceConfigurationProperties{ - // Port: to.Ptr[int64](22), - // ServiceName: to.Ptr(armhybridconnectivity.ServiceNameSSH), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/examples/ServiceConfigurationsDeleteSSH.json -func ExampleServiceConfigurationsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridconnectivity.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewServiceConfigurationsClient().Delete(ctx, "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default", "default", "SSH", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/solutionconfigurations_client.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/solutionconfigurations_client.go new file mode 100644 index 000000000000..62d0293c43cd --- /dev/null +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/solutionconfigurations_client.go @@ -0,0 +1,391 @@ +// 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 armhybridconnectivity + +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" +) + +// SolutionConfigurationsClient contains the methods for the SolutionConfigurations group. +// Don't use this type directly, use NewSolutionConfigurationsClient() instead. +type SolutionConfigurationsClient struct { + internal *arm.Client +} + +// NewSolutionConfigurationsClient creates a new instance of SolutionConfigurationsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewSolutionConfigurationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*SolutionConfigurationsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SolutionConfigurationsClient{ + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Create a SolutionConfiguration +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-12-01 +// - resourceURI - The fully qualified Azure Resource manager identifier of the resource. +// - solutionConfiguration - Represent Solution Configuration Resource. +// - resource - Resource create parameters. +// - options - SolutionConfigurationsClientCreateOrUpdateOptions contains the optional parameters for the SolutionConfigurationsClient.CreateOrUpdate +// method. +func (client *SolutionConfigurationsClient) CreateOrUpdate(ctx context.Context, resourceURI string, solutionConfiguration string, resource SolutionConfiguration, options *SolutionConfigurationsClientCreateOrUpdateOptions) (SolutionConfigurationsClientCreateOrUpdateResponse, error) { + var err error + const operationName = "SolutionConfigurationsClient.CreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceURI, solutionConfiguration, resource, options) + if err != nil { + return SolutionConfigurationsClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SolutionConfigurationsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return SolutionConfigurationsClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *SolutionConfigurationsClient) createOrUpdateCreateRequest(ctx context.Context, resourceURI string, solutionConfiguration string, resource SolutionConfiguration, _ *SolutionConfigurationsClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration}" + urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) + if solutionConfiguration == "" { + return nil, errors.New("parameter solutionConfiguration cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{solutionConfiguration}", url.PathEscape(solutionConfiguration)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-12-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 + } + return req, nil +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *SolutionConfigurationsClient) createOrUpdateHandleResponse(resp *http.Response) (SolutionConfigurationsClientCreateOrUpdateResponse, error) { + result := SolutionConfigurationsClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SolutionConfiguration); err != nil { + return SolutionConfigurationsClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Delete a SolutionConfiguration +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-12-01 +// - resourceURI - The fully qualified Azure Resource manager identifier of the resource. +// - solutionConfiguration - Represent Solution Configuration Resource. +// - options - SolutionConfigurationsClientDeleteOptions contains the optional parameters for the SolutionConfigurationsClient.Delete +// method. +func (client *SolutionConfigurationsClient) Delete(ctx context.Context, resourceURI string, solutionConfiguration string, options *SolutionConfigurationsClientDeleteOptions) (SolutionConfigurationsClientDeleteResponse, error) { + var err error + const operationName = "SolutionConfigurationsClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceURI, solutionConfiguration, options) + if err != nil { + return SolutionConfigurationsClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SolutionConfigurationsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return SolutionConfigurationsClientDeleteResponse{}, err + } + return SolutionConfigurationsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *SolutionConfigurationsClient) deleteCreateRequest(ctx context.Context, resourceURI string, solutionConfiguration string, _ *SolutionConfigurationsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration}" + urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) + if solutionConfiguration == "" { + return nil, errors.New("parameter solutionConfiguration cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{solutionConfiguration}", url.PathEscape(solutionConfiguration)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-12-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a SolutionConfiguration +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-12-01 +// - resourceURI - The fully qualified Azure Resource manager identifier of the resource. +// - solutionConfiguration - Represent Solution Configuration Resource. +// - options - SolutionConfigurationsClientGetOptions contains the optional parameters for the SolutionConfigurationsClient.Get +// method. +func (client *SolutionConfigurationsClient) Get(ctx context.Context, resourceURI string, solutionConfiguration string, options *SolutionConfigurationsClientGetOptions) (SolutionConfigurationsClientGetResponse, error) { + var err error + const operationName = "SolutionConfigurationsClient.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, resourceURI, solutionConfiguration, options) + if err != nil { + return SolutionConfigurationsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SolutionConfigurationsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SolutionConfigurationsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *SolutionConfigurationsClient) getCreateRequest(ctx context.Context, resourceURI string, solutionConfiguration string, _ *SolutionConfigurationsClientGetOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration}" + urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) + if solutionConfiguration == "" { + return nil, errors.New("parameter solutionConfiguration cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{solutionConfiguration}", url.PathEscape(solutionConfiguration)) + 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-12-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *SolutionConfigurationsClient) getHandleResponse(resp *http.Response) (SolutionConfigurationsClientGetResponse, error) { + result := SolutionConfigurationsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SolutionConfiguration); err != nil { + return SolutionConfigurationsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - List SolutionConfiguration resources by parent +// +// Generated from API version 2024-12-01 +// - resourceURI - The fully qualified Azure Resource manager identifier of the resource. +// - options - SolutionConfigurationsClientListOptions contains the optional parameters for the SolutionConfigurationsClient.NewListPager +// method. +func (client *SolutionConfigurationsClient) NewListPager(resourceURI string, options *SolutionConfigurationsClientListOptions) *runtime.Pager[SolutionConfigurationsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[SolutionConfigurationsClientListResponse]{ + More: func(page SolutionConfigurationsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SolutionConfigurationsClientListResponse) (SolutionConfigurationsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SolutionConfigurationsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceURI, options) + }, nil) + if err != nil { + return SolutionConfigurationsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *SolutionConfigurationsClient) listCreateRequest(ctx context.Context, resourceURI string, _ *SolutionConfigurationsClientListOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations" + urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) + 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-12-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *SolutionConfigurationsClient) listHandleResponse(resp *http.Response) (SolutionConfigurationsClientListResponse, error) { + result := SolutionConfigurationsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SolutionConfigurationListResult); err != nil { + return SolutionConfigurationsClientListResponse{}, err + } + return result, nil +} + +// BeginSyncNow - Trigger immediate sync with source cloud +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-12-01 +// - resourceURI - The fully qualified Azure Resource manager identifier of the resource. +// - solutionConfiguration - Represent Solution Configuration Resource. +// - options - SolutionConfigurationsClientBeginSyncNowOptions contains the optional parameters for the SolutionConfigurationsClient.BeginSyncNow +// method. +func (client *SolutionConfigurationsClient) BeginSyncNow(ctx context.Context, resourceURI string, solutionConfiguration string, options *SolutionConfigurationsClientBeginSyncNowOptions) (*runtime.Poller[SolutionConfigurationsClientSyncNowResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.syncNow(ctx, resourceURI, solutionConfiguration, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SolutionConfigurationsClientSyncNowResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SolutionConfigurationsClientSyncNowResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// SyncNow - Trigger immediate sync with source cloud +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-12-01 +func (client *SolutionConfigurationsClient) syncNow(ctx context.Context, resourceURI string, solutionConfiguration string, options *SolutionConfigurationsClientBeginSyncNowOptions) (*http.Response, error) { + var err error + const operationName = "SolutionConfigurationsClient.BeginSyncNow" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.syncNowCreateRequest(ctx, resourceURI, solutionConfiguration, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// syncNowCreateRequest creates the SyncNow request. +func (client *SolutionConfigurationsClient) syncNowCreateRequest(ctx context.Context, resourceURI string, solutionConfiguration string, _ *SolutionConfigurationsClientBeginSyncNowOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration}/syncNow" + urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) + if solutionConfiguration == "" { + return nil, errors.New("parameter solutionConfiguration cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{solutionConfiguration}", url.PathEscape(solutionConfiguration)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-12-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Update - Update a SolutionConfiguration +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-12-01 +// - resourceURI - The fully qualified Azure Resource manager identifier of the resource. +// - solutionConfiguration - Represent Solution Configuration Resource. +// - properties - The resource properties to be updated. +// - options - SolutionConfigurationsClientUpdateOptions contains the optional parameters for the SolutionConfigurationsClient.Update +// method. +func (client *SolutionConfigurationsClient) Update(ctx context.Context, resourceURI string, solutionConfiguration string, properties SolutionConfiguration, options *SolutionConfigurationsClientUpdateOptions) (SolutionConfigurationsClientUpdateResponse, error) { + var err error + const operationName = "SolutionConfigurationsClient.Update" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceURI, solutionConfiguration, properties, options) + if err != nil { + return SolutionConfigurationsClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SolutionConfigurationsClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SolutionConfigurationsClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *SolutionConfigurationsClient) updateCreateRequest(ctx context.Context, resourceURI string, solutionConfiguration string, properties SolutionConfiguration, _ *SolutionConfigurationsClientUpdateOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration}" + urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) + if solutionConfiguration == "" { + return nil, errors.New("parameter solutionConfiguration cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{solutionConfiguration}", url.PathEscape(solutionConfiguration)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-12-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 + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *SolutionConfigurationsClient) updateHandleResponse(resp *http.Response) (SolutionConfigurationsClientUpdateResponse, error) { + result := SolutionConfigurationsClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SolutionConfiguration); err != nil { + return SolutionConfigurationsClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/solutionconfigurations_client_example_test.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/solutionconfigurations_client_example_test.go new file mode 100644 index 000000000000..6cce14fb7257 --- /dev/null +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/solutionconfigurations_client_example_test.go @@ -0,0 +1,301 @@ +// 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 armhybridconnectivity_test + +import ( + "context" + "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/hybridconnectivity/armhybridconnectivity/v2" + "log" +) + +// Generated from example definition: 2024-12-01/SolutionConfigurations_CreateOrUpdate.json +func ExampleSolutionConfigurationsClient_CreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhybridconnectivity.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSolutionConfigurationsClient().CreateOrUpdate(ctx, "ymuj", "keebwujt", armhybridconnectivity.SolutionConfiguration{ + Properties: &armhybridconnectivity.SolutionConfigurationProperties{ + SolutionType: to.Ptr("nmtqllkyohwtsthxaimsye"), + SolutionSettings: &armhybridconnectivity.SolutionSettings{}, + }, + }, 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 = armhybridconnectivity.SolutionConfigurationsClientCreateOrUpdateResponse{ + // SolutionConfiguration: &armhybridconnectivity.SolutionConfiguration{ + // Properties: &armhybridconnectivity.SolutionConfigurationProperties{ + // SolutionType: to.Ptr("nmtqllkyohwtsthxaimsye"), + // SolutionSettings: &armhybridconnectivity.SolutionSettings{ + // }, + // ProvisioningState: to.Ptr(armhybridconnectivity.ResourceProvisioningStateSucceeded), + // Status: to.Ptr(armhybridconnectivity.SolutionConfigurationStatusNew), + // StatusDetails: to.Ptr("rqbrzildwecankrpukkbjjqrczxboz"), + // LastSyncTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-20T03:24:15.820Z"); return t}()), + // }, + // ID: to.Ptr("/subscriptions/testSubcrptions/resourceGroups/testResourceGroup/providers/Microsoft.HybridConnectivity/SolutionConfigurations/qpwubemzmootxmtlxaerir"), + // Name: to.Ptr("qpwubemzmootxmtlxaerir"), + // Type: to.Ptr("uknrk"), + // SystemData: &armhybridconnectivity.SystemData{ + // CreatedBy: to.Ptr("rpxzkcrobprrdvuoqxz"), + // CreatedByType: to.Ptr(armhybridconnectivity.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-18T22:52:07.890Z"); return t}()), + // LastModifiedBy: to.Ptr("jidegyskxi"), + // LastModifiedByType: to.Ptr(armhybridconnectivity.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-18T22:52:07.890Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2024-12-01/SolutionConfigurations_Delete.json +func ExampleSolutionConfigurationsClient_Delete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhybridconnectivity.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSolutionConfigurationsClient().Delete(ctx, "ymuj", "stu", 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 = armhybridconnectivity.SolutionConfigurationsClientDeleteResponse{ + // } +} + +// Generated from example definition: 2024-12-01/SolutionConfigurations_Get.json +func ExampleSolutionConfigurationsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhybridconnectivity.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSolutionConfigurationsClient().Get(ctx, "ymuj", "tks", 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 = armhybridconnectivity.SolutionConfigurationsClientGetResponse{ + // SolutionConfiguration: &armhybridconnectivity.SolutionConfiguration{ + // Properties: &armhybridconnectivity.SolutionConfigurationProperties{ + // SolutionType: to.Ptr("nmtqllkyohwtsthxaimsye"), + // SolutionSettings: &armhybridconnectivity.SolutionSettings{ + // }, + // ProvisioningState: to.Ptr(armhybridconnectivity.ResourceProvisioningStateSucceeded), + // Status: to.Ptr(armhybridconnectivity.SolutionConfigurationStatusNew), + // StatusDetails: to.Ptr("rqbrzildwecankrpukkbjjqrczxboz"), + // LastSyncTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-20T03:24:15.820Z"); return t}()), + // }, + // ID: to.Ptr("/subscriptions/testSubcrptions/resourceGroups/testResourceGroup/providers/Microsoft.HybridConnectivity/SolutionConfigurations/qpwubemzmootxmtlxaerir"), + // Name: to.Ptr("qpwubemzmootxmtlxaerir"), + // Type: to.Ptr("uknrk"), + // SystemData: &armhybridconnectivity.SystemData{ + // CreatedBy: to.Ptr("rpxzkcrobprrdvuoqxz"), + // CreatedByType: to.Ptr(armhybridconnectivity.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-18T22:52:07.890Z"); return t}()), + // LastModifiedBy: to.Ptr("jidegyskxi"), + // LastModifiedByType: to.Ptr(armhybridconnectivity.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-18T22:52:07.890Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2024-12-01/SolutionConfigurations_List.json +func ExampleSolutionConfigurationsClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhybridconnectivity.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewSolutionConfigurationsClient().NewListPager("ymuj", 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 = armhybridconnectivity.SolutionConfigurationsClientListResponse{ + // SolutionConfigurationListResult: armhybridconnectivity.SolutionConfigurationListResult{ + // Value: []*armhybridconnectivity.SolutionConfiguration{ + // { + // Properties: &armhybridconnectivity.SolutionConfigurationProperties{ + // SolutionType: to.Ptr("Microsoft.AssetManagement"), + // SolutionSettings: &armhybridconnectivity.SolutionSettings{ + // }, + // ProvisioningState: to.Ptr(armhybridconnectivity.ResourceProvisioningStateSucceeded), + // StatusDetails: to.Ptr("Aws authorization validation pending in Aws account"), + // LastSyncTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-20T03:24:15.820Z"); return t}()), + // }, + // ID: to.Ptr("/subscriptions/testSubcrptions/resourceGroups/testResourceGroup/providers/Microsoft.HybridConnectivity/SolutionConfigurations/solutionconfigurationtest"), + // Name: to.Ptr("solutionconfigurationtest"), + // Type: to.Ptr("microsoft.hybridconnectivity/solutionconfigurations"), + // SystemData: &armhybridconnectivity.SystemData{ + // CreatedBy: to.Ptr("rpxzkcrobprrdvuoqxz"), + // CreatedByType: to.Ptr(armhybridconnectivity.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-18T22:52:07.890Z"); return t}()), + // LastModifiedBy: to.Ptr("jidegyskxi"), + // LastModifiedByType: to.Ptr(armhybridconnectivity.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-18T22:52:07.890Z"); return t}()), + // }, + // }, + // { + // Properties: &armhybridconnectivity.SolutionConfigurationProperties{ + // SolutionType: to.Ptr("Microsoft.HybridCompute"), + // SolutionSettings: &armhybridconnectivity.SolutionSettings{ + // }, + // ProvisioningState: to.Ptr(armhybridconnectivity.ResourceProvisioningStateSucceeded), + // StatusDetails: to.Ptr("Aws authorization validation succeeded in Aws account"), + // LastSyncTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-20T03:24:15.820Z"); return t}()), + // }, + // ID: to.Ptr("/subscriptions/testSubcrptions/resourceGroups/testResourceGroup/providers/Microsoft.HybridConnectivity/SolutionConfigurations/solutionconfigurationtest2"), + // Name: to.Ptr("solutionconfigurationtest2"), + // Type: to.Ptr("microsoft.hybridconnectivity/solutionconfigurations"), + // SystemData: &armhybridconnectivity.SystemData{ + // CreatedBy: to.Ptr("rpxzkcrobprrdvuoqxz"), + // CreatedByType: to.Ptr(armhybridconnectivity.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-18T22:52:07.890Z"); return t}()), + // LastModifiedBy: to.Ptr("jidegyskxi"), + // LastModifiedByType: to.Ptr(armhybridconnectivity.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-18T22:52:07.890Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} + +// Generated from example definition: 2024-12-01/SolutionConfigurations_SyncNow.json +func ExampleSolutionConfigurationsClient_BeginSyncNow() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhybridconnectivity.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSolutionConfigurationsClient().BeginSyncNow(ctx, "ymuj", "tks", 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 = armhybridconnectivity.SolutionConfigurationsClientSyncNowResponse{ + // OperationStatusResult: &armhybridconnectivity.OperationStatusResult{ + // ID: to.Ptr("/subscriptions/5ACC4579-DB34-4C2F-8F8C-25061168F342/providers/Microsoft.HybridConnectivity/PublicCloudConnectors/esixipkbydb"), + // Name: to.Ptr("svqtraeuwvyvblujlvqilypwpdrt"), + // Status: to.Ptr("bevmrejij"), + // PercentComplete: to.Ptr[float64](15), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-10-02T18:38:19.143Z"); return t}()), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-10-02T18:38:19.143Z"); return t}()), + // Operations: []*armhybridconnectivity.OperationStatusResult{ + // }, + // Error: &armhybridconnectivity.ErrorDetail{ + // Code: to.Ptr("ykzvluyqiftfsumgvwzdh"), + // Message: to.Ptr("krbjgtqkjgiux"), + // Target: to.Ptr("nsaucxt"), + // Details: []*armhybridconnectivity.ErrorDetail{ + // }, + // AdditionalInfo: []*armhybridconnectivity.ErrorAdditionalInfo{ + // { + // Type: to.Ptr("qivvrewsjvcildjgwwytgimwklh"), + // Info: &armhybridconnectivity.ErrorAdditionalInfoInfo{ + // }, + // }, + // }, + // }, + // }, + // } +} + +// Generated from example definition: 2024-12-01/SolutionConfigurations_Update.json +func ExampleSolutionConfigurationsClient_Update() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhybridconnectivity.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSolutionConfigurationsClient().Update(ctx, "ymuj", "dxt", armhybridconnectivity.SolutionConfiguration{ + Properties: &armhybridconnectivity.SolutionConfigurationProperties{ + SolutionType: to.Ptr("myzljlstvmgkp"), + SolutionSettings: &armhybridconnectivity.SolutionSettings{}, + }, + }, 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 = armhybridconnectivity.SolutionConfigurationsClientUpdateResponse{ + // SolutionConfiguration: &armhybridconnectivity.SolutionConfiguration{ + // Properties: &armhybridconnectivity.SolutionConfigurationProperties{ + // SolutionType: to.Ptr("nmtqllkyohwtsthxaimsye"), + // SolutionSettings: &armhybridconnectivity.SolutionSettings{ + // }, + // ProvisioningState: to.Ptr(armhybridconnectivity.ResourceProvisioningStateSucceeded), + // Status: to.Ptr(armhybridconnectivity.SolutionConfigurationStatusNew), + // StatusDetails: to.Ptr("rqbrzildwecankrpukkbjjqrczxboz"), + // LastSyncTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-20T03:24:15.820Z"); return t}()), + // }, + // ID: to.Ptr("/subscriptions/testSubcrptions/resourceGroups/testResourceGroup/providers/Microsoft.HybridConnectivity/SolutionConfigurations/qpwubemzmootxmtlxaerir"), + // Name: to.Ptr("qpwubemzmootxmtlxaerir"), + // Type: to.Ptr("uknrk"), + // SystemData: &armhybridconnectivity.SystemData{ + // CreatedBy: to.Ptr("rpxzkcrobprrdvuoqxz"), + // CreatedByType: to.Ptr(armhybridconnectivity.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-18T22:52:07.890Z"); return t}()), + // LastModifiedBy: to.Ptr("jidegyskxi"), + // LastModifiedByType: to.Ptr(armhybridconnectivity.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-18T22:52:07.890Z"); return t}()), + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/solutiontypes_client.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/solutiontypes_client.go new file mode 100644 index 000000000000..41a56f3d87f7 --- /dev/null +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/solutiontypes_client.go @@ -0,0 +1,219 @@ +// 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 armhybridconnectivity + +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" +) + +// SolutionTypesClient contains the methods for the SolutionTypes group. +// Don't use this type directly, use NewSolutionTypesClient() instead. +type SolutionTypesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewSolutionTypesClient creates a new instance of SolutionTypesClient 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 NewSolutionTypesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SolutionTypesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SolutionTypesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Get a SolutionTypeResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-12-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - solutionType - Solution Type resource +// - options - SolutionTypesClientGetOptions contains the optional parameters for the SolutionTypesClient.Get method. +func (client *SolutionTypesClient) Get(ctx context.Context, resourceGroupName string, solutionType string, options *SolutionTypesClientGetOptions) (SolutionTypesClientGetResponse, error) { + var err error + const operationName = "SolutionTypesClient.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, solutionType, options) + if err != nil { + return SolutionTypesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SolutionTypesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SolutionTypesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *SolutionTypesClient) getCreateRequest(ctx context.Context, resourceGroupName string, solutionType string, _ *SolutionTypesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/solutionTypes/{solutionType}" + 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 solutionType == "" { + return nil, errors.New("parameter solutionType cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{solutionType}", url.PathEscape(solutionType)) + 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-12-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *SolutionTypesClient) getHandleResponse(resp *http.Response) (SolutionTypesClientGetResponse, error) { + result := SolutionTypesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SolutionTypeResource); err != nil { + return SolutionTypesClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - List SolutionTypeResource resources by resource group +// +// Generated from API version 2024-12-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - SolutionTypesClientListByResourceGroupOptions contains the optional parameters for the SolutionTypesClient.NewListByResourceGroupPager +// method. +func (client *SolutionTypesClient) NewListByResourceGroupPager(resourceGroupName string, options *SolutionTypesClientListByResourceGroupOptions) *runtime.Pager[SolutionTypesClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[SolutionTypesClientListByResourceGroupResponse]{ + More: func(page SolutionTypesClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SolutionTypesClientListByResourceGroupResponse) (SolutionTypesClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SolutionTypesClient.NewListByResourceGroupPager") + 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.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return SolutionTypesClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *SolutionTypesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *SolutionTypesClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/solutionTypes" + 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)) + 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-12-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *SolutionTypesClient) listByResourceGroupHandleResponse(resp *http.Response) (SolutionTypesClientListByResourceGroupResponse, error) { + result := SolutionTypesClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SolutionTypeResourceListResult); err != nil { + return SolutionTypesClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - List SolutionTypeResource resources by subscription ID +// +// Generated from API version 2024-12-01 +// - options - SolutionTypesClientListBySubscriptionOptions contains the optional parameters for the SolutionTypesClient.NewListBySubscriptionPager +// method. +func (client *SolutionTypesClient) NewListBySubscriptionPager(options *SolutionTypesClientListBySubscriptionOptions) *runtime.Pager[SolutionTypesClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[SolutionTypesClientListBySubscriptionResponse]{ + More: func(page SolutionTypesClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SolutionTypesClientListBySubscriptionResponse) (SolutionTypesClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SolutionTypesClient.NewListBySubscriptionPager") + 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.listBySubscriptionCreateRequest(ctx, options) + }, nil) + if err != nil { + return SolutionTypesClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *SolutionTypesClient) listBySubscriptionCreateRequest(ctx context.Context, _ *SolutionTypesClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.HybridConnectivity/solutionTypes" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + 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-12-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *SolutionTypesClient) listBySubscriptionHandleResponse(resp *http.Response) (SolutionTypesClientListBySubscriptionResponse, error) { + result := SolutionTypesClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SolutionTypeResourceListResult); err != nil { + return SolutionTypesClientListBySubscriptionResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/solutiontypes_client_example_test.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/solutiontypes_client_example_test.go new file mode 100644 index 000000000000..6624be46c314 --- /dev/null +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/solutiontypes_client_example_test.go @@ -0,0 +1,194 @@ +// 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 armhybridconnectivity_test + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/v2" + "log" +) + +// Generated from example definition: 2024-12-01/SolutionTypes_Get.json +func ExampleSolutionTypesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhybridconnectivity.NewClientFactory("5ACC4579-DB34-4C2F-8F8C-25061168F342", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSolutionTypesClient().Get(ctx, "rgpublicCloud", "lulzqllpu", 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 = armhybridconnectivity.SolutionTypesClientGetResponse{ + // SolutionTypeResource: &armhybridconnectivity.SolutionTypeResource{ + // Properties: &armhybridconnectivity.SolutionTypeProperties{ + // SolutionType: to.Ptr("tjtoeycxhyqxtgd"), + // Description: to.Ptr("wxyxcvtzuxgodtlanjevedwfdwnznc"), + // SupportedAzureRegions: []*string{ + // to.Ptr("cimocdh"), + // }, + // SolutionSettings: []*armhybridconnectivity.SolutionTypeSettingsProperties{ + // { + // Name: to.Ptr("tepghdgbefujhnnue"), + // DisplayName: to.Ptr("mwlzepoin"), + // Type: to.Ptr("je"), + // Description: to.Ptr("soq"), + // AllowedValues: []*string{ + // to.Ptr("pwizyngpkpxsllpluffjspx"), + // }, + // DefaultValue: to.Ptr("laekyetgapdpxyqervqaqfscfwagek"), + // }, + // }, + // }, + // ID: to.Ptr("/subscriptions/testSubcrptions/resourceGroups/testResourceGroup/providers/Microsoft.HybridConnectivity/solutionTypes/j"), + // Name: to.Ptr("xczyyxuphhacyyj"), + // Type: to.Ptr("mf"), + // SystemData: &armhybridconnectivity.SystemData{ + // CreatedBy: to.Ptr("rpxzkcrobprrdvuoqxz"), + // CreatedByType: to.Ptr(armhybridconnectivity.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-18T22:52:07.890Z"); return t}()), + // LastModifiedBy: to.Ptr("jidegyskxi"), + // LastModifiedByType: to.Ptr(armhybridconnectivity.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-18T22:52:07.890Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2024-12-01/SolutionTypes_ListByResourceGroup.json +func ExampleSolutionTypesClient_NewListByResourceGroupPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhybridconnectivity.NewClientFactory("5ACC4579-DB34-4C2F-8F8C-25061168F342", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewSolutionTypesClient().NewListByResourceGroupPager("rgpublicCloud", 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 = armhybridconnectivity.SolutionTypesClientListByResourceGroupResponse{ + // SolutionTypeResourceListResult: armhybridconnectivity.SolutionTypeResourceListResult{ + // Value: []*armhybridconnectivity.SolutionTypeResource{ + // { + // Properties: &armhybridconnectivity.SolutionTypeProperties{ + // SolutionType: to.Ptr("j"), + // Description: to.Ptr("mhasmuazxsr"), + // SupportedAzureRegions: []*string{ + // to.Ptr("jfvkgljymtuzfwbumgabpdpjjnxit"), + // }, + // SolutionSettings: []*armhybridconnectivity.SolutionTypeSettingsProperties{ + // { + // Name: to.Ptr("eepvybtmsjwgcpf"), + // DisplayName: to.Ptr("npxunbwkjrklbjsvdryzsjtecm"), + // Type: to.Ptr("fngmzlffmwmrglepeyce"), + // Description: to.Ptr("vdtvoysdagvae"), + // AllowedValues: []*string{ + // to.Ptr("cgbkgbmsgsfofmcrjerg"), + // }, + // DefaultValue: to.Ptr("knshmo"), + // }, + // }, + // }, + // ID: to.Ptr("/subscriptions/testSubcrptions/resourceGroups/testResourceGroup/providers/Microsoft.HybridConnectivity/solutionTypes/j"), + // Name: to.Ptr("yzgpvbtzwvijawjgfvnhgbqefqq"), + // Type: to.Ptr("vamwfnqqpjosjnomwbkwnlnrg"), + // SystemData: &armhybridconnectivity.SystemData{ + // CreatedBy: to.Ptr("rpxzkcrobprrdvuoqxz"), + // CreatedByType: to.Ptr(armhybridconnectivity.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-18T22:52:07.890Z"); return t}()), + // LastModifiedBy: to.Ptr("jidegyskxi"), + // LastModifiedByType: to.Ptr(armhybridconnectivity.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-18T22:52:07.890Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} + +// Generated from example definition: 2024-12-01/SolutionTypes_ListBySubscription.json +func ExampleSolutionTypesClient_NewListBySubscriptionPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhybridconnectivity.NewClientFactory("5ACC4579-DB34-4C2F-8F8C-25061168F342", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewSolutionTypesClient().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 = armhybridconnectivity.SolutionTypesClientListBySubscriptionResponse{ + // SolutionTypeResourceListResult: armhybridconnectivity.SolutionTypeResourceListResult{ + // Value: []*armhybridconnectivity.SolutionTypeResource{ + // { + // Properties: &armhybridconnectivity.SolutionTypeProperties{ + // SolutionType: to.Ptr("dembhpcydwoiyszmjtniletpy"), + // Description: to.Ptr("fkegiumpjdwgkde"), + // SupportedAzureRegions: []*string{ + // to.Ptr("ujawbfint"), + // }, + // SolutionSettings: []*armhybridconnectivity.SolutionTypeSettingsProperties{ + // { + // Name: to.Ptr("i"), + // DisplayName: to.Ptr("forzmqskffaub"), + // Type: to.Ptr("d"), + // Description: to.Ptr("cbyxsxfsaye"), + // AllowedValues: []*string{ + // to.Ptr("uecqnmmssdeusxejcxrtkskfugvl"), + // }, + // DefaultValue: to.Ptr("uzwiymoxrummkoowwvzjhyazeavzr"), + // }, + // }, + // }, + // ID: to.Ptr("/subscriptions/testSubcrptions/resourceGroups/testResourceGroup/providers/Microsoft.HybridConnectivity/solutionTypes/i"), + // Name: to.Ptr("jtlxwihbuftmaobxfmfjojalhpwrv"), + // Type: to.Ptr("zditfautattfhnffvjw"), + // SystemData: &armhybridconnectivity.SystemData{ + // CreatedBy: to.Ptr("rpxzkcrobprrdvuoqxz"), + // CreatedByType: to.Ptr(armhybridconnectivity.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-18T22:52:07.890Z"); return t}()), + // LastModifiedBy: to.Ptr("jidegyskxi"), + // LastModifiedByType: to.Ptr(armhybridconnectivity.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-18T22:52:07.890Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/time_rfc3339.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/time_rfc3339.go index 6bb38b46697d..a973c25378da 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/time_rfc3339.go +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/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 armhybridconnectivity @@ -19,12 +15,16 @@ import ( ) // Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. -var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) const ( - utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` - utcDateTime = "2006-01-02T15:04:05.999999999" - dateTimeJSON = `"` + time.RFC3339Nano + `"` + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` ) type dateTimeRFC3339 time.Time @@ -40,17 +40,36 @@ func (t dateTimeRFC3339) MarshalText() ([]byte, error) { } func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcDateTimeJSON - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT } return t.Parse(layout, string(data)) } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - layout := utcDateTime - if tzOffsetRegex.Match(data) { + if len(data) == 0 { + return nil + } + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT } return t.Parse(layout, string(data)) } @@ -61,6 +80,10 @@ func (t *dateTimeRFC3339) Parse(layout, value string) error { return err } +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return @@ -74,7 +97,7 @@ func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { } func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { + if data == nil || string(data) == "null" { return nil } var aux dateTimeRFC3339 diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/tsp-location.yaml b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/tsp-location.yaml new file mode 100644 index 000000000000..c022da5059c1 --- /dev/null +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/hybridconnectivity/PublicCloud.Management +commit: 405438c72094a0a43fbcba18a56aa71110b78db8 +repo: Azure/azure-rest-api-specs +additionalDirectories: \ No newline at end of file diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/CHANGELOG.md b/sdk/resourcemanager/iotoperations/armiotoperations/CHANGELOG.md index d68fe58cc2ef..b18433b8fba8 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/CHANGELOG.md +++ b/sdk/resourcemanager/iotoperations/armiotoperations/CHANGELOG.md @@ -1,5 +1,15 @@ # Release History +## 1.0.0 (2024-11-29) +### Breaking Changes + +- `ManagedServiceIdentityTypeSystemAndUserAssigned` from enum `ManagedServiceIdentityType` has been removed + +### Features Added + +- New value `ManagedServiceIdentityTypeSystemAssignedUserAssigned` added to enum type `ManagedServiceIdentityType` + + ## 0.1.0 (2024-10-24) ### Other Changes diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/constants.go b/sdk/resourcemanager/iotoperations/armiotoperations/constants.go index 016557525542..1cf40a4b83ed 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/constants.go +++ b/sdk/resourcemanager/iotoperations/armiotoperations/constants.go @@ -6,7 +6,7 @@ package armiotoperations const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iotoperations/armiotoperations" - moduleVersion = "v0.1.0" + moduleVersion = "v1.0.0" ) // ActionType - Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. @@ -454,10 +454,10 @@ type ManagedServiceIdentityType string const ( // ManagedServiceIdentityTypeNone - No managed identity. ManagedServiceIdentityTypeNone ManagedServiceIdentityType = "None" - // ManagedServiceIdentityTypeSystemAndUserAssigned - System and user assigned managed identity. - ManagedServiceIdentityTypeSystemAndUserAssigned ManagedServiceIdentityType = "SystemAssigned,UserAssigned" // ManagedServiceIdentityTypeSystemAssigned - System assigned managed identity. ManagedServiceIdentityTypeSystemAssigned ManagedServiceIdentityType = "SystemAssigned" + // ManagedServiceIdentityTypeSystemAssignedUserAssigned - System and user assigned managed identity. + ManagedServiceIdentityTypeSystemAssignedUserAssigned ManagedServiceIdentityType = "SystemAssigned,UserAssigned" // ManagedServiceIdentityTypeUserAssigned - User assigned managed identity. ManagedServiceIdentityTypeUserAssigned ManagedServiceIdentityType = "UserAssigned" ) @@ -466,8 +466,8 @@ const ( func PossibleManagedServiceIdentityTypeValues() []ManagedServiceIdentityType { return []ManagedServiceIdentityType{ ManagedServiceIdentityTypeNone, - ManagedServiceIdentityTypeSystemAndUserAssigned, ManagedServiceIdentityTypeSystemAssigned, + ManagedServiceIdentityTypeSystemAssignedUserAssigned, ManagedServiceIdentityTypeUserAssigned, } } diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/dataflowendpoint_client_example_test.go b/sdk/resourcemanager/iotoperations/armiotoperations/dataflowendpoint_client_example_test.go index 804413411bf4..3bd088772c39 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/dataflowendpoint_client_example_test.go +++ b/sdk/resourcemanager/iotoperations/armiotoperations/dataflowendpoint_client_example_test.go @@ -646,6 +646,99 @@ func ExampleDataflowEndpointClient_BeginCreateOrUpdate_dataflowEndpointCreateOrU // } } +// Generated from example definition: 2024-11-01/DataflowEndpoint_CreateOrUpdate_MQTT.json +func ExampleDataflowEndpointClient_BeginCreateOrUpdate_dataflowEndpointCreateOrUpdateMqtt() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armiotoperations.NewClientFactory("F8C729F9-DF9C-4743-848F-96EE433D8E53", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewDataflowEndpointClient().BeginCreateOrUpdate(ctx, "rgiotoperations", "resource-name123", "generic-mqtt-broker-endpoint", armiotoperations.DataflowEndpointResource{ + Properties: &armiotoperations.DataflowEndpointProperties{ + EndpointType: to.Ptr(armiotoperations.EndpointTypeMqtt), + MqttSettings: &armiotoperations.DataflowEndpointMqtt{ + Host: to.Ptr("example.broker.local:1883"), + Authentication: &armiotoperations.DataflowEndpointMqttAuthentication{ + Method: to.Ptr(armiotoperations.MqttAuthMethodX509Certificate), + X509CertificateSettings: &armiotoperations.DataflowEndpointAuthenticationX509{ + SecretRef: to.Ptr("example-secret"), + }, + }, + TLS: &armiotoperations.TLSProperties{ + Mode: to.Ptr(armiotoperations.OperationalModeDisabled), + }, + ClientIDPrefix: to.Ptr("factory-gateway"), + Retain: to.Ptr(armiotoperations.MqttRetainTypeKeep), + SessionExpirySeconds: to.Ptr[int32](3600), + Qos: to.Ptr[int32](1), + Protocol: to.Ptr(armiotoperations.BrokerProtocolTypeWebSockets), + MaxInflightMessages: to.Ptr[int32](100), + KeepAliveSeconds: to.Ptr[int32](60), + }, + }, + ExtendedLocation: &armiotoperations.ExtendedLocation{ + Name: to.Ptr("qmbrfwcpwwhggszhrdjv"), + Type: to.Ptr(armiotoperations.ExtendedLocationTypeCustomLocation), + }, + }, 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 = armiotoperations.DataflowEndpointClientCreateOrUpdateResponse{ + // DataflowEndpointResource: &armiotoperations.DataflowEndpointResource{ + // Properties: &armiotoperations.DataflowEndpointProperties{ + // EndpointType: to.Ptr(armiotoperations.EndpointTypeMqtt), + // MqttSettings: &armiotoperations.DataflowEndpointMqtt{ + // Host: to.Ptr("example.broker.local:1883"), + // Authentication: &armiotoperations.DataflowEndpointMqttAuthentication{ + // Method: to.Ptr(armiotoperations.MqttAuthMethodX509Certificate), + // X509CertificateSettings: &armiotoperations.DataflowEndpointAuthenticationX509{ + // SecretRef: to.Ptr("example-secret"), + // }, + // }, + // TLS: &armiotoperations.TLSProperties{ + // Mode: to.Ptr(armiotoperations.OperationalModeDisabled), + // }, + // ClientIDPrefix: to.Ptr("factory-gateway"), + // Retain: to.Ptr(armiotoperations.MqttRetainTypeKeep), + // SessionExpirySeconds: to.Ptr[int32](3600), + // Qos: to.Ptr[int32](1), + // Protocol: to.Ptr(armiotoperations.BrokerProtocolTypeWebSockets), + // MaxInflightMessages: to.Ptr[int32](100), + // KeepAliveSeconds: to.Ptr[int32](60), + // }, + // ProvisioningState: to.Ptr(armiotoperations.ProvisioningStateSucceeded), + // }, + // ExtendedLocation: &armiotoperations.ExtendedLocation{ + // Name: to.Ptr("qmbrfwcpwwhggszhrdjv"), + // Type: to.Ptr(armiotoperations.ExtendedLocationTypeCustomLocation), + // }, + // ID: to.Ptr("/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123/dataflowEndpoints/resource-name123"), + // Name: to.Ptr("zyhxscudobzfacetvgyjiav"), + // Type: to.Ptr("iay"), + // SystemData: &armiotoperations.SystemData{ + // CreatedBy: to.Ptr("ssvaslsmudloholronopqyxjcu"), + // CreatedByType: to.Ptr(armiotoperations.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()), + // LastModifiedBy: to.Ptr("gnicpuszwd"), + // LastModifiedByType: to.Ptr(armiotoperations.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()), + // }, + // }, + // } +} + // Generated from example definition: 2024-11-01/DataflowEndpoint_CreateOrUpdate_MaximumSet_Gen.json func ExampleDataflowEndpointClient_BeginCreateOrUpdate_dataflowEndpointCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) @@ -967,99 +1060,6 @@ func ExampleDataflowEndpointClient_BeginCreateOrUpdate_dataflowEndpointCreateOrU // } } -// Generated from example definition: 2024-11-01/DataflowEndpoint_CreateOrUpdate_MQTT.json -func ExampleDataflowEndpointClient_BeginCreateOrUpdate_dataflowEndpointCreateOrUpdateMqtt() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armiotoperations.NewClientFactory("F8C729F9-DF9C-4743-848F-96EE433D8E53", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDataflowEndpointClient().BeginCreateOrUpdate(ctx, "rgiotoperations", "resource-name123", "generic-mqtt-broker-endpoint", armiotoperations.DataflowEndpointResource{ - Properties: &armiotoperations.DataflowEndpointProperties{ - EndpointType: to.Ptr(armiotoperations.EndpointTypeMqtt), - MqttSettings: &armiotoperations.DataflowEndpointMqtt{ - Host: to.Ptr("example.broker.local:1883"), - Authentication: &armiotoperations.DataflowEndpointMqttAuthentication{ - Method: to.Ptr(armiotoperations.MqttAuthMethodX509Certificate), - X509CertificateSettings: &armiotoperations.DataflowEndpointAuthenticationX509{ - SecretRef: to.Ptr("example-secret"), - }, - }, - TLS: &armiotoperations.TLSProperties{ - Mode: to.Ptr(armiotoperations.OperationalModeDisabled), - }, - ClientIDPrefix: to.Ptr("factory-gateway"), - Retain: to.Ptr(armiotoperations.MqttRetainTypeKeep), - SessionExpirySeconds: to.Ptr[int32](3600), - Qos: to.Ptr[int32](1), - Protocol: to.Ptr(armiotoperations.BrokerProtocolTypeWebSockets), - MaxInflightMessages: to.Ptr[int32](100), - KeepAliveSeconds: to.Ptr[int32](60), - }, - }, - ExtendedLocation: &armiotoperations.ExtendedLocation{ - Name: to.Ptr("qmbrfwcpwwhggszhrdjv"), - Type: to.Ptr(armiotoperations.ExtendedLocationTypeCustomLocation), - }, - }, 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 = armiotoperations.DataflowEndpointClientCreateOrUpdateResponse{ - // DataflowEndpointResource: &armiotoperations.DataflowEndpointResource{ - // Properties: &armiotoperations.DataflowEndpointProperties{ - // EndpointType: to.Ptr(armiotoperations.EndpointTypeMqtt), - // MqttSettings: &armiotoperations.DataflowEndpointMqtt{ - // Host: to.Ptr("example.broker.local:1883"), - // Authentication: &armiotoperations.DataflowEndpointMqttAuthentication{ - // Method: to.Ptr(armiotoperations.MqttAuthMethodX509Certificate), - // X509CertificateSettings: &armiotoperations.DataflowEndpointAuthenticationX509{ - // SecretRef: to.Ptr("example-secret"), - // }, - // }, - // TLS: &armiotoperations.TLSProperties{ - // Mode: to.Ptr(armiotoperations.OperationalModeDisabled), - // }, - // ClientIDPrefix: to.Ptr("factory-gateway"), - // Retain: to.Ptr(armiotoperations.MqttRetainTypeKeep), - // SessionExpirySeconds: to.Ptr[int32](3600), - // Qos: to.Ptr[int32](1), - // Protocol: to.Ptr(armiotoperations.BrokerProtocolTypeWebSockets), - // MaxInflightMessages: to.Ptr[int32](100), - // KeepAliveSeconds: to.Ptr[int32](60), - // }, - // ProvisioningState: to.Ptr(armiotoperations.ProvisioningStateSucceeded), - // }, - // ExtendedLocation: &armiotoperations.ExtendedLocation{ - // Name: to.Ptr("qmbrfwcpwwhggszhrdjv"), - // Type: to.Ptr(armiotoperations.ExtendedLocationTypeCustomLocation), - // }, - // ID: to.Ptr("/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123/dataflowEndpoints/resource-name123"), - // Name: to.Ptr("zyhxscudobzfacetvgyjiav"), - // Type: to.Ptr("iay"), - // SystemData: &armiotoperations.SystemData{ - // CreatedBy: to.Ptr("ssvaslsmudloholronopqyxjcu"), - // CreatedByType: to.Ptr(armiotoperations.CreatedByTypeUser), - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()), - // LastModifiedBy: to.Ptr("gnicpuszwd"), - // LastModifiedByType: to.Ptr(armiotoperations.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()), - // }, - // }, - // } -} - // Generated from example definition: 2024-11-01/DataflowEndpoint_Delete_MaximumSet_Gen.json func ExampleDataflowEndpointClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/fake/broker_server.go b/sdk/resourcemanager/iotoperations/armiotoperations/fake/broker_server.go index dffe57a392ac..67b5ac3a9a4e 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/fake/broker_server.go +++ b/sdk/resourcemanager/iotoperations/armiotoperations/fake/broker_server.go @@ -25,7 +25,7 @@ type BrokerServer struct { BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, resource armiotoperations.BrokerResource, options *armiotoperations.BrokerClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armiotoperations.BrokerClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method BrokerClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, options *armiotoperations.BrokerClientBeginDeleteOptions) (resp azfake.PollerResponder[armiotoperations.BrokerClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method BrokerClient.Get @@ -70,23 +70,42 @@ func (b *BrokerServerTransport) Do(req *http.Request) (*http.Response, error) { } func (b *BrokerServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error + resultChan := make(chan result) + defer close(resultChan) - switch method { - case "BrokerClient.BeginCreateOrUpdate": - resp, err = b.dispatchBeginCreateOrUpdate(req) - case "BrokerClient.BeginDelete": - resp, err = b.dispatchBeginDelete(req) - case "BrokerClient.Get": - resp, err = b.dispatchGet(req) - case "BrokerClient.NewListByResourceGroupPager": - resp, err = b.dispatchNewListByResourceGroupPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + go func() { + var intercepted bool + var res result + if brokerServerTransportInterceptor != nil { + res.resp, res.err, intercepted = brokerServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "BrokerClient.BeginCreateOrUpdate": + res.resp, res.err = b.dispatchBeginCreateOrUpdate(req) + case "BrokerClient.BeginDelete": + res.resp, res.err = b.dispatchBeginDelete(req) + case "BrokerClient.Get": + res.resp, res.err = b.dispatchGet(req) + case "BrokerClient.NewListByResourceGroupPager": + res.resp, res.err = b.dispatchNewListByResourceGroupPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() - return resp, err + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (b *BrokerServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -178,9 +197,9 @@ func (b *BrokerServerTransport) dispatchBeginDelete(req *http.Request) (*http.Re return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { b.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { b.beginDelete.remove(req) @@ -266,3 +285,9 @@ func (b *BrokerServerTransport) dispatchNewListByResourceGroupPager(req *http.Re } return resp, nil } + +// set this to conditionally intercept incoming requests to BrokerServerTransport +var brokerServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/fake/brokerauthentication_server.go b/sdk/resourcemanager/iotoperations/armiotoperations/fake/brokerauthentication_server.go index c5cead819a84..41db4c63b617 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/fake/brokerauthentication_server.go +++ b/sdk/resourcemanager/iotoperations/armiotoperations/fake/brokerauthentication_server.go @@ -25,7 +25,7 @@ type BrokerAuthenticationServer struct { BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, authenticationName string, resource armiotoperations.BrokerAuthenticationResource, options *armiotoperations.BrokerAuthenticationClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armiotoperations.BrokerAuthenticationClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method BrokerAuthenticationClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, authenticationName string, options *armiotoperations.BrokerAuthenticationClientBeginDeleteOptions) (resp azfake.PollerResponder[armiotoperations.BrokerAuthenticationClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method BrokerAuthenticationClient.Get @@ -70,23 +70,42 @@ func (b *BrokerAuthenticationServerTransport) Do(req *http.Request) (*http.Respo } func (b *BrokerAuthenticationServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error + resultChan := make(chan result) + defer close(resultChan) - switch method { - case "BrokerAuthenticationClient.BeginCreateOrUpdate": - resp, err = b.dispatchBeginCreateOrUpdate(req) - case "BrokerAuthenticationClient.BeginDelete": - resp, err = b.dispatchBeginDelete(req) - case "BrokerAuthenticationClient.Get": - resp, err = b.dispatchGet(req) - case "BrokerAuthenticationClient.NewListByResourceGroupPager": - resp, err = b.dispatchNewListByResourceGroupPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + go func() { + var intercepted bool + var res result + if brokerAuthenticationServerTransportInterceptor != nil { + res.resp, res.err, intercepted = brokerAuthenticationServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "BrokerAuthenticationClient.BeginCreateOrUpdate": + res.resp, res.err = b.dispatchBeginCreateOrUpdate(req) + case "BrokerAuthenticationClient.BeginDelete": + res.resp, res.err = b.dispatchBeginDelete(req) + case "BrokerAuthenticationClient.Get": + res.resp, res.err = b.dispatchGet(req) + case "BrokerAuthenticationClient.NewListByResourceGroupPager": + res.resp, res.err = b.dispatchNewListByResourceGroupPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() - return resp, err + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (b *BrokerAuthenticationServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -186,9 +205,9 @@ func (b *BrokerAuthenticationServerTransport) dispatchBeginDelete(req *http.Requ return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { b.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { b.beginDelete.remove(req) @@ -282,3 +301,9 @@ func (b *BrokerAuthenticationServerTransport) dispatchNewListByResourceGroupPage } return resp, nil } + +// set this to conditionally intercept incoming requests to BrokerAuthenticationServerTransport +var brokerAuthenticationServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/fake/brokerauthorization_server.go b/sdk/resourcemanager/iotoperations/armiotoperations/fake/brokerauthorization_server.go index 1ffe027e54a3..c7ab5780363d 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/fake/brokerauthorization_server.go +++ b/sdk/resourcemanager/iotoperations/armiotoperations/fake/brokerauthorization_server.go @@ -25,7 +25,7 @@ type BrokerAuthorizationServer struct { BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, authorizationName string, resource armiotoperations.BrokerAuthorizationResource, options *armiotoperations.BrokerAuthorizationClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armiotoperations.BrokerAuthorizationClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method BrokerAuthorizationClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, authorizationName string, options *armiotoperations.BrokerAuthorizationClientBeginDeleteOptions) (resp azfake.PollerResponder[armiotoperations.BrokerAuthorizationClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method BrokerAuthorizationClient.Get @@ -70,23 +70,42 @@ func (b *BrokerAuthorizationServerTransport) Do(req *http.Request) (*http.Respon } func (b *BrokerAuthorizationServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error + resultChan := make(chan result) + defer close(resultChan) - switch method { - case "BrokerAuthorizationClient.BeginCreateOrUpdate": - resp, err = b.dispatchBeginCreateOrUpdate(req) - case "BrokerAuthorizationClient.BeginDelete": - resp, err = b.dispatchBeginDelete(req) - case "BrokerAuthorizationClient.Get": - resp, err = b.dispatchGet(req) - case "BrokerAuthorizationClient.NewListByResourceGroupPager": - resp, err = b.dispatchNewListByResourceGroupPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + go func() { + var intercepted bool + var res result + if brokerAuthorizationServerTransportInterceptor != nil { + res.resp, res.err, intercepted = brokerAuthorizationServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "BrokerAuthorizationClient.BeginCreateOrUpdate": + res.resp, res.err = b.dispatchBeginCreateOrUpdate(req) + case "BrokerAuthorizationClient.BeginDelete": + res.resp, res.err = b.dispatchBeginDelete(req) + case "BrokerAuthorizationClient.Get": + res.resp, res.err = b.dispatchGet(req) + case "BrokerAuthorizationClient.NewListByResourceGroupPager": + res.resp, res.err = b.dispatchNewListByResourceGroupPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() - return resp, err + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (b *BrokerAuthorizationServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -186,9 +205,9 @@ func (b *BrokerAuthorizationServerTransport) dispatchBeginDelete(req *http.Reque return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { b.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { b.beginDelete.remove(req) @@ -282,3 +301,9 @@ func (b *BrokerAuthorizationServerTransport) dispatchNewListByResourceGroupPager } return resp, nil } + +// set this to conditionally intercept incoming requests to BrokerAuthorizationServerTransport +var brokerAuthorizationServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/fake/brokerlistener_server.go b/sdk/resourcemanager/iotoperations/armiotoperations/fake/brokerlistener_server.go index 7b627b35d6bd..3d1143862494 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/fake/brokerlistener_server.go +++ b/sdk/resourcemanager/iotoperations/armiotoperations/fake/brokerlistener_server.go @@ -25,7 +25,7 @@ type BrokerListenerServer struct { BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, listenerName string, resource armiotoperations.BrokerListenerResource, options *armiotoperations.BrokerListenerClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armiotoperations.BrokerListenerClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method BrokerListenerClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, listenerName string, options *armiotoperations.BrokerListenerClientBeginDeleteOptions) (resp azfake.PollerResponder[armiotoperations.BrokerListenerClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method BrokerListenerClient.Get @@ -70,23 +70,42 @@ func (b *BrokerListenerServerTransport) Do(req *http.Request) (*http.Response, e } func (b *BrokerListenerServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error + resultChan := make(chan result) + defer close(resultChan) - switch method { - case "BrokerListenerClient.BeginCreateOrUpdate": - resp, err = b.dispatchBeginCreateOrUpdate(req) - case "BrokerListenerClient.BeginDelete": - resp, err = b.dispatchBeginDelete(req) - case "BrokerListenerClient.Get": - resp, err = b.dispatchGet(req) - case "BrokerListenerClient.NewListByResourceGroupPager": - resp, err = b.dispatchNewListByResourceGroupPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + go func() { + var intercepted bool + var res result + if brokerListenerServerTransportInterceptor != nil { + res.resp, res.err, intercepted = brokerListenerServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "BrokerListenerClient.BeginCreateOrUpdate": + res.resp, res.err = b.dispatchBeginCreateOrUpdate(req) + case "BrokerListenerClient.BeginDelete": + res.resp, res.err = b.dispatchBeginDelete(req) + case "BrokerListenerClient.Get": + res.resp, res.err = b.dispatchGet(req) + case "BrokerListenerClient.NewListByResourceGroupPager": + res.resp, res.err = b.dispatchNewListByResourceGroupPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() - return resp, err + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (b *BrokerListenerServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -186,9 +205,9 @@ func (b *BrokerListenerServerTransport) dispatchBeginDelete(req *http.Request) ( return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { b.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { b.beginDelete.remove(req) @@ -282,3 +301,9 @@ func (b *BrokerListenerServerTransport) dispatchNewListByResourceGroupPager(req } return resp, nil } + +// set this to conditionally intercept incoming requests to BrokerListenerServerTransport +var brokerListenerServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/fake/dataflow_server.go b/sdk/resourcemanager/iotoperations/armiotoperations/fake/dataflow_server.go index 83806513fcd8..59cb0f102922 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/fake/dataflow_server.go +++ b/sdk/resourcemanager/iotoperations/armiotoperations/fake/dataflow_server.go @@ -25,7 +25,7 @@ type DataflowServer struct { BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, instanceName string, dataflowProfileName string, dataflowName string, resource armiotoperations.DataflowResource, options *armiotoperations.DataflowClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armiotoperations.DataflowClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method DataflowClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, instanceName string, dataflowProfileName string, dataflowName string, options *armiotoperations.DataflowClientBeginDeleteOptions) (resp azfake.PollerResponder[armiotoperations.DataflowClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method DataflowClient.Get @@ -70,23 +70,42 @@ func (d *DataflowServerTransport) Do(req *http.Request) (*http.Response, error) } func (d *DataflowServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error + resultChan := make(chan result) + defer close(resultChan) - switch method { - case "DataflowClient.BeginCreateOrUpdate": - resp, err = d.dispatchBeginCreateOrUpdate(req) - case "DataflowClient.BeginDelete": - resp, err = d.dispatchBeginDelete(req) - case "DataflowClient.Get": - resp, err = d.dispatchGet(req) - case "DataflowClient.NewListByResourceGroupPager": - resp, err = d.dispatchNewListByResourceGroupPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + go func() { + var intercepted bool + var res result + if dataflowServerTransportInterceptor != nil { + res.resp, res.err, intercepted = dataflowServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "DataflowClient.BeginCreateOrUpdate": + res.resp, res.err = d.dispatchBeginCreateOrUpdate(req) + case "DataflowClient.BeginDelete": + res.resp, res.err = d.dispatchBeginDelete(req) + case "DataflowClient.Get": + res.resp, res.err = d.dispatchGet(req) + case "DataflowClient.NewListByResourceGroupPager": + res.resp, res.err = d.dispatchNewListByResourceGroupPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() - return resp, err + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (d *DataflowServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -186,9 +205,9 @@ func (d *DataflowServerTransport) dispatchBeginDelete(req *http.Request) (*http. return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { d.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { d.beginDelete.remove(req) @@ -282,3 +301,9 @@ func (d *DataflowServerTransport) dispatchNewListByResourceGroupPager(req *http. } return resp, nil } + +// set this to conditionally intercept incoming requests to DataflowServerTransport +var dataflowServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/fake/dataflowendpoint_server.go b/sdk/resourcemanager/iotoperations/armiotoperations/fake/dataflowendpoint_server.go index d7494bf232d3..85e95d3fee3d 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/fake/dataflowendpoint_server.go +++ b/sdk/resourcemanager/iotoperations/armiotoperations/fake/dataflowendpoint_server.go @@ -25,7 +25,7 @@ type DataflowEndpointServer struct { BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, instanceName string, dataflowEndpointName string, resource armiotoperations.DataflowEndpointResource, options *armiotoperations.DataflowEndpointClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armiotoperations.DataflowEndpointClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method DataflowEndpointClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, instanceName string, dataflowEndpointName string, options *armiotoperations.DataflowEndpointClientBeginDeleteOptions) (resp azfake.PollerResponder[armiotoperations.DataflowEndpointClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method DataflowEndpointClient.Get @@ -70,23 +70,42 @@ func (d *DataflowEndpointServerTransport) Do(req *http.Request) (*http.Response, } func (d *DataflowEndpointServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error + resultChan := make(chan result) + defer close(resultChan) - switch method { - case "DataflowEndpointClient.BeginCreateOrUpdate": - resp, err = d.dispatchBeginCreateOrUpdate(req) - case "DataflowEndpointClient.BeginDelete": - resp, err = d.dispatchBeginDelete(req) - case "DataflowEndpointClient.Get": - resp, err = d.dispatchGet(req) - case "DataflowEndpointClient.NewListByResourceGroupPager": - resp, err = d.dispatchNewListByResourceGroupPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + go func() { + var intercepted bool + var res result + if dataflowEndpointServerTransportInterceptor != nil { + res.resp, res.err, intercepted = dataflowEndpointServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "DataflowEndpointClient.BeginCreateOrUpdate": + res.resp, res.err = d.dispatchBeginCreateOrUpdate(req) + case "DataflowEndpointClient.BeginDelete": + res.resp, res.err = d.dispatchBeginDelete(req) + case "DataflowEndpointClient.Get": + res.resp, res.err = d.dispatchGet(req) + case "DataflowEndpointClient.NewListByResourceGroupPager": + res.resp, res.err = d.dispatchNewListByResourceGroupPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() - return resp, err + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (d *DataflowEndpointServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -178,9 +197,9 @@ func (d *DataflowEndpointServerTransport) dispatchBeginDelete(req *http.Request) return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { d.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { d.beginDelete.remove(req) @@ -266,3 +285,9 @@ func (d *DataflowEndpointServerTransport) dispatchNewListByResourceGroupPager(re } return resp, nil } + +// set this to conditionally intercept incoming requests to DataflowEndpointServerTransport +var dataflowEndpointServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/fake/dataflowprofile_server.go b/sdk/resourcemanager/iotoperations/armiotoperations/fake/dataflowprofile_server.go index 429d7d167583..6d0d4c67b302 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/fake/dataflowprofile_server.go +++ b/sdk/resourcemanager/iotoperations/armiotoperations/fake/dataflowprofile_server.go @@ -25,7 +25,7 @@ type DataflowProfileServer struct { BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, instanceName string, dataflowProfileName string, resource armiotoperations.DataflowProfileResource, options *armiotoperations.DataflowProfileClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armiotoperations.DataflowProfileClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method DataflowProfileClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, instanceName string, dataflowProfileName string, options *armiotoperations.DataflowProfileClientBeginDeleteOptions) (resp azfake.PollerResponder[armiotoperations.DataflowProfileClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method DataflowProfileClient.Get @@ -70,23 +70,42 @@ func (d *DataflowProfileServerTransport) Do(req *http.Request) (*http.Response, } func (d *DataflowProfileServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error + resultChan := make(chan result) + defer close(resultChan) - switch method { - case "DataflowProfileClient.BeginCreateOrUpdate": - resp, err = d.dispatchBeginCreateOrUpdate(req) - case "DataflowProfileClient.BeginDelete": - resp, err = d.dispatchBeginDelete(req) - case "DataflowProfileClient.Get": - resp, err = d.dispatchGet(req) - case "DataflowProfileClient.NewListByResourceGroupPager": - resp, err = d.dispatchNewListByResourceGroupPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + go func() { + var intercepted bool + var res result + if dataflowProfileServerTransportInterceptor != nil { + res.resp, res.err, intercepted = dataflowProfileServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "DataflowProfileClient.BeginCreateOrUpdate": + res.resp, res.err = d.dispatchBeginCreateOrUpdate(req) + case "DataflowProfileClient.BeginDelete": + res.resp, res.err = d.dispatchBeginDelete(req) + case "DataflowProfileClient.Get": + res.resp, res.err = d.dispatchGet(req) + case "DataflowProfileClient.NewListByResourceGroupPager": + res.resp, res.err = d.dispatchNewListByResourceGroupPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() - return resp, err + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (d *DataflowProfileServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -178,9 +197,9 @@ func (d *DataflowProfileServerTransport) dispatchBeginDelete(req *http.Request) return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { d.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { d.beginDelete.remove(req) @@ -266,3 +285,9 @@ func (d *DataflowProfileServerTransport) dispatchNewListByResourceGroupPager(req } return resp, nil } + +// set this to conditionally intercept incoming requests to DataflowProfileServerTransport +var dataflowProfileServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/fake/instance_server.go b/sdk/resourcemanager/iotoperations/armiotoperations/fake/instance_server.go index ed9ccd09a6d9..8f398c784034 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/fake/instance_server.go +++ b/sdk/resourcemanager/iotoperations/armiotoperations/fake/instance_server.go @@ -25,7 +25,7 @@ type InstanceServer struct { BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, instanceName string, resource armiotoperations.InstanceResource, options *armiotoperations.InstanceClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armiotoperations.InstanceClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method InstanceClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, instanceName string, options *armiotoperations.InstanceClientBeginDeleteOptions) (resp azfake.PollerResponder[armiotoperations.InstanceClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method InstanceClient.Get @@ -80,27 +80,46 @@ func (i *InstanceServerTransport) Do(req *http.Request) (*http.Response, error) } func (i *InstanceServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error + resultChan := make(chan result) + defer close(resultChan) - switch method { - case "InstanceClient.BeginCreateOrUpdate": - resp, err = i.dispatchBeginCreateOrUpdate(req) - case "InstanceClient.BeginDelete": - resp, err = i.dispatchBeginDelete(req) - case "InstanceClient.Get": - resp, err = i.dispatchGet(req) - case "InstanceClient.NewListByResourceGroupPager": - resp, err = i.dispatchNewListByResourceGroupPager(req) - case "InstanceClient.NewListBySubscriptionPager": - resp, err = i.dispatchNewListBySubscriptionPager(req) - case "InstanceClient.Update": - resp, err = i.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + go func() { + var intercepted bool + var res result + if instanceServerTransportInterceptor != nil { + res.resp, res.err, intercepted = instanceServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "InstanceClient.BeginCreateOrUpdate": + res.resp, res.err = i.dispatchBeginCreateOrUpdate(req) + case "InstanceClient.BeginDelete": + res.resp, res.err = i.dispatchBeginDelete(req) + case "InstanceClient.Get": + res.resp, res.err = i.dispatchGet(req) + case "InstanceClient.NewListByResourceGroupPager": + res.resp, res.err = i.dispatchNewListByResourceGroupPager(req) + case "InstanceClient.NewListBySubscriptionPager": + res.resp, res.err = i.dispatchNewListBySubscriptionPager(req) + case "InstanceClient.Update": + res.resp, res.err = i.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() - return resp, err + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (i *InstanceServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -184,9 +203,9 @@ func (i *InstanceServerTransport) dispatchBeginDelete(req *http.Request) (*http. return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { i.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { i.beginDelete.remove(req) @@ -334,3 +353,9 @@ func (i *InstanceServerTransport) dispatchUpdate(req *http.Request) (*http.Respo } return resp, nil } + +// set this to conditionally intercept incoming requests to InstanceServerTransport +var instanceServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/fake/internal.go b/sdk/resourcemanager/iotoperations/armiotoperations/fake/internal.go index 56a8f624f5f3..7425b6a669e2 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/fake/internal.go +++ b/sdk/resourcemanager/iotoperations/armiotoperations/fake/internal.go @@ -10,6 +10,11 @@ import ( "sync" ) +type result struct { + resp *http.Response + err error +} + type nonRetriableError struct { error } diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/fake/operations_server.go b/sdk/resourcemanager/iotoperations/armiotoperations/fake/operations_server.go index efd9e8991369..af813699fd33 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/fake/operations_server.go +++ b/sdk/resourcemanager/iotoperations/armiotoperations/fake/operations_server.go @@ -51,17 +51,36 @@ func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error } func (o *OperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error + resultChan := make(chan result) + defer close(resultChan) - switch method { - case "OperationsClient.NewListPager": - resp, err = o.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + go func() { + var intercepted bool + var res result + if operationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = operationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OperationsClient.NewListPager": + res.resp, res.err = o.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() - return resp, err + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { @@ -90,3 +109,9 @@ func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*ht } return resp, nil } + +// set this to conditionally intercept incoming requests to OperationsServerTransport +var operationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/go.mod b/sdk/resourcemanager/iotoperations/armiotoperations/go.mod index 92533fca7e43..13b9390b8b11 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/go.mod +++ b/sdk/resourcemanager/iotoperations/armiotoperations/go.mod @@ -3,7 +3,7 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iotoperations/armio go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 ) @@ -14,8 +14,8 @@ require ( github.com/google/uuid v1.6.0 // indirect github.com/kylelemons/godebug v1.1.0 // indirect github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect - golang.org/x/crypto v0.25.0 // indirect - golang.org/x/net v0.27.0 // indirect - golang.org/x/sys v0.22.0 // indirect - golang.org/x/text v0.16.0 // indirect + golang.org/x/crypto v0.27.0 // indirect + golang.org/x/net v0.29.0 // indirect + golang.org/x/sys v0.25.0 // indirect + golang.org/x/text v0.18.0 // indirect ) diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/go.sum b/sdk/resourcemanager/iotoperations/armiotoperations/go.sum index 09d275cb9a37..cbddbbd9ecec 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/go.sum +++ b/sdk/resourcemanager/iotoperations/armiotoperations/go.sum @@ -1,5 +1,5 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 h1:GJHeeA2N7xrG3q30L2UXDyuWRzDM900/65j70wcM4Ww= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 h1:JZg6HRh6W6U4OLl6lk7BZ7BLisIzM9dG1R50zUk9C/M= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0/go.mod h1:YL1xnZ6QejvQHWJrX/AvhFl4WW4rqHVoKspWNVwFk0M= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= @@ -17,13 +17,13 @@ github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmd github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= -golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= -golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= +golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= +golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/tsp-location.yaml b/sdk/resourcemanager/iotoperations/armiotoperations/tsp-location.yaml index 253771057f04..0c36350b16a9 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/tsp-location.yaml +++ b/sdk/resourcemanager/iotoperations/armiotoperations/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/iotoperations/IoTOperations.Management -commit: 1ba188e3c1a7246ce6a7067adacd04d576fcfa24 +commit: 405438c72094a0a43fbcba18a56aa71110b78db8 repo: Azure/azure-rest-api-specs -additionalDirectories: +additionalDirectories: \ No newline at end of file diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/CHANGELOG.md b/sdk/resourcemanager/mongocluster/armmongocluster/CHANGELOG.md index 47629dbbcb66..e5b8d396e732 100644 --- a/sdk/resourcemanager/mongocluster/armmongocluster/CHANGELOG.md +++ b/sdk/resourcemanager/mongocluster/armmongocluster/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 1.0.2 (2024-11-29) +### Other Changes + + ## 1.0.1 (2024-10-14) ### Other Changes - Add examples diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/constants.go b/sdk/resourcemanager/mongocluster/armmongocluster/constants.go index 8ebb465edcce..e2bfad7caeb9 100644 --- a/sdk/resourcemanager/mongocluster/armmongocluster/constants.go +++ b/sdk/resourcemanager/mongocluster/armmongocluster/constants.go @@ -6,7 +6,7 @@ package armmongocluster const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster" - moduleVersion = "v1.0.1" + moduleVersion = "v1.0.2" ) // ActionType - Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/fake/firewallrules_server.go b/sdk/resourcemanager/mongocluster/armmongocluster/fake/firewallrules_server.go index 2fa0dba5139c..ca62e57c265e 100644 --- a/sdk/resourcemanager/mongocluster/armmongocluster/fake/firewallrules_server.go +++ b/sdk/resourcemanager/mongocluster/armmongocluster/fake/firewallrules_server.go @@ -25,7 +25,7 @@ type FirewallRulesServer struct { BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, mongoClusterName string, firewallRuleName string, resource armmongocluster.FirewallRule, options *armmongocluster.FirewallRulesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armmongocluster.FirewallRulesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method FirewallRulesClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, mongoClusterName string, firewallRuleName string, options *armmongocluster.FirewallRulesClientBeginDeleteOptions) (resp azfake.PollerResponder[armmongocluster.FirewallRulesClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method FirewallRulesClient.Get @@ -70,23 +70,42 @@ func (f *FirewallRulesServerTransport) Do(req *http.Request) (*http.Response, er } func (f *FirewallRulesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error + resultChan := make(chan result) + defer close(resultChan) - switch method { - case "FirewallRulesClient.BeginCreateOrUpdate": - resp, err = f.dispatchBeginCreateOrUpdate(req) - case "FirewallRulesClient.BeginDelete": - resp, err = f.dispatchBeginDelete(req) - case "FirewallRulesClient.Get": - resp, err = f.dispatchGet(req) - case "FirewallRulesClient.NewListByMongoClusterPager": - resp, err = f.dispatchNewListByMongoClusterPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + go func() { + var intercepted bool + var res result + if firewallRulesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = firewallRulesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "FirewallRulesClient.BeginCreateOrUpdate": + res.resp, res.err = f.dispatchBeginCreateOrUpdate(req) + case "FirewallRulesClient.BeginDelete": + res.resp, res.err = f.dispatchBeginDelete(req) + case "FirewallRulesClient.Get": + res.resp, res.err = f.dispatchGet(req) + case "FirewallRulesClient.NewListByMongoClusterPager": + res.resp, res.err = f.dispatchNewListByMongoClusterPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() - return resp, err + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (f *FirewallRulesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -178,9 +197,9 @@ func (f *FirewallRulesServerTransport) dispatchBeginDelete(req *http.Request) (* return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { f.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { f.beginDelete.remove(req) @@ -266,3 +285,9 @@ func (f *FirewallRulesServerTransport) dispatchNewListByMongoClusterPager(req *h } return resp, nil } + +// set this to conditionally intercept incoming requests to FirewallRulesServerTransport +var firewallRulesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/fake/internal.go b/sdk/resourcemanager/mongocluster/armmongocluster/fake/internal.go index 56a8f624f5f3..7425b6a669e2 100644 --- a/sdk/resourcemanager/mongocluster/armmongocluster/fake/internal.go +++ b/sdk/resourcemanager/mongocluster/armmongocluster/fake/internal.go @@ -10,6 +10,11 @@ import ( "sync" ) +type result struct { + resp *http.Response + err error +} + type nonRetriableError struct { error } diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/fake/mongoclusters_server.go b/sdk/resourcemanager/mongocluster/armmongocluster/fake/mongoclusters_server.go index 282e05f31b53..71e5c8df2b66 100644 --- a/sdk/resourcemanager/mongocluster/armmongocluster/fake/mongoclusters_server.go +++ b/sdk/resourcemanager/mongocluster/armmongocluster/fake/mongoclusters_server.go @@ -29,7 +29,7 @@ type MongoClustersServer struct { BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, mongoClusterName string, resource armmongocluster.MongoCluster, options *armmongocluster.MongoClustersClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armmongocluster.MongoClustersClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method MongoClustersClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, mongoClusterName string, options *armmongocluster.MongoClustersClientBeginDeleteOptions) (resp azfake.PollerResponder[armmongocluster.MongoClustersClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method MongoClustersClient.Get @@ -49,7 +49,7 @@ type MongoClustersServer struct { ListConnectionStrings func(ctx context.Context, resourceGroupName string, mongoClusterName string, options *armmongocluster.MongoClustersClientListConnectionStringsOptions) (resp azfake.Responder[armmongocluster.MongoClustersClientListConnectionStringsResponse], errResp azfake.ErrorResponder) // BeginPromote is the fake for method MongoClustersClient.BeginPromote - // HTTP status codes to indicate success: http.StatusAccepted + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginPromote func(ctx context.Context, resourceGroupName string, mongoClusterName string, body armmongocluster.PromoteReplicaRequest, options *armmongocluster.MongoClustersClientBeginPromoteOptions) (resp azfake.PollerResponder[armmongocluster.MongoClustersClientPromoteResponse], errResp azfake.ErrorResponder) // BeginUpdate is the fake for method MongoClustersClient.BeginUpdate @@ -96,33 +96,52 @@ func (m *MongoClustersServerTransport) Do(req *http.Request) (*http.Response, er } func (m *MongoClustersServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error - - switch method { - case "MongoClustersClient.CheckNameAvailability": - resp, err = m.dispatchCheckNameAvailability(req) - case "MongoClustersClient.BeginCreateOrUpdate": - resp, err = m.dispatchBeginCreateOrUpdate(req) - case "MongoClustersClient.BeginDelete": - resp, err = m.dispatchBeginDelete(req) - case "MongoClustersClient.Get": - resp, err = m.dispatchGet(req) - case "MongoClustersClient.NewListPager": - resp, err = m.dispatchNewListPager(req) - case "MongoClustersClient.NewListByResourceGroupPager": - resp, err = m.dispatchNewListByResourceGroupPager(req) - case "MongoClustersClient.ListConnectionStrings": - resp, err = m.dispatchListConnectionStrings(req) - case "MongoClustersClient.BeginPromote": - resp, err = m.dispatchBeginPromote(req) - case "MongoClustersClient.BeginUpdate": - resp, err = m.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - return resp, err + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if mongoClustersServerTransportInterceptor != nil { + res.resp, res.err, intercepted = mongoClustersServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "MongoClustersClient.CheckNameAvailability": + res.resp, res.err = m.dispatchCheckNameAvailability(req) + case "MongoClustersClient.BeginCreateOrUpdate": + res.resp, res.err = m.dispatchBeginCreateOrUpdate(req) + case "MongoClustersClient.BeginDelete": + res.resp, res.err = m.dispatchBeginDelete(req) + case "MongoClustersClient.Get": + res.resp, res.err = m.dispatchGet(req) + case "MongoClustersClient.NewListPager": + res.resp, res.err = m.dispatchNewListPager(req) + case "MongoClustersClient.NewListByResourceGroupPager": + res.resp, res.err = m.dispatchNewListByResourceGroupPager(req) + case "MongoClustersClient.ListConnectionStrings": + res.resp, res.err = m.dispatchListConnectionStrings(req) + case "MongoClustersClient.BeginPromote": + res.resp, res.err = m.dispatchBeginPromote(req) + case "MongoClustersClient.BeginUpdate": + res.resp, res.err = m.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (m *MongoClustersServerTransport) dispatchCheckNameAvailability(req *http.Request) (*http.Response, error) { @@ -239,9 +258,9 @@ func (m *MongoClustersServerTransport) dispatchBeginDelete(req *http.Request) (* return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { m.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { m.beginDelete.remove(req) @@ -423,9 +442,9 @@ func (m *MongoClustersServerTransport) dispatchBeginPromote(req *http.Request) ( return nil, err } - if !contains([]int{http.StatusAccepted}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { m.beginPromote.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginPromote) { m.beginPromote.remove(req) @@ -481,3 +500,9 @@ func (m *MongoClustersServerTransport) dispatchBeginUpdate(req *http.Request) (* return resp, nil } + +// set this to conditionally intercept incoming requests to MongoClustersServerTransport +var mongoClustersServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/fake/operations_server.go b/sdk/resourcemanager/mongocluster/armmongocluster/fake/operations_server.go index e03576da7bf7..f9b0ab327954 100644 --- a/sdk/resourcemanager/mongocluster/armmongocluster/fake/operations_server.go +++ b/sdk/resourcemanager/mongocluster/armmongocluster/fake/operations_server.go @@ -51,17 +51,36 @@ func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error } func (o *OperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error + resultChan := make(chan result) + defer close(resultChan) - switch method { - case "OperationsClient.NewListPager": - resp, err = o.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + go func() { + var intercepted bool + var res result + if operationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = operationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OperationsClient.NewListPager": + res.resp, res.err = o.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() - return resp, err + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { @@ -90,3 +109,9 @@ func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*ht } return resp, nil } + +// set this to conditionally intercept incoming requests to OperationsServerTransport +var operationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/fake/privateendpointconnections_server.go b/sdk/resourcemanager/mongocluster/armmongocluster/fake/privateendpointconnections_server.go index 1857e3b2d3a2..2ff521073ce8 100644 --- a/sdk/resourcemanager/mongocluster/armmongocluster/fake/privateendpointconnections_server.go +++ b/sdk/resourcemanager/mongocluster/armmongocluster/fake/privateendpointconnections_server.go @@ -25,7 +25,7 @@ type PrivateEndpointConnectionsServer struct { BeginCreate func(ctx context.Context, resourceGroupName string, mongoClusterName string, privateEndpointConnectionName string, resource armmongocluster.PrivateEndpointConnectionResource, options *armmongocluster.PrivateEndpointConnectionsClientBeginCreateOptions) (resp azfake.PollerResponder[armmongocluster.PrivateEndpointConnectionsClientCreateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method PrivateEndpointConnectionsClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, mongoClusterName string, privateEndpointConnectionName string, options *armmongocluster.PrivateEndpointConnectionsClientBeginDeleteOptions) (resp azfake.PollerResponder[armmongocluster.PrivateEndpointConnectionsClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method PrivateEndpointConnectionsClient.Get @@ -70,23 +70,42 @@ func (p *PrivateEndpointConnectionsServerTransport) Do(req *http.Request) (*http } func (p *PrivateEndpointConnectionsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error + resultChan := make(chan result) + defer close(resultChan) - switch method { - case "PrivateEndpointConnectionsClient.BeginCreate": - resp, err = p.dispatchBeginCreate(req) - case "PrivateEndpointConnectionsClient.BeginDelete": - resp, err = p.dispatchBeginDelete(req) - case "PrivateEndpointConnectionsClient.Get": - resp, err = p.dispatchGet(req) - case "PrivateEndpointConnectionsClient.NewListByMongoClusterPager": - resp, err = p.dispatchNewListByMongoClusterPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + go func() { + var intercepted bool + var res result + if privateEndpointConnectionsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = privateEndpointConnectionsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "PrivateEndpointConnectionsClient.BeginCreate": + res.resp, res.err = p.dispatchBeginCreate(req) + case "PrivateEndpointConnectionsClient.BeginDelete": + res.resp, res.err = p.dispatchBeginDelete(req) + case "PrivateEndpointConnectionsClient.Get": + res.resp, res.err = p.dispatchGet(req) + case "PrivateEndpointConnectionsClient.NewListByMongoClusterPager": + res.resp, res.err = p.dispatchNewListByMongoClusterPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() - return resp, err + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (p *PrivateEndpointConnectionsServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { @@ -178,9 +197,9 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchBeginDelete(req *htt return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { p.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { p.beginDelete.remove(req) @@ -266,3 +285,9 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchNewListByMongoCluste } return resp, nil } + +// set this to conditionally intercept incoming requests to PrivateEndpointConnectionsServerTransport +var privateEndpointConnectionsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/fake/privatelinks_server.go b/sdk/resourcemanager/mongocluster/armmongocluster/fake/privatelinks_server.go index c5c7f79a7086..e51c4ae7e0b3 100644 --- a/sdk/resourcemanager/mongocluster/armmongocluster/fake/privatelinks_server.go +++ b/sdk/resourcemanager/mongocluster/armmongocluster/fake/privatelinks_server.go @@ -53,17 +53,36 @@ func (p *PrivateLinksServerTransport) Do(req *http.Request) (*http.Response, err } func (p *PrivateLinksServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error + resultChan := make(chan result) + defer close(resultChan) - switch method { - case "PrivateLinksClient.NewListByMongoClusterPager": - resp, err = p.dispatchNewListByMongoClusterPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + go func() { + var intercepted bool + var res result + if privateLinksServerTransportInterceptor != nil { + res.resp, res.err, intercepted = privateLinksServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "PrivateLinksClient.NewListByMongoClusterPager": + res.resp, res.err = p.dispatchNewListByMongoClusterPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() - return resp, err + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (p *PrivateLinksServerTransport) dispatchNewListByMongoClusterPager(req *http.Request) (*http.Response, error) { @@ -106,3 +125,9 @@ func (p *PrivateLinksServerTransport) dispatchNewListByMongoClusterPager(req *ht } return resp, nil } + +// set this to conditionally intercept incoming requests to PrivateLinksServerTransport +var privateLinksServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/fake/replicas_server.go b/sdk/resourcemanager/mongocluster/armmongocluster/fake/replicas_server.go index 380cc5823b3d..fe07670b3590 100644 --- a/sdk/resourcemanager/mongocluster/armmongocluster/fake/replicas_server.go +++ b/sdk/resourcemanager/mongocluster/armmongocluster/fake/replicas_server.go @@ -53,17 +53,36 @@ func (r *ReplicasServerTransport) Do(req *http.Request) (*http.Response, error) } func (r *ReplicasServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error + resultChan := make(chan result) + defer close(resultChan) - switch method { - case "ReplicasClient.NewListByParentPager": - resp, err = r.dispatchNewListByParentPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + go func() { + var intercepted bool + var res result + if replicasServerTransportInterceptor != nil { + res.resp, res.err, intercepted = replicasServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ReplicasClient.NewListByParentPager": + res.resp, res.err = r.dispatchNewListByParentPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() - return resp, err + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (r *ReplicasServerTransport) dispatchNewListByParentPager(req *http.Request) (*http.Response, error) { @@ -106,3 +125,9 @@ func (r *ReplicasServerTransport) dispatchNewListByParentPager(req *http.Request } return resp, nil } + +// set this to conditionally intercept incoming requests to ReplicasServerTransport +var replicasServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/firewallrules_client_example_test.go b/sdk/resourcemanager/mongocluster/armmongocluster/firewallrules_client_example_test.go index 46b9b0d8cb32..a9bb46cb506b 100644 --- a/sdk/resourcemanager/mongocluster/armmongocluster/firewallrules_client_example_test.go +++ b/sdk/resourcemanager/mongocluster/armmongocluster/firewallrules_client_example_test.go @@ -12,7 +12,7 @@ import ( "log" ) -// Generated from example definition: D:/ws/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-07-01/MongoClusters_FirewallRuleCreate.json +// Generated from example definition: 2024-07-01/MongoClusters_FirewallRuleCreate.json func ExampleFirewallRulesClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -61,7 +61,7 @@ func ExampleFirewallRulesClient_BeginCreateOrUpdate() { // } } -// Generated from example definition: D:/ws/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-07-01/MongoClusters_FirewallRuleDelete.json +// Generated from example definition: 2024-07-01/MongoClusters_FirewallRuleDelete.json func ExampleFirewallRulesClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -82,7 +82,7 @@ func ExampleFirewallRulesClient_BeginDelete() { } } -// Generated from example definition: D:/ws/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-07-01/MongoClusters_FirewallRuleGet.json +// Generated from example definition: 2024-07-01/MongoClusters_FirewallRuleGet.json func ExampleFirewallRulesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -122,7 +122,7 @@ func ExampleFirewallRulesClient_Get() { // } } -// Generated from example definition: D:/ws/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-07-01/MongoClusters_FirewallRuleList.json +// Generated from example definition: 2024-07-01/MongoClusters_FirewallRuleList.json func ExampleFirewallRulesClient_NewListByMongoClusterPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/go.mod b/sdk/resourcemanager/mongocluster/armmongocluster/go.mod index 48b9c03c5485..540f28dfa774 100644 --- a/sdk/resourcemanager/mongocluster/armmongocluster/go.mod +++ b/sdk/resourcemanager/mongocluster/armmongocluster/go.mod @@ -3,7 +3,7 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmon go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3 v3.1.0 ) @@ -16,8 +16,8 @@ require ( github.com/google/uuid v1.6.0 // indirect github.com/kylelemons/godebug v1.1.0 // indirect github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect - golang.org/x/crypto v0.25.0 // indirect - golang.org/x/net v0.27.0 // indirect - golang.org/x/sys v0.22.0 // indirect - golang.org/x/text v0.16.0 // indirect + golang.org/x/crypto v0.27.0 // indirect + golang.org/x/net v0.29.0 // indirect + golang.org/x/sys v0.25.0 // indirect + golang.org/x/text v0.18.0 // indirect ) diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/go.sum b/sdk/resourcemanager/mongocluster/armmongocluster/go.sum index d7d2cf1b6883..e7ef42f307a8 100644 --- a/sdk/resourcemanager/mongocluster/armmongocluster/go.sum +++ b/sdk/resourcemanager/mongocluster/armmongocluster/go.sum @@ -1,5 +1,5 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 h1:GJHeeA2N7xrG3q30L2UXDyuWRzDM900/65j70wcM4Ww= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 h1:JZg6HRh6W6U4OLl6lk7BZ7BLisIzM9dG1R50zUk9C/M= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0/go.mod h1:YL1xnZ6QejvQHWJrX/AvhFl4WW4rqHVoKspWNVwFk0M= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= @@ -23,13 +23,13 @@ github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmd github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= -golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= -golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= +golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= +golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/mongoclusters_client.go b/sdk/resourcemanager/mongocluster/armmongocluster/mongoclusters_client.go index 14410d6a7eab..38f009b987a7 100644 --- a/sdk/resourcemanager/mongocluster/armmongocluster/mongoclusters_client.go +++ b/sdk/resourcemanager/mongocluster/armmongocluster/mongoclusters_client.go @@ -43,7 +43,7 @@ func NewMongoClustersClient(subscriptionID string, credential azcore.TokenCreden // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2024-07-01 -// - location - The location name. +// - location - The name of the Azure region. // - body - The CheckAvailability request // - options - MongoClustersClientCheckNameAvailabilityOptions contains the optional parameters for the MongoClustersClient.CheckNameAvailability // method. diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/mongoclusters_client_example_test.go b/sdk/resourcemanager/mongocluster/armmongocluster/mongoclusters_client_example_test.go index 5e7f6481eb99..da42c112c3ba 100644 --- a/sdk/resourcemanager/mongocluster/armmongocluster/mongoclusters_client_example_test.go +++ b/sdk/resourcemanager/mongocluster/armmongocluster/mongoclusters_client_example_test.go @@ -13,7 +13,7 @@ import ( "time" ) -// Generated from example definition: D:/ws/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-07-01/MongoClusters_NameAvailability.json +// Generated from example definition: 2024-07-01/MongoClusters_NameAvailability.json func ExampleMongoClustersClient_CheckNameAvailability_checksAndConfirmsTheMongoClusterNameIsAvailabilityForUse() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -41,7 +41,7 @@ func ExampleMongoClustersClient_CheckNameAvailability_checksAndConfirmsTheMongoC // } } -// Generated from example definition: D:/ws/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-07-01/MongoClusters_NameAvailability_AlreadyExists.json +// Generated from example definition: 2024-07-01/MongoClusters_NameAvailability_AlreadyExists.json func ExampleMongoClustersClient_CheckNameAvailability_checksAndReturnsThatTheMongoClusterNameIsAlreadyInUse() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -71,7 +71,7 @@ func ExampleMongoClustersClient_CheckNameAvailability_checksAndReturnsThatTheMon // } } -// Generated from example definition: D:/ws/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-07-01/MongoClusters_Create.json +// Generated from example definition: 2024-07-01/MongoClusters_Create.json func ExampleMongoClustersClient_BeginCreateOrUpdate_createsANewMongoClusterResource() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -162,7 +162,7 @@ func ExampleMongoClustersClient_BeginCreateOrUpdate_createsANewMongoClusterResou // } } -// Generated from example definition: D:/ws/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-07-01/MongoClusters_CreateGeoReplica.json +// Generated from example definition: 2024-07-01/MongoClusters_CreateGeoReplica.json func ExampleMongoClustersClient_BeginCreateOrUpdate_createsAReplicaMongoClusterResourceFromASourceResource() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -236,7 +236,7 @@ func ExampleMongoClustersClient_BeginCreateOrUpdate_createsAReplicaMongoClusterR // } } -// Generated from example definition: D:/ws/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-07-01/MongoClusters_CreatePITR.json +// Generated from example definition: 2024-07-01/MongoClusters_CreatePITR.json func ExampleMongoClustersClient_BeginCreateOrUpdate_createsAMongoClusterResourceFromAPointInTimeRestore() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -307,7 +307,7 @@ func ExampleMongoClustersClient_BeginCreateOrUpdate_createsAMongoClusterResource // } } -// Generated from example definition: D:/ws/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-07-01/MongoClusters_Delete.json +// Generated from example definition: 2024-07-01/MongoClusters_Delete.json func ExampleMongoClustersClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -328,7 +328,7 @@ func ExampleMongoClustersClient_BeginDelete() { } } -// Generated from example definition: D:/ws/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-07-01/MongoClusters_Get.json +// Generated from example definition: 2024-07-01/MongoClusters_Get.json func ExampleMongoClustersClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -400,7 +400,7 @@ func ExampleMongoClustersClient_Get() { // } } -// Generated from example definition: D:/ws/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-07-01/MongoClusters_List.json +// Generated from example definition: 2024-07-01/MongoClusters_List.json func ExampleMongoClustersClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -529,7 +529,7 @@ func ExampleMongoClustersClient_NewListPager() { } } -// Generated from example definition: D:/ws/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-07-01/MongoClusters_ListByResourceGroup.json +// Generated from example definition: 2024-07-01/MongoClusters_ListByResourceGroup.json func ExampleMongoClustersClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -658,7 +658,7 @@ func ExampleMongoClustersClient_NewListByResourceGroupPager() { } } -// Generated from example definition: D:/ws/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-07-01/MongoClusters_ListConnectionStrings.json +// Generated from example definition: 2024-07-01/MongoClusters_ListConnectionStrings.json func ExampleMongoClustersClient_ListConnectionStrings() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -688,7 +688,7 @@ func ExampleMongoClustersClient_ListConnectionStrings() { // } } -// Generated from example definition: D:/ws/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-07-01/MongoClusters_ForcePromoteReplica.json +// Generated from example definition: 2024-07-01/MongoClusters_ForcePromoteReplica.json func ExampleMongoClustersClient_BeginPromote() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -712,7 +712,7 @@ func ExampleMongoClustersClient_BeginPromote() { } } -// Generated from example definition: D:/ws/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-07-01/MongoClusters_PatchDiskSize.json +// Generated from example definition: 2024-07-01/MongoClusters_PatchDiskSize.json func ExampleMongoClustersClient_BeginUpdate_updatesTheDiskSizeOnAMongoClusterResource() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -788,7 +788,7 @@ func ExampleMongoClustersClient_BeginUpdate_updatesTheDiskSizeOnAMongoClusterRes // } } -// Generated from example definition: D:/ws/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-07-01/MongoClusters_PatchPrivateNetworkAccess.json +// Generated from example definition: 2024-07-01/MongoClusters_PatchPrivateNetworkAccess.json func ExampleMongoClustersClient_BeginUpdate_disablesPublicNetworkAccessOnAMongoClusterResourceWithAPrivateEndpointConnection() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -888,7 +888,7 @@ func ExampleMongoClustersClient_BeginUpdate_disablesPublicNetworkAccessOnAMongoC // } } -// Generated from example definition: D:/ws/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-07-01/MongoClusters_ResetPassword.json +// Generated from example definition: 2024-07-01/MongoClusters_ResetPassword.json func ExampleMongoClustersClient_BeginUpdate_resetsTheAdministratorLoginPassword() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -965,7 +965,7 @@ func ExampleMongoClustersClient_BeginUpdate_resetsTheAdministratorLoginPassword( // } } -// Generated from example definition: D:/ws/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-07-01/MongoClusters_Update.json +// Generated from example definition: 2024-07-01/MongoClusters_Update.json func ExampleMongoClustersClient_BeginUpdate_updatesAMongoClusterResource() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/operations_client_example_test.go b/sdk/resourcemanager/mongocluster/armmongocluster/operations_client_example_test.go index 560fc23c093a..bd03c838daf1 100644 --- a/sdk/resourcemanager/mongocluster/armmongocluster/operations_client_example_test.go +++ b/sdk/resourcemanager/mongocluster/armmongocluster/operations_client_example_test.go @@ -11,7 +11,7 @@ import ( "log" ) -// Generated from example definition: D:/ws/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-07-01/Operations_List.json +// Generated from example definition: 2024-07-01/Operations_List.json func ExampleOperationsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/privateendpointconnections_client_example_test.go b/sdk/resourcemanager/mongocluster/armmongocluster/privateendpointconnections_client_example_test.go index 9f27e134b3ee..96d66b289c48 100644 --- a/sdk/resourcemanager/mongocluster/armmongocluster/privateendpointconnections_client_example_test.go +++ b/sdk/resourcemanager/mongocluster/armmongocluster/privateendpointconnections_client_example_test.go @@ -12,7 +12,7 @@ import ( "log" ) -// Generated from example definition: D:/ws/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-07-01/MongoClusters_PrivateEndpointConnectionPut.json +// Generated from example definition: 2024-07-01/MongoClusters_PrivateEndpointConnectionPut.json func ExamplePrivateEndpointConnectionsClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -72,7 +72,7 @@ func ExamplePrivateEndpointConnectionsClient_BeginCreate() { // } } -// Generated from example definition: D:/ws/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-07-01/MongoClusters_PrivateEndpointConnectionDelete.json +// Generated from example definition: 2024-07-01/MongoClusters_PrivateEndpointConnectionDelete.json func ExamplePrivateEndpointConnectionsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -93,7 +93,7 @@ func ExamplePrivateEndpointConnectionsClient_BeginDelete() { } } -// Generated from example definition: D:/ws/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-07-01/MongoClusters_PrivateEndpointConnectionGet.json +// Generated from example definition: 2024-07-01/MongoClusters_PrivateEndpointConnectionGet.json func ExamplePrivateEndpointConnectionsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -142,7 +142,7 @@ func ExamplePrivateEndpointConnectionsClient_Get() { // } } -// Generated from example definition: D:/ws/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-07-01/MongoClusters_PrivateEndpointConnectionList.json +// Generated from example definition: 2024-07-01/MongoClusters_PrivateEndpointConnectionList.json func ExamplePrivateEndpointConnectionsClient_NewListByMongoClusterPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/privatelinks_client_example_test.go b/sdk/resourcemanager/mongocluster/armmongocluster/privatelinks_client_example_test.go index 70399d79c0ad..03b8153acd1e 100644 --- a/sdk/resourcemanager/mongocluster/armmongocluster/privatelinks_client_example_test.go +++ b/sdk/resourcemanager/mongocluster/armmongocluster/privatelinks_client_example_test.go @@ -11,7 +11,7 @@ import ( "log" ) -// Generated from example definition: D:/ws/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-07-01/MongoClusters_PrivateLinkResourceList.json +// Generated from example definition: 2024-07-01/MongoClusters_PrivateLinkResourceList.json func ExamplePrivateLinksClient_NewListByMongoClusterPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/replicas_client_example_test.go b/sdk/resourcemanager/mongocluster/armmongocluster/replicas_client_example_test.go index 30c3f632e55f..4ccb2c200387 100644 --- a/sdk/resourcemanager/mongocluster/armmongocluster/replicas_client_example_test.go +++ b/sdk/resourcemanager/mongocluster/armmongocluster/replicas_client_example_test.go @@ -11,7 +11,7 @@ import ( "log" ) -// Generated from example definition: D:/ws/azure-sdk-for-go/sdk/resourcemanager/mongocluster/armmongocluster/TempTypeSpecFiles/DocumentDB.MongoCluster.Management/examples/2024-07-01/MongoClusters_ReplicaList.json +// Generated from example definition: 2024-07-01/MongoClusters_ReplicaList.json func ExampleReplicasClient_NewListByParentPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/tsp-location.yaml b/sdk/resourcemanager/mongocluster/armmongocluster/tsp-location.yaml index efed7142ec15..bfd46fffbd1c 100644 --- a/sdk/resourcemanager/mongocluster/armmongocluster/tsp-location.yaml +++ b/sdk/resourcemanager/mongocluster/armmongocluster/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/mongocluster/DocumentDB.MongoCluster.Management -commit: 02ff8f08a132a5a68fcdd48da118e36e5ececc3d +commit: 405438c72094a0a43fbcba18a56aa71110b78db8 repo: Azure/azure-rest-api-specs -additionalDirectories: +additionalDirectories: \ No newline at end of file diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/client_factory.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/client_factory.go index 9952282e6d03..ef8866110c68 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/client_factory.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/client_factory.go @@ -13,7 +13,7 @@ import ( // Don't use this type directly, use NewClientFactory instead. type ClientFactory struct { subscriptionID string - internal *arm.Client + internal *arm.Client } // NewClientFactory creates a new instance of ClientFactory with the specified values. @@ -28,7 +28,7 @@ func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, } return &ClientFactory{ subscriptionID: subscriptionID, - internal: internal, + internal: internal, }, nil } @@ -43,6 +43,7 @@ func (c *ClientFactory) NewOperationsClient() *OperationsClient { func (c *ClientFactory) NewOrganizationsClient() *OrganizationsClient { return &OrganizationsClient{ subscriptionID: c.subscriptionID, - internal: c.internal, + internal: c.internal, } } + diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/constants.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/constants.go index 471985f693d9..ac2e53804239 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/constants.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/constants.go @@ -5,7 +5,7 @@ package armneonpostgres const ( - moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres" + moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres" moduleVersion = "v0.1.0" ) @@ -13,13 +13,13 @@ const ( type ActionType string const ( - // ActionTypeInternal - Actions are for internal-only APIs. +// ActionTypeInternal - Actions are for internal-only APIs. ActionTypeInternal ActionType = "Internal" ) // PossibleActionTypeValues returns the possible values for the ActionType const type. func PossibleActionTypeValues() []ActionType { - return []ActionType{ + return []ActionType{ ActionTypeInternal, } } @@ -28,19 +28,19 @@ func PossibleActionTypeValues() []ActionType { type CreatedByType string const ( - // CreatedByTypeApplication - The entity was created by an application. +// CreatedByTypeApplication - The entity was created by an application. CreatedByTypeApplication CreatedByType = "Application" - // CreatedByTypeKey - The entity was created by a key. +// CreatedByTypeKey - The entity was created by a key. CreatedByTypeKey CreatedByType = "Key" - // CreatedByTypeManagedIdentity - The entity was created by a managed identity. +// CreatedByTypeManagedIdentity - The entity was created by a managed identity. CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" - // CreatedByTypeUser - The entity was created by a user. +// CreatedByTypeUser - The entity was created by a user. CreatedByTypeUser CreatedByType = "User" ) // PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. func PossibleCreatedByTypeValues() []CreatedByType { - return []CreatedByType{ + return []CreatedByType{ CreatedByTypeApplication, CreatedByTypeKey, CreatedByTypeManagedIdentity, @@ -52,20 +52,20 @@ func PossibleCreatedByTypeValues() []CreatedByType { type MarketplaceSubscriptionStatus string const ( - // MarketplaceSubscriptionStatusPendingFulfillmentStart - Purchased but not yet activated +// MarketplaceSubscriptionStatusPendingFulfillmentStart - Purchased but not yet activated MarketplaceSubscriptionStatusPendingFulfillmentStart MarketplaceSubscriptionStatus = "PendingFulfillmentStart" - // MarketplaceSubscriptionStatusSubscribed - Marketplace subscription is activated +// MarketplaceSubscriptionStatusSubscribed - Marketplace subscription is activated MarketplaceSubscriptionStatusSubscribed MarketplaceSubscriptionStatus = "Subscribed" - // MarketplaceSubscriptionStatusSuspended - This state indicates that a customer's payment for the Marketplace service was - // not received +// MarketplaceSubscriptionStatusSuspended - This state indicates that a customer's payment for the Marketplace service was +// not received MarketplaceSubscriptionStatusSuspended MarketplaceSubscriptionStatus = "Suspended" - // MarketplaceSubscriptionStatusUnsubscribed - Customer has cancelled the subscription +// MarketplaceSubscriptionStatusUnsubscribed - Customer has cancelled the subscription MarketplaceSubscriptionStatusUnsubscribed MarketplaceSubscriptionStatus = "Unsubscribed" ) // PossibleMarketplaceSubscriptionStatusValues returns the possible values for the MarketplaceSubscriptionStatus const type. func PossibleMarketplaceSubscriptionStatusValues() []MarketplaceSubscriptionStatus { - return []MarketplaceSubscriptionStatus{ + return []MarketplaceSubscriptionStatus{ MarketplaceSubscriptionStatusPendingFulfillmentStart, MarketplaceSubscriptionStatusSubscribed, MarketplaceSubscriptionStatusSuspended, @@ -78,17 +78,17 @@ func PossibleMarketplaceSubscriptionStatusValues() []MarketplaceSubscriptionStat type Origin string const ( - // OriginSystem - Indicates the operation is initiated by a system. +// OriginSystem - Indicates the operation is initiated by a system. OriginSystem Origin = "system" - // OriginUser - Indicates the operation is initiated by a user. +// OriginUser - Indicates the operation is initiated by a user. OriginUser Origin = "user" - // OriginUserSystem - Indicates the operation is initiated by a user or system. +// OriginUserSystem - Indicates the operation is initiated by a user or system. OriginUserSystem Origin = "user,system" ) // PossibleOriginValues returns the possible values for the Origin const type. func PossibleOriginValues() []Origin { - return []Origin{ + return []Origin{ OriginSystem, OriginUser, OriginUserSystem, @@ -99,17 +99,17 @@ func PossibleOriginValues() []Origin { type ResourceProvisioningState string const ( - // ResourceProvisioningStateCanceled - Resource creation was canceled. +// ResourceProvisioningStateCanceled - Resource creation was canceled. ResourceProvisioningStateCanceled ResourceProvisioningState = "Canceled" - // ResourceProvisioningStateFailed - Resource creation failed. +// ResourceProvisioningStateFailed - Resource creation failed. ResourceProvisioningStateFailed ResourceProvisioningState = "Failed" - // ResourceProvisioningStateSucceeded - Resource has been created. +// ResourceProvisioningStateSucceeded - Resource has been created. ResourceProvisioningStateSucceeded ResourceProvisioningState = "Succeeded" ) // PossibleResourceProvisioningStateValues returns the possible values for the ResourceProvisioningState const type. func PossibleResourceProvisioningStateValues() []ResourceProvisioningState { - return []ResourceProvisioningState{ + return []ResourceProvisioningState{ ResourceProvisioningStateCanceled, ResourceProvisioningStateFailed, ResourceProvisioningStateSucceeded, @@ -120,19 +120,20 @@ func PossibleResourceProvisioningStateValues() []ResourceProvisioningState { type SingleSignOnStates string const ( - // SingleSignOnStatesDisable - SSO is disabled for the organization +// SingleSignOnStatesDisable - SSO is disabled for the organization SingleSignOnStatesDisable SingleSignOnStates = "Disable" - // SingleSignOnStatesEnable - SSO is enabled for the organization +// SingleSignOnStatesEnable - SSO is enabled for the organization SingleSignOnStatesEnable SingleSignOnStates = "Enable" - // SingleSignOnStatesInitial - Initial state of the SSO resource +// SingleSignOnStatesInitial - Initial state of the SSO resource SingleSignOnStatesInitial SingleSignOnStates = "Initial" ) // PossibleSingleSignOnStatesValues returns the possible values for the SingleSignOnStates const type. func PossibleSingleSignOnStatesValues() []SingleSignOnStates { - return []SingleSignOnStates{ + return []SingleSignOnStates{ SingleSignOnStatesDisable, SingleSignOnStatesEnable, SingleSignOnStatesInitial, } } + diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/internal.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/internal.go index 7425b6a669e2..312c843d0531 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/internal.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/internal.go @@ -10,9 +10,10 @@ import ( "sync" ) + type result struct { resp *http.Response - err error + err error } type nonRetriableError struct { @@ -40,7 +41,7 @@ func newTracker[T any]() *tracker[T] { type tracker[T any] struct { items map[string]*T - mu sync.Mutex + mu sync.Mutex } func (p *tracker[T]) get(req *http.Request) *T { diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/operations_server.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/operations_server.go index c30b0623a4d2..0965e500b0ed 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/operations_server.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/operations_server.go @@ -16,10 +16,11 @@ import ( ) // OperationsServer is a fake server for instances of the armneonpostgres.OperationsClient type. -type OperationsServer struct { +type OperationsServer struct{ // NewListPager is the fake for method OperationsClient.NewListPager // HTTP status codes to indicate success: http.StatusOK NewListPager func(options *armneonpostgres.OperationsClientListOptions) (resp azfake.PagerResponder[armneonpostgres.OperationsClientListResponse]) + } // NewOperationsServerTransport creates a new instance of OperationsServerTransport with the provided implementation. @@ -27,7 +28,7 @@ type OperationsServer struct { // azcore.ClientOptions.Transporter field in the client's constructor parameters. func NewOperationsServerTransport(srv *OperationsServer) *OperationsServerTransport { return &OperationsServerTransport{ - srv: srv, + srv: srv, newListPager: newTracker[azfake.PagerResponder[armneonpostgres.OperationsClientListResponse]](), } } @@ -35,7 +36,7 @@ func NewOperationsServerTransport(srv *OperationsServer) *OperationsServerTransp // OperationsServerTransport connects instances of armneonpostgres.OperationsClient to instances of OperationsServer. // Don't use this type directly, use NewOperationsServerTransport instead. type OperationsServerTransport struct { - srv *OperationsServer + srv *OperationsServer newListPager *tracker[azfake.PagerResponder[armneonpostgres.OperationsClientListResponse]] } @@ -57,15 +58,15 @@ func (o *OperationsServerTransport) dispatchToMethodFake(req *http.Request, meth go func() { var intercepted bool var res result - if operationsServerTransportInterceptor != nil { - res.resp, res.err, intercepted = operationsServerTransportInterceptor.Do(req) + if operationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = operationsServerTransportInterceptor.Do(req) } if !intercepted { switch method { case "OperationsClient.NewListPager": res.resp, res.err = o.dispatchNewListPager(req) - default: - res.err = fmt.Errorf("unhandled API %s", method) + default: + res.err = fmt.Errorf("unhandled API %s", method) } } @@ -89,7 +90,7 @@ func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*ht } newListPager := o.newListPager.get(req) if newListPager == nil { - resp := o.srv.NewListPager(nil) +resp := o.srv.NewListPager(nil) newListPager = &resp o.newListPager.add(req, newListPager) server.PagerResponderInjectNextLinks(newListPager, req, func(page *armneonpostgres.OperationsClientListResponse, createLink func() string) { diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/organizations_server.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/organizations_server.go index 10e568444f2e..dd1272438b36 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/organizations_server.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/organizations_server.go @@ -19,7 +19,7 @@ import ( ) // OrganizationsServer is a fake server for instances of the armneonpostgres.OrganizationsClient type. -type OrganizationsServer struct { +type OrganizationsServer struct{ // BeginCreateOrUpdate is the fake for method OrganizationsClient.BeginCreateOrUpdate // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, organizationName string, resource armneonpostgres.OrganizationResource, options *armneonpostgres.OrganizationsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armneonpostgres.OrganizationsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) @@ -43,6 +43,7 @@ type OrganizationsServer struct { // BeginUpdate is the fake for method OrganizationsClient.BeginUpdate // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted BeginUpdate func(ctx context.Context, resourceGroupName string, organizationName string, properties armneonpostgres.OrganizationResource, options *armneonpostgres.OrganizationsClientBeginUpdateOptions) (resp azfake.PollerResponder[armneonpostgres.OrganizationsClientUpdateResponse], errResp azfake.ErrorResponder) + } // NewOrganizationsServerTransport creates a new instance of OrganizationsServerTransport with the provided implementation. @@ -50,24 +51,24 @@ type OrganizationsServer struct { // azcore.ClientOptions.Transporter field in the client's constructor parameters. func NewOrganizationsServerTransport(srv *OrganizationsServer) *OrganizationsServerTransport { return &OrganizationsServerTransport{ - srv: srv, - beginCreateOrUpdate: newTracker[azfake.PollerResponder[armneonpostgres.OrganizationsClientCreateOrUpdateResponse]](), - beginDelete: newTracker[azfake.PollerResponder[armneonpostgres.OrganizationsClientDeleteResponse]](), + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armneonpostgres.OrganizationsClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armneonpostgres.OrganizationsClientDeleteResponse]](), newListByResourceGroupPager: newTracker[azfake.PagerResponder[armneonpostgres.OrganizationsClientListByResourceGroupResponse]](), - newListBySubscriptionPager: newTracker[azfake.PagerResponder[armneonpostgres.OrganizationsClientListBySubscriptionResponse]](), - beginUpdate: newTracker[azfake.PollerResponder[armneonpostgres.OrganizationsClientUpdateResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armneonpostgres.OrganizationsClientListBySubscriptionResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armneonpostgres.OrganizationsClientUpdateResponse]](), } } // OrganizationsServerTransport connects instances of armneonpostgres.OrganizationsClient to instances of OrganizationsServer. // Don't use this type directly, use NewOrganizationsServerTransport instead. type OrganizationsServerTransport struct { - srv *OrganizationsServer - beginCreateOrUpdate *tracker[azfake.PollerResponder[armneonpostgres.OrganizationsClientCreateOrUpdateResponse]] - beginDelete *tracker[azfake.PollerResponder[armneonpostgres.OrganizationsClientDeleteResponse]] + srv *OrganizationsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armneonpostgres.OrganizationsClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armneonpostgres.OrganizationsClientDeleteResponse]] newListByResourceGroupPager *tracker[azfake.PagerResponder[armneonpostgres.OrganizationsClientListByResourceGroupResponse]] - newListBySubscriptionPager *tracker[azfake.PagerResponder[armneonpostgres.OrganizationsClientListBySubscriptionResponse]] - beginUpdate *tracker[azfake.PollerResponder[armneonpostgres.OrganizationsClientUpdateResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armneonpostgres.OrganizationsClientListBySubscriptionResponse]] + beginUpdate *tracker[azfake.PollerResponder[armneonpostgres.OrganizationsClientUpdateResponse]] } // Do implements the policy.Transporter interface for OrganizationsServerTransport. @@ -88,8 +89,8 @@ func (o *OrganizationsServerTransport) dispatchToMethodFake(req *http.Request, m go func() { var intercepted bool var res result - if organizationsServerTransportInterceptor != nil { - res.resp, res.err, intercepted = organizationsServerTransportInterceptor.Do(req) + if organizationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = organizationsServerTransportInterceptor.Do(req) } if !intercepted { switch method { @@ -105,8 +106,8 @@ func (o *OrganizationsServerTransport) dispatchToMethodFake(req *http.Request, m res.resp, res.err = o.dispatchNewListBySubscriptionPager(req) case "OrganizationsClient.BeginUpdate": res.resp, res.err = o.dispatchBeginUpdate(req) - default: - res.err = fmt.Errorf("unhandled API %s", method) + default: + res.err = fmt.Errorf("unhandled API %s", method) } } @@ -130,28 +131,28 @@ func (o *OrganizationsServerTransport) dispatchBeginCreateOrUpdate(req *http.Req } beginCreateOrUpdate := o.beginCreateOrUpdate.get(req) if beginCreateOrUpdate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - 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) - } - body, err := server.UnmarshalRequestAsJSON[armneonpostgres.OrganizationResource](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - organizationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("organizationName")]) - if err != nil { - return nil, err - } - respr, errRespr := o.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, organizationNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[armneonpostgres.OrganizationResource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + organizationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("organizationName")]) + if err != nil { + return nil, err + } + respr, errRespr := o.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, organizationNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } beginCreateOrUpdate = &respr o.beginCreateOrUpdate.add(req, beginCreateOrUpdate) } @@ -178,24 +179,24 @@ func (o *OrganizationsServerTransport) dispatchBeginDelete(req *http.Request) (* } beginDelete := o.beginDelete.get(req) if beginDelete == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - 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 - } - organizationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("organizationName")]) - if err != nil { - return nil, err - } - respr, errRespr := o.srv.BeginDelete(req.Context(), resourceGroupNameParam, organizationNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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 + } + organizationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("organizationName")]) + if err != nil { + return nil, err + } + respr, errRespr := o.srv.BeginDelete(req.Context(), resourceGroupNameParam, organizationNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } beginDelete = &respr o.beginDelete.add(req, beginDelete) } @@ -255,17 +256,17 @@ func (o *OrganizationsServerTransport) dispatchNewListByResourceGroupPager(req * } newListByResourceGroupPager := o.newListByResourceGroupPager.get(req) if newListByResourceGroupPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - resp := o.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } +resp := o.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) newListByResourceGroupPager = &resp o.newListByResourceGroupPager.add(req, newListByResourceGroupPager) server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armneonpostgres.OrganizationsClientListByResourceGroupResponse, createLink func() string) { @@ -292,13 +293,13 @@ func (o *OrganizationsServerTransport) dispatchNewListBySubscriptionPager(req *h } newListBySubscriptionPager := o.newListBySubscriptionPager.get(req) if newListBySubscriptionPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resp := o.srv.NewListBySubscriptionPager(nil) + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } +resp := o.srv.NewListBySubscriptionPager(nil) newListBySubscriptionPager = &resp o.newListBySubscriptionPager.add(req, newListBySubscriptionPager) server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armneonpostgres.OrganizationsClientListBySubscriptionResponse, createLink func() string) { @@ -325,28 +326,28 @@ func (o *OrganizationsServerTransport) dispatchBeginUpdate(req *http.Request) (* } beginUpdate := o.beginUpdate.get(req) if beginUpdate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - 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) - } - body, err := server.UnmarshalRequestAsJSON[armneonpostgres.OrganizationResource](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - organizationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("organizationName")]) - if err != nil { - return nil, err - } - respr, errRespr := o.srv.BeginUpdate(req.Context(), resourceGroupNameParam, organizationNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[armneonpostgres.OrganizationResource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + organizationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("organizationName")]) + if err != nil { + return nil, err + } + respr, errRespr := o.srv.BeginUpdate(req.Context(), resourceGroupNameParam, organizationNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } beginUpdate = &respr o.beginUpdate.add(req, beginUpdate) } diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/server_factory.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/server_factory.go index 556d0757b464..57bd2dbff91b 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/server_factory.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/server_factory.go @@ -20,6 +20,7 @@ type ServerFactory struct { // OrganizationsServer contains the fakes for client OrganizationsClient OrganizationsServer OrganizationsServer + } // NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. @@ -34,9 +35,9 @@ func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { // ServerFactoryTransport connects instances of armneonpostgres.ClientFactory to instances of ServerFactory. // Don't use this type directly, use NewServerFactoryTransport instead. type ServerFactoryTransport struct { - srv *ServerFactory - trMu sync.Mutex - trOperationsServer *OperationsServerTransport + srv *ServerFactory + trMu sync.Mutex + trOperationsServer *OperationsServerTransport trOrganizationsServer *OrganizationsServerTransport } @@ -57,9 +58,7 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) resp, err = s.trOperationsServer.Do(req) case "OrganizationsClient": - initServer(s, &s.trOrganizationsServer, func() *OrganizationsServerTransport { - return NewOrganizationsServerTransport(&s.srv.OrganizationsServer) - }) + initServer(s, &s.trOrganizationsServer, func() *OrganizationsServerTransport { return NewOrganizationsServerTransport(&s.srv.OrganizationsServer) }) resp, err = s.trOrganizationsServer.Do(req) default: err = fmt.Errorf("unhandled client %s", client) diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/time_rfc3339.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/time_rfc3339.go index 87ee11e83b32..6a44c12dade4 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/time_rfc3339.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/time_rfc3339.go @@ -4,6 +4,8 @@ package fake + + import ( "encoding/json" "fmt" @@ -14,6 +16,8 @@ import ( "time" ) + + // Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) @@ -84,6 +88,7 @@ func (t dateTimeRFC3339) String() string { return time.Time(t).Format(time.RFC3339Nano) } + func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/models.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/models.go index c2f676abe180..905970ef3e67 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/models.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/models.go @@ -8,220 +8,221 @@ import "time" // CompanyDetails - Company details for an organization type CompanyDetails struct { - // Business phone number of the company +// Business phone number of the company BusinessPhone *string - // Company name +// Company name CompanyName *string - // Country name of the company +// Country name of the company Country *string - // Domain of the user +// Domain of the user Domain *string - // Number of employees in the company +// Number of employees in the company NumberOfEmployees *int64 - // Office address of the company +// Office address of the company OfficeAddress *string } // MarketplaceDetails - Marketplace details for an organization type MarketplaceDetails struct { - // REQUIRED; Offer details for the marketplace that is selected by the user +// REQUIRED; Offer details for the marketplace that is selected by the user OfferDetails *OfferDetails - // SaaS subscription id for the the marketplace offer +// SaaS subscription id for the the marketplace offer SubscriptionID *string - // Marketplace subscription status +// Marketplace subscription status SubscriptionStatus *MarketplaceSubscriptionStatus } // OfferDetails - Offer details for the marketplace that is selected by the user type OfferDetails struct { - // REQUIRED; Offer Id for the marketplace offer +// REQUIRED; Offer Id for the marketplace offer OfferID *string - // REQUIRED; Plan Id for the marketplace offer +// REQUIRED; Plan Id for the marketplace offer PlanID *string - // REQUIRED; Publisher Id for the marketplace offer +// REQUIRED; Publisher Id for the marketplace offer PublisherID *string - // Plan Name for the marketplace offer +// Plan Name for the marketplace offer PlanName *string - // Term Id for the marketplace offer +// Term Id for the marketplace offer TermID *string - // Term Name for the marketplace offer +// Term Name for the marketplace offer TermUnit *string } // Operation - Details of a REST API operation, returned from the Resource Provider Operations API type Operation struct { - // Extensible 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; Localized display information for this particular operation. +// 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. +// 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", - // "Microsoft.Compute/virtualMachines/capture/action" +// READ-ONLY; The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", +// "Microsoft.Compute/virtualMachines/capture/action" Name *string - // READ-ONLY; The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default - // value is "user,system" +// READ-ONLY; The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default +// value is "user,system" Origin *Origin } // 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. +// READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views. Description *string - // READ-ONLY; The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual - // Machine", "Restart Virtual Machine". +// READ-ONLY; The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual +// Machine", "Restart Virtual Machine". Operation *string - // READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft - // Compute". +// READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft +// Compute". Provider *string - // READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job - // Schedule Collections". +// READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job +// Schedule Collections". Resource *string } // 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 { - // REQUIRED; The Operation items on this page +// REQUIRED; The Operation items on this page Value []*Operation - // The link to the next page of items +// The link to the next page of items NextLink *string } // OrganizationProperties - Properties specific to Data Organization resource type OrganizationProperties struct { - // REQUIRED; Details of the company. +// REQUIRED; Details of the company. CompanyDetails *CompanyDetails - // REQUIRED; Marketplace details of the resource. +// REQUIRED; Marketplace details of the resource. MarketplaceDetails *MarketplaceDetails - // REQUIRED; Details of the user. +// REQUIRED; Details of the user. UserDetails *UserDetails - // Organization properties +// Organization properties PartnerOrganizationProperties *PartnerOrganizationProperties - // READ-ONLY; Provisioning state of the resource. +// READ-ONLY; Provisioning state of the resource. ProvisioningState *ResourceProvisioningState } // OrganizationResource - Organization Resource by Neon type OrganizationResource struct { - // REQUIRED; The geo-location where the resource lives +// REQUIRED; The geo-location where the resource lives Location *string - // The resource-specific properties for this resource. +// The resource-specific properties for this resource. Properties *OrganizationProperties - // Resource tags. +// Resource tags. Tags map[string]*string - // READ-ONLY; Name of the Neon Organizations resource +// READ-ONLY; Name of the Neon Organizations resource Name *string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. +// 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" +// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // OrganizationResourceListResult - The response of a OrganizationResource list operation. type OrganizationResourceListResult struct { - // REQUIRED; The OrganizationResource items on this page +// REQUIRED; The OrganizationResource items on this page Value []*OrganizationResource - // The link to the next page of items +// The link to the next page of items NextLink *string } // PartnerOrganizationProperties - Properties specific to Partner's organization type PartnerOrganizationProperties struct { - // REQUIRED; Organization name in partner's system +// REQUIRED; Organization name in partner's system OrganizationName *string - // Organization Id in partner's system +// Organization Id in partner's system OrganizationID *string - // Single Sign On properties for the organization +// Single Sign On properties for the organization SingleSignOnProperties *SingleSignOnProperties } // SingleSignOnProperties - Properties specific to Single Sign On Resource type SingleSignOnProperties struct { - // List of AAD domains fetched from Microsoft Graph for user. +// List of AAD domains fetched from Microsoft Graph for user. AADDomains []*string - // AAD enterprise application Id used to setup SSO +// AAD enterprise application Id used to setup SSO EnterpriseAppID *string - // State of the Single Sign On for the organization +// State of the Single Sign On for the organization SingleSignOnState *SingleSignOnStates - // URL for SSO to be used by the partner to redirect the user to their system +// URL for SSO to be used by the partner to redirect the user to their system SingleSignOnURL *string } // SystemData - Metadata pertaining to creation and last modification of the resource. type SystemData struct { - // The timestamp of resource creation (UTC). +// The timestamp of resource creation (UTC). CreatedAt *time.Time - // The identity that created the resource. +// The identity that created the resource. CreatedBy *string - // The type of identity that created the resource. +// The type of identity that created the resource. CreatedByType *CreatedByType - // The timestamp of resource last modification (UTC) +// The timestamp of resource last modification (UTC) LastModifiedAt *time.Time - // The identity that last modified the resource. +// The identity that last modified the resource. LastModifiedBy *string - // The type of identity that last modified the resource. +// The type of identity that last modified the resource. LastModifiedByType *CreatedByType } // UserDetails - User details for an organization type UserDetails struct { - // Email address of the user +// Email address of the user EmailAddress *string - // First name of the user +// First name of the user FirstName *string - // Last name of the user +// Last name of the user LastName *string - // User's phone number +// User's phone number PhoneNumber *string - // User's principal name +// User's principal name Upn *string } + diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/models_serde.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/models_serde.go index 717b61c582bb..c2e97bd46293 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/models_serde.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/models_serde.go @@ -33,22 +33,22 @@ func (c *CompanyDetails) UnmarshalJSON(data []byte) error { var err error switch key { case "businessPhone": - err = unpopulate(val, "BusinessPhone", &c.BusinessPhone) + err = unpopulate(val, "BusinessPhone", &c.BusinessPhone) delete(rawMsg, key) case "companyName": - err = unpopulate(val, "CompanyName", &c.CompanyName) + err = unpopulate(val, "CompanyName", &c.CompanyName) delete(rawMsg, key) case "country": - err = unpopulate(val, "Country", &c.Country) + err = unpopulate(val, "Country", &c.Country) delete(rawMsg, key) case "domain": - err = unpopulate(val, "Domain", &c.Domain) + err = unpopulate(val, "Domain", &c.Domain) delete(rawMsg, key) case "numberOfEmployees": - err = unpopulate(val, "NumberOfEmployees", &c.NumberOfEmployees) + err = unpopulate(val, "NumberOfEmployees", &c.NumberOfEmployees) delete(rawMsg, key) case "officeAddress": - err = unpopulate(val, "OfficeAddress", &c.OfficeAddress) + err = unpopulate(val, "OfficeAddress", &c.OfficeAddress) delete(rawMsg, key) } if err != nil { @@ -77,13 +77,13 @@ func (m *MarketplaceDetails) UnmarshalJSON(data []byte) error { var err error switch key { case "offerDetails": - err = unpopulate(val, "OfferDetails", &m.OfferDetails) + err = unpopulate(val, "OfferDetails", &m.OfferDetails) delete(rawMsg, key) case "subscriptionId": - err = unpopulate(val, "SubscriptionID", &m.SubscriptionID) + err = unpopulate(val, "SubscriptionID", &m.SubscriptionID) delete(rawMsg, key) case "subscriptionStatus": - err = unpopulate(val, "SubscriptionStatus", &m.SubscriptionStatus) + err = unpopulate(val, "SubscriptionStatus", &m.SubscriptionStatus) delete(rawMsg, key) } if err != nil { @@ -115,22 +115,22 @@ func (o *OfferDetails) UnmarshalJSON(data []byte) error { var err error switch key { case "offerId": - err = unpopulate(val, "OfferID", &o.OfferID) + err = unpopulate(val, "OfferID", &o.OfferID) delete(rawMsg, key) case "planId": - err = unpopulate(val, "PlanID", &o.PlanID) + err = unpopulate(val, "PlanID", &o.PlanID) delete(rawMsg, key) case "planName": - err = unpopulate(val, "PlanName", &o.PlanName) + err = unpopulate(val, "PlanName", &o.PlanName) delete(rawMsg, key) case "publisherId": - err = unpopulate(val, "PublisherID", &o.PublisherID) + err = unpopulate(val, "PublisherID", &o.PublisherID) delete(rawMsg, key) case "termId": - err = unpopulate(val, "TermID", &o.TermID) + err = unpopulate(val, "TermID", &o.TermID) delete(rawMsg, key) case "termUnit": - err = unpopulate(val, "TermUnit", &o.TermUnit) + err = unpopulate(val, "TermUnit", &o.TermUnit) delete(rawMsg, key) } if err != nil { @@ -161,19 +161,19 @@ func (o *Operation) UnmarshalJSON(data []byte) error { var err error switch key { case "actionType": - err = unpopulate(val, "ActionType", &o.ActionType) + err = unpopulate(val, "ActionType", &o.ActionType) delete(rawMsg, key) case "display": - err = unpopulate(val, "Display", &o.Display) + err = unpopulate(val, "Display", &o.Display) delete(rawMsg, key) case "isDataAction": - err = unpopulate(val, "IsDataAction", &o.IsDataAction) + err = unpopulate(val, "IsDataAction", &o.IsDataAction) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &o.Name) + err = unpopulate(val, "Name", &o.Name) delete(rawMsg, key) case "origin": - err = unpopulate(val, "Origin", &o.Origin) + err = unpopulate(val, "Origin", &o.Origin) delete(rawMsg, key) } if err != nil { @@ -203,16 +203,16 @@ func (o *OperationDisplay) UnmarshalJSON(data []byte) error { var err error switch key { case "description": - err = unpopulate(val, "Description", &o.Description) + err = unpopulate(val, "Description", &o.Description) delete(rawMsg, key) case "operation": - err = unpopulate(val, "Operation", &o.Operation) + err = unpopulate(val, "Operation", &o.Operation) delete(rawMsg, key) case "provider": - err = unpopulate(val, "Provider", &o.Provider) + err = unpopulate(val, "Provider", &o.Provider) delete(rawMsg, key) case "resource": - err = unpopulate(val, "Resource", &o.Resource) + err = unpopulate(val, "Resource", &o.Resource) delete(rawMsg, key) } if err != nil { @@ -240,10 +240,10 @@ func (o *OperationListResult) UnmarshalJSON(data []byte) error { var err error switch key { case "nextLink": - err = unpopulate(val, "NextLink", &o.NextLink) + err = unpopulate(val, "NextLink", &o.NextLink) delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &o.Value) + err = unpopulate(val, "Value", &o.Value) delete(rawMsg, key) } if err != nil { @@ -274,19 +274,19 @@ func (o *OrganizationProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "companyDetails": - err = unpopulate(val, "CompanyDetails", &o.CompanyDetails) + err = unpopulate(val, "CompanyDetails", &o.CompanyDetails) delete(rawMsg, key) case "marketplaceDetails": - err = unpopulate(val, "MarketplaceDetails", &o.MarketplaceDetails) + err = unpopulate(val, "MarketplaceDetails", &o.MarketplaceDetails) delete(rawMsg, key) case "partnerOrganizationProperties": - err = unpopulate(val, "PartnerOrganizationProperties", &o.PartnerOrganizationProperties) + err = unpopulate(val, "PartnerOrganizationProperties", &o.PartnerOrganizationProperties) delete(rawMsg, key) case "provisioningState": - err = unpopulate(val, "ProvisioningState", &o.ProvisioningState) + err = unpopulate(val, "ProvisioningState", &o.ProvisioningState) delete(rawMsg, key) case "userDetails": - err = unpopulate(val, "UserDetails", &o.UserDetails) + err = unpopulate(val, "UserDetails", &o.UserDetails) delete(rawMsg, key) } if err != nil { @@ -319,25 +319,25 @@ func (o *OrganizationResource) UnmarshalJSON(data []byte) error { var err error switch key { case "id": - err = unpopulate(val, "ID", &o.ID) + err = unpopulate(val, "ID", &o.ID) delete(rawMsg, key) case "location": - err = unpopulate(val, "Location", &o.Location) + err = unpopulate(val, "Location", &o.Location) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &o.Name) + err = unpopulate(val, "Name", &o.Name) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &o.Properties) + err = unpopulate(val, "Properties", &o.Properties) delete(rawMsg, key) case "systemData": - err = unpopulate(val, "SystemData", &o.SystemData) + err = unpopulate(val, "SystemData", &o.SystemData) delete(rawMsg, key) case "tags": - err = unpopulate(val, "Tags", &o.Tags) + err = unpopulate(val, "Tags", &o.Tags) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &o.Type) + err = unpopulate(val, "Type", &o.Type) delete(rawMsg, key) } if err != nil { @@ -365,10 +365,10 @@ func (o *OrganizationResourceListResult) UnmarshalJSON(data []byte) error { var err error switch key { case "nextLink": - err = unpopulate(val, "NextLink", &o.NextLink) + err = unpopulate(val, "NextLink", &o.NextLink) delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &o.Value) + err = unpopulate(val, "Value", &o.Value) delete(rawMsg, key) } if err != nil { @@ -397,13 +397,13 @@ func (p *PartnerOrganizationProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "organizationId": - err = unpopulate(val, "OrganizationID", &p.OrganizationID) + err = unpopulate(val, "OrganizationID", &p.OrganizationID) delete(rawMsg, key) case "organizationName": - err = unpopulate(val, "OrganizationName", &p.OrganizationName) + err = unpopulate(val, "OrganizationName", &p.OrganizationName) delete(rawMsg, key) case "singleSignOnProperties": - err = unpopulate(val, "SingleSignOnProperties", &p.SingleSignOnProperties) + err = unpopulate(val, "SingleSignOnProperties", &p.SingleSignOnProperties) delete(rawMsg, key) } if err != nil { @@ -433,16 +433,16 @@ func (s *SingleSignOnProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "aadDomains": - err = unpopulate(val, "AADDomains", &s.AADDomains) + err = unpopulate(val, "AADDomains", &s.AADDomains) delete(rawMsg, key) case "enterpriseAppId": - err = unpopulate(val, "EnterpriseAppID", &s.EnterpriseAppID) + err = unpopulate(val, "EnterpriseAppID", &s.EnterpriseAppID) delete(rawMsg, key) case "singleSignOnState": - err = unpopulate(val, "SingleSignOnState", &s.SingleSignOnState) + err = unpopulate(val, "SingleSignOnState", &s.SingleSignOnState) delete(rawMsg, key) case "singleSignOnUrl": - err = unpopulate(val, "SingleSignOnURL", &s.SingleSignOnURL) + err = unpopulate(val, "SingleSignOnURL", &s.SingleSignOnURL) delete(rawMsg, key) } if err != nil { @@ -474,22 +474,22 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { var err error switch key { case "createdAt": - err = unpopulateDateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + err = unpopulateDateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) delete(rawMsg, key) case "createdBy": - err = unpopulate(val, "CreatedBy", &s.CreatedBy) + err = unpopulate(val, "CreatedBy", &s.CreatedBy) delete(rawMsg, key) case "createdByType": - err = unpopulate(val, "CreatedByType", &s.CreatedByType) + err = unpopulate(val, "CreatedByType", &s.CreatedByType) delete(rawMsg, key) case "lastModifiedAt": - err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) delete(rawMsg, key) case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) delete(rawMsg, key) case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) delete(rawMsg, key) } if err != nil { @@ -520,19 +520,19 @@ func (u *UserDetails) UnmarshalJSON(data []byte) error { var err error switch key { case "emailAddress": - err = unpopulate(val, "EmailAddress", &u.EmailAddress) + err = unpopulate(val, "EmailAddress", &u.EmailAddress) delete(rawMsg, key) case "firstName": - err = unpopulate(val, "FirstName", &u.FirstName) + err = unpopulate(val, "FirstName", &u.FirstName) delete(rawMsg, key) case "lastName": - err = unpopulate(val, "LastName", &u.LastName) + err = unpopulate(val, "LastName", &u.LastName) delete(rawMsg, key) case "phoneNumber": - err = unpopulate(val, "PhoneNumber", &u.PhoneNumber) + err = unpopulate(val, "PhoneNumber", &u.PhoneNumber) delete(rawMsg, key) case "upn": - err = unpopulate(val, "Upn", &u.Upn) + err = unpopulate(val, "Upn", &u.Upn) delete(rawMsg, key) } if err != nil { @@ -561,3 +561,4 @@ func unpopulate(data json.RawMessage, fn string, v any) error { } return nil } + diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/operations_client.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/operations_client.go index d4de494eccb2..c59b48741443 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/operations_client.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/operations_client.go @@ -28,7 +28,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO return nil, err } client := &OperationsClient{ - internal: cl, + internal: cl, } return client, nil } @@ -37,13 +37,13 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // // Generated from API version 2024-08-01-preview // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. -func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { +func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) (*runtime.Pager[OperationsClientListResponse]) { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ More: func(page OperationsClientListResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OperationsClient.NewListPager") + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OperationsClient.NewListPager") nextLink := "" if page != nil { nextLink = *page.NextLink @@ -55,7 +55,7 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption return OperationsClientListResponse{}, err } return client.listHandleResponse(resp) - }, + }, Tracer: client.internal.Tracer(), }) } @@ -82,3 +82,4 @@ func (client *OperationsClient) listHandleResponse(resp *http.Response) (Operati } return result, nil } + diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/operations_client_example_test.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/operations_client_example_test.go index 88e995b751b9..9522f5803dab 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/operations_client_example_test.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/operations_client_example_test.go @@ -54,3 +54,4 @@ func ExampleOperationsClient_NewListPager() { // } } } + diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/options.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/options.go index bfccbb6f8dfa..41cb5e2915da 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/options.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/options.go @@ -12,19 +12,19 @@ type OperationsClientListOptions struct { // OrganizationsClientBeginCreateOrUpdateOptions contains the optional parameters for the OrganizationsClient.BeginCreateOrUpdate // method. type OrganizationsClientBeginCreateOrUpdateOptions struct { - // Resumes the long-running operation from the provided token. +// Resumes the long-running operation from the provided token. ResumeToken string } // OrganizationsClientBeginDeleteOptions contains the optional parameters for the OrganizationsClient.BeginDelete method. type OrganizationsClientBeginDeleteOptions struct { - // Resumes the long-running operation from the provided token. +// Resumes the long-running operation from the provided token. ResumeToken string } // OrganizationsClientBeginUpdateOptions contains the optional parameters for the OrganizationsClient.BeginUpdate method. type OrganizationsClientBeginUpdateOptions struct { - // Resumes the long-running operation from the provided token. +// Resumes the long-running operation from the provided token. ResumeToken string } @@ -44,3 +44,4 @@ type OrganizationsClientListByResourceGroupOptions struct { type OrganizationsClientListBySubscriptionOptions struct { // placeholder for future optional parameters } + diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/organizations_client.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/organizations_client.go index 81c23c12b462..a909cb037e5d 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/organizations_client.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/organizations_client.go @@ -19,7 +19,7 @@ import ( // OrganizationsClient contains the methods for the Organizations group. // Don't use this type directly, use NewOrganizationsClient() instead. type OrganizationsClient struct { - internal *arm.Client + internal *arm.Client subscriptionID string } @@ -34,7 +34,7 @@ func NewOrganizationsClient(subscriptionID string, credential azcore.TokenCreden } client := &OrganizationsClient{ subscriptionID: subscriptionID, - internal: cl, + internal: cl, } return client, nil } @@ -114,10 +114,10 @@ func (client *OrganizationsClient) createOrUpdateCreateRequest(ctx context.Conte 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 - } - return req, nil +if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err +} +; return req, nil } // BeginDelete - Delete a OrganizationResource @@ -266,13 +266,13 @@ func (client *OrganizationsClient) getHandleResponse(resp *http.Response) (Organ // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - OrganizationsClientListByResourceGroupOptions contains the optional parameters for the OrganizationsClient.NewListByResourceGroupPager // method. -func (client *OrganizationsClient) NewListByResourceGroupPager(resourceGroupName string, options *OrganizationsClientListByResourceGroupOptions) *runtime.Pager[OrganizationsClientListByResourceGroupResponse] { +func (client *OrganizationsClient) NewListByResourceGroupPager(resourceGroupName string, options *OrganizationsClientListByResourceGroupOptions) (*runtime.Pager[OrganizationsClientListByResourceGroupResponse]) { return runtime.NewPager(runtime.PagingHandler[OrganizationsClientListByResourceGroupResponse]{ More: func(page OrganizationsClientListByResourceGroupResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *OrganizationsClientListByResourceGroupResponse) (OrganizationsClientListByResourceGroupResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OrganizationsClient.NewListByResourceGroupPager") + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OrganizationsClient.NewListByResourceGroupPager") nextLink := "" if page != nil { nextLink = *page.NextLink @@ -284,7 +284,7 @@ func (client *OrganizationsClient) NewListByResourceGroupPager(resourceGroupName return OrganizationsClientListByResourceGroupResponse{}, err } return client.listByResourceGroupHandleResponse(resp) - }, + }, Tracer: client.internal.Tracer(), }) } @@ -325,13 +325,13 @@ func (client *OrganizationsClient) listByResourceGroupHandleResponse(resp *http. // Generated from API version 2024-08-01-preview // - options - OrganizationsClientListBySubscriptionOptions contains the optional parameters for the OrganizationsClient.NewListBySubscriptionPager // method. -func (client *OrganizationsClient) NewListBySubscriptionPager(options *OrganizationsClientListBySubscriptionOptions) *runtime.Pager[OrganizationsClientListBySubscriptionResponse] { +func (client *OrganizationsClient) NewListBySubscriptionPager(options *OrganizationsClientListBySubscriptionOptions) (*runtime.Pager[OrganizationsClientListBySubscriptionResponse]) { return runtime.NewPager(runtime.PagingHandler[OrganizationsClientListBySubscriptionResponse]{ More: func(page OrganizationsClientListBySubscriptionResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *OrganizationsClientListBySubscriptionResponse) (OrganizationsClientListBySubscriptionResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OrganizationsClient.NewListBySubscriptionPager") + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OrganizationsClient.NewListBySubscriptionPager") nextLink := "" if page != nil { nextLink = *page.NextLink @@ -343,7 +343,7 @@ func (client *OrganizationsClient) NewListBySubscriptionPager(options *Organizat return OrganizationsClientListBySubscriptionResponse{}, err } return client.listBySubscriptionHandleResponse(resp) - }, + }, Tracer: client.internal.Tracer(), }) } @@ -450,8 +450,9 @@ func (client *OrganizationsClient) updateCreateRequest(ctx context.Context, reso 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 - } - return req, nil +if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err } +; return req, nil +} + diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/organizations_client_example_test.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/organizations_client_example_test.go index 8c1b36426b1d..43a86f975190 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/organizations_client_example_test.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/organizations_client_example_test.go @@ -26,39 +26,39 @@ func ExampleOrganizationsClient_BeginCreateOrUpdate() { poller, err := clientFactory.NewOrganizationsClient().BeginCreateOrUpdate(ctx, "rgneon", "XB-.:", armneonpostgres.OrganizationResource{ Properties: &armneonpostgres.OrganizationProperties{ MarketplaceDetails: &armneonpostgres.MarketplaceDetails{ - SubscriptionID: to.Ptr("yxmkfivp"), + SubscriptionID: to.Ptr("yxmkfivp"), SubscriptionStatus: to.Ptr(armneonpostgres.MarketplaceSubscriptionStatusPendingFulfillmentStart), OfferDetails: &armneonpostgres.OfferDetails{ PublisherID: to.Ptr("hporaxnopmolttlnkbarw"), - OfferID: to.Ptr("bunyeeupoedueofwrzej"), - PlanID: to.Ptr("nlbfiwtslenfwek"), - PlanName: to.Ptr("ljbmgpkfqklaufacbpml"), - TermUnit: to.Ptr("qbcq"), - TermID: to.Ptr("aedlchikwqckuploswthvshe"), + OfferID: to.Ptr("bunyeeupoedueofwrzej"), + PlanID: to.Ptr("nlbfiwtslenfwek"), + PlanName: to.Ptr("ljbmgpkfqklaufacbpml"), + TermUnit: to.Ptr("qbcq"), + TermID: to.Ptr("aedlchikwqckuploswthvshe"), }, }, UserDetails: &armneonpostgres.UserDetails{ - FirstName: to.Ptr("buwwe"), - LastName: to.Ptr("escynjpynkoox"), + FirstName: to.Ptr("buwwe"), + LastName: to.Ptr("escynjpynkoox"), EmailAddress: to.Ptr("3i_%@w8-y.H-p.tvj.dG"), - Upn: to.Ptr("fwedjamgwwrotcjaucuzdwycfjdqn"), - PhoneNumber: to.Ptr("dlrqoowumy"), + Upn: to.Ptr("fwedjamgwwrotcjaucuzdwycfjdqn"), + PhoneNumber: to.Ptr("dlrqoowumy"), }, CompanyDetails: &armneonpostgres.CompanyDetails{ - CompanyName: to.Ptr("uxn"), - Country: to.Ptr("lpajqzptqchuko"), - OfficeAddress: to.Ptr("chpkrlpmfslmawgunjxdllzcrctykq"), - BusinessPhone: to.Ptr("hbeb"), - Domain: to.Ptr("krjldeakhwiepvs"), + CompanyName: to.Ptr("uxn"), + Country: to.Ptr("lpajqzptqchuko"), + OfficeAddress: to.Ptr("chpkrlpmfslmawgunjxdllzcrctykq"), + BusinessPhone: to.Ptr("hbeb"), + Domain: to.Ptr("krjldeakhwiepvs"), NumberOfEmployees: to.Ptr[int64](23), }, PartnerOrganizationProperties: &armneonpostgres.PartnerOrganizationProperties{ - OrganizationID: to.Ptr("nrhvoqzulowcunhmvwfgjcaibvwcl"), + OrganizationID: to.Ptr("nrhvoqzulowcunhmvwfgjcaibvwcl"), OrganizationName: to.Ptr("2__.-"), SingleSignOnProperties: &armneonpostgres.SingleSignOnProperties{ SingleSignOnState: to.Ptr(armneonpostgres.SingleSignOnStatesInitial), - EnterpriseAppID: to.Ptr("fpibacregjfncfdsojs"), - SingleSignOnURL: to.Ptr("tmojh"), + EnterpriseAppID: to.Ptr("fpibacregjfncfdsojs"), + SingleSignOnURL: to.Ptr("tmojh"), AADDomains: []*string{ to.Ptr("kndszgrwzbvvlssvkej"), }, @@ -441,27 +441,27 @@ func ExampleOrganizationsClient_BeginUpdate() { poller, err := clientFactory.NewOrganizationsClient().BeginUpdate(ctx, "rgneon", "eRY-J_:", armneonpostgres.OrganizationResource{ Properties: &armneonpostgres.OrganizationProperties{ UserDetails: &armneonpostgres.UserDetails{ - FirstName: to.Ptr("buwwe"), - LastName: to.Ptr("escynjpynkoox"), + FirstName: to.Ptr("buwwe"), + LastName: to.Ptr("escynjpynkoox"), EmailAddress: to.Ptr("3i_%@w8-y.H-p.tvj.dG"), - Upn: to.Ptr("fwedjamgwwrotcjaucuzdwycfjdqn"), - PhoneNumber: to.Ptr("dlrqoowumy"), + Upn: to.Ptr("fwedjamgwwrotcjaucuzdwycfjdqn"), + PhoneNumber: to.Ptr("dlrqoowumy"), }, CompanyDetails: &armneonpostgres.CompanyDetails{ - CompanyName: to.Ptr("uxn"), - Country: to.Ptr("lpajqzptqchuko"), - OfficeAddress: to.Ptr("chpkrlpmfslmawgunjxdllzcrctykq"), - BusinessPhone: to.Ptr("hbeb"), - Domain: to.Ptr("krjldeakhwiepvs"), + CompanyName: to.Ptr("uxn"), + Country: to.Ptr("lpajqzptqchuko"), + OfficeAddress: to.Ptr("chpkrlpmfslmawgunjxdllzcrctykq"), + BusinessPhone: to.Ptr("hbeb"), + Domain: to.Ptr("krjldeakhwiepvs"), NumberOfEmployees: to.Ptr[int64](23), }, PartnerOrganizationProperties: &armneonpostgres.PartnerOrganizationProperties{ - OrganizationID: to.Ptr("njyoqflcmfwzfsqe"), + OrganizationID: to.Ptr("njyoqflcmfwzfsqe"), OrganizationName: to.Ptr("J:.._3P"), SingleSignOnProperties: &armneonpostgres.SingleSignOnProperties{ SingleSignOnState: to.Ptr(armneonpostgres.SingleSignOnStatesInitial), - EnterpriseAppID: to.Ptr("fpibacregjfncfdsojs"), - SingleSignOnURL: to.Ptr("tmojh"), + EnterpriseAppID: to.Ptr("fpibacregjfncfdsojs"), + SingleSignOnURL: to.Ptr("tmojh"), AADDomains: []*string{ to.Ptr("kndszgrwzbvvlssvkej"), }, @@ -544,3 +544,4 @@ func ExampleOrganizationsClient_BeginUpdate() { // }, // } } + diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/responses.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/responses.go index 1eacfafa5069..26ebaeae9fcf 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/responses.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/responses.go @@ -6,13 +6,13 @@ package armneonpostgres // OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { - // A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. +// A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. OperationListResult } // OrganizationsClientCreateOrUpdateResponse contains the response from method OrganizationsClient.BeginCreateOrUpdate. type OrganizationsClientCreateOrUpdateResponse struct { - // Organization Resource by Neon +// Organization Resource by Neon OrganizationResource } @@ -23,24 +23,25 @@ type OrganizationsClientDeleteResponse struct { // OrganizationsClientGetResponse contains the response from method OrganizationsClient.Get. type OrganizationsClientGetResponse struct { - // Organization Resource by Neon +// Organization Resource by Neon OrganizationResource } // OrganizationsClientListByResourceGroupResponse contains the response from method OrganizationsClient.NewListByResourceGroupPager. type OrganizationsClientListByResourceGroupResponse struct { - // The response of a OrganizationResource list operation. +// The response of a OrganizationResource list operation. OrganizationResourceListResult } // OrganizationsClientListBySubscriptionResponse contains the response from method OrganizationsClient.NewListBySubscriptionPager. type OrganizationsClientListBySubscriptionResponse struct { - // The response of a OrganizationResource list operation. +// The response of a OrganizationResource list operation. OrganizationResourceListResult } // OrganizationsClientUpdateResponse contains the response from method OrganizationsClient.BeginUpdate. type OrganizationsClientUpdateResponse struct { - // Organization Resource by Neon +// Organization Resource by Neon OrganizationResource } + diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/time_rfc3339.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/time_rfc3339.go index 302675535299..e9ae5b05483d 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/time_rfc3339.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/time_rfc3339.go @@ -4,6 +4,8 @@ package armneonpostgres + + import ( "encoding/json" "fmt" @@ -14,6 +16,8 @@ import ( "time" ) + + // Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) @@ -84,6 +88,7 @@ func (t dateTimeRFC3339) String() string { return time.Time(t).Format(time.RFC3339Nano) } + func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/tsp-location.yaml b/sdk/resourcemanager/neonpostgres/armneonpostgres/tsp-location.yaml index 471fdd5cc1b4..dc0aa7fb0369 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/tsp-location.yaml +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/liftrneon/Neon.Postgres.Management -commit: d477c7caa09bf82e22c419be0a99d170552b5892 +commit: 405438c72094a0a43fbcba18a56aa71110b78db8 repo: Azure/azure-rest-api-specs -additionalDirectories: +additionalDirectories: \ No newline at end of file diff --git a/sdk/resourcemanager/sitemanager/armsitemanager/CHANGELOG.md b/sdk/resourcemanager/sitemanager/armsitemanager/CHANGELOG.md new file mode 100644 index 000000000000..e4313f1f82a2 --- /dev/null +++ b/sdk/resourcemanager/sitemanager/armsitemanager/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 0.1.0 (2024-11-29) +### Other Changes + +The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sitemanager/armsitemanager` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html). + +To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/go/mgmt). \ No newline at end of file diff --git a/sdk/resourcemanager/sitemanager/armsitemanager/LICENSE.txt b/sdk/resourcemanager/sitemanager/armsitemanager/LICENSE.txt new file mode 100644 index 000000000000..dc0c2ffb3dc1 --- /dev/null +++ b/sdk/resourcemanager/sitemanager/armsitemanager/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Microsoft Corporation. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/resourcemanager/sitemanager/armsitemanager/README.md b/sdk/resourcemanager/sitemanager/armsitemanager/README.md new file mode 100644 index 000000000000..eb53888840b9 --- /dev/null +++ b/sdk/resourcemanager/sitemanager/armsitemanager/README.md @@ -0,0 +1,90 @@ +# Azure Sitemanager Module for Go + +The `armsitemanager` module provides operations for working with Azure Sitemanager. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/sitemanager/armsitemanager) + +# Getting started + +## Prerequisites + +- an [Azure subscription](https://azure.microsoft.com/free/) +- Go 1.18 or above (You could download and install the latest version of Go from [here](https://go.dev/doc/install). It will replace the existing Go on your machine. If you want to install multiple Go versions on the same machine, you could refer this [doc](https://go.dev/doc/manage-install).) + +## Install the package + +This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for versioning and dependency management. + +Install the Azure Sitemanager module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sitemanager/armsitemanager +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Sitemanager. The `azidentity` module provides facilities for various ways of authenticating with Azure including client/secret, certificate, managed identity, and more. + +```go +cred, err := azidentity.NewDefaultAzureCredential(nil) +``` + +For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). + +## Client Factory + +Azure Sitemanager module consists of one or more clients. We provide a client factory which could be used to create any client in this module. + +```go +clientFactory, err := armsitemanager.NewClientFactory(, cred, nil) +``` + +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). + +```go +options := arm.ClientOptions { + ClientOptions: azcore.ClientOptions { + Cloud: cloud.AzureChina, + }, +} +clientFactory, err := armsitemanager.NewClientFactory(, cred, &options) +``` + +## Clients + +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.NewSitesBySubscriptionClient() +``` + +## Fakes + +The fake package contains types used for constructing in-memory fake servers used in unit tests. +This allows writing tests to cover various success/error conditions without the need for connecting to a live service. + +Please see https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/samples/fakes for details and examples on how to use fakes. + +## Provide Feedback + +If you encounter bugs or have suggestions, please +[open an issue](https://github.com/Azure/azure-sdk-for-go/issues) and assign the `Sitemanager` label. + +# Contributing + +This project welcomes contributions and suggestions. Most contributions require +you to agree to a Contributor License Agreement (CLA) declaring that you have +the right to, and actually do, grant us the rights to use your contribution. +For details, visit [https://cla.microsoft.com](https://cla.microsoft.com). + +When you submit a pull request, a CLA-bot will automatically determine whether +you need to provide a CLA and decorate the PR appropriately (e.g., label, +comment). Simply follow the instructions provided by the bot. You will only +need to do this once across all repos using our CLA. + +This project has adopted the +[Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). +For more information, see the +[Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) +or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any +additional questions or comments. \ No newline at end of file diff --git a/sdk/resourcemanager/sitemanager/armsitemanager/ci.yml b/sdk/resourcemanager/sitemanager/armsitemanager/ci.yml new file mode 100644 index 000000000000..01788f4950a3 --- /dev/null +++ b/sdk/resourcemanager/sitemanager/armsitemanager/ci.yml @@ -0,0 +1,28 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. +trigger: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/sitemanager/armsitemanager/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/sitemanager/armsitemanager/ + +extends: + template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + IncludeRelease: true + ServiceDirectory: 'resourcemanager/sitemanager/armsitemanager' diff --git a/sdk/resourcemanager/sitemanager/armsitemanager/client_factory.go b/sdk/resourcemanager/sitemanager/armsitemanager/client_factory.go new file mode 100644 index 000000000000..c32210938fb8 --- /dev/null +++ b/sdk/resourcemanager/sitemanager/armsitemanager/client_factory.go @@ -0,0 +1,49 @@ +// 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 armsitemanager + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" +) + +// ClientFactory is a client factory used to create any client in this module. +// Don't use this type directly, use NewClientFactory instead. +type ClientFactory struct { + subscriptionID string + internal *arm.Client +} + +// NewClientFactory creates a new instance of ClientFactory with the specified values. +// The parameter values will be propagated to any client created from this factory. +// - 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 NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { + internal, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + return &ClientFactory{ + subscriptionID: subscriptionID, + internal: internal, + }, nil +} + +// NewSitesBySubscriptionClient creates a new instance of SitesBySubscriptionClient. +func (c *ClientFactory) NewSitesBySubscriptionClient() *SitesBySubscriptionClient { + return &SitesBySubscriptionClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewSitesClient creates a new instance of SitesClient. +func (c *ClientFactory) NewSitesClient() *SitesClient { + return &SitesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} diff --git a/sdk/resourcemanager/sitemanager/armsitemanager/constants.go b/sdk/resourcemanager/sitemanager/armsitemanager/constants.go new file mode 100644 index 000000000000..938b4a1f6098 --- /dev/null +++ b/sdk/resourcemanager/sitemanager/armsitemanager/constants.go @@ -0,0 +1,55 @@ +// 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 armsitemanager + +const ( + moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sitemanager/armsitemanager" + moduleVersion = "v0.1.0" +) + +// CreatedByType - The kind of entity that created the resource. +type CreatedByType string + +const ( + // 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 - The entity was created by a user. + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{ + CreatedByTypeApplication, + CreatedByTypeKey, + CreatedByTypeManagedIdentity, + CreatedByTypeUser, + } +} + +// ResourceProvisioningState - The provisioning state of a resource type. +type ResourceProvisioningState string + +const ( + // ResourceProvisioningStateCanceled - Resource creation was canceled. + ResourceProvisioningStateCanceled ResourceProvisioningState = "Canceled" + // ResourceProvisioningStateFailed - Resource creation failed. + ResourceProvisioningStateFailed ResourceProvisioningState = "Failed" + // ResourceProvisioningStateSucceeded - Resource has been created. + ResourceProvisioningStateSucceeded ResourceProvisioningState = "Succeeded" +) + +// PossibleResourceProvisioningStateValues returns the possible values for the ResourceProvisioningState const type. +func PossibleResourceProvisioningStateValues() []ResourceProvisioningState { + return []ResourceProvisioningState{ + ResourceProvisioningStateCanceled, + ResourceProvisioningStateFailed, + ResourceProvisioningStateSucceeded, + } +} diff --git a/sdk/resourcemanager/sitemanager/armsitemanager/fake/internal.go b/sdk/resourcemanager/sitemanager/armsitemanager/fake/internal.go new file mode 100644 index 000000000000..7425b6a669e2 --- /dev/null +++ b/sdk/resourcemanager/sitemanager/armsitemanager/fake/internal.go @@ -0,0 +1,65 @@ +// 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 ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "net/http" + "sync" +) + +type result struct { + resp *http.Response + err error +} + +type nonRetriableError struct { + error +} + +func (nonRetriableError) NonRetriable() { + // marker method +} + +func contains[T comparable](s []T, v T) bool { + for _, vv := range s { + if vv == v { + return true + } + } + return false +} + +func newTracker[T any]() *tracker[T] { + return &tracker[T]{ + items: map[string]*T{}, + } +} + +type tracker[T any] struct { + items map[string]*T + mu sync.Mutex +} + +func (p *tracker[T]) get(req *http.Request) *T { + p.mu.Lock() + defer p.mu.Unlock() + if item, ok := p.items[server.SanitizePagerPollerPath(req.URL.Path)]; ok { + return item + } + return nil +} + +func (p *tracker[T]) add(req *http.Request, item *T) { + p.mu.Lock() + defer p.mu.Unlock() + p.items[server.SanitizePagerPollerPath(req.URL.Path)] = item +} + +func (p *tracker[T]) remove(req *http.Request) { + p.mu.Lock() + defer p.mu.Unlock() + delete(p.items, server.SanitizePagerPollerPath(req.URL.Path)) +} diff --git a/sdk/resourcemanager/sitemanager/armsitemanager/fake/server_factory.go b/sdk/resourcemanager/sitemanager/armsitemanager/fake/server_factory.go new file mode 100644 index 000000000000..b0ca6984dca2 --- /dev/null +++ b/sdk/resourcemanager/sitemanager/armsitemanager/fake/server_factory.go @@ -0,0 +1,81 @@ +// 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 ( + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" + "sync" +) + +// ServerFactory is a fake server for instances of the armsitemanager.ClientFactory type. +type ServerFactory struct { + // SitesBySubscriptionServer contains the fakes for client SitesBySubscriptionClient + SitesBySubscriptionServer SitesBySubscriptionServer + + // SitesServer contains the fakes for client SitesClient + SitesServer SitesServer +} + +// NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. +// The returned ServerFactoryTransport instance is connected to an instance of armsitemanager.ClientFactory via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { + return &ServerFactoryTransport{ + srv: srv, + } +} + +// ServerFactoryTransport connects instances of armsitemanager.ClientFactory to instances of ServerFactory. +// Don't use this type directly, use NewServerFactoryTransport instead. +type ServerFactoryTransport struct { + srv *ServerFactory + trMu sync.Mutex + trSitesBySubscriptionServer *SitesBySubscriptionServerTransport + trSitesServer *SitesServerTransport +} + +// Do implements the policy.Transporter interface for ServerFactoryTransport. +func (s *ServerFactoryTransport) 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")} + } + + client := method[:strings.Index(method, ".")] + var resp *http.Response + var err error + + switch client { + case "SitesBySubscriptionClient": + initServer(s, &s.trSitesBySubscriptionServer, func() *SitesBySubscriptionServerTransport { + return NewSitesBySubscriptionServerTransport(&s.srv.SitesBySubscriptionServer) + }) + resp, err = s.trSitesBySubscriptionServer.Do(req) + case "SitesClient": + initServer(s, &s.trSitesServer, func() *SitesServerTransport { return NewSitesServerTransport(&s.srv.SitesServer) }) + resp, err = s.trSitesServer.Do(req) + default: + err = fmt.Errorf("unhandled client %s", client) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func initServer[T any](s *ServerFactoryTransport, dst **T, src func() *T) { + s.trMu.Lock() + if *dst == nil { + *dst = src() + } + s.trMu.Unlock() +} diff --git a/sdk/resourcemanager/sitemanager/armsitemanager/fake/sites_server.go b/sdk/resourcemanager/sitemanager/armsitemanager/fake/sites_server.go new file mode 100644 index 000000000000..d76902de37a3 --- /dev/null +++ b/sdk/resourcemanager/sitemanager/armsitemanager/fake/sites_server.go @@ -0,0 +1,307 @@ +// 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/sitemanager/armsitemanager" + "net/http" + "net/url" + "regexp" +) + +// SitesServer is a fake server for instances of the armsitemanager.SitesClient type. +type SitesServer struct { + // BeginCreateOrUpdate is the fake for method SitesClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, siteName string, resource armsitemanager.Site, options *armsitemanager.SitesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armsitemanager.SitesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // Delete is the fake for method SitesClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, resourceGroupName string, siteName string, options *armsitemanager.SitesClientDeleteOptions) (resp azfake.Responder[armsitemanager.SitesClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method SitesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, siteName string, options *armsitemanager.SitesClientGetOptions) (resp azfake.Responder[armsitemanager.SitesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method SitesClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armsitemanager.SitesClientListByResourceGroupOptions) (resp azfake.PagerResponder[armsitemanager.SitesClientListByResourceGroupResponse]) + + // Update is the fake for method SitesClient.Update + // HTTP status codes to indicate success: http.StatusOK + Update func(ctx context.Context, resourceGroupName string, siteName string, properties armsitemanager.SiteUpdate, options *armsitemanager.SitesClientUpdateOptions) (resp azfake.Responder[armsitemanager.SitesClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewSitesServerTransport creates a new instance of SitesServerTransport with the provided implementation. +// The returned SitesServerTransport instance is connected to an instance of armsitemanager.SitesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewSitesServerTransport(srv *SitesServer) *SitesServerTransport { + return &SitesServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armsitemanager.SitesClientCreateOrUpdateResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armsitemanager.SitesClientListByResourceGroupResponse]](), + } +} + +// SitesServerTransport connects instances of armsitemanager.SitesClient to instances of SitesServer. +// Don't use this type directly, use NewSitesServerTransport instead. +type SitesServerTransport struct { + srv *SitesServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armsitemanager.SitesClientCreateOrUpdateResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armsitemanager.SitesClientListByResourceGroupResponse]] +} + +// Do implements the policy.Transporter interface for SitesServerTransport. +func (s *SitesServerTransport) 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 *SitesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if sitesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = sitesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "SitesClient.BeginCreateOrUpdate": + res.resp, res.err = s.dispatchBeginCreateOrUpdate(req) + case "SitesClient.Delete": + res.resp, res.err = s.dispatchDelete(req) + case "SitesClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "SitesClient.NewListByResourceGroupPager": + res.resp, res.err = s.dispatchNewListByResourceGroupPager(req) + case "SitesClient.Update": + res.resp, res.err = s.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (s *SitesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if s.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := s.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Edge/sites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[armsitemanager.Site](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, siteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + s.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + s.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + s.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (s *SitesServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { + if s.srv.Delete == nil { + return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Edge/sites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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 + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Delete(req.Context(), resourceGroupNameParam, siteNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SitesServerTransport) 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\.Edge/sites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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 + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Get(req.Context(), resourceGroupNameParam, siteNameParam, 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).Site, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SitesServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if s.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := s.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Edge/sites` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resp := s.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) + newListByResourceGroupPager = &resp + s.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armsitemanager.SitesClientListByResourceGroupResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + s.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + s.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (s *SitesServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { + if s.srv.Update == nil { + return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Edge/sites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[armsitemanager.SiteUpdate](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Update(req.Context(), resourceGroupNameParam, siteNameParam, body, 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).Site, req) + if err != nil { + return nil, err + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to SitesServerTransport +var sitesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/sitemanager/armsitemanager/fake/sitesbysubscription_server.go b/sdk/resourcemanager/sitemanager/armsitemanager/fake/sitesbysubscription_server.go new file mode 100644 index 000000000000..4b36c82422df --- /dev/null +++ b/sdk/resourcemanager/sitemanager/armsitemanager/fake/sitesbysubscription_server.go @@ -0,0 +1,287 @@ +// 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/sitemanager/armsitemanager" + "net/http" + "net/url" + "regexp" +) + +// SitesBySubscriptionServer is a fake server for instances of the armsitemanager.SitesBySubscriptionClient type. +type SitesBySubscriptionServer struct { + // BeginCreateOrUpdate is the fake for method SitesBySubscriptionClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, siteName string, resource armsitemanager.Site, options *armsitemanager.SitesBySubscriptionClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armsitemanager.SitesBySubscriptionClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // Delete is the fake for method SitesBySubscriptionClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, siteName string, options *armsitemanager.SitesBySubscriptionClientDeleteOptions) (resp azfake.Responder[armsitemanager.SitesBySubscriptionClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method SitesBySubscriptionClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, siteName string, options *armsitemanager.SitesBySubscriptionClientGetOptions) (resp azfake.Responder[armsitemanager.SitesBySubscriptionClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method SitesBySubscriptionClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(options *armsitemanager.SitesBySubscriptionClientListOptions) (resp azfake.PagerResponder[armsitemanager.SitesBySubscriptionClientListResponse]) + + // Update is the fake for method SitesBySubscriptionClient.Update + // HTTP status codes to indicate success: http.StatusOK + Update func(ctx context.Context, siteName string, properties armsitemanager.SiteUpdate, options *armsitemanager.SitesBySubscriptionClientUpdateOptions) (resp azfake.Responder[armsitemanager.SitesBySubscriptionClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewSitesBySubscriptionServerTransport creates a new instance of SitesBySubscriptionServerTransport with the provided implementation. +// The returned SitesBySubscriptionServerTransport instance is connected to an instance of armsitemanager.SitesBySubscriptionClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewSitesBySubscriptionServerTransport(srv *SitesBySubscriptionServer) *SitesBySubscriptionServerTransport { + return &SitesBySubscriptionServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armsitemanager.SitesBySubscriptionClientCreateOrUpdateResponse]](), + newListPager: newTracker[azfake.PagerResponder[armsitemanager.SitesBySubscriptionClientListResponse]](), + } +} + +// SitesBySubscriptionServerTransport connects instances of armsitemanager.SitesBySubscriptionClient to instances of SitesBySubscriptionServer. +// Don't use this type directly, use NewSitesBySubscriptionServerTransport instead. +type SitesBySubscriptionServerTransport struct { + srv *SitesBySubscriptionServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armsitemanager.SitesBySubscriptionClientCreateOrUpdateResponse]] + newListPager *tracker[azfake.PagerResponder[armsitemanager.SitesBySubscriptionClientListResponse]] +} + +// Do implements the policy.Transporter interface for SitesBySubscriptionServerTransport. +func (s *SitesBySubscriptionServerTransport) 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 *SitesBySubscriptionServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if sitesBySubscriptionServerTransportInterceptor != nil { + res.resp, res.err, intercepted = sitesBySubscriptionServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "SitesBySubscriptionClient.BeginCreateOrUpdate": + res.resp, res.err = s.dispatchBeginCreateOrUpdate(req) + case "SitesBySubscriptionClient.Delete": + res.resp, res.err = s.dispatchDelete(req) + case "SitesBySubscriptionClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "SitesBySubscriptionClient.NewListPager": + res.resp, res.err = s.dispatchNewListPager(req) + case "SitesBySubscriptionClient.Update": + res.resp, res.err = s.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (s *SitesBySubscriptionServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if s.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := s.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Edge/sites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armsitemanager.Site](req) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginCreateOrUpdate(req.Context(), siteNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + s.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + s.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + s.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (s *SitesBySubscriptionServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { + if s.srv.Delete == nil { + return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Edge/sites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Delete(req.Context(), siteNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SitesBySubscriptionServerTransport) 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~%@]+)/providers/Microsoft\.Edge/sites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Get(req.Context(), siteNameParam, 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).Site, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SitesBySubscriptionServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if s.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := s.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Edge/sites` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resp := s.srv.NewListPager(nil) + newListPager = &resp + s.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsitemanager.SitesBySubscriptionClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + s.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + s.newListPager.remove(req) + } + return resp, nil +} + +func (s *SitesBySubscriptionServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { + if s.srv.Update == nil { + return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Edge/sites/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armsitemanager.SiteUpdate](req) + if err != nil { + return nil, err + } + siteNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("siteName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Update(req.Context(), siteNameParam, body, 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).Site, req) + if err != nil { + return nil, err + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to SitesBySubscriptionServerTransport +var sitesBySubscriptionServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/sitemanager/armsitemanager/fake/time_rfc3339.go b/sdk/resourcemanager/sitemanager/armsitemanager/fake/time_rfc3339.go new file mode 100644 index 000000000000..87ee11e83b32 --- /dev/null +++ b/sdk/resourcemanager/sitemanager/armsitemanager/fake/time_rfc3339.go @@ -0,0 +1,109 @@ +// 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 ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "regexp" + "strings" + "time" +) + +// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) + +const ( + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` +) + +type dateTimeRFC3339 time.Time + +func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t dateTimeRFC3339) MarshalText() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT + } + return t.Parse(layout, string(data)) +} + +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 + if tzOffset && hasT { + layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = dateTimeRFC3339(p) + return err +} + +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + +func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*dateTimeRFC3339)(t) +} + +func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || string(data) == "null" { + return nil + } + var aux dateTimeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/sitemanager/armsitemanager/go.mod b/sdk/resourcemanager/sitemanager/armsitemanager/go.mod new file mode 100644 index 000000000000..7c28ad853f77 --- /dev/null +++ b/sdk/resourcemanager/sitemanager/armsitemanager/go.mod @@ -0,0 +1,21 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sitemanager/armsitemanager + +go 1.18 + +require ( + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 +) + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect + github.com/golang-jwt/jwt/v5 v5.2.1 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/kylelemons/godebug v1.1.0 // indirect + github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect + golang.org/x/crypto v0.27.0 // indirect + golang.org/x/net v0.29.0 // indirect + golang.org/x/sys v0.25.0 // indirect + golang.org/x/text v0.18.0 // indirect +) diff --git a/sdk/resourcemanager/sitemanager/armsitemanager/go.sum b/sdk/resourcemanager/sitemanager/armsitemanager/go.sum new file mode 100644 index 000000000000..cbddbbd9ecec --- /dev/null +++ b/sdk/resourcemanager/sitemanager/armsitemanager/go.sum @@ -0,0 +1,29 @@ +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 h1:JZg6HRh6W6U4OLl6lk7BZ7BLisIzM9dG1R50zUk9C/M= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0/go.mod h1:YL1xnZ6QejvQHWJrX/AvhFl4WW4rqHVoKspWNVwFk0M= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0/go.mod h1:iZDifYGJTIgIIkYRNWPENUnqx6bJ2xnSDFI2tjwZNuY= +github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU= +github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= +github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= +github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= +github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= +golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/sitemanager/armsitemanager/models.go b/sdk/resourcemanager/sitemanager/armsitemanager/models.go new file mode 100644 index 000000000000..c766ac6d29a2 --- /dev/null +++ b/sdk/resourcemanager/sitemanager/armsitemanager/models.go @@ -0,0 +1,88 @@ +// 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 armsitemanager + +import "time" + +// Site as ARM Resource +type Site struct { + // The resource-specific properties for this resource. + Properties *SiteProperties + + // READ-ONLY; Name of Site resource + Name *string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// SiteListResult - The response of a Site list operation. +type SiteListResult struct { + // REQUIRED; The Site items on this page + Value []*Site + + // The link to the next page of items + NextLink *string +} + +// SiteProperties - Site properties +type SiteProperties struct { + // AddressResource ArmId of Site resource + AddressResourceID *string + + // Description of Site resource + Description *string + + // displayName of Site resource + DisplayName *string + + // READ-ONLY; Provisioning state of last operation + ProvisioningState *ResourceProvisioningState +} + +// SiteUpdate - The type used for update operations of the Site. +type SiteUpdate struct { + // The updatable properties of the Site. + Properties *SiteUpdateProperties +} + +// SiteUpdateProperties - The updatable properties of the Site. +type SiteUpdateProperties struct { + // AddressResource ArmId of Site resource + AddressResourceID *string + + // Description of Site resource + Description *string + + // displayName of Site resource + DisplayName *string +} + +// SystemData - Metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // The timestamp of resource creation (UTC). + CreatedAt *time.Time + + // The identity that created the resource. + CreatedBy *string + + // The type of identity that created the resource. + CreatedByType *CreatedByType + + // The timestamp of resource last modification (UTC) + LastModifiedAt *time.Time + + // The identity that last modified the resource. + LastModifiedBy *string + + // The type of identity that last modified the resource. + LastModifiedByType *CreatedByType +} diff --git a/sdk/resourcemanager/sitemanager/armsitemanager/models_serde.go b/sdk/resourcemanager/sitemanager/armsitemanager/models_serde.go new file mode 100644 index 000000000000..50edcbd3f177 --- /dev/null +++ b/sdk/resourcemanager/sitemanager/armsitemanager/models_serde.go @@ -0,0 +1,254 @@ +// 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 armsitemanager + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type Site. +func (s Site) 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 Site. +func (s *Site) 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 SiteListResult. +func (s SiteListResult) 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 SiteListResult. +func (s *SiteListResult) 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 SiteProperties. +func (s SiteProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "addressResourceId", s.AddressResourceID) + populate(objectMap, "description", s.Description) + populate(objectMap, "displayName", s.DisplayName) + populate(objectMap, "provisioningState", s.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SiteProperties. +func (s *SiteProperties) 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 "addressResourceId": + err = unpopulate(val, "AddressResourceID", &s.AddressResourceID) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &s.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &s.DisplayName) + 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 SiteUpdate. +func (s SiteUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", s.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SiteUpdate. +func (s *SiteUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SiteUpdateProperties. +func (s SiteUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "addressResourceId", s.AddressResourceID) + populate(objectMap, "description", s.Description) + populate(objectMap, "displayName", s.DisplayName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SiteUpdateProperties. +func (s *SiteUpdateProperties) 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 "addressResourceId": + err = unpopulate(val, "AddressResourceID", &s.AddressResourceID) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &s.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &s.DisplayName) + 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 SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateDateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) 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 "createdAt": + err = unpopulateDateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, "CreatedByType", &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +func populate(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, fn string, v any) error { + if data == nil || string(data) == "null" { + return nil + } + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + return nil +} diff --git a/sdk/resourcemanager/sitemanager/armsitemanager/options.go b/sdk/resourcemanager/sitemanager/armsitemanager/options.go new file mode 100644 index 000000000000..c798e4b73cb5 --- /dev/null +++ b/sdk/resourcemanager/sitemanager/armsitemanager/options.go @@ -0,0 +1,59 @@ +// 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 armsitemanager + +// SitesBySubscriptionClientBeginCreateOrUpdateOptions contains the optional parameters for the SitesBySubscriptionClient.BeginCreateOrUpdate +// method. +type SitesBySubscriptionClientBeginCreateOrUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// SitesBySubscriptionClientDeleteOptions contains the optional parameters for the SitesBySubscriptionClient.Delete method. +type SitesBySubscriptionClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// SitesBySubscriptionClientGetOptions contains the optional parameters for the SitesBySubscriptionClient.Get method. +type SitesBySubscriptionClientGetOptions struct { + // placeholder for future optional parameters +} + +// SitesBySubscriptionClientListOptions contains the optional parameters for the SitesBySubscriptionClient.NewListPager method. +type SitesBySubscriptionClientListOptions struct { + // placeholder for future optional parameters +} + +// SitesBySubscriptionClientUpdateOptions contains the optional parameters for the SitesBySubscriptionClient.Update method. +type SitesBySubscriptionClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// SitesClientBeginCreateOrUpdateOptions contains the optional parameters for the SitesClient.BeginCreateOrUpdate method. +type SitesClientBeginCreateOrUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// SitesClientDeleteOptions contains the optional parameters for the SitesClient.Delete method. +type SitesClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// SitesClientGetOptions contains the optional parameters for the SitesClient.Get method. +type SitesClientGetOptions struct { + // placeholder for future optional parameters +} + +// SitesClientListByResourceGroupOptions contains the optional parameters for the SitesClient.NewListByResourceGroupPager +// method. +type SitesClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// SitesClientUpdateOptions contains the optional parameters for the SitesClient.Update method. +type SitesClientUpdateOptions struct { + // placeholder for future optional parameters +} diff --git a/sdk/resourcemanager/sitemanager/armsitemanager/responses.go b/sdk/resourcemanager/sitemanager/armsitemanager/responses.go new file mode 100644 index 000000000000..acb8b682c742 --- /dev/null +++ b/sdk/resourcemanager/sitemanager/armsitemanager/responses.go @@ -0,0 +1,63 @@ +// 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 armsitemanager + +// SitesBySubscriptionClientCreateOrUpdateResponse contains the response from method SitesBySubscriptionClient.BeginCreateOrUpdate. +type SitesBySubscriptionClientCreateOrUpdateResponse struct { + // Site as ARM Resource + Site +} + +// SitesBySubscriptionClientDeleteResponse contains the response from method SitesBySubscriptionClient.Delete. +type SitesBySubscriptionClientDeleteResponse struct { + // placeholder for future response values +} + +// SitesBySubscriptionClientGetResponse contains the response from method SitesBySubscriptionClient.Get. +type SitesBySubscriptionClientGetResponse struct { + // Site as ARM Resource + Site +} + +// SitesBySubscriptionClientListResponse contains the response from method SitesBySubscriptionClient.NewListPager. +type SitesBySubscriptionClientListResponse struct { + // The response of a Site list operation. + SiteListResult +} + +// SitesBySubscriptionClientUpdateResponse contains the response from method SitesBySubscriptionClient.Update. +type SitesBySubscriptionClientUpdateResponse struct { + // Site as ARM Resource + Site +} + +// SitesClientCreateOrUpdateResponse contains the response from method SitesClient.BeginCreateOrUpdate. +type SitesClientCreateOrUpdateResponse struct { + // Site as ARM Resource + Site +} + +// SitesClientDeleteResponse contains the response from method SitesClient.Delete. +type SitesClientDeleteResponse struct { + // placeholder for future response values +} + +// SitesClientGetResponse contains the response from method SitesClient.Get. +type SitesClientGetResponse struct { + // Site as ARM Resource + Site +} + +// SitesClientListByResourceGroupResponse contains the response from method SitesClient.NewListByResourceGroupPager. +type SitesClientListByResourceGroupResponse struct { + // The response of a Site list operation. + SiteListResult +} + +// SitesClientUpdateResponse contains the response from method SitesClient.Update. +type SitesClientUpdateResponse struct { + // Site as ARM Resource + Site +} diff --git a/sdk/resourcemanager/sitemanager/armsitemanager/sites_client.go b/sdk/resourcemanager/sitemanager/armsitemanager/sites_client.go new file mode 100644 index 000000000000..49563f0564ce --- /dev/null +++ b/sdk/resourcemanager/sitemanager/armsitemanager/sites_client.go @@ -0,0 +1,368 @@ +// 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 armsitemanager + +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" +) + +// SitesClient contains the methods for the Sites group. +// Don't use this type directly, use NewSitesClient() instead. +type SitesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewSitesClient creates a new instance of SitesClient 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 NewSitesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SitesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SitesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create a Site +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Name of Site resource +// - resource - Resource create parameters. +// - options - SitesClientBeginCreateOrUpdateOptions contains the optional parameters for the SitesClient.BeginCreateOrUpdate +// method. +func (client *SitesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, siteName string, resource Site, options *SitesClientBeginCreateOrUpdateOptions) (*runtime.Poller[SitesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, siteName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SitesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SitesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create a Site +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-01-preview +func (client *SitesClient) createOrUpdate(ctx context.Context, resourceGroupName string, siteName string, resource Site, options *SitesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "SitesClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, siteName, resource, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *SitesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, siteName string, resource Site, _ *SitesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/sites/{siteName}" + 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 siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-02-01-preview") + 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 + } + return req, nil +} + +// Delete - Delete a Site +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Name of Site resource +// - options - SitesClientDeleteOptions contains the optional parameters for the SitesClient.Delete method. +func (client *SitesClient) Delete(ctx context.Context, resourceGroupName string, siteName string, options *SitesClientDeleteOptions) (SitesClientDeleteResponse, error) { + var err error + const operationName = "SitesClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, siteName, options) + if err != nil { + return SitesClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SitesClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return SitesClientDeleteResponse{}, err + } + return SitesClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *SitesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, siteName string, _ *SitesClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/sites/{siteName}" + 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 siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a Site +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Name of Site resource +// - options - SitesClientGetOptions contains the optional parameters for the SitesClient.Get method. +func (client *SitesClient) Get(ctx context.Context, resourceGroupName string, siteName string, options *SitesClientGetOptions) (SitesClientGetResponse, error) { + var err error + const operationName = "SitesClient.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, siteName, options) + if err != nil { + return SitesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SitesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SitesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *SitesClient) getCreateRequest(ctx context.Context, resourceGroupName string, siteName string, _ *SitesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/sites/{siteName}" + 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 siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + 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-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *SitesClient) getHandleResponse(resp *http.Response) (SitesClientGetResponse, error) { + result := SitesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Site); err != nil { + return SitesClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - List Site resources by resource group +// +// Generated from API version 2024-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - SitesClientListByResourceGroupOptions contains the optional parameters for the SitesClient.NewListByResourceGroupPager +// method. +func (client *SitesClient) NewListByResourceGroupPager(resourceGroupName string, options *SitesClientListByResourceGroupOptions) *runtime.Pager[SitesClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[SitesClientListByResourceGroupResponse]{ + More: func(page SitesClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SitesClientListByResourceGroupResponse) (SitesClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SitesClient.NewListByResourceGroupPager") + 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.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return SitesClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *SitesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *SitesClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/sites" + 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)) + 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-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *SitesClient) listByResourceGroupHandleResponse(resp *http.Response) (SitesClientListByResourceGroupResponse, error) { + result := SitesClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SiteListResult); err != nil { + return SitesClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// Update - Update a Site +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - siteName - Name of Site resource +// - properties - The resource properties to be updated. +// - options - SitesClientUpdateOptions contains the optional parameters for the SitesClient.Update method. +func (client *SitesClient) Update(ctx context.Context, resourceGroupName string, siteName string, properties SiteUpdate, options *SitesClientUpdateOptions) (SitesClientUpdateResponse, error) { + var err error + const operationName = "SitesClient.Update" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, siteName, properties, options) + if err != nil { + return SitesClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SitesClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SitesClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *SitesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, siteName string, properties SiteUpdate, _ *SitesClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/sites/{siteName}" + 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 siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-02-01-preview") + 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 + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *SitesClient) updateHandleResponse(resp *http.Response) (SitesClientUpdateResponse, error) { + result := SitesClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Site); err != nil { + return SitesClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/sitemanager/armsitemanager/sites_client_example_test.go b/sdk/resourcemanager/sitemanager/armsitemanager/sites_client_example_test.go new file mode 100644 index 000000000000..fcd9ca928be2 --- /dev/null +++ b/sdk/resourcemanager/sitemanager/armsitemanager/sites_client_example_test.go @@ -0,0 +1,188 @@ +// 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 armsitemanager_test + +import ( + "context" + "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/sitemanager/armsitemanager" + "log" +) + +// Generated from example definition: 2024-02-01-preview/Sites_CreateOrUpdate.json +func ExampleSitesClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsitemanager.NewClientFactory("0154f7fe-df09-4981-bf82-7ad5c1f596eb", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSitesClient().BeginCreateOrUpdate(ctx, "string", "string", armsitemanager.Site{ + Properties: &armsitemanager.SiteProperties{ + DisplayName: to.Ptr("string"), + Description: to.Ptr("string"), + AddressResourceID: to.Ptr("/subscriptions/680d0dad-59aa-4464-3df3-b34b2b42738c/resourceGroups/us-site-rg/providers/Microsoft.EdgeOrder/addresses/12343213"), + }, + }, 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 = armsitemanager.SitesClientCreateOrUpdateResponse{ + // Site: &armsitemanager.Site{ + // ID: to.Ptr("/subscriptions/0154f7fe-df09-4981-bf82-7ad5c1f596eb/resourcegroups/EdgeSitesRG/providers/Microsoft.Edge/Sites/BellvueSite"), + // Type: to.Ptr("string"), + // Properties: &armsitemanager.SiteProperties{ + // DisplayName: to.Ptr("string"), + // Description: to.Ptr("string"), + // AddressResourceID: to.Ptr("/subscriptions/680d0dad-59aa-4464-3df3-b34b2b42738c/resourceGroups/us-site-rg/providers/Microsoft.EdgeOrder/addresses/12343213"), + // ProvisioningState: to.Ptr(armsitemanager.ResourceProvisioningStateSucceeded), + // }, + // }, + // } +} + +// Generated from example definition: 2024-02-01-preview/Sites_Delete.json +func ExampleSitesClient_Delete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsitemanager.NewClientFactory("0154f7fe-df09-4981-bf82-7ad5c1f596eb", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSitesClient().Delete(ctx, "string", "string", 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 = armsitemanager.SitesClientDeleteResponse{ + // } +} + +// Generated from example definition: 2024-02-01-preview/Sites_Get.json +func ExampleSitesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsitemanager.NewClientFactory("0154f7fe-df09-4981-bf82-7ad5c1f596eb", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSitesClient().Get(ctx, "string", "string", 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 = armsitemanager.SitesClientGetResponse{ + // Site: &armsitemanager.Site{ + // ID: to.Ptr("/subscriptions/0154f7fe-df09-4981-bf82-7ad5c1f596eb/resourcegroups/EdgeSitesRG/providers/Microsoft.Edge/Sites/BellvueSite"), + // Type: to.Ptr("string"), + // Properties: &armsitemanager.SiteProperties{ + // DisplayName: to.Ptr("string"), + // Description: to.Ptr("string"), + // AddressResourceID: to.Ptr("/subscriptions/11111111-2222-3333-4444-55555555/resourceGroups/us-site-rg/providers/Microsoft.EdgeOrder/addresses/12343213"), + // ProvisioningState: to.Ptr(armsitemanager.ResourceProvisioningStateSucceeded), + // }, + // }, + // } +} + +// Generated from example definition: 2024-02-01-preview/Sites_ListByResourceGroup.json +func ExampleSitesClient_NewListByResourceGroupPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsitemanager.NewClientFactory("0154f7fe-df09-4981-bf82-7ad5c1f596eb", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewSitesClient().NewListByResourceGroupPager("string", 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 = armsitemanager.SitesClientListByResourceGroupResponse{ + // SiteListResult: armsitemanager.SiteListResult{ + // Value: []*armsitemanager.Site{ + // { + // ID: to.Ptr("/subscriptions/0154f7fe-df09-4981-bf82-7ad5c1f596eb/resourcegroups/EdgeSitesRG/providers/Microsoft.Edge/Sites/BellvueSite"), + // Type: to.Ptr("string"), + // Properties: &armsitemanager.SiteProperties{ + // DisplayName: to.Ptr("string"), + // Description: to.Ptr("string"), + // AddressResourceID: to.Ptr("/subscriptions/11111111-2222-3333-4444-55555555/resourceGroups/us-site-rg/providers/Microsoft.EdgeOrder/addresses/12343213"), + // ProvisioningState: to.Ptr(armsitemanager.ResourceProvisioningStateSucceeded), + // }, + // }, + // }, + // }, + // } + } +} + +// Generated from example definition: 2024-02-01-preview/Sites_Update.json +func ExampleSitesClient_Update() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsitemanager.NewClientFactory("0154f7fe-df09-4981-bf82-7ad5c1f596eb", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSitesClient().Update(ctx, "string", "string", armsitemanager.SiteUpdate{ + Properties: &armsitemanager.SiteUpdateProperties{ + DisplayName: to.Ptr("string"), + Description: to.Ptr("string"), + AddressResourceID: to.Ptr("/subscriptions/11111111-2222-3333-4444-55555555/resourceGroups/us-site-rg/providers/Microsoft.EdgeOrder/addresses/12343213"), + }, + }, 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 = armsitemanager.SitesClientUpdateResponse{ + // Site: &armsitemanager.Site{ + // ID: to.Ptr("/subscriptions/0154f7fe-df09-4981-bf82-7ad5c1f596eb/resourcegroups/EdgeSitesRG/providers/Microsoft.Edge/Sites/BellvueSite"), + // Type: to.Ptr("string"), + // Properties: &armsitemanager.SiteProperties{ + // DisplayName: to.Ptr("string"), + // Description: to.Ptr("string"), + // AddressResourceID: to.Ptr("/subscriptions/11111111-2222-3333-4444-55555555/resourceGroups/us-site-rg/providers/Microsoft.EdgeOrder/addresses/12343213"), + // ProvisioningState: to.Ptr(armsitemanager.ResourceProvisioningStateSucceeded), + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/sitemanager/armsitemanager/sitesbysubscription_client.go b/sdk/resourcemanager/sitemanager/armsitemanager/sitesbysubscription_client.go new file mode 100644 index 000000000000..47677c70b4c6 --- /dev/null +++ b/sdk/resourcemanager/sitemanager/armsitemanager/sitesbysubscription_client.go @@ -0,0 +1,345 @@ +// 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 armsitemanager + +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" +) + +// SitesBySubscriptionClient contains the methods for the SitesBySubscription group. +// Don't use this type directly, use NewSitesBySubscriptionClient() instead. +type SitesBySubscriptionClient struct { + internal *arm.Client + subscriptionID string +} + +// NewSitesBySubscriptionClient creates a new instance of SitesBySubscriptionClient 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 NewSitesBySubscriptionClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SitesBySubscriptionClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SitesBySubscriptionClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create a Site +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-01-preview +// - siteName - Name of Site resource +// - resource - Resource create parameters. +// - options - SitesBySubscriptionClientBeginCreateOrUpdateOptions contains the optional parameters for the SitesBySubscriptionClient.BeginCreateOrUpdate +// method. +func (client *SitesBySubscriptionClient) BeginCreateOrUpdate(ctx context.Context, siteName string, resource Site, options *SitesBySubscriptionClientBeginCreateOrUpdateOptions) (*runtime.Poller[SitesBySubscriptionClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, siteName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SitesBySubscriptionClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SitesBySubscriptionClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create a Site +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-01-preview +func (client *SitesBySubscriptionClient) createOrUpdate(ctx context.Context, siteName string, resource Site, options *SitesBySubscriptionClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "SitesBySubscriptionClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, siteName, resource, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *SitesBySubscriptionClient) createOrUpdateCreateRequest(ctx context.Context, siteName string, resource Site, _ *SitesBySubscriptionClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Edge/sites/{siteName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-02-01-preview") + 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 + } + return req, nil +} + +// Delete - Delete a Site +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-01-preview +// - siteName - Name of Site resource +// - options - SitesBySubscriptionClientDeleteOptions contains the optional parameters for the SitesBySubscriptionClient.Delete +// method. +func (client *SitesBySubscriptionClient) Delete(ctx context.Context, siteName string, options *SitesBySubscriptionClientDeleteOptions) (SitesBySubscriptionClientDeleteResponse, error) { + var err error + const operationName = "SitesBySubscriptionClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, siteName, options) + if err != nil { + return SitesBySubscriptionClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SitesBySubscriptionClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return SitesBySubscriptionClientDeleteResponse{}, err + } + return SitesBySubscriptionClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *SitesBySubscriptionClient) deleteCreateRequest(ctx context.Context, siteName string, _ *SitesBySubscriptionClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Edge/sites/{siteName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a Site +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-01-preview +// - siteName - Name of Site resource +// - options - SitesBySubscriptionClientGetOptions contains the optional parameters for the SitesBySubscriptionClient.Get method. +func (client *SitesBySubscriptionClient) Get(ctx context.Context, siteName string, options *SitesBySubscriptionClientGetOptions) (SitesBySubscriptionClientGetResponse, error) { + var err error + const operationName = "SitesBySubscriptionClient.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, siteName, options) + if err != nil { + return SitesBySubscriptionClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SitesBySubscriptionClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SitesBySubscriptionClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *SitesBySubscriptionClient) getCreateRequest(ctx context.Context, siteName string, _ *SitesBySubscriptionClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Edge/sites/{siteName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + 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-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *SitesBySubscriptionClient) getHandleResponse(resp *http.Response) (SitesBySubscriptionClientGetResponse, error) { + result := SitesBySubscriptionClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Site); err != nil { + return SitesBySubscriptionClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - List Site resources by subscription ID +// +// Generated from API version 2024-02-01-preview +// - options - SitesBySubscriptionClientListOptions contains the optional parameters for the SitesBySubscriptionClient.NewListPager +// method. +func (client *SitesBySubscriptionClient) NewListPager(options *SitesBySubscriptionClientListOptions) *runtime.Pager[SitesBySubscriptionClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[SitesBySubscriptionClientListResponse]{ + More: func(page SitesBySubscriptionClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SitesBySubscriptionClientListResponse) (SitesBySubscriptionClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SitesBySubscriptionClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, nil) + if err != nil { + return SitesBySubscriptionClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *SitesBySubscriptionClient) listCreateRequest(ctx context.Context, _ *SitesBySubscriptionClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Edge/sites" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + 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-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *SitesBySubscriptionClient) listHandleResponse(resp *http.Response) (SitesBySubscriptionClientListResponse, error) { + result := SitesBySubscriptionClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SiteListResult); err != nil { + return SitesBySubscriptionClientListResponse{}, err + } + return result, nil +} + +// Update - Update a Site +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-01-preview +// - siteName - Name of Site resource +// - properties - The resource properties to be updated. +// - options - SitesBySubscriptionClientUpdateOptions contains the optional parameters for the SitesBySubscriptionClient.Update +// method. +func (client *SitesBySubscriptionClient) Update(ctx context.Context, siteName string, properties SiteUpdate, options *SitesBySubscriptionClientUpdateOptions) (SitesBySubscriptionClientUpdateResponse, error) { + var err error + const operationName = "SitesBySubscriptionClient.Update" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, siteName, properties, options) + if err != nil { + return SitesBySubscriptionClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SitesBySubscriptionClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SitesBySubscriptionClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *SitesBySubscriptionClient) updateCreateRequest(ctx context.Context, siteName string, properties SiteUpdate, _ *SitesBySubscriptionClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Edge/sites/{siteName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-02-01-preview") + 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 + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *SitesBySubscriptionClient) updateHandleResponse(resp *http.Response) (SitesBySubscriptionClientUpdateResponse, error) { + result := SitesBySubscriptionClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Site); err != nil { + return SitesBySubscriptionClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/sitemanager/armsitemanager/sitesbysubscription_client_example_test.go b/sdk/resourcemanager/sitemanager/armsitemanager/sitesbysubscription_client_example_test.go new file mode 100644 index 000000000000..735649fd32e7 --- /dev/null +++ b/sdk/resourcemanager/sitemanager/armsitemanager/sitesbysubscription_client_example_test.go @@ -0,0 +1,188 @@ +// 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 armsitemanager_test + +import ( + "context" + "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/sitemanager/armsitemanager" + "log" +) + +// Generated from example definition: 2024-02-01-preview/SitesBySubscription_CreateOrUpdate.json +func ExampleSitesBySubscriptionClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsitemanager.NewClientFactory("0154f7fe-df09-4981-bf82-7ad5c1f596eb", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSitesBySubscriptionClient().BeginCreateOrUpdate(ctx, "string", armsitemanager.Site{ + Properties: &armsitemanager.SiteProperties{ + Description: to.Ptr("string"), + AddressResourceID: to.Ptr("/subscriptions/680d0dad-59aa-4464-3df3-b34b2b42738c/resourceGroups/us-site-rg/providers/Microsoft.EdgeOrder/addresses/12343213"), + DisplayName: to.Ptr("string"), + }, + }, 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 = armsitemanager.SitesBySubscriptionClientCreateOrUpdateResponse{ + // Site: &armsitemanager.Site{ + // Type: to.Ptr("string"), + // ID: to.Ptr("/subscriptions/0154f7fe-df09-4981-bf82-7ad5c1f596eb/resourcegroups/EdgeSitesRG/providers/Microsoft.Edge/Sites/BellvueSite"), + // Properties: &armsitemanager.SiteProperties{ + // Description: to.Ptr("string"), + // AddressResourceID: to.Ptr("/subscriptions/680d0dad-59aa-4464-3df3-b34b2b42738c/resourceGroups/us-site-rg/providers/Microsoft.EdgeOrder/addresses/12343213"), + // DisplayName: to.Ptr("string"), + // ProvisioningState: to.Ptr(armsitemanager.ResourceProvisioningStateSucceeded), + // }, + // }, + // } +} + +// Generated from example definition: 2024-02-01-preview/SitesBySubscription_Delete.json +func ExampleSitesBySubscriptionClient_Delete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsitemanager.NewClientFactory("0154f7fe-df09-4981-bf82-7ad5c1f596eb", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSitesBySubscriptionClient().Delete(ctx, "string", 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 = armsitemanager.SitesBySubscriptionClientDeleteResponse{ + // } +} + +// Generated from example definition: 2024-02-01-preview/SitesBySubscription_Get.json +func ExampleSitesBySubscriptionClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsitemanager.NewClientFactory("0154f7fe-df09-4981-bf82-7ad5c1f596eb", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSitesBySubscriptionClient().Get(ctx, "string", 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 = armsitemanager.SitesBySubscriptionClientGetResponse{ + // Site: &armsitemanager.Site{ + // Type: to.Ptr("string"), + // ID: to.Ptr("/subscriptions/0154f7fe-df09-4981-bf82-7ad5c1f596eb/resourcegroups/EdgeSitesRG/providers/Microsoft.Edge/Sites/BellvueSite"), + // Properties: &armsitemanager.SiteProperties{ + // Description: to.Ptr("string"), + // AddressResourceID: to.Ptr("/subscriptions/0154f7fe-df09-4981-bf82-7ad5c1f596eb/resourceGroups/us-site-rg/providers/Microsoft.EdgeOrder/addresses/12343213"), + // DisplayName: to.Ptr("string"), + // ProvisioningState: to.Ptr(armsitemanager.ResourceProvisioningStateSucceeded), + // }, + // }, + // } +} + +// Generated from example definition: 2024-02-01-preview/SitesBySubscription_List.json +func ExampleSitesBySubscriptionClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsitemanager.NewClientFactory("0154f7fe-df09-4981-bf82-7ad5c1f596eb", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewSitesBySubscriptionClient().NewListPager(nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page = armsitemanager.SitesBySubscriptionClientListResponse{ + // SiteListResult: armsitemanager.SiteListResult{ + // Value: []*armsitemanager.Site{ + // { + // Type: to.Ptr("string"), + // ID: to.Ptr("/subscriptions/0154f7fe-df09-4981-bf82-7ad5c1f596eb/resourcegroups/EdgeSitesRG/providers/Microsoft.Edge/Sites/BellvueSite"), + // Properties: &armsitemanager.SiteProperties{ + // Description: to.Ptr("string"), + // AddressResourceID: to.Ptr("/subscriptions/0154f7fe-df09-4981-bf82-7ad5c1f596eb/resourceGroups/us-site-rg/providers/Microsoft.EdgeOrder/addresses/12343213"), + // DisplayName: to.Ptr("string"), + // ProvisioningState: to.Ptr(armsitemanager.ResourceProvisioningStateSucceeded), + // }, + // }, + // }, + // }, + // } + } +} + +// Generated from example definition: 2024-02-01-preview/SitesBySubscription_Update.json +func ExampleSitesBySubscriptionClient_Update() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsitemanager.NewClientFactory("0154f7fe-df09-4981-bf82-7ad5c1f596eb", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSitesBySubscriptionClient().Update(ctx, "string", armsitemanager.SiteUpdate{ + Properties: &armsitemanager.SiteUpdateProperties{ + Description: to.Ptr("string"), + AddressResourceID: to.Ptr("/subscriptions/0154f7fe-df09-4981-bf82-7ad5c1f596eb/resourceGroups/us-site-rg/providers/Microsoft.EdgeOrder/addresses/12343213"), + DisplayName: to.Ptr("string"), + }, + }, 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 = armsitemanager.SitesBySubscriptionClientUpdateResponse{ + // Site: &armsitemanager.Site{ + // Type: to.Ptr("string"), + // ID: to.Ptr("/subscriptions/0154f7fe-df09-4981-bf82-7ad5c1f596eb/resourcegroups/EdgeSitesRG/providers/Microsoft.Edge/Sites/BellvueSite"), + // Properties: &armsitemanager.SiteProperties{ + // Description: to.Ptr("string"), + // AddressResourceID: to.Ptr("/subscriptions/0154f7fe-df09-4981-bf82-7ad5c1f596eb/resourceGroups/us-site-rg/providers/Microsoft.EdgeOrder/addresses/12343213"), + // DisplayName: to.Ptr("string"), + // ProvisioningState: to.Ptr(armsitemanager.ResourceProvisioningStateSucceeded), + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/sitemanager/armsitemanager/time_rfc3339.go b/sdk/resourcemanager/sitemanager/armsitemanager/time_rfc3339.go new file mode 100644 index 000000000000..9bb638248dd2 --- /dev/null +++ b/sdk/resourcemanager/sitemanager/armsitemanager/time_rfc3339.go @@ -0,0 +1,109 @@ +// 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 armsitemanager + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "regexp" + "strings" + "time" +) + +// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) + +const ( + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` +) + +type dateTimeRFC3339 time.Time + +func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t dateTimeRFC3339) MarshalText() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT + } + return t.Parse(layout, string(data)) +} + +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 + if tzOffset && hasT { + layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = dateTimeRFC3339(p) + return err +} + +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + +func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*dateTimeRFC3339)(t) +} + +func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || string(data) == "null" { + return nil + } + var aux dateTimeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/sitemanager/armsitemanager/tsp-location.yaml b/sdk/resourcemanager/sitemanager/armsitemanager/tsp-location.yaml new file mode 100644 index 000000000000..6753807c6a0d --- /dev/null +++ b/sdk/resourcemanager/sitemanager/armsitemanager/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/edge/Microsoft.Edge.Sites.Management +commit: 405438c72094a0a43fbcba18a56aa71110b78db8 +repo: Azure/azure-rest-api-specs +additionalDirectories: \ No newline at end of file diff --git a/sdk/resourcemanager/standbypool/armstandbypool/CHANGELOG.md b/sdk/resourcemanager/standbypool/armstandbypool/CHANGELOG.md index 715d2f53ffc1..c9d7fd6e61d3 100644 --- a/sdk/resourcemanager/standbypool/armstandbypool/CHANGELOG.md +++ b/sdk/resourcemanager/standbypool/armstandbypool/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 1.0.1 (2024-11-29) +### Other Changes + + ## 1.0.0 (2024-09-26) ### Breaking Changes diff --git a/sdk/resourcemanager/standbypool/armstandbypool/constants.go b/sdk/resourcemanager/standbypool/armstandbypool/constants.go index 2eec7cc967ca..4a86ff6f7c41 100644 --- a/sdk/resourcemanager/standbypool/armstandbypool/constants.go +++ b/sdk/resourcemanager/standbypool/armstandbypool/constants.go @@ -6,7 +6,7 @@ package armstandbypool const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/standbypool/armstandbypool" - moduleVersion = "v1.0.0" + moduleVersion = "v1.0.1" ) // ActionType - Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. diff --git a/sdk/resourcemanager/standbypool/armstandbypool/fake/internal.go b/sdk/resourcemanager/standbypool/armstandbypool/fake/internal.go index 56a8f624f5f3..7425b6a669e2 100644 --- a/sdk/resourcemanager/standbypool/armstandbypool/fake/internal.go +++ b/sdk/resourcemanager/standbypool/armstandbypool/fake/internal.go @@ -10,6 +10,11 @@ import ( "sync" ) +type result struct { + resp *http.Response + err error +} + type nonRetriableError struct { error } diff --git a/sdk/resourcemanager/standbypool/armstandbypool/fake/operations_server.go b/sdk/resourcemanager/standbypool/armstandbypool/fake/operations_server.go index 9a882bb6131f..afbf35a47ebf 100644 --- a/sdk/resourcemanager/standbypool/armstandbypool/fake/operations_server.go +++ b/sdk/resourcemanager/standbypool/armstandbypool/fake/operations_server.go @@ -51,17 +51,36 @@ func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error } func (o *OperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error + resultChan := make(chan result) + defer close(resultChan) - switch method { - case "OperationsClient.NewListPager": - resp, err = o.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + go func() { + var intercepted bool + var res result + if operationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = operationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OperationsClient.NewListPager": + res.resp, res.err = o.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() - return resp, err + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { @@ -90,3 +109,9 @@ func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*ht } return resp, nil } + +// set this to conditionally intercept incoming requests to OperationsServerTransport +var operationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/standbypool/armstandbypool/fake/standbycontainergrouppoolruntimeviews_server.go b/sdk/resourcemanager/standbypool/armstandbypool/fake/standbycontainergrouppoolruntimeviews_server.go index 70e38faf4686..4fde08fc0a5a 100644 --- a/sdk/resourcemanager/standbypool/armstandbypool/fake/standbycontainergrouppoolruntimeviews_server.go +++ b/sdk/resourcemanager/standbypool/armstandbypool/fake/standbycontainergrouppoolruntimeviews_server.go @@ -58,19 +58,38 @@ func (s *StandbyContainerGroupPoolRuntimeViewsServerTransport) Do(req *http.Requ } func (s *StandbyContainerGroupPoolRuntimeViewsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error + resultChan := make(chan result) + defer close(resultChan) - 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) - } + go func() { + var intercepted bool + var res result + if standbyContainerGroupPoolRuntimeViewsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = standbyContainerGroupPoolRuntimeViewsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "StandbyContainerGroupPoolRuntimeViewsClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "StandbyContainerGroupPoolRuntimeViewsClient.NewListByStandbyPoolPager": + res.resp, res.err = s.dispatchNewListByStandbyPoolPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() - return resp, err + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (s *StandbyContainerGroupPoolRuntimeViewsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -150,3 +169,9 @@ func (s *StandbyContainerGroupPoolRuntimeViewsServerTransport) dispatchNewListBy } return resp, nil } + +// set this to conditionally intercept incoming requests to StandbyContainerGroupPoolRuntimeViewsServerTransport +var standbyContainerGroupPoolRuntimeViewsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/standbypool/armstandbypool/fake/standbycontainergrouppools_server.go b/sdk/resourcemanager/standbypool/armstandbypool/fake/standbycontainergrouppools_server.go index 792826dc3f33..757d6865bc58 100644 --- a/sdk/resourcemanager/standbypool/armstandbypool/fake/standbycontainergrouppools_server.go +++ b/sdk/resourcemanager/standbypool/armstandbypool/fake/standbycontainergrouppools_server.go @@ -25,7 +25,7 @@ type StandbyContainerGroupPoolsServer struct { BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, standbyContainerGroupPoolName string, resource armstandbypool.StandbyContainerGroupPoolResource, options *armstandbypool.StandbyContainerGroupPoolsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armstandbypool.StandbyContainerGroupPoolsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method StandbyContainerGroupPoolsClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, standbyContainerGroupPoolName string, options *armstandbypool.StandbyContainerGroupPoolsClientBeginDeleteOptions) (resp azfake.PollerResponder[armstandbypool.StandbyContainerGroupPoolsClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method StandbyContainerGroupPoolsClient.Get @@ -80,27 +80,46 @@ func (s *StandbyContainerGroupPoolsServerTransport) Do(req *http.Request) (*http } func (s *StandbyContainerGroupPoolsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error + resultChan := make(chan result) + defer close(resultChan) - switch method { - case "StandbyContainerGroupPoolsClient.BeginCreateOrUpdate": - resp, err = s.dispatchBeginCreateOrUpdate(req) - case "StandbyContainerGroupPoolsClient.BeginDelete": - resp, err = s.dispatchBeginDelete(req) - case "StandbyContainerGroupPoolsClient.Get": - resp, err = s.dispatchGet(req) - case "StandbyContainerGroupPoolsClient.NewListByResourceGroupPager": - resp, err = s.dispatchNewListByResourceGroupPager(req) - case "StandbyContainerGroupPoolsClient.NewListBySubscriptionPager": - resp, err = s.dispatchNewListBySubscriptionPager(req) - case "StandbyContainerGroupPoolsClient.Update": - resp, err = s.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + go func() { + var intercepted bool + var res result + if standbyContainerGroupPoolsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = standbyContainerGroupPoolsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "StandbyContainerGroupPoolsClient.BeginCreateOrUpdate": + res.resp, res.err = s.dispatchBeginCreateOrUpdate(req) + case "StandbyContainerGroupPoolsClient.BeginDelete": + res.resp, res.err = s.dispatchBeginDelete(req) + case "StandbyContainerGroupPoolsClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "StandbyContainerGroupPoolsClient.NewListByResourceGroupPager": + res.resp, res.err = s.dispatchNewListByResourceGroupPager(req) + case "StandbyContainerGroupPoolsClient.NewListBySubscriptionPager": + res.resp, res.err = s.dispatchNewListBySubscriptionPager(req) + case "StandbyContainerGroupPoolsClient.Update": + res.resp, res.err = s.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() - return resp, err + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (s *StandbyContainerGroupPoolsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -184,9 +203,9 @@ func (s *StandbyContainerGroupPoolsServerTransport) dispatchBeginDelete(req *htt return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { s.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { s.beginDelete.remove(req) @@ -334,3 +353,9 @@ func (s *StandbyContainerGroupPoolsServerTransport) dispatchUpdate(req *http.Req } return resp, nil } + +// set this to conditionally intercept incoming requests to StandbyContainerGroupPoolsServerTransport +var standbyContainerGroupPoolsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/standbypool/armstandbypool/fake/standbyvirtualmachinepoolruntimeviews_server.go b/sdk/resourcemanager/standbypool/armstandbypool/fake/standbyvirtualmachinepoolruntimeviews_server.go index 835b9bade3b5..a7bdb2f0521e 100644 --- a/sdk/resourcemanager/standbypool/armstandbypool/fake/standbyvirtualmachinepoolruntimeviews_server.go +++ b/sdk/resourcemanager/standbypool/armstandbypool/fake/standbyvirtualmachinepoolruntimeviews_server.go @@ -58,19 +58,38 @@ func (s *StandbyVirtualMachinePoolRuntimeViewsServerTransport) Do(req *http.Requ } func (s *StandbyVirtualMachinePoolRuntimeViewsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error + resultChan := make(chan result) + defer close(resultChan) - 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) - } + go func() { + var intercepted bool + var res result + if standbyVirtualMachinePoolRuntimeViewsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = standbyVirtualMachinePoolRuntimeViewsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "StandbyVirtualMachinePoolRuntimeViewsClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "StandbyVirtualMachinePoolRuntimeViewsClient.NewListByStandbyPoolPager": + res.resp, res.err = s.dispatchNewListByStandbyPoolPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() - return resp, err + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (s *StandbyVirtualMachinePoolRuntimeViewsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -150,3 +169,9 @@ func (s *StandbyVirtualMachinePoolRuntimeViewsServerTransport) dispatchNewListBy } return resp, nil } + +// set this to conditionally intercept incoming requests to StandbyVirtualMachinePoolRuntimeViewsServerTransport +var standbyVirtualMachinePoolRuntimeViewsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/standbypool/armstandbypool/fake/standbyvirtualmachinepools_server.go b/sdk/resourcemanager/standbypool/armstandbypool/fake/standbyvirtualmachinepools_server.go index 49b3ac00dcf8..3f7a6bed5468 100644 --- a/sdk/resourcemanager/standbypool/armstandbypool/fake/standbyvirtualmachinepools_server.go +++ b/sdk/resourcemanager/standbypool/armstandbypool/fake/standbyvirtualmachinepools_server.go @@ -25,7 +25,7 @@ type StandbyVirtualMachinePoolsServer struct { BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, standbyVirtualMachinePoolName string, resource armstandbypool.StandbyVirtualMachinePoolResource, options *armstandbypool.StandbyVirtualMachinePoolsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armstandbypool.StandbyVirtualMachinePoolsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method StandbyVirtualMachinePoolsClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, standbyVirtualMachinePoolName string, options *armstandbypool.StandbyVirtualMachinePoolsClientBeginDeleteOptions) (resp azfake.PollerResponder[armstandbypool.StandbyVirtualMachinePoolsClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method StandbyVirtualMachinePoolsClient.Get @@ -80,27 +80,46 @@ func (s *StandbyVirtualMachinePoolsServerTransport) Do(req *http.Request) (*http } func (s *StandbyVirtualMachinePoolsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error + resultChan := make(chan result) + defer close(resultChan) - switch method { - case "StandbyVirtualMachinePoolsClient.BeginCreateOrUpdate": - resp, err = s.dispatchBeginCreateOrUpdate(req) - case "StandbyVirtualMachinePoolsClient.BeginDelete": - resp, err = s.dispatchBeginDelete(req) - case "StandbyVirtualMachinePoolsClient.Get": - resp, err = s.dispatchGet(req) - case "StandbyVirtualMachinePoolsClient.NewListByResourceGroupPager": - resp, err = s.dispatchNewListByResourceGroupPager(req) - case "StandbyVirtualMachinePoolsClient.NewListBySubscriptionPager": - resp, err = s.dispatchNewListBySubscriptionPager(req) - case "StandbyVirtualMachinePoolsClient.Update": - resp, err = s.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + go func() { + var intercepted bool + var res result + if standbyVirtualMachinePoolsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = standbyVirtualMachinePoolsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "StandbyVirtualMachinePoolsClient.BeginCreateOrUpdate": + res.resp, res.err = s.dispatchBeginCreateOrUpdate(req) + case "StandbyVirtualMachinePoolsClient.BeginDelete": + res.resp, res.err = s.dispatchBeginDelete(req) + case "StandbyVirtualMachinePoolsClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "StandbyVirtualMachinePoolsClient.NewListByResourceGroupPager": + res.resp, res.err = s.dispatchNewListByResourceGroupPager(req) + case "StandbyVirtualMachinePoolsClient.NewListBySubscriptionPager": + res.resp, res.err = s.dispatchNewListBySubscriptionPager(req) + case "StandbyVirtualMachinePoolsClient.Update": + res.resp, res.err = s.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() - return resp, err + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (s *StandbyVirtualMachinePoolsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -184,9 +203,9 @@ func (s *StandbyVirtualMachinePoolsServerTransport) dispatchBeginDelete(req *htt return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { s.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { s.beginDelete.remove(req) @@ -334,3 +353,9 @@ func (s *StandbyVirtualMachinePoolsServerTransport) dispatchUpdate(req *http.Req } return resp, nil } + +// set this to conditionally intercept incoming requests to StandbyVirtualMachinePoolsServerTransport +var standbyVirtualMachinePoolsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/standbypool/armstandbypool/fake/standbyvirtualmachines_server.go b/sdk/resourcemanager/standbypool/armstandbypool/fake/standbyvirtualmachines_server.go index e6d922df6faa..27a23990a73c 100644 --- a/sdk/resourcemanager/standbypool/armstandbypool/fake/standbyvirtualmachines_server.go +++ b/sdk/resourcemanager/standbypool/armstandbypool/fake/standbyvirtualmachines_server.go @@ -58,19 +58,38 @@ func (s *StandbyVirtualMachinesServerTransport) Do(req *http.Request) (*http.Res } func (s *StandbyVirtualMachinesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error + resultChan := make(chan result) + defer close(resultChan) - switch method { - case "StandbyVirtualMachinesClient.Get": - resp, err = s.dispatchGet(req) - case "StandbyVirtualMachinesClient.NewListByStandbyVirtualMachinePoolResourcePager": - resp, err = s.dispatchNewListByStandbyVirtualMachinePoolResourcePager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + go func() { + var intercepted bool + var res result + if standbyVirtualMachinesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = standbyVirtualMachinesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "StandbyVirtualMachinesClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "StandbyVirtualMachinesClient.NewListByStandbyVirtualMachinePoolResourcePager": + res.resp, res.err = s.dispatchNewListByStandbyVirtualMachinePoolResourcePager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() - return resp, err + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (s *StandbyVirtualMachinesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -150,3 +169,9 @@ func (s *StandbyVirtualMachinesServerTransport) dispatchNewListByStandbyVirtualM } return resp, nil } + +// set this to conditionally intercept incoming requests to StandbyVirtualMachinesServerTransport +var standbyVirtualMachinesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/standbypool/armstandbypool/go.mod b/sdk/resourcemanager/standbypool/armstandbypool/go.mod index 240851bac176..2645c1ebcb84 100644 --- a/sdk/resourcemanager/standbypool/armstandbypool/go.mod +++ b/sdk/resourcemanager/standbypool/armstandbypool/go.mod @@ -3,7 +3,7 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/standbypool/armstan go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 ) @@ -14,8 +14,8 @@ require ( github.com/google/uuid v1.6.0 // indirect github.com/kylelemons/godebug v1.1.0 // indirect github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect - golang.org/x/crypto v0.25.0 // indirect - golang.org/x/net v0.27.0 // indirect - golang.org/x/sys v0.22.0 // indirect - golang.org/x/text v0.16.0 // indirect + golang.org/x/crypto v0.27.0 // indirect + golang.org/x/net v0.29.0 // indirect + golang.org/x/sys v0.25.0 // indirect + golang.org/x/text v0.18.0 // indirect ) diff --git a/sdk/resourcemanager/standbypool/armstandbypool/go.sum b/sdk/resourcemanager/standbypool/armstandbypool/go.sum index 09d275cb9a37..cbddbbd9ecec 100644 --- a/sdk/resourcemanager/standbypool/armstandbypool/go.sum +++ b/sdk/resourcemanager/standbypool/armstandbypool/go.sum @@ -1,5 +1,5 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 h1:GJHeeA2N7xrG3q30L2UXDyuWRzDM900/65j70wcM4Ww= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 h1:JZg6HRh6W6U4OLl6lk7BZ7BLisIzM9dG1R50zUk9C/M= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0/go.mod h1:YL1xnZ6QejvQHWJrX/AvhFl4WW4rqHVoKspWNVwFk0M= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= @@ -17,13 +17,13 @@ github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmd github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= -golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= -golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= +golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= +golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/standbypool/armstandbypool/tsp-location.yaml b/sdk/resourcemanager/standbypool/armstandbypool/tsp-location.yaml index 10840906cfb3..37daf235f4e7 100644 --- a/sdk/resourcemanager/standbypool/armstandbypool/tsp-location.yaml +++ b/sdk/resourcemanager/standbypool/armstandbypool/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/standbypool/StandbyPool.Management -commit: 3ca7edabc2edf1117b7d912ba34f2694721e3ff3 +commit: 405438c72094a0a43fbcba18a56aa71110b78db8 repo: Azure/azure-rest-api-specs -additionalDirectories: +additionalDirectories: \ No newline at end of file diff --git a/sdk/resourcemanager/terraform/armterraform/CHANGELOG.md b/sdk/resourcemanager/terraform/armterraform/CHANGELOG.md index 683baba6e17a..de88953570ba 100644 --- a/sdk/resourcemanager/terraform/armterraform/CHANGELOG.md +++ b/sdk/resourcemanager/terraform/armterraform/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 0.1.1 (2024-11-29) +### Other Changes + + ## 0.1.0 (2024-11-20) ### Other Changes diff --git a/sdk/resourcemanager/terraform/armterraform/constants.go b/sdk/resourcemanager/terraform/armterraform/constants.go index d0c99ec10c13..3b40a680274a 100644 --- a/sdk/resourcemanager/terraform/armterraform/constants.go +++ b/sdk/resourcemanager/terraform/armterraform/constants.go @@ -6,7 +6,7 @@ package armterraform const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/terraform/armterraform" - moduleVersion = "v0.1.0" + moduleVersion = "v0.1.1" ) // ActionType - Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. diff --git a/sdk/resourcemanager/terraform/armterraform/terraform_client_example_test.go b/sdk/resourcemanager/terraform/armterraform/terraform_client_example_test.go index 2f9c447ca7e9..a6fb7ee92d0d 100644 --- a/sdk/resourcemanager/terraform/armterraform/terraform_client_example_test.go +++ b/sdk/resourcemanager/terraform/armterraform/terraform_client_example_test.go @@ -6,7 +6,7 @@ package armterraform_test import ( "context" - // "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "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/terraform/armterraform" "log" @@ -23,12 +23,10 @@ func ExampleTerraformClient_BeginExportTerraform() { if err != nil { log.Fatalf("failed to create client: %v", err) } - // armterraform.ExportResourceGroup{ - // Type: to.Ptr(armterraform.TypeExportResourceGroup), - // ResourceGroupName: to.Ptr("rg1"), - // } - var b armterraform.BaseExportModelClassification - poller, err := clientFactory.NewTerraformClient().BeginExportTerraform(ctx, b, nil) + poller, err := clientFactory.NewTerraformClient().BeginExportTerraform(ctx, armterraform.ExportResourceGroup{ + Type: to.Ptr(armterraform.TypeExportResourceGroup), + ResourceGroupName: to.Ptr("rg1"), + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/terraform/armterraform/tsp-location.yaml b/sdk/resourcemanager/terraform/armterraform/tsp-location.yaml index 3d2afc909690..b9d461b34241 100644 --- a/sdk/resourcemanager/terraform/armterraform/tsp-location.yaml +++ b/sdk/resourcemanager/terraform/armterraform/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/terraform/Microsoft.AzureTerraform.Management -commit: d477c7caa09bf82e22c419be0a99d170552b5892 +commit: 405438c72094a0a43fbcba18a56aa71110b78db8 repo: Azure/azure-rest-api-specs -additionalDirectories: +additionalDirectories: \ No newline at end of file diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/CHANGELOG.md b/sdk/resourcemanager/trustedsigning/armtrustedsigning/CHANGELOG.md index 65b66c134a02..436a76d01ee1 100644 --- a/sdk/resourcemanager/trustedsigning/armtrustedsigning/CHANGELOG.md +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/CHANGELOG.md @@ -1,5 +1,17 @@ # Release History +## 0.2.0 (2024-11-29) +### Breaking Changes + +- Type of `CodeSigningAccountPatchProperties.SKU` has been changed from `*AccountSKU` to `*AccountSKUPatch` +- Field `City`, `CommonName`, `Country`, `EnhancedKeyUsage`, `Organization`, `OrganizationUnit`, `PostalCode`, `State`, `StreetAddress` of struct `CertificateProfileProperties` has been removed + +### Features Added + +- New struct `AccountSKUPatch` +- New field `EnhancedKeyUsage` in struct `Certificate` + + ## 0.1.0 (2024-09-29) ### Other Changes diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/certificateprofiles_client.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/certificateprofiles_client.go index 532d09c78819..e434808aae39 100644 --- a/sdk/resourcemanager/trustedsigning/armtrustedsigning/certificateprofiles_client.go +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/certificateprofiles_client.go @@ -42,7 +42,7 @@ func NewCertificateProfilesClient(subscriptionID string, credential azcore.Token // BeginCreate - Create a certificate profile. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-05-preview +// Generated from API version 2024-09-30-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Trusted Signing account name. // - profileName - Certificate profile name. @@ -70,7 +70,7 @@ func (client *CertificateProfilesClient) BeginCreate(ctx context.Context, resour // Create - Create a certificate profile. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-05-preview +// Generated from API version 2024-09-30-preview func (client *CertificateProfilesClient) create(ctx context.Context, resourceGroupName string, accountName string, profileName string, resource CertificateProfile, options *CertificateProfilesClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "CertificateProfilesClient.BeginCreate" @@ -116,7 +116,7 @@ func (client *CertificateProfilesClient) createCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-05-preview") + reqQP.Set("api-version", "2024-09-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} @@ -129,7 +129,7 @@ func (client *CertificateProfilesClient) createCreateRequest(ctx context.Context // BeginDelete - Delete a certificate profile. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-05-preview +// Generated from API version 2024-09-30-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Trusted Signing account name. // - profileName - Certificate profile name. @@ -155,7 +155,7 @@ func (client *CertificateProfilesClient) BeginDelete(ctx context.Context, resour // Delete - Delete a certificate profile. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-05-preview +// Generated from API version 2024-09-30-preview func (client *CertificateProfilesClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, profileName string, options *CertificateProfilesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "CertificateProfilesClient.BeginDelete" @@ -201,7 +201,7 @@ func (client *CertificateProfilesClient) deleteCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-05-preview") + reqQP.Set("api-version", "2024-09-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -210,7 +210,7 @@ func (client *CertificateProfilesClient) deleteCreateRequest(ctx context.Context // Get - Get details of a certificate profile. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-05-preview +// Generated from API version 2024-09-30-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Trusted Signing account name. // - profileName - Certificate profile name. @@ -261,7 +261,7 @@ func (client *CertificateProfilesClient) getCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-05-preview") + reqQP.Set("api-version", "2024-09-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -278,7 +278,7 @@ func (client *CertificateProfilesClient) getHandleResponse(resp *http.Response) // NewListByCodeSigningAccountPager - List certificate profiles under a trusted signing account. // -// Generated from API version 2024-02-05-preview +// Generated from API version 2024-09-30-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Trusted Signing account name. // - options - CertificateProfilesClientListByCodeSigningAccountOptions contains the optional parameters for the CertificateProfilesClient.NewListByCodeSigningAccountPager @@ -326,7 +326,7 @@ func (client *CertificateProfilesClient) listByCodeSigningAccountCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-05-preview") + reqQP.Set("api-version", "2024-09-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -344,7 +344,7 @@ func (client *CertificateProfilesClient) listByCodeSigningAccountHandleResponse( // RevokeCertificate - Revoke a certificate under a certificate profile. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-05-preview +// Generated from API version 2024-09-30-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Trusted Signing account name. // - profileName - Certificate profile name. @@ -396,7 +396,7 @@ func (client *CertificateProfilesClient) revokeCertificateCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-05-preview") + reqQP.Set("api-version", "2024-09-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/certificateprofiles_client_example_test.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/certificateprofiles_client_example_test.go index 080c1b439988..0a6f5872d918 100644 --- a/sdk/resourcemanager/trustedsigning/armtrustedsigning/certificateprofiles_client_example_test.go +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/certificateprofiles_client_example_test.go @@ -13,7 +13,7 @@ import ( "time" ) -// Generated from example definition: 2024-02-05-preview/CertificateProfiles_Create.json +// Generated from example definition: 2024-09-30-preview/CertificateProfiles_Create.json func ExampleCertificateProfilesClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -52,35 +52,28 @@ func ExampleCertificateProfilesClient_BeginCreate() { // { // CreatedDate: to.Ptr("3/14/2023 5:27:49 PM"), // ExpiryDate: to.Ptr("3/17/2023 5:27:49 PM"), + // EnhancedKeyUsage: to.Ptr("1.3.6.1.4.1.311.yy.xxxxxxxx.xxxxxxxx.xxxxxxxxx.xxxxxxxx"), // SerialNumber: to.Ptr("xxxxxxxxxxxxxxxxxx"), // Status: to.Ptr(armtrustedsigning.CertificateStatusActive), // SubjectName: to.Ptr("CN=Contoso Inc, O=Contoso Inc, L=New York, S=New York, C=US"), // Thumbprint: to.Ptr("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"), // }, // }, - // City: to.Ptr("Dallas"), - // CommonName: to.Ptr("Contoso Inc"), - // Country: to.Ptr("US"), - // EnhancedKeyUsage: to.Ptr("1.3.6.1.4.1.311.yy.xxxxxxxx.xxxxxxxx.xxxxxxxxx.xxxxxxxx"), // IdentityValidationID: to.Ptr("00000000-1234-5678-3333-444444444444"), // IncludeCity: to.Ptr(false), // IncludeCountry: to.Ptr(false), // IncludePostalCode: to.Ptr(true), // IncludeState: to.Ptr(false), // IncludeStreetAddress: to.Ptr(false), - // Organization: to.Ptr("Contoso Inc"), - // PostalCode: to.Ptr("560090"), // ProfileType: to.Ptr(armtrustedsigning.ProfileTypePublicTrust), // ProvisioningState: to.Ptr(armtrustedsigning.ProvisioningStateSucceeded), - // State: to.Ptr("Texas"), // Status: to.Ptr(armtrustedsigning.CertificateProfileStatusActive), - // StreetAddress: to.Ptr("123 Bluebonnet"), // }, // }, // } } -// Generated from example definition: 2024-02-05-preview/CertificateProfiles_Delete.json +// Generated from example definition: 2024-09-30-preview/CertificateProfiles_Delete.json func ExampleCertificateProfilesClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -101,7 +94,7 @@ func ExampleCertificateProfilesClient_BeginDelete() { } } -// Generated from example definition: 2024-02-05-preview/CertificateProfiles_Get.json +// Generated from example definition: 2024-09-30-preview/CertificateProfiles_Get.json func ExampleCertificateProfilesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -129,35 +122,28 @@ func ExampleCertificateProfilesClient_Get() { // { // CreatedDate: to.Ptr("3/14/2023 5:27:49 PM"), // ExpiryDate: to.Ptr("3/17/2023 5:27:49 PM"), + // EnhancedKeyUsage: to.Ptr("1.3.6.1.4.1.311.yy.xxxxxxxx.xxxxxxxx.xxxxxxxxx.xxxxxxxx"), // SerialNumber: to.Ptr("xxxxxxxxxxxxxxxxxx"), // Status: to.Ptr(armtrustedsigning.CertificateStatusActive), // SubjectName: to.Ptr("CN=Contoso Inc, O=Contoso Inc, L=New York, S=New York, C=US"), // Thumbprint: to.Ptr("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"), // }, // }, - // City: to.Ptr("Dallas"), - // CommonName: to.Ptr("Contoso Inc"), - // Country: to.Ptr("US"), - // EnhancedKeyUsage: to.Ptr("1.3.6.1.4.1.311.yy.xxxxxxxx.xxxxxxxx.xxxxxxxxx.xxxxxxxx"), // IdentityValidationID: to.Ptr("123456"), // IncludeCity: to.Ptr(false), // IncludeCountry: to.Ptr(false), // IncludePostalCode: to.Ptr(true), // IncludeState: to.Ptr(false), // IncludeStreetAddress: to.Ptr(false), - // Organization: to.Ptr("Contoso Inc"), - // PostalCode: to.Ptr("560090"), // ProfileType: to.Ptr(armtrustedsigning.ProfileTypePublicTrust), // ProvisioningState: to.Ptr(armtrustedsigning.ProvisioningStateSucceeded), - // State: to.Ptr("Texas"), // Status: to.Ptr(armtrustedsigning.CertificateProfileStatusActive), - // StreetAddress: to.Ptr("123 Bluebonnet"), // }, // }, // } } -// Generated from example definition: 2024-02-05-preview/CertificateProfiles_ListByCodeSigningAccount.json +// Generated from example definition: 2024-09-30-preview/CertificateProfiles_ListByCodeSigningAccount.json func ExampleCertificateProfilesClient_NewListByCodeSigningAccountPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -191,29 +177,22 @@ func ExampleCertificateProfilesClient_NewListByCodeSigningAccountPager() { // { // CreatedDate: to.Ptr("3/14/2023 5:27:49 PM"), // ExpiryDate: to.Ptr("3/17/2023 5:27:49 PM"), + // EnhancedKeyUsage: to.Ptr("1.3.6.1.4.1.311.yy.xxxxxxxx.xxxxxxxx.xxxxxxxxx.xxxxxxxx"), // SerialNumber: to.Ptr("xxxxxxxxxxxxxxxxxx"), // Status: to.Ptr(armtrustedsigning.CertificateStatusActive), // SubjectName: to.Ptr("CN=Contoso Inc, O=Contoso Inc, L=New York, S=New York, C=US"), // Thumbprint: to.Ptr("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"), // }, // }, - // City: to.Ptr("Dallas"), - // CommonName: to.Ptr("Microsoft Corporation"), - // Country: to.Ptr("US"), - // EnhancedKeyUsage: to.Ptr("1.3.6.1.4.1.311.yy.xxxxxxxx.xxxxxxxx.xxxxxxxxx.xxxxxxxx"), // IdentityValidationID: to.Ptr("123456"), // IncludeCity: to.Ptr(false), // IncludeCountry: to.Ptr(false), // IncludePostalCode: to.Ptr(true), // IncludeState: to.Ptr(false), // IncludeStreetAddress: to.Ptr(false), - // Organization: to.Ptr("Microsoft Corporation"), - // PostalCode: to.Ptr("560090"), // ProfileType: to.Ptr(armtrustedsigning.ProfileTypePublicTrust), // ProvisioningState: to.Ptr(armtrustedsigning.ProvisioningStateSucceeded), - // State: to.Ptr("Texas"), // Status: to.Ptr(armtrustedsigning.CertificateProfileStatusActive), - // StreetAddress: to.Ptr("123 Bluebonnet"), // }, // }, // }, @@ -222,7 +201,7 @@ func ExampleCertificateProfilesClient_NewListByCodeSigningAccountPager() { } } -// Generated from example definition: 2024-02-05-preview/CertificateProfiles_RevokeCertificate.json +// Generated from example definition: 2024-09-30-preview/CertificateProfiles_RevokeCertificate.json func ExampleCertificateProfilesClient_RevokeCertificate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/codesigningaccounts_client.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/codesigningaccounts_client.go index 5d80b7c400f2..fc0c2cd038d0 100644 --- a/sdk/resourcemanager/trustedsigning/armtrustedsigning/codesigningaccounts_client.go +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/codesigningaccounts_client.go @@ -42,7 +42,7 @@ func NewCodeSigningAccountsClient(subscriptionID string, credential azcore.Token // CheckNameAvailability - Checks that the trusted signing account name is valid and is not already in use. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-05-preview +// Generated from API version 2024-09-30-preview // - body - The CheckAvailability request // - options - CodeSigningAccountsClientCheckNameAvailabilityOptions contains the optional parameters for the CodeSigningAccountsClient.CheckNameAvailability // method. @@ -80,7 +80,7 @@ func (client *CodeSigningAccountsClient) checkNameAvailabilityCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-05-preview") + reqQP.Set("api-version", "2024-09-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} @@ -102,7 +102,7 @@ func (client *CodeSigningAccountsClient) checkNameAvailabilityHandleResponse(res // BeginCreate - Create a trusted Signing Account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-05-preview +// Generated from API version 2024-09-30-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Trusted Signing account name. // - resource - Parameters to create the trusted signing account @@ -129,7 +129,7 @@ func (client *CodeSigningAccountsClient) BeginCreate(ctx context.Context, resour // Create - Create a trusted Signing Account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-05-preview +// Generated from API version 2024-09-30-preview func (client *CodeSigningAccountsClient) create(ctx context.Context, resourceGroupName string, accountName string, resource CodeSigningAccount, options *CodeSigningAccountsClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "CodeSigningAccountsClient.BeginCreate" @@ -171,7 +171,7 @@ func (client *CodeSigningAccountsClient) createCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-05-preview") + reqQP.Set("api-version", "2024-09-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} @@ -184,7 +184,7 @@ func (client *CodeSigningAccountsClient) createCreateRequest(ctx context.Context // BeginDelete - Delete a trusted signing account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-05-preview +// Generated from API version 2024-09-30-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Trusted Signing account name. // - options - CodeSigningAccountsClientBeginDeleteOptions contains the optional parameters for the CodeSigningAccountsClient.BeginDelete @@ -209,7 +209,7 @@ func (client *CodeSigningAccountsClient) BeginDelete(ctx context.Context, resour // Delete - Delete a trusted signing account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-05-preview +// Generated from API version 2024-09-30-preview func (client *CodeSigningAccountsClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, options *CodeSigningAccountsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "CodeSigningAccountsClient.BeginDelete" @@ -251,7 +251,7 @@ func (client *CodeSigningAccountsClient) deleteCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-05-preview") + reqQP.Set("api-version", "2024-09-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -260,7 +260,7 @@ func (client *CodeSigningAccountsClient) deleteCreateRequest(ctx context.Context // Get - Get a trusted Signing Account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-05-preview +// Generated from API version 2024-09-30-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Trusted Signing account name. // - options - CodeSigningAccountsClientGetOptions contains the optional parameters for the CodeSigningAccountsClient.Get method. @@ -306,7 +306,7 @@ func (client *CodeSigningAccountsClient) getCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-05-preview") + reqQP.Set("api-version", "2024-09-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -323,7 +323,7 @@ func (client *CodeSigningAccountsClient) getHandleResponse(resp *http.Response) // NewListByResourceGroupPager - Lists trusted signing accounts within a resource group. // -// Generated from API version 2024-02-05-preview +// Generated from API version 2024-09-30-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - CodeSigningAccountsClientListByResourceGroupOptions contains the optional parameters for the CodeSigningAccountsClient.NewListByResourceGroupPager // method. @@ -366,7 +366,7 @@ func (client *CodeSigningAccountsClient) listByResourceGroupCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-05-preview") + reqQP.Set("api-version", "2024-09-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -383,7 +383,7 @@ func (client *CodeSigningAccountsClient) listByResourceGroupHandleResponse(resp // NewListBySubscriptionPager - Lists trusted signing accounts within a subscription. // -// Generated from API version 2024-02-05-preview +// Generated from API version 2024-09-30-preview // - options - CodeSigningAccountsClientListBySubscriptionOptions contains the optional parameters for the CodeSigningAccountsClient.NewListBySubscriptionPager // method. func (client *CodeSigningAccountsClient) NewListBySubscriptionPager(options *CodeSigningAccountsClientListBySubscriptionOptions) *runtime.Pager[CodeSigningAccountsClientListBySubscriptionResponse] { @@ -421,7 +421,7 @@ func (client *CodeSigningAccountsClient) listBySubscriptionCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-05-preview") + reqQP.Set("api-version", "2024-09-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -439,7 +439,7 @@ func (client *CodeSigningAccountsClient) listBySubscriptionHandleResponse(resp * // BeginUpdate - Update a trusted signing account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-05-preview +// Generated from API version 2024-09-30-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Trusted Signing account name. // - properties - Parameters supplied to update the trusted signing account @@ -465,7 +465,7 @@ func (client *CodeSigningAccountsClient) BeginUpdate(ctx context.Context, resour // Update - Update a trusted signing account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-05-preview +// Generated from API version 2024-09-30-preview func (client *CodeSigningAccountsClient) update(ctx context.Context, resourceGroupName string, accountName string, properties CodeSigningAccountPatch, options *CodeSigningAccountsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "CodeSigningAccountsClient.BeginUpdate" @@ -507,7 +507,7 @@ func (client *CodeSigningAccountsClient) updateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-05-preview") + reqQP.Set("api-version", "2024-09-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/codesigningaccounts_client_example_test.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/codesigningaccounts_client_example_test.go index 5d99e26faea0..6b8df0c7182e 100644 --- a/sdk/resourcemanager/trustedsigning/armtrustedsigning/codesigningaccounts_client_example_test.go +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/codesigningaccounts_client_example_test.go @@ -12,7 +12,7 @@ import ( "log" ) -// Generated from example definition: 2024-02-05-preview/CodeSigningAccounts_CheckNameAvailability.json +// Generated from example definition: 2024-09-30-preview/CodeSigningAccounts_CheckNameAvailability.json func ExampleCodeSigningAccountsClient_CheckNameAvailability() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -39,7 +39,7 @@ func ExampleCodeSigningAccountsClient_CheckNameAvailability() { // } } -// Generated from example definition: 2024-02-05-preview/CodeSigningAccounts_Create.json +// Generated from example definition: 2024-09-30-preview/CodeSigningAccounts_Create.json func ExampleCodeSigningAccountsClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -84,7 +84,7 @@ func ExampleCodeSigningAccountsClient_BeginCreate() { // } } -// Generated from example definition: 2024-02-05-preview/CodeSigningAccounts_Delete.json +// Generated from example definition: 2024-09-30-preview/CodeSigningAccounts_Delete.json func ExampleCodeSigningAccountsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -105,7 +105,7 @@ func ExampleCodeSigningAccountsClient_BeginDelete() { } } -// Generated from example definition: 2024-02-05-preview/CodeSigningAccounts_Get.json +// Generated from example definition: 2024-09-30-preview/CodeSigningAccounts_Get.json func ExampleCodeSigningAccountsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -142,7 +142,7 @@ func ExampleCodeSigningAccountsClient_Get() { // } } -// Generated from example definition: 2024-02-05-preview/CodeSigningAccounts_ListByResourceGroup.json +// Generated from example definition: 2024-09-30-preview/CodeSigningAccounts_ListByResourceGroup.json func ExampleCodeSigningAccountsClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -188,7 +188,7 @@ func ExampleCodeSigningAccountsClient_NewListByResourceGroupPager() { } } -// Generated from example definition: 2024-02-05-preview/CodeSigningAccounts_ListBySubscription.json +// Generated from example definition: 2024-09-30-preview/CodeSigningAccounts_ListBySubscription.json func ExampleCodeSigningAccountsClient_NewListBySubscriptionPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -234,7 +234,7 @@ func ExampleCodeSigningAccountsClient_NewListBySubscriptionPager() { } } -// Generated from example definition: 2024-02-05-preview/CodeSigningAccounts_Update.json +// Generated from example definition: 2024-09-30-preview/CodeSigningAccounts_Update.json func ExampleCodeSigningAccountsClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/constants.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/constants.go index ff6a585fdc9d..f85c071f63ba 100644 --- a/sdk/resourcemanager/trustedsigning/armtrustedsigning/constants.go +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/constants.go @@ -6,7 +6,7 @@ package armtrustedsigning const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/trustedsigning/armtrustedsigning" - moduleVersion = "v0.1.0" + moduleVersion = "v0.2.0" ) // ActionType - Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/certificateprofiles_server.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/certificateprofiles_server.go index 50234da52fcb..94d152216852 100644 --- a/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/certificateprofiles_server.go +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/certificateprofiles_server.go @@ -25,7 +25,7 @@ type CertificateProfilesServer struct { BeginCreate func(ctx context.Context, resourceGroupName string, accountName string, profileName string, resource armtrustedsigning.CertificateProfile, options *armtrustedsigning.CertificateProfilesClientBeginCreateOptions) (resp azfake.PollerResponder[armtrustedsigning.CertificateProfilesClientCreateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method CertificateProfilesClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, accountName string, profileName string, options *armtrustedsigning.CertificateProfilesClientBeginDeleteOptions) (resp azfake.PollerResponder[armtrustedsigning.CertificateProfilesClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method CertificateProfilesClient.Get @@ -74,25 +74,44 @@ func (c *CertificateProfilesServerTransport) Do(req *http.Request) (*http.Respon } func (c *CertificateProfilesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error + resultChan := make(chan result) + defer close(resultChan) - switch method { - case "CertificateProfilesClient.BeginCreate": - resp, err = c.dispatchBeginCreate(req) - case "CertificateProfilesClient.BeginDelete": - resp, err = c.dispatchBeginDelete(req) - case "CertificateProfilesClient.Get": - resp, err = c.dispatchGet(req) - case "CertificateProfilesClient.NewListByCodeSigningAccountPager": - resp, err = c.dispatchNewListByCodeSigningAccountPager(req) - case "CertificateProfilesClient.RevokeCertificate": - resp, err = c.dispatchRevokeCertificate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + go func() { + var intercepted bool + var res result + if certificateProfilesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = certificateProfilesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "CertificateProfilesClient.BeginCreate": + res.resp, res.err = c.dispatchBeginCreate(req) + case "CertificateProfilesClient.BeginDelete": + res.resp, res.err = c.dispatchBeginDelete(req) + case "CertificateProfilesClient.Get": + res.resp, res.err = c.dispatchGet(req) + case "CertificateProfilesClient.NewListByCodeSigningAccountPager": + res.resp, res.err = c.dispatchNewListByCodeSigningAccountPager(req) + case "CertificateProfilesClient.RevokeCertificate": + res.resp, res.err = c.dispatchRevokeCertificate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() - return resp, err + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (c *CertificateProfilesServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { @@ -184,9 +203,9 @@ func (c *CertificateProfilesServerTransport) dispatchBeginDelete(req *http.Reque return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { c.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { c.beginDelete.remove(req) @@ -313,3 +332,9 @@ func (c *CertificateProfilesServerTransport) dispatchRevokeCertificate(req *http } return resp, nil } + +// set this to conditionally intercept incoming requests to CertificateProfilesServerTransport +var certificateProfilesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/codesigningaccounts_server.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/codesigningaccounts_server.go index a886f6e6372a..933abafd06b9 100644 --- a/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/codesigningaccounts_server.go +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/codesigningaccounts_server.go @@ -29,7 +29,7 @@ type CodeSigningAccountsServer struct { BeginCreate func(ctx context.Context, resourceGroupName string, accountName string, resource armtrustedsigning.CodeSigningAccount, options *armtrustedsigning.CodeSigningAccountsClientBeginCreateOptions) (resp azfake.PollerResponder[armtrustedsigning.CodeSigningAccountsClientCreateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method CodeSigningAccountsClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, accountName string, options *armtrustedsigning.CodeSigningAccountsClientBeginDeleteOptions) (resp azfake.PollerResponder[armtrustedsigning.CodeSigningAccountsClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method CodeSigningAccountsClient.Get @@ -86,29 +86,48 @@ func (c *CodeSigningAccountsServerTransport) Do(req *http.Request) (*http.Respon } func (c *CodeSigningAccountsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error - - switch method { - case "CodeSigningAccountsClient.CheckNameAvailability": - resp, err = c.dispatchCheckNameAvailability(req) - case "CodeSigningAccountsClient.BeginCreate": - resp, err = c.dispatchBeginCreate(req) - case "CodeSigningAccountsClient.BeginDelete": - resp, err = c.dispatchBeginDelete(req) - case "CodeSigningAccountsClient.Get": - resp, err = c.dispatchGet(req) - case "CodeSigningAccountsClient.NewListByResourceGroupPager": - resp, err = c.dispatchNewListByResourceGroupPager(req) - case "CodeSigningAccountsClient.NewListBySubscriptionPager": - resp, err = c.dispatchNewListBySubscriptionPager(req) - case "CodeSigningAccountsClient.BeginUpdate": - resp, err = c.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - return resp, err + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if codeSigningAccountsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = codeSigningAccountsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "CodeSigningAccountsClient.CheckNameAvailability": + res.resp, res.err = c.dispatchCheckNameAvailability(req) + case "CodeSigningAccountsClient.BeginCreate": + res.resp, res.err = c.dispatchBeginCreate(req) + case "CodeSigningAccountsClient.BeginDelete": + res.resp, res.err = c.dispatchBeginDelete(req) + case "CodeSigningAccountsClient.Get": + res.resp, res.err = c.dispatchGet(req) + case "CodeSigningAccountsClient.NewListByResourceGroupPager": + res.resp, res.err = c.dispatchNewListByResourceGroupPager(req) + case "CodeSigningAccountsClient.NewListBySubscriptionPager": + res.resp, res.err = c.dispatchNewListBySubscriptionPager(req) + case "CodeSigningAccountsClient.BeginUpdate": + res.resp, res.err = c.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (c *CodeSigningAccountsServerTransport) dispatchCheckNameAvailability(req *http.Request) (*http.Response, error) { @@ -221,9 +240,9 @@ func (c *CodeSigningAccountsServerTransport) dispatchBeginDelete(req *http.Reque return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { c.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { c.beginDelete.remove(req) @@ -382,3 +401,9 @@ func (c *CodeSigningAccountsServerTransport) dispatchBeginUpdate(req *http.Reque return resp, nil } + +// set this to conditionally intercept incoming requests to CodeSigningAccountsServerTransport +var codeSigningAccountsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/internal.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/internal.go index 56a8f624f5f3..7425b6a669e2 100644 --- a/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/internal.go +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/internal.go @@ -10,6 +10,11 @@ import ( "sync" ) +type result struct { + resp *http.Response + err error +} + type nonRetriableError struct { error } diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/operations_server.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/operations_server.go index dcbfc7a95dbc..dc32d5c2713e 100644 --- a/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/operations_server.go +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/operations_server.go @@ -51,17 +51,36 @@ func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error } func (o *OperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error + resultChan := make(chan result) + defer close(resultChan) - switch method { - case "OperationsClient.NewListPager": - resp, err = o.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + go func() { + var intercepted bool + var res result + if operationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = operationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OperationsClient.NewListPager": + res.resp, res.err = o.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() - return resp, err + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { @@ -90,3 +109,9 @@ func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*ht } return resp, nil } + +// set this to conditionally intercept incoming requests to OperationsServerTransport +var operationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/go.mod b/sdk/resourcemanager/trustedsigning/armtrustedsigning/go.mod index d0a344d6e1de..62c06031e21e 100644 --- a/sdk/resourcemanager/trustedsigning/armtrustedsigning/go.mod +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/go.mod @@ -3,7 +3,7 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/trustedsigning/armt go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 ) @@ -14,8 +14,8 @@ require ( github.com/google/uuid v1.6.0 // indirect github.com/kylelemons/godebug v1.1.0 // indirect github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect - golang.org/x/crypto v0.25.0 // indirect - golang.org/x/net v0.27.0 // indirect - golang.org/x/sys v0.22.0 // indirect - golang.org/x/text v0.16.0 // indirect + golang.org/x/crypto v0.27.0 // indirect + golang.org/x/net v0.29.0 // indirect + golang.org/x/sys v0.25.0 // indirect + golang.org/x/text v0.18.0 // indirect ) diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/go.sum b/sdk/resourcemanager/trustedsigning/armtrustedsigning/go.sum index 09d275cb9a37..cbddbbd9ecec 100644 --- a/sdk/resourcemanager/trustedsigning/armtrustedsigning/go.sum +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/go.sum @@ -1,5 +1,5 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 h1:GJHeeA2N7xrG3q30L2UXDyuWRzDM900/65j70wcM4Ww= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 h1:JZg6HRh6W6U4OLl6lk7BZ7BLisIzM9dG1R50zUk9C/M= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0/go.mod h1:YL1xnZ6QejvQHWJrX/AvhFl4WW4rqHVoKspWNVwFk0M= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= @@ -17,13 +17,13 @@ github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmd github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= -golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= -golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= +golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= +golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/models.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/models.go index cfb89b3234d0..730350126f22 100644 --- a/sdk/resourcemanager/trustedsigning/armtrustedsigning/models.go +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/models.go @@ -12,11 +12,20 @@ type AccountSKU struct { Name *SKUName } +// AccountSKUPatch - SKU of the trusted signing account. +type AccountSKUPatch struct { + // Name of the SKU. + Name *SKUName +} + // Certificate - Properties of the certificate. type Certificate struct { // Certificate created date. CreatedDate *string + // Enhanced key usage of the certificate. + EnhancedKeyUsage *string + // Certificate expiry date. ExpiryDate *string @@ -65,12 +74,12 @@ type CertificateProfileListResult struct { // CertificateProfileProperties - Properties of the certificate profile. type CertificateProfileProperties struct { + // REQUIRED; Identity validation id used for the certificate subject name. + IdentityValidationID *string + // REQUIRED; Profile type of the certificate. ProfileType *ProfileType - // Identity validation id used for the certificate subject name. - IdentityValidationID *string - // Whether to include L in the certificate subject name. Applicable only for private trust, private trust ci profile types IncludeCity *bool @@ -89,38 +98,11 @@ type CertificateProfileProperties struct { // READ-ONLY; List of renewed certificates. Certificates []*Certificate - // READ-ONLY; Used as L in the certificate subject name. - City *string - - // READ-ONLY; Used as CN in the certificate subject name. - CommonName *string - - // READ-ONLY; Used as C in the certificate subject name. - Country *string - - // READ-ONLY; Enhanced key usage of the certificate. - EnhancedKeyUsage *string - - // READ-ONLY; Used as O in the certificate subject name. - Organization *string - - // READ-ONLY; Used as OU in the private trust certificate subject name. - OrganizationUnit *string - - // READ-ONLY; Used as PC in the certificate subject name. - PostalCode *string - // READ-ONLY; Status of the current operation on certificate profile. ProvisioningState *ProvisioningState - // READ-ONLY; Used as S in the certificate subject name. - State *string - // READ-ONLY; Status of the certificate profile. Status *CertificateProfileStatus - - // READ-ONLY; Used as STREET in the certificate subject name. - StreetAddress *string } // CheckNameAvailability - The parameters used to check the availability of the trusted signing account name. @@ -188,7 +170,7 @@ type CodeSigningAccountPatch struct { // CodeSigningAccountPatchProperties - Properties of the trusted signing account. type CodeSigningAccountPatchProperties struct { // SKU of the trusted signing account. - SKU *AccountSKU + SKU *AccountSKUPatch } // CodeSigningAccountProperties - Properties of the trusted signing account. diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/models_serde.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/models_serde.go index a2b0b08cfedf..fcb032b16f18 100644 --- a/sdk/resourcemanager/trustedsigning/armtrustedsigning/models_serde.go +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/models_serde.go @@ -38,10 +38,38 @@ func (a *AccountSKU) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type AccountSKUPatch. +func (a AccountSKUPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", a.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccountSKUPatch. +func (a *AccountSKUPatch) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type Certificate. func (c Certificate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "createdDate", c.CreatedDate) + populate(objectMap, "enhancedKeyUsage", c.EnhancedKeyUsage) populate(objectMap, "expiryDate", c.ExpiryDate) populate(objectMap, "revocation", c.Revocation) populate(objectMap, "serialNumber", c.SerialNumber) @@ -63,6 +91,9 @@ func (c *Certificate) UnmarshalJSON(data []byte) error { case "createdDate": err = unpopulate(val, "CreatedDate", &c.CreatedDate) delete(rawMsg, key) + case "enhancedKeyUsage": + err = unpopulate(val, "EnhancedKeyUsage", &c.EnhancedKeyUsage) + delete(rawMsg, key) case "expiryDate": err = unpopulate(val, "ExpiryDate", &c.ExpiryDate) delete(rawMsg, key) @@ -167,24 +198,15 @@ func (c *CertificateProfileListResult) UnmarshalJSON(data []byte) error { func (c CertificateProfileProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "certificates", c.Certificates) - populate(objectMap, "city", c.City) - populate(objectMap, "commonName", c.CommonName) - populate(objectMap, "country", c.Country) - populate(objectMap, "enhancedKeyUsage", c.EnhancedKeyUsage) populate(objectMap, "identityValidationId", c.IdentityValidationID) populate(objectMap, "includeCity", c.IncludeCity) populate(objectMap, "includeCountry", c.IncludeCountry) populate(objectMap, "includePostalCode", c.IncludePostalCode) populate(objectMap, "includeState", c.IncludeState) populate(objectMap, "includeStreetAddress", c.IncludeStreetAddress) - populate(objectMap, "organization", c.Organization) - populate(objectMap, "organizationUnit", c.OrganizationUnit) - populate(objectMap, "postalCode", c.PostalCode) populate(objectMap, "profileType", c.ProfileType) populate(objectMap, "provisioningState", c.ProvisioningState) - populate(objectMap, "state", c.State) populate(objectMap, "status", c.Status) - populate(objectMap, "streetAddress", c.StreetAddress) return json.Marshal(objectMap) } @@ -200,18 +222,6 @@ func (c *CertificateProfileProperties) UnmarshalJSON(data []byte) error { case "certificates": err = unpopulate(val, "Certificates", &c.Certificates) delete(rawMsg, key) - case "city": - err = unpopulate(val, "City", &c.City) - delete(rawMsg, key) - case "commonName": - err = unpopulate(val, "CommonName", &c.CommonName) - delete(rawMsg, key) - case "country": - err = unpopulate(val, "Country", &c.Country) - delete(rawMsg, key) - case "enhancedKeyUsage": - err = unpopulate(val, "EnhancedKeyUsage", &c.EnhancedKeyUsage) - delete(rawMsg, key) case "identityValidationId": err = unpopulate(val, "IdentityValidationID", &c.IdentityValidationID) delete(rawMsg, key) @@ -230,30 +240,15 @@ func (c *CertificateProfileProperties) UnmarshalJSON(data []byte) error { case "includeStreetAddress": err = unpopulate(val, "IncludeStreetAddress", &c.IncludeStreetAddress) delete(rawMsg, key) - case "organization": - err = unpopulate(val, "Organization", &c.Organization) - delete(rawMsg, key) - case "organizationUnit": - err = unpopulate(val, "OrganizationUnit", &c.OrganizationUnit) - delete(rawMsg, key) - case "postalCode": - err = unpopulate(val, "PostalCode", &c.PostalCode) - delete(rawMsg, key) case "profileType": err = unpopulate(val, "ProfileType", &c.ProfileType) delete(rawMsg, key) case "provisioningState": err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &c.State) - delete(rawMsg, key) case "status": err = unpopulate(val, "Status", &c.Status) delete(rawMsg, key) - case "streetAddress": - err = unpopulate(val, "StreetAddress", &c.StreetAddress) - delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/operations_client.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/operations_client.go index 4df423270e96..ee3e36600a93 100644 --- a/sdk/resourcemanager/trustedsigning/armtrustedsigning/operations_client.go +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/operations_client.go @@ -35,7 +35,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - List the operations for the provider // -// Generated from API version 2024-02-05-preview +// Generated from API version 2024-09-30-preview // - 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]{ @@ -68,7 +68,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, _ *Operat return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-05-preview") + reqQP.Set("api-version", "2024-09-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/operations_client_example_test.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/operations_client_example_test.go index 8d8011d02001..886d000c955f 100644 --- a/sdk/resourcemanager/trustedsigning/armtrustedsigning/operations_client_example_test.go +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/operations_client_example_test.go @@ -11,7 +11,7 @@ import ( "log" ) -// Generated from example definition: 2024-02-05-preview/Operations_List.json +// Generated from example definition: 2024-09-30-preview/Operations_List.json func ExampleOperationsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/tsp-location.yaml b/sdk/resourcemanager/trustedsigning/armtrustedsigning/tsp-location.yaml index 58a0ab9c920e..351e45e8a666 100644 --- a/sdk/resourcemanager/trustedsigning/armtrustedsigning/tsp-location.yaml +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/codesigning/CodeSigning.Management -commit: 778fdb20839c487eba95a6b161812ad9d9d6337d +commit: 405438c72094a0a43fbcba18a56aa71110b78db8 repo: Azure/azure-rest-api-specs -additionalDirectories: +additionalDirectories: \ No newline at end of file diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/CHANGELOG.md b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/CHANGELOG.md index 3a3e8181ab5f..6499e4e4bb10 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/CHANGELOG.md +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/CHANGELOG.md @@ -1,5 +1,88 @@ # Release History +## 1.0.0 (2024-11-29) +### Breaking Changes + +- Type of `CreateAndMountFileShareConfiguration.ConfigurationType` has been changed from `*ConfigurationType` to `*FileShareConfigurationType` +- Type of `ErrorAdditionalInfo.Info` has been changed from `any` to `*ErrorAdditionalInfoInfo` +- Type of `FileShareConfiguration.ConfigurationType` has been changed from `*ConfigurationType` to `*FileShareConfigurationType` +- Type of `MountFileShareConfiguration.ConfigurationType` has been changed from `*ConfigurationType` to `*FileShareConfigurationType` +- Type of `OperationStatusResult.PercentComplete` has been changed from `*float32` to `*float64` +- Type of `SAPVirtualInstance.Identity` has been changed from `*UserAssignedServiceIdentity` to `*SAPVirtualInstanceIdentity` +- Type of `SkipFileShareConfiguration.ConfigurationType` has been changed from `*ConfigurationType` to `*FileShareConfigurationType` +- Type of `UpdateSAPVirtualInstanceRequest.Identity` has been changed from `*UserAssignedServiceIdentity` to `*SAPVirtualInstanceIdentity` +- Enum `ActionType` has been removed +- Enum `ConfigurationType` has been removed +- Enum `ManagedServiceIdentityType` has been removed +- Enum `Origin` has been removed +- Function `*ClientFactory.NewOperationsClient` has been removed +- Function `*ClientFactory.NewSAPCentralInstancesClient` has been removed +- Function `*ClientFactory.NewWorkloadsClient` has been removed +- Function `NewOperationsClient` has been removed +- Function `*OperationsClient.NewListPager` has been removed +- Function `*SAPApplicationServerInstancesClient.BeginStartInstance` has been removed +- Function `*SAPApplicationServerInstancesClient.BeginStopInstance` has been removed +- Function `NewSAPCentralInstancesClient` has been removed +- Function `*SAPCentralInstancesClient.BeginCreate` has been removed +- Function `*SAPCentralInstancesClient.BeginDelete` has been removed +- Function `*SAPCentralInstancesClient.Get` has been removed +- Function `*SAPCentralInstancesClient.NewListPager` has been removed +- Function `*SAPCentralInstancesClient.BeginStartInstance` has been removed +- Function `*SAPCentralInstancesClient.BeginStopInstance` has been removed +- Function `*SAPCentralInstancesClient.Update` has been removed +- Function `*SAPDatabaseInstancesClient.BeginStartInstance` has been removed +- Function `*SAPDatabaseInstancesClient.BeginStopInstance` has been removed +- Function `NewWorkloadsClient` has been removed +- Function `*WorkloadsClient.SAPAvailabilityZoneDetails` has been removed +- Function `*WorkloadsClient.SAPDiskConfigurations` has been removed +- Function `*WorkloadsClient.SAPSizingRecommendations` has been removed +- Function `*WorkloadsClient.SAPSupportedSKU` has been removed +- Struct `Operation` has been removed +- Struct `OperationDisplay` has been removed +- Struct `OperationListResult` has been removed +- Struct `SAPApplicationServerInstanceList` has been removed +- Struct `SAPCentralInstanceList` has been removed +- Struct `SAPDatabaseInstanceList` has been removed +- Struct `SAPVirtualInstanceList` has been removed +- Struct `UserAssignedServiceIdentity` has been removed +- Field `SAPApplicationServerInstanceList` of struct `SAPApplicationServerInstancesClientListResponse` has been removed +- Field `SAPDatabaseInstanceList` of struct `SAPDatabaseInstancesClientListResponse` has been removed +- Field `SAPVirtualInstanceList` of struct `SAPVirtualInstancesClientListByResourceGroupResponse` has been removed +- Field `SAPVirtualInstanceList` of struct `SAPVirtualInstancesClientListBySubscriptionResponse` has been removed + +### Features Added + +- New enum type `FileShareConfigurationType` with values `FileShareConfigurationTypeCreateAndMount`, `FileShareConfigurationTypeMount`, `FileShareConfigurationTypeSkip` +- New enum type `SAPVirtualInstanceIdentityType` with values `SAPVirtualInstanceIdentityTypeNone`, `SAPVirtualInstanceIdentityTypeUserAssigned` +- New function `*ClientFactory.NewSAPCentralServerInstancesClient() *SAPCentralServerInstancesClient` +- New function `*SAPApplicationServerInstancesClient.BeginStart(context.Context, string, string, string, *SAPApplicationServerInstancesClientBeginStartOptions) (*runtime.Poller[SAPApplicationServerInstancesClientStartResponse], error)` +- New function `*SAPApplicationServerInstancesClient.BeginStop(context.Context, string, string, string, *SAPApplicationServerInstancesClientBeginStopOptions) (*runtime.Poller[SAPApplicationServerInstancesClientStopResponse], error)` +- New function `NewSAPCentralServerInstancesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*SAPCentralServerInstancesClient, error)` +- New function `*SAPCentralServerInstancesClient.BeginCreate(context.Context, string, string, string, SAPCentralServerInstance, *SAPCentralServerInstancesClientBeginCreateOptions) (*runtime.Poller[SAPCentralServerInstancesClientCreateResponse], error)` +- New function `*SAPCentralServerInstancesClient.BeginDelete(context.Context, string, string, string, *SAPCentralServerInstancesClientBeginDeleteOptions) (*runtime.Poller[SAPCentralServerInstancesClientDeleteResponse], error)` +- New function `*SAPCentralServerInstancesClient.Get(context.Context, string, string, string, *SAPCentralServerInstancesClientGetOptions) (SAPCentralServerInstancesClientGetResponse, error)` +- New function `*SAPCentralServerInstancesClient.NewListPager(string, string, *SAPCentralServerInstancesClientListOptions) *runtime.Pager[SAPCentralServerInstancesClientListResponse]` +- New function `*SAPCentralServerInstancesClient.BeginStart(context.Context, string, string, string, *SAPCentralServerInstancesClientBeginStartOptions) (*runtime.Poller[SAPCentralServerInstancesClientStartResponse], error)` +- New function `*SAPCentralServerInstancesClient.BeginStop(context.Context, string, string, string, *SAPCentralServerInstancesClientBeginStopOptions) (*runtime.Poller[SAPCentralServerInstancesClientStopResponse], error)` +- New function `*SAPCentralServerInstancesClient.Update(context.Context, string, string, string, UpdateSAPCentralInstanceRequest, *SAPCentralServerInstancesClientUpdateOptions) (SAPCentralServerInstancesClientUpdateResponse, error)` +- New function `*SAPDatabaseInstancesClient.BeginStart(context.Context, string, string, string, *SAPDatabaseInstancesClientBeginStartOptions) (*runtime.Poller[SAPDatabaseInstancesClientStartResponse], error)` +- New function `*SAPDatabaseInstancesClient.BeginStop(context.Context, string, string, string, *SAPDatabaseInstancesClientBeginStopOptions) (*runtime.Poller[SAPDatabaseInstancesClientStopResponse], error)` +- New function `*SAPVirtualInstancesClient.GetAvailabilityZoneDetails(context.Context, string, SAPAvailabilityZoneDetailsRequest, *SAPVirtualInstancesClientGetAvailabilityZoneDetailsOptions) (SAPVirtualInstancesClientGetAvailabilityZoneDetailsResponse, error)` +- New function `*SAPVirtualInstancesClient.GetDiskConfigurations(context.Context, string, SAPDiskConfigurationsRequest, *SAPVirtualInstancesClientGetDiskConfigurationsOptions) (SAPVirtualInstancesClientGetDiskConfigurationsResponse, error)` +- New function `*SAPVirtualInstancesClient.GetSapSupportedSKU(context.Context, string, SAPSupportedSKUsRequest, *SAPVirtualInstancesClientGetSapSupportedSKUOptions) (SAPVirtualInstancesClientGetSapSupportedSKUResponse, error)` +- New function `*SAPVirtualInstancesClient.GetSizingRecommendations(context.Context, string, SAPSizingRecommendationRequest, *SAPVirtualInstancesClientGetSizingRecommendationsOptions) (SAPVirtualInstancesClientGetSizingRecommendationsResponse, error)` +- New struct `ErrorAdditionalInfoInfo` +- New struct `SAPApplicationServerInstanceListResult` +- New struct `SAPCentralServerInstanceListResult` +- New struct `SAPDatabaseInstanceListResult` +- New struct `SAPVirtualInstanceIdentity` +- New struct `SAPVirtualInstanceListResult` +- New anonymous field `SAPApplicationServerInstanceListResult` in struct `SAPApplicationServerInstancesClientListResponse` +- New anonymous field `SAPDatabaseInstanceListResult` in struct `SAPDatabaseInstancesClientListResponse` +- New anonymous field `SAPVirtualInstanceListResult` in struct `SAPVirtualInstancesClientListByResourceGroupResponse` +- New anonymous field `SAPVirtualInstanceListResult` in struct `SAPVirtualInstancesClientListBySubscriptionResponse` + + ## 0.1.0 (2024-02-23) ### Other Changes diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/autorest.md b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/autorest.md deleted file mode 100644 index d90afb2e7ea1..000000000000 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/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/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/readme.go.md -license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.0 -tag: package-preview-2023-10 -``` \ No newline at end of file diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/build.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/build.go deleted file mode 100644 index 17e40c7f3d7d..000000000000 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/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/workloadssapvirtualinstance/armworkloadssapvirtualinstance - -package armworkloadssapvirtualinstance diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/client_factory.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/client_factory.go index caba65f1dc75..948443e595bd 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/client_factory.go +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/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 armworkloadssapvirtualinstance @@ -22,7 +18,7 @@ type ClientFactory struct { // NewClientFactory creates a new instance of ClientFactory with the specified values. // The parameter values will be propagated to any client created from this factory. -// - subscriptionID - The ID of the target subscription. +// - 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 NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { @@ -36,13 +32,6 @@ func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, }, nil } -// NewOperationsClient creates a new instance of OperationsClient. -func (c *ClientFactory) NewOperationsClient() *OperationsClient { - return &OperationsClient{ - internal: c.internal, - } -} - // NewSAPApplicationServerInstancesClient creates a new instance of SAPApplicationServerInstancesClient. func (c *ClientFactory) NewSAPApplicationServerInstancesClient() *SAPApplicationServerInstancesClient { return &SAPApplicationServerInstancesClient{ @@ -51,9 +40,9 @@ func (c *ClientFactory) NewSAPApplicationServerInstancesClient() *SAPApplication } } -// NewSAPCentralInstancesClient creates a new instance of SAPCentralInstancesClient. -func (c *ClientFactory) NewSAPCentralInstancesClient() *SAPCentralInstancesClient { - return &SAPCentralInstancesClient{ +// NewSAPCentralServerInstancesClient creates a new instance of SAPCentralServerInstancesClient. +func (c *ClientFactory) NewSAPCentralServerInstancesClient() *SAPCentralServerInstancesClient { + return &SAPCentralServerInstancesClient{ subscriptionID: c.subscriptionID, internal: c.internal, } @@ -74,11 +63,3 @@ func (c *ClientFactory) NewSAPVirtualInstancesClient() *SAPVirtualInstancesClien internal: c.internal, } } - -// NewWorkloadsClient creates a new instance of WorkloadsClient. -func (c *ClientFactory) NewWorkloadsClient() *WorkloadsClient { - return &WorkloadsClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/constants.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/constants.go index 8e5f27f91544..a023be37502b 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/constants.go +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/constants.go @@ -1,38 +1,23 @@ -//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 armworkloadssapvirtualinstance const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance" - moduleVersion = "v0.1.0" -) - -// ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. -type ActionType string - -const ( - ActionTypeInternal ActionType = "Internal" + moduleVersion = "v1.0.0" ) -// PossibleActionTypeValues returns the possible values for the ActionType const type. -func PossibleActionTypeValues() []ActionType { - return []ActionType{ - ActionTypeInternal, - } -} - // ApplicationServerVirtualMachineType - Defines the type of application server VM. type ApplicationServerVirtualMachineType string const ( - ApplicationServerVirtualMachineTypeActive ApplicationServerVirtualMachineType = "Active" + // ApplicationServerVirtualMachineTypeActive - Active Application server vm type. + ApplicationServerVirtualMachineTypeActive ApplicationServerVirtualMachineType = "Active" + // ApplicationServerVirtualMachineTypeStandby - Standby Application server vm type. ApplicationServerVirtualMachineTypeStandby ApplicationServerVirtualMachineType = "Standby" + // ApplicationServerVirtualMachineTypeUnknown - Unknown Application server vm type. ApplicationServerVirtualMachineTypeUnknown ApplicationServerVirtualMachineType = "Unknown" ) @@ -49,13 +34,20 @@ func PossibleApplicationServerVirtualMachineTypeValues() []ApplicationServerVirt type CentralServerVirtualMachineType string const ( - CentralServerVirtualMachineTypeASCS CentralServerVirtualMachineType = "ASCS" - CentralServerVirtualMachineTypeERS CentralServerVirtualMachineType = "ERS" + // CentralServerVirtualMachineTypeASCS - ASCS Central server vm type. + CentralServerVirtualMachineTypeASCS CentralServerVirtualMachineType = "ASCS" + // CentralServerVirtualMachineTypeERS - ERS Central server vm type. + CentralServerVirtualMachineTypeERS CentralServerVirtualMachineType = "ERS" + // CentralServerVirtualMachineTypeERSInactive - ERSInactive Central server vm type. CentralServerVirtualMachineTypeERSInactive CentralServerVirtualMachineType = "ERSInactive" - CentralServerVirtualMachineTypePrimary CentralServerVirtualMachineType = "Primary" - CentralServerVirtualMachineTypeSecondary CentralServerVirtualMachineType = "Secondary" - CentralServerVirtualMachineTypeStandby CentralServerVirtualMachineType = "Standby" - CentralServerVirtualMachineTypeUnknown CentralServerVirtualMachineType = "Unknown" + // CentralServerVirtualMachineTypePrimary - Primary central server vm. + CentralServerVirtualMachineTypePrimary CentralServerVirtualMachineType = "Primary" + // CentralServerVirtualMachineTypeSecondary - Secondary central server vm. + CentralServerVirtualMachineTypeSecondary CentralServerVirtualMachineType = "Secondary" + // CentralServerVirtualMachineTypeStandby - Standby Central server vm type. + CentralServerVirtualMachineTypeStandby CentralServerVirtualMachineType = "Standby" + // CentralServerVirtualMachineTypeUnknown - Central server vm type unknown. + CentralServerVirtualMachineTypeUnknown CentralServerVirtualMachineType = "Unknown" ) // PossibleCentralServerVirtualMachineTypeValues returns the possible values for the CentralServerVirtualMachineType const type. @@ -71,32 +63,18 @@ func PossibleCentralServerVirtualMachineTypeValues() []CentralServerVirtualMachi } } -// ConfigurationType - The type of file share config. -type ConfigurationType string - -const ( - ConfigurationTypeCreateAndMount ConfigurationType = "CreateAndMount" - ConfigurationTypeMount ConfigurationType = "Mount" - ConfigurationTypeSkip ConfigurationType = "Skip" -) - -// PossibleConfigurationTypeValues returns the possible values for the ConfigurationType const type. -func PossibleConfigurationTypeValues() []ConfigurationType { - return []ConfigurationType{ - ConfigurationTypeCreateAndMount, - ConfigurationTypeMount, - ConfigurationTypeSkip, - } -} - -// 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. @@ -113,13 +91,20 @@ func PossibleCreatedByTypeValues() []CreatedByType { type DiskSKUName string const ( - DiskSKUNamePremiumLRS DiskSKUName = "Premium_LRS" - DiskSKUNamePremiumV2LRS DiskSKUName = "PremiumV2_LRS" - DiskSKUNamePremiumZRS DiskSKUName = "Premium_ZRS" - DiskSKUNameStandardLRS DiskSKUName = "Standard_LRS" + // DiskSKUNamePremiumLRS - Premium_LRS Disk SKU. + DiskSKUNamePremiumLRS DiskSKUName = "Premium_LRS" + // DiskSKUNamePremiumV2LRS - PremiumV2_LRS Disk SKU. + DiskSKUNamePremiumV2LRS DiskSKUName = "PremiumV2_LRS" + // DiskSKUNamePremiumZRS - Premium_ZRS Disk SKU. + DiskSKUNamePremiumZRS DiskSKUName = "Premium_ZRS" + // DiskSKUNameStandardLRS - Standard LRS Disk SKU. + DiskSKUNameStandardLRS DiskSKUName = "Standard_LRS" + // DiskSKUNameStandardSSDLRS - StandardSSD_LRS Disk SKU. DiskSKUNameStandardSSDLRS DiskSKUName = "StandardSSD_LRS" + // DiskSKUNameStandardSSDZRS - StandardSSD_ZRS Disk SKU. DiskSKUNameStandardSSDZRS DiskSKUName = "StandardSSD_ZRS" - DiskSKUNameUltraSSDLRS DiskSKUName = "UltraSSD_LRS" + // DiskSKUNameUltraSSDLRS - UltraSSD_LRS Disk SKU. + DiskSKUNameUltraSSDLRS DiskSKUName = "UltraSSD_LRS" ) // PossibleDiskSKUNameValues returns the possible values for the DiskSKUName const type. @@ -139,7 +124,9 @@ func PossibleDiskSKUNameValues() []DiskSKUName { type EnqueueReplicationServerType string const ( + // EnqueueReplicationServerTypeEnqueueReplicator1 - Enqueue Replication server type 1. EnqueueReplicationServerTypeEnqueueReplicator1 EnqueueReplicationServerType = "EnqueueReplicator1" + // EnqueueReplicationServerTypeEnqueueReplicator2 - Enqueue Replication server type 2. EnqueueReplicationServerTypeEnqueueReplicator2 EnqueueReplicationServerType = "EnqueueReplicator2" ) @@ -151,12 +138,35 @@ func PossibleEnqueueReplicationServerTypeValues() []EnqueueReplicationServerType } } +// FileShareConfigurationType - The type of file share config. +type FileShareConfigurationType string + +const ( + // FileShareConfigurationTypeCreateAndMount - Fileshare will be created and mounted by service. + FileShareConfigurationTypeCreateAndMount FileShareConfigurationType = "CreateAndMount" + // FileShareConfigurationTypeMount - Existing fileshare provided will be mounted by service. + FileShareConfigurationTypeMount FileShareConfigurationType = "Mount" + // FileShareConfigurationTypeSkip - Skip creating the file share. + FileShareConfigurationTypeSkip FileShareConfigurationType = "Skip" +) + +// PossibleFileShareConfigurationTypeValues returns the possible values for the FileShareConfigurationType const type. +func PossibleFileShareConfigurationTypeValues() []FileShareConfigurationType { + return []FileShareConfigurationType{ + FileShareConfigurationTypeCreateAndMount, + FileShareConfigurationTypeMount, + FileShareConfigurationTypeSkip, + } +} + // ManagedResourcesNetworkAccessType - Defines the network access type for managed resources. type ManagedResourcesNetworkAccessType string const ( + // ManagedResourcesNetworkAccessTypePrivate - Managed resources will be deployed with public network access disabled. ManagedResourcesNetworkAccessTypePrivate ManagedResourcesNetworkAccessType = "Private" - ManagedResourcesNetworkAccessTypePublic ManagedResourcesNetworkAccessType = "Public" + // ManagedResourcesNetworkAccessTypePublic - Managed resources will be deployed with public network access enabled. + ManagedResourcesNetworkAccessTypePublic ManagedResourcesNetworkAccessType = "Public" ) // PossibleManagedResourcesNetworkAccessTypeValues returns the possible values for the ManagedResourcesNetworkAccessType const type. @@ -167,26 +177,11 @@ func PossibleManagedResourcesNetworkAccessTypeValues() []ManagedResourcesNetwork } } -// ManagedServiceIdentityType - Type of managed service identity (only None, UserAssigned types are allowed). -type ManagedServiceIdentityType string - -const ( - ManagedServiceIdentityTypeNone ManagedServiceIdentityType = "None" - ManagedServiceIdentityTypeUserAssigned ManagedServiceIdentityType = "UserAssigned" -) - -// PossibleManagedServiceIdentityTypeValues returns the possible values for the ManagedServiceIdentityType const type. -func PossibleManagedServiceIdentityTypeValues() []ManagedServiceIdentityType { - return []ManagedServiceIdentityType{ - ManagedServiceIdentityTypeNone, - ManagedServiceIdentityTypeUserAssigned, - } -} - // NamingPatternType - The pattern type to be used for resource naming. type NamingPatternType string const ( + // NamingPatternTypeFullResourceName - Full resource names that will be created by service. NamingPatternTypeFullResourceName NamingPatternType = "FullResourceName" ) @@ -201,7 +196,9 @@ func PossibleNamingPatternTypeValues() []NamingPatternType { type OSType string const ( - OSTypeLinux OSType = "Linux" + // OSTypeLinux - Linux OS Type. + OSTypeLinux OSType = "Linux" + // OSTypeWindows - Windows OS Type. OSTypeWindows OSType = "Windows" ) @@ -213,32 +210,16 @@ func PossibleOSTypeValues() []OSType { } } -// Origin - The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default -// value is "user,system" -type Origin string - -const ( - OriginSystem Origin = "system" - OriginUser Origin = "user" - OriginUserSystem Origin = "user,system" -) - -// PossibleOriginValues returns the possible values for the Origin const type. -func PossibleOriginValues() []Origin { - return []Origin{ - OriginSystem, - OriginUser, - OriginUserSystem, - } -} - // SAPConfigurationType - The configuration Type. type SAPConfigurationType string const ( - SAPConfigurationTypeDeployment SAPConfigurationType = "Deployment" + // SAPConfigurationTypeDeployment - SAP system will be deployed by service. No OS configurations will be done. + SAPConfigurationTypeDeployment SAPConfigurationType = "Deployment" + // SAPConfigurationTypeDeploymentWithOSConfig - SAP system will be deployed by service. OS configurations will be done. SAPConfigurationTypeDeploymentWithOSConfig SAPConfigurationType = "DeploymentWithOSConfig" - SAPConfigurationTypeDiscovery SAPConfigurationType = "Discovery" + // SAPConfigurationTypeDiscovery - Existing SAP system will be registered. + SAPConfigurationTypeDiscovery SAPConfigurationType = "Discovery" ) // PossibleSAPConfigurationTypeValues returns the possible values for the SAPConfigurationType const type. @@ -254,6 +235,7 @@ func PossibleSAPConfigurationTypeValues() []SAPConfigurationType { type SAPDatabaseScaleMethod string const ( + // SAPDatabaseScaleMethodScaleUp - ScaleUp Hana Database deployment type SAPDatabaseScaleMethodScaleUp SAPDatabaseScaleMethod = "ScaleUp" ) @@ -268,7 +250,9 @@ func PossibleSAPDatabaseScaleMethodValues() []SAPDatabaseScaleMethod { type SAPDatabaseType string const ( - SAPDatabaseTypeDB2 SAPDatabaseType = "DB2" + // SAPDatabaseTypeDB2 - DB2 database type of the SAP system. + SAPDatabaseTypeDB2 SAPDatabaseType = "DB2" + // SAPDatabaseTypeHANA - HANA Database type of SAP system. SAPDatabaseTypeHANA SAPDatabaseType = "HANA" ) @@ -284,8 +268,10 @@ func PossibleSAPDatabaseTypeValues() []SAPDatabaseType { type SAPDeploymentType string const ( + // SAPDeploymentTypeSingleServer - SAP Single server deployment type. SAPDeploymentTypeSingleServer SAPDeploymentType = "SingleServer" - SAPDeploymentTypeThreeTier SAPDeploymentType = "ThreeTier" + // SAPDeploymentTypeThreeTier - SAP Distributed deployment type. + SAPDeploymentTypeThreeTier SAPDeploymentType = "ThreeTier" ) // PossibleSAPDeploymentTypeValues returns the possible values for the SAPDeploymentType const type. @@ -300,8 +286,10 @@ func PossibleSAPDeploymentTypeValues() []SAPDeploymentType { type SAPEnvironmentType string const ( + // SAPEnvironmentTypeNonProd - Non Production SAP system. SAPEnvironmentTypeNonProd SAPEnvironmentType = "NonProd" - SAPEnvironmentTypeProd SAPEnvironmentType = "Prod" + // SAPEnvironmentTypeProd - Production SAP system. + SAPEnvironmentTypeProd SAPEnvironmentType = "Prod" ) // PossibleSAPEnvironmentTypeValues returns the possible values for the SAPEnvironmentType const type. @@ -316,10 +304,14 @@ func PossibleSAPEnvironmentTypeValues() []SAPEnvironmentType { type SAPHealthState string const ( - SAPHealthStateDegraded SAPHealthState = "Degraded" - SAPHealthStateHealthy SAPHealthState = "Healthy" + // SAPHealthStateDegraded - SAP System health is degraded. + SAPHealthStateDegraded SAPHealthState = "Degraded" + // SAPHealthStateHealthy - SAP System health is healthy. + SAPHealthStateHealthy SAPHealthState = "Healthy" + // SAPHealthStateUnhealthy - SAP System is unhealthy. SAPHealthStateUnhealthy SAPHealthState = "Unhealthy" - SAPHealthStateUnknown SAPHealthState = "Unknown" + // SAPHealthStateUnknown - SAP System health is unknown. + SAPHealthStateUnknown SAPHealthState = "Unknown" ) // PossibleSAPHealthStateValues returns the possible values for the SAPHealthState const type. @@ -336,7 +328,9 @@ func PossibleSAPHealthStateValues() []SAPHealthState { type SAPHighAvailabilityType string const ( - SAPHighAvailabilityTypeAvailabilitySet SAPHighAvailabilityType = "AvailabilitySet" + // SAPHighAvailabilityTypeAvailabilitySet - HA deployment with availability sets. + SAPHighAvailabilityTypeAvailabilitySet SAPHighAvailabilityType = "AvailabilitySet" + // SAPHighAvailabilityTypeAvailabilityZone - HA deployment with availability zones. SAPHighAvailabilityTypeAvailabilityZone SAPHighAvailabilityType = "AvailabilityZone" ) @@ -352,8 +346,11 @@ func PossibleSAPHighAvailabilityTypeValues() []SAPHighAvailabilityType { type SAPProductType string const ( - SAPProductTypeECC SAPProductType = "ECC" - SAPProductTypeOther SAPProductType = "Other" + // SAPProductTypeECC - SAP Product ECC. + SAPProductTypeECC SAPProductType = "ECC" + // SAPProductTypeOther - SAP Products other than the ones listed. + SAPProductTypeOther SAPProductType = "Other" + // SAPProductTypeS4HANA - SAP Product S4HANA. SAPProductTypeS4HANA SAPProductType = "S4HANA" ) @@ -370,9 +367,12 @@ func PossibleSAPProductTypeValues() []SAPProductType { type SAPSoftwareInstallationType string const ( - SAPSoftwareInstallationTypeExternal SAPSoftwareInstallationType = "External" + // SAPSoftwareInstallationTypeExternal - External software installation type. + SAPSoftwareInstallationTypeExternal SAPSoftwareInstallationType = "External" + // SAPSoftwareInstallationTypeSAPInstallWithoutOSConfig - SAP Install without OS Config. SAPSoftwareInstallationTypeSAPInstallWithoutOSConfig SAPSoftwareInstallationType = "SAPInstallWithoutOSConfig" - SAPSoftwareInstallationTypeServiceInitiated SAPSoftwareInstallationType = "ServiceInitiated" + // SAPSoftwareInstallationTypeServiceInitiated - SAP Install managed by service. + SAPSoftwareInstallationTypeServiceInitiated SAPSoftwareInstallationType = "ServiceInitiated" ) // PossibleSAPSoftwareInstallationTypeValues returns the possible values for the SAPSoftwareInstallationType const type. @@ -384,23 +384,55 @@ func PossibleSAPSoftwareInstallationTypeValues() []SAPSoftwareInstallationType { } } +// SAPVirtualInstanceIdentityType - Type of managed service identity (where only None and UserAssigned types are allowed). +type SAPVirtualInstanceIdentityType string + +const ( + // SAPVirtualInstanceIdentityTypeNone - No managed identity. + SAPVirtualInstanceIdentityTypeNone SAPVirtualInstanceIdentityType = "None" + // SAPVirtualInstanceIdentityTypeUserAssigned - User assigned managed identity. + SAPVirtualInstanceIdentityTypeUserAssigned SAPVirtualInstanceIdentityType = "UserAssigned" +) + +// PossibleSAPVirtualInstanceIdentityTypeValues returns the possible values for the SAPVirtualInstanceIdentityType const type. +func PossibleSAPVirtualInstanceIdentityTypeValues() []SAPVirtualInstanceIdentityType { + return []SAPVirtualInstanceIdentityType{ + SAPVirtualInstanceIdentityTypeNone, + SAPVirtualInstanceIdentityTypeUserAssigned, + } +} + // SAPVirtualInstanceState - Defines the Virtual Instance for SAP state. type SAPVirtualInstanceState string const ( - SAPVirtualInstanceStateACSSInstallationBlocked SAPVirtualInstanceState = "ACSSInstallationBlocked" - SAPVirtualInstanceStateDiscoveryFailed SAPVirtualInstanceState = "DiscoveryFailed" - SAPVirtualInstanceStateDiscoveryInProgress SAPVirtualInstanceState = "DiscoveryInProgress" - SAPVirtualInstanceStateDiscoveryPending SAPVirtualInstanceState = "DiscoveryPending" - SAPVirtualInstanceStateInfrastructureDeploymentFailed SAPVirtualInstanceState = "InfrastructureDeploymentFailed" + // SAPVirtualInstanceStateACSSInstallationBlocked - ACSS installation cannot proceed. + SAPVirtualInstanceStateACSSInstallationBlocked SAPVirtualInstanceState = "ACSSInstallationBlocked" + // SAPVirtualInstanceStateDiscoveryFailed - Registration has failed. + SAPVirtualInstanceStateDiscoveryFailed SAPVirtualInstanceState = "DiscoveryFailed" + // SAPVirtualInstanceStateDiscoveryInProgress - Registration is in progress. + SAPVirtualInstanceStateDiscoveryInProgress SAPVirtualInstanceState = "DiscoveryInProgress" + // SAPVirtualInstanceStateDiscoveryPending - Registration has not started. + SAPVirtualInstanceStateDiscoveryPending SAPVirtualInstanceState = "DiscoveryPending" + // SAPVirtualInstanceStateInfrastructureDeploymentFailed - Infrastructure deployment has failed. + SAPVirtualInstanceStateInfrastructureDeploymentFailed SAPVirtualInstanceState = "InfrastructureDeploymentFailed" + // SAPVirtualInstanceStateInfrastructureDeploymentInProgress - Infrastructure deployment is in progress. SAPVirtualInstanceStateInfrastructureDeploymentInProgress SAPVirtualInstanceState = "InfrastructureDeploymentInProgress" - SAPVirtualInstanceStateInfrastructureDeploymentPending SAPVirtualInstanceState = "InfrastructureDeploymentPending" - SAPVirtualInstanceStateRegistrationComplete SAPVirtualInstanceState = "RegistrationComplete" - SAPVirtualInstanceStateSoftwareDetectionFailed SAPVirtualInstanceState = "SoftwareDetectionFailed" - SAPVirtualInstanceStateSoftwareDetectionInProgress SAPVirtualInstanceState = "SoftwareDetectionInProgress" - SAPVirtualInstanceStateSoftwareInstallationFailed SAPVirtualInstanceState = "SoftwareInstallationFailed" - SAPVirtualInstanceStateSoftwareInstallationInProgress SAPVirtualInstanceState = "SoftwareInstallationInProgress" - SAPVirtualInstanceStateSoftwareInstallationPending SAPVirtualInstanceState = "SoftwareInstallationPending" + // SAPVirtualInstanceStateInfrastructureDeploymentPending - Infrastructure is not yet deployed. + SAPVirtualInstanceStateInfrastructureDeploymentPending SAPVirtualInstanceState = "InfrastructureDeploymentPending" + // SAPVirtualInstanceStateRegistrationComplete - Registration is complete. + SAPVirtualInstanceStateRegistrationComplete SAPVirtualInstanceState = "RegistrationComplete" + // SAPVirtualInstanceStateSoftwareDetectionFailed - Software detection failed. + SAPVirtualInstanceStateSoftwareDetectionFailed SAPVirtualInstanceState = "SoftwareDetectionFailed" + // SAPVirtualInstanceStateSoftwareDetectionInProgress - Software detection is in progress. + SAPVirtualInstanceStateSoftwareDetectionInProgress SAPVirtualInstanceState = "SoftwareDetectionInProgress" + // SAPVirtualInstanceStateSoftwareInstallationFailed - Software installation failed. + SAPVirtualInstanceStateSoftwareInstallationFailed SAPVirtualInstanceState = "SoftwareInstallationFailed" + // SAPVirtualInstanceStateSoftwareInstallationInProgress - Software installation is in progress. + SAPVirtualInstanceStateSoftwareInstallationInProgress SAPVirtualInstanceState = "SoftwareInstallationInProgress" + // SAPVirtualInstanceStateSoftwareInstallationPending - Infrastructure deployment is successful. Software installation is + // pending. + SAPVirtualInstanceStateSoftwareInstallationPending SAPVirtualInstanceState = "SoftwareInstallationPending" ) // PossibleSAPVirtualInstanceStateValues returns the possible values for the SAPVirtualInstanceState const type. @@ -426,13 +458,20 @@ func PossibleSAPVirtualInstanceStateValues() []SAPVirtualInstanceState { type SAPVirtualInstanceStatus string const ( - SAPVirtualInstanceStatusOffline SAPVirtualInstanceStatus = "Offline" + // SAPVirtualInstanceStatusOffline - SAP system is offline. + SAPVirtualInstanceStatusOffline SAPVirtualInstanceStatus = "Offline" + // SAPVirtualInstanceStatusPartiallyRunning - SAP system is partially running. SAPVirtualInstanceStatusPartiallyRunning SAPVirtualInstanceStatus = "PartiallyRunning" - SAPVirtualInstanceStatusRunning SAPVirtualInstanceStatus = "Running" - SAPVirtualInstanceStatusSoftShutdown SAPVirtualInstanceStatus = "SoftShutdown" - SAPVirtualInstanceStatusStarting SAPVirtualInstanceStatus = "Starting" - SAPVirtualInstanceStatusStopping SAPVirtualInstanceStatus = "Stopping" - SAPVirtualInstanceStatusUnavailable SAPVirtualInstanceStatus = "Unavailable" + // SAPVirtualInstanceStatusRunning - SAP system is running. + SAPVirtualInstanceStatusRunning SAPVirtualInstanceStatus = "Running" + // SAPVirtualInstanceStatusSoftShutdown - Soft shutdown of SAP system is initiated. + SAPVirtualInstanceStatusSoftShutdown SAPVirtualInstanceStatus = "SoftShutdown" + // SAPVirtualInstanceStatusStarting - SAP system is getting started. + SAPVirtualInstanceStatusStarting SAPVirtualInstanceStatus = "Starting" + // SAPVirtualInstanceStatusStopping - SAP system is being stopped. + SAPVirtualInstanceStatusStopping SAPVirtualInstanceStatus = "Stopping" + // SAPVirtualInstanceStatusUnavailable - SAP system status is unavailable. + SAPVirtualInstanceStatusUnavailable SAPVirtualInstanceStatus = "Unavailable" ) // PossibleSAPVirtualInstanceStatusValues returns the possible values for the SAPVirtualInstanceStatus const type. @@ -452,12 +491,18 @@ func PossibleSAPVirtualInstanceStatusValues() []SAPVirtualInstanceStatus { type SapVirtualInstanceProvisioningState string const ( - SapVirtualInstanceProvisioningStateCanceled SapVirtualInstanceProvisioningState = "Canceled" - SapVirtualInstanceProvisioningStateCreating SapVirtualInstanceProvisioningState = "Creating" - SapVirtualInstanceProvisioningStateDeleting SapVirtualInstanceProvisioningState = "Deleting" - SapVirtualInstanceProvisioningStateFailed SapVirtualInstanceProvisioningState = "Failed" + // SapVirtualInstanceProvisioningStateCanceled - ACSS Canceled provisioning state. + SapVirtualInstanceProvisioningStateCanceled SapVirtualInstanceProvisioningState = "Canceled" + // SapVirtualInstanceProvisioningStateCreating - ACSS Creating provisioning state. + SapVirtualInstanceProvisioningStateCreating SapVirtualInstanceProvisioningState = "Creating" + // SapVirtualInstanceProvisioningStateDeleting - ACSS Deleting provisioning state. + SapVirtualInstanceProvisioningStateDeleting SapVirtualInstanceProvisioningState = "Deleting" + // SapVirtualInstanceProvisioningStateFailed - ACSS Failed provisioning state. + SapVirtualInstanceProvisioningStateFailed SapVirtualInstanceProvisioningState = "Failed" + // SapVirtualInstanceProvisioningStateSucceeded - ACSS succeeded provisioning state. SapVirtualInstanceProvisioningStateSucceeded SapVirtualInstanceProvisioningState = "Succeeded" - SapVirtualInstanceProvisioningStateUpdating SapVirtualInstanceProvisioningState = "Updating" + // SapVirtualInstanceProvisioningStateUpdating - ACSS updating provisioning state. + SapVirtualInstanceProvisioningStateUpdating SapVirtualInstanceProvisioningState = "Updating" ) // PossibleSapVirtualInstanceProvisioningStateValues returns the possible values for the SapVirtualInstanceProvisioningState const type. diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/internal.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/internal.go index 5f75802a569e..7425b6a669e2 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/internal.go +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/internal.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -14,6 +10,11 @@ import ( "sync" ) +type result struct { + resp *http.Response + err error +} + type nonRetriableError struct { error } diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/sapapplicationserverinstances_server.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/sapapplicationserverinstances_server.go index fde564c462de..7613fd80fbcb 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/sapapplicationserverinstances_server.go +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/sapapplicationserverinstances_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 @@ -27,10 +23,10 @@ import ( type SAPApplicationServerInstancesServer struct { // BeginCreate is the fake for method SAPApplicationServerInstancesClient.BeginCreate // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreate func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, body armworkloadssapvirtualinstance.SAPApplicationServerInstance, options *armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientBeginCreateOptions) (resp azfake.PollerResponder[armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientCreateResponse], errResp azfake.ErrorResponder) + BeginCreate func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, resource armworkloadssapvirtualinstance.SAPApplicationServerInstance, options *armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientBeginCreateOptions) (resp azfake.PollerResponder[armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientCreateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method SAPApplicationServerInstancesClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, options *armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientBeginDeleteOptions) (resp azfake.PollerResponder[armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method SAPApplicationServerInstancesClient.Get @@ -41,17 +37,17 @@ type SAPApplicationServerInstancesServer struct { // HTTP status codes to indicate success: http.StatusOK NewListPager func(resourceGroupName string, sapVirtualInstanceName string, options *armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientListOptions) (resp azfake.PagerResponder[armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientListResponse]) - // BeginStartInstance is the fake for method SAPApplicationServerInstancesClient.BeginStartInstance + // BeginStart is the fake for method SAPApplicationServerInstancesClient.BeginStart // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginStartInstance func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, options *armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientBeginStartInstanceOptions) (resp azfake.PollerResponder[armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientStartInstanceResponse], errResp azfake.ErrorResponder) + BeginStart func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, options *armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientBeginStartOptions) (resp azfake.PollerResponder[armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientStartResponse], errResp azfake.ErrorResponder) - // BeginStopInstance is the fake for method SAPApplicationServerInstancesClient.BeginStopInstance + // BeginStop is the fake for method SAPApplicationServerInstancesClient.BeginStop // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginStopInstance func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, options *armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientBeginStopInstanceOptions) (resp azfake.PollerResponder[armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientStopInstanceResponse], errResp azfake.ErrorResponder) + BeginStop func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, options *armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientBeginStopOptions) (resp azfake.PollerResponder[armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientStopResponse], errResp azfake.ErrorResponder) // Update is the fake for method SAPApplicationServerInstancesClient.Update // HTTP status codes to indicate success: http.StatusOK - Update func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, body armworkloadssapvirtualinstance.UpdateSAPApplicationInstanceRequest, options *armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientUpdateOptions) (resp azfake.Responder[armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientUpdateResponse], errResp azfake.ErrorResponder) + Update func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, properties armworkloadssapvirtualinstance.UpdateSAPApplicationInstanceRequest, options *armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientUpdateOptions) (resp azfake.Responder[armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientUpdateResponse], errResp azfake.ErrorResponder) } // NewSAPApplicationServerInstancesServerTransport creates a new instance of SAPApplicationServerInstancesServerTransport with the provided implementation. @@ -59,24 +55,24 @@ type SAPApplicationServerInstancesServer struct { // azcore.ClientOptions.Transporter field in the client's constructor parameters. func NewSAPApplicationServerInstancesServerTransport(srv *SAPApplicationServerInstancesServer) *SAPApplicationServerInstancesServerTransport { return &SAPApplicationServerInstancesServerTransport{ - srv: srv, - beginCreate: newTracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientCreateResponse]](), - beginDelete: newTracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientDeleteResponse]](), - newListPager: newTracker[azfake.PagerResponder[armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientListResponse]](), - beginStartInstance: newTracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientStartInstanceResponse]](), - beginStopInstance: newTracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientStopInstanceResponse]](), + srv: srv, + beginCreate: newTracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientCreateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientListResponse]](), + beginStart: newTracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientStartResponse]](), + beginStop: newTracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientStopResponse]](), } } // SAPApplicationServerInstancesServerTransport connects instances of armworkloadssapvirtualinstance.SAPApplicationServerInstancesClient to instances of SAPApplicationServerInstancesServer. // Don't use this type directly, use NewSAPApplicationServerInstancesServerTransport instead. type SAPApplicationServerInstancesServerTransport struct { - srv *SAPApplicationServerInstancesServer - beginCreate *tracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientCreateResponse]] - beginDelete *tracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientDeleteResponse]] - newListPager *tracker[azfake.PagerResponder[armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientListResponse]] - beginStartInstance *tracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientStartInstanceResponse]] - beginStopInstance *tracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientStopInstanceResponse]] + srv *SAPApplicationServerInstancesServer + beginCreate *tracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientCreateResponse]] + beginDelete *tracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientListResponse]] + beginStart *tracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientStartResponse]] + beginStop *tracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientStopResponse]] } // Do implements the policy.Transporter interface for SAPApplicationServerInstancesServerTransport. @@ -87,33 +83,52 @@ func (s *SAPApplicationServerInstancesServerTransport) Do(req *http.Request) (*h return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error - - switch method { - case "SAPApplicationServerInstancesClient.BeginCreate": - resp, err = s.dispatchBeginCreate(req) - case "SAPApplicationServerInstancesClient.BeginDelete": - resp, err = s.dispatchBeginDelete(req) - case "SAPApplicationServerInstancesClient.Get": - resp, err = s.dispatchGet(req) - case "SAPApplicationServerInstancesClient.NewListPager": - resp, err = s.dispatchNewListPager(req) - case "SAPApplicationServerInstancesClient.BeginStartInstance": - resp, err = s.dispatchBeginStartInstance(req) - case "SAPApplicationServerInstancesClient.BeginStopInstance": - resp, err = s.dispatchBeginStopInstance(req) - case "SAPApplicationServerInstancesClient.Update": - resp, err = s.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + return s.dispatchToMethodFake(req, method) +} - if err != nil { - return nil, err - } +func (s *SAPApplicationServerInstancesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - return resp, nil + go func() { + var intercepted bool + var res result + if sapApplicationServerInstancesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = sapApplicationServerInstancesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "SAPApplicationServerInstancesClient.BeginCreate": + res.resp, res.err = s.dispatchBeginCreate(req) + case "SAPApplicationServerInstancesClient.BeginDelete": + res.resp, res.err = s.dispatchBeginDelete(req) + case "SAPApplicationServerInstancesClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "SAPApplicationServerInstancesClient.NewListPager": + res.resp, res.err = s.dispatchNewListPager(req) + case "SAPApplicationServerInstancesClient.BeginStart": + res.resp, res.err = s.dispatchBeginStart(req) + case "SAPApplicationServerInstancesClient.BeginStop": + res.resp, res.err = s.dispatchBeginStop(req) + case "SAPApplicationServerInstancesClient.Update": + res.resp, res.err = s.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (s *SAPApplicationServerInstancesServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { @@ -205,9 +220,9 @@ func (s *SAPApplicationServerInstancesServerTransport) dispatchBeginDelete(req * return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { s.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { s.beginDelete.remove(req) @@ -294,12 +309,12 @@ func (s *SAPApplicationServerInstancesServerTransport) dispatchNewListPager(req return resp, nil } -func (s *SAPApplicationServerInstancesServerTransport) dispatchBeginStartInstance(req *http.Request) (*http.Response, error) { - if s.srv.BeginStartInstance == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginStartInstance not implemented")} +func (s *SAPApplicationServerInstancesServerTransport) dispatchBeginStart(req *http.Request) (*http.Response, error) { + if s.srv.BeginStart == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginStart not implemented")} } - beginStartInstance := s.beginStartInstance.get(req) - if beginStartInstance == nil { + beginStart := s.beginStart.get(req) + if beginStart == nil { const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Workloads/sapVirtualInstances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/applicationInstances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/start` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) @@ -322,42 +337,42 @@ func (s *SAPApplicationServerInstancesServerTransport) dispatchBeginStartInstanc if err != nil { return nil, err } - var options *armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientBeginStartInstanceOptions + var options *armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientBeginStartOptions if !reflect.ValueOf(body).IsZero() { - options = &armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientBeginStartInstanceOptions{ + options = &armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientBeginStartOptions{ Body: &body, } } - respr, errRespr := s.srv.BeginStartInstance(req.Context(), resourceGroupNameParam, sapVirtualInstanceNameParam, applicationInstanceNameParam, options) + respr, errRespr := s.srv.BeginStart(req.Context(), resourceGroupNameParam, sapVirtualInstanceNameParam, applicationInstanceNameParam, options) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } - beginStartInstance = &respr - s.beginStartInstance.add(req, beginStartInstance) + beginStart = &respr + s.beginStart.add(req, beginStart) } - resp, err := server.PollerResponderNext(beginStartInstance, req) + resp, err := server.PollerResponderNext(beginStart, req) if err != nil { return nil, err } if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { - s.beginStartInstance.remove(req) + s.beginStart.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} } - if !server.PollerResponderMore(beginStartInstance) { - s.beginStartInstance.remove(req) + if !server.PollerResponderMore(beginStart) { + s.beginStart.remove(req) } return resp, nil } -func (s *SAPApplicationServerInstancesServerTransport) dispatchBeginStopInstance(req *http.Request) (*http.Response, error) { - if s.srv.BeginStopInstance == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginStopInstance not implemented")} +func (s *SAPApplicationServerInstancesServerTransport) dispatchBeginStop(req *http.Request) (*http.Response, error) { + if s.srv.BeginStop == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginStop not implemented")} } - beginStopInstance := s.beginStopInstance.get(req) - if beginStopInstance == nil { + beginStop := s.beginStop.get(req) + if beginStop == nil { const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Workloads/sapVirtualInstances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/applicationInstances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/stop` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) @@ -380,31 +395,31 @@ func (s *SAPApplicationServerInstancesServerTransport) dispatchBeginStopInstance if err != nil { return nil, err } - var options *armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientBeginStopInstanceOptions + var options *armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientBeginStopOptions if !reflect.ValueOf(body).IsZero() { - options = &armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientBeginStopInstanceOptions{ + options = &armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientBeginStopOptions{ Body: &body, } } - respr, errRespr := s.srv.BeginStopInstance(req.Context(), resourceGroupNameParam, sapVirtualInstanceNameParam, applicationInstanceNameParam, options) + respr, errRespr := s.srv.BeginStop(req.Context(), resourceGroupNameParam, sapVirtualInstanceNameParam, applicationInstanceNameParam, options) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } - beginStopInstance = &respr - s.beginStopInstance.add(req, beginStopInstance) + beginStop = &respr + s.beginStop.add(req, beginStop) } - resp, err := server.PollerResponderNext(beginStopInstance, req) + resp, err := server.PollerResponderNext(beginStop, req) if err != nil { return nil, err } if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { - s.beginStopInstance.remove(req) + s.beginStop.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} } - if !server.PollerResponderMore(beginStopInstance) { - s.beginStopInstance.remove(req) + if !server.PollerResponderMore(beginStop) { + s.beginStop.remove(req) } return resp, nil @@ -450,3 +465,9 @@ func (s *SAPApplicationServerInstancesServerTransport) dispatchUpdate(req *http. } return resp, nil } + +// set this to conditionally intercept incoming requests to SAPApplicationServerInstancesServerTransport +var sapApplicationServerInstancesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/sapcentralinstances_server.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/sapcentralserverinstances_server.go similarity index 60% rename from sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/sapcentralinstances_server.go rename to sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/sapcentralserverinstances_server.go index b4c64a343374..292a935256be 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/sapcentralinstances_server.go +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/sapcentralserverinstances_server.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -23,100 +19,119 @@ import ( "regexp" ) -// SAPCentralInstancesServer is a fake server for instances of the armworkloadssapvirtualinstance.SAPCentralInstancesClient type. -type SAPCentralInstancesServer struct { - // BeginCreate is the fake for method SAPCentralInstancesClient.BeginCreate +// SAPCentralServerInstancesServer is a fake server for instances of the armworkloadssapvirtualinstance.SAPCentralServerInstancesClient type. +type SAPCentralServerInstancesServer struct { + // BeginCreate is the fake for method SAPCentralServerInstancesClient.BeginCreate // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreate func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, body armworkloadssapvirtualinstance.SAPCentralServerInstance, options *armworkloadssapvirtualinstance.SAPCentralInstancesClientBeginCreateOptions) (resp azfake.PollerResponder[armworkloadssapvirtualinstance.SAPCentralInstancesClientCreateResponse], errResp azfake.ErrorResponder) + BeginCreate func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, resource armworkloadssapvirtualinstance.SAPCentralServerInstance, options *armworkloadssapvirtualinstance.SAPCentralServerInstancesClientBeginCreateOptions) (resp azfake.PollerResponder[armworkloadssapvirtualinstance.SAPCentralServerInstancesClientCreateResponse], errResp azfake.ErrorResponder) - // BeginDelete is the fake for method SAPCentralInstancesClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent - BeginDelete func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, options *armworkloadssapvirtualinstance.SAPCentralInstancesClientBeginDeleteOptions) (resp azfake.PollerResponder[armworkloadssapvirtualinstance.SAPCentralInstancesClientDeleteResponse], errResp azfake.ErrorResponder) + // BeginDelete is the fake for method SAPCentralServerInstancesClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, options *armworkloadssapvirtualinstance.SAPCentralServerInstancesClientBeginDeleteOptions) (resp azfake.PollerResponder[armworkloadssapvirtualinstance.SAPCentralServerInstancesClientDeleteResponse], errResp azfake.ErrorResponder) - // Get is the fake for method SAPCentralInstancesClient.Get + // Get is the fake for method SAPCentralServerInstancesClient.Get // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, options *armworkloadssapvirtualinstance.SAPCentralInstancesClientGetOptions) (resp azfake.Responder[armworkloadssapvirtualinstance.SAPCentralInstancesClientGetResponse], errResp azfake.ErrorResponder) + Get func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, options *armworkloadssapvirtualinstance.SAPCentralServerInstancesClientGetOptions) (resp azfake.Responder[armworkloadssapvirtualinstance.SAPCentralServerInstancesClientGetResponse], errResp azfake.ErrorResponder) - // NewListPager is the fake for method SAPCentralInstancesClient.NewListPager + // NewListPager is the fake for method SAPCentralServerInstancesClient.NewListPager // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceGroupName string, sapVirtualInstanceName string, options *armworkloadssapvirtualinstance.SAPCentralInstancesClientListOptions) (resp azfake.PagerResponder[armworkloadssapvirtualinstance.SAPCentralInstancesClientListResponse]) + NewListPager func(resourceGroupName string, sapVirtualInstanceName string, options *armworkloadssapvirtualinstance.SAPCentralServerInstancesClientListOptions) (resp azfake.PagerResponder[armworkloadssapvirtualinstance.SAPCentralServerInstancesClientListResponse]) - // BeginStartInstance is the fake for method SAPCentralInstancesClient.BeginStartInstance + // BeginStart is the fake for method SAPCentralServerInstancesClient.BeginStart // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginStartInstance func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, options *armworkloadssapvirtualinstance.SAPCentralInstancesClientBeginStartInstanceOptions) (resp azfake.PollerResponder[armworkloadssapvirtualinstance.SAPCentralInstancesClientStartInstanceResponse], errResp azfake.ErrorResponder) + BeginStart func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, options *armworkloadssapvirtualinstance.SAPCentralServerInstancesClientBeginStartOptions) (resp azfake.PollerResponder[armworkloadssapvirtualinstance.SAPCentralServerInstancesClientStartResponse], errResp azfake.ErrorResponder) - // BeginStopInstance is the fake for method SAPCentralInstancesClient.BeginStopInstance + // BeginStop is the fake for method SAPCentralServerInstancesClient.BeginStop // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginStopInstance func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, options *armworkloadssapvirtualinstance.SAPCentralInstancesClientBeginStopInstanceOptions) (resp azfake.PollerResponder[armworkloadssapvirtualinstance.SAPCentralInstancesClientStopInstanceResponse], errResp azfake.ErrorResponder) + BeginStop func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, options *armworkloadssapvirtualinstance.SAPCentralServerInstancesClientBeginStopOptions) (resp azfake.PollerResponder[armworkloadssapvirtualinstance.SAPCentralServerInstancesClientStopResponse], errResp azfake.ErrorResponder) - // Update is the fake for method SAPCentralInstancesClient.Update + // Update is the fake for method SAPCentralServerInstancesClient.Update // HTTP status codes to indicate success: http.StatusOK - Update func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, body armworkloadssapvirtualinstance.UpdateSAPCentralInstanceRequest, options *armworkloadssapvirtualinstance.SAPCentralInstancesClientUpdateOptions) (resp azfake.Responder[armworkloadssapvirtualinstance.SAPCentralInstancesClientUpdateResponse], errResp azfake.ErrorResponder) + Update func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, properties armworkloadssapvirtualinstance.UpdateSAPCentralInstanceRequest, options *armworkloadssapvirtualinstance.SAPCentralServerInstancesClientUpdateOptions) (resp azfake.Responder[armworkloadssapvirtualinstance.SAPCentralServerInstancesClientUpdateResponse], errResp azfake.ErrorResponder) } -// NewSAPCentralInstancesServerTransport creates a new instance of SAPCentralInstancesServerTransport with the provided implementation. -// The returned SAPCentralInstancesServerTransport instance is connected to an instance of armworkloadssapvirtualinstance.SAPCentralInstancesClient via the +// NewSAPCentralServerInstancesServerTransport creates a new instance of SAPCentralServerInstancesServerTransport with the provided implementation. +// The returned SAPCentralServerInstancesServerTransport instance is connected to an instance of armworkloadssapvirtualinstance.SAPCentralServerInstancesClient via the // azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewSAPCentralInstancesServerTransport(srv *SAPCentralInstancesServer) *SAPCentralInstancesServerTransport { - return &SAPCentralInstancesServerTransport{ - srv: srv, - beginCreate: newTracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPCentralInstancesClientCreateResponse]](), - beginDelete: newTracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPCentralInstancesClientDeleteResponse]](), - newListPager: newTracker[azfake.PagerResponder[armworkloadssapvirtualinstance.SAPCentralInstancesClientListResponse]](), - beginStartInstance: newTracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPCentralInstancesClientStartInstanceResponse]](), - beginStopInstance: newTracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPCentralInstancesClientStopInstanceResponse]](), +func NewSAPCentralServerInstancesServerTransport(srv *SAPCentralServerInstancesServer) *SAPCentralServerInstancesServerTransport { + return &SAPCentralServerInstancesServerTransport{ + srv: srv, + beginCreate: newTracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPCentralServerInstancesClientCreateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPCentralServerInstancesClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[armworkloadssapvirtualinstance.SAPCentralServerInstancesClientListResponse]](), + beginStart: newTracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPCentralServerInstancesClientStartResponse]](), + beginStop: newTracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPCentralServerInstancesClientStopResponse]](), } } -// SAPCentralInstancesServerTransport connects instances of armworkloadssapvirtualinstance.SAPCentralInstancesClient to instances of SAPCentralInstancesServer. -// Don't use this type directly, use NewSAPCentralInstancesServerTransport instead. -type SAPCentralInstancesServerTransport struct { - srv *SAPCentralInstancesServer - beginCreate *tracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPCentralInstancesClientCreateResponse]] - beginDelete *tracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPCentralInstancesClientDeleteResponse]] - newListPager *tracker[azfake.PagerResponder[armworkloadssapvirtualinstance.SAPCentralInstancesClientListResponse]] - beginStartInstance *tracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPCentralInstancesClientStartInstanceResponse]] - beginStopInstance *tracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPCentralInstancesClientStopInstanceResponse]] +// SAPCentralServerInstancesServerTransport connects instances of armworkloadssapvirtualinstance.SAPCentralServerInstancesClient to instances of SAPCentralServerInstancesServer. +// Don't use this type directly, use NewSAPCentralServerInstancesServerTransport instead. +type SAPCentralServerInstancesServerTransport struct { + srv *SAPCentralServerInstancesServer + beginCreate *tracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPCentralServerInstancesClientCreateResponse]] + beginDelete *tracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPCentralServerInstancesClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[armworkloadssapvirtualinstance.SAPCentralServerInstancesClientListResponse]] + beginStart *tracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPCentralServerInstancesClientStartResponse]] + beginStop *tracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPCentralServerInstancesClientStopResponse]] } -// Do implements the policy.Transporter interface for SAPCentralInstancesServerTransport. -func (s *SAPCentralInstancesServerTransport) Do(req *http.Request) (*http.Response, error) { +// Do implements the policy.Transporter interface for SAPCentralServerInstancesServerTransport. +func (s *SAPCentralServerInstancesServerTransport) Do(req *http.Request) (*http.Response, error) { rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) method, ok := rawMethod.(string) if !ok { return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error - - switch method { - case "SAPCentralInstancesClient.BeginCreate": - resp, err = s.dispatchBeginCreate(req) - case "SAPCentralInstancesClient.BeginDelete": - resp, err = s.dispatchBeginDelete(req) - case "SAPCentralInstancesClient.Get": - resp, err = s.dispatchGet(req) - case "SAPCentralInstancesClient.NewListPager": - resp, err = s.dispatchNewListPager(req) - case "SAPCentralInstancesClient.BeginStartInstance": - resp, err = s.dispatchBeginStartInstance(req) - case "SAPCentralInstancesClient.BeginStopInstance": - resp, err = s.dispatchBeginStopInstance(req) - case "SAPCentralInstancesClient.Update": - resp, err = s.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + return s.dispatchToMethodFake(req, method) +} - if err != nil { - return nil, err - } +func (s *SAPCentralServerInstancesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - return resp, nil + go func() { + var intercepted bool + var res result + if sapCentralServerInstancesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = sapCentralServerInstancesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "SAPCentralServerInstancesClient.BeginCreate": + res.resp, res.err = s.dispatchBeginCreate(req) + case "SAPCentralServerInstancesClient.BeginDelete": + res.resp, res.err = s.dispatchBeginDelete(req) + case "SAPCentralServerInstancesClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "SAPCentralServerInstancesClient.NewListPager": + res.resp, res.err = s.dispatchNewListPager(req) + case "SAPCentralServerInstancesClient.BeginStart": + res.resp, res.err = s.dispatchBeginStart(req) + case "SAPCentralServerInstancesClient.BeginStop": + res.resp, res.err = s.dispatchBeginStop(req) + case "SAPCentralServerInstancesClient.Update": + res.resp, res.err = s.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } -func (s *SAPCentralInstancesServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { +func (s *SAPCentralServerInstancesServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { if s.srv.BeginCreate == nil { return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} } @@ -168,7 +183,7 @@ func (s *SAPCentralInstancesServerTransport) dispatchBeginCreate(req *http.Reque return resp, nil } -func (s *SAPCentralInstancesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { +func (s *SAPCentralServerInstancesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { if s.srv.BeginDelete == nil { return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} } @@ -205,9 +220,9 @@ func (s *SAPCentralInstancesServerTransport) dispatchBeginDelete(req *http.Reque return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { s.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { s.beginDelete.remove(req) @@ -216,7 +231,7 @@ func (s *SAPCentralInstancesServerTransport) dispatchBeginDelete(req *http.Reque return resp, nil } -func (s *SAPCentralInstancesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { +func (s *SAPCentralServerInstancesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { if s.srv.Get == nil { return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} } @@ -253,7 +268,7 @@ func (s *SAPCentralInstancesServerTransport) dispatchGet(req *http.Request) (*ht return resp, nil } -func (s *SAPCentralInstancesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { +func (s *SAPCentralServerInstancesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { if s.srv.NewListPager == nil { return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} } @@ -276,7 +291,7 @@ func (s *SAPCentralInstancesServerTransport) dispatchNewListPager(req *http.Requ resp := s.srv.NewListPager(resourceGroupNameParam, sapVirtualInstanceNameParam, nil) newListPager = &resp s.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armworkloadssapvirtualinstance.SAPCentralInstancesClientListResponse, createLink func() string) { + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armworkloadssapvirtualinstance.SAPCentralServerInstancesClientListResponse, createLink func() string) { page.NextLink = to.Ptr(createLink()) }) } @@ -294,12 +309,12 @@ func (s *SAPCentralInstancesServerTransport) dispatchNewListPager(req *http.Requ return resp, nil } -func (s *SAPCentralInstancesServerTransport) dispatchBeginStartInstance(req *http.Request) (*http.Response, error) { - if s.srv.BeginStartInstance == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginStartInstance not implemented")} +func (s *SAPCentralServerInstancesServerTransport) dispatchBeginStart(req *http.Request) (*http.Response, error) { + if s.srv.BeginStart == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginStart not implemented")} } - beginStartInstance := s.beginStartInstance.get(req) - if beginStartInstance == nil { + beginStart := s.beginStart.get(req) + if beginStart == nil { const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Workloads/sapVirtualInstances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/centralInstances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/start` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) @@ -322,42 +337,42 @@ func (s *SAPCentralInstancesServerTransport) dispatchBeginStartInstance(req *htt if err != nil { return nil, err } - var options *armworkloadssapvirtualinstance.SAPCentralInstancesClientBeginStartInstanceOptions + var options *armworkloadssapvirtualinstance.SAPCentralServerInstancesClientBeginStartOptions if !reflect.ValueOf(body).IsZero() { - options = &armworkloadssapvirtualinstance.SAPCentralInstancesClientBeginStartInstanceOptions{ + options = &armworkloadssapvirtualinstance.SAPCentralServerInstancesClientBeginStartOptions{ Body: &body, } } - respr, errRespr := s.srv.BeginStartInstance(req.Context(), resourceGroupNameParam, sapVirtualInstanceNameParam, centralInstanceNameParam, options) + respr, errRespr := s.srv.BeginStart(req.Context(), resourceGroupNameParam, sapVirtualInstanceNameParam, centralInstanceNameParam, options) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } - beginStartInstance = &respr - s.beginStartInstance.add(req, beginStartInstance) + beginStart = &respr + s.beginStart.add(req, beginStart) } - resp, err := server.PollerResponderNext(beginStartInstance, req) + resp, err := server.PollerResponderNext(beginStart, req) if err != nil { return nil, err } if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { - s.beginStartInstance.remove(req) + s.beginStart.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} } - if !server.PollerResponderMore(beginStartInstance) { - s.beginStartInstance.remove(req) + if !server.PollerResponderMore(beginStart) { + s.beginStart.remove(req) } return resp, nil } -func (s *SAPCentralInstancesServerTransport) dispatchBeginStopInstance(req *http.Request) (*http.Response, error) { - if s.srv.BeginStopInstance == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginStopInstance not implemented")} +func (s *SAPCentralServerInstancesServerTransport) dispatchBeginStop(req *http.Request) (*http.Response, error) { + if s.srv.BeginStop == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginStop not implemented")} } - beginStopInstance := s.beginStopInstance.get(req) - if beginStopInstance == nil { + beginStop := s.beginStop.get(req) + if beginStop == nil { const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Workloads/sapVirtualInstances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/centralInstances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/stop` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) @@ -380,37 +395,37 @@ func (s *SAPCentralInstancesServerTransport) dispatchBeginStopInstance(req *http if err != nil { return nil, err } - var options *armworkloadssapvirtualinstance.SAPCentralInstancesClientBeginStopInstanceOptions + var options *armworkloadssapvirtualinstance.SAPCentralServerInstancesClientBeginStopOptions if !reflect.ValueOf(body).IsZero() { - options = &armworkloadssapvirtualinstance.SAPCentralInstancesClientBeginStopInstanceOptions{ + options = &armworkloadssapvirtualinstance.SAPCentralServerInstancesClientBeginStopOptions{ Body: &body, } } - respr, errRespr := s.srv.BeginStopInstance(req.Context(), resourceGroupNameParam, sapVirtualInstanceNameParam, centralInstanceNameParam, options) + respr, errRespr := s.srv.BeginStop(req.Context(), resourceGroupNameParam, sapVirtualInstanceNameParam, centralInstanceNameParam, options) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } - beginStopInstance = &respr - s.beginStopInstance.add(req, beginStopInstance) + beginStop = &respr + s.beginStop.add(req, beginStop) } - resp, err := server.PollerResponderNext(beginStopInstance, req) + resp, err := server.PollerResponderNext(beginStop, req) if err != nil { return nil, err } if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { - s.beginStopInstance.remove(req) + s.beginStop.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} } - if !server.PollerResponderMore(beginStopInstance) { - s.beginStopInstance.remove(req) + if !server.PollerResponderMore(beginStop) { + s.beginStop.remove(req) } return resp, nil } -func (s *SAPCentralInstancesServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { +func (s *SAPCentralServerInstancesServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { if s.srv.Update == nil { return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} } @@ -450,3 +465,9 @@ func (s *SAPCentralInstancesServerTransport) dispatchUpdate(req *http.Request) ( } return resp, nil } + +// set this to conditionally intercept incoming requests to SAPCentralServerInstancesServerTransport +var sapCentralServerInstancesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/sapdatabaseinstances_server.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/sapdatabaseinstances_server.go index cf74eebc66d4..1750ca852dcc 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/sapdatabaseinstances_server.go +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/sapdatabaseinstances_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 @@ -27,10 +23,10 @@ import ( type SAPDatabaseInstancesServer struct { // BeginCreate is the fake for method SAPDatabaseInstancesClient.BeginCreate // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreate func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, body armworkloadssapvirtualinstance.SAPDatabaseInstance, options *armworkloadssapvirtualinstance.SAPDatabaseInstancesClientBeginCreateOptions) (resp azfake.PollerResponder[armworkloadssapvirtualinstance.SAPDatabaseInstancesClientCreateResponse], errResp azfake.ErrorResponder) + BeginCreate func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, resource armworkloadssapvirtualinstance.SAPDatabaseInstance, options *armworkloadssapvirtualinstance.SAPDatabaseInstancesClientBeginCreateOptions) (resp azfake.PollerResponder[armworkloadssapvirtualinstance.SAPDatabaseInstancesClientCreateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method SAPDatabaseInstancesClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, options *armworkloadssapvirtualinstance.SAPDatabaseInstancesClientBeginDeleteOptions) (resp azfake.PollerResponder[armworkloadssapvirtualinstance.SAPDatabaseInstancesClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method SAPDatabaseInstancesClient.Get @@ -41,17 +37,17 @@ type SAPDatabaseInstancesServer struct { // HTTP status codes to indicate success: http.StatusOK NewListPager func(resourceGroupName string, sapVirtualInstanceName string, options *armworkloadssapvirtualinstance.SAPDatabaseInstancesClientListOptions) (resp azfake.PagerResponder[armworkloadssapvirtualinstance.SAPDatabaseInstancesClientListResponse]) - // BeginStartInstance is the fake for method SAPDatabaseInstancesClient.BeginStartInstance + // BeginStart is the fake for method SAPDatabaseInstancesClient.BeginStart // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginStartInstance func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, options *armworkloadssapvirtualinstance.SAPDatabaseInstancesClientBeginStartInstanceOptions) (resp azfake.PollerResponder[armworkloadssapvirtualinstance.SAPDatabaseInstancesClientStartInstanceResponse], errResp azfake.ErrorResponder) + BeginStart func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, options *armworkloadssapvirtualinstance.SAPDatabaseInstancesClientBeginStartOptions) (resp azfake.PollerResponder[armworkloadssapvirtualinstance.SAPDatabaseInstancesClientStartResponse], errResp azfake.ErrorResponder) - // BeginStopInstance is the fake for method SAPDatabaseInstancesClient.BeginStopInstance + // BeginStop is the fake for method SAPDatabaseInstancesClient.BeginStop // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginStopInstance func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, options *armworkloadssapvirtualinstance.SAPDatabaseInstancesClientBeginStopInstanceOptions) (resp azfake.PollerResponder[armworkloadssapvirtualinstance.SAPDatabaseInstancesClientStopInstanceResponse], errResp azfake.ErrorResponder) + BeginStop func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, options *armworkloadssapvirtualinstance.SAPDatabaseInstancesClientBeginStopOptions) (resp azfake.PollerResponder[armworkloadssapvirtualinstance.SAPDatabaseInstancesClientStopResponse], errResp azfake.ErrorResponder) // Update is the fake for method SAPDatabaseInstancesClient.Update // HTTP status codes to indicate success: http.StatusOK - Update func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, body armworkloadssapvirtualinstance.UpdateSAPDatabaseInstanceRequest, options *armworkloadssapvirtualinstance.SAPDatabaseInstancesClientUpdateOptions) (resp azfake.Responder[armworkloadssapvirtualinstance.SAPDatabaseInstancesClientUpdateResponse], errResp azfake.ErrorResponder) + Update func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, properties armworkloadssapvirtualinstance.UpdateSAPDatabaseInstanceRequest, options *armworkloadssapvirtualinstance.SAPDatabaseInstancesClientUpdateOptions) (resp azfake.Responder[armworkloadssapvirtualinstance.SAPDatabaseInstancesClientUpdateResponse], errResp azfake.ErrorResponder) } // NewSAPDatabaseInstancesServerTransport creates a new instance of SAPDatabaseInstancesServerTransport with the provided implementation. @@ -59,24 +55,24 @@ type SAPDatabaseInstancesServer struct { // azcore.ClientOptions.Transporter field in the client's constructor parameters. func NewSAPDatabaseInstancesServerTransport(srv *SAPDatabaseInstancesServer) *SAPDatabaseInstancesServerTransport { return &SAPDatabaseInstancesServerTransport{ - srv: srv, - beginCreate: newTracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPDatabaseInstancesClientCreateResponse]](), - beginDelete: newTracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPDatabaseInstancesClientDeleteResponse]](), - newListPager: newTracker[azfake.PagerResponder[armworkloadssapvirtualinstance.SAPDatabaseInstancesClientListResponse]](), - beginStartInstance: newTracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPDatabaseInstancesClientStartInstanceResponse]](), - beginStopInstance: newTracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPDatabaseInstancesClientStopInstanceResponse]](), + srv: srv, + beginCreate: newTracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPDatabaseInstancesClientCreateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPDatabaseInstancesClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[armworkloadssapvirtualinstance.SAPDatabaseInstancesClientListResponse]](), + beginStart: newTracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPDatabaseInstancesClientStartResponse]](), + beginStop: newTracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPDatabaseInstancesClientStopResponse]](), } } // SAPDatabaseInstancesServerTransport connects instances of armworkloadssapvirtualinstance.SAPDatabaseInstancesClient to instances of SAPDatabaseInstancesServer. // Don't use this type directly, use NewSAPDatabaseInstancesServerTransport instead. type SAPDatabaseInstancesServerTransport struct { - srv *SAPDatabaseInstancesServer - beginCreate *tracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPDatabaseInstancesClientCreateResponse]] - beginDelete *tracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPDatabaseInstancesClientDeleteResponse]] - newListPager *tracker[azfake.PagerResponder[armworkloadssapvirtualinstance.SAPDatabaseInstancesClientListResponse]] - beginStartInstance *tracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPDatabaseInstancesClientStartInstanceResponse]] - beginStopInstance *tracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPDatabaseInstancesClientStopInstanceResponse]] + srv *SAPDatabaseInstancesServer + beginCreate *tracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPDatabaseInstancesClientCreateResponse]] + beginDelete *tracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPDatabaseInstancesClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[armworkloadssapvirtualinstance.SAPDatabaseInstancesClientListResponse]] + beginStart *tracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPDatabaseInstancesClientStartResponse]] + beginStop *tracker[azfake.PollerResponder[armworkloadssapvirtualinstance.SAPDatabaseInstancesClientStopResponse]] } // Do implements the policy.Transporter interface for SAPDatabaseInstancesServerTransport. @@ -87,33 +83,52 @@ func (s *SAPDatabaseInstancesServerTransport) Do(req *http.Request) (*http.Respo return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error - - switch method { - case "SAPDatabaseInstancesClient.BeginCreate": - resp, err = s.dispatchBeginCreate(req) - case "SAPDatabaseInstancesClient.BeginDelete": - resp, err = s.dispatchBeginDelete(req) - case "SAPDatabaseInstancesClient.Get": - resp, err = s.dispatchGet(req) - case "SAPDatabaseInstancesClient.NewListPager": - resp, err = s.dispatchNewListPager(req) - case "SAPDatabaseInstancesClient.BeginStartInstance": - resp, err = s.dispatchBeginStartInstance(req) - case "SAPDatabaseInstancesClient.BeginStopInstance": - resp, err = s.dispatchBeginStopInstance(req) - case "SAPDatabaseInstancesClient.Update": - resp, err = s.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + return s.dispatchToMethodFake(req, method) +} - if err != nil { - return nil, err - } +func (s *SAPDatabaseInstancesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - return resp, nil + go func() { + var intercepted bool + var res result + if sapDatabaseInstancesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = sapDatabaseInstancesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "SAPDatabaseInstancesClient.BeginCreate": + res.resp, res.err = s.dispatchBeginCreate(req) + case "SAPDatabaseInstancesClient.BeginDelete": + res.resp, res.err = s.dispatchBeginDelete(req) + case "SAPDatabaseInstancesClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "SAPDatabaseInstancesClient.NewListPager": + res.resp, res.err = s.dispatchNewListPager(req) + case "SAPDatabaseInstancesClient.BeginStart": + res.resp, res.err = s.dispatchBeginStart(req) + case "SAPDatabaseInstancesClient.BeginStop": + res.resp, res.err = s.dispatchBeginStop(req) + case "SAPDatabaseInstancesClient.Update": + res.resp, res.err = s.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (s *SAPDatabaseInstancesServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { @@ -205,9 +220,9 @@ func (s *SAPDatabaseInstancesServerTransport) dispatchBeginDelete(req *http.Requ return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { s.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { s.beginDelete.remove(req) @@ -294,12 +309,12 @@ func (s *SAPDatabaseInstancesServerTransport) dispatchNewListPager(req *http.Req return resp, nil } -func (s *SAPDatabaseInstancesServerTransport) dispatchBeginStartInstance(req *http.Request) (*http.Response, error) { - if s.srv.BeginStartInstance == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginStartInstance not implemented")} +func (s *SAPDatabaseInstancesServerTransport) dispatchBeginStart(req *http.Request) (*http.Response, error) { + if s.srv.BeginStart == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginStart not implemented")} } - beginStartInstance := s.beginStartInstance.get(req) - if beginStartInstance == nil { + beginStart := s.beginStart.get(req) + if beginStart == nil { const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Workloads/sapVirtualInstances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/databaseInstances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/start` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) @@ -322,42 +337,42 @@ func (s *SAPDatabaseInstancesServerTransport) dispatchBeginStartInstance(req *ht if err != nil { return nil, err } - var options *armworkloadssapvirtualinstance.SAPDatabaseInstancesClientBeginStartInstanceOptions + var options *armworkloadssapvirtualinstance.SAPDatabaseInstancesClientBeginStartOptions if !reflect.ValueOf(body).IsZero() { - options = &armworkloadssapvirtualinstance.SAPDatabaseInstancesClientBeginStartInstanceOptions{ + options = &armworkloadssapvirtualinstance.SAPDatabaseInstancesClientBeginStartOptions{ Body: &body, } } - respr, errRespr := s.srv.BeginStartInstance(req.Context(), resourceGroupNameParam, sapVirtualInstanceNameParam, databaseInstanceNameParam, options) + respr, errRespr := s.srv.BeginStart(req.Context(), resourceGroupNameParam, sapVirtualInstanceNameParam, databaseInstanceNameParam, options) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } - beginStartInstance = &respr - s.beginStartInstance.add(req, beginStartInstance) + beginStart = &respr + s.beginStart.add(req, beginStart) } - resp, err := server.PollerResponderNext(beginStartInstance, req) + resp, err := server.PollerResponderNext(beginStart, req) if err != nil { return nil, err } if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { - s.beginStartInstance.remove(req) + s.beginStart.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} } - if !server.PollerResponderMore(beginStartInstance) { - s.beginStartInstance.remove(req) + if !server.PollerResponderMore(beginStart) { + s.beginStart.remove(req) } return resp, nil } -func (s *SAPDatabaseInstancesServerTransport) dispatchBeginStopInstance(req *http.Request) (*http.Response, error) { - if s.srv.BeginStopInstance == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginStopInstance not implemented")} +func (s *SAPDatabaseInstancesServerTransport) dispatchBeginStop(req *http.Request) (*http.Response, error) { + if s.srv.BeginStop == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginStop not implemented")} } - beginStopInstance := s.beginStopInstance.get(req) - if beginStopInstance == nil { + beginStop := s.beginStop.get(req) + if beginStop == nil { const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Workloads/sapVirtualInstances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/databaseInstances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/stop` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) @@ -380,31 +395,31 @@ func (s *SAPDatabaseInstancesServerTransport) dispatchBeginStopInstance(req *htt if err != nil { return nil, err } - var options *armworkloadssapvirtualinstance.SAPDatabaseInstancesClientBeginStopInstanceOptions + var options *armworkloadssapvirtualinstance.SAPDatabaseInstancesClientBeginStopOptions if !reflect.ValueOf(body).IsZero() { - options = &armworkloadssapvirtualinstance.SAPDatabaseInstancesClientBeginStopInstanceOptions{ + options = &armworkloadssapvirtualinstance.SAPDatabaseInstancesClientBeginStopOptions{ Body: &body, } } - respr, errRespr := s.srv.BeginStopInstance(req.Context(), resourceGroupNameParam, sapVirtualInstanceNameParam, databaseInstanceNameParam, options) + respr, errRespr := s.srv.BeginStop(req.Context(), resourceGroupNameParam, sapVirtualInstanceNameParam, databaseInstanceNameParam, options) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } - beginStopInstance = &respr - s.beginStopInstance.add(req, beginStopInstance) + beginStop = &respr + s.beginStop.add(req, beginStop) } - resp, err := server.PollerResponderNext(beginStopInstance, req) + resp, err := server.PollerResponderNext(beginStop, req) if err != nil { return nil, err } if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { - s.beginStopInstance.remove(req) + s.beginStop.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} } - if !server.PollerResponderMore(beginStopInstance) { - s.beginStopInstance.remove(req) + if !server.PollerResponderMore(beginStop) { + s.beginStop.remove(req) } return resp, nil @@ -450,3 +465,9 @@ func (s *SAPDatabaseInstancesServerTransport) dispatchUpdate(req *http.Request) } return resp, nil } + +// set this to conditionally intercept incoming requests to SAPDatabaseInstancesServerTransport +var sapDatabaseInstancesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/sapvirtualinstances_server.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/sapvirtualinstances_server.go index 603a01a7b054..fc4305d0fc6a 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/sapvirtualinstances_server.go +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/sapvirtualinstances_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 @@ -27,16 +23,32 @@ import ( type SAPVirtualInstancesServer struct { // BeginCreate is the fake for method SAPVirtualInstancesClient.BeginCreate // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreate func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, body armworkloadssapvirtualinstance.SAPVirtualInstance, options *armworkloadssapvirtualinstance.SAPVirtualInstancesClientBeginCreateOptions) (resp azfake.PollerResponder[armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse], errResp azfake.ErrorResponder) + BeginCreate func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, resource armworkloadssapvirtualinstance.SAPVirtualInstance, options *armworkloadssapvirtualinstance.SAPVirtualInstancesClientBeginCreateOptions) (resp azfake.PollerResponder[armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method SAPVirtualInstancesClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, options *armworkloadssapvirtualinstance.SAPVirtualInstancesClientBeginDeleteOptions) (resp azfake.PollerResponder[armworkloadssapvirtualinstance.SAPVirtualInstancesClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method SAPVirtualInstancesClient.Get // HTTP status codes to indicate success: http.StatusOK Get func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, options *armworkloadssapvirtualinstance.SAPVirtualInstancesClientGetOptions) (resp azfake.Responder[armworkloadssapvirtualinstance.SAPVirtualInstancesClientGetResponse], errResp azfake.ErrorResponder) + // GetAvailabilityZoneDetails is the fake for method SAPVirtualInstancesClient.GetAvailabilityZoneDetails + // HTTP status codes to indicate success: http.StatusOK + GetAvailabilityZoneDetails func(ctx context.Context, location string, body armworkloadssapvirtualinstance.SAPAvailabilityZoneDetailsRequest, options *armworkloadssapvirtualinstance.SAPVirtualInstancesClientGetAvailabilityZoneDetailsOptions) (resp azfake.Responder[armworkloadssapvirtualinstance.SAPVirtualInstancesClientGetAvailabilityZoneDetailsResponse], errResp azfake.ErrorResponder) + + // GetDiskConfigurations is the fake for method SAPVirtualInstancesClient.GetDiskConfigurations + // HTTP status codes to indicate success: http.StatusOK + GetDiskConfigurations func(ctx context.Context, location string, body armworkloadssapvirtualinstance.SAPDiskConfigurationsRequest, options *armworkloadssapvirtualinstance.SAPVirtualInstancesClientGetDiskConfigurationsOptions) (resp azfake.Responder[armworkloadssapvirtualinstance.SAPVirtualInstancesClientGetDiskConfigurationsResponse], errResp azfake.ErrorResponder) + + // GetSapSupportedSKU is the fake for method SAPVirtualInstancesClient.GetSapSupportedSKU + // HTTP status codes to indicate success: http.StatusOK + GetSapSupportedSKU func(ctx context.Context, location string, body armworkloadssapvirtualinstance.SAPSupportedSKUsRequest, options *armworkloadssapvirtualinstance.SAPVirtualInstancesClientGetSapSupportedSKUOptions) (resp azfake.Responder[armworkloadssapvirtualinstance.SAPVirtualInstancesClientGetSapSupportedSKUResponse], errResp azfake.ErrorResponder) + + // GetSizingRecommendations is the fake for method SAPVirtualInstancesClient.GetSizingRecommendations + // HTTP status codes to indicate success: http.StatusOK + GetSizingRecommendations func(ctx context.Context, location string, body armworkloadssapvirtualinstance.SAPSizingRecommendationRequest, options *armworkloadssapvirtualinstance.SAPVirtualInstancesClientGetSizingRecommendationsOptions) (resp azfake.Responder[armworkloadssapvirtualinstance.SAPVirtualInstancesClientGetSizingRecommendationsResponse], errResp azfake.ErrorResponder) + // NewListByResourceGroupPager is the fake for method SAPVirtualInstancesClient.NewListByResourceGroupPager // HTTP status codes to indicate success: http.StatusOK NewListByResourceGroupPager func(resourceGroupName string, options *armworkloadssapvirtualinstance.SAPVirtualInstancesClientListByResourceGroupOptions) (resp azfake.PagerResponder[armworkloadssapvirtualinstance.SAPVirtualInstancesClientListByResourceGroupResponse]) @@ -55,7 +67,7 @@ type SAPVirtualInstancesServer struct { // BeginUpdate is the fake for method SAPVirtualInstancesClient.BeginUpdate // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginUpdate func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, body armworkloadssapvirtualinstance.UpdateSAPVirtualInstanceRequest, options *armworkloadssapvirtualinstance.SAPVirtualInstancesClientBeginUpdateOptions) (resp azfake.PollerResponder[armworkloadssapvirtualinstance.SAPVirtualInstancesClientUpdateResponse], errResp azfake.ErrorResponder) + BeginUpdate func(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, properties armworkloadssapvirtualinstance.UpdateSAPVirtualInstanceRequest, options *armworkloadssapvirtualinstance.SAPVirtualInstancesClientBeginUpdateOptions) (resp azfake.PollerResponder[armworkloadssapvirtualinstance.SAPVirtualInstancesClientUpdateResponse], errResp azfake.ErrorResponder) } // NewSAPVirtualInstancesServerTransport creates a new instance of SAPVirtualInstancesServerTransport with the provided implementation. @@ -95,35 +107,62 @@ func (s *SAPVirtualInstancesServerTransport) Do(req *http.Request) (*http.Respon return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error - - switch method { - case "SAPVirtualInstancesClient.BeginCreate": - resp, err = s.dispatchBeginCreate(req) - case "SAPVirtualInstancesClient.BeginDelete": - resp, err = s.dispatchBeginDelete(req) - case "SAPVirtualInstancesClient.Get": - resp, err = s.dispatchGet(req) - case "SAPVirtualInstancesClient.NewListByResourceGroupPager": - resp, err = s.dispatchNewListByResourceGroupPager(req) - case "SAPVirtualInstancesClient.NewListBySubscriptionPager": - resp, err = s.dispatchNewListBySubscriptionPager(req) - case "SAPVirtualInstancesClient.BeginStart": - resp, err = s.dispatchBeginStart(req) - case "SAPVirtualInstancesClient.BeginStop": - resp, err = s.dispatchBeginStop(req) - case "SAPVirtualInstancesClient.BeginUpdate": - resp, err = s.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + return s.dispatchToMethodFake(req, method) +} - if err != nil { - return nil, err - } +func (s *SAPVirtualInstancesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - return resp, nil + go func() { + var intercepted bool + var res result + if sapVirtualInstancesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = sapVirtualInstancesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "SAPVirtualInstancesClient.BeginCreate": + res.resp, res.err = s.dispatchBeginCreate(req) + case "SAPVirtualInstancesClient.BeginDelete": + res.resp, res.err = s.dispatchBeginDelete(req) + case "SAPVirtualInstancesClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "SAPVirtualInstancesClient.GetAvailabilityZoneDetails": + res.resp, res.err = s.dispatchGetAvailabilityZoneDetails(req) + case "SAPVirtualInstancesClient.GetDiskConfigurations": + res.resp, res.err = s.dispatchGetDiskConfigurations(req) + case "SAPVirtualInstancesClient.GetSapSupportedSKU": + res.resp, res.err = s.dispatchGetSapSupportedSKU(req) + case "SAPVirtualInstancesClient.GetSizingRecommendations": + res.resp, res.err = s.dispatchGetSizingRecommendations(req) + case "SAPVirtualInstancesClient.NewListByResourceGroupPager": + res.resp, res.err = s.dispatchNewListByResourceGroupPager(req) + case "SAPVirtualInstancesClient.NewListBySubscriptionPager": + res.resp, res.err = s.dispatchNewListBySubscriptionPager(req) + case "SAPVirtualInstancesClient.BeginStart": + res.resp, res.err = s.dispatchBeginStart(req) + case "SAPVirtualInstancesClient.BeginStop": + res.resp, res.err = s.dispatchBeginStop(req) + case "SAPVirtualInstancesClient.BeginUpdate": + res.resp, res.err = s.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (s *SAPVirtualInstancesServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { @@ -207,9 +246,9 @@ func (s *SAPVirtualInstancesServerTransport) dispatchBeginDelete(req *http.Reque return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { s.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { s.beginDelete.remove(req) @@ -251,6 +290,138 @@ func (s *SAPVirtualInstancesServerTransport) dispatchGet(req *http.Request) (*ht return resp, nil } +func (s *SAPVirtualInstancesServerTransport) dispatchGetAvailabilityZoneDetails(req *http.Request) (*http.Response, error) { + if s.srv.GetAvailabilityZoneDetails == nil { + return nil, &nonRetriableError{errors.New("fake for method GetAvailabilityZoneDetails not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Workloads/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sapVirtualInstanceMetadata/default/getAvailabilityZoneDetails` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armworkloadssapvirtualinstance.SAPAvailabilityZoneDetailsRequest](req) + if err != nil { + return nil, err + } + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.GetAvailabilityZoneDetails(req.Context(), locationParam, body, 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).SAPAvailabilityZoneDetailsResult, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SAPVirtualInstancesServerTransport) dispatchGetDiskConfigurations(req *http.Request) (*http.Response, error) { + if s.srv.GetDiskConfigurations == nil { + return nil, &nonRetriableError{errors.New("fake for method GetDiskConfigurations not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Workloads/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sapVirtualInstanceMetadata/default/getDiskConfigurations` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armworkloadssapvirtualinstance.SAPDiskConfigurationsRequest](req) + if err != nil { + return nil, err + } + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.GetDiskConfigurations(req.Context(), locationParam, body, 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).SAPDiskConfigurationsResult, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SAPVirtualInstancesServerTransport) dispatchGetSapSupportedSKU(req *http.Request) (*http.Response, error) { + if s.srv.GetSapSupportedSKU == nil { + return nil, &nonRetriableError{errors.New("fake for method GetSapSupportedSKU not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Workloads/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sapVirtualInstanceMetadata/default/getSapSupportedSku` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armworkloadssapvirtualinstance.SAPSupportedSKUsRequest](req) + if err != nil { + return nil, err + } + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.GetSapSupportedSKU(req.Context(), locationParam, body, 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).SAPSupportedResourceSKUsResult, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SAPVirtualInstancesServerTransport) dispatchGetSizingRecommendations(req *http.Request) (*http.Response, error) { + if s.srv.GetSizingRecommendations == nil { + return nil, &nonRetriableError{errors.New("fake for method GetSizingRecommendations not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Workloads/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sapVirtualInstanceMetadata/default/getSizingRecommendations` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armworkloadssapvirtualinstance.SAPSizingRecommendationRequest](req) + if err != nil { + return nil, err + } + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.GetSizingRecommendations(req.Context(), locationParam, body, 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).SAPSizingRecommendationResultClassification, req) + if err != nil { + return nil, err + } + return resp, nil +} + func (s *SAPVirtualInstancesServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { if s.srv.NewListByResourceGroupPager == nil { return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} @@ -476,3 +647,9 @@ func (s *SAPVirtualInstancesServerTransport) dispatchBeginUpdate(req *http.Reque return resp, nil } + +// set this to conditionally intercept incoming requests to SAPVirtualInstancesServerTransport +var sapVirtualInstancesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/server_factory.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/server_factory.go index 76fde4013d4e..99f4bf1c38bb 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/server_factory.go +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/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,12 +15,17 @@ import ( // ServerFactory is a fake server for instances of the armworkloadssapvirtualinstance.ClientFactory type. type ServerFactory struct { - OperationsServer OperationsServer + // SAPApplicationServerInstancesServer contains the fakes for client SAPApplicationServerInstancesClient SAPApplicationServerInstancesServer SAPApplicationServerInstancesServer - SAPCentralInstancesServer SAPCentralInstancesServer - SAPDatabaseInstancesServer SAPDatabaseInstancesServer - SAPVirtualInstancesServer SAPVirtualInstancesServer - WorkloadsServer WorkloadsServer + + // SAPCentralServerInstancesServer contains the fakes for client SAPCentralServerInstancesClient + SAPCentralServerInstancesServer SAPCentralServerInstancesServer + + // SAPDatabaseInstancesServer contains the fakes for client SAPDatabaseInstancesClient + SAPDatabaseInstancesServer SAPDatabaseInstancesServer + + // SAPVirtualInstancesServer contains the fakes for client SAPVirtualInstancesClient + SAPVirtualInstancesServer SAPVirtualInstancesServer } // NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. @@ -41,12 +42,10 @@ func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { type ServerFactoryTransport struct { srv *ServerFactory trMu sync.Mutex - trOperationsServer *OperationsServerTransport trSAPApplicationServerInstancesServer *SAPApplicationServerInstancesServerTransport - trSAPCentralInstancesServer *SAPCentralInstancesServerTransport + trSAPCentralServerInstancesServer *SAPCentralServerInstancesServerTransport trSAPDatabaseInstancesServer *SAPDatabaseInstancesServerTransport trSAPVirtualInstancesServer *SAPVirtualInstancesServerTransport - trWorkloadsServer *WorkloadsServerTransport } // Do implements the policy.Transporter interface for ServerFactoryTransport. @@ -62,19 +61,16 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { var err error switch client { - case "OperationsClient": - initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) - resp, err = s.trOperationsServer.Do(req) case "SAPApplicationServerInstancesClient": initServer(s, &s.trSAPApplicationServerInstancesServer, func() *SAPApplicationServerInstancesServerTransport { return NewSAPApplicationServerInstancesServerTransport(&s.srv.SAPApplicationServerInstancesServer) }) resp, err = s.trSAPApplicationServerInstancesServer.Do(req) - case "SAPCentralInstancesClient": - initServer(s, &s.trSAPCentralInstancesServer, func() *SAPCentralInstancesServerTransport { - return NewSAPCentralInstancesServerTransport(&s.srv.SAPCentralInstancesServer) + case "SAPCentralServerInstancesClient": + initServer(s, &s.trSAPCentralServerInstancesServer, func() *SAPCentralServerInstancesServerTransport { + return NewSAPCentralServerInstancesServerTransport(&s.srv.SAPCentralServerInstancesServer) }) - resp, err = s.trSAPCentralInstancesServer.Do(req) + resp, err = s.trSAPCentralServerInstancesServer.Do(req) case "SAPDatabaseInstancesClient": initServer(s, &s.trSAPDatabaseInstancesServer, func() *SAPDatabaseInstancesServerTransport { return NewSAPDatabaseInstancesServerTransport(&s.srv.SAPDatabaseInstancesServer) @@ -85,9 +81,6 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { return NewSAPVirtualInstancesServerTransport(&s.srv.SAPVirtualInstancesServer) }) resp, err = s.trSAPVirtualInstancesServer.Do(req) - case "WorkloadsClient": - initServer(s, &s.trWorkloadsServer, func() *WorkloadsServerTransport { return NewWorkloadsServerTransport(&s.srv.WorkloadsServer) }) - resp, err = s.trWorkloadsServer.Do(req) default: err = fmt.Errorf("unhandled client %s", client) } diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/time_rfc3339.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/time_rfc3339.go index 81f308b0d343..87ee11e83b32 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/time_rfc3339.go +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/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/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/workloads_server.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/workloads_server.go deleted file mode 100644 index 52a61891416f..000000000000 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/workloads_server.go +++ /dev/null @@ -1,242 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance" - "net/http" - "net/url" - "reflect" - "regexp" -) - -// WorkloadsServer is a fake server for instances of the armworkloadssapvirtualinstance.WorkloadsClient type. -type WorkloadsServer struct { - // SAPAvailabilityZoneDetails is the fake for method WorkloadsClient.SAPAvailabilityZoneDetails - // HTTP status codes to indicate success: http.StatusOK - SAPAvailabilityZoneDetails func(ctx context.Context, location string, options *armworkloadssapvirtualinstance.WorkloadsClientSAPAvailabilityZoneDetailsOptions) (resp azfake.Responder[armworkloadssapvirtualinstance.WorkloadsClientSAPAvailabilityZoneDetailsResponse], errResp azfake.ErrorResponder) - - // SAPDiskConfigurations is the fake for method WorkloadsClient.SAPDiskConfigurations - // HTTP status codes to indicate success: http.StatusOK - SAPDiskConfigurations func(ctx context.Context, location string, options *armworkloadssapvirtualinstance.WorkloadsClientSAPDiskConfigurationsOptions) (resp azfake.Responder[armworkloadssapvirtualinstance.WorkloadsClientSAPDiskConfigurationsResponse], errResp azfake.ErrorResponder) - - // SAPSizingRecommendations is the fake for method WorkloadsClient.SAPSizingRecommendations - // HTTP status codes to indicate success: http.StatusOK - SAPSizingRecommendations func(ctx context.Context, location string, options *armworkloadssapvirtualinstance.WorkloadsClientSAPSizingRecommendationsOptions) (resp azfake.Responder[armworkloadssapvirtualinstance.WorkloadsClientSAPSizingRecommendationsResponse], errResp azfake.ErrorResponder) - - // SAPSupportedSKU is the fake for method WorkloadsClient.SAPSupportedSKU - // HTTP status codes to indicate success: http.StatusOK - SAPSupportedSKU func(ctx context.Context, location string, options *armworkloadssapvirtualinstance.WorkloadsClientSAPSupportedSKUOptions) (resp azfake.Responder[armworkloadssapvirtualinstance.WorkloadsClientSAPSupportedSKUResponse], errResp azfake.ErrorResponder) -} - -// NewWorkloadsServerTransport creates a new instance of WorkloadsServerTransport with the provided implementation. -// The returned WorkloadsServerTransport instance is connected to an instance of armworkloadssapvirtualinstance.WorkloadsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewWorkloadsServerTransport(srv *WorkloadsServer) *WorkloadsServerTransport { - return &WorkloadsServerTransport{srv: srv} -} - -// WorkloadsServerTransport connects instances of armworkloadssapvirtualinstance.WorkloadsClient to instances of WorkloadsServer. -// Don't use this type directly, use NewWorkloadsServerTransport instead. -type WorkloadsServerTransport struct { - srv *WorkloadsServer -} - -// Do implements the policy.Transporter interface for WorkloadsServerTransport. -func (w *WorkloadsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "WorkloadsClient.SAPAvailabilityZoneDetails": - resp, err = w.dispatchSAPAvailabilityZoneDetails(req) - case "WorkloadsClient.SAPDiskConfigurations": - resp, err = w.dispatchSAPDiskConfigurations(req) - case "WorkloadsClient.SAPSizingRecommendations": - resp, err = w.dispatchSAPSizingRecommendations(req) - case "WorkloadsClient.SAPSupportedSKU": - resp, err = w.dispatchSAPSupportedSKU(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (w *WorkloadsServerTransport) dispatchSAPAvailabilityZoneDetails(req *http.Request) (*http.Response, error) { - if w.srv.SAPAvailabilityZoneDetails == nil { - return nil, &nonRetriableError{errors.New("fake for method SAPAvailabilityZoneDetails not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Workloads/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sapVirtualInstanceMetadata/default/getAvailabilityZoneDetails` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armworkloadssapvirtualinstance.SAPAvailabilityZoneDetailsRequest](req) - if err != nil { - return nil, err - } - locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) - if err != nil { - return nil, err - } - var options *armworkloadssapvirtualinstance.WorkloadsClientSAPAvailabilityZoneDetailsOptions - if !reflect.ValueOf(body).IsZero() { - options = &armworkloadssapvirtualinstance.WorkloadsClientSAPAvailabilityZoneDetailsOptions{ - SAPAvailabilityZoneDetails: &body, - } - } - respr, errRespr := w.srv.SAPAvailabilityZoneDetails(req.Context(), locationParam, options) - 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).SAPAvailabilityZoneDetailsResult, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (w *WorkloadsServerTransport) dispatchSAPDiskConfigurations(req *http.Request) (*http.Response, error) { - if w.srv.SAPDiskConfigurations == nil { - return nil, &nonRetriableError{errors.New("fake for method SAPDiskConfigurations not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Workloads/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sapVirtualInstanceMetadata/default/getDiskConfigurations` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armworkloadssapvirtualinstance.SAPDiskConfigurationsRequest](req) - if err != nil { - return nil, err - } - locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) - if err != nil { - return nil, err - } - var options *armworkloadssapvirtualinstance.WorkloadsClientSAPDiskConfigurationsOptions - if !reflect.ValueOf(body).IsZero() { - options = &armworkloadssapvirtualinstance.WorkloadsClientSAPDiskConfigurationsOptions{ - SAPDiskConfigurations: &body, - } - } - respr, errRespr := w.srv.SAPDiskConfigurations(req.Context(), locationParam, options) - 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).SAPDiskConfigurationsResult, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (w *WorkloadsServerTransport) dispatchSAPSizingRecommendations(req *http.Request) (*http.Response, error) { - if w.srv.SAPSizingRecommendations == nil { - return nil, &nonRetriableError{errors.New("fake for method SAPSizingRecommendations not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Workloads/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sapVirtualInstanceMetadata/default/getSizingRecommendations` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armworkloadssapvirtualinstance.SAPSizingRecommendationRequest](req) - if err != nil { - return nil, err - } - locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) - if err != nil { - return nil, err - } - var options *armworkloadssapvirtualinstance.WorkloadsClientSAPSizingRecommendationsOptions - if !reflect.ValueOf(body).IsZero() { - options = &armworkloadssapvirtualinstance.WorkloadsClientSAPSizingRecommendationsOptions{ - SAPSizingRecommendation: &body, - } - } - respr, errRespr := w.srv.SAPSizingRecommendations(req.Context(), locationParam, options) - 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).SAPSizingRecommendationResultClassification, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (w *WorkloadsServerTransport) dispatchSAPSupportedSKU(req *http.Request) (*http.Response, error) { - if w.srv.SAPSupportedSKU == nil { - return nil, &nonRetriableError{errors.New("fake for method SAPSupportedSKU not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Workloads/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sapVirtualInstanceMetadata/default/getSapSupportedSku` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armworkloadssapvirtualinstance.SAPSupportedSKUsRequest](req) - if err != nil { - return nil, err - } - locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) - if err != nil { - return nil, err - } - var options *armworkloadssapvirtualinstance.WorkloadsClientSAPSupportedSKUOptions - if !reflect.ValueOf(body).IsZero() { - options = &armworkloadssapvirtualinstance.WorkloadsClientSAPSupportedSKUOptions{ - SAPSupportedSKU: &body, - } - } - respr, errRespr := w.srv.SAPSupportedSKU(req.Context(), locationParam, options) - 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).SAPSupportedResourceSKUsResult, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/go.mod b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/go.mod index cbc72d4d4f77..56da7dd00518 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/go.mod +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/go.mod @@ -3,7 +3,7 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloadssapvirtual go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 ) @@ -14,8 +14,8 @@ require ( github.com/google/uuid v1.6.0 // indirect github.com/kylelemons/godebug v1.1.0 // indirect github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect - golang.org/x/crypto v0.25.0 // indirect - golang.org/x/net v0.27.0 // indirect - golang.org/x/sys v0.22.0 // indirect - golang.org/x/text v0.16.0 // indirect + golang.org/x/crypto v0.27.0 // indirect + golang.org/x/net v0.29.0 // indirect + golang.org/x/sys v0.25.0 // indirect + golang.org/x/text v0.18.0 // indirect ) diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/go.sum b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/go.sum index 09d275cb9a37..cbddbbd9ecec 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/go.sum +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/go.sum @@ -1,5 +1,5 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 h1:GJHeeA2N7xrG3q30L2UXDyuWRzDM900/65j70wcM4Ww= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 h1:JZg6HRh6W6U4OLl6lk7BZ7BLisIzM9dG1R50zUk9C/M= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0/go.mod h1:YL1xnZ6QejvQHWJrX/AvhFl4WW4rqHVoKspWNVwFk0M= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= @@ -17,13 +17,13 @@ github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmd github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= -golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= -golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= +golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= +golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/interfaces.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/interfaces.go index d5a628b5cd4c..6f702bf2f8db 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/interfaces.go +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/interfaces.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armworkloadssapvirtualinstance diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/models.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/models.go index 3ba605dab9fb..2812c5b4de41 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/models.go +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/models.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armworkloadssapvirtualinstance @@ -41,7 +37,7 @@ type ApplicationServerVMDetails struct { // READ-ONLY; Defines the type of application server VM. Type *ApplicationServerVirtualMachineType - // READ-ONLY + // READ-ONLY; The virtual machine id. VirtualMachineID *string } @@ -66,8 +62,7 @@ type CentralServerFullResourceNames struct { LoadBalancer *LoadBalancerResourceNames // The list of names for all ASCS virtual machines to be deployed. The number of entries in this list should be equal to the - // number VMs to be created for ASCS layer. At maximum, there can be two virtual - // machines at this layer: ASCS and ERS. + // number VMs to be created for ASCS layer. At maximum, there can be two virtual machines at this layer: ASCS and ERS. VirtualMachines []*VirtualMachineResourceNames } @@ -80,16 +75,17 @@ type CentralServerVMDetails struct { // READ-ONLY; Defines the type of central server VM. Type *CentralServerVirtualMachineType - // READ-ONLY + // READ-ONLY; The virtual machine id. VirtualMachineID *string } // CreateAndMountFileShareConfiguration - Gets or sets the file share configuration where the transport directory fileshare -// is created and mounted as a part of the create infra flow. Please pre-create the resource group you intend to place -// the transport directory in. The storage account and fileshare will be auto-created by the ACSS and doesn't need to be pre-created. +// is created and mounted as a part of the create infra flow. Please pre-create the resource group you intend to place the +// transport directory in. The storage account and fileshare will be auto-created by the ACSS and doesn't need to be pre-created. type CreateAndMountFileShareConfiguration struct { - // REQUIRED; The type of file share config. - ConfigurationType *ConfigurationType + // CONSTANT; The type of file share config. + // Field has constant value FileShareConfigurationTypeCreateAndMount, any specified value is ignored. + ConfigurationType *FileShareConfigurationType // The name of transport file share resource group. This should be pre created by the customer. The app rg is used in case // of missing input. @@ -146,7 +142,7 @@ type DatabaseVMDetails struct { // Storage. StorageDetails []*StorageInformation - // READ-ONLY + // READ-ONLY; The virtual machine id. VirtualMachineID *string } @@ -161,7 +157,8 @@ type DeployerVMPackages struct { // DeploymentConfiguration - Deployment Configuration. type DeploymentConfiguration struct { - // REQUIRED; The configuration Type. + // CONSTANT; The deployment configuration Type. + // Field has constant value SAPConfigurationTypeDeployment, any specified value is ignored. ConfigurationType *SAPConfigurationType // The geo-location where the SAP system is to be created. @@ -183,7 +180,8 @@ func (d *DeploymentConfiguration) GetSAPConfiguration() *SAPConfiguration { // DeploymentWithOSConfiguration - Deployment along with OS Configuration. type DeploymentWithOSConfiguration struct { - // REQUIRED; The configuration Type. + // CONSTANT; The configuration Type. + // Field has constant value SAPConfigurationTypeDeploymentWithOSConfig, any specified value is ignored. ConfigurationType *SAPConfigurationType // The geo-location where the SAP system is to be created. @@ -208,16 +206,16 @@ func (d *DeploymentWithOSConfiguration) GetSAPConfiguration() *SAPConfiguration // DiscoveryConfiguration - Discovery Details. type DiscoveryConfiguration struct { - // REQUIRED; The configuration Type. + // CONSTANT; The configuration Type. + // Field has constant value SAPConfigurationTypeDiscovery, any specified value is ignored. ConfigurationType *SAPConfigurationType // The virtual machine ID of the Central Server. CentralServerVMID *string // The custom storage account name for the storage account created by the service in the managed resource group created as - // part of VIS deployment. - // Refer to the storage account naming rules here [https://learn.microsoft.com/azure/azure-resource-manager/management/resource-name-rules#microsoftstorage]. - // If not provided, the service will create the storage account with a random name. + // part of VIS deployment.

Refer to the storage account naming rules [here](https://learn.microsoft.com/azure/azure-resource-manager/management/resource-name-rules#microsoftstorage).

If + // not provided, the service will create the storage account with a random name. ManagedRgStorageAccountName *string // READ-ONLY; The geo-location where the SAP system exists. @@ -255,14 +253,14 @@ type DiskDetails struct { // The minimum supported disk count. MinimumSupportedDiskCount *int64 - // The type of disk sku. For example, StandardLRS, StandardZRS, PremiumLRS, PremiumZRS. + // The type of disk sku. For example, Standard_LRS, Standard_ZRS, Premium_LRS, Premium_ZRS. SKU *DiskSKU // The disk size in GB. SizeGB *int64 } -// DiskSKU - The type of disk sku. For example, StandardLRS, StandardZRS, PremiumLRS, PremiumZRS. +// DiskSKU - The type of disk sku. For example, Standard_LRS, Standard_ZRS, Premium_LRS, Premium_ZRS. type DiskSKU struct { // Defines the disk sku name. Name *DiskSKUName @@ -322,12 +320,15 @@ type EnqueueServerProperties struct { // ErrorAdditionalInfo - The resource management error additional info. type ErrorAdditionalInfo struct { // READ-ONLY; The additional info. - Info any + Info *ErrorAdditionalInfoInfo // READ-ONLY; The additional info type. Type *string } +type ErrorAdditionalInfoInfo struct { +} + // ErrorDefinition - Error definition. type ErrorDefinition struct { // READ-ONLY; Service specific error code which serves as the substatus for the HTTP error code. @@ -361,7 +362,8 @@ type ErrorDetail struct { // ExternalInstallationSoftwareConfiguration - The SAP Software configuration Input when the software is installed externally // outside the service. type ExternalInstallationSoftwareConfiguration struct { - // REQUIRED; The SAP software installation Type. + // CONSTANT; The SAP software installation Type. + // Field has constant value SAPSoftwareInstallationTypeExternal, any specified value is ignored. SoftwareInstallationType *SAPSoftwareInstallationType // The resource ID of the virtual machine containing the central server instance. @@ -378,8 +380,8 @@ func (e *ExternalInstallationSoftwareConfiguration) GetSoftwareConfiguration() * // FileShareConfiguration - File Share configuration details, populated with information on storage configuration mounted // on the VIS. The createAndMount option is selected in case of missing input. type FileShareConfiguration struct { - // REQUIRED; The type of file share config. - ConfigurationType *ConfigurationType + // REQUIRED; The type of file share config, eg: Mount/CreateAndMount/Skip. + ConfigurationType *FileShareConfigurationType } // GetFileShareConfiguration implements the FileShareConfigurationClassification interface for type FileShareConfiguration. @@ -411,13 +413,12 @@ type HighAvailabilitySoftwareConfiguration struct { } // ImageReference - Specifies information about the image to use. You can specify information about platform images, marketplace -// images, or virtual machine images. This element is required when you want to use a platform -// image, marketplace image, or virtual machine image, but is not used in other creation operations. NOTE: Image reference -// publisher and offer can only be set when you create the scale set. +// images, or virtual machine images. This element is required when you want to use a platform image, marketplace image, or +// virtual machine image, but is not used in other creation operations. NOTE: Image reference publisher and offer can only +// be set when you create the scale set. type ImageReference struct { // Specifies the ARM resource ID of the Azure Compute Gallery image version used for creating ACSS VMs. You will need to provide - // this input when you choose to deploy virtual machines in ACSS with OS - // image from the Azure Compute gallery. + // this input when you choose to deploy virtual machines in ACSS with OS image from the Azure Compute gallery. ID *string // Specifies the offer of the platform image or marketplace image used to create the virtual machine. @@ -430,10 +431,9 @@ type ImageReference struct { SKU *string // Specifies the version of the platform image or marketplace image used to create the virtual machine. The allowed formats - // are Major.Minor.Build or 'latest'. Major, Minor, and Build are decimal numbers. - // Specify 'latest' to use the latest version of an image available at deploy time. Even if you use 'latest', the VM image - // will not automatically update after deploy time even if a new version becomes - // available. + // are Major.Minor.Build or 'latest'. Major, Minor, and Build are decimal numbers. Specify 'latest' to use the latest version + // of an image available at deploy time. Even if you use 'latest', the VM image will not automatically update after deploy + // time even if a new version becomes available. Version *string } @@ -442,7 +442,7 @@ type InfrastructureConfiguration struct { // REQUIRED; The application resource group where SAP system resources will be deployed. AppResourceGroup *string - // REQUIRED; The type of SAP deployment, single server or Three tier. + // REQUIRED; The SAP deployment type. Eg: SingleServer/ThreeTier. DeploymentType *SAPDeploymentType } @@ -451,10 +451,11 @@ func (i *InfrastructureConfiguration) GetInfrastructureConfiguration() *Infrastr return i } -// LinuxConfiguration - Specifies the Linux operating system settings on the virtual machine. -// For a list of supported Linux distributions, see Linux on Azure-Endorsed Distributions [https://docs.microsoft.com/azure/virtual-machines/linux/endorsed-distros]. +// LinuxConfiguration - Specifies the Linux operating system settings on the virtual machine.

For a list of supported +// Linux distributions, see [Linux on Azure-Endorsed Distributions](https://docs.microsoft.com/azure/virtual-machines/linux/endorsed-distros). type LinuxConfiguration struct { - // REQUIRED; The OS Type + // CONSTANT; The OS Type + // Field has constant value OSTypeLinux, any specified value is ignored. OSType *OSType // Specifies whether password authentication should be disabled. @@ -476,7 +477,7 @@ func (l *LinuxConfiguration) GetOSConfiguration() *OSConfiguration { // LoadBalancerDetails - The Load Balancer details such as Load Balancer ID. type LoadBalancerDetails struct { - // READ-ONLY + // READ-ONLY; Fully qualified resource ID for the load balancer. ID *string } @@ -530,8 +531,9 @@ type MessageServerProperties struct { // MountFileShareConfiguration - Gets or sets the file share configuration where the transport directory fileshare already // exists, and user wishes to mount the fileshare as a part of the create infra flow. type MountFileShareConfiguration struct { - // REQUIRED; The type of file share config. - ConfigurationType *ConfigurationType + // CONSTANT; The type of file share config, mount in this case. + // Field has constant value FileShareConfigurationTypeMount, any specified value is ignored. + ConfigurationType *FileShareConfigurationType // REQUIRED; The fileshare resource ID ID *string @@ -556,10 +558,9 @@ type NetworkConfiguration struct { // NetworkInterfaceResourceNames - The resource names object for network interface and related resources. type NetworkInterfaceResourceNames struct { // The full name for network interface. If name is not provided, service uses a default name based on the deployment type. - // For SingleServer, default name is {SID}-Nic. In case of HA-AvZone systems, - // default name will be {SID}-{App/ASCS/DB}-Zone{A/B}-Nic with an incrementor at the end in case of more than 1 instance per - // layer. For distributed and HA-AvSet systems, default name will be - // {SID}-{App/ASCS/DB}-Nic with an incrementor at the end in case of more than 1 instance per layer. + // For SingleServer, default name is {SID}-Nic. In case of HA-AvZone systems, default name will be {SID}-{App/ASCS/DB}-Zone{A/B}-Nic + // with an incrementor at the end in case of more than 1 instance per layer. For distributed and HA-AvSet systems, default + // name will be {SID}-{App/ASCS/DB}-Nic with an incrementor at the end in case of more than 1 instance per layer. NetworkInterfaceName *string } @@ -575,87 +576,28 @@ func (o *OSConfiguration) GetOSConfiguration() *OSConfiguration { return o } // OSProfile - Specifies the operating system settings for the virtual machine. Some of the settings cannot be changed once // VM is provisioned. type OSProfile struct { - // Specifies the password of the administrator account. - // Minimum-length (Windows): 8 characters - // Minimum-length (Linux): 6 characters - // Max-length (Windows): 123 characters - // Max-length (Linux): 72 characters - // Complexity requirements: 3 out of 4 conditions below need to be fulfilled - // Has lower characters - // Has upper characters - // Has a digit - // Has a special character (Regex match [\W_]) - // Disallowed values: "abc@123", "P@$$w0rd", "P@ssw0rd", "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", - // "Password22", "iloveyou!" - // For resetting the password, see How to reset the Remote Desktop service or its login password in a Windows VM [https://docs.microsoft.com/troubleshoot/azure/virtual-machines/reset-rdp] - // For resetting root password, see Manage users, SSH, and check or repair disks on Azure Linux VMs using the VMAccess Extension - // [https://docs.microsoft.com/troubleshoot/azure/virtual-machines/troubleshoot-ssh-connection] + // Specifies the password of the administrator account.

**Minimum-length (Windows):** 8 characters

**Minimum-length + // (Linux):** 6 characters

**Max-length (Windows):** 123 characters

**Max-length (Linux):** 72 characters + //

**Complexity requirements:** 3 out of 4 conditions below need to be fulfilled
Has lower characters
Has + // upper characters
Has a digit
Has a special character (Regex match [\W_])

**Disallowed values:** "abc@123", + // "P@$$w0rd", "P@ssw0rd", "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!"

+ // For resetting the password, see [How to reset the Remote Desktop service or its login password in a Windows VM](https://docs.microsoft.com/troubleshoot/azure/virtual-machines/reset-rdp) + //

For resetting root password, see [Manage users, SSH, and check or repair disks on Azure Linux VMs using the VMAccess + // Extension](https://docs.microsoft.com/troubleshoot/azure/virtual-machines/troubleshoot-ssh-connection) AdminPassword *string - // Specifies the name of the administrator account. - // This property cannot be updated after the VM is created. - // Windows-only restriction: Cannot end in "." - // Disallowed values: "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", - // "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", - // "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". - // Minimum-length (Linux): 1 character - // Max-length (Linux): 64 characters - // Max-length (Windows): 20 characters. + // Specifies the name of the administrator account.

This property cannot be updated after the VM is created.

+ // **Windows-only restriction:** Cannot end in "."

**Disallowed values:** "administrator", "admin", "user", "user1", + // "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", + // "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", + // "user5".

**Minimum-length (Linux):** 1 character

**Max-length (Linux):** 64 characters

**Max-length + // (Windows):** 20 characters. AdminUsername *string // Specifies Windows operating system settings on the virtual machine. OSConfiguration OSConfigurationClassification } -// 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. - 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. - IsDataAction *bool - - // READ-ONLY; The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", - // "Microsoft.Compute/virtualMachines/capture/action" - Name *string - - // READ-ONLY; The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default - // value is "user,system" - Origin *Origin -} - -// OperationDisplay - Localized display information for this particular operation. -type OperationDisplay struct { - // READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views. - Description *string - - // READ-ONLY; The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual - // Machine", "Restart Virtual Machine". - Operation *string - - // READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft - // Compute". - Provider *string - - // READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job - // Schedule Collections". - Resource *string -} - -// OperationListResult - A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to -// get the next set of results. -type OperationListResult struct { - // READ-ONLY; URL to get the next set of operation list results (if there are any). - NextLink *string - - // READ-ONLY; List of operations supported by the resource provider - Value []*Operation -} - // OperationStatusResult - The current status of an async operation. type OperationStatusResult struct { // REQUIRED; Operation status. @@ -677,7 +619,7 @@ type OperationStatusResult struct { Operations []*OperationStatusResult // Percent of the operation that is complete. - PercentComplete *float32 + PercentComplete *float64 // The start time of the operation. StartTime *time.Time @@ -697,18 +639,18 @@ type SAPApplicationServerInstance struct { // REQUIRED; The geo-location where the resource lives Location *string - // Defines the SAP Application Server instance properties. + // The resource-specific properties for this resource. Properties *SAPApplicationServerProperties // Resource tags. Tags map[string]*string + // READ-ONLY; The name of SAP Application Server instance resource. + Name *string + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource - Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData @@ -716,13 +658,13 @@ type SAPApplicationServerInstance struct { Type *string } -// SAPApplicationServerInstanceList - Defines the collection of SAP Application Server Instance resources. -type SAPApplicationServerInstanceList struct { - // Gets the value of next link. - NextLink *string - - // Gets the list of SAP Application Server instance resources. +// SAPApplicationServerInstanceListResult - The response of a SAPApplicationServerInstance list operation. +type SAPApplicationServerInstanceListResult struct { + // REQUIRED; The SAPApplicationServerInstance items on this page Value []*SAPApplicationServerInstance + + // The link to the next page of items + NextLink *string } // SAPApplicationServerProperties - Defines the SAP Application Server instance properties. @@ -803,32 +745,23 @@ type SAPAvailabilityZonePair struct { ZoneB *int64 } -// SAPCentralInstanceList - Defines the collection of SAP Central Services Instance resources. -type SAPCentralInstanceList struct { - // Gets the value of next link. - NextLink *string - - // Gets the list of SAP central services instance resources. - Value []*SAPCentralServerInstance -} - // SAPCentralServerInstance - Define the SAP Central Services Instance resource. type SAPCentralServerInstance struct { // REQUIRED; The geo-location where the resource lives Location *string - // Defines the SAP Central Services Instance properties. + // The resource-specific properties for this resource. Properties *SAPCentralServerProperties // Resource tags. Tags map[string]*string + // READ-ONLY; Central Services Instance resource name string modeled as parameter for auto generation to work correctly. + Name *string + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource - Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData @@ -836,6 +769,15 @@ type SAPCentralServerInstance struct { Type *string } +// SAPCentralServerInstanceListResult - The response of a SAPCentralServerInstance list operation. +type SAPCentralServerInstanceListResult struct { + // REQUIRED; The SAPCentralServerInstance items on this page + Value []*SAPCentralServerInstance + + // The link to the next page of items + NextLink *string +} + // SAPCentralServerProperties - Defines the SAP Central Services Instance properties. type SAPCentralServerProperties struct { // Defines the SAP Enqueue Replication Server (ERS) properties. @@ -883,7 +825,7 @@ type SAPCentralServerProperties struct { // SAPConfiguration - The SAP Configuration. type SAPConfiguration struct { - // REQUIRED; The configuration Type. + // REQUIRED; The configuration type. Eg: Deployment/Discovery ConfigurationType *SAPConfigurationType } @@ -895,18 +837,18 @@ type SAPDatabaseInstance struct { // REQUIRED; The geo-location where the resource lives Location *string - // Defines the Database properties. + // The resource-specific properties for this resource. Properties *SAPDatabaseProperties // Resource tags. Tags map[string]*string + // READ-ONLY; Database resource name string modeled as parameter for auto generation to work correctly. + Name *string + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource - Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData @@ -914,13 +856,13 @@ type SAPDatabaseInstance struct { Type *string } -// SAPDatabaseInstanceList - Defines the collection of SAP Database Instances. -type SAPDatabaseInstanceList struct { - // Gets the value of next link. - NextLink *string - - // Gets the list of SAP Database instances. +// SAPDatabaseInstanceListResult - The response of a SAPDatabaseInstance list operation. +type SAPDatabaseInstanceListResult struct { + // REQUIRED; The SAPDatabaseInstance items on this page Value []*SAPDatabaseInstance + + // The link to the next page of items + NextLink *string } // SAPDatabaseProperties - Defines the Database properties. @@ -1000,7 +942,8 @@ type SAPInstallWithoutOSConfigSoftwareConfiguration struct { // REQUIRED; The SAP bits storage account id. SapBitsStorageAccountID *string - // REQUIRED; The SAP software installation Type. + // CONSTANT; The SAP software installation Type. + // Field has constant value SAPSoftwareInstallationTypeSAPInstallWithoutOSConfig, any specified value is ignored. SoftwareInstallationType *SAPSoftwareInstallationType // REQUIRED; The software version to install. @@ -1049,7 +992,7 @@ type SAPSizingRecommendationRequest struct { // SAPSizingRecommendationResult - The SAP sizing recommendation result. type SAPSizingRecommendationResult struct { - // REQUIRED; The type of SAP deployment, single server or Three tier. + // REQUIRED; The deployment type. Eg: SingleServer/ThreeTier DeploymentType *SAPDeploymentType } @@ -1102,11 +1045,14 @@ type SAPVirtualInstance struct { // REQUIRED; The geo-location where the resource lives Location *string - // REQUIRED; Defines the Virtual Instance for SAP solutions resource properties. - Properties *SAPVirtualInstanceProperties + // READ-ONLY; The name of the Virtual Instances for SAP solutions resource + Name *string - // Managed service identity (user assigned identities) - Identity *UserAssignedServiceIdentity + // The managed service identities assigned to this resource. + Identity *SAPVirtualInstanceIdentity + + // The resource-specific properties for this resource. + Properties *SAPVirtualInstanceProperties // Resource tags. Tags map[string]*string @@ -1114,9 +1060,6 @@ type SAPVirtualInstance struct { // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource - Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData @@ -1130,13 +1073,22 @@ type SAPVirtualInstanceError struct { Properties *ErrorDefinition } -// SAPVirtualInstanceList - Defines the collection of Virtual Instance for SAP solutions resources. -type SAPVirtualInstanceList struct { - // Gets the value of next link. - NextLink *string +// SAPVirtualInstanceIdentity - Managed service identity (user assigned identities) +type SAPVirtualInstanceIdentity struct { + // REQUIRED; The type of managed identity assigned to this resource. + Type *SAPVirtualInstanceIdentityType - // Gets the list of Virtual Instances for SAP solutions resources. + // The identities assigned to this resource by the user. + UserAssignedIdentities map[string]*UserAssignedIdentity +} + +// SAPVirtualInstanceListResult - The response of a SAPVirtualInstance list operation. +type SAPVirtualInstanceListResult struct { + // REQUIRED; The SAPVirtualInstance items on this page Value []*SAPVirtualInstance + + // The link to the next page of items + NextLink *string } // SAPVirtualInstanceProperties - Defines the Virtual Instance for SAP solutions resource properties. @@ -1155,10 +1107,9 @@ type SAPVirtualInstanceProperties struct { ManagedResourceGroupConfiguration *ManagedRGConfiguration // Specifies the network access configuration for the resources that will be deployed in the Managed Resource Group. The options - // to choose from are Public and Private. If 'Private' is chosen, the Storage - // Account service tag should be enabled on the subnets in which the SAP VMs exist. This is required for establishing connectivity - // between VM extensions and the managed resource group storage account. - // This setting is currently applicable only to Storage Account. Learn more here https://go.microsoft.com/fwlink/?linkid=2247228 + // to choose from are Public and Private. If 'Private' is chosen, the Storage Account service tag should be enabled on the + // subnets in which the SAP VMs exist. This is required for establishing connectivity between VM extensions and the managed + // resource group storage account. This setting is currently applicable only to Storage Account. Learn more here https://go.microsoft.com/fwlink/?linkid=2247228 ManagedResourcesNetworkAccessType *ManagedResourcesNetworkAccessType // READ-ONLY; Indicates any errors on the Virtual Instance for SAP solutions resource. @@ -1184,7 +1135,7 @@ type SSHConfiguration struct { } // SSHKeyPair - The SSH Key-pair used to authenticate with the VM. The key needs to be at least 2048-bit and in ssh-rsa format. -// For creating ssh keys, see Create SSH keys on Linux and Mac for Linux VMs in Azure [https://docs.microsoft.com/azure/virtual-machines/linux/create-ssh-keys-detailed]. +//

For creating ssh keys, see [Create SSH keys on Linux and Mac for Linux VMs in Azure](https://docs.microsoft.com/azure/virtual-machines/linux/create-ssh-keys-detailed). type SSHKeyPair struct { // SSH private key. PrivateKey *string @@ -1197,8 +1148,7 @@ type SSHKeyPair struct { // is placed. type SSHPublicKey struct { // SSH public key certificate used to authenticate with the VM through ssh. The key needs to be at least 2048-bit and in ssh-rsa - // format. - // For creating ssh keys, see Create SSH keys on Linux and Mac for Linux VMs in Azure [https://docs.microsoft.com/azure/virtual-machines/linux/create-ssh-keys-detailed]. + // format.

For creating ssh keys, see [Create SSH keys on Linux and Mac for Linux VMs in Azure](https://docs.microsoft.com/azure/virtual-machines/linux/create-ssh-keys-detailed). KeyData *string } @@ -1216,7 +1166,8 @@ type ServiceInitiatedSoftwareConfiguration struct { // REQUIRED; The FQDN to set for the SAP system during install. SapFqdn *string - // REQUIRED; The SAP software installation Type. + // CONSTANT; The SAP software installation Type, service initiated in this case. + // Field has constant value SAPSoftwareInstallationTypeServiceInitiated, any specified value is ignored. SoftwareInstallationType *SAPSoftwareInstallationType // REQUIRED; The software version to install. @@ -1243,12 +1194,13 @@ type SharedStorageResourceNames struct { } // SingleServerConfiguration - Gets or sets the single server configuration. For prerequisites for creating the infrastructure, -// please see here [https://go.microsoft.com/fwlink/?linkid=2212611&clcid=0x409] +// please see [here](https://go.microsoft.com/fwlink/?linkid=2212611&clcid=0x409) type SingleServerConfiguration struct { // REQUIRED; The application resource group where SAP system resources will be deployed. AppResourceGroup *string - // REQUIRED; The type of SAP deployment, single server or Three tier. + // CONSTANT; The type of SAP deployment, single server in this case. + // Field has constant value SAPDeploymentTypeSingleServer, any specified value is ignored. DeploymentType *SAPDeploymentType // REQUIRED; The subnet id. @@ -1281,7 +1233,7 @@ func (s *SingleServerConfiguration) GetInfrastructureConfiguration() *Infrastruc // SingleServerCustomResourceNames - The resource-names input to specify custom names for underlying azure resources that // are part of a single server SAP system. type SingleServerCustomResourceNames struct { - // REQUIRED; The pattern type to be used for resource naming. + // REQUIRED; The naming pattern type. NamingPatternType *NamingPatternType } @@ -1293,7 +1245,8 @@ func (s *SingleServerCustomResourceNames) GetSingleServerCustomResourceNames() * // SingleServerFullResourceNames - The resource name object where the specified values will be full resource names of the // corresponding resources in a single server SAP system. type SingleServerFullResourceNames struct { - // REQUIRED; The pattern type to be used for resource naming. + // CONSTANT; The pattern type to be used for resource naming. + // Field has constant value NamingPatternTypeFullResourceName, any specified value is ignored. NamingPatternType *NamingPatternType // The resource names object for virtual machine and related resources. @@ -1309,7 +1262,7 @@ func (s *SingleServerFullResourceNames) GetSingleServerCustomResourceNames() *Si // SingleServerRecommendationResult - The recommended configuration for a single server SAP system. type SingleServerRecommendationResult struct { - // REQUIRED; The type of SAP deployment, single server or Three tier. + // REQUIRED; The single server SAP deployment type. DeploymentType *SAPDeploymentType // The recommended VM SKU for single server. @@ -1326,8 +1279,9 @@ func (s *SingleServerRecommendationResult) GetSAPSizingRecommendationResult() *S // SkipFileShareConfiguration - Gets or sets the file share configuration for scenarios where transport directory fileshare // is not created or required. type SkipFileShareConfiguration struct { - // REQUIRED; The type of file share config. - ConfigurationType *ConfigurationType + // CONSTANT; The type of file share config, skip in this case i.e. fileshare is not created or required. + // Field has constant value FileShareConfigurationTypeSkip, any specified value is ignored. + ConfigurationType *FileShareConfigurationType } // GetFileShareConfiguration implements the FileShareConfigurationClassification interface for type SkipFileShareConfiguration. @@ -1339,7 +1293,7 @@ func (s *SkipFileShareConfiguration) GetFileShareConfiguration() *FileShareConfi // SoftwareConfiguration - The SAP Software configuration Input. type SoftwareConfiguration struct { - // REQUIRED; The SAP software installation Type. + // REQUIRED; The SAP software installation type. SoftwareInstallationType *SAPSoftwareInstallationType } @@ -1358,8 +1312,8 @@ type StopRequest struct { DeallocateVM *bool // This parameter defines how long (in seconds) the soft shutdown waits until the RFC/HTTP clients no longer consider the - // server for calls with load balancing. Value 0 means that the kernel does not - // wait, but goes directly into the next shutdown state, i.e. hard stop. + // server for calls with load balancing. Value 0 means that the kernel does not wait, but goes directly into the next shutdown + // state, i.e. hard stop. SoftStopTimeoutSeconds *int64 } @@ -1372,7 +1326,7 @@ type StorageConfiguration struct { // StorageInformation - Storage details of all the Storage accounts attached to the VM. For e.g. NFS on AFS Shared Storage. type StorageInformation struct { - // READ-ONLY + // READ-ONLY; Fully qualified resource ID for the storage account. ID *string } @@ -1398,7 +1352,7 @@ type SystemData struct { } // ThreeTierConfiguration - Gets or sets the three tier SAP configuration. For prerequisites for creating the infrastructure, -// please see here [https://go.microsoft.com/fwlink/?linkid=2212611&clcid=0x409] +// please see [here](https://go.microsoft.com/fwlink/?linkid=2212611&clcid=0x409) type ThreeTierConfiguration struct { // REQUIRED; The application resource group where SAP system resources will be deployed. AppResourceGroup *string @@ -1412,7 +1366,8 @@ type ThreeTierConfiguration struct { // REQUIRED; The database configuration. DatabaseServer *DatabaseConfiguration - // REQUIRED; The type of SAP deployment, single server or Three tier. + // CONSTANT; The type of SAP deployment, ThreeTier in this case. + // Field has constant value SAPDeploymentTypeThreeTier, any specified value is ignored. DeploymentType *SAPDeploymentType // The set of custom names to be used for underlying azure resources that are part of the SAP system. @@ -1451,7 +1406,8 @@ func (t *ThreeTierCustomResourceNames) GetThreeTierCustomResourceNames() *ThreeT // ThreeTierFullResourceNames - The resource name object where the specified values will be full resource names of the corresponding // resources in a three tier SAP system. type ThreeTierFullResourceNames struct { - // REQUIRED; The pattern type to be used for resource naming. + // CONSTANT; The pattern type to be used for resource naming, FullResourceName in this case. + // Field has constant value NamingPatternTypeFullResourceName, any specified value is ignored. NamingPatternType *NamingPatternType // The full resource names object for application layer resources. The number of entries in this list should be equal to the @@ -1478,7 +1434,7 @@ func (t *ThreeTierFullResourceNames) GetThreeTierCustomResourceNames() *ThreeTie // ThreeTierRecommendationResult - The recommended configuration for a three tier SAP system. type ThreeTierRecommendationResult struct { - // REQUIRED; The type of SAP deployment, single server or Three tier. + // REQUIRED; The three tier SAP deployment type. DeploymentType *SAPDeploymentType // The application server instance count. @@ -1525,22 +1481,21 @@ type UpdateSAPDatabaseInstanceRequest struct { Tags map[string]*string } -// UpdateSAPVirtualInstanceProperties - Defines the properties to be updated for Virtual Instance for SAP. +// UpdateSAPVirtualInstanceProperties - Defines the update request body properties for updating Virtual Instance for SAP. type UpdateSAPVirtualInstanceProperties struct { // Specifies the network access configuration for the resources that will be deployed in the Managed Resource Group. The options - // to choose from are Public and Private. If 'Private' is chosen, the Storage - // Account service tag should be enabled on the subnets in which the SAP VMs exist. This is required for establishing connectivity - // between VM extensions and the managed resource group storage account. - // This setting is currently applicable only to Storage Account. Learn more here https://go.microsoft.com/fwlink/?linkid=2247228 + // to choose from are Public and Private. If 'Private' is chosen, the Storage Account service tag should be enabled on the + // subnets in which the SAP VMs exist. This is required for establishing connectivity between VM extensions and the managed + // resource group storage account. This setting is currently applicable only to Storage Account. Learn more here https://go.microsoft.com/fwlink/?linkid=2247228 ManagedResourcesNetworkAccessType *ManagedResourcesNetworkAccessType } // UpdateSAPVirtualInstanceRequest - Defines the request body for updating Virtual Instance for SAP. type UpdateSAPVirtualInstanceRequest struct { // Managed service identity (user assigned identities) - Identity *UserAssignedServiceIdentity + Identity *SAPVirtualInstanceIdentity - // Defines the properties to be updated for Virtual Instance for SAP. + // The update properties. Properties *UpdateSAPVirtualInstanceProperties // Gets or sets the Resource tags. @@ -1556,15 +1511,6 @@ type UserAssignedIdentity struct { PrincipalID *string } -// UserAssignedServiceIdentity - Managed service identity (user assigned identities) -type UserAssignedServiceIdentity struct { - // REQUIRED; Type of manage identity - Type *ManagedServiceIdentityType - - // User assigned identities dictionary - UserAssignedIdentities map[string]*UserAssignedIdentity -} - // VirtualMachineConfiguration - Defines the virtual machine configuration. type VirtualMachineConfiguration struct { // REQUIRED; The image reference. @@ -1580,13 +1526,12 @@ type VirtualMachineConfiguration struct { // VirtualMachineResourceNames - The resource names object for virtual machine and related resources. type VirtualMachineResourceNames struct { // The full resource names for virtual machine data disks. This is a dictionary containing list of names of data disks per - // volume. Currently supported volumes for database layer are ['hana/data', - // 'hana/log', hana/shared', 'usr/sap', 'os', 'backup']. For application and cs layers, only 'default' volume is supported + // volume. Currently supported volumes for database layer are ['hana/data', 'hana/log', hana/shared', 'usr/sap', 'os', 'backup']. + // For application and cs layers, only 'default' volume is supported DataDiskNames map[string][]*string // The full name for virtual-machine's host (computer name). Currently, ACSS only supports host names which are less than - // or equal to 13 characters long. If this value is not provided, vmName will be - // used as host name. + // or equal to 13 characters long. If this value is not provided, vmName will be used as host name. HostName *string // The list of network interface name objects for the selected virtual machine. Currently, only one network interface is supported @@ -1594,21 +1539,21 @@ type VirtualMachineResourceNames struct { NetworkInterfaces []*NetworkInterfaceResourceNames // The full name for OS disk attached to the VM. If this value is not provided, it will be named by ARM as per its default - // naming standards (prefixed with vm name). There is only one OS disk attached per - // Virtual Machine. + // naming standards (prefixed with vm name). There is only one OS disk attached per Virtual Machine. OSDiskName *string // The full name for virtual machine. The length of this field can be upto 64 characters. If name is not provided, service - // uses a default name based on the deployment type. For SingleServer, default name - // is {SID}vm. In case of HA-AvZone systems, default name will be {SID}{app/ascs/db}z{a/b}vm with an incrementor at the end - // in case of more than 1 vm per layer. For distributed and HA-AvSet systems, - // default name will be {SID}{app/ascs/db}vm with an incrementor at the end in case of more than 1 vm per layer. + // uses a default name based on the deployment type. For SingleServer, default name is {SID}vm. In case of HA-AvZone systems, + // default name will be {SID}{app/ascs/db}z{a/b}vm with an incrementor at the end in case of more than 1 vm per layer. For + // distributed and HA-AvSet systems, default name will be {SID}{app/ascs/db}vm with an incrementor at the end in case of more + // than 1 vm per layer. VMName *string } // WindowsConfiguration - Specifies Windows operating system settings on the virtual machine. type WindowsConfiguration struct { - // REQUIRED; The OS Type + // CONSTANT; The OS Type + // Field has constant value OSTypeWindows, any specified value is ignored. OSType *OSType } diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/models_serde.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/models_serde.go index a4cbf08d5ef7..77703778cf0b 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/models_serde.go +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/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 armworkloadssapvirtualinstance @@ -224,7 +220,7 @@ func (c *CentralServerVMDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type CreateAndMountFileShareConfiguration. func (c CreateAndMountFileShareConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["configurationType"] = ConfigurationTypeCreateAndMount + objectMap["configurationType"] = FileShareConfigurationTypeCreateAndMount populate(objectMap, "resourceGroup", c.ResourceGroup) populate(objectMap, "storageAccountName", c.StorageAccountName) return json.Marshal(objectMap) @@ -754,7 +750,7 @@ func (e *EnqueueServerProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateAny(objectMap, "info", e.Info) + populate(objectMap, "info", e.Info) populate(objectMap, "type", e.Type) return json.Marshal(objectMap) } @@ -894,7 +890,7 @@ func (e *ExternalInstallationSoftwareConfiguration) UnmarshalJSON(data []byte) e // MarshalJSON implements the json.Marshaller interface for type FileShareConfiguration. func (f FileShareConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["configurationType"] = f.ConfigurationType + populate(objectMap, "configurationType", f.ConfigurationType) return json.Marshal(objectMap) } @@ -1054,7 +1050,7 @@ func (i *ImageReference) UnmarshalJSON(data []byte) error { func (i InfrastructureConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "appResourceGroup", i.AppResourceGroup) - objectMap["deploymentType"] = i.DeploymentType + populate(objectMap, "deploymentType", i.DeploymentType) return json.Marshal(objectMap) } @@ -1267,7 +1263,7 @@ func (m *MessageServerProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type MountFileShareConfiguration. func (m MountFileShareConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["configurationType"] = ConfigurationTypeMount + objectMap["configurationType"] = FileShareConfigurationTypeMount populate(objectMap, "id", m.ID) populate(objectMap, "privateEndpointId", m.PrivateEndpointID) return json.Marshal(objectMap) @@ -1356,7 +1352,7 @@ func (n *NetworkInterfaceResourceNames) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type OSConfiguration. func (o OSConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["osType"] = o.OSType + populate(objectMap, "osType", o.OSType) return json.Marshal(objectMap) } @@ -1415,119 +1411,6 @@ func (o *OSProfile) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type Operation. -func (o Operation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "actionType", o.ActionType) - populate(objectMap, "display", o.Display) - populate(objectMap, "isDataAction", o.IsDataAction) - populate(objectMap, "name", o.Name) - populate(objectMap, "origin", o.Origin) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. -func (o *Operation) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "actionType": - err = unpopulate(val, "ActionType", &o.ActionType) - delete(rawMsg, key) - case "display": - err = unpopulate(val, "Display", &o.Display) - delete(rawMsg, key) - case "isDataAction": - err = unpopulate(val, "IsDataAction", &o.IsDataAction) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &o.Name) - delete(rawMsg, key) - case "origin": - err = unpopulate(val, "Origin", &o.Origin) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. -func (o OperationDisplay) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "description", o.Description) - populate(objectMap, "operation", o.Operation) - populate(objectMap, "provider", o.Provider) - populate(objectMap, "resource", o.Resource) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. -func (o *OperationDisplay) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "description": - err = unpopulate(val, "Description", &o.Description) - delete(rawMsg, key) - case "operation": - err = unpopulate(val, "Operation", &o.Operation) - delete(rawMsg, key) - case "provider": - err = unpopulate(val, "Provider", &o.Provider) - delete(rawMsg, key) - case "resource": - err = unpopulate(val, "Resource", &o.Resource) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type OperationListResult. -func (o OperationListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", o.NextLink) - populate(objectMap, "value", o.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. -func (o *OperationListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &o.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &o.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type OperationStatusResult. func (o OperationStatusResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1665,16 +1548,16 @@ func (s *SAPApplicationServerInstance) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SAPApplicationServerInstanceList. -func (s SAPApplicationServerInstanceList) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SAPApplicationServerInstanceListResult. +func (s SAPApplicationServerInstanceListResult) 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 SAPApplicationServerInstanceList. -func (s *SAPApplicationServerInstanceList) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SAPApplicationServerInstanceListResult. +func (s *SAPApplicationServerInstanceListResult) 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) @@ -1876,37 +1759,6 @@ func (s *SAPAvailabilityZonePair) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SAPCentralInstanceList. -func (s SAPCentralInstanceList) 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 SAPCentralInstanceList. -func (s *SAPCentralInstanceList) 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 SAPCentralServerInstance. func (s SAPCentralServerInstance) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1958,6 +1810,37 @@ func (s *SAPCentralServerInstance) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type SAPCentralServerInstanceListResult. +func (s SAPCentralServerInstanceListResult) 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 SAPCentralServerInstanceListResult. +func (s *SAPCentralServerInstanceListResult) 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 SAPCentralServerProperties. func (s SAPCentralServerProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -2040,7 +1923,7 @@ func (s *SAPCentralServerProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SAPConfiguration. func (s SAPConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["configurationType"] = s.ConfigurationType + populate(objectMap, "configurationType", s.ConfigurationType) return json.Marshal(objectMap) } @@ -2115,16 +1998,16 @@ func (s *SAPDatabaseInstance) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SAPDatabaseInstanceList. -func (s SAPDatabaseInstanceList) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SAPDatabaseInstanceListResult. +func (s SAPDatabaseInstanceListResult) 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 SAPDatabaseInstanceList. -func (s *SAPDatabaseInstanceList) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SAPDatabaseInstanceListResult. +func (s *SAPDatabaseInstanceListResult) 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) @@ -2415,7 +2298,7 @@ func (s *SAPSizingRecommendationRequest) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SAPSizingRecommendationResult. func (s SAPSizingRecommendationResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["deploymentType"] = s.DeploymentType + populate(objectMap, "deploymentType", s.DeploymentType) return json.Marshal(objectMap) } @@ -2630,16 +2513,47 @@ func (s *SAPVirtualInstanceError) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SAPVirtualInstanceList. -func (s SAPVirtualInstanceList) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SAPVirtualInstanceIdentity. +func (s SAPVirtualInstanceIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "type", s.Type) + populate(objectMap, "userAssignedIdentities", s.UserAssignedIdentities) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SAPVirtualInstanceIdentity. +func (s *SAPVirtualInstanceIdentity) 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 "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + case "userAssignedIdentities": + err = unpopulate(val, "UserAssignedIdentities", &s.UserAssignedIdentities) + 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 SAPVirtualInstanceListResult. +func (s SAPVirtualInstanceListResult) 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 SAPVirtualInstanceList. -func (s *SAPVirtualInstanceList) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SAPVirtualInstanceListResult. +func (s *SAPVirtualInstanceListResult) 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) @@ -2949,7 +2863,7 @@ func (s *SingleServerConfiguration) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SingleServerCustomResourceNames. func (s SingleServerCustomResourceNames) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["namingPatternType"] = s.NamingPatternType + populate(objectMap, "namingPatternType", s.NamingPatternType) return json.Marshal(objectMap) } @@ -3038,7 +2952,7 @@ func (s *SingleServerRecommendationResult) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SkipFileShareConfiguration. func (s SkipFileShareConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["configurationType"] = ConfigurationTypeSkip + objectMap["configurationType"] = FileShareConfigurationTypeSkip return json.Marshal(objectMap) } @@ -3065,7 +2979,7 @@ func (s *SkipFileShareConfiguration) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SoftwareConfiguration. func (s SoftwareConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["softwareInstallationType"] = s.SoftwareInstallationType + populate(objectMap, "softwareInstallationType", s.SoftwareInstallationType) return json.Marshal(objectMap) } @@ -3310,7 +3224,7 @@ func (t *ThreeTierConfiguration) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ThreeTierCustomResourceNames. func (t ThreeTierCustomResourceNames) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["namingPatternType"] = t.NamingPatternType + populate(objectMap, "namingPatternType", t.NamingPatternType) return json.Marshal(objectMap) } @@ -3602,37 +3516,6 @@ func (u *UserAssignedIdentity) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type UserAssignedServiceIdentity. -func (u UserAssignedServiceIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "type", u.Type) - populate(objectMap, "userAssignedIdentities", u.UserAssignedIdentities) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type UserAssignedServiceIdentity. -func (u *UserAssignedServiceIdentity) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "type": - err = unpopulate(val, "Type", &u.Type) - delete(rawMsg, key) - case "userAssignedIdentities": - err = unpopulate(val, "UserAssignedIdentities", &u.UserAssignedIdentities) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type VirtualMachineConfiguration. func (v VirtualMachineConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -3748,16 +3631,6 @@ func populate(m map[string]any, k string, v any) { } } -func populateAny(m map[string]any, k string, v any) { - if v == nil { - return - } else if azcore.IsNullValue(v) { - m[k] = nil - } else { - m[k] = v - } -} - func unpopulate(data json.RawMessage, fn string, v any) error { if data == nil || string(data) == "null" { return nil diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/operations_client_example_test.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/operations_client_example_test.go deleted file mode 100644 index 5d08b8a4c4be..000000000000 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/operations_client_example_test.go +++ /dev/null @@ -1,316 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armworkloadssapvirtualinstance_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/operations/preview/2023-10-01-preview/examples/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 := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOperationsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OperationListResult = armworkloadssapvirtualinstance.OperationListResult{ - // Value: []*armworkloadssapvirtualinstance.Operation{ - // { - // Name: to.Ptr("Microsoft.Workloads/monitors/read"), - // Display: &armworkloadssapvirtualinstance.OperationDisplay{ - // Description: to.Ptr("Gets a list of SAP monitors in the specified subscription. The operations returns various properties of each SAP monitor."), - // Operation: to.Ptr("monitors_List"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("monitors"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/monitors/read"), - // Display: &armworkloadssapvirtualinstance.OperationDisplay{ - // Description: to.Ptr("Gets a list of SAP monitors in the specified resource group."), - // Operation: to.Ptr("monitors_ListByResourceGroup"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("monitors"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/monitors/read"), - // Display: &armworkloadssapvirtualinstance.OperationDisplay{ - // Description: to.Ptr("Gets properties of a SAP monitor for the specified subscription, resource group, and resource name."), - // Operation: to.Ptr("monitors_Get"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("monitors"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/monitors/write"), - // Display: &armworkloadssapvirtualinstance.OperationDisplay{ - // Description: to.Ptr("Creates a SAP monitor for the specified subscription, resource group, and resource name."), - // Operation: to.Ptr("monitors_Create"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("monitors"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/monitors/delete"), - // Display: &armworkloadssapvirtualinstance.OperationDisplay{ - // Description: to.Ptr("Deletes a SAP monitor with the specified subscription, resource group, and monitor name."), - // Operation: to.Ptr("monitors_Delete"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("monitors"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/monitors/write"), - // Display: &armworkloadssapvirtualinstance.OperationDisplay{ - // Description: to.Ptr("Patches the Tags field of a SAP monitor for the specified subscription, resource group, and monitor name."), - // Operation: to.Ptr("monitors_Update"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("monitors"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/monitors/providerInstances/read"), - // Display: &armworkloadssapvirtualinstance.OperationDisplay{ - // Description: to.Ptr("Gets a list of provider instances in the specified SAP monitor. The operations returns various properties of each provider instances."), - // Operation: to.Ptr("ProviderInstances_List"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("monitors/providerInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/monitors/providerInstances/read"), - // Display: &armworkloadssapvirtualinstance.OperationDisplay{ - // Description: to.Ptr("Gets properties of a provider instance for the specified subscription, resource group, Monitor name, and resource name."), - // Operation: to.Ptr("ProviderInstances_Get"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("monitors/providerInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/monitors/providerInstances/write"), - // Display: &armworkloadssapvirtualinstance.OperationDisplay{ - // Description: to.Ptr("Creates a provider instance for the specified subscription, resource group, Monitor name, and resource name."), - // Operation: to.Ptr("ProviderInstances_Create"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("monitors/providerInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/monitors/providerInstances/delete"), - // Display: &armworkloadssapvirtualinstance.OperationDisplay{ - // Description: to.Ptr("Deletes a provider instance for the specified subscription, resource group, Monitor name, and resource name."), - // Operation: to.Ptr("ProviderInstances_Delete"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("monitors/providerInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/monitors/sapLandscapeMonitor/read"), - // Display: &armworkloadssapvirtualinstance.OperationDisplay{ - // Description: to.Ptr("Gets a list of properties of a SAP Landscape monitor configuration for the specified subscription, resource group, and resource name."), - // Operation: to.Ptr("SapLandscapeMonitor_List"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("monitors/sapLandscapeMonitor"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/monitors/sapLandscapeMonitor/read"), - // Display: &armworkloadssapvirtualinstance.OperationDisplay{ - // Description: to.Ptr("Gets properties of a SAP Landscape monitor configuration for the specified subscription, resource group, and resource name."), - // Operation: to.Ptr("SapLandscapeMonitor_Get"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("monitors/sapLandscapeMonitor"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/monitors/sapLandscapeMonitor/write"), - // Display: &armworkloadssapvirtualinstance.OperationDisplay{ - // Description: to.Ptr("Creates a SAP Landscape monitor configuration for the specified subscription, resource group, and resource name."), - // Operation: to.Ptr("SapLandscapeMonitor_Create"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("monitors/sapLandscapeMonitor"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/monitors/sapLandscapeMonitor/delete"), - // Display: &armworkloadssapvirtualinstance.OperationDisplay{ - // Description: to.Ptr("Deletes a SAP Landscape monitor configuration with the specified subscription, resource group, and monitor name."), - // Operation: to.Ptr("SapLandscapeMonitor_Delete"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("monitors/sapLandscapeMonitor"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/SapDiscoverySites/Write"), - // Display: &armworkloadssapvirtualinstance.OperationDisplay{ - // Description: to.Ptr("Set SapDiscoverySites"), - // Operation: to.Ptr("Creates or updates the SapDiscoverySites"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("SapDiscoverySites"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/SapDiscoverySites/Delete"), - // Display: &armworkloadssapvirtualinstance.OperationDisplay{ - // Description: to.Ptr("Delete SapDiscoverySites"), - // Operation: to.Ptr("Deletes the SapDiscoverySites"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("SapDiscoverySites"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/SapDiscoverySites/Read"), - // Display: &armworkloadssapvirtualinstance.OperationDisplay{ - // Description: to.Ptr("Read SapDiscoverySites"), - // Operation: to.Ptr("Reads the SapDiscoverySites"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("SapDiscoverySites"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/SapDiscoverySites/SapInstances/Write"), - // Display: &armworkloadssapvirtualinstance.OperationDisplay{ - // Description: to.Ptr("Set SapInstances"), - // Operation: to.Ptr("Creates or updates the SapInstances"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("SapInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/SapDiscoverySites/SapInstances/Delete"), - // Display: &armworkloadssapvirtualinstance.OperationDisplay{ - // Description: to.Ptr("Delete SapInstances"), - // Operation: to.Ptr("Deletes the SapInstances"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("SapInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/SapDiscoverySites/SapInstances/Read"), - // Display: &armworkloadssapvirtualinstance.OperationDisplay{ - // Description: to.Ptr("Read SapInstances"), - // Operation: to.Ptr("Reads the SapInstances"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("SapInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/SapDiscoverySites/SapInstances/serverInstances/Write"), - // Display: &armworkloadssapvirtualinstance.OperationDisplay{ - // Description: to.Ptr("Set serverInstances"), - // Operation: to.Ptr("Creates or updates the serverInstances"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("serverInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/SapDiscoverySites/SapInstances/serverInstances/Delete"), - // Display: &armworkloadssapvirtualinstance.OperationDisplay{ - // Description: to.Ptr("Delete serverInstances"), - // Operation: to.Ptr("Deletes the serverInstances"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("serverInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/SapDiscoverySites/SapInstances/serverInstances/Read"), - // Display: &armworkloadssapvirtualinstance.OperationDisplay{ - // Description: to.Ptr("Read serverInstances"), - // Operation: to.Ptr("Reads the serverInstances"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("serverInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/connectors/Write"), - // Display: &armworkloadssapvirtualinstance.OperationDisplay{ - // Description: to.Ptr("Set connectors"), - // Operation: to.Ptr("Creates or updates the connectors"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("connectors"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/connectors/Read"), - // Display: &armworkloadssapvirtualinstance.OperationDisplay{ - // Description: to.Ptr("Read connectors"), - // Operation: to.Ptr("Reads the connectors"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("connectors"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/connectors/acssBackups/Write"), - // Display: &armworkloadssapvirtualinstance.OperationDisplay{ - // Description: to.Ptr("Set acssBackups"), - // Operation: to.Ptr("Creates or updates the acssBackups"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("acssBackups"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.Workloads/connectors/acssBackups/Read"), - // Display: &armworkloadssapvirtualinstance.OperationDisplay{ - // Description: to.Ptr("Read acssBackups"), - // Operation: to.Ptr("Reads the acssBackups"), - // Provider: to.Ptr("Microsoft.Workloads"), - // Resource: to.Ptr("acssBackups"), - // }, - // IsDataAction: to.Ptr(false), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/options.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/options.go index af565915360c..bee0753c9532 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/options.go +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/options.go @@ -1,50 +1,41 @@ -//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 armworkloadssapvirtualinstance -// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. -type OperationsClientListOptions struct { - // placeholder for future optional parameters -} - // SAPApplicationServerInstancesClientBeginCreateOptions contains the optional parameters for the SAPApplicationServerInstancesClient.BeginCreate // method. type SAPApplicationServerInstancesClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // SAPApplicationServerInstancesClientBeginDeleteOptions contains the optional parameters for the SAPApplicationServerInstancesClient.BeginDelete // method. type SAPApplicationServerInstancesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } -// SAPApplicationServerInstancesClientBeginStartInstanceOptions contains the optional parameters for the SAPApplicationServerInstancesClient.BeginStartInstance +// SAPApplicationServerInstancesClientBeginStartOptions contains the optional parameters for the SAPApplicationServerInstancesClient.BeginStart // method. -type SAPApplicationServerInstancesClientBeginStartInstanceOptions struct { +type SAPApplicationServerInstancesClientBeginStartOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string + // SAP Application server instance start request body. Body *StartRequest - - // Resumes the LRO from the provided token. - ResumeToken string } -// SAPApplicationServerInstancesClientBeginStopInstanceOptions contains the optional parameters for the SAPApplicationServerInstancesClient.BeginStopInstance +// SAPApplicationServerInstancesClientBeginStopOptions contains the optional parameters for the SAPApplicationServerInstancesClient.BeginStop // method. -type SAPApplicationServerInstancesClientBeginStopInstanceOptions struct { +type SAPApplicationServerInstancesClientBeginStopOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string + // SAP Application server instance stop request body. Body *StopRequest - - // Resumes the LRO from the provided token. - ResumeToken string } // SAPApplicationServerInstancesClientGetOptions contains the optional parameters for the SAPApplicationServerInstancesClient.Get @@ -65,87 +56,90 @@ type SAPApplicationServerInstancesClientUpdateOptions struct { // placeholder for future optional parameters } -// SAPCentralInstancesClientBeginCreateOptions contains the optional parameters for the SAPCentralInstancesClient.BeginCreate +// SAPCentralServerInstancesClientBeginCreateOptions contains the optional parameters for the SAPCentralServerInstancesClient.BeginCreate // method. -type SAPCentralInstancesClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. +type SAPCentralServerInstancesClientBeginCreateOptions struct { + // Resumes the long-running operation from the provided token. ResumeToken string } -// SAPCentralInstancesClientBeginDeleteOptions contains the optional parameters for the SAPCentralInstancesClient.BeginDelete +// SAPCentralServerInstancesClientBeginDeleteOptions contains the optional parameters for the SAPCentralServerInstancesClient.BeginDelete // method. -type SAPCentralInstancesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. +type SAPCentralServerInstancesClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. ResumeToken string } -// SAPCentralInstancesClientBeginStartInstanceOptions contains the optional parameters for the SAPCentralInstancesClient.BeginStartInstance +// SAPCentralServerInstancesClientBeginStartOptions contains the optional parameters for the SAPCentralServerInstancesClient.BeginStart // method. -type SAPCentralInstancesClientBeginStartInstanceOptions struct { +type SAPCentralServerInstancesClientBeginStartOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string + // SAP Central Services instance start request body. Body *StartRequest - - // Resumes the LRO from the provided token. - ResumeToken string } -// SAPCentralInstancesClientBeginStopInstanceOptions contains the optional parameters for the SAPCentralInstancesClient.BeginStopInstance +// SAPCentralServerInstancesClientBeginStopOptions contains the optional parameters for the SAPCentralServerInstancesClient.BeginStop // method. -type SAPCentralInstancesClientBeginStopInstanceOptions struct { +type SAPCentralServerInstancesClientBeginStopOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string + // SAP Central Services instance stop request body. Body *StopRequest - - // Resumes the LRO from the provided token. - ResumeToken string } -// SAPCentralInstancesClientGetOptions contains the optional parameters for the SAPCentralInstancesClient.Get method. -type SAPCentralInstancesClientGetOptions struct { +// SAPCentralServerInstancesClientGetOptions contains the optional parameters for the SAPCentralServerInstancesClient.Get +// method. +type SAPCentralServerInstancesClientGetOptions struct { // placeholder for future optional parameters } -// SAPCentralInstancesClientListOptions contains the optional parameters for the SAPCentralInstancesClient.NewListPager method. -type SAPCentralInstancesClientListOptions struct { +// SAPCentralServerInstancesClientListOptions contains the optional parameters for the SAPCentralServerInstancesClient.NewListPager +// method. +type SAPCentralServerInstancesClientListOptions struct { // placeholder for future optional parameters } -// SAPCentralInstancesClientUpdateOptions contains the optional parameters for the SAPCentralInstancesClient.Update method. -type SAPCentralInstancesClientUpdateOptions struct { +// SAPCentralServerInstancesClientUpdateOptions contains the optional parameters for the SAPCentralServerInstancesClient.Update +// method. +type SAPCentralServerInstancesClientUpdateOptions struct { // placeholder for future optional parameters } // SAPDatabaseInstancesClientBeginCreateOptions contains the optional parameters for the SAPDatabaseInstancesClient.BeginCreate // method. type SAPDatabaseInstancesClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // SAPDatabaseInstancesClientBeginDeleteOptions contains the optional parameters for the SAPDatabaseInstancesClient.BeginDelete // method. type SAPDatabaseInstancesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } -// SAPDatabaseInstancesClientBeginStartInstanceOptions contains the optional parameters for the SAPDatabaseInstancesClient.BeginStartInstance +// SAPDatabaseInstancesClientBeginStartOptions contains the optional parameters for the SAPDatabaseInstancesClient.BeginStart // method. -type SAPDatabaseInstancesClientBeginStartInstanceOptions struct { +type SAPDatabaseInstancesClientBeginStartOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string + // SAP Database server instance start request body. Body *StartRequest - - // Resumes the LRO from the provided token. - ResumeToken string } -// SAPDatabaseInstancesClientBeginStopInstanceOptions contains the optional parameters for the SAPDatabaseInstancesClient.BeginStopInstance +// SAPDatabaseInstancesClientBeginStopOptions contains the optional parameters for the SAPDatabaseInstancesClient.BeginStop // method. -type SAPDatabaseInstancesClientBeginStopInstanceOptions struct { +type SAPDatabaseInstancesClientBeginStopOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string + // Stop request for the database instance of the SAP system. Body *StopRequest - - // Resumes the LRO from the provided token. - ResumeToken string } // SAPDatabaseInstancesClientGetOptions contains the optional parameters for the SAPDatabaseInstancesClient.Get method. @@ -167,84 +161,81 @@ type SAPDatabaseInstancesClientUpdateOptions struct { // SAPVirtualInstancesClientBeginCreateOptions contains the optional parameters for the SAPVirtualInstancesClient.BeginCreate // method. type SAPVirtualInstancesClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // SAPVirtualInstancesClientBeginDeleteOptions contains the optional parameters for the SAPVirtualInstancesClient.BeginDelete // method. type SAPVirtualInstancesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // SAPVirtualInstancesClientBeginStartOptions contains the optional parameters for the SAPVirtualInstancesClient.BeginStart // method. type SAPVirtualInstancesClientBeginStartOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string + // The Virtual Instance for SAP solutions resource start request body. Body *StartRequest - - // Resumes the LRO from the provided token. - ResumeToken string } // SAPVirtualInstancesClientBeginStopOptions contains the optional parameters for the SAPVirtualInstancesClient.BeginStop // method. type SAPVirtualInstancesClientBeginStopOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string + // The Virtual Instance for SAP solutions resource stop request body. Body *StopRequest - - // Resumes the LRO from the provided token. - ResumeToken string } // SAPVirtualInstancesClientBeginUpdateOptions contains the optional parameters for the SAPVirtualInstancesClient.BeginUpdate // method. type SAPVirtualInstancesClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } -// SAPVirtualInstancesClientGetOptions contains the optional parameters for the SAPVirtualInstancesClient.Get method. -type SAPVirtualInstancesClientGetOptions struct { +// SAPVirtualInstancesClientGetAvailabilityZoneDetailsOptions contains the optional parameters for the SAPVirtualInstancesClient.GetAvailabilityZoneDetails +// method. +type SAPVirtualInstancesClientGetAvailabilityZoneDetailsOptions struct { // placeholder for future optional parameters } -// SAPVirtualInstancesClientListByResourceGroupOptions contains the optional parameters for the SAPVirtualInstancesClient.NewListByResourceGroupPager +// SAPVirtualInstancesClientGetDiskConfigurationsOptions contains the optional parameters for the SAPVirtualInstancesClient.GetDiskConfigurations // method. -type SAPVirtualInstancesClientListByResourceGroupOptions struct { +type SAPVirtualInstancesClientGetDiskConfigurationsOptions struct { // placeholder for future optional parameters } -// SAPVirtualInstancesClientListBySubscriptionOptions contains the optional parameters for the SAPVirtualInstancesClient.NewListBySubscriptionPager -// method. -type SAPVirtualInstancesClientListBySubscriptionOptions struct { +// SAPVirtualInstancesClientGetOptions contains the optional parameters for the SAPVirtualInstancesClient.Get method. +type SAPVirtualInstancesClientGetOptions struct { // placeholder for future optional parameters } -// WorkloadsClientSAPAvailabilityZoneDetailsOptions contains the optional parameters for the WorkloadsClient.SAPAvailabilityZoneDetails +// SAPVirtualInstancesClientGetSapSupportedSKUOptions contains the optional parameters for the SAPVirtualInstancesClient.GetSapSupportedSKU // method. -type WorkloadsClientSAPAvailabilityZoneDetailsOptions struct { - // SAP Availability Zone Details Request body - SAPAvailabilityZoneDetails *SAPAvailabilityZoneDetailsRequest +type SAPVirtualInstancesClientGetSapSupportedSKUOptions struct { + // placeholder for future optional parameters } -// WorkloadsClientSAPDiskConfigurationsOptions contains the optional parameters for the WorkloadsClient.SAPDiskConfigurations +// SAPVirtualInstancesClientGetSizingRecommendationsOptions contains the optional parameters for the SAPVirtualInstancesClient.GetSizingRecommendations // method. -type WorkloadsClientSAPDiskConfigurationsOptions struct { - // SAP Disk Configurations Request body - SAPDiskConfigurations *SAPDiskConfigurationsRequest +type SAPVirtualInstancesClientGetSizingRecommendationsOptions struct { + // placeholder for future optional parameters } -// WorkloadsClientSAPSizingRecommendationsOptions contains the optional parameters for the WorkloadsClient.SAPSizingRecommendations +// SAPVirtualInstancesClientListByResourceGroupOptions contains the optional parameters for the SAPVirtualInstancesClient.NewListByResourceGroupPager // method. -type WorkloadsClientSAPSizingRecommendationsOptions struct { - // SAP Sizing Recommendation Request body - SAPSizingRecommendation *SAPSizingRecommendationRequest +type SAPVirtualInstancesClientListByResourceGroupOptions struct { + // placeholder for future optional parameters } -// WorkloadsClientSAPSupportedSKUOptions contains the optional parameters for the WorkloadsClient.SAPSupportedSKU method. -type WorkloadsClientSAPSupportedSKUOptions struct { - // SAP Supported SKU Request body - SAPSupportedSKU *SAPSupportedSKUsRequest +// SAPVirtualInstancesClientListBySubscriptionOptions contains the optional parameters for the SAPVirtualInstancesClient.NewListBySubscriptionPager +// method. +type SAPVirtualInstancesClientListBySubscriptionOptions struct { + // placeholder for future optional parameters } diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/polymorphic_helpers.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/polymorphic_helpers.go index 0d6862f0c70c..ccad72c54fb3 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/polymorphic_helpers.go +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/polymorphic_helpers.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armworkloadssapvirtualinstance @@ -20,12 +16,12 @@ func unmarshalFileShareConfigurationClassification(rawMsg json.RawMessage) (File } var b FileShareConfigurationClassification switch m["configurationType"] { - case string(ConfigurationTypeCreateAndMount): + case string(FileShareConfigurationTypeSkip): + b = &SkipFileShareConfiguration{} + case string(FileShareConfigurationTypeCreateAndMount): b = &CreateAndMountFileShareConfiguration{} - case string(ConfigurationTypeMount): + case string(FileShareConfigurationTypeMount): b = &MountFileShareConfiguration{} - case string(ConfigurationTypeSkip): - b = &SkipFileShareConfiguration{} default: b = &FileShareConfiguration{} } @@ -68,10 +64,10 @@ func unmarshalOSConfigurationClassification(rawMsg json.RawMessage) (OSConfigura } var b OSConfigurationClassification switch m["osType"] { - case string(OSTypeLinux): - b = &LinuxConfiguration{} case string(OSTypeWindows): b = &WindowsConfiguration{} + case string(OSTypeLinux): + b = &LinuxConfiguration{} default: b = &OSConfiguration{} } @@ -91,12 +87,12 @@ func unmarshalSAPConfigurationClassification(rawMsg json.RawMessage) (SAPConfigu } var b SAPConfigurationClassification switch m["configurationType"] { + case string(SAPConfigurationTypeDiscovery): + b = &DiscoveryConfiguration{} case string(SAPConfigurationTypeDeployment): b = &DeploymentConfiguration{} case string(SAPConfigurationTypeDeploymentWithOSConfig): b = &DeploymentWithOSConfiguration{} - case string(SAPConfigurationTypeDiscovery): - b = &DiscoveryConfiguration{} default: b = &SAPConfiguration{} } @@ -160,12 +156,12 @@ func unmarshalSoftwareConfigurationClassification(rawMsg json.RawMessage) (Softw } var b SoftwareConfigurationClassification switch m["softwareInstallationType"] { - case string(SAPSoftwareInstallationTypeExternal): - b = &ExternalInstallationSoftwareConfiguration{} - case string(SAPSoftwareInstallationTypeSAPInstallWithoutOSConfig): - b = &SAPInstallWithoutOSConfigSoftwareConfiguration{} case string(SAPSoftwareInstallationTypeServiceInitiated): b = &ServiceInitiatedSoftwareConfiguration{} + case string(SAPSoftwareInstallationTypeSAPInstallWithoutOSConfig): + b = &SAPInstallWithoutOSConfigSoftwareConfiguration{} + case string(SAPSoftwareInstallationTypeExternal): + b = &ExternalInstallationSoftwareConfiguration{} default: b = &SoftwareConfiguration{} } diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/responses.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/responses.go index 46127783a0b7..35faa70f98af 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/responses.go +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/responses.go @@ -1,19 +1,9 @@ -//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 armworkloadssapvirtualinstance -// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. -type OperationsClientListResponse struct { - // A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. - OperationListResult -} - // SAPApplicationServerInstancesClientCreateResponse contains the response from method SAPApplicationServerInstancesClient.BeginCreate. type SAPApplicationServerInstancesClientCreateResponse struct { // Define the SAP Application Server Instance resource. @@ -33,18 +23,18 @@ type SAPApplicationServerInstancesClientGetResponse struct { // SAPApplicationServerInstancesClientListResponse contains the response from method SAPApplicationServerInstancesClient.NewListPager. type SAPApplicationServerInstancesClientListResponse struct { - // Defines the collection of SAP Application Server Instance resources. - SAPApplicationServerInstanceList + // The response of a SAPApplicationServerInstance list operation. + SAPApplicationServerInstanceListResult } -// SAPApplicationServerInstancesClientStartInstanceResponse contains the response from method SAPApplicationServerInstancesClient.BeginStartInstance. -type SAPApplicationServerInstancesClientStartInstanceResponse struct { +// SAPApplicationServerInstancesClientStartResponse contains the response from method SAPApplicationServerInstancesClient.BeginStart. +type SAPApplicationServerInstancesClientStartResponse struct { // The current status of an async operation. OperationStatusResult } -// SAPApplicationServerInstancesClientStopInstanceResponse contains the response from method SAPApplicationServerInstancesClient.BeginStopInstance. -type SAPApplicationServerInstancesClientStopInstanceResponse struct { +// SAPApplicationServerInstancesClientStopResponse contains the response from method SAPApplicationServerInstancesClient.BeginStop. +type SAPApplicationServerInstancesClientStopResponse struct { // The current status of an async operation. OperationStatusResult } @@ -55,43 +45,43 @@ type SAPApplicationServerInstancesClientUpdateResponse struct { SAPApplicationServerInstance } -// SAPCentralInstancesClientCreateResponse contains the response from method SAPCentralInstancesClient.BeginCreate. -type SAPCentralInstancesClientCreateResponse struct { +// SAPCentralServerInstancesClientCreateResponse contains the response from method SAPCentralServerInstancesClient.BeginCreate. +type SAPCentralServerInstancesClientCreateResponse struct { // Define the SAP Central Services Instance resource. SAPCentralServerInstance } -// SAPCentralInstancesClientDeleteResponse contains the response from method SAPCentralInstancesClient.BeginDelete. -type SAPCentralInstancesClientDeleteResponse struct { +// SAPCentralServerInstancesClientDeleteResponse contains the response from method SAPCentralServerInstancesClient.BeginDelete. +type SAPCentralServerInstancesClientDeleteResponse struct { // placeholder for future response values } -// SAPCentralInstancesClientGetResponse contains the response from method SAPCentralInstancesClient.Get. -type SAPCentralInstancesClientGetResponse struct { +// SAPCentralServerInstancesClientGetResponse contains the response from method SAPCentralServerInstancesClient.Get. +type SAPCentralServerInstancesClientGetResponse struct { // Define the SAP Central Services Instance resource. SAPCentralServerInstance } -// SAPCentralInstancesClientListResponse contains the response from method SAPCentralInstancesClient.NewListPager. -type SAPCentralInstancesClientListResponse struct { - // Defines the collection of SAP Central Services Instance resources. - SAPCentralInstanceList +// SAPCentralServerInstancesClientListResponse contains the response from method SAPCentralServerInstancesClient.NewListPager. +type SAPCentralServerInstancesClientListResponse struct { + // The response of a SAPCentralServerInstance list operation. + SAPCentralServerInstanceListResult } -// SAPCentralInstancesClientStartInstanceResponse contains the response from method SAPCentralInstancesClient.BeginStartInstance. -type SAPCentralInstancesClientStartInstanceResponse struct { +// SAPCentralServerInstancesClientStartResponse contains the response from method SAPCentralServerInstancesClient.BeginStart. +type SAPCentralServerInstancesClientStartResponse struct { // The current status of an async operation. OperationStatusResult } -// SAPCentralInstancesClientStopInstanceResponse contains the response from method SAPCentralInstancesClient.BeginStopInstance. -type SAPCentralInstancesClientStopInstanceResponse struct { +// SAPCentralServerInstancesClientStopResponse contains the response from method SAPCentralServerInstancesClient.BeginStop. +type SAPCentralServerInstancesClientStopResponse struct { // The current status of an async operation. OperationStatusResult } -// SAPCentralInstancesClientUpdateResponse contains the response from method SAPCentralInstancesClient.Update. -type SAPCentralInstancesClientUpdateResponse struct { +// SAPCentralServerInstancesClientUpdateResponse contains the response from method SAPCentralServerInstancesClient.Update. +type SAPCentralServerInstancesClientUpdateResponse struct { // Define the SAP Central Services Instance resource. SAPCentralServerInstance } @@ -115,18 +105,18 @@ type SAPDatabaseInstancesClientGetResponse struct { // SAPDatabaseInstancesClientListResponse contains the response from method SAPDatabaseInstancesClient.NewListPager. type SAPDatabaseInstancesClientListResponse struct { - // Defines the collection of SAP Database Instances. - SAPDatabaseInstanceList + // The response of a SAPDatabaseInstance list operation. + SAPDatabaseInstanceListResult } -// SAPDatabaseInstancesClientStartInstanceResponse contains the response from method SAPDatabaseInstancesClient.BeginStartInstance. -type SAPDatabaseInstancesClientStartInstanceResponse struct { +// SAPDatabaseInstancesClientStartResponse contains the response from method SAPDatabaseInstancesClient.BeginStart. +type SAPDatabaseInstancesClientStartResponse struct { // The current status of an async operation. OperationStatusResult } -// SAPDatabaseInstancesClientStopInstanceResponse contains the response from method SAPDatabaseInstancesClient.BeginStopInstance. -type SAPDatabaseInstancesClientStopInstanceResponse struct { +// SAPDatabaseInstancesClientStopResponse contains the response from method SAPDatabaseInstancesClient.BeginStop. +type SAPDatabaseInstancesClientStopResponse struct { // The current status of an async operation. OperationStatusResult } @@ -148,22 +138,46 @@ type SAPVirtualInstancesClientDeleteResponse struct { // placeholder for future response values } +// SAPVirtualInstancesClientGetAvailabilityZoneDetailsResponse contains the response from method SAPVirtualInstancesClient.GetAvailabilityZoneDetails. +type SAPVirtualInstancesClientGetAvailabilityZoneDetailsResponse struct { + // The list of supported availability zone pairs which are part of SAP HA deployment. + SAPAvailabilityZoneDetailsResult +} + +// SAPVirtualInstancesClientGetDiskConfigurationsResponse contains the response from method SAPVirtualInstancesClient.GetDiskConfigurations. +type SAPVirtualInstancesClientGetDiskConfigurationsResponse struct { + // The list of disk configuration for vmSku which are part of SAP deployment. + SAPDiskConfigurationsResult +} + // SAPVirtualInstancesClientGetResponse contains the response from method SAPVirtualInstancesClient.Get. type SAPVirtualInstancesClientGetResponse struct { // Define the Virtual Instance for SAP solutions resource. SAPVirtualInstance } +// SAPVirtualInstancesClientGetSapSupportedSKUResponse contains the response from method SAPVirtualInstancesClient.GetSapSupportedSKU. +type SAPVirtualInstancesClientGetSapSupportedSKUResponse struct { + // The list of supported SKUs for different resources which are part of SAP deployment. + SAPSupportedResourceSKUsResult +} + +// SAPVirtualInstancesClientGetSizingRecommendationsResponse contains the response from method SAPVirtualInstancesClient.GetSizingRecommendations. +type SAPVirtualInstancesClientGetSizingRecommendationsResponse struct { + // The SAP sizing recommendation result. + SAPSizingRecommendationResultClassification +} + // SAPVirtualInstancesClientListByResourceGroupResponse contains the response from method SAPVirtualInstancesClient.NewListByResourceGroupPager. type SAPVirtualInstancesClientListByResourceGroupResponse struct { - // Defines the collection of Virtual Instance for SAP solutions resources. - SAPVirtualInstanceList + // The response of a SAPVirtualInstance list operation. + SAPVirtualInstanceListResult } // SAPVirtualInstancesClientListBySubscriptionResponse contains the response from method SAPVirtualInstancesClient.NewListBySubscriptionPager. type SAPVirtualInstancesClientListBySubscriptionResponse struct { - // Defines the collection of Virtual Instance for SAP solutions resources. - SAPVirtualInstanceList + // The response of a SAPVirtualInstance list operation. + SAPVirtualInstanceListResult } // SAPVirtualInstancesClientStartResponse contains the response from method SAPVirtualInstancesClient.BeginStart. @@ -183,37 +197,3 @@ type SAPVirtualInstancesClientUpdateResponse struct { // Define the Virtual Instance for SAP solutions resource. SAPVirtualInstance } - -// WorkloadsClientSAPAvailabilityZoneDetailsResponse contains the response from method WorkloadsClient.SAPAvailabilityZoneDetails. -type WorkloadsClientSAPAvailabilityZoneDetailsResponse struct { - // The list of supported availability zone pairs which are part of SAP HA deployment. - SAPAvailabilityZoneDetailsResult -} - -// WorkloadsClientSAPDiskConfigurationsResponse contains the response from method WorkloadsClient.SAPDiskConfigurations. -type WorkloadsClientSAPDiskConfigurationsResponse struct { - // The list of disk configuration for vmSku which are part of SAP deployment. - SAPDiskConfigurationsResult -} - -// WorkloadsClientSAPSizingRecommendationsResponse contains the response from method WorkloadsClient.SAPSizingRecommendations. -type WorkloadsClientSAPSizingRecommendationsResponse struct { - // The SAP sizing recommendation result. - SAPSizingRecommendationResultClassification -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type WorkloadsClientSAPSizingRecommendationsResponse. -func (w *WorkloadsClientSAPSizingRecommendationsResponse) UnmarshalJSON(data []byte) error { - res, err := unmarshalSAPSizingRecommendationResultClassification(data) - if err != nil { - return err - } - w.SAPSizingRecommendationResultClassification = res - return nil -} - -// WorkloadsClientSAPSupportedSKUResponse contains the response from method WorkloadsClient.SAPSupportedSKU. -type WorkloadsClientSAPSupportedSKUResponse struct { - // The list of supported SKUs for different resources which are part of SAP deployment. - SAPSupportedResourceSKUsResult -} diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/responses_serde.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/responses_serde.go new file mode 100644 index 000000000000..ff87f92c7633 --- /dev/null +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/responses_serde.go @@ -0,0 +1,15 @@ +// 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 armworkloadssapvirtualinstance + +// UnmarshalJSON implements the json.Unmarshaller interface for type SAPVirtualInstancesClientGetSizingRecommendationsResponse. +func (s *SAPVirtualInstancesClientGetSizingRecommendationsResponse) UnmarshalJSON(data []byte) error { + res, err := unmarshalSAPSizingRecommendationResultClassification(data) + if err != nil { + return err + } + s.SAPSizingRecommendationResultClassification = res + return nil +} diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapapplicationserverinstances_client.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapapplicationserverinstances_client.go index 9a8e05592e28..5e0986185f46 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapapplicationserverinstances_client.go +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapapplicationserverinstances_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 armworkloadssapvirtualinstance @@ -28,7 +24,7 @@ type SAPApplicationServerInstancesClient struct { } // NewSAPApplicationServerInstancesClient creates a new instance of SAPApplicationServerInstancesClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - 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 NewSAPApplicationServerInstancesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SAPApplicationServerInstancesClient, error) { @@ -43,26 +39,25 @@ func NewSAPApplicationServerInstancesClient(subscriptionID string, credential az return client, nil } -// BeginCreate - Puts the SAP Application Server Instance resource. -// This will be used by service only. PUT by end user will return a Bad Request error. +// BeginCreate - Puts the SAP Application Server Instance resource. <br><br>This will be used by service only. +// PUT by end user will return a Bad Request error. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - sapVirtualInstanceName - The name of the Virtual Instances for SAP solutions resource // - applicationInstanceName - The name of SAP Application Server instance resource. -// - body - The SAP Application Server Instance resource request body. +// - resource - The SAP Application Server Instance resource request body. // - options - SAPApplicationServerInstancesClientBeginCreateOptions contains the optional parameters for the SAPApplicationServerInstancesClient.BeginCreate // method. -func (client *SAPApplicationServerInstancesClient) BeginCreate(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, body SAPApplicationServerInstance, options *SAPApplicationServerInstancesClientBeginCreateOptions) (*runtime.Poller[SAPApplicationServerInstancesClientCreateResponse], error) { +func (client *SAPApplicationServerInstancesClient) BeginCreate(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, resource SAPApplicationServerInstance, options *SAPApplicationServerInstancesClientBeginCreateOptions) (*runtime.Poller[SAPApplicationServerInstancesClientCreateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.create(ctx, resourceGroupName, sapVirtualInstanceName, applicationInstanceName, body, options) + resp, err := client.create(ctx, resourceGroupName, sapVirtualInstanceName, applicationInstanceName, resource, options) if err != nil { return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SAPApplicationServerInstancesClientCreateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -72,18 +67,18 @@ func (client *SAPApplicationServerInstancesClient) BeginCreate(ctx context.Conte } } -// Create - Puts the SAP Application Server Instance resource. -// This will be used by service only. PUT by end user will return a Bad Request error. +// Create - Puts the SAP Application Server Instance resource. <br><br>This will be used by service only. PUT +// by end user will return a Bad Request error. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview -func (client *SAPApplicationServerInstancesClient) create(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, body SAPApplicationServerInstance, options *SAPApplicationServerInstancesClientBeginCreateOptions) (*http.Response, error) { +// Generated from API version 2024-09-01 +func (client *SAPApplicationServerInstancesClient) create(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, resource SAPApplicationServerInstance, options *SAPApplicationServerInstancesClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "SAPApplicationServerInstancesClient.BeginCreate" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.createCreateRequest(ctx, resourceGroupName, sapVirtualInstanceName, applicationInstanceName, body, options) + req, err := client.createCreateRequest(ctx, resourceGroupName, sapVirtualInstanceName, applicationInstanceName, resource, options) if err != nil { return nil, err } @@ -99,7 +94,7 @@ func (client *SAPApplicationServerInstancesClient) create(ctx context.Context, r } // createCreateRequest creates the Create request. -func (client *SAPApplicationServerInstancesClient) createCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, body SAPApplicationServerInstance, options *SAPApplicationServerInstancesClientBeginCreateOptions) (*policy.Request, error) { +func (client *SAPApplicationServerInstancesClient) createCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, resource SAPApplicationServerInstance, _ *SAPApplicationServerInstancesClientBeginCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -122,20 +117,21 @@ func (client *SAPApplicationServerInstancesClient) createCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, body); err != nil { + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { return nil, err } return req, nil } -// BeginDelete - Deletes the SAP Application Server Instance resource. -// This operation will be used by service only. Delete by end user will return a Bad Request error. +// BeginDelete - Deletes the SAP Application Server Instance resource. <br><br>This operation will be used by +// service only. Delete by end user will return a Bad Request error. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - sapVirtualInstanceName - The name of the Virtual Instances for SAP solutions resource // - applicationInstanceName - The name of SAP Application Server instance resource. @@ -148,8 +144,7 @@ func (client *SAPApplicationServerInstancesClient) BeginDelete(ctx context.Conte return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SAPApplicationServerInstancesClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -159,11 +154,11 @@ func (client *SAPApplicationServerInstancesClient) BeginDelete(ctx context.Conte } } -// Delete - Deletes the SAP Application Server Instance resource. -// This operation will be used by service only. Delete by end user will return a Bad Request error. +// Delete - Deletes the SAP Application Server Instance resource. <br><br>This operation will be used by service +// only. Delete by end user will return a Bad Request error. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 func (client *SAPApplicationServerInstancesClient) deleteOperation(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, options *SAPApplicationServerInstancesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "SAPApplicationServerInstancesClient.BeginDelete" @@ -186,7 +181,7 @@ func (client *SAPApplicationServerInstancesClient) deleteOperation(ctx context.C } // deleteCreateRequest creates the Delete request. -func (client *SAPApplicationServerInstancesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, options *SAPApplicationServerInstancesClientBeginDeleteOptions) (*policy.Request, error) { +func (client *SAPApplicationServerInstancesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, _ *SAPApplicationServerInstancesClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -209,7 +204,7 @@ func (client *SAPApplicationServerInstancesClient) deleteCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -218,7 +213,7 @@ func (client *SAPApplicationServerInstancesClient) deleteCreateRequest(ctx conte // Get - Gets the SAP Application Server Instance corresponding to the Virtual Instance for SAP solutions resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - sapVirtualInstanceName - The name of the Virtual Instances for SAP solutions resource // - applicationInstanceName - The name of SAP Application Server instance resource. @@ -247,7 +242,7 @@ func (client *SAPApplicationServerInstancesClient) Get(ctx context.Context, reso } // getCreateRequest creates the Get request. -func (client *SAPApplicationServerInstancesClient) getCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, options *SAPApplicationServerInstancesClientGetOptions) (*policy.Request, error) { +func (client *SAPApplicationServerInstancesClient) getCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, _ *SAPApplicationServerInstancesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -270,7 +265,7 @@ func (client *SAPApplicationServerInstancesClient) getCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -287,7 +282,7 @@ func (client *SAPApplicationServerInstancesClient) getHandleResponse(resp *http. // NewListPager - Lists the SAP Application Server Instance resources for a given Virtual Instance for SAP solutions resource. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - sapVirtualInstanceName - The name of the Virtual Instances for SAP solutions resource // - options - SAPApplicationServerInstancesClientListOptions contains the optional parameters for the SAPApplicationServerInstancesClient.NewListPager @@ -316,7 +311,7 @@ func (client *SAPApplicationServerInstancesClient) NewListPager(resourceGroupNam } // listCreateRequest creates the List request. -func (client *SAPApplicationServerInstancesClient) listCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, options *SAPApplicationServerInstancesClientListOptions) (*policy.Request, error) { +func (client *SAPApplicationServerInstancesClient) listCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, _ *SAPApplicationServerInstancesClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -335,7 +330,7 @@ func (client *SAPApplicationServerInstancesClient) listCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -344,50 +339,49 @@ func (client *SAPApplicationServerInstancesClient) listCreateRequest(ctx context // listHandleResponse handles the List response. func (client *SAPApplicationServerInstancesClient) listHandleResponse(resp *http.Response) (SAPApplicationServerInstancesClientListResponse, error) { result := SAPApplicationServerInstancesClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.SAPApplicationServerInstanceList); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.SAPApplicationServerInstanceListResult); err != nil { return SAPApplicationServerInstancesClientListResponse{}, err } return result, nil } -// BeginStartInstance - Starts the SAP Application Server Instance. +// BeginStart - Starts the SAP Application Server Instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - sapVirtualInstanceName - The name of the Virtual Instances for SAP solutions resource // - applicationInstanceName - The name of SAP Application Server instance resource. -// - options - SAPApplicationServerInstancesClientBeginStartInstanceOptions contains the optional parameters for the SAPApplicationServerInstancesClient.BeginStartInstance +// - options - SAPApplicationServerInstancesClientBeginStartOptions contains the optional parameters for the SAPApplicationServerInstancesClient.BeginStart // method. -func (client *SAPApplicationServerInstancesClient) BeginStartInstance(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, options *SAPApplicationServerInstancesClientBeginStartInstanceOptions) (*runtime.Poller[SAPApplicationServerInstancesClientStartInstanceResponse], error) { +func (client *SAPApplicationServerInstancesClient) BeginStart(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, options *SAPApplicationServerInstancesClientBeginStartOptions) (*runtime.Poller[SAPApplicationServerInstancesClientStartResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.startInstance(ctx, resourceGroupName, sapVirtualInstanceName, applicationInstanceName, options) + resp, err := client.start(ctx, resourceGroupName, sapVirtualInstanceName, applicationInstanceName, options) if err != nil { return nil, err } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SAPApplicationServerInstancesClientStartInstanceResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SAPApplicationServerInstancesClientStartResponse]{ + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SAPApplicationServerInstancesClientStartInstanceResponse]{ + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SAPApplicationServerInstancesClientStartResponse]{ Tracer: client.internal.Tracer(), }) } } -// StartInstance - Starts the SAP Application Server Instance. +// Start - Starts the SAP Application Server Instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview -func (client *SAPApplicationServerInstancesClient) startInstance(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, options *SAPApplicationServerInstancesClientBeginStartInstanceOptions) (*http.Response, error) { +// Generated from API version 2024-09-01 +func (client *SAPApplicationServerInstancesClient) start(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, options *SAPApplicationServerInstancesClientBeginStartOptions) (*http.Response, error) { var err error - const operationName = "SAPApplicationServerInstancesClient.BeginStartInstance" + const operationName = "SAPApplicationServerInstancesClient.BeginStart" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.startInstanceCreateRequest(ctx, resourceGroupName, sapVirtualInstanceName, applicationInstanceName, options) + req, err := client.startCreateRequest(ctx, resourceGroupName, sapVirtualInstanceName, applicationInstanceName, options) if err != nil { return nil, err } @@ -402,8 +396,8 @@ func (client *SAPApplicationServerInstancesClient) startInstance(ctx context.Con return httpResp, nil } -// startInstanceCreateRequest creates the StartInstance request. -func (client *SAPApplicationServerInstancesClient) startInstanceCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, options *SAPApplicationServerInstancesClientBeginStartInstanceOptions) (*policy.Request, error) { +// startCreateRequest creates the Start request. +func (client *SAPApplicationServerInstancesClient) startCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, options *SAPApplicationServerInstancesClientBeginStartOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}/start" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -426,10 +420,11 @@ func (client *SAPApplicationServerInstancesClient) startInstanceCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Body != nil { + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, *options.Body); err != nil { return nil, err } @@ -438,44 +433,43 @@ func (client *SAPApplicationServerInstancesClient) startInstanceCreateRequest(ct return req, nil } -// BeginStopInstance - Stops the SAP Application Server Instance. +// BeginStop - Stops the SAP Application Server Instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - sapVirtualInstanceName - The name of the Virtual Instances for SAP solutions resource // - applicationInstanceName - The name of SAP Application Server instance resource. -// - options - SAPApplicationServerInstancesClientBeginStopInstanceOptions contains the optional parameters for the SAPApplicationServerInstancesClient.BeginStopInstance +// - options - SAPApplicationServerInstancesClientBeginStopOptions contains the optional parameters for the SAPApplicationServerInstancesClient.BeginStop // method. -func (client *SAPApplicationServerInstancesClient) BeginStopInstance(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, options *SAPApplicationServerInstancesClientBeginStopInstanceOptions) (*runtime.Poller[SAPApplicationServerInstancesClientStopInstanceResponse], error) { +func (client *SAPApplicationServerInstancesClient) BeginStop(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, options *SAPApplicationServerInstancesClientBeginStopOptions) (*runtime.Poller[SAPApplicationServerInstancesClientStopResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.stopInstance(ctx, resourceGroupName, sapVirtualInstanceName, applicationInstanceName, options) + resp, err := client.stop(ctx, resourceGroupName, sapVirtualInstanceName, applicationInstanceName, options) if err != nil { return nil, err } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SAPApplicationServerInstancesClientStopInstanceResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SAPApplicationServerInstancesClientStopResponse]{ + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SAPApplicationServerInstancesClientStopInstanceResponse]{ + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SAPApplicationServerInstancesClientStopResponse]{ Tracer: client.internal.Tracer(), }) } } -// StopInstance - Stops the SAP Application Server Instance. +// Stop - Stops the SAP Application Server Instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview -func (client *SAPApplicationServerInstancesClient) stopInstance(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, options *SAPApplicationServerInstancesClientBeginStopInstanceOptions) (*http.Response, error) { +// Generated from API version 2024-09-01 +func (client *SAPApplicationServerInstancesClient) stop(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, options *SAPApplicationServerInstancesClientBeginStopOptions) (*http.Response, error) { var err error - const operationName = "SAPApplicationServerInstancesClient.BeginStopInstance" + const operationName = "SAPApplicationServerInstancesClient.BeginStop" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.stopInstanceCreateRequest(ctx, resourceGroupName, sapVirtualInstanceName, applicationInstanceName, options) + req, err := client.stopCreateRequest(ctx, resourceGroupName, sapVirtualInstanceName, applicationInstanceName, options) if err != nil { return nil, err } @@ -490,8 +484,8 @@ func (client *SAPApplicationServerInstancesClient) stopInstance(ctx context.Cont return httpResp, nil } -// stopInstanceCreateRequest creates the StopInstance request. -func (client *SAPApplicationServerInstancesClient) stopInstanceCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, options *SAPApplicationServerInstancesClientBeginStopInstanceOptions) (*policy.Request, error) { +// stopCreateRequest creates the Stop request. +func (client *SAPApplicationServerInstancesClient) stopCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, options *SAPApplicationServerInstancesClientBeginStopOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}/stop" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -514,10 +508,11 @@ func (client *SAPApplicationServerInstancesClient) stopInstanceCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Body != nil { + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, *options.Body); err != nil { return nil, err } @@ -526,23 +521,23 @@ func (client *SAPApplicationServerInstancesClient) stopInstanceCreateRequest(ctx return req, nil } -// Update - Updates the SAP Application server instance resource. This can be used to update tags on the resource. +// Update - Puts the SAP Application Server Instance resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - sapVirtualInstanceName - The name of the Virtual Instances for SAP solutions resource // - applicationInstanceName - The name of SAP Application Server instance resource. -// - body - The SAP Application Server Instance resource request body. +// - properties - The SAP Application Server Instance resource request body. // - options - SAPApplicationServerInstancesClientUpdateOptions contains the optional parameters for the SAPApplicationServerInstancesClient.Update // method. -func (client *SAPApplicationServerInstancesClient) Update(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, body UpdateSAPApplicationInstanceRequest, options *SAPApplicationServerInstancesClientUpdateOptions) (SAPApplicationServerInstancesClientUpdateResponse, error) { +func (client *SAPApplicationServerInstancesClient) Update(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, properties UpdateSAPApplicationInstanceRequest, options *SAPApplicationServerInstancesClientUpdateOptions) (SAPApplicationServerInstancesClientUpdateResponse, error) { var err error const operationName = "SAPApplicationServerInstancesClient.Update" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.updateCreateRequest(ctx, resourceGroupName, sapVirtualInstanceName, applicationInstanceName, body, options) + req, err := client.updateCreateRequest(ctx, resourceGroupName, sapVirtualInstanceName, applicationInstanceName, properties, options) if err != nil { return SAPApplicationServerInstancesClientUpdateResponse{}, err } @@ -559,7 +554,7 @@ func (client *SAPApplicationServerInstancesClient) Update(ctx context.Context, r } // updateCreateRequest creates the Update request. -func (client *SAPApplicationServerInstancesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, body UpdateSAPApplicationInstanceRequest, options *SAPApplicationServerInstancesClientUpdateOptions) (*policy.Request, error) { +func (client *SAPApplicationServerInstancesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string, properties UpdateSAPApplicationInstanceRequest, _ *SAPApplicationServerInstancesClientUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -582,10 +577,11 @@ func (client *SAPApplicationServerInstancesClient) updateCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, body); err != nil { + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { return nil, err } return req, nil diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapapplicationserverinstances_client_example_test.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapapplicationserverinstances_client_example_test.go index f126fa2c64f1..994f42f6ce84 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapapplicationserverinstances_client_example_test.go +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapapplicationserverinstances_client_example_test.go @@ -1,94 +1,99 @@ -//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 armworkloadssapvirtualinstance_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/workloadssapvirtualinstance/armworkloadssapvirtualinstance" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapapplicationinstances/SAPApplicationServerInstances_Get.json -func ExampleSAPApplicationServerInstancesClient_Get() { +// Generated from example definition: 2024-09-01/SapApplicationServerInstances_Create.json +func ExampleSAPApplicationServerInstancesClient_BeginCreate_sapApplicationServerInstancesCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("6d875e77-e412-4d7d-9af4-8895278b4443", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewSAPApplicationServerInstancesClient().Get(ctx, "test-rg", "X00", "app01", nil) + poller, err := clientFactory.NewSAPApplicationServerInstancesClient().BeginCreate(ctx, "test-rg", "X00", "app01", armworkloadssapvirtualinstance.SAPApplicationServerInstance{ + Location: to.Ptr("westcentralus"), + Properties: &armworkloadssapvirtualinstance.SAPApplicationServerProperties{}, + Tags: map[string]*string{}, + }, 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.SAPApplicationServerInstance = armworkloadssapvirtualinstance.SAPApplicationServerInstance{ - // Name: to.Ptr("app01"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/applicationInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/app01"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPApplicationServerProperties{ - // DispatcherStatus: to.Ptr("Running"), - // GatewayPort: to.Ptr[int64](3300), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // Hostname: to.Ptr("vh-nw1"), - // IcmHTTPPort: to.Ptr[int64](3312), - // IcmHTTPSPort: to.Ptr[int64](3313), - // InstanceNo: to.Ptr("00"), - // IPAddress: to.Ptr("10.0.0.5"), - // KernelPatch: to.Ptr("patch 300"), - // KernelVersion: to.Ptr("777"), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), - // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/SAP-E2ETest-rg/providers/Microsoft.Network/virtualNetworks/loop-test-vnet/subnets/loopsubnet"), - // VMDetails: []*armworkloadssapvirtualinstance.ApplicationServerVMDetails{ - // { - // Type: to.Ptr(armworkloadssapvirtualinstance.ApplicationServerVirtualMachineTypeActive), - // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/app01-vm"), - // }}, + // res = armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientCreateResponse{ + // SAPApplicationServerInstance: &armworkloadssapvirtualinstance.SAPApplicationServerInstance{ + // Name: to.Ptr("app01"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/applicationInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/app01"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPApplicationServerProperties{ + // DispatcherStatus: to.Ptr("Running"), + // GatewayPort: to.Ptr[int64](3300), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // Hostname: to.Ptr("vh-nw1"), + // IcmHTTPPort: to.Ptr[int64](3312), + // IcmHTTPSPort: to.Ptr[int64](3313), + // InstanceNo: to.Ptr("01"), + // IPAddress: to.Ptr("10.0.0.5"), + // KernelPatch: to.Ptr("patch 300"), + // KernelVersion: to.Ptr("777"), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), + // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/SAP-E2ETest-rg/providers/Microsoft.Network/virtualNetworks/loop-test-vnet/subnets/loopsubnet"), + // VMDetails: []*armworkloadssapvirtualinstance.ApplicationServerVMDetails{ + // { + // Type: to.Ptr(armworkloadssapvirtualinstance.ApplicationServerVirtualMachineTypeActive), + // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/app01-vm"), + // }, + // }, + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // }, // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapapplicationinstances/SAPApplicationServerInstances_Create_HA_AvSet.json +// Generated from example definition: 2024-09-01/SapApplicationServerInstances_CreateForHaWithAvailabilitySet.json func ExampleSAPApplicationServerInstancesClient_BeginCreate_createSapApplicationServerInstancesForHaSystemWithAvailabilitySet() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("6d875e77-e412-4d7d-9af4-8895278b4443", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } poller, err := clientFactory.NewSAPApplicationServerInstancesClient().BeginCreate(ctx, "test-rg", "X00", "app01", armworkloadssapvirtualinstance.SAPApplicationServerInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, + Location: to.Ptr("westcentralus"), Properties: &armworkloadssapvirtualinstance.SAPApplicationServerProperties{}, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -100,319 +105,371 @@ func ExampleSAPApplicationServerInstancesClient_BeginCreate_createSapApplication // 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.SAPApplicationServerInstance = armworkloadssapvirtualinstance.SAPApplicationServerInstance{ - // Name: to.Ptr("app01"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/applicationInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/app01"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPApplicationServerProperties{ - // DispatcherStatus: to.Ptr("Running"), - // GatewayPort: to.Ptr[int64](3300), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // Hostname: to.Ptr("vh-nw1"), - // IcmHTTPPort: to.Ptr[int64](3312), - // IcmHTTPSPort: to.Ptr[int64](3313), - // InstanceNo: to.Ptr("01"), - // IPAddress: to.Ptr("10.0.0.5"), - // KernelPatch: to.Ptr("patch 300"), - // KernelVersion: to.Ptr("777"), - // LoadBalancerDetails: &armworkloadssapvirtualinstance.LoadBalancerDetails{ - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Network/loadBalancers/cs-loadBalancer"), - // }, - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), - // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/SAP-E2ETest-rg/providers/Microsoft.Network/virtualNetworks/loop-test-vnet/subnets/loopsubnet"), - // VMDetails: []*armworkloadssapvirtualinstance.ApplicationServerVMDetails{ - // { - // Type: to.Ptr(armworkloadssapvirtualinstance.ApplicationServerVirtualMachineTypeActive), - // StorageDetails: []*armworkloadssapvirtualinstance.StorageInformation{ - // { - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/nfsstorageaccount"), - // }}, - // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/cs-vm1"), + // res = armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientCreateResponse{ + // SAPApplicationServerInstance: &armworkloadssapvirtualinstance.SAPApplicationServerInstance{ + // Name: to.Ptr("app01"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/applicationInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/app01"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPApplicationServerProperties{ + // DispatcherStatus: to.Ptr("Running"), + // GatewayPort: to.Ptr[int64](3300), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // Hostname: to.Ptr("vh-nw1"), + // IcmHTTPPort: to.Ptr[int64](3312), + // IcmHTTPSPort: to.Ptr[int64](3313), + // InstanceNo: to.Ptr("01"), + // IPAddress: to.Ptr("10.0.0.5"), + // KernelPatch: to.Ptr("patch 300"), + // KernelVersion: to.Ptr("777"), + // LoadBalancerDetails: &armworkloadssapvirtualinstance.LoadBalancerDetails{ + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Network/loadBalancers/cs-loadBalancer"), + // }, + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), + // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/SAP-E2ETest-rg/providers/Microsoft.Network/virtualNetworks/loop-test-vnet/subnets/loopsubnet"), + // VMDetails: []*armworkloadssapvirtualinstance.ApplicationServerVMDetails{ + // { + // Type: to.Ptr(armworkloadssapvirtualinstance.ApplicationServerVirtualMachineTypeActive), + // StorageDetails: []*armworkloadssapvirtualinstance.StorageInformation{ + // { + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/nfsstorageaccount"), + // }, + // }, + // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/cs-vm1"), + // }, + // { + // Type: to.Ptr(armworkloadssapvirtualinstance.ApplicationServerVirtualMachineTypeStandby), + // StorageDetails: []*armworkloadssapvirtualinstance.StorageInformation{ + // { + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/nfsstorageaccount"), + // }, + // }, + // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/cs-vm2"), + // }, // }, - // { - // Type: to.Ptr(armworkloadssapvirtualinstance.ApplicationServerVirtualMachineTypeStandby), - // StorageDetails: []*armworkloadssapvirtualinstance.StorageInformation{ - // { - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/nfsstorageaccount"), - // }}, - // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/cs-vm2"), - // }}, + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // }, // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapapplicationinstances/SAPApplicationServerInstances_Create.json -func ExampleSAPApplicationServerInstancesClient_BeginCreate_sapApplicationServerInstancesCreate() { +// Generated from example definition: 2024-09-01/SapApplicationServerInstances_Delete.json +func ExampleSAPApplicationServerInstancesClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("6d875e77-e412-4d7d-9af4-8895278b4443", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewSAPApplicationServerInstancesClient().BeginCreate(ctx, "test-rg", "X00", "app01", armworkloadssapvirtualinstance.SAPApplicationServerInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, - Properties: &armworkloadssapvirtualinstance.SAPApplicationServerProperties{}, - }, nil) + poller, err := clientFactory.NewSAPApplicationServerInstancesClient().BeginDelete(ctx, "test-rg", "X00", "app01", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - res, err := poller.PollUntilDone(ctx, nil) + _, err = poller.PollUntilDone(ctx, nil) if err != nil { log.Fatalf("failed to pull the result: %v", err) } +} + +// Generated from example definition: 2024-09-01/SapApplicationServerInstances_Get.json +func ExampleSAPApplicationServerInstancesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("6d875e77-e412-4d7d-9af4-8895278b4443", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSAPApplicationServerInstancesClient().Get(ctx, "test-rg", "X00", "app01", 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.SAPApplicationServerInstance = armworkloadssapvirtualinstance.SAPApplicationServerInstance{ - // Name: to.Ptr("app01"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/applicationInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/app01"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPApplicationServerProperties{ - // DispatcherStatus: to.Ptr("Running"), - // GatewayPort: to.Ptr[int64](3300), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // Hostname: to.Ptr("vh-nw1"), - // IcmHTTPPort: to.Ptr[int64](3312), - // IcmHTTPSPort: to.Ptr[int64](3313), - // InstanceNo: to.Ptr("01"), - // IPAddress: to.Ptr("10.0.0.5"), - // KernelPatch: to.Ptr("patch 300"), - // KernelVersion: to.Ptr("777"), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), - // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/SAP-E2ETest-rg/providers/Microsoft.Network/virtualNetworks/loop-test-vnet/subnets/loopsubnet"), - // VMDetails: []*armworkloadssapvirtualinstance.ApplicationServerVMDetails{ - // { - // Type: to.Ptr(armworkloadssapvirtualinstance.ApplicationServerVirtualMachineTypeActive), - // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/app01-vm"), - // }}, + // res = armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientGetResponse{ + // SAPApplicationServerInstance: &armworkloadssapvirtualinstance.SAPApplicationServerInstance{ + // Name: to.Ptr("app01"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/applicationInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/app01"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPApplicationServerProperties{ + // DispatcherStatus: to.Ptr("Running"), + // GatewayPort: to.Ptr[int64](3300), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // Hostname: to.Ptr("vh-nw1"), + // IcmHTTPPort: to.Ptr[int64](3312), + // IcmHTTPSPort: to.Ptr[int64](3313), + // InstanceNo: to.Ptr("00"), + // IPAddress: to.Ptr("10.0.0.5"), + // KernelPatch: to.Ptr("patch 300"), + // KernelVersion: to.Ptr("777"), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), + // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/SAP-E2ETest-rg/providers/Microsoft.Network/virtualNetworks/loop-test-vnet/subnets/loopsubnet"), + // VMDetails: []*armworkloadssapvirtualinstance.ApplicationServerVMDetails{ + // { + // Type: to.Ptr(armworkloadssapvirtualinstance.ApplicationServerVirtualMachineTypeActive), + // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/app01-vm"), + // }, + // }, + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // }, // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapapplicationinstances/SAPApplicationServerInstances_Update.json -func ExampleSAPApplicationServerInstancesClient_Update() { +// Generated from example definition: 2024-09-01/SapApplicationServerInstances_ListBySapVirtualInstance.json +func ExampleSAPApplicationServerInstancesClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("6d875e77-e412-4d7d-9af4-8895278b4443", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewSAPApplicationServerInstancesClient().Update(ctx, "test-rg", "X00", "app01", armworkloadssapvirtualinstance.UpdateSAPApplicationInstanceRequest{ - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - }, - }, nil) + pager := clientFactory.NewSAPApplicationServerInstancesClient().NewListPager("test-rg", "X00", 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 = armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientListResponse{ + // SAPApplicationServerInstanceListResult: armworkloadssapvirtualinstance.SAPApplicationServerInstanceListResult{ + // Value: []*armworkloadssapvirtualinstance.SAPApplicationServerInstance{ + // { + // Name: to.Ptr("app01"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/applicationInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/app01"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPApplicationServerProperties{ + // DispatcherStatus: to.Ptr("Running"), + // GatewayPort: to.Ptr[int64](3300), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // Hostname: to.Ptr("vh-nw1"), + // IcmHTTPPort: to.Ptr[int64](3312), + // IcmHTTPSPort: to.Ptr[int64](3313), + // InstanceNo: to.Ptr("00"), + // IPAddress: to.Ptr("10.0.0.5"), + // KernelPatch: to.Ptr("patch 300"), + // KernelVersion: to.Ptr("777"), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), + // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/SAP-E2ETest-rg/providers/Microsoft.Network/virtualNetworks/loop-test-vnet/subnets/loopsubnet"), + // VMDetails: []*armworkloadssapvirtualinstance.ApplicationServerVMDetails{ + // { + // Type: to.Ptr(armworkloadssapvirtualinstance.ApplicationServerVirtualMachineTypeActive), + // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/app01-vm"), + // }, + // }, + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // }, + // }, + // { + // Name: to.Ptr("app02"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/applicationInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/app02"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPApplicationServerProperties{ + // DispatcherStatus: to.Ptr("Running"), + // GatewayPort: to.Ptr[int64](3300), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // Hostname: to.Ptr("vh-nw1"), + // IcmHTTPPort: to.Ptr[int64](3312), + // IcmHTTPSPort: to.Ptr[int64](3313), + // InstanceNo: to.Ptr("01"), + // IPAddress: to.Ptr("10.0.0.5"), + // KernelPatch: to.Ptr("patch 300"), + // KernelVersion: to.Ptr("777"), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), + // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/SAP-E2ETest-rg/providers/Microsoft.Network/virtualNetworks/loop-test-vnet/subnets/loopsubnet"), + // VMDetails: []*armworkloadssapvirtualinstance.ApplicationServerVMDetails{ + // { + // Type: to.Ptr(armworkloadssapvirtualinstance.ApplicationServerVirtualMachineTypeActive), + // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/app01-vm"), + // }, + // }, + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // }, + // }, + // }, + // }, + // } + } +} + +// Generated from example definition: 2024-09-01/SapApplicationServerInstances_StartInstance.json +func ExampleSAPApplicationServerInstancesClient_BeginStart_startTheSapApplicationServerInstance() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSAPApplicationServerInstancesClient().BeginStart(ctx, "test-rg", "X00", "app01", &SAPApplicationServerInstancesClientBeginStartOptions{ + body: &armworkloadssapvirtualinstance.StartRequest{}}) 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.SAPApplicationServerInstance = armworkloadssapvirtualinstance.SAPApplicationServerInstance{ - // Name: to.Ptr("app01"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/applicationInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/app01"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPApplicationServerProperties{ - // DispatcherStatus: to.Ptr("Running"), - // GatewayPort: to.Ptr[int64](3300), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // Hostname: to.Ptr("vh-nw1"), - // IcmHTTPPort: to.Ptr[int64](3312), - // IcmHTTPSPort: to.Ptr[int64](3313), - // InstanceNo: to.Ptr("01"), - // IPAddress: to.Ptr("10.0.0.5"), - // KernelPatch: to.Ptr("patch 300"), - // KernelVersion: to.Ptr("777"), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), - // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/SAP-E2ETest-rg/providers/Microsoft.Network/virtualNetworks/loop-test-vnet/subnets/loopsubnet"), - // VMDetails: []*armworkloadssapvirtualinstance.ApplicationServerVMDetails{ - // { - // Type: to.Ptr(armworkloadssapvirtualinstance.ApplicationServerVirtualMachineTypeActive), - // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/app01-vm"), - // }}, + // res = armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientStartResponse{ + // OperationStatusResult: &armworkloadssapvirtualinstance.OperationStatusResult{ + // Name: to.Ptr("app01"), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/app01"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), + // Status: to.Ptr("Succeeded"), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapapplicationinstances/SAPApplicationServerInstances_Delete.json -func ExampleSAPApplicationServerInstancesClient_BeginDelete() { +// Generated from example definition: 2024-09-01/SapApplicationServerInstances_StartInstanceVM.json +func ExampleSAPApplicationServerInstancesClient_BeginStart_startVirtualMachineAndTheSapApplicationServerInstanceOnIt() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewSAPApplicationServerInstancesClient().BeginDelete(ctx, "test-rg", "X00", "app01", nil) + poller, err := clientFactory.NewSAPApplicationServerInstancesClient().BeginStart(ctx, "test-rg", "X00", "app01", &SAPApplicationServerInstancesClientBeginStartOptions{ + body: &armworkloadssapvirtualinstance.StartRequest{ + StartVM: to.Ptr(true), + }}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - _, err = poller.PollUntilDone(ctx, nil) + res, err := poller.PollUntilDone(ctx, nil) if err != nil { log.Fatalf("failed to pull the result: %v", err) } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res = armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientStartResponse{ + // OperationStatusResult: &armworkloadssapvirtualinstance.OperationStatusResult{ + // Name: to.Ptr("app01"), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/app01"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), + // Status: to.Ptr("Succeeded"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapapplicationinstances/SAPApplicationServerInstances_List.json -func ExampleSAPApplicationServerInstancesClient_NewListPager() { +// Generated from example definition: 2024-09-01/SapApplicationServerInstances_StopInstance.json +func ExampleSAPApplicationServerInstancesClient_BeginStop_stopTheSapApplicationServerInstance() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewSAPApplicationServerInstancesClient().NewListPager("test-rg", "X00", 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.SAPApplicationServerInstanceList = armworkloadssapvirtualinstance.SAPApplicationServerInstanceList{ - // Value: []*armworkloadssapvirtualinstance.SAPApplicationServerInstance{ - // { - // Name: to.Ptr("app01"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/applicationInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/app01"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPApplicationServerProperties{ - // DispatcherStatus: to.Ptr("Running"), - // GatewayPort: to.Ptr[int64](3300), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // Hostname: to.Ptr("vh-nw1"), - // IcmHTTPPort: to.Ptr[int64](3312), - // IcmHTTPSPort: to.Ptr[int64](3313), - // InstanceNo: to.Ptr("00"), - // IPAddress: to.Ptr("10.0.0.5"), - // KernelPatch: to.Ptr("patch 300"), - // KernelVersion: to.Ptr("777"), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), - // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/SAP-E2ETest-rg/providers/Microsoft.Network/virtualNetworks/loop-test-vnet/subnets/loopsubnet"), - // VMDetails: []*armworkloadssapvirtualinstance.ApplicationServerVMDetails{ - // { - // Type: to.Ptr(armworkloadssapvirtualinstance.ApplicationServerVirtualMachineTypeActive), - // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/app01-vm"), - // }}, - // }, - // }, - // { - // Name: to.Ptr("app02"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/applicationInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/app02"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPApplicationServerProperties{ - // DispatcherStatus: to.Ptr("Running"), - // GatewayPort: to.Ptr[int64](3300), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // Hostname: to.Ptr("vh-nw1"), - // IcmHTTPPort: to.Ptr[int64](3312), - // IcmHTTPSPort: to.Ptr[int64](3313), - // InstanceNo: to.Ptr("01"), - // IPAddress: to.Ptr("10.0.0.5"), - // KernelPatch: to.Ptr("patch 300"), - // KernelVersion: to.Ptr("777"), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), - // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/SAP-E2ETest-rg/providers/Microsoft.Network/virtualNetworks/loop-test-vnet/subnets/loopsubnet"), - // VMDetails: []*armworkloadssapvirtualinstance.ApplicationServerVMDetails{ - // { - // Type: to.Ptr(armworkloadssapvirtualinstance.ApplicationServerVirtualMachineTypeActive), - // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/app01-vm"), - // }}, - // }, - // }}, - // } + poller, err := clientFactory.NewSAPApplicationServerInstancesClient().BeginStop(ctx, "test-rg", "X00", "app01", &SAPApplicationServerInstancesClientBeginStopOptions{ + body: &armworkloadssapvirtualinstance.StopRequest{ + SoftStopTimeoutSeconds: to.Ptr[int64](0), + }}) + 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 = armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientStopResponse{ + // OperationStatusResult: &armworkloadssapvirtualinstance.OperationStatusResult{ + // Name: to.Ptr("app01"), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/app01"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), + // Status: to.Ptr("Succeeded"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapapplicationinstances/SAPApplicationServerInstances_StartInstance_WithInfraOperations.json -func ExampleSAPApplicationServerInstancesClient_BeginStartInstance_startVirtualMachineAndTheSapApplicationServerInstanceOnIt() { +// Generated from example definition: 2024-09-01/SapApplicationServerInstances_StopInstanceInfrastructure.json +func ExampleSAPApplicationServerInstancesClient_BeginStop_stopTheSapApplicationServerInstanceAndItSInfrastructure() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewSAPApplicationServerInstancesClient().BeginStartInstance(ctx, "test-rg", "X00", "app01", &armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientBeginStartInstanceOptions{Body: &armworkloadssapvirtualinstance.StartRequest{ - StartVM: to.Ptr(true), - }, - }) + poller, err := clientFactory.NewSAPApplicationServerInstancesClient().BeginStop(ctx, "test-rg", "X00", "app01", &SAPApplicationServerInstancesClientBeginStopOptions{ + body: &armworkloadssapvirtualinstance.StopRequest{ + DeallocateVM: to.Ptr(true), + SoftStopTimeoutSeconds: to.Ptr[int64](0), + }}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -423,27 +480,32 @@ func ExampleSAPApplicationServerInstancesClient_BeginStartInstance_startVirtualM // 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.OperationStatusResult = armworkloadssapvirtualinstance.OperationStatusResult{ - // Name: to.Ptr("app01"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/app01"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), - // Status: to.Ptr("Succeeded"), + // res = armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientStopResponse{ + // OperationStatusResult: &armworkloadssapvirtualinstance.OperationStatusResult{ + // Name: to.Ptr("app01"), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/app01"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), + // Status: to.Ptr("Succeeded"), + // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapapplicationinstances/SAPApplicationServerInstances_StartInstance.json -func ExampleSAPApplicationServerInstancesClient_BeginStartInstance_startTheSapApplicationServerInstance() { +// Generated from example definition: 2024-09-01/SapApplicationServerInstances_StopInstanceSoft.json +func ExampleSAPApplicationServerInstancesClient_BeginStop_softStopTheSapApplicationServerInstance() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewSAPApplicationServerInstancesClient().BeginStartInstance(ctx, "test-rg", "X00", "app01", &armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientBeginStartInstanceOptions{Body: nil}) + poller, err := clientFactory.NewSAPApplicationServerInstancesClient().BeginStop(ctx, "test-rg", "X00", "app01", &SAPApplicationServerInstancesClientBeginStopOptions{ + body: &armworkloadssapvirtualinstance.StopRequest{ + SoftStopTimeoutSeconds: to.Ptr[int64](300), + }}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -454,30 +516,33 @@ func ExampleSAPApplicationServerInstancesClient_BeginStartInstance_startTheSapAp // 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.OperationStatusResult = armworkloadssapvirtualinstance.OperationStatusResult{ - // Name: to.Ptr("app01"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/app01"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), - // Status: to.Ptr("Succeeded"), + // res = armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientStopResponse{ + // OperationStatusResult: &armworkloadssapvirtualinstance.OperationStatusResult{ + // Name: to.Ptr("app01"), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/app01"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), + // Status: to.Ptr("Succeeded"), + // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapapplicationinstances/SAPApplicationServerInstances_StopInstance.json -func ExampleSAPApplicationServerInstancesClient_BeginStopInstance_stopTheSapApplicationServerInstance() { +// Generated from example definition: 2024-09-01/SapApplicationServerInstances_StopInstanceSoftInfrastructure.json +func ExampleSAPApplicationServerInstancesClient_BeginStop_softStopTheSapApplicationServerInstanceAndItSInfrastructure() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewSAPApplicationServerInstancesClient().BeginStopInstance(ctx, "test-rg", "X00", "app01", &armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientBeginStopInstanceOptions{Body: &armworkloadssapvirtualinstance.StopRequest{ - SoftStopTimeoutSeconds: to.Ptr[int64](0), - }, - }) + poller, err := clientFactory.NewSAPApplicationServerInstancesClient().BeginStop(ctx, "test-rg", "X00", "app01", &SAPApplicationServerInstancesClientBeginStopOptions{ + body: &armworkloadssapvirtualinstance.StopRequest{ + DeallocateVM: to.Ptr(true), + SoftStopTimeoutSeconds: to.Ptr[int64](300), + }}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -488,46 +553,76 @@ func ExampleSAPApplicationServerInstancesClient_BeginStopInstance_stopTheSapAppl // 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.OperationStatusResult = armworkloadssapvirtualinstance.OperationStatusResult{ - // Name: to.Ptr("app01"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/app01"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), - // Status: to.Ptr("Succeeded"), + // res = armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientStopResponse{ + // OperationStatusResult: &armworkloadssapvirtualinstance.OperationStatusResult{ + // Name: to.Ptr("app01"), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/app01"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), + // Status: to.Ptr("Succeeded"), + // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapapplicationinstances/SAPApplicationServerInstances_StopInstance_WithInfraOperations.json -func ExampleSAPApplicationServerInstancesClient_BeginStopInstance_stopTheSapApplicationServerInstanceAndTheVirtualMachine() { +// Generated from example definition: 2024-09-01/SapApplicationServerInstances_Update.json +func ExampleSAPApplicationServerInstancesClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("6d875e77-e412-4d7d-9af4-8895278b4443", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewSAPApplicationServerInstancesClient().BeginStopInstance(ctx, "test-rg", "X00", "app01", &armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientBeginStopInstanceOptions{Body: &armworkloadssapvirtualinstance.StopRequest{ - DeallocateVM: to.Ptr(true), - SoftStopTimeoutSeconds: to.Ptr[int64](0), - }, - }) + res, err := clientFactory.NewSAPApplicationServerInstancesClient().Update(ctx, "test-rg", "X00", "app01", armworkloadssapvirtualinstance.UpdateSAPApplicationInstanceRequest{ + Tags: map[string]*string{ + "tag1": to.Ptr("value1"), + }, + }, 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.OperationStatusResult = armworkloadssapvirtualinstance.OperationStatusResult{ - // Name: to.Ptr("app01"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/app01"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), - // Status: to.Ptr("Succeeded"), + // res = armworkloadssapvirtualinstance.SAPApplicationServerInstancesClientUpdateResponse{ + // SAPApplicationServerInstance: &armworkloadssapvirtualinstance.SAPApplicationServerInstance{ + // Name: to.Ptr("app01"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/applicationInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/app01"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPApplicationServerProperties{ + // DispatcherStatus: to.Ptr("Running"), + // GatewayPort: to.Ptr[int64](3300), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // Hostname: to.Ptr("vh-nw1"), + // IcmHTTPPort: to.Ptr[int64](3312), + // IcmHTTPSPort: to.Ptr[int64](3313), + // InstanceNo: to.Ptr("01"), + // IPAddress: to.Ptr("10.0.0.5"), + // KernelPatch: to.Ptr("patch 300"), + // KernelVersion: to.Ptr("777"), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), + // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/SAP-E2ETest-rg/providers/Microsoft.Network/virtualNetworks/loop-test-vnet/subnets/loopsubnet"), + // VMDetails: []*armworkloadssapvirtualinstance.ApplicationServerVMDetails{ + // { + // Type: to.Ptr(armworkloadssapvirtualinstance.ApplicationServerVirtualMachineTypeActive), + // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/app01-vm"), + // }, + // }, + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // }, + // }, // } } diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapcentralinstances_client_example_test.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapcentralinstances_client_example_test.go deleted file mode 100644 index 84bf884df766..000000000000 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapcentralinstances_client_example_test.go +++ /dev/null @@ -1,606 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armworkloadssapvirtualinstance_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/workloadssapvirtualinstance/armworkloadssapvirtualinstance" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapcentralinstances/SAPCentralInstances_Get.json -func ExampleSAPCentralInstancesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSAPCentralInstancesClient().Get(ctx, "test-rg", "X00", "centralServer", 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.SAPCentralServerInstance = armworkloadssapvirtualinstance.SAPCentralServerInstance{ - // Name: to.Ptr("centralServer"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/centralInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/centralInstances/centralServer"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPCentralServerProperties{ - // EnqueueReplicationServerProperties: &armworkloadssapvirtualinstance.EnqueueReplicationServerProperties{ - // ErsVersion: to.Ptr(armworkloadssapvirtualinstance.EnqueueReplicationServerTypeEnqueueReplicator1), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // Hostname: to.Ptr("vh-ers1"), - // InstanceNo: to.Ptr("00"), - // IPAddress: to.Ptr("10.0.0.5"), - // KernelPatch: to.Ptr("patch 300"), - // KernelVersion: to.Ptr("777"), - // }, - // EnqueueServerProperties: &armworkloadssapvirtualinstance.EnqueueServerProperties{ - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), - // Hostname: to.Ptr("vh-ascs1"), - // IPAddress: to.Ptr("10.0.0.5"), - // Port: to.Ptr[int64](3600), - // }, - // GatewayServerProperties: &armworkloadssapvirtualinstance.GatewayServerProperties{ - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateDegraded), - // Port: to.Ptr[int64](3300), - // }, - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), - // InstanceNo: to.Ptr("00"), - // KernelPatch: to.Ptr("patch 300"), - // KernelVersion: to.Ptr("777"), - // MessageServerProperties: &armworkloadssapvirtualinstance.MessageServerProperties{ - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnhealthy), - // Hostname: to.Ptr("vh-ascs1"), - // HTTPPort: to.Ptr[int64](8100), - // HTTPSPort: to.Ptr[int64](44400), - // InternalMsPort: to.Ptr[int64](3900), - // IPAddress: to.Ptr("10.0.0.5"), - // MSPort: to.Ptr[int64](3600), - // }, - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), - // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/SAP-E2ETest-rg/providers/Microsoft.Network/virtualNetworks/loop-test-vnet/subnets/loopsubnet"), - // VMDetails: []*armworkloadssapvirtualinstance.CentralServerVMDetails{ - // { - // Type: to.Ptr(armworkloadssapvirtualinstance.CentralServerVirtualMachineTypePrimary), - // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/cs-vm"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapcentralinstances/SAPCentralInstances_Create_HA_AvSet.json -func ExampleSAPCentralInstancesClient_BeginCreate_createSapCentralInstancesForHaSystemWithAvailabilitySet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPCentralInstancesClient().BeginCreate(ctx, "test-rg", "X00", "centralServer", armworkloadssapvirtualinstance.SAPCentralServerInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, - Properties: &armworkloadssapvirtualinstance.SAPCentralServerProperties{}, - }, 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.SAPCentralServerInstance = armworkloadssapvirtualinstance.SAPCentralServerInstance{ - // Name: to.Ptr("centralServer"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/centralInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/centralInstances/centralServer"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPCentralServerProperties{ - // EnqueueReplicationServerProperties: &armworkloadssapvirtualinstance.EnqueueReplicationServerProperties{ - // ErsVersion: to.Ptr(armworkloadssapvirtualinstance.EnqueueReplicationServerTypeEnqueueReplicator1), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // Hostname: to.Ptr("vh-ers1"), - // InstanceNo: to.Ptr("00"), - // IPAddress: to.Ptr("10.0.0.5"), - // KernelPatch: to.Ptr("patch 300"), - // KernelVersion: to.Ptr("777"), - // }, - // EnqueueServerProperties: &armworkloadssapvirtualinstance.EnqueueServerProperties{ - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // Hostname: to.Ptr("vh-ascs1"), - // IPAddress: to.Ptr("10.0.0.5"), - // Port: to.Ptr[int64](3600), - // }, - // GatewayServerProperties: &armworkloadssapvirtualinstance.GatewayServerProperties{ - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // Port: to.Ptr[int64](3300), - // }, - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // InstanceNo: to.Ptr("00"), - // KernelPatch: to.Ptr("patch 300"), - // KernelVersion: to.Ptr("777"), - // LoadBalancerDetails: &armworkloadssapvirtualinstance.LoadBalancerDetails{ - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Network/loadBalancers/cs-ASCS-loadBalancer"), - // }, - // MessageServerProperties: &armworkloadssapvirtualinstance.MessageServerProperties{ - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // Hostname: to.Ptr("vh-ascs1"), - // HTTPPort: to.Ptr[int64](8100), - // HTTPSPort: to.Ptr[int64](44400), - // InternalMsPort: to.Ptr[int64](3900), - // IPAddress: to.Ptr("10.0.0.5"), - // MSPort: to.Ptr[int64](3600), - // }, - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), - // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/SAP-E2ETest-rg/providers/Microsoft.Network/virtualNetworks/loop-test-vnet/subnets/loopsubnet"), - // VMDetails: []*armworkloadssapvirtualinstance.CentralServerVMDetails{ - // { - // Type: to.Ptr(armworkloadssapvirtualinstance.CentralServerVirtualMachineTypePrimary), - // StorageDetails: []*armworkloadssapvirtualinstance.StorageInformation{ - // { - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/nfsstorageaccount"), - // }}, - // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/cs-vm1"), - // }, - // { - // Type: to.Ptr(armworkloadssapvirtualinstance.CentralServerVirtualMachineTypePrimary), - // StorageDetails: []*armworkloadssapvirtualinstance.StorageInformation{ - // { - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/nfsstorageaccount"), - // }}, - // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/cs-vm2"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapcentralinstances/SAPCentralInstances_Create.json -func ExampleSAPCentralInstancesClient_BeginCreate_sapCentralInstancesCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPCentralInstancesClient().BeginCreate(ctx, "test-rg", "X00", "centralServer", armworkloadssapvirtualinstance.SAPCentralServerInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, - Properties: &armworkloadssapvirtualinstance.SAPCentralServerProperties{}, - }, 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.SAPCentralServerInstance = armworkloadssapvirtualinstance.SAPCentralServerInstance{ - // Name: to.Ptr("centralServer"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/centralInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/centralInstances/centralServer"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPCentralServerProperties{ - // EnqueueReplicationServerProperties: &armworkloadssapvirtualinstance.EnqueueReplicationServerProperties{ - // ErsVersion: to.Ptr(armworkloadssapvirtualinstance.EnqueueReplicationServerTypeEnqueueReplicator1), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // Hostname: to.Ptr("vh-ers1"), - // InstanceNo: to.Ptr("00"), - // IPAddress: to.Ptr("10.0.0.5"), - // KernelPatch: to.Ptr("patch 300"), - // KernelVersion: to.Ptr("777"), - // }, - // EnqueueServerProperties: &armworkloadssapvirtualinstance.EnqueueServerProperties{ - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // Hostname: to.Ptr("vh-ascs1"), - // IPAddress: to.Ptr("10.0.0.5"), - // Port: to.Ptr[int64](3600), - // }, - // GatewayServerProperties: &armworkloadssapvirtualinstance.GatewayServerProperties{ - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // Port: to.Ptr[int64](3300), - // }, - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // InstanceNo: to.Ptr("00"), - // KernelPatch: to.Ptr("patch 300"), - // KernelVersion: to.Ptr("777"), - // MessageServerProperties: &armworkloadssapvirtualinstance.MessageServerProperties{ - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // Hostname: to.Ptr("vh-ascs1"), - // HTTPPort: to.Ptr[int64](8100), - // HTTPSPort: to.Ptr[int64](44400), - // InternalMsPort: to.Ptr[int64](3900), - // IPAddress: to.Ptr("10.0.0.5"), - // MSPort: to.Ptr[int64](3600), - // }, - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), - // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/SAP-E2ETest-rg/providers/Microsoft.Network/virtualNetworks/loop-test-vnet/subnets/loopsubnet"), - // VMDetails: []*armworkloadssapvirtualinstance.CentralServerVMDetails{ - // { - // Type: to.Ptr(armworkloadssapvirtualinstance.CentralServerVirtualMachineTypePrimary), - // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/cs-vm"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapcentralinstances/SAPCentralInstances_Update.json -func ExampleSAPCentralInstancesClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSAPCentralInstancesClient().Update(ctx, "test-rg", "X00", "centralServer", armworkloadssapvirtualinstance.UpdateSAPCentralInstanceRequest{ - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - }, - }, 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.SAPCentralServerInstance = armworkloadssapvirtualinstance.SAPCentralServerInstance{ - // Name: to.Ptr("centralServer"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/centralInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/centralInstances/centralServer"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPCentralServerProperties{ - // EnqueueReplicationServerProperties: &armworkloadssapvirtualinstance.EnqueueReplicationServerProperties{ - // ErsVersion: to.Ptr(armworkloadssapvirtualinstance.EnqueueReplicationServerTypeEnqueueReplicator1), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // Hostname: to.Ptr("vh-ers1"), - // InstanceNo: to.Ptr("00"), - // IPAddress: to.Ptr("10.0.0.5"), - // KernelPatch: to.Ptr("patch 300"), - // KernelVersion: to.Ptr("777"), - // }, - // EnqueueServerProperties: &armworkloadssapvirtualinstance.EnqueueServerProperties{ - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // Hostname: to.Ptr("vh-ascs1"), - // IPAddress: to.Ptr("10.0.0.5"), - // Port: to.Ptr[int64](3600), - // }, - // GatewayServerProperties: &armworkloadssapvirtualinstance.GatewayServerProperties{ - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // Port: to.Ptr[int64](3300), - // }, - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // InstanceNo: to.Ptr("00"), - // KernelPatch: to.Ptr("patch 300"), - // KernelVersion: to.Ptr("777"), - // MessageServerProperties: &armworkloadssapvirtualinstance.MessageServerProperties{ - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // Hostname: to.Ptr("vh-ascs1"), - // HTTPPort: to.Ptr[int64](8100), - // HTTPSPort: to.Ptr[int64](44400), - // InternalMsPort: to.Ptr[int64](3900), - // IPAddress: to.Ptr("10.0.0.5"), - // MSPort: to.Ptr[int64](3600), - // }, - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), - // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/SAP-E2ETest-rg/providers/Microsoft.Network/virtualNetworks/loop-test-vnet/subnets/loopsubnet"), - // VMDetails: []*armworkloadssapvirtualinstance.CentralServerVMDetails{ - // { - // Type: to.Ptr(armworkloadssapvirtualinstance.CentralServerVirtualMachineTypePrimary), - // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/cs-vm"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapcentralinstances/SAPCentralInstances_Delete.json -func ExampleSAPCentralInstancesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPCentralInstancesClient().BeginDelete(ctx, "test-rg", "X00", "centralServer", 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/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapcentralinstances/SAPCentralInstances_List.json -func ExampleSAPCentralInstancesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSAPCentralInstancesClient().NewListPager("test-rg", "X00", 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.SAPCentralInstanceList = armworkloadssapvirtualinstance.SAPCentralInstanceList{ - // Value: []*armworkloadssapvirtualinstance.SAPCentralServerInstance{ - // { - // Name: to.Ptr("centralServer"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/centralInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/centralInstances/centralServer"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPCentralServerProperties{ - // EnqueueReplicationServerProperties: &armworkloadssapvirtualinstance.EnqueueReplicationServerProperties{ - // ErsVersion: to.Ptr(armworkloadssapvirtualinstance.EnqueueReplicationServerTypeEnqueueReplicator1), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // Hostname: to.Ptr("vh-ers1"), - // InstanceNo: to.Ptr("00"), - // IPAddress: to.Ptr("10.0.0.5"), - // KernelPatch: to.Ptr("patch 300"), - // KernelVersion: to.Ptr("777"), - // }, - // EnqueueServerProperties: &armworkloadssapvirtualinstance.EnqueueServerProperties{ - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // Hostname: to.Ptr("vh-ascs1"), - // IPAddress: to.Ptr("10.0.0.5"), - // Port: to.Ptr[int64](3600), - // }, - // GatewayServerProperties: &armworkloadssapvirtualinstance.GatewayServerProperties{ - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // Port: to.Ptr[int64](3300), - // }, - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // InstanceNo: to.Ptr("00"), - // KernelPatch: to.Ptr("patch 300"), - // KernelVersion: to.Ptr("777"), - // MessageServerProperties: &armworkloadssapvirtualinstance.MessageServerProperties{ - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // Hostname: to.Ptr("vh-ascs1"), - // HTTPPort: to.Ptr[int64](8100), - // HTTPSPort: to.Ptr[int64](44400), - // InternalMsPort: to.Ptr[int64](3900), - // IPAddress: to.Ptr("10.0.0.5"), - // MSPort: to.Ptr[int64](3600), - // }, - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), - // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/SAP-E2ETest-rg/providers/Microsoft.Network/virtualNetworks/loop-test-vnet/subnets/loopsubnet"), - // VMDetails: []*armworkloadssapvirtualinstance.CentralServerVMDetails{ - // { - // Type: to.Ptr(armworkloadssapvirtualinstance.CentralServerVirtualMachineTypePrimary), - // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/cs-vm"), - // }}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapcentralinstances/SAPCentralInstances_StartInstance.json -func ExampleSAPCentralInstancesClient_BeginStartInstance_startTheSapCentralServicesInstance() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPCentralInstancesClient().BeginStartInstance(ctx, "test-rg", "X00", "centralServer", &armworkloadssapvirtualinstance.SAPCentralInstancesClientBeginStartInstanceOptions{Body: 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.OperationStatusResult = armworkloadssapvirtualinstance.OperationStatusResult{ - // Name: to.Ptr("centralServer"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/centralInstances/centralServer"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), - // Status: to.Ptr("Succeeded"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapcentralinstances/SAPCentralInstances_StartInstance_WithInfraOperations.json -func ExampleSAPCentralInstancesClient_BeginStartInstance_startTheVirtualMachineSAndTheSapCentralServicesInstanceOnIt() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPCentralInstancesClient().BeginStartInstance(ctx, "test-rg", "X00", "centralServer", &armworkloadssapvirtualinstance.SAPCentralInstancesClientBeginStartInstanceOptions{Body: &armworkloadssapvirtualinstance.StartRequest{ - StartVM: to.Ptr(true), - }, - }) - 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.OperationStatusResult = armworkloadssapvirtualinstance.OperationStatusResult{ - // Name: to.Ptr("centralServer"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/centralInstances/centralServer"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), - // Status: to.Ptr("Succeeded"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapcentralinstances/SAPCentralInstances_StopInstance_WithInfraOperations.json -func ExampleSAPCentralInstancesClient_BeginStopInstance_stopTheSapCentralServicesInstanceAndItsUnderlyingVirtualMachineS() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPCentralInstancesClient().BeginStopInstance(ctx, "test-rg", "X00", "centralServer", &armworkloadssapvirtualinstance.SAPCentralInstancesClientBeginStopInstanceOptions{Body: &armworkloadssapvirtualinstance.StopRequest{ - DeallocateVM: to.Ptr(true), - }, - }) - 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.OperationStatusResult = armworkloadssapvirtualinstance.OperationStatusResult{ - // Name: to.Ptr("centralServer"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/centralInstances/centralServer"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), - // Status: to.Ptr("Succeeded"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapcentralinstances/SAPCentralInstances_StopInstance.json -func ExampleSAPCentralInstancesClient_BeginStopInstance_stopTheSapCentralServicesInstance() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPCentralInstancesClient().BeginStopInstance(ctx, "test-rg", "X00", "centralServer", &armworkloadssapvirtualinstance.SAPCentralInstancesClientBeginStopInstanceOptions{Body: &armworkloadssapvirtualinstance.StopRequest{ - SoftStopTimeoutSeconds: to.Ptr[int64](1200), - }, - }) - 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.OperationStatusResult = armworkloadssapvirtualinstance.OperationStatusResult{ - // Name: to.Ptr("centralServer"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/centralInstances/centralServer"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), - // Status: to.Ptr("Succeeded"), - // } -} diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapcentralinstances_client.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapcentralserverinstances_client.go similarity index 62% rename from sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapcentralinstances_client.go rename to sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapcentralserverinstances_client.go index 5941cfe5dca7..2f3c222e252f 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapcentralinstances_client.go +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapcentralserverinstances_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 armworkloadssapvirtualinstance @@ -20,70 +16,69 @@ import ( "strings" ) -// SAPCentralInstancesClient contains the methods for the SAPCentralInstances group. -// Don't use this type directly, use NewSAPCentralInstancesClient() instead. -type SAPCentralInstancesClient struct { +// SAPCentralServerInstancesClient contains the methods for the SAPCentralServerInstances group. +// Don't use this type directly, use NewSAPCentralServerInstancesClient() instead. +type SAPCentralServerInstancesClient struct { internal *arm.Client subscriptionID string } -// NewSAPCentralInstancesClient creates a new instance of SAPCentralInstancesClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// NewSAPCentralServerInstancesClient creates a new instance of SAPCentralServerInstancesClient 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 NewSAPCentralInstancesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SAPCentralInstancesClient, error) { +func NewSAPCentralServerInstancesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SAPCentralServerInstancesClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } - client := &SAPCentralInstancesClient{ + client := &SAPCentralServerInstancesClient{ subscriptionID: subscriptionID, internal: cl, } return client, nil } -// BeginCreate - Creates the SAP Central Services Instance resource. -// This will be used by service only. PUT operation on this resource by end user will return a Bad Request error. +// BeginCreate - Creates the SAP Central Services Instance resource. <br><br>This will be used by service only. +// PUT operation on this resource by end user will return a Bad Request error. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - sapVirtualInstanceName - The name of the Virtual Instances for SAP solutions resource // - centralInstanceName - Central Services Instance resource name string modeled as parameter for auto generation to work correctly. -// - body - The SAP Central Services Instance request body. -// - options - SAPCentralInstancesClientBeginCreateOptions contains the optional parameters for the SAPCentralInstancesClient.BeginCreate +// - resource - The SAP Central Services Instance request body. +// - options - SAPCentralServerInstancesClientBeginCreateOptions contains the optional parameters for the SAPCentralServerInstancesClient.BeginCreate // method. -func (client *SAPCentralInstancesClient) BeginCreate(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, body SAPCentralServerInstance, options *SAPCentralInstancesClientBeginCreateOptions) (*runtime.Poller[SAPCentralInstancesClientCreateResponse], error) { +func (client *SAPCentralServerInstancesClient) BeginCreate(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, resource SAPCentralServerInstance, options *SAPCentralServerInstancesClientBeginCreateOptions) (*runtime.Poller[SAPCentralServerInstancesClientCreateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.create(ctx, resourceGroupName, sapVirtualInstanceName, centralInstanceName, body, options) + resp, err := client.create(ctx, resourceGroupName, sapVirtualInstanceName, centralInstanceName, resource, options) if err != nil { return nil, err } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SAPCentralInstancesClientCreateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SAPCentralServerInstancesClientCreateResponse]{ + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SAPCentralInstancesClientCreateResponse]{ + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SAPCentralServerInstancesClientCreateResponse]{ Tracer: client.internal.Tracer(), }) } } -// Create - Creates the SAP Central Services Instance resource. -// This will be used by service only. PUT operation on this resource by end user will return a Bad Request error. +// Create - Creates the SAP Central Services Instance resource. <br><br>This will be used by service only. PUT +// operation on this resource by end user will return a Bad Request error. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview -func (client *SAPCentralInstancesClient) create(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, body SAPCentralServerInstance, options *SAPCentralInstancesClientBeginCreateOptions) (*http.Response, error) { +// Generated from API version 2024-09-01 +func (client *SAPCentralServerInstancesClient) create(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, resource SAPCentralServerInstance, options *SAPCentralServerInstancesClientBeginCreateOptions) (*http.Response, error) { var err error - const operationName = "SAPCentralInstancesClient.BeginCreate" + const operationName = "SAPCentralServerInstancesClient.BeginCreate" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.createCreateRequest(ctx, resourceGroupName, sapVirtualInstanceName, centralInstanceName, body, options) + req, err := client.createCreateRequest(ctx, resourceGroupName, sapVirtualInstanceName, centralInstanceName, resource, options) if err != nil { return nil, err } @@ -99,7 +94,7 @@ func (client *SAPCentralInstancesClient) create(ctx context.Context, resourceGro } // createCreateRequest creates the Create request. -func (client *SAPCentralInstancesClient) createCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, body SAPCentralServerInstance, options *SAPCentralInstancesClientBeginCreateOptions) (*policy.Request, error) { +func (client *SAPCentralServerInstancesClient) createCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, resource SAPCentralServerInstance, _ *SAPCentralServerInstancesClientBeginCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -122,55 +117,53 @@ func (client *SAPCentralInstancesClient) createCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, body); err != nil { + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { return nil, err } return req, nil } -// BeginDelete - Deletes the SAP Central Services Instance resource. -// This will be used by service only. Delete operation on this resource by end user will return a Bad Request error. You can -// delete the parent resource, which is the Virtual Instance for SAP solutions -// resource, using the delete operation on it. +// BeginDelete - Deletes the SAP Central Services Instance resource. <br><br>This will be used by service only. +// Delete operation on this resource by end user will return a Bad Request error. You can delete the parent resource, which +// is the Virtual Instance for SAP solutions resource, using the delete operation on it. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - sapVirtualInstanceName - The name of the Virtual Instances for SAP solutions resource // - centralInstanceName - Central Services Instance resource name string modeled as parameter for auto generation to work correctly. -// - options - SAPCentralInstancesClientBeginDeleteOptions contains the optional parameters for the SAPCentralInstancesClient.BeginDelete +// - options - SAPCentralServerInstancesClientBeginDeleteOptions contains the optional parameters for the SAPCentralServerInstancesClient.BeginDelete // method. -func (client *SAPCentralInstancesClient) BeginDelete(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, options *SAPCentralInstancesClientBeginDeleteOptions) (*runtime.Poller[SAPCentralInstancesClientDeleteResponse], error) { +func (client *SAPCentralServerInstancesClient) BeginDelete(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, options *SAPCentralServerInstancesClientBeginDeleteOptions) (*runtime.Poller[SAPCentralServerInstancesClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.deleteOperation(ctx, resourceGroupName, sapVirtualInstanceName, centralInstanceName, options) if err != nil { return nil, err } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SAPCentralInstancesClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SAPCentralServerInstancesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SAPCentralInstancesClientDeleteResponse]{ + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SAPCentralServerInstancesClientDeleteResponse]{ Tracer: client.internal.Tracer(), }) } } -// Delete - Deletes the SAP Central Services Instance resource. -// This will be used by service only. Delete operation on this resource by end user will return a Bad Request error. You can -// delete the parent resource, which is the Virtual Instance for SAP solutions -// resource, using the delete operation on it. +// Delete - Deletes the SAP Central Services Instance resource. <br><br>This will be used by service only. Delete +// operation on this resource by end user will return a Bad Request error. You can delete the parent resource, which is the +// Virtual Instance for SAP solutions resource, using the delete operation on it. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview -func (client *SAPCentralInstancesClient) deleteOperation(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, options *SAPCentralInstancesClientBeginDeleteOptions) (*http.Response, error) { +// Generated from API version 2024-09-01 +func (client *SAPCentralServerInstancesClient) deleteOperation(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, options *SAPCentralServerInstancesClientBeginDeleteOptions) (*http.Response, error) { var err error - const operationName = "SAPCentralInstancesClient.BeginDelete" + const operationName = "SAPCentralServerInstancesClient.BeginDelete" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() @@ -190,7 +183,7 @@ func (client *SAPCentralInstancesClient) deleteOperation(ctx context.Context, re } // deleteCreateRequest creates the Delete request. -func (client *SAPCentralInstancesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, options *SAPCentralInstancesClientBeginDeleteOptions) (*policy.Request, error) { +func (client *SAPCentralServerInstancesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, _ *SAPCentralServerInstancesClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -213,7 +206,7 @@ func (client *SAPCentralInstancesClient) deleteCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -222,35 +215,36 @@ func (client *SAPCentralInstancesClient) deleteCreateRequest(ctx context.Context // Get - Gets the SAP Central Services Instance resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - sapVirtualInstanceName - The name of the Virtual Instances for SAP solutions resource // - centralInstanceName - Central Services Instance resource name string modeled as parameter for auto generation to work correctly. -// - options - SAPCentralInstancesClientGetOptions contains the optional parameters for the SAPCentralInstancesClient.Get method. -func (client *SAPCentralInstancesClient) Get(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, options *SAPCentralInstancesClientGetOptions) (SAPCentralInstancesClientGetResponse, error) { +// - options - SAPCentralServerInstancesClientGetOptions contains the optional parameters for the SAPCentralServerInstancesClient.Get +// method. +func (client *SAPCentralServerInstancesClient) Get(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, options *SAPCentralServerInstancesClientGetOptions) (SAPCentralServerInstancesClientGetResponse, error) { var err error - const operationName = "SAPCentralInstancesClient.Get" + const operationName = "SAPCentralServerInstancesClient.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, sapVirtualInstanceName, centralInstanceName, options) if err != nil { - return SAPCentralInstancesClientGetResponse{}, err + return SAPCentralServerInstancesClientGetResponse{}, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return SAPCentralInstancesClientGetResponse{}, err + return SAPCentralServerInstancesClientGetResponse{}, err } if !runtime.HasStatusCode(httpResp, http.StatusOK) { err = runtime.NewResponseError(httpResp) - return SAPCentralInstancesClientGetResponse{}, err + return SAPCentralServerInstancesClientGetResponse{}, err } resp, err := client.getHandleResponse(httpResp) return resp, err } // getCreateRequest creates the Get request. -func (client *SAPCentralInstancesClient) getCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, options *SAPCentralInstancesClientGetOptions) (*policy.Request, error) { +func (client *SAPCentralServerInstancesClient) getCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, _ *SAPCentralServerInstancesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -273,35 +267,35 @@ func (client *SAPCentralInstancesClient) getCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // getHandleResponse handles the Get response. -func (client *SAPCentralInstancesClient) getHandleResponse(resp *http.Response) (SAPCentralInstancesClientGetResponse, error) { - result := SAPCentralInstancesClientGetResponse{} +func (client *SAPCentralServerInstancesClient) getHandleResponse(resp *http.Response) (SAPCentralServerInstancesClientGetResponse, error) { + result := SAPCentralServerInstancesClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.SAPCentralServerInstance); err != nil { - return SAPCentralInstancesClientGetResponse{}, err + return SAPCentralServerInstancesClientGetResponse{}, err } return result, nil } // NewListPager - Lists the SAP Central Services Instance resource for the given Virtual Instance for SAP solutions resource. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - sapVirtualInstanceName - The name of the Virtual Instances for SAP solutions resource -// - options - SAPCentralInstancesClientListOptions contains the optional parameters for the SAPCentralInstancesClient.NewListPager +// - options - SAPCentralServerInstancesClientListOptions contains the optional parameters for the SAPCentralServerInstancesClient.NewListPager // method. -func (client *SAPCentralInstancesClient) NewListPager(resourceGroupName string, sapVirtualInstanceName string, options *SAPCentralInstancesClientListOptions) *runtime.Pager[SAPCentralInstancesClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[SAPCentralInstancesClientListResponse]{ - More: func(page SAPCentralInstancesClientListResponse) bool { +func (client *SAPCentralServerInstancesClient) NewListPager(resourceGroupName string, sapVirtualInstanceName string, options *SAPCentralServerInstancesClientListOptions) *runtime.Pager[SAPCentralServerInstancesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[SAPCentralServerInstancesClientListResponse]{ + More: func(page SAPCentralServerInstancesClientListResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, - Fetcher: func(ctx context.Context, page *SAPCentralInstancesClientListResponse) (SAPCentralInstancesClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SAPCentralInstancesClient.NewListPager") + Fetcher: func(ctx context.Context, page *SAPCentralServerInstancesClientListResponse) (SAPCentralServerInstancesClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SAPCentralServerInstancesClient.NewListPager") nextLink := "" if page != nil { nextLink = *page.NextLink @@ -310,7 +304,7 @@ func (client *SAPCentralInstancesClient) NewListPager(resourceGroupName string, return client.listCreateRequest(ctx, resourceGroupName, sapVirtualInstanceName, options) }, nil) if err != nil { - return SAPCentralInstancesClientListResponse{}, err + return SAPCentralServerInstancesClientListResponse{}, err } return client.listHandleResponse(resp) }, @@ -319,7 +313,7 @@ func (client *SAPCentralInstancesClient) NewListPager(resourceGroupName string, } // listCreateRequest creates the List request. -func (client *SAPCentralInstancesClient) listCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, options *SAPCentralInstancesClientListOptions) (*policy.Request, error) { +func (client *SAPCentralServerInstancesClient) listCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, _ *SAPCentralServerInstancesClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -338,59 +332,58 @@ func (client *SAPCentralInstancesClient) listCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // listHandleResponse handles the List response. -func (client *SAPCentralInstancesClient) listHandleResponse(resp *http.Response) (SAPCentralInstancesClientListResponse, error) { - result := SAPCentralInstancesClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.SAPCentralInstanceList); err != nil { - return SAPCentralInstancesClientListResponse{}, err +func (client *SAPCentralServerInstancesClient) listHandleResponse(resp *http.Response) (SAPCentralServerInstancesClientListResponse, error) { + result := SAPCentralServerInstancesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SAPCentralServerInstanceListResult); err != nil { + return SAPCentralServerInstancesClientListResponse{}, err } return result, nil } -// BeginStartInstance - Starts the SAP Central Services Instance. +// BeginStart - Starts the SAP Central Services Instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - sapVirtualInstanceName - The name of the Virtual Instances for SAP solutions resource // - centralInstanceName - Central Services Instance resource name string modeled as parameter for auto generation to work correctly. -// - options - SAPCentralInstancesClientBeginStartInstanceOptions contains the optional parameters for the SAPCentralInstancesClient.BeginStartInstance +// - options - SAPCentralServerInstancesClientBeginStartOptions contains the optional parameters for the SAPCentralServerInstancesClient.BeginStart // method. -func (client *SAPCentralInstancesClient) BeginStartInstance(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, options *SAPCentralInstancesClientBeginStartInstanceOptions) (*runtime.Poller[SAPCentralInstancesClientStartInstanceResponse], error) { +func (client *SAPCentralServerInstancesClient) BeginStart(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, options *SAPCentralServerInstancesClientBeginStartOptions) (*runtime.Poller[SAPCentralServerInstancesClientStartResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.startInstance(ctx, resourceGroupName, sapVirtualInstanceName, centralInstanceName, options) + resp, err := client.start(ctx, resourceGroupName, sapVirtualInstanceName, centralInstanceName, options) if err != nil { return nil, err } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SAPCentralInstancesClientStartInstanceResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SAPCentralServerInstancesClientStartResponse]{ + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SAPCentralInstancesClientStartInstanceResponse]{ + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SAPCentralServerInstancesClientStartResponse]{ Tracer: client.internal.Tracer(), }) } } -// StartInstance - Starts the SAP Central Services Instance. +// Start - Starts the SAP Central Services Instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview -func (client *SAPCentralInstancesClient) startInstance(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, options *SAPCentralInstancesClientBeginStartInstanceOptions) (*http.Response, error) { +// Generated from API version 2024-09-01 +func (client *SAPCentralServerInstancesClient) start(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, options *SAPCentralServerInstancesClientBeginStartOptions) (*http.Response, error) { var err error - const operationName = "SAPCentralInstancesClient.BeginStartInstance" + const operationName = "SAPCentralServerInstancesClient.BeginStart" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.startInstanceCreateRequest(ctx, resourceGroupName, sapVirtualInstanceName, centralInstanceName, options) + req, err := client.startCreateRequest(ctx, resourceGroupName, sapVirtualInstanceName, centralInstanceName, options) if err != nil { return nil, err } @@ -405,8 +398,8 @@ func (client *SAPCentralInstancesClient) startInstance(ctx context.Context, reso return httpResp, nil } -// startInstanceCreateRequest creates the StartInstance request. -func (client *SAPCentralInstancesClient) startInstanceCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, options *SAPCentralInstancesClientBeginStartInstanceOptions) (*policy.Request, error) { +// startCreateRequest creates the Start request. +func (client *SAPCentralServerInstancesClient) startCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, options *SAPCentralServerInstancesClientBeginStartOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}/start" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -429,10 +422,11 @@ func (client *SAPCentralInstancesClient) startInstanceCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Body != nil { + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, *options.Body); err != nil { return nil, err } @@ -441,44 +435,43 @@ func (client *SAPCentralInstancesClient) startInstanceCreateRequest(ctx context. return req, nil } -// BeginStopInstance - Stops the SAP Central Services Instance. +// BeginStop - Stops the SAP Central Services Instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - sapVirtualInstanceName - The name of the Virtual Instances for SAP solutions resource // - centralInstanceName - Central Services Instance resource name string modeled as parameter for auto generation to work correctly. -// - options - SAPCentralInstancesClientBeginStopInstanceOptions contains the optional parameters for the SAPCentralInstancesClient.BeginStopInstance +// - options - SAPCentralServerInstancesClientBeginStopOptions contains the optional parameters for the SAPCentralServerInstancesClient.BeginStop // method. -func (client *SAPCentralInstancesClient) BeginStopInstance(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, options *SAPCentralInstancesClientBeginStopInstanceOptions) (*runtime.Poller[SAPCentralInstancesClientStopInstanceResponse], error) { +func (client *SAPCentralServerInstancesClient) BeginStop(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, options *SAPCentralServerInstancesClientBeginStopOptions) (*runtime.Poller[SAPCentralServerInstancesClientStopResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.stopInstance(ctx, resourceGroupName, sapVirtualInstanceName, centralInstanceName, options) + resp, err := client.stop(ctx, resourceGroupName, sapVirtualInstanceName, centralInstanceName, options) if err != nil { return nil, err } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SAPCentralInstancesClientStopInstanceResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SAPCentralServerInstancesClientStopResponse]{ + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SAPCentralInstancesClientStopInstanceResponse]{ + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SAPCentralServerInstancesClientStopResponse]{ Tracer: client.internal.Tracer(), }) } } -// StopInstance - Stops the SAP Central Services Instance. +// Stop - Stops the SAP Central Services Instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview -func (client *SAPCentralInstancesClient) stopInstance(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, options *SAPCentralInstancesClientBeginStopInstanceOptions) (*http.Response, error) { +// Generated from API version 2024-09-01 +func (client *SAPCentralServerInstancesClient) stop(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, options *SAPCentralServerInstancesClientBeginStopOptions) (*http.Response, error) { var err error - const operationName = "SAPCentralInstancesClient.BeginStopInstance" + const operationName = "SAPCentralServerInstancesClient.BeginStop" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.stopInstanceCreateRequest(ctx, resourceGroupName, sapVirtualInstanceName, centralInstanceName, options) + req, err := client.stopCreateRequest(ctx, resourceGroupName, sapVirtualInstanceName, centralInstanceName, options) if err != nil { return nil, err } @@ -493,8 +486,8 @@ func (client *SAPCentralInstancesClient) stopInstance(ctx context.Context, resou return httpResp, nil } -// stopInstanceCreateRequest creates the StopInstance request. -func (client *SAPCentralInstancesClient) stopInstanceCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, options *SAPCentralInstancesClientBeginStopInstanceOptions) (*policy.Request, error) { +// stopCreateRequest creates the Stop request. +func (client *SAPCentralServerInstancesClient) stopCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, options *SAPCentralServerInstancesClientBeginStopOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}/stop" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -517,10 +510,11 @@ func (client *SAPCentralInstancesClient) stopInstanceCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Body != nil { + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, *options.Body); err != nil { return nil, err } @@ -529,41 +523,41 @@ func (client *SAPCentralInstancesClient) stopInstanceCreateRequest(ctx context.C return req, nil } -// Update - Updates the SAP Central Services Instance resource. -// This can be used to update tags on the resource. +// Update - Updates the SAP Central Services Instance resource. <br><br>This can be used to update tags on the +// resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - sapVirtualInstanceName - The name of the Virtual Instances for SAP solutions resource // - centralInstanceName - Central Services Instance resource name string modeled as parameter for auto generation to work correctly. -// - body - The SAP Central Services Instance resource request body. -// - options - SAPCentralInstancesClientUpdateOptions contains the optional parameters for the SAPCentralInstancesClient.Update +// - properties - The SAP Central Services Instance resource request body. +// - options - SAPCentralServerInstancesClientUpdateOptions contains the optional parameters for the SAPCentralServerInstancesClient.Update // method. -func (client *SAPCentralInstancesClient) Update(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, body UpdateSAPCentralInstanceRequest, options *SAPCentralInstancesClientUpdateOptions) (SAPCentralInstancesClientUpdateResponse, error) { +func (client *SAPCentralServerInstancesClient) Update(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, properties UpdateSAPCentralInstanceRequest, options *SAPCentralServerInstancesClientUpdateOptions) (SAPCentralServerInstancesClientUpdateResponse, error) { var err error - const operationName = "SAPCentralInstancesClient.Update" + const operationName = "SAPCentralServerInstancesClient.Update" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.updateCreateRequest(ctx, resourceGroupName, sapVirtualInstanceName, centralInstanceName, body, options) + req, err := client.updateCreateRequest(ctx, resourceGroupName, sapVirtualInstanceName, centralInstanceName, properties, options) if err != nil { - return SAPCentralInstancesClientUpdateResponse{}, err + return SAPCentralServerInstancesClientUpdateResponse{}, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return SAPCentralInstancesClientUpdateResponse{}, err + return SAPCentralServerInstancesClientUpdateResponse{}, err } if !runtime.HasStatusCode(httpResp, http.StatusOK) { err = runtime.NewResponseError(httpResp) - return SAPCentralInstancesClientUpdateResponse{}, err + return SAPCentralServerInstancesClientUpdateResponse{}, err } resp, err := client.updateHandleResponse(httpResp) return resp, err } // updateCreateRequest creates the Update request. -func (client *SAPCentralInstancesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, body UpdateSAPCentralInstanceRequest, options *SAPCentralInstancesClientUpdateOptions) (*policy.Request, error) { +func (client *SAPCentralServerInstancesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string, properties UpdateSAPCentralInstanceRequest, _ *SAPCentralServerInstancesClientUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -586,20 +580,21 @@ func (client *SAPCentralInstancesClient) updateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, body); err != nil { + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { return nil, err } return req, nil } // updateHandleResponse handles the Update response. -func (client *SAPCentralInstancesClient) updateHandleResponse(resp *http.Response) (SAPCentralInstancesClientUpdateResponse, error) { - result := SAPCentralInstancesClientUpdateResponse{} +func (client *SAPCentralServerInstancesClient) updateHandleResponse(resp *http.Response) (SAPCentralServerInstancesClientUpdateResponse, error) { + result := SAPCentralServerInstancesClientUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.SAPCentralServerInstance); err != nil { - return SAPCentralInstancesClientUpdateResponse{}, err + return SAPCentralServerInstancesClientUpdateResponse{}, err } return result, nil } diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapcentralserverinstances_client_example_test.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapcentralserverinstances_client_example_test.go new file mode 100644 index 000000000000..c682e2bcaabc --- /dev/null +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapcentralserverinstances_client_example_test.go @@ -0,0 +1,627 @@ +// 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 armworkloadssapvirtualinstance_test + +import ( + "context" + "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/workloadssapvirtualinstance/armworkloadssapvirtualinstance" + "log" +) + +// Generated from example definition: 2024-09-01/SapCentralInstances_Create.json +func ExampleSAPCentralServerInstancesClient_BeginCreate_sapCentralServerInstancesCreate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("6d875e77-e412-4d7d-9af4-8895278b4443", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSAPCentralServerInstancesClient().BeginCreate(ctx, "test-rg", "X00", "centralServer", armworkloadssapvirtualinstance.SAPCentralServerInstance{ + Location: to.Ptr("westcentralus"), + Properties: &armworkloadssapvirtualinstance.SAPCentralServerProperties{}, + Tags: map[string]*string{}, + }, 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 = armworkloadssapvirtualinstance.SAPCentralServerInstancesClientCreateResponse{ + // SAPCentralServerInstance: &armworkloadssapvirtualinstance.SAPCentralServerInstance{ + // Name: to.Ptr("centralServer"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/centralInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/centralInstances/centralServer"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPCentralServerProperties{ + // EnqueueReplicationServerProperties: &armworkloadssapvirtualinstance.EnqueueReplicationServerProperties{ + // ErsVersion: to.Ptr(armworkloadssapvirtualinstance.EnqueueReplicationServerTypeEnqueueReplicator1), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // Hostname: to.Ptr("vh-ers1"), + // InstanceNo: to.Ptr("00"), + // IPAddress: to.Ptr("10.0.0.5"), + // KernelPatch: to.Ptr("patch 300"), + // KernelVersion: to.Ptr("777"), + // }, + // EnqueueServerProperties: &armworkloadssapvirtualinstance.EnqueueServerProperties{ + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // Hostname: to.Ptr("vh-ascs1"), + // IPAddress: to.Ptr("10.0.0.5"), + // Port: to.Ptr[int64](3600), + // }, + // GatewayServerProperties: &armworkloadssapvirtualinstance.GatewayServerProperties{ + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // Port: to.Ptr[int64](3300), + // }, + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // InstanceNo: to.Ptr("00"), + // KernelPatch: to.Ptr("patch 300"), + // KernelVersion: to.Ptr("777"), + // MessageServerProperties: &armworkloadssapvirtualinstance.MessageServerProperties{ + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // Hostname: to.Ptr("vh-ascs1"), + // HTTPPort: to.Ptr[int64](8100), + // HTTPSPort: to.Ptr[int64](44400), + // InternalMsPort: to.Ptr[int64](3900), + // IPAddress: to.Ptr("10.0.0.5"), + // MSPort: to.Ptr[int64](3600), + // }, + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), + // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/SAP-E2ETest-rg/providers/Microsoft.Network/virtualNetworks/loop-test-vnet/subnets/loopsubnet"), + // VMDetails: []*armworkloadssapvirtualinstance.CentralServerVMDetails{ + // { + // Type: to.Ptr(armworkloadssapvirtualinstance.CentralServerVirtualMachineTypePrimary), + // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/cs-vm"), + // }, + // }, + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // }, + // }, + // } +} + +// Generated from example definition: 2024-09-01/SapCentralInstances_CreateForHaWithAvailabilitySet.json +func ExampleSAPCentralServerInstancesClient_BeginCreate_createSapCentralInstancesForHaSystemWithAvailabilitySet() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("6d875e77-e412-4d7d-9af4-8895278b4443", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSAPCentralServerInstancesClient().BeginCreate(ctx, "test-rg", "X00", "centralServer", armworkloadssapvirtualinstance.SAPCentralServerInstance{ + Location: to.Ptr("westcentralus"), + Properties: &armworkloadssapvirtualinstance.SAPCentralServerProperties{}, + Tags: map[string]*string{}, + }, 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 = armworkloadssapvirtualinstance.SAPCentralServerInstancesClientCreateResponse{ + // SAPCentralServerInstance: &armworkloadssapvirtualinstance.SAPCentralServerInstance{ + // Name: to.Ptr("centralServer"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/centralInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/centralInstances/centralServer"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPCentralServerProperties{ + // EnqueueReplicationServerProperties: &armworkloadssapvirtualinstance.EnqueueReplicationServerProperties{ + // ErsVersion: to.Ptr(armworkloadssapvirtualinstance.EnqueueReplicationServerTypeEnqueueReplicator1), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // Hostname: to.Ptr("vh-ers1"), + // InstanceNo: to.Ptr("00"), + // IPAddress: to.Ptr("10.0.0.5"), + // KernelPatch: to.Ptr("patch 300"), + // KernelVersion: to.Ptr("777"), + // }, + // EnqueueServerProperties: &armworkloadssapvirtualinstance.EnqueueServerProperties{ + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // Hostname: to.Ptr("vh-ascs1"), + // IPAddress: to.Ptr("10.0.0.5"), + // Port: to.Ptr[int64](3600), + // }, + // GatewayServerProperties: &armworkloadssapvirtualinstance.GatewayServerProperties{ + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // Port: to.Ptr[int64](3300), + // }, + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // InstanceNo: to.Ptr("00"), + // KernelPatch: to.Ptr("patch 300"), + // KernelVersion: to.Ptr("777"), + // LoadBalancerDetails: &armworkloadssapvirtualinstance.LoadBalancerDetails{ + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Network/loadBalancers/cs-ASCS-loadBalancer"), + // }, + // MessageServerProperties: &armworkloadssapvirtualinstance.MessageServerProperties{ + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // Hostname: to.Ptr("vh-ascs1"), + // HTTPPort: to.Ptr[int64](8100), + // HTTPSPort: to.Ptr[int64](44400), + // InternalMsPort: to.Ptr[int64](3900), + // IPAddress: to.Ptr("10.0.0.5"), + // MSPort: to.Ptr[int64](3600), + // }, + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), + // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/SAP-E2ETest-rg/providers/Microsoft.Network/virtualNetworks/loop-test-vnet/subnets/loopsubnet"), + // VMDetails: []*armworkloadssapvirtualinstance.CentralServerVMDetails{ + // { + // Type: to.Ptr(armworkloadssapvirtualinstance.CentralServerVirtualMachineTypePrimary), + // StorageDetails: []*armworkloadssapvirtualinstance.StorageInformation{ + // { + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/nfsstorageaccount"), + // }, + // }, + // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/cs-vm1"), + // }, + // { + // Type: to.Ptr(armworkloadssapvirtualinstance.CentralServerVirtualMachineTypePrimary), + // StorageDetails: []*armworkloadssapvirtualinstance.StorageInformation{ + // { + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/nfsstorageaccount"), + // }, + // }, + // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/cs-vm2"), + // }, + // }, + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // }, + // }, + // } +} + +// Generated from example definition: 2024-09-01/SapCentralInstances_Delete.json +func ExampleSAPCentralServerInstancesClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("6d875e77-e412-4d7d-9af4-8895278b4443", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSAPCentralServerInstancesClient().BeginDelete(ctx, "test-rg", "X00", "centralServer", 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: 2024-09-01/SapCentralInstances_Get.json +func ExampleSAPCentralServerInstancesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("6d875e77-e412-4d7d-9af4-8895278b4443", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSAPCentralServerInstancesClient().Get(ctx, "test-rg", "X00", "centralServer", 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 = armworkloadssapvirtualinstance.SAPCentralServerInstancesClientGetResponse{ + // SAPCentralServerInstance: &armworkloadssapvirtualinstance.SAPCentralServerInstance{ + // Name: to.Ptr("centralServer"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/centralInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/centralInstances/centralServer"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPCentralServerProperties{ + // EnqueueReplicationServerProperties: &armworkloadssapvirtualinstance.EnqueueReplicationServerProperties{ + // ErsVersion: to.Ptr(armworkloadssapvirtualinstance.EnqueueReplicationServerTypeEnqueueReplicator1), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // Hostname: to.Ptr("vh-ers1"), + // InstanceNo: to.Ptr("00"), + // IPAddress: to.Ptr("10.0.0.5"), + // KernelPatch: to.Ptr("patch 300"), + // KernelVersion: to.Ptr("777"), + // }, + // EnqueueServerProperties: &armworkloadssapvirtualinstance.EnqueueServerProperties{ + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), + // Hostname: to.Ptr("vh-ascs1"), + // IPAddress: to.Ptr("10.0.0.5"), + // Port: to.Ptr[int64](3600), + // }, + // GatewayServerProperties: &armworkloadssapvirtualinstance.GatewayServerProperties{ + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateDegraded), + // Port: to.Ptr[int64](3300), + // }, + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), + // InstanceNo: to.Ptr("00"), + // KernelPatch: to.Ptr("patch 300"), + // KernelVersion: to.Ptr("777"), + // MessageServerProperties: &armworkloadssapvirtualinstance.MessageServerProperties{ + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnhealthy), + // Hostname: to.Ptr("vh-ascs1"), + // HTTPPort: to.Ptr[int64](8100), + // HTTPSPort: to.Ptr[int64](44400), + // InternalMsPort: to.Ptr[int64](3900), + // IPAddress: to.Ptr("10.0.0.5"), + // MSPort: to.Ptr[int64](3600), + // }, + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), + // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/SAP-E2ETest-rg/providers/Microsoft.Network/virtualNetworks/loop-test-vnet/subnets/loopsubnet"), + // VMDetails: []*armworkloadssapvirtualinstance.CentralServerVMDetails{ + // { + // Type: to.Ptr(armworkloadssapvirtualinstance.CentralServerVirtualMachineTypePrimary), + // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/cs-vm"), + // }, + // }, + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // }, + // }, + // } +} + +// Generated from example definition: 2024-09-01/SapCentralServerInstances_ListBySapVirtualInstance.json +func ExampleSAPCentralServerInstancesClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("6d875e77-e412-4d7d-9af4-8895278b4443", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewSAPCentralServerInstancesClient().NewListPager("test-rg", "X00", 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 = armworkloadssapvirtualinstance.SAPCentralServerInstancesClientListResponse{ + // SAPCentralServerInstanceListResult: armworkloadssapvirtualinstance.SAPCentralServerInstanceListResult{ + // Value: []*armworkloadssapvirtualinstance.SAPCentralServerInstance{ + // { + // Name: to.Ptr("centralServer"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/centralInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/centralInstances/centralServer"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPCentralServerProperties{ + // EnqueueReplicationServerProperties: &armworkloadssapvirtualinstance.EnqueueReplicationServerProperties{ + // ErsVersion: to.Ptr(armworkloadssapvirtualinstance.EnqueueReplicationServerTypeEnqueueReplicator1), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // Hostname: to.Ptr("vh-ers1"), + // InstanceNo: to.Ptr("00"), + // IPAddress: to.Ptr("10.0.0.5"), + // KernelPatch: to.Ptr("patch 300"), + // KernelVersion: to.Ptr("777"), + // }, + // EnqueueServerProperties: &armworkloadssapvirtualinstance.EnqueueServerProperties{ + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // Hostname: to.Ptr("vh-ascs1"), + // IPAddress: to.Ptr("10.0.0.5"), + // Port: to.Ptr[int64](3600), + // }, + // GatewayServerProperties: &armworkloadssapvirtualinstance.GatewayServerProperties{ + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // Port: to.Ptr[int64](3300), + // }, + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // InstanceNo: to.Ptr("00"), + // KernelPatch: to.Ptr("patch 300"), + // KernelVersion: to.Ptr("777"), + // MessageServerProperties: &armworkloadssapvirtualinstance.MessageServerProperties{ + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // Hostname: to.Ptr("vh-ascs1"), + // HTTPPort: to.Ptr[int64](8100), + // HTTPSPort: to.Ptr[int64](44400), + // InternalMsPort: to.Ptr[int64](3900), + // IPAddress: to.Ptr("10.0.0.5"), + // MSPort: to.Ptr[int64](3600), + // }, + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), + // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/SAP-E2ETest-rg/providers/Microsoft.Network/virtualNetworks/loop-test-vnet/subnets/loopsubnet"), + // VMDetails: []*armworkloadssapvirtualinstance.CentralServerVMDetails{ + // { + // Type: to.Ptr(armworkloadssapvirtualinstance.CentralServerVirtualMachineTypePrimary), + // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/cs-vm"), + // }, + // }, + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // }, + // }, + // }, + // }, + // } + } +} + +// Generated from example definition: 2024-09-01/SapCentralInstances_StartInstance.json +func ExampleSAPCentralServerInstancesClient_BeginStart_startTheSapCentralServicesInstance() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSAPCentralServerInstancesClient().BeginStart(ctx, "test-rg", "X00", "centralServer", &SAPCentralServerInstancesClientBeginStartOptions{ + body: &armworkloadssapvirtualinstance.StartRequest{}}) + 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 = armworkloadssapvirtualinstance.SAPCentralServerInstancesClientStartResponse{ + // OperationStatusResult: &armworkloadssapvirtualinstance.OperationStatusResult{ + // Name: to.Ptr("centralServer"), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/centralInstances/centralServer"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), + // Status: to.Ptr("Succeeded"), + // }, + // } +} + +// Generated from example definition: 2024-09-01/SapCentralInstances_StartInstanceVM.json +func ExampleSAPCentralServerInstancesClient_BeginStart_startTheVirtualMachineSAndTheSapCentralServicesInstanceOnIt() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSAPCentralServerInstancesClient().BeginStart(ctx, "test-rg", "X00", "centralServer", &SAPCentralServerInstancesClientBeginStartOptions{ + body: &armworkloadssapvirtualinstance.StartRequest{ + StartVM: to.Ptr(true), + }}) + 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 = armworkloadssapvirtualinstance.SAPCentralServerInstancesClientStartResponse{ + // OperationStatusResult: &armworkloadssapvirtualinstance.OperationStatusResult{ + // Name: to.Ptr("centralServer"), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/centralInstances/centralServer"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), + // Status: to.Ptr("Succeeded"), + // }, + // } +} + +// Generated from example definition: 2024-09-01/SapCentralInstances_StopInstance.json +func ExampleSAPCentralServerInstancesClient_BeginStop_stopTheSapCentralServicesInstance() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSAPCentralServerInstancesClient().BeginStop(ctx, "test-rg", "X00", "centralServer", &SAPCentralServerInstancesClientBeginStopOptions{ + body: &armworkloadssapvirtualinstance.StopRequest{ + SoftStopTimeoutSeconds: to.Ptr[int64](1200), + }}) + 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 = armworkloadssapvirtualinstance.SAPCentralServerInstancesClientStopResponse{ + // OperationStatusResult: &armworkloadssapvirtualinstance.OperationStatusResult{ + // Name: to.Ptr("centralServer"), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/centralInstances/centralServer"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), + // Status: to.Ptr("Succeeded"), + // }, + // } +} + +// Generated from example definition: 2024-09-01/SapCentralInstances_StopInstanceVM.json +func ExampleSAPCentralServerInstancesClient_BeginStop_stopTheSapCentralServicesInstanceAndItsUnderlyingVirtualMachineS() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSAPCentralServerInstancesClient().BeginStop(ctx, "test-rg", "X00", "centralServer", &SAPCentralServerInstancesClientBeginStopOptions{ + body: &armworkloadssapvirtualinstance.StopRequest{ + DeallocateVM: to.Ptr(true), + }}) + 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 = armworkloadssapvirtualinstance.SAPCentralServerInstancesClientStopResponse{ + // OperationStatusResult: &armworkloadssapvirtualinstance.OperationStatusResult{ + // Name: to.Ptr("centralServer"), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/centralInstances/centralServer"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), + // Status: to.Ptr("Succeeded"), + // }, + // } +} + +// Generated from example definition: 2024-09-01/SapCentralInstances_Update.json +func ExampleSAPCentralServerInstancesClient_Update() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("6d875e77-e412-4d7d-9af4-8895278b4443", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSAPCentralServerInstancesClient().Update(ctx, "test-rg", "X00", "centralServer", armworkloadssapvirtualinstance.UpdateSAPCentralInstanceRequest{ + Tags: map[string]*string{ + "tag1": to.Ptr("value1"), + }, + }, 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 = armworkloadssapvirtualinstance.SAPCentralServerInstancesClientUpdateResponse{ + // SAPCentralServerInstance: &armworkloadssapvirtualinstance.SAPCentralServerInstance{ + // Name: to.Ptr("centralServer"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/centralInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/centralInstances/centralServer"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPCentralServerProperties{ + // EnqueueReplicationServerProperties: &armworkloadssapvirtualinstance.EnqueueReplicationServerProperties{ + // ErsVersion: to.Ptr(armworkloadssapvirtualinstance.EnqueueReplicationServerTypeEnqueueReplicator1), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // Hostname: to.Ptr("vh-ers1"), + // InstanceNo: to.Ptr("00"), + // IPAddress: to.Ptr("10.0.0.5"), + // KernelPatch: to.Ptr("patch 300"), + // KernelVersion: to.Ptr("777"), + // }, + // EnqueueServerProperties: &armworkloadssapvirtualinstance.EnqueueServerProperties{ + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // Hostname: to.Ptr("vh-ascs1"), + // IPAddress: to.Ptr("10.0.0.5"), + // Port: to.Ptr[int64](3600), + // }, + // GatewayServerProperties: &armworkloadssapvirtualinstance.GatewayServerProperties{ + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // Port: to.Ptr[int64](3300), + // }, + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // InstanceNo: to.Ptr("00"), + // KernelPatch: to.Ptr("patch 300"), + // KernelVersion: to.Ptr("777"), + // MessageServerProperties: &armworkloadssapvirtualinstance.MessageServerProperties{ + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // Hostname: to.Ptr("vh-ascs1"), + // HTTPPort: to.Ptr[int64](8100), + // HTTPSPort: to.Ptr[int64](44400), + // InternalMsPort: to.Ptr[int64](3900), + // IPAddress: to.Ptr("10.0.0.5"), + // MSPort: to.Ptr[int64](3600), + // }, + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), + // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/SAP-E2ETest-rg/providers/Microsoft.Network/virtualNetworks/loop-test-vnet/subnets/loopsubnet"), + // VMDetails: []*armworkloadssapvirtualinstance.CentralServerVMDetails{ + // { + // Type: to.Ptr(armworkloadssapvirtualinstance.CentralServerVirtualMachineTypePrimary), + // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/cs-vm"), + // }, + // }, + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapdatabaseinstances_client.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapdatabaseinstances_client.go index 82161ffb0f2a..db0c2fe0240e 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapdatabaseinstances_client.go +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapdatabaseinstances_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 armworkloadssapvirtualinstance @@ -28,7 +24,7 @@ type SAPDatabaseInstancesClient struct { } // NewSAPDatabaseInstancesClient creates a new instance of SAPDatabaseInstancesClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - 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 NewSAPDatabaseInstancesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SAPDatabaseInstancesClient, error) { @@ -43,26 +39,25 @@ func NewSAPDatabaseInstancesClient(subscriptionID string, credential azcore.Toke return client, nil } -// BeginCreate - Creates the Database resource corresponding to the Virtual Instance for SAP solutions resource. -// This will be used by service only. PUT by end user will return a Bad Request error. +// BeginCreate - Creates the Database resource corresponding to the Virtual Instance for SAP solutions resource. <br><br>This +// will be used by service only. PUT by end user will return a Bad Request error. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - sapVirtualInstanceName - The name of the Virtual Instances for SAP solutions resource // - databaseInstanceName - Database resource name string modeled as parameter for auto generation to work correctly. -// - body - Request body of Database resource of a SAP system. +// - resource - Request body of Database resource of a SAP system. // - options - SAPDatabaseInstancesClientBeginCreateOptions contains the optional parameters for the SAPDatabaseInstancesClient.BeginCreate // method. -func (client *SAPDatabaseInstancesClient) BeginCreate(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, body SAPDatabaseInstance, options *SAPDatabaseInstancesClientBeginCreateOptions) (*runtime.Poller[SAPDatabaseInstancesClientCreateResponse], error) { +func (client *SAPDatabaseInstancesClient) BeginCreate(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, resource SAPDatabaseInstance, options *SAPDatabaseInstancesClientBeginCreateOptions) (*runtime.Poller[SAPDatabaseInstancesClientCreateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.create(ctx, resourceGroupName, sapVirtualInstanceName, databaseInstanceName, body, options) + resp, err := client.create(ctx, resourceGroupName, sapVirtualInstanceName, databaseInstanceName, resource, options) if err != nil { return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SAPDatabaseInstancesClientCreateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -72,18 +67,18 @@ func (client *SAPDatabaseInstancesClient) BeginCreate(ctx context.Context, resou } } -// Create - Creates the Database resource corresponding to the Virtual Instance for SAP solutions resource. -// This will be used by service only. PUT by end user will return a Bad Request error. +// Create - Creates the Database resource corresponding to the Virtual Instance for SAP solutions resource. <br><br>This +// will be used by service only. PUT by end user will return a Bad Request error. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview -func (client *SAPDatabaseInstancesClient) create(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, body SAPDatabaseInstance, options *SAPDatabaseInstancesClientBeginCreateOptions) (*http.Response, error) { +// Generated from API version 2024-09-01 +func (client *SAPDatabaseInstancesClient) create(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, resource SAPDatabaseInstance, options *SAPDatabaseInstancesClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "SAPDatabaseInstancesClient.BeginCreate" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.createCreateRequest(ctx, resourceGroupName, sapVirtualInstanceName, databaseInstanceName, body, options) + req, err := client.createCreateRequest(ctx, resourceGroupName, sapVirtualInstanceName, databaseInstanceName, resource, options) if err != nil { return nil, err } @@ -99,7 +94,7 @@ func (client *SAPDatabaseInstancesClient) create(ctx context.Context, resourceGr } // createCreateRequest creates the Create request. -func (client *SAPDatabaseInstancesClient) createCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, body SAPDatabaseInstance, options *SAPDatabaseInstancesClientBeginCreateOptions) (*policy.Request, error) { +func (client *SAPDatabaseInstancesClient) createCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, resource SAPDatabaseInstance, _ *SAPDatabaseInstancesClientBeginCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -122,20 +117,21 @@ func (client *SAPDatabaseInstancesClient) createCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, body); err != nil { + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { return nil, err } return req, nil } -// BeginDelete - Deletes the Database resource corresponding to a Virtual Instance for SAP solutions resource. -// This will be used by service only. Delete by end user will return a Bad Request error. +// BeginDelete - Deletes the Database resource corresponding to a Virtual Instance for SAP solutions resource. <br><br>This +// will be used by service only. Delete by end user will return a Bad Request error. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - sapVirtualInstanceName - The name of the Virtual Instances for SAP solutions resource // - databaseInstanceName - Database resource name string modeled as parameter for auto generation to work correctly. @@ -148,8 +144,7 @@ func (client *SAPDatabaseInstancesClient) BeginDelete(ctx context.Context, resou return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SAPDatabaseInstancesClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -159,11 +154,11 @@ func (client *SAPDatabaseInstancesClient) BeginDelete(ctx context.Context, resou } } -// Delete - Deletes the Database resource corresponding to a Virtual Instance for SAP solutions resource. -// This will be used by service only. Delete by end user will return a Bad Request error. +// Delete - Deletes the Database resource corresponding to a Virtual Instance for SAP solutions resource. <br><br>This +// will be used by service only. Delete by end user will return a Bad Request error. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 func (client *SAPDatabaseInstancesClient) deleteOperation(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, options *SAPDatabaseInstancesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "SAPDatabaseInstancesClient.BeginDelete" @@ -186,7 +181,7 @@ func (client *SAPDatabaseInstancesClient) deleteOperation(ctx context.Context, r } // deleteCreateRequest creates the Delete request. -func (client *SAPDatabaseInstancesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, options *SAPDatabaseInstancesClientBeginDeleteOptions) (*policy.Request, error) { +func (client *SAPDatabaseInstancesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, _ *SAPDatabaseInstancesClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -209,7 +204,7 @@ func (client *SAPDatabaseInstancesClient) deleteCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -218,7 +213,7 @@ func (client *SAPDatabaseInstancesClient) deleteCreateRequest(ctx context.Contex // Get - Gets the SAP Database Instance resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - sapVirtualInstanceName - The name of the Virtual Instances for SAP solutions resource // - databaseInstanceName - Database resource name string modeled as parameter for auto generation to work correctly. @@ -247,7 +242,7 @@ func (client *SAPDatabaseInstancesClient) Get(ctx context.Context, resourceGroup } // getCreateRequest creates the Get request. -func (client *SAPDatabaseInstancesClient) getCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, options *SAPDatabaseInstancesClientGetOptions) (*policy.Request, error) { +func (client *SAPDatabaseInstancesClient) getCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, _ *SAPDatabaseInstancesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -270,7 +265,7 @@ func (client *SAPDatabaseInstancesClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -287,7 +282,7 @@ func (client *SAPDatabaseInstancesClient) getHandleResponse(resp *http.Response) // NewListPager - Lists the Database resources associated with a Virtual Instance for SAP solutions resource. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - sapVirtualInstanceName - The name of the Virtual Instances for SAP solutions resource // - options - SAPDatabaseInstancesClientListOptions contains the optional parameters for the SAPDatabaseInstancesClient.NewListPager @@ -316,7 +311,7 @@ func (client *SAPDatabaseInstancesClient) NewListPager(resourceGroupName string, } // listCreateRequest creates the List request. -func (client *SAPDatabaseInstancesClient) listCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, options *SAPDatabaseInstancesClientListOptions) (*policy.Request, error) { +func (client *SAPDatabaseInstancesClient) listCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, _ *SAPDatabaseInstancesClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -335,7 +330,7 @@ func (client *SAPDatabaseInstancesClient) listCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -344,50 +339,49 @@ func (client *SAPDatabaseInstancesClient) listCreateRequest(ctx context.Context, // listHandleResponse handles the List response. func (client *SAPDatabaseInstancesClient) listHandleResponse(resp *http.Response) (SAPDatabaseInstancesClientListResponse, error) { result := SAPDatabaseInstancesClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.SAPDatabaseInstanceList); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.SAPDatabaseInstanceListResult); err != nil { return SAPDatabaseInstancesClientListResponse{}, err } return result, nil } -// BeginStartInstance - Starts the database instance of the SAP system. +// BeginStart - Starts the database instance of the SAP system. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - sapVirtualInstanceName - The name of the Virtual Instances for SAP solutions resource // - databaseInstanceName - Database resource name string modeled as parameter for auto generation to work correctly. -// - options - SAPDatabaseInstancesClientBeginStartInstanceOptions contains the optional parameters for the SAPDatabaseInstancesClient.BeginStartInstance +// - options - SAPDatabaseInstancesClientBeginStartOptions contains the optional parameters for the SAPDatabaseInstancesClient.BeginStart // method. -func (client *SAPDatabaseInstancesClient) BeginStartInstance(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, options *SAPDatabaseInstancesClientBeginStartInstanceOptions) (*runtime.Poller[SAPDatabaseInstancesClientStartInstanceResponse], error) { +func (client *SAPDatabaseInstancesClient) BeginStart(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, options *SAPDatabaseInstancesClientBeginStartOptions) (*runtime.Poller[SAPDatabaseInstancesClientStartResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.startInstance(ctx, resourceGroupName, sapVirtualInstanceName, databaseInstanceName, options) + resp, err := client.start(ctx, resourceGroupName, sapVirtualInstanceName, databaseInstanceName, options) if err != nil { return nil, err } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SAPDatabaseInstancesClientStartInstanceResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SAPDatabaseInstancesClientStartResponse]{ + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SAPDatabaseInstancesClientStartInstanceResponse]{ + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SAPDatabaseInstancesClientStartResponse]{ Tracer: client.internal.Tracer(), }) } } -// StartInstance - Starts the database instance of the SAP system. +// Start - Starts the database instance of the SAP system. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview -func (client *SAPDatabaseInstancesClient) startInstance(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, options *SAPDatabaseInstancesClientBeginStartInstanceOptions) (*http.Response, error) { +// Generated from API version 2024-09-01 +func (client *SAPDatabaseInstancesClient) start(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, options *SAPDatabaseInstancesClientBeginStartOptions) (*http.Response, error) { var err error - const operationName = "SAPDatabaseInstancesClient.BeginStartInstance" + const operationName = "SAPDatabaseInstancesClient.BeginStart" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.startInstanceCreateRequest(ctx, resourceGroupName, sapVirtualInstanceName, databaseInstanceName, options) + req, err := client.startCreateRequest(ctx, resourceGroupName, sapVirtualInstanceName, databaseInstanceName, options) if err != nil { return nil, err } @@ -402,8 +396,8 @@ func (client *SAPDatabaseInstancesClient) startInstance(ctx context.Context, res return httpResp, nil } -// startInstanceCreateRequest creates the StartInstance request. -func (client *SAPDatabaseInstancesClient) startInstanceCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, options *SAPDatabaseInstancesClientBeginStartInstanceOptions) (*policy.Request, error) { +// startCreateRequest creates the Start request. +func (client *SAPDatabaseInstancesClient) startCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, options *SAPDatabaseInstancesClientBeginStartOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}/start" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -426,10 +420,11 @@ func (client *SAPDatabaseInstancesClient) startInstanceCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Body != nil { + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, *options.Body); err != nil { return nil, err } @@ -438,44 +433,43 @@ func (client *SAPDatabaseInstancesClient) startInstanceCreateRequest(ctx context return req, nil } -// BeginStopInstance - Stops the database instance of the SAP system. +// BeginStop - Stops the database instance of the SAP system. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - sapVirtualInstanceName - The name of the Virtual Instances for SAP solutions resource // - databaseInstanceName - Database resource name string modeled as parameter for auto generation to work correctly. -// - options - SAPDatabaseInstancesClientBeginStopInstanceOptions contains the optional parameters for the SAPDatabaseInstancesClient.BeginStopInstance +// - options - SAPDatabaseInstancesClientBeginStopOptions contains the optional parameters for the SAPDatabaseInstancesClient.BeginStop // method. -func (client *SAPDatabaseInstancesClient) BeginStopInstance(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, options *SAPDatabaseInstancesClientBeginStopInstanceOptions) (*runtime.Poller[SAPDatabaseInstancesClientStopInstanceResponse], error) { +func (client *SAPDatabaseInstancesClient) BeginStop(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, options *SAPDatabaseInstancesClientBeginStopOptions) (*runtime.Poller[SAPDatabaseInstancesClientStopResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.stopInstance(ctx, resourceGroupName, sapVirtualInstanceName, databaseInstanceName, options) + resp, err := client.stop(ctx, resourceGroupName, sapVirtualInstanceName, databaseInstanceName, options) if err != nil { return nil, err } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SAPDatabaseInstancesClientStopInstanceResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SAPDatabaseInstancesClientStopResponse]{ + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SAPDatabaseInstancesClientStopInstanceResponse]{ + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SAPDatabaseInstancesClientStopResponse]{ Tracer: client.internal.Tracer(), }) } } -// StopInstance - Stops the database instance of the SAP system. +// Stop - Stops the database instance of the SAP system. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview -func (client *SAPDatabaseInstancesClient) stopInstance(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, options *SAPDatabaseInstancesClientBeginStopInstanceOptions) (*http.Response, error) { +// Generated from API version 2024-09-01 +func (client *SAPDatabaseInstancesClient) stop(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, options *SAPDatabaseInstancesClientBeginStopOptions) (*http.Response, error) { var err error - const operationName = "SAPDatabaseInstancesClient.BeginStopInstance" + const operationName = "SAPDatabaseInstancesClient.BeginStop" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.stopInstanceCreateRequest(ctx, resourceGroupName, sapVirtualInstanceName, databaseInstanceName, options) + req, err := client.stopCreateRequest(ctx, resourceGroupName, sapVirtualInstanceName, databaseInstanceName, options) if err != nil { return nil, err } @@ -490,8 +484,8 @@ func (client *SAPDatabaseInstancesClient) stopInstance(ctx context.Context, reso return httpResp, nil } -// stopInstanceCreateRequest creates the StopInstance request. -func (client *SAPDatabaseInstancesClient) stopInstanceCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, options *SAPDatabaseInstancesClientBeginStopInstanceOptions) (*policy.Request, error) { +// stopCreateRequest creates the Stop request. +func (client *SAPDatabaseInstancesClient) stopCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, options *SAPDatabaseInstancesClientBeginStopOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}/stop" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -514,10 +508,11 @@ func (client *SAPDatabaseInstancesClient) stopInstanceCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Body != nil { + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, *options.Body); err != nil { return nil, err } @@ -526,23 +521,23 @@ func (client *SAPDatabaseInstancesClient) stopInstanceCreateRequest(ctx context. return req, nil } -// Update - Updates the Database instance resource. This can be used to update tags on the resource. +// Update - Updates the Database resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - sapVirtualInstanceName - The name of the Virtual Instances for SAP solutions resource // - databaseInstanceName - Database resource name string modeled as parameter for auto generation to work correctly. -// - body - Database resource update request body. +// - properties - Database resource update request body. // - options - SAPDatabaseInstancesClientUpdateOptions contains the optional parameters for the SAPDatabaseInstancesClient.Update // method. -func (client *SAPDatabaseInstancesClient) Update(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, body UpdateSAPDatabaseInstanceRequest, options *SAPDatabaseInstancesClientUpdateOptions) (SAPDatabaseInstancesClientUpdateResponse, error) { +func (client *SAPDatabaseInstancesClient) Update(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, properties UpdateSAPDatabaseInstanceRequest, options *SAPDatabaseInstancesClientUpdateOptions) (SAPDatabaseInstancesClientUpdateResponse, error) { var err error const operationName = "SAPDatabaseInstancesClient.Update" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.updateCreateRequest(ctx, resourceGroupName, sapVirtualInstanceName, databaseInstanceName, body, options) + req, err := client.updateCreateRequest(ctx, resourceGroupName, sapVirtualInstanceName, databaseInstanceName, properties, options) if err != nil { return SAPDatabaseInstancesClientUpdateResponse{}, err } @@ -559,7 +554,7 @@ func (client *SAPDatabaseInstancesClient) Update(ctx context.Context, resourceGr } // updateCreateRequest creates the Update request. -func (client *SAPDatabaseInstancesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, body UpdateSAPDatabaseInstanceRequest, options *SAPDatabaseInstancesClientUpdateOptions) (*policy.Request, error) { +func (client *SAPDatabaseInstancesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string, properties UpdateSAPDatabaseInstanceRequest, _ *SAPDatabaseInstancesClientUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -582,10 +577,11 @@ func (client *SAPDatabaseInstancesClient) updateCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, body); err != nil { + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { return nil, err } return req, nil diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapdatabaseinstances_client_example_test.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapdatabaseinstances_client_example_test.go index 05c7f04b06f0..1a21f88cb51b 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapdatabaseinstances_client_example_test.go +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapdatabaseinstances_client_example_test.go @@ -1,78 +1,91 @@ -//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 armworkloadssapvirtualinstance_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/workloadssapvirtualinstance/armworkloadssapvirtualinstance" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapdatabaseinstances/SAPDatabaseInstances_Get.json -func ExampleSAPDatabaseInstancesClient_Get() { +// Generated from example definition: 2024-09-01/SapDatabaseInstances_Create.json +func ExampleSAPDatabaseInstancesClient_BeginCreate_sapDatabaseInstancesCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("6d875e77-e412-4d7d-9af4-8895278b4443", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewSAPDatabaseInstancesClient().Get(ctx, "test-rg", "X00", "databaseServer", nil) + poller, err := clientFactory.NewSAPDatabaseInstancesClient().BeginCreate(ctx, "test-rg", "X00", "databaseServer", armworkloadssapvirtualinstance.SAPDatabaseInstance{ + Location: to.Ptr("westcentralus"), + Properties: &armworkloadssapvirtualinstance.SAPDatabaseProperties{}, + Tags: map[string]*string{}, + }, 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.SAPDatabaseInstance = armworkloadssapvirtualinstance.SAPDatabaseInstance{ - // Name: to.Ptr("databaseServer"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/databaseInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/databaseInstances/databaseServer"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPDatabaseProperties{ - // DatabaseSid: to.Ptr("X00"), - // DatabaseType: to.Ptr("hdb"), - // IPAddress: to.Ptr("10.0.0.5"), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), - // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // VMDetails: []*armworkloadssapvirtualinstance.DatabaseVMDetails{ - // { - // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/db-vm"), - // }}, + // res = armworkloadssapvirtualinstance.SAPDatabaseInstancesClientCreateResponse{ + // SAPDatabaseInstance: &armworkloadssapvirtualinstance.SAPDatabaseInstance{ + // Name: to.Ptr("databaseServer"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/databaseInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/databaseInstances/databaseServer"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPDatabaseProperties{ + // DatabaseSid: to.Ptr("X00"), + // DatabaseType: to.Ptr("hdb"), + // IPAddress: to.Ptr("10.0.0.5"), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), + // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), + // VMDetails: []*armworkloadssapvirtualinstance.DatabaseVMDetails{ + // { + // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/db-vm"), + // }, + // }, + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // }, // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapdatabaseinstances/SAPDatabaseInstances_Create_HA_AvSet.json +// Generated from example definition: 2024-09-01/SapDatabaseInstances_CreateForHaWithAvailabilitySet.json func ExampleSAPDatabaseInstancesClient_BeginCreate_createSapDatabaseInstancesForHaSystemWithAvailabilitySet() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("6d875e77-e412-4d7d-9af4-8895278b4443", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } poller, err := clientFactory.NewSAPDatabaseInstancesClient().BeginCreate(ctx, "test-rg", "X00", "databaseServer", armworkloadssapvirtualinstance.SAPDatabaseInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, + Location: to.Ptr("westcentralus"), Properties: &armworkloadssapvirtualinstance.SAPDatabaseProperties{}, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -84,243 +97,292 @@ func ExampleSAPDatabaseInstancesClient_BeginCreate_createSapDatabaseInstancesFor // 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.SAPDatabaseInstance = armworkloadssapvirtualinstance.SAPDatabaseInstance{ - // Name: to.Ptr("databaseServer"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/databaseInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/databaseInstances/databaseServer"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPDatabaseProperties{ - // DatabaseSid: to.Ptr("X00"), - // DatabaseType: to.Ptr("hdb"), - // IPAddress: to.Ptr("10.0.0.5"), - // LoadBalancerDetails: &armworkloadssapvirtualinstance.LoadBalancerDetails{ - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Network/loadBalancers/db-loadBalancer"), + // res = armworkloadssapvirtualinstance.SAPDatabaseInstancesClientCreateResponse{ + // SAPDatabaseInstance: &armworkloadssapvirtualinstance.SAPDatabaseInstance{ + // Name: to.Ptr("databaseServer"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/databaseInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/databaseInstances/databaseServer"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPDatabaseProperties{ + // DatabaseSid: to.Ptr("X00"), + // DatabaseType: to.Ptr("hdb"), + // IPAddress: to.Ptr("10.0.0.5"), + // LoadBalancerDetails: &armworkloadssapvirtualinstance.LoadBalancerDetails{ + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Network/loadBalancers/db-loadBalancer"), + // }, + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), + // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), + // VMDetails: []*armworkloadssapvirtualinstance.DatabaseVMDetails{ + // { + // StorageDetails: []*armworkloadssapvirtualinstance.StorageInformation{ + // { + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/nfsstorageaccount"), + // }, + // }, + // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/db-vm"), + // }, + // }, + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ // }, - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), - // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // VMDetails: []*armworkloadssapvirtualinstance.DatabaseVMDetails{ - // { - // StorageDetails: []*armworkloadssapvirtualinstance.StorageInformation{ - // { - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/nfsstorageaccount"), - // }}, - // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/db-vm"), - // }}, // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapdatabaseinstances/SAPDatabaseInstances_Create.json -func ExampleSAPDatabaseInstancesClient_BeginCreate_sapDatabaseInstancesCreate() { +// Generated from example definition: 2024-09-01/SapDatabaseInstances_Delete.json +func ExampleSAPDatabaseInstancesClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("6d875e77-e412-4d7d-9af4-8895278b4443", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewSAPDatabaseInstancesClient().BeginCreate(ctx, "test-rg", "X00", "databaseServer", armworkloadssapvirtualinstance.SAPDatabaseInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, - Properties: &armworkloadssapvirtualinstance.SAPDatabaseProperties{}, - }, nil) + poller, err := clientFactory.NewSAPDatabaseInstancesClient().BeginDelete(ctx, "test-rg", "X00", "databaseServer", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - res, err := poller.PollUntilDone(ctx, nil) + _, err = poller.PollUntilDone(ctx, nil) if err != nil { log.Fatalf("failed to pull the result: %v", err) } +} + +// Generated from example definition: 2024-09-01/SapDatabaseInstances_Get.json +func ExampleSAPDatabaseInstancesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("6d875e77-e412-4d7d-9af4-8895278b4443", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSAPDatabaseInstancesClient().Get(ctx, "test-rg", "X00", "databaseServer", 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.SAPDatabaseInstance = armworkloadssapvirtualinstance.SAPDatabaseInstance{ - // Name: to.Ptr("databaseServer"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/databaseInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/databaseInstances/databaseServer"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPDatabaseProperties{ - // DatabaseSid: to.Ptr("X00"), - // DatabaseType: to.Ptr("hdb"), - // IPAddress: to.Ptr("10.0.0.5"), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), - // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // VMDetails: []*armworkloadssapvirtualinstance.DatabaseVMDetails{ - // { - // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/db-vm"), - // }}, + // res = armworkloadssapvirtualinstance.SAPDatabaseInstancesClientGetResponse{ + // SAPDatabaseInstance: &armworkloadssapvirtualinstance.SAPDatabaseInstance{ + // Name: to.Ptr("databaseServer"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/databaseInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/databaseInstances/databaseServer"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPDatabaseProperties{ + // DatabaseSid: to.Ptr("X00"), + // DatabaseType: to.Ptr("hdb"), + // IPAddress: to.Ptr("10.0.0.5"), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), + // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), + // VMDetails: []*armworkloadssapvirtualinstance.DatabaseVMDetails{ + // { + // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/db-vm"), + // }, + // }, + // }, + // Tags: map[string]*string{ + // }, // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapdatabaseinstances/SAPDatabaseInstances_Update.json -func ExampleSAPDatabaseInstancesClient_Update() { +// Generated from example definition: 2024-09-01/SapDatabaseInstances_List.json +func ExampleSAPDatabaseInstancesClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("6d875e77-e412-4d7d-9af4-8895278b4443", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewSAPDatabaseInstancesClient().Update(ctx, "test-rg", "X00", "databaseServer", armworkloadssapvirtualinstance.UpdateSAPDatabaseInstanceRequest{ - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - }, - }, nil) + pager := clientFactory.NewSAPDatabaseInstancesClient().NewListPager("test-rg", "X00", 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 = armworkloadssapvirtualinstance.SAPDatabaseInstancesClientListResponse{ + // SAPDatabaseInstanceListResult: armworkloadssapvirtualinstance.SAPDatabaseInstanceListResult{ + // Value: []*armworkloadssapvirtualinstance.SAPDatabaseInstance{ + // { + // Name: to.Ptr("databaseServer"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/databaseInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/databaseInstances/databaseServer"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPDatabaseProperties{ + // DatabaseSid: to.Ptr("X00"), + // DatabaseType: to.Ptr("hdb"), + // IPAddress: to.Ptr("10.0.0.5"), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), + // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), + // VMDetails: []*armworkloadssapvirtualinstance.DatabaseVMDetails{ + // { + // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/db-vm"), + // }, + // }, + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // }, + // }, + // }, + // }, + // } + } +} + +// Generated from example definition: 2024-09-01/SapDatabaseInstances_StartInstance.json +func ExampleSAPDatabaseInstancesClient_BeginStart_startTheDatabaseInstanceOfTheSapSystem() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSAPDatabaseInstancesClient().BeginStart(ctx, "test-rg", "X00", "db0", &SAPDatabaseInstancesClientBeginStartOptions{ + body: &armworkloadssapvirtualinstance.StartRequest{}}) 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.SAPDatabaseInstance = armworkloadssapvirtualinstance.SAPDatabaseInstance{ - // Name: to.Ptr("databaseServer"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/databaseInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/databaseInstances/databaseServer"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPDatabaseProperties{ - // DatabaseSid: to.Ptr("X00"), - // DatabaseType: to.Ptr("hdb"), - // IPAddress: to.Ptr("10.0.0.5"), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), - // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // VMDetails: []*armworkloadssapvirtualinstance.DatabaseVMDetails{ - // { - // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/db-vm"), - // }}, + // res = armworkloadssapvirtualinstance.SAPDatabaseInstancesClientStartResponse{ + // OperationStatusResult: &armworkloadssapvirtualinstance.OperationStatusResult{ + // Name: to.Ptr("db0"), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-01T03:38:07.000Z"); return t}()), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/db0"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-01T03:36:07.000Z"); return t}()), + // Status: to.Ptr("Succeeded"), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapdatabaseinstances/SAPDatabaseInstances_Delete.json -func ExampleSAPDatabaseInstancesClient_BeginDelete() { +// Generated from example definition: 2024-09-01/SapDatabaseInstances_StartInstanceVM.json +func ExampleSAPDatabaseInstancesClient_BeginStart_startVirtualMachineAndTheDatabaseInstanceOfTheSapSystemOnIt() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewSAPDatabaseInstancesClient().BeginDelete(ctx, "test-rg", "X00", "databaseServer", nil) + poller, err := clientFactory.NewSAPDatabaseInstancesClient().BeginStart(ctx, "test-rg", "X00", "db0", &SAPDatabaseInstancesClientBeginStartOptions{ + body: &armworkloadssapvirtualinstance.StartRequest{ + StartVM: to.Ptr(true), + }}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - _, err = poller.PollUntilDone(ctx, nil) + res, err := poller.PollUntilDone(ctx, nil) if err != nil { log.Fatalf("failed to pull the result: %v", err) } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res = armworkloadssapvirtualinstance.SAPDatabaseInstancesClientStartResponse{ + // OperationStatusResult: &armworkloadssapvirtualinstance.OperationStatusResult{ + // Name: to.Ptr("db0"), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-01T03:38:07.000Z"); return t}()), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/db0"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-01T03:36:07.000Z"); return t}()), + // Status: to.Ptr("Succeeded"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapdatabaseinstances/SAPDatabaseInstances_List.json -func ExampleSAPDatabaseInstancesClient_NewListPager() { +// Generated from example definition: 2024-09-01/SapDatabaseInstances_StopInstance.json +func ExampleSAPDatabaseInstancesClient_BeginStop_stopTheDatabaseInstanceOfTheSapSystem() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewSAPDatabaseInstancesClient().NewListPager("test-rg", "X00", 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.SAPDatabaseInstanceList = armworkloadssapvirtualinstance.SAPDatabaseInstanceList{ - // Value: []*armworkloadssapvirtualinstance.SAPDatabaseInstance{ - // { - // Name: to.Ptr("databaseServer"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/databaseInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/databaseInstances/databaseServer"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPDatabaseProperties{ - // DatabaseSid: to.Ptr("X00"), - // DatabaseType: to.Ptr("hdb"), - // IPAddress: to.Ptr("10.0.0.5"), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), - // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // VMDetails: []*armworkloadssapvirtualinstance.DatabaseVMDetails{ - // { - // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/db-vm"), - // }}, - // }, - // }}, - // } + poller, err := clientFactory.NewSAPDatabaseInstancesClient().BeginStop(ctx, "test-rg", "X00", "db0", &SAPDatabaseInstancesClientBeginStopOptions{ + body: &armworkloadssapvirtualinstance.StopRequest{ + SoftStopTimeoutSeconds: to.Ptr[int64](0), + }}) + 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 = armworkloadssapvirtualinstance.SAPDatabaseInstancesClientStopResponse{ + // OperationStatusResult: &armworkloadssapvirtualinstance.OperationStatusResult{ + // Name: to.Ptr("db0"), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-01T03:38:07.000Z"); return t}()), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/db0"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-01T03:36:07.000Z"); return t}()), + // Status: to.Ptr("Succeeded"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapdatabaseinstances/SAPDatabaseInstances_StartInstance_WithInfraOperations.json -func ExampleSAPDatabaseInstancesClient_BeginStartInstance_startVirtualMachineAndTheDatabaseInstanceOfTheSapSystemOnIt() { +// Generated from example definition: 2024-09-01/SapDatabaseInstances_StopInstanceSoft.json +func ExampleSAPDatabaseInstancesClient_BeginStop_softStopTheDatabaseInstanceOfTheSapSystem() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewSAPDatabaseInstancesClient().BeginStartInstance(ctx, "test-rg", "X00", "db0", &armworkloadssapvirtualinstance.SAPDatabaseInstancesClientBeginStartInstanceOptions{Body: &armworkloadssapvirtualinstance.StartRequest{ - StartVM: to.Ptr(true), - }, - }) + poller, err := clientFactory.NewSAPDatabaseInstancesClient().BeginStop(ctx, "test-rg", "X00", "db0", &SAPDatabaseInstancesClientBeginStopOptions{ + body: &armworkloadssapvirtualinstance.StopRequest{ + SoftStopTimeoutSeconds: to.Ptr[int64](300), + }}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -331,27 +393,33 @@ func ExampleSAPDatabaseInstancesClient_BeginStartInstance_startVirtualMachineAnd // 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.OperationStatusResult = armworkloadssapvirtualinstance.OperationStatusResult{ - // Name: to.Ptr("db0"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-01T03:38:07.000Z"); return t}()), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/db0"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-01T03:36:07.000Z"); return t}()), - // Status: to.Ptr("Succeeded"), + // res = armworkloadssapvirtualinstance.SAPDatabaseInstancesClientStopResponse{ + // OperationStatusResult: &armworkloadssapvirtualinstance.OperationStatusResult{ + // Name: to.Ptr("db0"), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-01T03:38:07.000Z"); return t}()), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/db0"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-01T03:36:07.000Z"); return t}()), + // Status: to.Ptr("Succeeded"), + // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapdatabaseinstances/SAPDatabaseInstances_StartInstance.json -func ExampleSAPDatabaseInstancesClient_BeginStartInstance_startTheDatabaseInstanceOfTheSapSystem() { +// Generated from example definition: 2024-09-01/SapDatabaseInstances_StopInstanceSoftVM.json +func ExampleSAPDatabaseInstancesClient_BeginStop_softStopTheDatabaseInstanceOfTheSapSystemAndTheUnderlyingVirtualMachineS() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewSAPDatabaseInstancesClient().BeginStartInstance(ctx, "test-rg", "X00", "db0", &armworkloadssapvirtualinstance.SAPDatabaseInstancesClientBeginStartInstanceOptions{Body: nil}) + poller, err := clientFactory.NewSAPDatabaseInstancesClient().BeginStop(ctx, "test-rg", "X00", "db0", &SAPDatabaseInstancesClientBeginStopOptions{ + body: &armworkloadssapvirtualinstance.StopRequest{ + DeallocateVM: to.Ptr(true), + SoftStopTimeoutSeconds: to.Ptr[int64](300), + }}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -362,31 +430,33 @@ func ExampleSAPDatabaseInstancesClient_BeginStartInstance_startTheDatabaseInstan // 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.OperationStatusResult = armworkloadssapvirtualinstance.OperationStatusResult{ - // Name: to.Ptr("db0"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-01T03:38:07.000Z"); return t}()), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/db0"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-01T03:36:07.000Z"); return t}()), - // Status: to.Ptr("Succeeded"), + // res = armworkloadssapvirtualinstance.SAPDatabaseInstancesClientStopResponse{ + // OperationStatusResult: &armworkloadssapvirtualinstance.OperationStatusResult{ + // Name: to.Ptr("db0"), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-01T03:38:07.000Z"); return t}()), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/db0"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-01T03:36:07.000Z"); return t}()), + // Status: to.Ptr("Succeeded"), + // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapdatabaseinstances/SAPDatabaseInstances_StopInstance_WithInfraOperations.json -func ExampleSAPDatabaseInstancesClient_BeginStopInstance_stopTheDatabaseInstanceOfTheSapSystemAndTheUnderlyingVirtualMachineS() { +// Generated from example definition: 2024-09-01/SapDatabaseInstances_StopInstanceVM.json +func ExampleSAPDatabaseInstancesClient_BeginStop_stopTheDatabaseInstanceOfTheSapSystemAndTheUnderlyingVirtualMachineS() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewSAPDatabaseInstancesClient().BeginStopInstance(ctx, "test-rg", "X00", "db0", &armworkloadssapvirtualinstance.SAPDatabaseInstancesClientBeginStopInstanceOptions{Body: &armworkloadssapvirtualinstance.StopRequest{ - DeallocateVM: to.Ptr(true), - SoftStopTimeoutSeconds: to.Ptr[int64](0), - }, - }) + poller, err := clientFactory.NewSAPDatabaseInstancesClient().BeginStop(ctx, "test-rg", "X00", "db0", &SAPDatabaseInstancesClientBeginStopOptions{ + body: &armworkloadssapvirtualinstance.StopRequest{ + DeallocateVM: to.Ptr(true), + SoftStopTimeoutSeconds: to.Ptr[int64](0), + }}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -397,45 +467,68 @@ func ExampleSAPDatabaseInstancesClient_BeginStopInstance_stopTheDatabaseInstance // 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.OperationStatusResult = armworkloadssapvirtualinstance.OperationStatusResult{ - // Name: to.Ptr("db0"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-01T03:38:07.000Z"); return t}()), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/db0"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-01T03:36:07.000Z"); return t}()), - // Status: to.Ptr("Succeeded"), + // res = armworkloadssapvirtualinstance.SAPDatabaseInstancesClientStopResponse{ + // OperationStatusResult: &armworkloadssapvirtualinstance.OperationStatusResult{ + // Name: to.Ptr("db0"), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-01T03:38:07.000Z"); return t}()), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/db0"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-01T03:36:07.000Z"); return t}()), + // Status: to.Ptr("Succeeded"), + // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapdatabaseinstances/SAPDatabaseInstances_StopInstance.json -func ExampleSAPDatabaseInstancesClient_BeginStopInstance_stopTheDatabaseInstanceOfTheSapSystem() { +// Generated from example definition: 2024-09-01/SapDatabaseInstances_Update.json +func ExampleSAPDatabaseInstancesClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("6d875e77-e412-4d7d-9af4-8895278b4443", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewSAPDatabaseInstancesClient().BeginStopInstance(ctx, "test-rg", "X00", "db0", &armworkloadssapvirtualinstance.SAPDatabaseInstancesClientBeginStopInstanceOptions{Body: &armworkloadssapvirtualinstance.StopRequest{ - SoftStopTimeoutSeconds: to.Ptr[int64](0), - }, - }) + res, err := clientFactory.NewSAPDatabaseInstancesClient().Update(ctx, "test-rg", "X00", "databaseServer", armworkloadssapvirtualinstance.UpdateSAPDatabaseInstanceRequest{ + Tags: map[string]*string{ + "key1": to.Ptr("value1"), + }, + }, 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.OperationStatusResult = armworkloadssapvirtualinstance.OperationStatusResult{ - // Name: to.Ptr("db0"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-01T03:38:07.000Z"); return t}()), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/applicationInstances/db0"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-01T03:36:07.000Z"); return t}()), - // Status: to.Ptr("Succeeded"), + // res = armworkloadssapvirtualinstance.SAPDatabaseInstancesClientUpdateResponse{ + // SAPDatabaseInstance: &armworkloadssapvirtualinstance.SAPDatabaseInstance{ + // Name: to.Ptr("databaseServer"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances/databaseInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00/databaseInstances/databaseServer"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPDatabaseProperties{ + // DatabaseSid: to.Ptr("X00"), + // DatabaseType: to.Ptr("hdb"), + // IPAddress: to.Ptr("10.0.0.5"), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), + // Subnet: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), + // VMDetails: []*armworkloadssapvirtualinstance.DatabaseVMDetails{ + // { + // VirtualMachineID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/db-vm"), + // }, + // }, + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // }, + // }, // } } diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapvirtualinstances_client.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapvirtualinstances_client.go index 41aa288ee716..c11ecdd67200 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapvirtualinstances_client.go +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapvirtualinstances_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 armworkloadssapvirtualinstance @@ -28,7 +24,7 @@ type SAPVirtualInstancesClient struct { } // NewSAPVirtualInstancesClient creates a new instance of SAPVirtualInstancesClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - 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 NewSAPVirtualInstancesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SAPVirtualInstancesClient, error) { @@ -46,21 +42,20 @@ func NewSAPVirtualInstancesClient(subscriptionID string, credential azcore.Token // BeginCreate - Creates a Virtual Instance for SAP solutions (VIS) resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - sapVirtualInstanceName - The name of the Virtual Instances for SAP solutions resource -// - body - Virtual Instance for SAP solutions resource request body. +// - resource - Virtual Instance for SAP solutions resource request body. // - options - SAPVirtualInstancesClientBeginCreateOptions contains the optional parameters for the SAPVirtualInstancesClient.BeginCreate // method. -func (client *SAPVirtualInstancesClient) BeginCreate(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, body SAPVirtualInstance, options *SAPVirtualInstancesClientBeginCreateOptions) (*runtime.Poller[SAPVirtualInstancesClientCreateResponse], error) { +func (client *SAPVirtualInstancesClient) BeginCreate(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, resource SAPVirtualInstance, options *SAPVirtualInstancesClientBeginCreateOptions) (*runtime.Poller[SAPVirtualInstancesClientCreateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.create(ctx, resourceGroupName, sapVirtualInstanceName, body, options) + resp, err := client.create(ctx, resourceGroupName, sapVirtualInstanceName, resource, options) if err != nil { return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SAPVirtualInstancesClientCreateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -73,14 +68,14 @@ func (client *SAPVirtualInstancesClient) BeginCreate(ctx context.Context, resour // Create - Creates a Virtual Instance for SAP solutions (VIS) resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview -func (client *SAPVirtualInstancesClient) create(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, body SAPVirtualInstance, options *SAPVirtualInstancesClientBeginCreateOptions) (*http.Response, error) { +// Generated from API version 2024-09-01 +func (client *SAPVirtualInstancesClient) create(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, resource SAPVirtualInstance, options *SAPVirtualInstancesClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "SAPVirtualInstancesClient.BeginCreate" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.createCreateRequest(ctx, resourceGroupName, sapVirtualInstanceName, body, options) + req, err := client.createCreateRequest(ctx, resourceGroupName, sapVirtualInstanceName, resource, options) if err != nil { return nil, err } @@ -96,7 +91,7 @@ func (client *SAPVirtualInstancesClient) create(ctx context.Context, resourceGro } // createCreateRequest creates the Create request. -func (client *SAPVirtualInstancesClient) createCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, body SAPVirtualInstance, options *SAPVirtualInstancesClientBeginCreateOptions) (*policy.Request, error) { +func (client *SAPVirtualInstancesClient) createCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, resource SAPVirtualInstance, _ *SAPVirtualInstancesClientBeginCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -115,10 +110,11 @@ func (client *SAPVirtualInstancesClient) createCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, body); err != nil { + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { return nil, err } return req, nil @@ -128,7 +124,7 @@ func (client *SAPVirtualInstancesClient) createCreateRequest(ctx context.Context // Services Instance, Application Server Instances and Database Instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - sapVirtualInstanceName - The name of the Virtual Instances for SAP solutions resource // - options - SAPVirtualInstancesClientBeginDeleteOptions contains the optional parameters for the SAPVirtualInstancesClient.BeginDelete @@ -140,8 +136,7 @@ func (client *SAPVirtualInstancesClient) BeginDelete(ctx context.Context, resour return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SAPVirtualInstancesClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -155,7 +150,7 @@ func (client *SAPVirtualInstancesClient) BeginDelete(ctx context.Context, resour // Services Instance, Application Server Instances and Database Instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 func (client *SAPVirtualInstancesClient) deleteOperation(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, options *SAPVirtualInstancesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "SAPVirtualInstancesClient.BeginDelete" @@ -178,7 +173,7 @@ func (client *SAPVirtualInstancesClient) deleteOperation(ctx context.Context, re } // deleteCreateRequest creates the Delete request. -func (client *SAPVirtualInstancesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, options *SAPVirtualInstancesClientBeginDeleteOptions) (*policy.Request, error) { +func (client *SAPVirtualInstancesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, _ *SAPVirtualInstancesClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -197,7 +192,7 @@ func (client *SAPVirtualInstancesClient) deleteCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -206,7 +201,7 @@ func (client *SAPVirtualInstancesClient) deleteCreateRequest(ctx context.Context // Get - Gets a Virtual Instance for SAP solutions resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - sapVirtualInstanceName - The name of the Virtual Instances for SAP solutions resource // - options - SAPVirtualInstancesClientGetOptions contains the optional parameters for the SAPVirtualInstancesClient.Get method. @@ -233,7 +228,7 @@ func (client *SAPVirtualInstancesClient) Get(ctx context.Context, resourceGroupN } // getCreateRequest creates the Get request. -func (client *SAPVirtualInstancesClient) getCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, options *SAPVirtualInstancesClientGetOptions) (*policy.Request, error) { +func (client *SAPVirtualInstancesClient) getCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, _ *SAPVirtualInstancesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -252,7 +247,7 @@ func (client *SAPVirtualInstancesClient) getCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -267,9 +262,269 @@ func (client *SAPVirtualInstancesClient) getHandleResponse(resp *http.Response) return result, nil } +// GetAvailabilityZoneDetails - Get the recommended SAP Availability Zone Pair Details for your region. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01 +// - location - The name of the Azure region. +// - body - The content of the action request +// - options - SAPVirtualInstancesClientGetAvailabilityZoneDetailsOptions contains the optional parameters for the SAPVirtualInstancesClient.GetAvailabilityZoneDetails +// method. +func (client *SAPVirtualInstancesClient) GetAvailabilityZoneDetails(ctx context.Context, location string, body SAPAvailabilityZoneDetailsRequest, options *SAPVirtualInstancesClientGetAvailabilityZoneDetailsOptions) (SAPVirtualInstancesClientGetAvailabilityZoneDetailsResponse, error) { + var err error + const operationName = "SAPVirtualInstancesClient.GetAvailabilityZoneDetails" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getAvailabilityZoneDetailsCreateRequest(ctx, location, body, options) + if err != nil { + return SAPVirtualInstancesClientGetAvailabilityZoneDetailsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SAPVirtualInstancesClientGetAvailabilityZoneDetailsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SAPVirtualInstancesClientGetAvailabilityZoneDetailsResponse{}, err + } + resp, err := client.getAvailabilityZoneDetailsHandleResponse(httpResp) + return resp, err +} + +// getAvailabilityZoneDetailsCreateRequest creates the GetAvailabilityZoneDetails request. +func (client *SAPVirtualInstancesClient) getAvailabilityZoneDetailsCreateRequest(ctx context.Context, location string, body SAPAvailabilityZoneDetailsRequest, _ *SAPVirtualInstancesClientGetAvailabilityZoneDetailsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getAvailabilityZoneDetails" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-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, body); err != nil { + return nil, err + } + return req, nil +} + +// getAvailabilityZoneDetailsHandleResponse handles the GetAvailabilityZoneDetails response. +func (client *SAPVirtualInstancesClient) getAvailabilityZoneDetailsHandleResponse(resp *http.Response) (SAPVirtualInstancesClientGetAvailabilityZoneDetailsResponse, error) { + result := SAPVirtualInstancesClientGetAvailabilityZoneDetailsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SAPAvailabilityZoneDetailsResult); err != nil { + return SAPVirtualInstancesClientGetAvailabilityZoneDetailsResponse{}, err + } + return result, nil +} + +// GetDiskConfigurations - Get the SAP Disk Configuration Layout prod/non-prod SAP System. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01 +// - location - The name of the Azure region. +// - body - The content of the action request +// - options - SAPVirtualInstancesClientGetDiskConfigurationsOptions contains the optional parameters for the SAPVirtualInstancesClient.GetDiskConfigurations +// method. +func (client *SAPVirtualInstancesClient) GetDiskConfigurations(ctx context.Context, location string, body SAPDiskConfigurationsRequest, options *SAPVirtualInstancesClientGetDiskConfigurationsOptions) (SAPVirtualInstancesClientGetDiskConfigurationsResponse, error) { + var err error + const operationName = "SAPVirtualInstancesClient.GetDiskConfigurations" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getDiskConfigurationsCreateRequest(ctx, location, body, options) + if err != nil { + return SAPVirtualInstancesClientGetDiskConfigurationsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SAPVirtualInstancesClientGetDiskConfigurationsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SAPVirtualInstancesClientGetDiskConfigurationsResponse{}, err + } + resp, err := client.getDiskConfigurationsHandleResponse(httpResp) + return resp, err +} + +// getDiskConfigurationsCreateRequest creates the GetDiskConfigurations request. +func (client *SAPVirtualInstancesClient) getDiskConfigurationsCreateRequest(ctx context.Context, location string, body SAPDiskConfigurationsRequest, _ *SAPVirtualInstancesClientGetDiskConfigurationsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getDiskConfigurations" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-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, body); err != nil { + return nil, err + } + return req, nil +} + +// getDiskConfigurationsHandleResponse handles the GetDiskConfigurations response. +func (client *SAPVirtualInstancesClient) getDiskConfigurationsHandleResponse(resp *http.Response) (SAPVirtualInstancesClientGetDiskConfigurationsResponse, error) { + result := SAPVirtualInstancesClientGetDiskConfigurationsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SAPDiskConfigurationsResult); err != nil { + return SAPVirtualInstancesClientGetDiskConfigurationsResponse{}, err + } + return result, nil +} + +// GetSapSupportedSKU - Get a list of SAP supported SKUs for ASCS, Application and Database tier. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01 +// - location - The name of the Azure region. +// - body - The content of the action request +// - options - SAPVirtualInstancesClientGetSapSupportedSKUOptions contains the optional parameters for the SAPVirtualInstancesClient.GetSapSupportedSKU +// method. +func (client *SAPVirtualInstancesClient) GetSapSupportedSKU(ctx context.Context, location string, body SAPSupportedSKUsRequest, options *SAPVirtualInstancesClientGetSapSupportedSKUOptions) (SAPVirtualInstancesClientGetSapSupportedSKUResponse, error) { + var err error + const operationName = "SAPVirtualInstancesClient.GetSapSupportedSKU" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getSapSupportedSKUCreateRequest(ctx, location, body, options) + if err != nil { + return SAPVirtualInstancesClientGetSapSupportedSKUResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SAPVirtualInstancesClientGetSapSupportedSKUResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SAPVirtualInstancesClientGetSapSupportedSKUResponse{}, err + } + resp, err := client.getSapSupportedSKUHandleResponse(httpResp) + return resp, err +} + +// getSapSupportedSKUCreateRequest creates the GetSapSupportedSKU request. +func (client *SAPVirtualInstancesClient) getSapSupportedSKUCreateRequest(ctx context.Context, location string, body SAPSupportedSKUsRequest, _ *SAPVirtualInstancesClientGetSapSupportedSKUOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getSapSupportedSku" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-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, body); err != nil { + return nil, err + } + return req, nil +} + +// getSapSupportedSKUHandleResponse handles the GetSapSupportedSKU response. +func (client *SAPVirtualInstancesClient) getSapSupportedSKUHandleResponse(resp *http.Response) (SAPVirtualInstancesClientGetSapSupportedSKUResponse, error) { + result := SAPVirtualInstancesClientGetSapSupportedSKUResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SAPSupportedResourceSKUsResult); err != nil { + return SAPVirtualInstancesClientGetSapSupportedSKUResponse{}, err + } + return result, nil +} + +// GetSizingRecommendations - Gets the sizing recommendations. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01 +// - location - The name of the Azure region. +// - body - The content of the action request +// - options - SAPVirtualInstancesClientGetSizingRecommendationsOptions contains the optional parameters for the SAPVirtualInstancesClient.GetSizingRecommendations +// method. +func (client *SAPVirtualInstancesClient) GetSizingRecommendations(ctx context.Context, location string, body SAPSizingRecommendationRequest, options *SAPVirtualInstancesClientGetSizingRecommendationsOptions) (SAPVirtualInstancesClientGetSizingRecommendationsResponse, error) { + var err error + const operationName = "SAPVirtualInstancesClient.GetSizingRecommendations" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getSizingRecommendationsCreateRequest(ctx, location, body, options) + if err != nil { + return SAPVirtualInstancesClientGetSizingRecommendationsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SAPVirtualInstancesClientGetSizingRecommendationsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SAPVirtualInstancesClientGetSizingRecommendationsResponse{}, err + } + resp, err := client.getSizingRecommendationsHandleResponse(httpResp) + return resp, err +} + +// getSizingRecommendationsCreateRequest creates the GetSizingRecommendations request. +func (client *SAPVirtualInstancesClient) getSizingRecommendationsCreateRequest(ctx context.Context, location string, body SAPSizingRecommendationRequest, _ *SAPVirtualInstancesClientGetSizingRecommendationsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getSizingRecommendations" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-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, body); err != nil { + return nil, err + } + return req, nil +} + +// getSizingRecommendationsHandleResponse handles the GetSizingRecommendations response. +func (client *SAPVirtualInstancesClient) getSizingRecommendationsHandleResponse(resp *http.Response) (SAPVirtualInstancesClientGetSizingRecommendationsResponse, error) { + result := SAPVirtualInstancesClientGetSizingRecommendationsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result); err != nil { + return SAPVirtualInstancesClientGetSizingRecommendationsResponse{}, err + } + return result, nil +} + // NewListByResourceGroupPager - Gets all Virtual Instances for SAP solutions resources in a Resource Group. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - SAPVirtualInstancesClientListByResourceGroupOptions contains the optional parameters for the SAPVirtualInstancesClient.NewListByResourceGroupPager // method. @@ -297,7 +552,7 @@ func (client *SAPVirtualInstancesClient) NewListByResourceGroupPager(resourceGro } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *SAPVirtualInstancesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *SAPVirtualInstancesClientListByResourceGroupOptions) (*policy.Request, error) { +func (client *SAPVirtualInstancesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *SAPVirtualInstancesClientListByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -312,7 +567,7 @@ func (client *SAPVirtualInstancesClient) listByResourceGroupCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -321,7 +576,7 @@ func (client *SAPVirtualInstancesClient) listByResourceGroupCreateRequest(ctx co // listByResourceGroupHandleResponse handles the ListByResourceGroup response. func (client *SAPVirtualInstancesClient) listByResourceGroupHandleResponse(resp *http.Response) (SAPVirtualInstancesClientListByResourceGroupResponse, error) { result := SAPVirtualInstancesClientListByResourceGroupResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.SAPVirtualInstanceList); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.SAPVirtualInstanceListResult); err != nil { return SAPVirtualInstancesClientListByResourceGroupResponse{}, err } return result, nil @@ -329,7 +584,7 @@ func (client *SAPVirtualInstancesClient) listByResourceGroupHandleResponse(resp // NewListBySubscriptionPager - Gets all Virtual Instances for SAP solutions resources in a Subscription. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 // - options - SAPVirtualInstancesClientListBySubscriptionOptions contains the optional parameters for the SAPVirtualInstancesClient.NewListBySubscriptionPager // method. func (client *SAPVirtualInstancesClient) NewListBySubscriptionPager(options *SAPVirtualInstancesClientListBySubscriptionOptions) *runtime.Pager[SAPVirtualInstancesClientListBySubscriptionResponse] { @@ -356,7 +611,7 @@ func (client *SAPVirtualInstancesClient) NewListBySubscriptionPager(options *SAP } // listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *SAPVirtualInstancesClient) listBySubscriptionCreateRequest(ctx context.Context, options *SAPVirtualInstancesClientListBySubscriptionOptions) (*policy.Request, error) { +func (client *SAPVirtualInstancesClient) listBySubscriptionCreateRequest(ctx context.Context, _ *SAPVirtualInstancesClientListBySubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/sapVirtualInstances" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -367,7 +622,7 @@ func (client *SAPVirtualInstancesClient) listBySubscriptionCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -376,7 +631,7 @@ func (client *SAPVirtualInstancesClient) listBySubscriptionCreateRequest(ctx con // listBySubscriptionHandleResponse handles the ListBySubscription response. func (client *SAPVirtualInstancesClient) listBySubscriptionHandleResponse(resp *http.Response) (SAPVirtualInstancesClientListBySubscriptionResponse, error) { result := SAPVirtualInstancesClientListBySubscriptionResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.SAPVirtualInstanceList); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.SAPVirtualInstanceListResult); err != nil { return SAPVirtualInstancesClientListBySubscriptionResponse{}, err } return result, nil @@ -385,7 +640,7 @@ func (client *SAPVirtualInstancesClient) listBySubscriptionHandleResponse(resp * // BeginStart - Starts the SAP application, that is the Central Services instance and Application server instances. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - sapVirtualInstanceName - The name of the Virtual Instances for SAP solutions resource // - options - SAPVirtualInstancesClientBeginStartOptions contains the optional parameters for the SAPVirtualInstancesClient.BeginStart @@ -397,8 +652,7 @@ func (client *SAPVirtualInstancesClient) BeginStart(ctx context.Context, resourc return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SAPVirtualInstancesClientStartResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -411,7 +665,7 @@ func (client *SAPVirtualInstancesClient) BeginStart(ctx context.Context, resourc // Start - Starts the SAP application, that is the Central Services instance and Application server instances. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 func (client *SAPVirtualInstancesClient) start(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, options *SAPVirtualInstancesClientBeginStartOptions) (*http.Response, error) { var err error const operationName = "SAPVirtualInstancesClient.BeginStart" @@ -453,10 +707,11 @@ func (client *SAPVirtualInstancesClient) startCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Body != nil { + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, *options.Body); err != nil { return nil, err } @@ -468,7 +723,7 @@ func (client *SAPVirtualInstancesClient) startCreateRequest(ctx context.Context, // BeginStop - Stops the SAP Application, that is the Application server instances and Central Services instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - sapVirtualInstanceName - The name of the Virtual Instances for SAP solutions resource // - options - SAPVirtualInstancesClientBeginStopOptions contains the optional parameters for the SAPVirtualInstancesClient.BeginStop @@ -480,8 +735,7 @@ func (client *SAPVirtualInstancesClient) BeginStop(ctx context.Context, resource return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SAPVirtualInstancesClientStopResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -494,7 +748,7 @@ func (client *SAPVirtualInstancesClient) BeginStop(ctx context.Context, resource // Stop - Stops the SAP Application, that is the Application server instances and Central Services instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 func (client *SAPVirtualInstancesClient) stop(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, options *SAPVirtualInstancesClientBeginStopOptions) (*http.Response, error) { var err error const operationName = "SAPVirtualInstancesClient.BeginStop" @@ -536,10 +790,11 @@ func (client *SAPVirtualInstancesClient) stopCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Body != nil { + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, *options.Body); err != nil { return nil, err } @@ -551,21 +806,20 @@ func (client *SAPVirtualInstancesClient) stopCreateRequest(ctx context.Context, // BeginUpdate - Updates a Virtual Instance for SAP solutions resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - sapVirtualInstanceName - The name of the Virtual Instances for SAP solutions resource -// - body - Request body to update a Virtual Instance for SAP solutions resource. +// - properties - Request body to update a Virtual Instance for SAP solutions resource. // - options - SAPVirtualInstancesClientBeginUpdateOptions contains the optional parameters for the SAPVirtualInstancesClient.BeginUpdate // method. -func (client *SAPVirtualInstancesClient) BeginUpdate(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, body UpdateSAPVirtualInstanceRequest, options *SAPVirtualInstancesClientBeginUpdateOptions) (*runtime.Poller[SAPVirtualInstancesClientUpdateResponse], error) { +func (client *SAPVirtualInstancesClient) BeginUpdate(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, properties UpdateSAPVirtualInstanceRequest, options *SAPVirtualInstancesClientBeginUpdateOptions) (*runtime.Poller[SAPVirtualInstancesClientUpdateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.update(ctx, resourceGroupName, sapVirtualInstanceName, body, options) + resp, err := client.update(ctx, resourceGroupName, sapVirtualInstanceName, properties, options) if err != nil { return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SAPVirtualInstancesClientUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -578,14 +832,14 @@ func (client *SAPVirtualInstancesClient) BeginUpdate(ctx context.Context, resour // Update - Updates a Virtual Instance for SAP solutions resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-01-preview -func (client *SAPVirtualInstancesClient) update(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, body UpdateSAPVirtualInstanceRequest, options *SAPVirtualInstancesClientBeginUpdateOptions) (*http.Response, error) { +// Generated from API version 2024-09-01 +func (client *SAPVirtualInstancesClient) update(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, properties UpdateSAPVirtualInstanceRequest, options *SAPVirtualInstancesClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "SAPVirtualInstancesClient.BeginUpdate" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.updateCreateRequest(ctx, resourceGroupName, sapVirtualInstanceName, body, options) + req, err := client.updateCreateRequest(ctx, resourceGroupName, sapVirtualInstanceName, properties, options) if err != nil { return nil, err } @@ -601,7 +855,7 @@ func (client *SAPVirtualInstancesClient) update(ctx context.Context, resourceGro } // updateCreateRequest creates the Update request. -func (client *SAPVirtualInstancesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, body UpdateSAPVirtualInstanceRequest, options *SAPVirtualInstancesClientBeginUpdateOptions) (*policy.Request, error) { +func (client *SAPVirtualInstancesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, sapVirtualInstanceName string, properties UpdateSAPVirtualInstanceRequest, _ *SAPVirtualInstancesClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -620,10 +874,11 @@ func (client *SAPVirtualInstancesClient) updateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, body); err != nil { + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { return nil, err } return req, nil diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapvirtualinstances_client_example_test.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapvirtualinstances_client_example_test.go index 98ebd270b844..de17c597f870 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapvirtualinstances_client_example_test.go +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/sapvirtualinstances_client_example_test.go @@ -1,122 +1,127 @@ -//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 armworkloadssapvirtualinstance_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/workloadssapvirtualinstance/armworkloadssapvirtualinstance" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_Custom_Image.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConfigurationWithAzureComputeGalleryImage() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_CreateDetectDS.json +func ExampleSAPVirtualInstancesClient_BeginCreate_detectSapSoftwareInstallationOnADistributedSystem() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, + Location: to.Ptr("eastus2"), Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), + Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ AppLocation: to.Ptr("eastus"), + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + AppResourceGroup: to.Ptr("{{resourcegrp}}"), ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - InstanceCount: to.Ptr[int64](6), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + InstanceCount: to.Ptr[int64](2), + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - ID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/galleries/testgallery/images/rhelimagetest/versions/0.0.1"), + Offer: to.Ptr("RHEL-SAP-HA"), + Publisher: to.Ptr("RedHat"), + SKU: to.Ptr("84sapha-gen2"), + Version: to.Ptr("latest"), }, OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), + AdminUsername: to.Ptr("azureuser"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), - SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - { - KeyData: to.Ptr("ssh-rsa public key"), - }}, + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + PrivateKey: to.Ptr("{{privateKey}}"), + PublicKey: to.Ptr("{{sshkey}}"), }, }, }, - VMSize: to.Ptr("Standard_E32ds_v4"), + VMSize: to.Ptr("Standard_E4ds_v4"), }, }, CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - InstanceCount: to.Ptr[int64](2), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + InstanceCount: to.Ptr[int64](1), + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - ID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/galleries/testgallery/images/rhelimagetest/versions/0.0.1"), + Offer: to.Ptr("RHEL-SAP-HA"), + Publisher: to.Ptr("RedHat"), + SKU: to.Ptr("84sapha-gen2"), + Version: to.Ptr("latest"), }, OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), + AdminUsername: to.Ptr("azureuser"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), - SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - { - KeyData: to.Ptr("ssh-rsa public key"), - }}, + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + PrivateKey: to.Ptr("{{privateKey}}"), + PublicKey: to.Ptr("{{sshkey}}"), }, }, }, - VMSize: to.Ptr("Standard_E16ds_v4"), + VMSize: to.Ptr("Standard_E4ds_v4"), }, }, DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - InstanceCount: to.Ptr[int64](2), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), + InstanceCount: to.Ptr[int64](1), + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - ID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/galleries/testgallery/images/rhelimagetest/versions/0.0.1"), + Offer: to.Ptr("RHEL-SAP-HA"), + Publisher: to.Ptr("RedHat"), + SKU: to.Ptr("84sapha-gen2"), + Version: to.Ptr("latest"), }, OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), + AdminUsername: to.Ptr("azureuser"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), - SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - { - KeyData: to.Ptr("ssh-rsa public key"), - }}, + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + PrivateKey: to.Ptr("{{privateKey}}"), + PublicKey: to.Ptr("{{sshkey}}"), }, }, }, VMSize: to.Ptr("Standard_M32ts"), }, }, - HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ - HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilityZone), + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + NetworkConfiguration: &armworkloadssapvirtualinstance.NetworkConfiguration{ + IsSecondaryIPEnabled: to.Ptr(true), }, }, + OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ + SapFqdn: to.Ptr("sap.bpaas.com"), + }, + SoftwareConfiguration: &armworkloadssapvirtualinstance.ExternalInstallationSoftwareConfiguration{ + CentralServerVMID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"), + SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeExternal), + }, }, Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), }, + Tags: map[string]*string{ + "created by": to.Ptr("azureuser"), + }, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -128,140 +133,145 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf // 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](6), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // ID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/galleries/testgallery/images/rhelimagetest/versions/0.0.1"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("microsoft.workloads/sapvirtualinstances"), + // ID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("eastus2"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + // AppResourceGroup: to.Ptr("aa-rg"), + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + // InstanceCount: to.Ptr[int64](2), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP-HA"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("azureuser"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("ssh-rsa AAA generated-by-azure"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_E4ds_v4"), // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // ID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/galleries/testgallery/images/rhelimagetest/versions/0.0.1"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, + // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP-HA"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("azureuser"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("ssh-rsa AAA generated-by-azure"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_E4ds_v4"), // }, - // VMSize: to.Ptr("Standard_E16ds_v4"), // }, - // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // ID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/galleries/testgallery/images/rhelimagetest/versions/0.0.1"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP-HA"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("azureuser"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("ssh-rsa AAA generated-by-azure"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_M32ts"), // }, - // VMSize: to.Ptr("Standard_M32ts"), + // }, + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + // NetworkConfiguration: &armworkloadssapvirtualinstance.NetworkConfiguration{ + // IsSecondaryIPEnabled: to.Ptr(true), // }, // }, - // HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ - // HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilityZone), + // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ + // SapFqdn: to.Ptr("sap.bpaas.com"), + // }, + // SoftwareConfiguration: &armworkloadssapvirtualinstance.ExternalInstallationSoftwareConfiguration{ + // CentralServerVMID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"), + // SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeExternal), // }, // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateRegistrationComplete), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-08-18T18:25:55.2406546Z"); return t}()), + // CreatedBy: to.Ptr("f1bc9460-9d57-4c16-99a8-5a19378a3a93"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeApplication), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-08-18T18:50:59.1945444Z"); return t}()), + // LastModifiedBy: to.Ptr("f1bc9460-9d57-4c16-99a8-5a19378a3a93"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeApplication), + // }, + // Tags: map[string]*string{ + // "created by": to.Ptr("azureuser"), // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatus("Unknown")), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_CustomFullResourceNames_Distributed.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConfigurationWithCustomResourceNamesForDistributedSystem() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_CreateDetectHaAvailabilitySet.json +func ExampleSAPVirtualInstancesClient_BeginCreate_detectSapSoftwareInstallationOnAnHaSystemWithAvailabilitySet() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, + Location: to.Ptr("westcentralus"), Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), AppLocation: to.Ptr("eastus"), + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ InstanceCount: to.Ptr[int64](6), SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), + Offer: to.Ptr("RHEL-SAP-HA"), Publisher: to.Ptr("RedHat"), SKU: to.Ptr("84sapha-gen2"), Version: to.Ptr("latest"), @@ -269,8 +279,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -281,11 +291,11 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf }, }, CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - InstanceCount: to.Ptr[int64](1), + InstanceCount: to.Ptr[int64](2), SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), + Offer: to.Ptr("RHEL-SAP-HA"), Publisher: to.Ptr("RedHat"), SKU: to.Ptr("84sapha-gen2"), Version: to.Ptr("latest"), @@ -293,8 +303,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -304,92 +314,13 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf VMSize: to.Ptr("Standard_E16ds_v4"), }, }, - CustomResourceNames: &armworkloadssapvirtualinstance.ThreeTierFullResourceNames{ - NamingPatternType: to.Ptr(armworkloadssapvirtualinstance.NamingPatternTypeFullResourceName), - ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerFullResourceNames{ - AvailabilitySetName: to.Ptr("appAvSet"), - VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ - { - DataDiskNames: map[string][]*string{ - "default": { - to.Ptr("app0disk0")}, - }, - HostName: to.Ptr("apphostName0"), - NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - { - NetworkInterfaceName: to.Ptr("appnic0"), - }}, - OSDiskName: to.Ptr("app0osdisk"), - VMName: to.Ptr("appvm0"), - }, - { - DataDiskNames: map[string][]*string{ - "default": { - to.Ptr("app1disk0")}, - }, - HostName: to.Ptr("apphostName1"), - NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - { - NetworkInterfaceName: to.Ptr("appnic1"), - }}, - OSDiskName: to.Ptr("app1osdisk"), - VMName: to.Ptr("appvm1"), - }}, - }, - CentralServer: &armworkloadssapvirtualinstance.CentralServerFullResourceNames{ - VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ - { - DataDiskNames: map[string][]*string{ - "default": { - to.Ptr("ascsdisk0")}, - }, - HostName: to.Ptr("ascshostName"), - NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - { - NetworkInterfaceName: to.Ptr("ascsnic"), - }}, - OSDiskName: to.Ptr("ascsosdisk"), - VMName: to.Ptr("ascsvm"), - }}, - }, - DatabaseServer: &armworkloadssapvirtualinstance.DatabaseServerFullResourceNames{ - VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ - { - DataDiskNames: map[string][]*string{ - "hanaData": { - to.Ptr("hanadata0"), - to.Ptr("hanadata1")}, - "hanaLog": { - to.Ptr("hanalog0"), - to.Ptr("hanalog1"), - to.Ptr("hanalog2")}, - "hanaShared": { - to.Ptr("hanashared0"), - to.Ptr("hanashared1")}, - "usrSap": { - to.Ptr("usrsap0")}, - }, - HostName: to.Ptr("dbhostName"), - NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - { - NetworkInterfaceName: to.Ptr("dbnic"), - }}, - OSDiskName: to.Ptr("dbosdisk"), - VMName: to.Ptr("dbvm"), - }}, - }, - SharedStorage: &armworkloadssapvirtualinstance.SharedStorageResourceNames{ - SharedStorageAccountName: to.Ptr("storageacc"), - SharedStorageAccountPrivateEndPointName: to.Ptr("peForxNFS"), - }, - }, DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - InstanceCount: to.Ptr[int64](1), + InstanceCount: to.Ptr[int64](2), SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), + Offer: to.Ptr("RHEL-SAP-HA"), Publisher: to.Ptr("RedHat"), SKU: to.Ptr("84sapha-gen2"), Version: to.Ptr("latest"), @@ -397,8 +328,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -408,17 +339,23 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf VMSize: to.Ptr("Standard_M32ts"), }, }, + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ + HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilitySet), + }, }, OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ SapFqdn: to.Ptr("xyz.test.com"), }, + SoftwareConfiguration: &armworkloadssapvirtualinstance.ExternalInstallationSoftwareConfiguration{ + CentralServerVMID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"), + SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeExternal), + }, }, Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - ManagedResourceGroupConfiguration: &armworkloadssapvirtualinstance.ManagedRGConfiguration{ - Name: to.Ptr("mrg-X00-8e17e36c-42e9-4cd5-a078-7b44883414e0"), - }, - SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), }, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -430,222 +367,145 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf // 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](6), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + // AppResourceGroup: to.Ptr("X00-RG"), + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + // InstanceCount: to.Ptr[int64](6), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP-HA"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), // }, - // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), - // }, - // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // VMSize: to.Ptr("Standard_E16ds_v4"), // }, - // }, - // CustomResourceNames: &armworkloadssapvirtualinstance.ThreeTierFullResourceNames{ - // NamingPatternType: to.Ptr(armworkloadssapvirtualinstance.NamingPatternTypeFullResourceName), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerFullResourceNames{ - // AvailabilitySetName: to.Ptr("appAvSet"), - // VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ - // { - // DataDiskNames: map[string][]*string{ - // "default": []*string{ - // to.Ptr("app0disk0")}, + // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ + // InstanceCount: to.Ptr[int64](2), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP-HA"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), // }, - // HostName: to.Ptr("apphostName0"), - // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - // { - // NetworkInterfaceName: to.Ptr("appnic0"), - // }}, - // OSDiskName: to.Ptr("app0osdisk"), - // VMName: to.Ptr("appvm0"), // }, - // { - // DataDiskNames: map[string][]*string{ - // "default": []*string{ - // to.Ptr("app1disk0")}, - // }, - // HostName: to.Ptr("apphostName1"), - // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - // { - // NetworkInterfaceName: to.Ptr("appnic1"), - // }}, - // OSDiskName: to.Ptr("app1osdisk"), - // VMName: to.Ptr("appvm1"), - // }}, - // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerFullResourceNames{ - // VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ - // { - // DataDiskNames: map[string][]*string{ - // "default": []*string{ - // to.Ptr("ascsdisk0")}, - // }, - // HostName: to.Ptr("ascshostName"), - // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - // { - // NetworkInterfaceName: to.Ptr("ascsnic"), - // }}, - // OSDiskName: to.Ptr("ascsosdisk"), - // VMName: to.Ptr("ascsvm"), - // }}, - // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseServerFullResourceNames{ - // VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ - // { - // DataDiskNames: map[string][]*string{ - // "hanaData": []*string{ - // to.Ptr("hanadata0"), - // to.Ptr("hanadata1")}, - // "hanaLog": []*string{ - // to.Ptr("hanalog0"), - // to.Ptr("hanalog1"), - // to.Ptr("hanalog2")}, - // "hanaShared": []*string{ - // to.Ptr("hanashared0"), - // to.Ptr("hanashared1")}, - // "usrSap": []*string{ - // to.Ptr("usrsap0")}, - // }, - // HostName: to.Ptr("dbhostName"), - // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - // { - // NetworkInterfaceName: to.Ptr("dbnic"), - // }}, - // OSDiskName: to.Ptr("dbosdisk"), - // VMName: to.Ptr("dbvm"), - // }}, - // }, - // SharedStorage: &armworkloadssapvirtualinstance.SharedStorageResourceNames{ - // SharedStorageAccountName: to.Ptr("storageacc"), - // SharedStorageAccountPrivateEndPointName: to.Ptr("peForxNFS"), - // }, - // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_M32ts"), - // }, - // }, - // }, - // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - // SapFqdn: to.Ptr("xyz.test.com"), - // }, - // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), - // ManagedResourceGroupConfiguration: &armworkloadssapvirtualinstance.ManagedRGConfiguration{ - // Name: to.Ptr("mrg-X00-8e17e36c-42e9-4cd5-a078-7b44883414e0"), + // }, + // VMSize: to.Ptr("Standard_E16ds_v4"), + // }, + // }, + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + // InstanceCount: to.Ptr[int64](2), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP-HA"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), // }, - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatus("Unknown")), // }, - // } + // }, + // VMSize: to.Ptr("Standard_M32ts"), + // }, + // }, + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + // HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ + // HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilitySet), + // }, + // }, + // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ + // SapFqdn: to.Ptr("xyz.test.com"), + // }, + // SoftwareConfiguration: &armworkloadssapvirtualinstance.ExternalInstallationSoftwareConfiguration{ + // CentralServerVMID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"), + // SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeExternal), + // }, + // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateRegistrationComplete), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // }, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_CustomFullResourceNames_HA_AvSet.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConfigurationWithCustomResourceNamesForHaSystemWithAvailabilitySet() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_CreateDetectHaAvailabilityZone.json +func ExampleSAPVirtualInstancesClient_BeginCreate_detectSapSoftwareInstallationOnAnHaSystemWithAvailabilityZone() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, + Location: to.Ptr("westcentralus"), Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), AppLocation: to.Ptr("eastus"), + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ InstanceCount: to.Ptr[int64](6), SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), + Offer: to.Ptr("RHEL-SAP-HA"), Publisher: to.Ptr("RedHat"), SKU: to.Ptr("84sapha-gen2"), Version: to.Ptr("latest"), @@ -653,8 +513,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -669,7 +529,7 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), + Offer: to.Ptr("RHEL-SAP-HA"), Publisher: to.Ptr("RedHat"), SKU: to.Ptr("84sapha-gen2"), Version: to.Ptr("latest"), @@ -677,8 +537,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -688,142 +548,13 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf VMSize: to.Ptr("Standard_E16ds_v4"), }, }, - CustomResourceNames: &armworkloadssapvirtualinstance.ThreeTierFullResourceNames{ - NamingPatternType: to.Ptr(armworkloadssapvirtualinstance.NamingPatternTypeFullResourceName), - ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerFullResourceNames{ - AvailabilitySetName: to.Ptr("appAvSet"), - VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ - { - DataDiskNames: map[string][]*string{ - "default": { - to.Ptr("app0disk0")}, - }, - HostName: to.Ptr("apphostName0"), - NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - { - NetworkInterfaceName: to.Ptr("appnic0"), - }}, - OSDiskName: to.Ptr("app0osdisk"), - VMName: to.Ptr("appvm0"), - }, - { - DataDiskNames: map[string][]*string{ - "default": { - to.Ptr("app1disk0")}, - }, - HostName: to.Ptr("apphostName1"), - NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - { - NetworkInterfaceName: to.Ptr("appnic1"), - }}, - OSDiskName: to.Ptr("app1osdisk"), - VMName: to.Ptr("appvm1"), - }}, - }, - CentralServer: &armworkloadssapvirtualinstance.CentralServerFullResourceNames{ - AvailabilitySetName: to.Ptr("csAvSet"), - LoadBalancer: &armworkloadssapvirtualinstance.LoadBalancerResourceNames{ - BackendPoolNames: []*string{ - to.Ptr("ascsBackendPool")}, - FrontendIPConfigurationNames: []*string{ - to.Ptr("ascsip0"), - to.Ptr("ersip0")}, - HealthProbeNames: []*string{ - to.Ptr("ascsHealthProbe"), - to.Ptr("ersHealthProbe")}, - LoadBalancerName: to.Ptr("ascslb"), - }, - VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ - { - HostName: to.Ptr("ascshostName"), - NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - { - NetworkInterfaceName: to.Ptr("ascsnic"), - }}, - OSDiskName: to.Ptr("ascsosdisk"), - VMName: to.Ptr("ascsvm"), - }, - { - HostName: to.Ptr("ershostName"), - NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - { - NetworkInterfaceName: to.Ptr("ersnic"), - }}, - OSDiskName: to.Ptr("ersosdisk"), - VMName: to.Ptr("ersvm"), - }}, - }, - DatabaseServer: &armworkloadssapvirtualinstance.DatabaseServerFullResourceNames{ - AvailabilitySetName: to.Ptr("dbAvSet"), - LoadBalancer: &armworkloadssapvirtualinstance.LoadBalancerResourceNames{ - BackendPoolNames: []*string{ - to.Ptr("dbBackendPool")}, - FrontendIPConfigurationNames: []*string{ - to.Ptr("dbip")}, - HealthProbeNames: []*string{ - to.Ptr("dbHealthProbe")}, - LoadBalancerName: to.Ptr("dblb"), - }, - VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ - { - DataDiskNames: map[string][]*string{ - "hanaData": { - to.Ptr("hanadatapr0"), - to.Ptr("hanadatapr1")}, - "hanaLog": { - to.Ptr("hanalogpr0"), - to.Ptr("hanalogpr1"), - to.Ptr("hanalogpr2")}, - "hanaShared": { - to.Ptr("hanasharedpr0"), - to.Ptr("hanasharedpr1")}, - "usrSap": { - to.Ptr("usrsappr0")}, - }, - HostName: to.Ptr("dbprhostName"), - NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - { - NetworkInterfaceName: to.Ptr("dbprnic"), - }}, - OSDiskName: to.Ptr("dbprosdisk"), - VMName: to.Ptr("dbvmpr"), - }, - { - DataDiskNames: map[string][]*string{ - "hanaData": { - to.Ptr("hanadatasr0"), - to.Ptr("hanadatasr1")}, - "hanaLog": { - to.Ptr("hanalogsr0"), - to.Ptr("hanalogsr1"), - to.Ptr("hanalogsr2")}, - "hanaShared": { - to.Ptr("hanasharedsr0"), - to.Ptr("hanasharedsr1")}, - "usrSap": { - to.Ptr("usrsapsr0")}, - }, - HostName: to.Ptr("dbsrhostName"), - NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - { - NetworkInterfaceName: to.Ptr("dbsrnic"), - }}, - OSDiskName: to.Ptr("dbsrosdisk"), - VMName: to.Ptr("dbvmsr"), - }}, - }, - SharedStorage: &armworkloadssapvirtualinstance.SharedStorageResourceNames{ - SharedStorageAccountName: to.Ptr("storageacc"), - SharedStorageAccountPrivateEndPointName: to.Ptr("peForxNFS"), - }, - }, DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), InstanceCount: to.Ptr[int64](2), SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), + Offer: to.Ptr("RHEL-SAP-HA"), Publisher: to.Ptr("RedHat"), SKU: to.Ptr("84sapha-gen2"), Version: to.Ptr("latest"), @@ -831,8 +562,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -842,20 +573,23 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf VMSize: to.Ptr("Standard_M32ts"), }, }, + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ - HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilitySet), + HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilityZone), }, }, OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ SapFqdn: to.Ptr("xyz.test.com"), }, + SoftwareConfiguration: &armworkloadssapvirtualinstance.ExternalInstallationSoftwareConfiguration{ + CentralServerVMID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"), + SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeExternal), + }, }, Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - ManagedResourceGroupConfiguration: &armworkloadssapvirtualinstance.ManagedRGConfiguration{ - Name: to.Ptr("mrg-X00-8e17e36c-42e9-4cd5-a078-7b44883414e0"), - }, - SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), }, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -867,270 +601,274 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf // 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](6), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + // AppResourceGroup: to.Ptr("X00-RG"), + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + // InstanceCount: to.Ptr[int64](6), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP-HA"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ + // InstanceCount: to.Ptr[int64](2), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP-HA"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_E16ds_v4"), // }, - // VMSize: to.Ptr("Standard_E16ds_v4"), // }, - // }, - // CustomResourceNames: &armworkloadssapvirtualinstance.ThreeTierFullResourceNames{ - // NamingPatternType: to.Ptr(armworkloadssapvirtualinstance.NamingPatternTypeFullResourceName), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerFullResourceNames{ - // AvailabilitySetName: to.Ptr("appAvSet"), - // VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ - // { - // DataDiskNames: map[string][]*string{ - // "default": []*string{ - // to.Ptr("app0disk0")}, + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + // InstanceCount: to.Ptr[int64](2), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP-HA"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), // }, - // HostName: to.Ptr("apphostName0"), - // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - // { - // NetworkInterfaceName: to.Ptr("appnic0"), - // }}, - // OSDiskName: to.Ptr("app0osdisk"), - // VMName: to.Ptr("appvm0"), // }, - // { - // DataDiskNames: map[string][]*string{ - // "default": []*string{ - // to.Ptr("app1disk0")}, - // }, - // HostName: to.Ptr("apphostName1"), - // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - // { - // NetworkInterfaceName: to.Ptr("appnic1"), - // }}, - // OSDiskName: to.Ptr("app1osdisk"), - // VMName: to.Ptr("appvm1"), - // }}, - // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerFullResourceNames{ - // AvailabilitySetName: to.Ptr("csAvSet"), - // LoadBalancer: &armworkloadssapvirtualinstance.LoadBalancerResourceNames{ - // BackendPoolNames: []*string{ - // to.Ptr("ascsBackendPool")}, - // FrontendIPConfigurationNames: []*string{ - // to.Ptr("ascsip0"), - // to.Ptr("ersip0")}, - // HealthProbeNames: []*string{ - // to.Ptr("ascsHealthProbe"), - // to.Ptr("ersHealthProbe")}, - // LoadBalancerName: to.Ptr("ascslb"), - // }, - // VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ - // { - // HostName: to.Ptr("ascshostName"), - // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - // { - // NetworkInterfaceName: to.Ptr("ascsnic"), - // }}, - // OSDiskName: to.Ptr("ascsosdisk"), - // VMName: to.Ptr("ascsvm"), - // }, - // { - // HostName: to.Ptr("ershostName"), - // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - // { - // NetworkInterfaceName: to.Ptr("ersnic"), - // }}, - // OSDiskName: to.Ptr("ersosdisk"), - // VMName: to.Ptr("ersvm"), - // }}, - // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseServerFullResourceNames{ - // AvailabilitySetName: to.Ptr("dbAvSet"), - // LoadBalancer: &armworkloadssapvirtualinstance.LoadBalancerResourceNames{ - // BackendPoolNames: []*string{ - // to.Ptr("dbBackendPool")}, - // FrontendIPConfigurationNames: []*string{ - // to.Ptr("dbip")}, - // HealthProbeNames: []*string{ - // to.Ptr("dbHealthProbe")}, - // LoadBalancerName: to.Ptr("dblb"), - // }, - // VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ - // { - // DataDiskNames: map[string][]*string{ - // "hanaData": []*string{ - // to.Ptr("hanadatapr0"), - // to.Ptr("hanadatapr1")}, - // "hanaLog": []*string{ - // to.Ptr("hanalogpr0"), - // to.Ptr("hanalogpr1"), - // to.Ptr("hanalogpr2")}, - // "hanaShared": []*string{ - // to.Ptr("hanasharedpr0"), - // to.Ptr("hanasharedpr1")}, - // "usrSap": []*string{ - // to.Ptr("usrsappr0")}, - // }, - // HostName: to.Ptr("dbprhostName"), - // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - // { - // NetworkInterfaceName: to.Ptr("dbprnic"), - // }}, - // OSDiskName: to.Ptr("dbprosdisk"), - // VMName: to.Ptr("dbvmpr"), - // }, - // { - // DataDiskNames: map[string][]*string{ - // "hanaData": []*string{ - // to.Ptr("hanadatasr0"), - // to.Ptr("hanadatasr1")}, - // "hanaLog": []*string{ - // to.Ptr("hanalogsr0"), - // to.Ptr("hanalogsr1"), - // to.Ptr("hanalogsr2")}, - // "hanaShared": []*string{ - // to.Ptr("hanasharedsr0"), - // to.Ptr("hanasharedsr1")}, - // "usrSap": []*string{ - // to.Ptr("usrsapsr0")}, - // }, - // HostName: to.Ptr("dbsrhostName"), - // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - // { - // NetworkInterfaceName: to.Ptr("dbsrnic"), - // }}, - // OSDiskName: to.Ptr("dbsrosdisk"), - // VMName: to.Ptr("dbvmsr"), - // }}, - // }, - // SharedStorage: &armworkloadssapvirtualinstance.SharedStorageResourceNames{ - // SharedStorageAccountName: to.Ptr("storageacc"), - // SharedStorageAccountPrivateEndPointName: to.Ptr("peForxNFS"), - // }, - // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_M32ts"), - // }, - // }, - // HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ - // HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilitySet), - // }, - // }, - // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - // SapFqdn: to.Ptr("xyz.test.com"), - // }, - // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), - // ManagedResourceGroupConfiguration: &armworkloadssapvirtualinstance.ManagedRGConfiguration{ - // Name: to.Ptr("mrg-X00-8e17e36c-42e9-4cd5-a078-7b44883414e0"), - // }, - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatus("Unknown")), - // }, - // } + // }, + // VMSize: to.Ptr("Standard_M32ts"), + // }, + // }, + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + // HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ + // HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilityZone), + // }, + // }, + // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ + // SapFqdn: to.Ptr("xyz.test.com"), + // }, + // SoftwareConfiguration: &armworkloadssapvirtualinstance.ExternalInstallationSoftwareConfiguration{ + // CentralServerVMID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"), + // SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeExternal), + // }, + // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateRegistrationComplete), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // }, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_CustomFullResourceNames_HA_AvZone.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConfigurationWithCustomResourceNamesForHaSystemWithAvailabilityZone() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_CreateDetectSingleServer.json +func ExampleSAPVirtualInstancesClient_BeginCreate_detectSapSoftwareInstallationOnASingleServerSystem() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, + Location: to.Ptr("westcentralus"), Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), AppLocation: to.Ptr("eastus"), - InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + InfrastructureConfiguration: &armworkloadssapvirtualinstance.SingleServerConfiguration{ AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeSingleServer), + NetworkConfiguration: &armworkloadssapvirtualinstance.NetworkConfiguration{ + IsSecondaryIPEnabled: to.Ptr(true), + }, + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + Offer: to.Ptr("RHEL-SAP-HA"), + Publisher: to.Ptr("RedHat"), + SKU: to.Ptr("84sapha-gen2"), + Version: to.Ptr("latest"), + }, + OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + AdminUsername: to.Ptr("{your-username}"), + OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + PrivateKey: to.Ptr("xyz"), + PublicKey: to.Ptr("abc"), + }, + }, + }, + VMSize: to.Ptr("Standard_E32ds_v4"), + }, + }, + OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ + SapFqdn: to.Ptr("xyz.test.com"), + }, + SoftwareConfiguration: &armworkloadssapvirtualinstance.ExternalInstallationSoftwareConfiguration{ + CentralServerVMID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"), + SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeExternal), + }, + }, + Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), + SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + }, + Tags: map[string]*string{}, + }, 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 = armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.SingleServerConfiguration{ + // AppResourceGroup: to.Ptr("X00-RG"), + // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeSingleServer), + // NetworkConfiguration: &armworkloadssapvirtualinstance.NetworkConfiguration{ + // IsSecondaryIPEnabled: to.Ptr(true), + // }, + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP-HA"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, + // }, + // }, + // VMSize: to.Ptr("Standard_E32ds_v4"), + // }, + // }, + // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ + // SapFqdn: to.Ptr("xyz.test.com"), + // }, + // SoftwareConfiguration: &armworkloadssapvirtualinstance.ExternalInstallationSoftwareConfiguration{ + // CentralServerVMID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"), + // SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeExternal), + // }, + // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateRegistrationComplete), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // }, + // }, + // } +} + +// Generated from example definition: 2024-09-01/SapVirtualInstances_CreateInfraDS.json +func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureOnlyForDistributedSystem() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ + Location: to.Ptr("westcentralus"), + Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ + AppLocation: to.Ptr("eastus"), + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), + InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + AppResourceGroup: to.Ptr("X00-RG"), + ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ InstanceCount: to.Ptr[int64](6), SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ @@ -1143,11 +881,14 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + { + KeyData: to.Ptr("ssh-rsa public key"), + }, + }, }, }, }, @@ -1155,7 +896,7 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf }, }, CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - InstanceCount: to.Ptr[int64](2), + InstanceCount: to.Ptr[int64](1), SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ @@ -1167,146 +908,23 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + { + KeyData: to.Ptr("ssh-rsa public key"), + }, + }, }, }, }, VMSize: to.Ptr("Standard_E16ds_v4"), }, }, - CustomResourceNames: &armworkloadssapvirtualinstance.ThreeTierFullResourceNames{ - NamingPatternType: to.Ptr(armworkloadssapvirtualinstance.NamingPatternTypeFullResourceName), - ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerFullResourceNames{ - VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ - { - DataDiskNames: map[string][]*string{ - "default": { - to.Ptr("app0disk0")}, - }, - HostName: to.Ptr("apphostName0"), - NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - { - NetworkInterfaceName: to.Ptr("appnic0"), - }}, - OSDiskName: to.Ptr("app0osdisk"), - VMName: to.Ptr("appvm0"), - }, - { - DataDiskNames: map[string][]*string{ - "default": { - to.Ptr("app1disk0")}, - }, - HostName: to.Ptr("apphostName1"), - NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - { - NetworkInterfaceName: to.Ptr("appnic1"), - }}, - OSDiskName: to.Ptr("app1osdisk"), - VMName: to.Ptr("appvm1"), - }}, - }, - CentralServer: &armworkloadssapvirtualinstance.CentralServerFullResourceNames{ - LoadBalancer: &armworkloadssapvirtualinstance.LoadBalancerResourceNames{ - BackendPoolNames: []*string{ - to.Ptr("ascsBackendPool")}, - FrontendIPConfigurationNames: []*string{ - to.Ptr("ascsip0"), - to.Ptr("ersip0")}, - HealthProbeNames: []*string{ - to.Ptr("ascsHealthProbe"), - to.Ptr("ersHealthProbe")}, - LoadBalancerName: to.Ptr("ascslb"), - }, - VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ - { - HostName: to.Ptr("ascshostName"), - NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - { - NetworkInterfaceName: to.Ptr("ascsnic"), - }}, - OSDiskName: to.Ptr("ascsosdisk"), - VMName: to.Ptr("ascsvm"), - }, - { - HostName: to.Ptr("ershostName"), - NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - { - NetworkInterfaceName: to.Ptr("ersnic"), - }}, - OSDiskName: to.Ptr("ersosdisk"), - VMName: to.Ptr("ersvm"), - }}, - }, - DatabaseServer: &armworkloadssapvirtualinstance.DatabaseServerFullResourceNames{ - LoadBalancer: &armworkloadssapvirtualinstance.LoadBalancerResourceNames{ - BackendPoolNames: []*string{ - to.Ptr("dbBackendPool")}, - FrontendIPConfigurationNames: []*string{ - to.Ptr("dbip")}, - HealthProbeNames: []*string{ - to.Ptr("dbHealthProbe")}, - LoadBalancerName: to.Ptr("dblb"), - }, - VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ - { - DataDiskNames: map[string][]*string{ - "hanaData": { - to.Ptr("hanadatapr0"), - to.Ptr("hanadatapr1")}, - "hanaLog": { - to.Ptr("hanalogpr0"), - to.Ptr("hanalogpr1"), - to.Ptr("hanalogpr2")}, - "hanaShared": { - to.Ptr("hanasharedpr0"), - to.Ptr("hanasharedpr1")}, - "usrSap": { - to.Ptr("usrsappr0")}, - }, - HostName: to.Ptr("dbprhostName"), - NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - { - NetworkInterfaceName: to.Ptr("dbprnic"), - }}, - OSDiskName: to.Ptr("dbprosdisk"), - VMName: to.Ptr("dbvmpr"), - }, - { - DataDiskNames: map[string][]*string{ - "hanaData": { - to.Ptr("hanadatasr0"), - to.Ptr("hanadatasr1")}, - "hanaLog": { - to.Ptr("hanalogsr0"), - to.Ptr("hanalogsr1"), - to.Ptr("hanalogsr2")}, - "hanaShared": { - to.Ptr("hanasharedsr0"), - to.Ptr("hanasharedsr1")}, - "usrSap": { - to.Ptr("usrsapsr0")}, - }, - HostName: to.Ptr("dbsrhostName"), - NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - { - NetworkInterfaceName: to.Ptr("dbsrnic"), - }}, - OSDiskName: to.Ptr("dbsrosdisk"), - VMName: to.Ptr("dbvmsr"), - }}, - }, - SharedStorage: &armworkloadssapvirtualinstance.SharedStorageResourceNames{ - SharedStorageAccountName: to.Ptr("storageacc"), - SharedStorageAccountPrivateEndPointName: to.Ptr("peForxNFS"), - }, - }, DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - InstanceCount: to.Ptr[int64](2), + InstanceCount: to.Ptr[int64](1), SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ @@ -1318,31 +936,27 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + { + KeyData: to.Ptr("ssh-rsa public key"), + }, + }, }, }, }, VMSize: to.Ptr("Standard_M32ts"), }, }, - HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ - HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilityZone), - }, - }, - OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - SapFqdn: to.Ptr("xyz.test.com"), + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), }, }, Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - ManagedResourceGroupConfiguration: &armworkloadssapvirtualinstance.ManagedRGConfiguration{ - Name: to.Ptr("mrg-X00-8e17e36c-42e9-4cd5-a078-7b44883414e0"), - }, - SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), }, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -1354,427 +968,145 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf // 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](6), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + // AppResourceGroup: to.Ptr("X00-RG"), + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + // InstanceCount: to.Ptr[int64](6), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + // { + // KeyData: to.Ptr("ssh-rsa public key"), + // }, + // }, + // }, + // }, + // }, + // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, + // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), // }, - // }, - // VMSize: to.Ptr("Standard_E16ds_v4"), - // }, - // }, - // CustomResourceNames: &armworkloadssapvirtualinstance.ThreeTierFullResourceNames{ - // NamingPatternType: to.Ptr(armworkloadssapvirtualinstance.NamingPatternTypeFullResourceName), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerFullResourceNames{ - // VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ - // { - // DataDiskNames: map[string][]*string{ - // "default": []*string{ - // to.Ptr("app0disk0")}, - // }, - // HostName: to.Ptr("apphostName0"), - // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - // { - // NetworkInterfaceName: to.Ptr("appnic0"), - // }}, - // OSDiskName: to.Ptr("app0osdisk"), - // VMName: to.Ptr("appvm0"), - // }, - // { - // DataDiskNames: map[string][]*string{ - // "default": []*string{ - // to.Ptr("app1disk0")}, - // }, - // HostName: to.Ptr("apphostName1"), - // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ // { - // NetworkInterfaceName: to.Ptr("appnic1"), - // }}, - // OSDiskName: to.Ptr("app1osdisk"), - // VMName: to.Ptr("appvm1"), - // }}, - // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerFullResourceNames{ - // LoadBalancer: &armworkloadssapvirtualinstance.LoadBalancerResourceNames{ - // BackendPoolNames: []*string{ - // to.Ptr("ascsBackendPool")}, - // FrontendIPConfigurationNames: []*string{ - // to.Ptr("ascsip0"), - // to.Ptr("ersip0")}, - // HealthProbeNames: []*string{ - // to.Ptr("ascsHealthProbe"), - // to.Ptr("ersHealthProbe")}, - // LoadBalancerName: to.Ptr("ascslb"), + // KeyData: to.Ptr("ssh-rsa public key"), // }, - // VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ - // { - // HostName: to.Ptr("ascshostName"), - // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - // { - // NetworkInterfaceName: to.Ptr("ascsnic"), - // }}, - // OSDiskName: to.Ptr("ascsosdisk"), - // VMName: to.Ptr("ascsvm"), - // }, - // { - // HostName: to.Ptr("ershostName"), - // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - // { - // NetworkInterfaceName: to.Ptr("ersnic"), - // }}, - // OSDiskName: to.Ptr("ersosdisk"), - // VMName: to.Ptr("ersvm"), - // }}, - // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseServerFullResourceNames{ - // LoadBalancer: &armworkloadssapvirtualinstance.LoadBalancerResourceNames{ - // BackendPoolNames: []*string{ - // to.Ptr("dbBackendPool")}, - // FrontendIPConfigurationNames: []*string{ - // to.Ptr("dbip")}, - // HealthProbeNames: []*string{ - // to.Ptr("dbHealthProbe")}, - // LoadBalancerName: to.Ptr("dblb"), - // }, - // VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ - // { - // DataDiskNames: map[string][]*string{ - // "hanaData": []*string{ - // to.Ptr("hanadatapr0"), - // to.Ptr("hanadatapr1")}, - // "hanaLog": []*string{ - // to.Ptr("hanalogpr0"), - // to.Ptr("hanalogpr1"), - // to.Ptr("hanalogpr2")}, - // "hanaShared": []*string{ - // to.Ptr("hanasharedpr0"), - // to.Ptr("hanasharedpr1")}, - // "usrSap": []*string{ - // to.Ptr("usrsappr0")}, - // }, - // HostName: to.Ptr("dbprhostName"), - // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - // { - // NetworkInterfaceName: to.Ptr("dbprnic"), - // }}, - // OSDiskName: to.Ptr("dbprosdisk"), - // VMName: to.Ptr("dbvmpr"), - // }, - // { - // DataDiskNames: map[string][]*string{ - // "hanaData": []*string{ - // to.Ptr("hanadatasr0"), - // to.Ptr("hanadatasr1")}, - // "hanaLog": []*string{ - // to.Ptr("hanalogsr0"), - // to.Ptr("hanalogsr1"), - // to.Ptr("hanalogsr2")}, - // "hanaShared": []*string{ - // to.Ptr("hanasharedsr0"), - // to.Ptr("hanasharedsr1")}, - // "usrSap": []*string{ - // to.Ptr("usrsapsr0")}, - // }, - // HostName: to.Ptr("dbsrhostName"), - // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - // { - // NetworkInterfaceName: to.Ptr("dbsrnic"), - // }}, - // OSDiskName: to.Ptr("dbsrosdisk"), - // VMName: to.Ptr("dbvmsr"), - // }}, - // }, - // SharedStorage: &armworkloadssapvirtualinstance.SharedStorageResourceNames{ - // SharedStorageAccountName: to.Ptr("storageacc"), - // SharedStorageAccountPrivateEndPointName: to.Ptr("peForxNFS"), - // }, - // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_M32ts"), - // }, - // }, - // HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ - // HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilityZone), - // }, - // }, - // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - // SapFqdn: to.Ptr("xyz.test.com"), - // }, - // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), - // ManagedResourceGroupConfiguration: &armworkloadssapvirtualinstance.ManagedRGConfiguration{ - // Name: to.Ptr("mrg-X00-8e17e36c-42e9-4cd5-a078-7b44883414e0"), - // }, - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatus("Unknown")), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_CustomFullResourceNames_SingleServer.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConfigurationWithCustomResourceNamesForSingleServerSystem() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, - Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), - AppLocation: to.Ptr("eastus"), - InfrastructureConfiguration: &armworkloadssapvirtualinstance.SingleServerConfiguration{ - AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeSingleServer), - DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - NetworkConfiguration: &armworkloadssapvirtualinstance.NetworkConfiguration{ - IsSecondaryIPEnabled: to.Ptr(true), - }, - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), - }, - }, - }, - VMSize: to.Ptr("Standard_E32ds_v4"), - }, - }, - OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - SapFqdn: to.Ptr("xyz.test.com"), - }, - }, - Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), - ManagedResourceGroupConfiguration: &armworkloadssapvirtualinstance.ManagedRGConfiguration{ - Name: to.Ptr("mrg-X00-8e17e36c-42e9-4cd5-a078-7b44883414e0"), - }, - SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - }, - }, 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.SingleServerConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeSingleServer), - // CustomResourceNames: &armworkloadssapvirtualinstance.SingleServerFullResourceNames{ - // NamingPatternType: to.Ptr(armworkloadssapvirtualinstance.NamingPatternTypeFullResourceName), - // VirtualMachine: &armworkloadssapvirtualinstance.VirtualMachineResourceNames{ - // DataDiskNames: map[string][]*string{ - // "hanaData": []*string{ - // to.Ptr("hanadata0"), - // to.Ptr("hanadata1")}, - // "hanaLog": []*string{ - // to.Ptr("hanalog0"), - // to.Ptr("hanalog1"), - // to.Ptr("hanalog2")}, - // "hanaShared": []*string{ - // to.Ptr("hanashared0"), - // to.Ptr("hanashared1")}, - // "usrSap": []*string{ - // to.Ptr("usrsap0")}, // }, - // HostName: to.Ptr("sshostName"), - // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ - // { - // NetworkInterfaceName: to.Ptr("ssnic"), - // }}, - // OSDiskName: to.Ptr("ssosdisk"), - // VMName: to.Ptr("ssvm"), // }, // }, - // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - // NetworkConfiguration: &armworkloadssapvirtualinstance.NetworkConfiguration{ - // IsSecondaryIPEnabled: to.Ptr(true), - // }, - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // }, + // VMSize: to.Ptr("Standard_E16ds_v4"), + // }, + // }, + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + // { + // KeyData: to.Ptr("ssh-rsa public key"), // }, // }, // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), // }, // }, - // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - // SapFqdn: to.Ptr("xyz.test.com"), - // }, - // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), - // ManagedResourceGroupConfiguration: &armworkloadssapvirtualinstance.ManagedRGConfiguration{ - // Name: to.Ptr("mrg-X00-8e17e36c-42e9-4cd5-a078-7b44883414e0"), + // VMSize: to.Ptr("Standard_M32ts"), // }, - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatus("Unknown")), // }, - // } + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + // }, + // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // }, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_WithOSConfig_WithTrustedAccess.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConfigurationWithTrustedAccessEnabled() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_CreateInfraDiskOsDSRecommended.json +func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithDiskAndOSConfigurationForDistributedSystemRecommended() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, + Location: to.Ptr("westcentralus"), Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), AppLocation: to.Ptr("eastus"), + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ InstanceCount: to.Ptr[int64](6), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ Offer: to.Ptr("RHEL-SAP"), @@ -1785,8 +1117,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -1798,7 +1130,7 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf }, CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ InstanceCount: to.Ptr[int64](1), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ Offer: to.Ptr("RHEL-SAP"), @@ -1809,8 +1141,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -1821,9 +1153,55 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf }, }, DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + DiskConfiguration: &armworkloadssapvirtualinstance.DiskConfiguration{ + DiskVolumeConfigurations: map[string]*armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + "backup": { + Count: to.Ptr[int64](2), + SizeGB: to.Ptr[int64](256), + SKU: &armworkloadssapvirtualinstance.DiskSKU{ + Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + }, + }, + "hana/data": { + Count: to.Ptr[int64](4), + SizeGB: to.Ptr[int64](128), + SKU: &armworkloadssapvirtualinstance.DiskSKU{ + Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + }, + }, + "hana/log": { + Count: to.Ptr[int64](3), + SizeGB: to.Ptr[int64](128), + SKU: &armworkloadssapvirtualinstance.DiskSKU{ + Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + }, + }, + "hana/shared": { + Count: to.Ptr[int64](1), + SizeGB: to.Ptr[int64](256), + SKU: &armworkloadssapvirtualinstance.DiskSKU{ + Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + }, + }, + "os": { + Count: to.Ptr[int64](1), + SizeGB: to.Ptr[int64](64), + SKU: &armworkloadssapvirtualinstance.DiskSKU{ + Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + }, + }, + "usr/sap": { + Count: to.Ptr[int64](1), + SizeGB: to.Ptr[int64](128), + SKU: &armworkloadssapvirtualinstance.DiskSKU{ + Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + }, + }, + }, + }, InstanceCount: to.Ptr[int64](1), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ Offer: to.Ptr("RHEL-SAP"), @@ -1834,8 +1212,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -1845,15 +1223,16 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf VMSize: to.Ptr("Standard_M32ts"), }, }, + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), }, OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ SapFqdn: to.Ptr("xyz.test.com"), }, }, - Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - ManagedResourcesNetworkAccessType: to.Ptr(armworkloadssapvirtualinstance.ManagedResourcesNetworkAccessTypePrivate), - SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), }, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -1865,138 +1244,182 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf // 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](6), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + // AppResourceGroup: to.Ptr("X00-RG"), + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + // InstanceCount: to.Ptr[int64](6), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, + // }, + // }, + // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // }, + // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_E16ds_v4"), // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + // DiskConfiguration: &armworkloadssapvirtualinstance.DiskConfiguration{ + // DiskVolumeConfigurations: map[string]*armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // "backup": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // Count: to.Ptr[int64](2), + // SizeGB: to.Ptr[int64](256), + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + // }, + // }, + // "hana/data": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // Count: to.Ptr[int64](4), + // SizeGB: to.Ptr[int64](128), + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // }, + // "hana/log": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // Count: to.Ptr[int64](3), + // SizeGB: to.Ptr[int64](128), + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // }, + // "hana/shared": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // Count: to.Ptr[int64](1), + // SizeGB: to.Ptr[int64](256), + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + // }, + // }, + // "os": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // Count: to.Ptr[int64](1), + // SizeGB: to.Ptr[int64](64), + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + // }, + // }, + // "usr/sap": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // Count: to.Ptr[int64](1), + // SizeGB: to.Ptr[int64](128), + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // }, + // }, // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_M32ts"), // }, - // VMSize: to.Ptr("Standard_E16ds_v4"), // }, + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_M32ts"), - // }, + // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ + // SapFqdn: to.Ptr("xyz.test.com"), // }, // }, - // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - // SapFqdn: to.Ptr("xyz.test.com"), - // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), - // ManagedResourcesNetworkAccessType: to.Ptr(armworkloadssapvirtualinstance.ManagedResourcesNetworkAccessTypePrivate), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatus("Unknown")), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_Distributed.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureOnlyForDistributedSystem() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_CreateInfraDiskOsHaAvailabilitySetRecommended.json +func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithDiskAndOSConfigurationForHaSystemWithAvailabilitySetRecommended() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, + Location: to.Ptr("westcentralus"), Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), + Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ AppLocation: to.Ptr("eastus"), + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ InstanceCount: to.Ptr[int64](6), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ Offer: to.Ptr("RHEL-SAP"), @@ -2007,13 +1430,11 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureOnlyForDis OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), - SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - { - KeyData: to.Ptr("ssh-rsa public key"), - }}, + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + PrivateKey: to.Ptr("xyz"), + PublicKey: to.Ptr("abc"), }, }, }, @@ -2021,8 +1442,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureOnlyForDis }, }, CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - InstanceCount: to.Ptr[int64](1), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + InstanceCount: to.Ptr[int64](2), + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ Offer: to.Ptr("RHEL-SAP"), @@ -2033,13 +1454,11 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureOnlyForDis OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), - SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - { - KeyData: to.Ptr("ssh-rsa public key"), - }}, + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + PrivateKey: to.Ptr("xyz"), + PublicKey: to.Ptr("abc"), }, }, }, @@ -2047,9 +1466,55 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureOnlyForDis }, }, DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - InstanceCount: to.Ptr[int64](1), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), + DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + DiskConfiguration: &armworkloadssapvirtualinstance.DiskConfiguration{ + DiskVolumeConfigurations: map[string]*armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + "backup": { + Count: to.Ptr[int64](2), + SizeGB: to.Ptr[int64](256), + SKU: &armworkloadssapvirtualinstance.DiskSKU{ + Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + }, + }, + "hana/data": { + Count: to.Ptr[int64](4), + SizeGB: to.Ptr[int64](128), + SKU: &armworkloadssapvirtualinstance.DiskSKU{ + Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + }, + }, + "hana/log": { + Count: to.Ptr[int64](3), + SizeGB: to.Ptr[int64](128), + SKU: &armworkloadssapvirtualinstance.DiskSKU{ + Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + }, + }, + "hana/shared": { + Count: to.Ptr[int64](1), + SizeGB: to.Ptr[int64](256), + SKU: &armworkloadssapvirtualinstance.DiskSKU{ + Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + }, + }, + "os": { + Count: to.Ptr[int64](1), + SizeGB: to.Ptr[int64](64), + SKU: &armworkloadssapvirtualinstance.DiskSKU{ + Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + }, + }, + "usr/sap": { + Count: to.Ptr[int64](1), + SizeGB: to.Ptr[int64](128), + SKU: &armworkloadssapvirtualinstance.DiskSKU{ + Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + }, + }, + }, + }, + InstanceCount: to.Ptr[int64](2), + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ Offer: to.Ptr("RHEL-SAP"), @@ -2060,24 +1525,30 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureOnlyForDis OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), - SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - { - KeyData: to.Ptr("ssh-rsa public key"), - }}, + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + PrivateKey: to.Ptr("xyz"), + PublicKey: to.Ptr("abc"), }, }, }, VMSize: to.Ptr("Standard_M32ts"), }, }, + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ + HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilitySet), + }, + }, + OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ + SapFqdn: to.Ptr("xyz.test.com"), }, }, Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), }, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -2089,143 +1560,185 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureOnlyForDis // 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](6), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + // AppResourceGroup: to.Ptr("X00-RG"), + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + // InstanceCount: to.Ptr[int64](6), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, + // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ + // InstanceCount: to.Ptr[int64](2), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_E16ds_v4"), // }, - // VMSize: to.Ptr("Standard_E16ds_v4"), // }, - // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + // DiskConfiguration: &armworkloadssapvirtualinstance.DiskConfiguration{ + // DiskVolumeConfigurations: map[string]*armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // "backup": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // Count: to.Ptr[int64](2), + // SizeGB: to.Ptr[int64](256), + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + // }, + // }, + // "hana/data": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // Count: to.Ptr[int64](4), + // SizeGB: to.Ptr[int64](128), + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // }, + // "hana/log": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // Count: to.Ptr[int64](3), + // SizeGB: to.Ptr[int64](128), + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // }, + // "hana/shared": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // Count: to.Ptr[int64](1), + // SizeGB: to.Ptr[int64](256), + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + // }, + // }, + // "os": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // Count: to.Ptr[int64](1), + // SizeGB: to.Ptr[int64](64), + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + // }, + // }, + // "usr/sap": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // Count: to.Ptr[int64](1), + // SizeGB: to.Ptr[int64](128), + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // }, + // }, // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, + // InstanceCount: to.Ptr[int64](2), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_M32ts"), // }, - // VMSize: to.Ptr("Standard_M32ts"), // }, + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + // HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ + // HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilitySet), + // }, + // }, + // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ + // SapFqdn: to.Ptr("xyz.test.com"), // }, // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatus("Unknown")), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_HA_AvSet.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureOnlyForHaSystemWithAvailabilitySet() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_CreateInfraDiskOsHaAvailabilityZoneRecommended.json +func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithDiskAndOSConfigurationForHaSystemWithAvailabilityZoneRecommended() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, + Location: to.Ptr("westcentralus"), Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), + Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ AppLocation: to.Ptr("eastus"), + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - InstanceCount: to.Ptr[int64](5), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + InstanceCount: to.Ptr[int64](6), + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ Offer: to.Ptr("RHEL-SAP"), @@ -2236,13 +1749,11 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureOnlyForHaS OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), - SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - { - KeyData: to.Ptr("ssh-rsa public key"), - }}, + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + PrivateKey: to.Ptr("xyz"), + PublicKey: to.Ptr("abc"), }, }, }, @@ -2251,7 +1762,7 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureOnlyForHaS }, CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ InstanceCount: to.Ptr[int64](2), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ Offer: to.Ptr("RHEL-SAP"), @@ -2262,13 +1773,11 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureOnlyForHaS OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), - SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - { - KeyData: to.Ptr("ssh-rsa public key"), - }}, + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + PrivateKey: to.Ptr("xyz"), + PublicKey: to.Ptr("abc"), }, }, }, @@ -2276,40 +1785,89 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureOnlyForHaS }, }, DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - InstanceCount: to.Ptr[int64](2), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - { - KeyData: to.Ptr("ssh-rsa public key"), - }}, + DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + DiskConfiguration: &armworkloadssapvirtualinstance.DiskConfiguration{ + DiskVolumeConfigurations: map[string]*armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + "backup": { + Count: to.Ptr[int64](2), + SizeGB: to.Ptr[int64](256), + SKU: &armworkloadssapvirtualinstance.DiskSKU{ + Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), }, }, - }, - VMSize: to.Ptr("Standard_M32ts"), - }, - }, - HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ - HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilitySet), - }, - }, - }, - Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - }, + "hana/data": { + Count: to.Ptr[int64](4), + SizeGB: to.Ptr[int64](128), + SKU: &armworkloadssapvirtualinstance.DiskSKU{ + Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + }, + }, + "hana/log": { + Count: to.Ptr[int64](3), + SizeGB: to.Ptr[int64](128), + SKU: &armworkloadssapvirtualinstance.DiskSKU{ + Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + }, + }, + "hana/shared": { + Count: to.Ptr[int64](1), + SizeGB: to.Ptr[int64](256), + SKU: &armworkloadssapvirtualinstance.DiskSKU{ + Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + }, + }, + "os": { + Count: to.Ptr[int64](1), + SizeGB: to.Ptr[int64](64), + SKU: &armworkloadssapvirtualinstance.DiskSKU{ + Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + }, + }, + "usr/sap": { + Count: to.Ptr[int64](1), + SizeGB: to.Ptr[int64](128), + SKU: &armworkloadssapvirtualinstance.DiskSKU{ + Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + }, + }, + }, + }, + InstanceCount: to.Ptr[int64](2), + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), + VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + Offer: to.Ptr("RHEL-SAP"), + Publisher: to.Ptr("RedHat"), + SKU: to.Ptr("84sapha-gen2"), + Version: to.Ptr("latest"), + }, + OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + AdminUsername: to.Ptr("{your-username}"), + OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + PrivateKey: to.Ptr("xyz"), + PublicKey: to.Ptr("abc"), + }, + }, + }, + VMSize: to.Ptr("Standard_M32ts"), + }, + }, + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ + HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilityZone), + }, + }, + OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ + SapFqdn: to.Ptr("xyz.test.com"), + }, + }, + Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + }, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -2321,230 +1879,263 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureOnlyForHaS // 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](5), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + // AppResourceGroup: to.Ptr("X00-RG"), + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + // InstanceCount: to.Ptr[int64](6), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, + // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ + // InstanceCount: to.Ptr[int64](2), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_E16ds_v4"), // }, - // VMSize: to.Ptr("Standard_E16ds_v4"), // }, - // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + // DiskConfiguration: &armworkloadssapvirtualinstance.DiskConfiguration{ + // DiskVolumeConfigurations: map[string]*armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // "backup": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // Count: to.Ptr[int64](2), + // SizeGB: to.Ptr[int64](256), + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + // }, + // }, + // "hana/data": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // Count: to.Ptr[int64](4), + // SizeGB: to.Ptr[int64](128), + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // }, + // "hana/log": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // Count: to.Ptr[int64](3), + // SizeGB: to.Ptr[int64](128), + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // }, + // "hana/shared": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // Count: to.Ptr[int64](1), + // SizeGB: to.Ptr[int64](256), + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + // }, + // }, + // "os": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // Count: to.Ptr[int64](1), + // SizeGB: to.Ptr[int64](64), + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + // }, + // }, + // "usr/sap": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // Count: to.Ptr[int64](1), + // SizeGB: to.Ptr[int64](128), + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // }, + // }, // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, + // InstanceCount: to.Ptr[int64](2), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_M32ts"), // }, - // VMSize: to.Ptr("Standard_M32ts"), + // }, + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + // HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ + // HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilityZone), // }, // }, - // HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ - // HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilitySet), + // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ + // SapFqdn: to.Ptr("xyz.test.com"), // }, // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatus("Unknown")), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_HA_AvZone.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureOnlyForHaSystemWithAvailabilityZone() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_CreateInfraDiskOsSingleServerRecommended.json +func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithDiskAndOSConfigurationsForSingleServerSystemRecommended() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, + Location: to.Ptr("westcentralus"), Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), + Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ AppLocation: to.Ptr("eastus"), - InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + InfrastructureConfiguration: &armworkloadssapvirtualinstance.SingleServerConfiguration{ AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - InstanceCount: to.Ptr[int64](6), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), + DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + DbDiskConfiguration: &armworkloadssapvirtualinstance.DiskConfiguration{ + DiskVolumeConfigurations: map[string]*armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + "backup": { + Count: to.Ptr[int64](2), + SizeGB: to.Ptr[int64](256), + SKU: &armworkloadssapvirtualinstance.DiskSKU{ + Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + }, }, - OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - { - KeyData: to.Ptr("ssh-rsa public key"), - }}, - }, + "hana/data": { + Count: to.Ptr[int64](4), + SizeGB: to.Ptr[int64](128), + SKU: &armworkloadssapvirtualinstance.DiskSKU{ + Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), }, }, - VMSize: to.Ptr("Standard_E32ds_v4"), - }, - }, - CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - InstanceCount: to.Ptr[int64](2), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), + "hana/log": { + Count: to.Ptr[int64](3), + SizeGB: to.Ptr[int64](128), + SKU: &armworkloadssapvirtualinstance.DiskSKU{ + Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + }, }, - OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - { - KeyData: to.Ptr("ssh-rsa public key"), - }}, - }, + "hana/shared": { + Count: to.Ptr[int64](1), + SizeGB: to.Ptr[int64](256), + SKU: &armworkloadssapvirtualinstance.DiskSKU{ + Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), }, }, - VMSize: to.Ptr("Standard_E16ds_v4"), - }, - }, - DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - InstanceCount: to.Ptr[int64](2), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), + "os": { + Count: to.Ptr[int64](1), + SizeGB: to.Ptr[int64](64), + SKU: &armworkloadssapvirtualinstance.DiskSKU{ + Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + }, }, - OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - { - KeyData: to.Ptr("ssh-rsa public key"), - }}, - }, + "usr/sap": { + Count: to.Ptr[int64](1), + SizeGB: to.Ptr[int64](128), + SKU: &armworkloadssapvirtualinstance.DiskSKU{ + Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), }, }, - VMSize: to.Ptr("Standard_M32ts"), }, }, - HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ - HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilityZone), + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeSingleServer), + NetworkConfiguration: &armworkloadssapvirtualinstance.NetworkConfiguration{ + IsSecondaryIPEnabled: to.Ptr(true), + }, + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + Offer: to.Ptr("RHEL-SAP"), + Publisher: to.Ptr("RedHat"), + SKU: to.Ptr("84sapha-gen2"), + Version: to.Ptr("latest"), + }, + OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + AdminUsername: to.Ptr("{your-username}"), + OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + PrivateKey: to.Ptr("xyz"), + PublicKey: to.Ptr("abc"), + }, + }, + }, + VMSize: to.Ptr("Standard_E32ds_v4"), }, }, + OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ + SapFqdn: to.Ptr("xyz.test.com"), + }, }, - Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), }, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -2556,84 +2147,70 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureOnlyForHaS // 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](6), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.SingleServerConfiguration{ + // AppResourceGroup: to.Ptr("X00-RG"), + // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + // DbDiskConfiguration: &armworkloadssapvirtualinstance.DiskConfiguration{ + // DiskVolumeConfigurations: map[string]*armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // "backup": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // Count: to.Ptr[int64](2), + // SizeGB: to.Ptr[int64](256), + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), // }, // }, - // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), - // }, - // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, + // "hana/data": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // Count: to.Ptr[int64](4), + // SizeGB: to.Ptr[int64](128), + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // }, + // "hana/log": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // Count: to.Ptr[int64](3), + // SizeGB: to.Ptr[int64](128), + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // }, + // "hana/shared": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // Count: to.Ptr[int64](1), + // SizeGB: to.Ptr[int64](256), + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + // }, + // }, + // "os": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // Count: to.Ptr[int64](1), + // SizeGB: to.Ptr[int64](64), + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + // }, + // }, + // "usr/sap": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // Count: to.Ptr[int64](1), + // SizeGB: to.Ptr[int64](128), + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), // }, // }, // }, - // VMSize: to.Ptr("Standard_E16ds_v4"), // }, - // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeSingleServer), + // NetworkConfiguration: &armworkloadssapvirtualinstance.NetworkConfiguration{ + // IsSecondaryIPEnabled: to.Ptr(true), + // }, + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ // Offer: to.Ptr("RHEL-SAP"), @@ -2644,180 +2221,62 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureOnlyForHaS // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ // AdminUsername: to.Ptr("{your-username}"), // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), // }, // }, // }, - // VMSize: to.Ptr("Standard_M32ts"), + // VMSize: to.Ptr("Standard_E32ds_v4"), // }, // }, - // HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ - // HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilityZone), + // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ + // SapFqdn: to.Ptr("xyz.test.com"), // }, // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatus("Unknown")), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_SingleServer.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureOnlyForSingleServerSystem() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, - Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), - AppLocation: to.Ptr("eastus"), - InfrastructureConfiguration: &armworkloadssapvirtualinstance.SingleServerConfiguration{ - AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeSingleServer), - DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - NetworkConfiguration: &armworkloadssapvirtualinstance.NetworkConfiguration{ - IsSecondaryIPEnabled: to.Ptr(true), - }, - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - { - KeyData: to.Ptr("ssh-rsa public key"), - }}, - }, - }, - }, - VMSize: to.Ptr("Standard_E32ds_v4"), - }, - }, - }, - Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), - SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - }, - }, 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.SingleServerConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeSingleServer), - // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), - // }, - // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatus("Unknown")), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_DiskDetails_Distributed.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithDiskAndOsConfigurationForDistributedSystemRecommended() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_CreateInfraHaAvailabilitySet.json +func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureOnlyForHaSystemWithAvailabilitySet() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, + Location: to.Ptr("westcentralus"), Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ AppLocation: to.Ptr("eastus"), + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - InstanceCount: to.Ptr[int64](6), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + InstanceCount: to.Ptr[int64](5), + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ Offer: to.Ptr("RHEL-SAP"), @@ -2828,11 +2287,14 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithDiskAn OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + { + KeyData: to.Ptr("ssh-rsa public key"), + }, + }, }, }, }, @@ -2840,8 +2302,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithDiskAn }, }, CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - InstanceCount: to.Ptr[int64](1), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + InstanceCount: to.Ptr[int64](2), + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ Offer: to.Ptr("RHEL-SAP"), @@ -2852,11 +2314,14 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithDiskAn OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + { + KeyData: to.Ptr("ssh-rsa public key"), + }, + }, }, }, }, @@ -2864,84 +2329,43 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithDiskAn }, }, DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - DiskConfiguration: &armworkloadssapvirtualinstance.DiskConfiguration{ - DiskVolumeConfigurations: map[string]*armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - "backup": { - Count: to.Ptr[int64](2), - SizeGB: to.Ptr[int64](256), - SKU: &armworkloadssapvirtualinstance.DiskSKU{ - Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - }, - }, - "hana/data": { - Count: to.Ptr[int64](4), - SizeGB: to.Ptr[int64](128), - SKU: &armworkloadssapvirtualinstance.DiskSKU{ - Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - }, - }, - "hana/log": { - Count: to.Ptr[int64](3), - SizeGB: to.Ptr[int64](128), - SKU: &armworkloadssapvirtualinstance.DiskSKU{ - Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - }, - }, - "hana/shared": { - Count: to.Ptr[int64](1), - SizeGB: to.Ptr[int64](256), - SKU: &armworkloadssapvirtualinstance.DiskSKU{ - Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - }, - }, - "os": { - Count: to.Ptr[int64](1), - SizeGB: to.Ptr[int64](64), - SKU: &armworkloadssapvirtualinstance.DiskSKU{ - Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - }, - }, - "usr/sap": { - Count: to.Ptr[int64](1), - SizeGB: to.Ptr[int64](128), - SKU: &armworkloadssapvirtualinstance.DiskSKU{ - Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - }, - }, - }, - }, - InstanceCount: to.Ptr[int64](1), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), + DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + InstanceCount: to.Ptr[int64](2), + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), + VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + Offer: to.Ptr("RHEL-SAP"), + Publisher: to.Ptr("RedHat"), + SKU: to.Ptr("84sapha-gen2"), + Version: to.Ptr("latest"), + }, + OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + AdminUsername: to.Ptr("{your-username}"), + OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + { + KeyData: to.Ptr("ssh-rsa public key"), + }, + }, }, }, }, VMSize: to.Ptr("Standard_M32ts"), }, }, - }, - OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - SapFqdn: to.Ptr("xyz.test.com"), + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ + HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilitySet), + }, }, }, Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), }, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -2953,183 +2377,148 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithDiskAn // 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](6), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + // AppResourceGroup: to.Ptr("X00-RG"), + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + // InstanceCount: to.Ptr[int64](5), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), // }, - // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), - // }, - // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + // { + // KeyData: to.Ptr("ssh-rsa public key"), + // }, + // }, + // }, // }, // }, + // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // VMSize: to.Ptr("Standard_E16ds_v4"), // }, - // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - // DiskConfiguration: &armworkloadssapvirtualinstance.DiskConfiguration{ - // DiskVolumeConfigurations: map[string]*armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // "backup": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](2), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - // }, - // }, - // "hana/data": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](4), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // "hana/log": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](3), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // "hana/shared": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - // }, - // }, - // "os": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](64), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - // }, + // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ + // InstanceCount: to.Ptr[int64](2), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), // }, - // "usr/sap": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + // { + // KeyData: to.Ptr("ssh-rsa public key"), + // }, + // }, + // }, // }, // }, + // VMSize: to.Ptr("Standard_E16ds_v4"), // }, // }, - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + // InstanceCount: to.Ptr[int64](2), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + // { + // KeyData: to.Ptr("ssh-rsa public key"), + // }, + // }, + // }, // }, // }, + // VMSize: to.Ptr("Standard_M32ts"), // }, - // VMSize: to.Ptr("Standard_M32ts"), + // }, + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + // HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ + // HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilitySet), // }, // }, // }, - // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - // SapFqdn: to.Ptr("xyz.test.com"), - // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatus("Unknown")), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_DiskDetails_HA_AvSet.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithDiskAndOsConfigurationForHaSystemWithAvailabilitySetRecommended() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_CreateInfraHaAvailabilityZone.json +func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureOnlyForHaSystemWithAvailabilityZone() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, + Location: to.Ptr("westcentralus"), Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ AppLocation: to.Ptr("eastus"), + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ InstanceCount: to.Ptr[int64](6), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ Offer: to.Ptr("RHEL-SAP"), @@ -3140,11 +2529,14 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithDiskAn OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + { + KeyData: to.Ptr("ssh-rsa public key"), + }, + }, }, }, }, @@ -3153,7 +2545,7 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithDiskAn }, CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ InstanceCount: to.Ptr[int64](2), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ Offer: to.Ptr("RHEL-SAP"), @@ -3164,11 +2556,14 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithDiskAn OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + { + KeyData: to.Ptr("ssh-rsa public key"), + }, + }, }, }, }, @@ -3176,55 +2571,9 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithDiskAn }, }, DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - DiskConfiguration: &armworkloadssapvirtualinstance.DiskConfiguration{ - DiskVolumeConfigurations: map[string]*armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - "backup": { - Count: to.Ptr[int64](2), - SizeGB: to.Ptr[int64](256), - SKU: &armworkloadssapvirtualinstance.DiskSKU{ - Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - }, - }, - "hana/data": { - Count: to.Ptr[int64](4), - SizeGB: to.Ptr[int64](128), - SKU: &armworkloadssapvirtualinstance.DiskSKU{ - Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - }, - }, - "hana/log": { - Count: to.Ptr[int64](3), - SizeGB: to.Ptr[int64](128), - SKU: &armworkloadssapvirtualinstance.DiskSKU{ - Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - }, - }, - "hana/shared": { - Count: to.Ptr[int64](1), - SizeGB: to.Ptr[int64](256), - SKU: &armworkloadssapvirtualinstance.DiskSKU{ - Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - }, - }, - "os": { - Count: to.Ptr[int64](1), - SizeGB: to.Ptr[int64](64), - SKU: &armworkloadssapvirtualinstance.DiskSKU{ - Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - }, - }, - "usr/sap": { - Count: to.Ptr[int64](1), - SizeGB: to.Ptr[int64](128), - SKU: &armworkloadssapvirtualinstance.DiskSKU{ - Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - }, - }, - }, - }, + DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), InstanceCount: to.Ptr[int64](2), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ Offer: to.Ptr("RHEL-SAP"), @@ -3235,28 +2584,30 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithDiskAn OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + { + KeyData: to.Ptr("ssh-rsa public key"), + }, + }, }, }, }, VMSize: to.Ptr("Standard_M32ts"), }, }, + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ - HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilitySet), + HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilityZone), }, }, - OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - SapFqdn: to.Ptr("xyz.test.com"), - }, }, Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), }, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -3268,201 +2619,163 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithDiskAn // 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](6), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + // AppResourceGroup: to.Ptr("X00-RG"), + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + // InstanceCount: to.Ptr[int64](6), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), // }, - // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), - // }, - // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + // { + // KeyData: to.Ptr("ssh-rsa public key"), + // }, + // }, + // }, // }, // }, + // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // VMSize: to.Ptr("Standard_E16ds_v4"), // }, - // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - // DiskConfiguration: &armworkloadssapvirtualinstance.DiskConfiguration{ - // DiskVolumeConfigurations: map[string]*armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // "backup": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](2), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - // }, - // }, - // "hana/data": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](4), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // "hana/log": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](3), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, + // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ + // InstanceCount: to.Ptr[int64](2), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), // }, - // "hana/shared": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - // }, - // }, - // "os": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](64), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - // }, - // }, - // "usr/sap": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + // { + // KeyData: to.Ptr("ssh-rsa public key"), + // }, + // }, + // }, // }, // }, + // VMSize: to.Ptr("Standard_E16ds_v4"), // }, // }, - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + // InstanceCount: to.Ptr[int64](2), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + // { + // KeyData: to.Ptr("ssh-rsa public key"), + // }, + // }, + // }, // }, // }, + // VMSize: to.Ptr("Standard_M32ts"), // }, - // VMSize: to.Ptr("Standard_M32ts"), // }, - // }, - // HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ - // HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilitySet), + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + // HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ + // HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilityZone), + // }, // }, // }, - // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - // SapFqdn: to.Ptr("xyz.test.com"), - // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatus("Unknown")), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_DiskDetails_HA_AvZone.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithDiskAndOsConfigurationForHaSystemWithAvailabilityZoneRecommended() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_CreateInfraOsComputeGalleryImage.json +func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOSConfigurationWithAzureComputeGalleryImage() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, + Location: to.Ptr("westcentralus"), Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ AppLocation: to.Ptr("eastus"), + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ InstanceCount: to.Ptr[int64](6), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), + ID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/galleries/testgallery/images/rhelimagetest/versions/0.0.1"), }, OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + { + KeyData: to.Ptr("ssh-rsa public key"), + }, + }, }, }, }, @@ -3471,22 +2784,22 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithDiskAn }, CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ InstanceCount: to.Ptr[int64](2), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), + ID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/galleries/testgallery/images/rhelimagetest/versions/0.0.1"), }, OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + { + KeyData: to.Ptr("ssh-rsa public key"), + }, + }, }, }, }, @@ -3494,87 +2807,40 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithDiskAn }, }, DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - DiskConfiguration: &armworkloadssapvirtualinstance.DiskConfiguration{ - DiskVolumeConfigurations: map[string]*armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - "backup": { - Count: to.Ptr[int64](2), - SizeGB: to.Ptr[int64](256), - SKU: &armworkloadssapvirtualinstance.DiskSKU{ - Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - }, - }, - "hana/data": { - Count: to.Ptr[int64](4), - SizeGB: to.Ptr[int64](128), - SKU: &armworkloadssapvirtualinstance.DiskSKU{ - Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - }, - }, - "hana/log": { - Count: to.Ptr[int64](3), - SizeGB: to.Ptr[int64](128), - SKU: &armworkloadssapvirtualinstance.DiskSKU{ - Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - }, - }, - "hana/shared": { - Count: to.Ptr[int64](1), - SizeGB: to.Ptr[int64](256), - SKU: &armworkloadssapvirtualinstance.DiskSKU{ - Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - }, - }, - "os": { - Count: to.Ptr[int64](1), - SizeGB: to.Ptr[int64](64), - SKU: &armworkloadssapvirtualinstance.DiskSKU{ - Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - }, - }, - "usr/sap": { - Count: to.Ptr[int64](1), - SizeGB: to.Ptr[int64](128), - SKU: &armworkloadssapvirtualinstance.DiskSKU{ - Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - }, - }, - }, - }, + DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), InstanceCount: to.Ptr[int64](2), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), + ID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/galleries/testgallery/images/rhelimagetest/versions/0.0.1"), }, OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + { + KeyData: to.Ptr("ssh-rsa public key"), + }, + }, }, }, }, VMSize: to.Ptr("Standard_M32ts"), }, }, + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilityZone), }, }, - OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - SapFqdn: to.Ptr("xyz.test.com"), - }, }, Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), }, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -3586,401 +2852,136 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithDiskAn // 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](6), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + // AppResourceGroup: to.Ptr("X00-RG"), + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + // InstanceCount: to.Ptr[int64](6), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // ID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/galleries/testgallery/images/rhelimagetest/versions/0.0.1"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + // { + // KeyData: to.Ptr("ssh-rsa public key"), + // }, + // }, + // }, + // }, + // }, + // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // }, + // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ + // InstanceCount: to.Ptr[int64](2), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // ID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/galleries/testgallery/images/rhelimagetest/versions/0.0.1"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + // { + // KeyData: to.Ptr("ssh-rsa public key"), + // }, + // }, + // }, // }, // }, + // VMSize: to.Ptr("Standard_E16ds_v4"), // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), + // }, + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + // InstanceCount: to.Ptr[int64](2), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // ID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/galleries/testgallery/images/rhelimagetest/versions/0.0.1"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + // { + // KeyData: to.Ptr("ssh-rsa public key"), + // }, + // }, + // }, + // }, + // }, + // VMSize: to.Ptr("Standard_M32ts"), + // }, + // }, + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + // HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ + // HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilityZone), // }, // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_E16ds_v4"), - // }, - // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - // DiskConfiguration: &armworkloadssapvirtualinstance.DiskConfiguration{ - // DiskVolumeConfigurations: map[string]*armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // "backup": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](2), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - // }, - // }, - // "hana/data": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](4), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // "hana/log": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](3), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // "hana/shared": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - // }, - // }, - // "os": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](64), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - // }, - // }, - // "usr/sap": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // }, - // }, - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_M32ts"), - // }, - // }, - // HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ - // HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilityZone), - // }, - // }, - // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - // SapFqdn: to.Ptr("xyz.test.com"), // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatus("Unknown")), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_DiskDetails_SingleServer.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithDiskAndOsConfigurationsForSingleServerSystemRecommended() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, - Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), - AppLocation: to.Ptr("eastus"), - InfrastructureConfiguration: &armworkloadssapvirtualinstance.SingleServerConfiguration{ - AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeSingleServer), - DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - DbDiskConfiguration: &armworkloadssapvirtualinstance.DiskConfiguration{ - DiskVolumeConfigurations: map[string]*armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - "backup": { - Count: to.Ptr[int64](2), - SizeGB: to.Ptr[int64](256), - SKU: &armworkloadssapvirtualinstance.DiskSKU{ - Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - }, - }, - "hana/data": { - Count: to.Ptr[int64](4), - SizeGB: to.Ptr[int64](128), - SKU: &armworkloadssapvirtualinstance.DiskSKU{ - Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - }, - }, - "hana/log": { - Count: to.Ptr[int64](3), - SizeGB: to.Ptr[int64](128), - SKU: &armworkloadssapvirtualinstance.DiskSKU{ - Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - }, - }, - "hana/shared": { - Count: to.Ptr[int64](1), - SizeGB: to.Ptr[int64](256), - SKU: &armworkloadssapvirtualinstance.DiskSKU{ - Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - }, - }, - "os": { - Count: to.Ptr[int64](1), - SizeGB: to.Ptr[int64](64), - SKU: &armworkloadssapvirtualinstance.DiskSKU{ - Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - }, - }, - "usr/sap": { - Count: to.Ptr[int64](1), - SizeGB: to.Ptr[int64](128), - SKU: &armworkloadssapvirtualinstance.DiskSKU{ - Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - }, - }, - }, - }, - NetworkConfiguration: &armworkloadssapvirtualinstance.NetworkConfiguration{ - IsSecondaryIPEnabled: to.Ptr(true), - }, - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), - }, - }, - }, - VMSize: to.Ptr("Standard_E32ds_v4"), - }, - }, - OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - SapFqdn: to.Ptr("xyz.test.com"), - }, - }, - Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), - SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - }, - }, 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.SingleServerConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeSingleServer), - // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - // DbDiskConfiguration: &armworkloadssapvirtualinstance.DiskConfiguration{ - // DiskVolumeConfigurations: map[string]*armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // "backup": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](2), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - // }, - // }, - // "hana/data": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](4), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // "hana/log": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](3), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // "hana/shared": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - // }, - // }, - // "os": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](64), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - // }, - // }, - // "usr/sap": &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // }, - // }, - // NetworkConfiguration: &armworkloadssapvirtualinstance.NetworkConfiguration{ - // IsSecondaryIPEnabled: to.Ptr(true), - // }, - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), - // }, - // }, - // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - // SapFqdn: to.Ptr("xyz.test.com"), - // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatus("Unknown")), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_WithOSConfig_Distributed.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConfigurationForDistributedSystemRecommended() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_CreateInfraOsCustomResourceNamesDS.json +func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOSConfigurationWithCustomResourceNamesForDistributedSystem() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, + Location: to.Ptr("westcentralus"), Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), AppLocation: to.Ptr("eastus"), + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ InstanceCount: to.Ptr[int64](6), SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), @@ -3994,8 +2995,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -4018,8 +3019,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -4029,31 +3030,125 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf VMSize: to.Ptr("Standard_E16ds_v4"), }, }, - DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - InstanceCount: to.Ptr[int64](1), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), + CustomResourceNames: &armworkloadssapvirtualinstance.ThreeTierFullResourceNames{ + ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerFullResourceNames{ + AvailabilitySetName: to.Ptr("appAvSet"), + VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ + { + DataDiskNames: map[string][]*string{ + "default": { + to.Ptr("app0disk0"), + }, }, - }, - }, - VMSize: to.Ptr("Standard_M32ts"), - }, + HostName: to.Ptr("apphostName0"), + NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + { + NetworkInterfaceName: to.Ptr("appnic0"), + }, + }, + OSDiskName: to.Ptr("app0osdisk"), + VMName: to.Ptr("appvm0"), + }, + { + DataDiskNames: map[string][]*string{ + "default": { + to.Ptr("app1disk0"), + }, + }, + HostName: to.Ptr("apphostName1"), + NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + { + NetworkInterfaceName: to.Ptr("appnic1"), + }, + }, + OSDiskName: to.Ptr("app1osdisk"), + VMName: to.Ptr("appvm1"), + }, + }, + }, + CentralServer: &armworkloadssapvirtualinstance.CentralServerFullResourceNames{ + VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ + { + DataDiskNames: map[string][]*string{ + "default": { + to.Ptr("ascsdisk0"), + }, + }, + HostName: to.Ptr("ascshostName"), + NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + { + NetworkInterfaceName: to.Ptr("ascsnic"), + }, + }, + OSDiskName: to.Ptr("ascsosdisk"), + VMName: to.Ptr("ascsvm"), + }, + }, + }, + DatabaseServer: &armworkloadssapvirtualinstance.DatabaseServerFullResourceNames{ + VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ + { + DataDiskNames: map[string][]*string{ + "hanaData": { + to.Ptr("hanadata0"), + to.Ptr("hanadata1"), + }, + "hanaLog": { + to.Ptr("hanalog0"), + to.Ptr("hanalog1"), + to.Ptr("hanalog2"), + }, + "hanaShared": { + to.Ptr("hanashared0"), + to.Ptr("hanashared1"), + }, + "usrSap": { + to.Ptr("usrsap0"), + }, + }, + HostName: to.Ptr("dbhostName"), + NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + { + NetworkInterfaceName: to.Ptr("dbnic"), + }, + }, + OSDiskName: to.Ptr("dbosdisk"), + VMName: to.Ptr("dbvm"), + }, + }, + }, + NamingPatternType: to.Ptr(armworkloadssapvirtualinstance.NamingPatternTypeFullResourceName), + SharedStorage: &armworkloadssapvirtualinstance.SharedStorageResourceNames{ + SharedStorageAccountName: to.Ptr("storageacc"), + SharedStorageAccountPrivateEndPointName: to.Ptr("peForxNFS"), + }, + }, + DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + InstanceCount: to.Ptr[int64](1), + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), + VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + Offer: to.Ptr("RHEL-SAP"), + Publisher: to.Ptr("RedHat"), + SKU: to.Ptr("84sapha-gen2"), + Version: to.Ptr("latest"), + }, + OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + AdminUsername: to.Ptr("{your-username}"), + OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + PrivateKey: to.Ptr("xyz"), + PublicKey: to.Ptr("abc"), + }, + }, + }, + VMSize: to.Ptr("Standard_M32ts"), + }, }, + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), }, OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ SapFqdn: to.Ptr("xyz.test.com"), @@ -4062,6 +3157,7 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), }, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -4073,134 +3169,226 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf // 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](6), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + // AppResourceGroup: to.Ptr("X00-RG"), + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + // InstanceCount: to.Ptr[int64](6), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, + // }, + // }, + // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // }, + // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_E16ds_v4"), // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), + // CustomResourceNames: &armworkloadssapvirtualinstance.ThreeTierFullResourceNames{ + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerFullResourceNames{ + // AvailabilitySetName: to.Ptr("appAvSet"), + // VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ + // { + // DataDiskNames: map[string][]*string{ + // "default": []*string{ + // to.Ptr("app0disk0"), + // }, + // }, + // HostName: to.Ptr("apphostName0"), + // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + // { + // NetworkInterfaceName: to.Ptr("appnic0"), + // }, + // }, + // OSDiskName: to.Ptr("app0osdisk"), + // VMName: to.Ptr("appvm0"), + // }, + // { + // DataDiskNames: map[string][]*string{ + // "default": []*string{ + // to.Ptr("app1disk0"), + // }, + // }, + // HostName: to.Ptr("apphostName1"), + // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + // { + // NetworkInterfaceName: to.Ptr("appnic1"), + // }, + // }, + // OSDiskName: to.Ptr("app1osdisk"), + // VMName: to.Ptr("appvm1"), + // }, + // }, // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // CentralServer: &armworkloadssapvirtualinstance.CentralServerFullResourceNames{ + // VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ + // { + // DataDiskNames: map[string][]*string{ + // "default": []*string{ + // to.Ptr("ascsdisk0"), + // }, + // }, + // HostName: to.Ptr("ascshostName"), + // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + // { + // NetworkInterfaceName: to.Ptr("ascsnic"), + // }, + // }, + // OSDiskName: to.Ptr("ascsosdisk"), + // VMName: to.Ptr("ascsvm"), // }, // }, // }, - // VMSize: to.Ptr("Standard_E16ds_v4"), - // }, - // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseServerFullResourceNames{ + // VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ + // { + // DataDiskNames: map[string][]*string{ + // "hanaData": []*string{ + // to.Ptr("hanadata0"), + // to.Ptr("hanadata1"), + // }, + // "hanaLog": []*string{ + // to.Ptr("hanalog0"), + // to.Ptr("hanalog1"), + // to.Ptr("hanalog2"), + // }, + // "hanaShared": []*string{ + // to.Ptr("hanashared0"), + // to.Ptr("hanashared1"), + // }, + // "usrSap": []*string{ + // to.Ptr("usrsap0"), + // }, + // }, + // HostName: to.Ptr("dbhostName"), + // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + // { + // NetworkInterfaceName: to.Ptr("dbnic"), + // }, + // }, + // OSDiskName: to.Ptr("dbosdisk"), + // VMName: to.Ptr("dbvm"), + // }, + // }, // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // NamingPatternType: to.Ptr(armworkloadssapvirtualinstance.NamingPatternTypeFullResourceName), + // SharedStorage: &armworkloadssapvirtualinstance.SharedStorageResourceNames{ + // SharedStorageAccountName: to.Ptr("storageacc"), + // SharedStorageAccountPrivateEndPointName: to.Ptr("peForxNFS"), + // }, + // }, + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_M32ts"), // }, - // VMSize: to.Ptr("Standard_M32ts"), // }, + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + // }, + // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ + // SapFqdn: to.Ptr("xyz.test.com"), // }, // }, - // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - // SapFqdn: to.Ptr("xyz.test.com"), - // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatus("Unknown")), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_WithOSConfig_HA_AvSet.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConfigurationForHaSystemWithAvailabilitySetRecommended() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_CreateInfraOsCustomResourceNamesHaAvailabilitySet.json +func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOSConfigurationWithCustomResourceNamesForHaSystemWithAvailabilitySet() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, + Location: to.Ptr("westcentralus"), Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), AppLocation: to.Ptr("eastus"), + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ InstanceCount: to.Ptr[int64](6), SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), @@ -4214,8 +3402,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -4238,8 +3426,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -4249,32 +3437,187 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf VMSize: to.Ptr("Standard_E16ds_v4"), }, }, - DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - InstanceCount: to.Ptr[int64](2), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - AdminUsername: to.Ptr("{your-username}"), - OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), + CustomResourceNames: &armworkloadssapvirtualinstance.ThreeTierFullResourceNames{ + ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerFullResourceNames{ + AvailabilitySetName: to.Ptr("appAvSet"), + VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ + { + DataDiskNames: map[string][]*string{ + "default": { + to.Ptr("app0disk0"), + }, + }, + HostName: to.Ptr("apphostName0"), + NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + { + NetworkInterfaceName: to.Ptr("appnic0"), + }, + }, + OSDiskName: to.Ptr("app0osdisk"), + VMName: to.Ptr("appvm0"), + }, + { + DataDiskNames: map[string][]*string{ + "default": { + to.Ptr("app1disk0"), + }, + }, + HostName: to.Ptr("apphostName1"), + NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + { + NetworkInterfaceName: to.Ptr("appnic1"), + }, }, + OSDiskName: to.Ptr("app1osdisk"), + VMName: to.Ptr("appvm1"), }, }, - VMSize: to.Ptr("Standard_M32ts"), }, - }, - HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ + CentralServer: &armworkloadssapvirtualinstance.CentralServerFullResourceNames{ + AvailabilitySetName: to.Ptr("csAvSet"), + LoadBalancer: &armworkloadssapvirtualinstance.LoadBalancerResourceNames{ + BackendPoolNames: []*string{ + to.Ptr("ascsBackendPool"), + }, + FrontendIPConfigurationNames: []*string{ + to.Ptr("ascsip0"), + to.Ptr("ersip0"), + }, + HealthProbeNames: []*string{ + to.Ptr("ascsHealthProbe"), + to.Ptr("ersHealthProbe"), + }, + LoadBalancerName: to.Ptr("ascslb"), + }, + VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ + { + HostName: to.Ptr("ascshostName"), + NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + { + NetworkInterfaceName: to.Ptr("ascsnic"), + }, + }, + OSDiskName: to.Ptr("ascsosdisk"), + VMName: to.Ptr("ascsvm"), + }, + { + HostName: to.Ptr("ershostName"), + NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + { + NetworkInterfaceName: to.Ptr("ersnic"), + }, + }, + OSDiskName: to.Ptr("ersosdisk"), + VMName: to.Ptr("ersvm"), + }, + }, + }, + DatabaseServer: &armworkloadssapvirtualinstance.DatabaseServerFullResourceNames{ + AvailabilitySetName: to.Ptr("dbAvSet"), + LoadBalancer: &armworkloadssapvirtualinstance.LoadBalancerResourceNames{ + BackendPoolNames: []*string{ + to.Ptr("dbBackendPool"), + }, + FrontendIPConfigurationNames: []*string{ + to.Ptr("dbip"), + }, + HealthProbeNames: []*string{ + to.Ptr("dbHealthProbe"), + }, + LoadBalancerName: to.Ptr("dblb"), + }, + VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ + { + DataDiskNames: map[string][]*string{ + "hanaData": { + to.Ptr("hanadatapr0"), + to.Ptr("hanadatapr1"), + }, + "hanaLog": { + to.Ptr("hanalogpr0"), + to.Ptr("hanalogpr1"), + to.Ptr("hanalogpr2"), + }, + "hanaShared": { + to.Ptr("hanasharedpr0"), + to.Ptr("hanasharedpr1"), + }, + "usrSap": { + to.Ptr("usrsappr0"), + }, + }, + HostName: to.Ptr("dbprhostName"), + NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + { + NetworkInterfaceName: to.Ptr("dbprnic"), + }, + }, + OSDiskName: to.Ptr("dbprosdisk"), + VMName: to.Ptr("dbvmpr"), + }, + { + DataDiskNames: map[string][]*string{ + "hanaData": { + to.Ptr("hanadatasr0"), + to.Ptr("hanadatasr1"), + }, + "hanaLog": { + to.Ptr("hanalogsr0"), + to.Ptr("hanalogsr1"), + to.Ptr("hanalogsr2"), + }, + "hanaShared": { + to.Ptr("hanasharedsr0"), + to.Ptr("hanasharedsr1"), + }, + "usrSap": { + to.Ptr("usrsapsr0"), + }, + }, + HostName: to.Ptr("dbsrhostName"), + NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + { + NetworkInterfaceName: to.Ptr("dbsrnic"), + }, + }, + OSDiskName: to.Ptr("dbsrosdisk"), + VMName: to.Ptr("dbvmsr"), + }, + }, + }, + NamingPatternType: to.Ptr(armworkloadssapvirtualinstance.NamingPatternTypeFullResourceName), + SharedStorage: &armworkloadssapvirtualinstance.SharedStorageResourceNames{ + SharedStorageAccountName: to.Ptr("storageacc"), + SharedStorageAccountPrivateEndPointName: to.Ptr("peForxNFS"), + }, + }, + DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + InstanceCount: to.Ptr[int64](2), + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), + VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + Offer: to.Ptr("RHEL-SAP"), + Publisher: to.Ptr("RedHat"), + SKU: to.Ptr("84sapha-gen2"), + Version: to.Ptr("latest"), + }, + OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + AdminUsername: to.Ptr("{your-username}"), + OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + PrivateKey: to.Ptr("xyz"), + PublicKey: to.Ptr("abc"), + }, + }, + }, + VMSize: to.Ptr("Standard_M32ts"), + }, + }, + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilitySet), }, }, @@ -4285,6 +3628,7 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), }, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -4296,137 +3640,290 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf // 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](6), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + // AppResourceGroup: to.Ptr("X00-RG"), + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + // InstanceCount: to.Ptr[int64](6), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, + // }, + // }, + // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // }, + // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ + // InstanceCount: to.Ptr[int64](2), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_E16ds_v4"), // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), + // CustomResourceNames: &armworkloadssapvirtualinstance.ThreeTierFullResourceNames{ + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerFullResourceNames{ + // AvailabilitySetName: to.Ptr("appAvSet"), + // VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ + // { + // DataDiskNames: map[string][]*string{ + // "default": []*string{ + // to.Ptr("app0disk0"), + // }, + // }, + // HostName: to.Ptr("apphostName0"), + // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + // { + // NetworkInterfaceName: to.Ptr("appnic0"), + // }, + // }, + // OSDiskName: to.Ptr("app0osdisk"), + // VMName: to.Ptr("appvm0"), + // }, + // { + // DataDiskNames: map[string][]*string{ + // "default": []*string{ + // to.Ptr("app1disk0"), + // }, + // }, + // HostName: to.Ptr("apphostName1"), + // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + // { + // NetworkInterfaceName: to.Ptr("appnic1"), + // }, + // }, + // OSDiskName: to.Ptr("app1osdisk"), + // VMName: to.Ptr("appvm1"), + // }, + // }, // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // CentralServer: &armworkloadssapvirtualinstance.CentralServerFullResourceNames{ + // AvailabilitySetName: to.Ptr("csAvSet"), + // LoadBalancer: &armworkloadssapvirtualinstance.LoadBalancerResourceNames{ + // BackendPoolNames: []*string{ + // to.Ptr("ascsBackendPool"), + // }, + // FrontendIPConfigurationNames: []*string{ + // to.Ptr("ascsip0"), + // to.Ptr("ersip0"), + // }, + // HealthProbeNames: []*string{ + // to.Ptr("ascsHealthProbe"), + // to.Ptr("ersHealthProbe"), + // }, + // LoadBalancerName: to.Ptr("ascslb"), + // }, + // VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ + // { + // HostName: to.Ptr("ascshostName"), + // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + // { + // NetworkInterfaceName: to.Ptr("ascsnic"), + // }, + // }, + // OSDiskName: to.Ptr("ascsosdisk"), + // VMName: to.Ptr("ascsvm"), + // }, + // { + // HostName: to.Ptr("ershostName"), + // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + // { + // NetworkInterfaceName: to.Ptr("ersnic"), + // }, + // }, + // OSDiskName: to.Ptr("ersosdisk"), + // VMName: to.Ptr("ersvm"), // }, // }, // }, - // VMSize: to.Ptr("Standard_E16ds_v4"), - // }, - // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseServerFullResourceNames{ + // AvailabilitySetName: to.Ptr("dbAvSet"), + // LoadBalancer: &armworkloadssapvirtualinstance.LoadBalancerResourceNames{ + // BackendPoolNames: []*string{ + // to.Ptr("dbBackendPool"), + // }, + // FrontendIPConfigurationNames: []*string{ + // to.Ptr("dbip"), + // }, + // HealthProbeNames: []*string{ + // to.Ptr("dbHealthProbe"), + // }, + // LoadBalancerName: to.Ptr("dblb"), + // }, + // VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ + // { + // DataDiskNames: map[string][]*string{ + // "hanaData": []*string{ + // to.Ptr("hanadatapr0"), + // to.Ptr("hanadatapr1"), + // }, + // "hanaLog": []*string{ + // to.Ptr("hanalogpr0"), + // to.Ptr("hanalogpr1"), + // to.Ptr("hanalogpr2"), + // }, + // "hanaShared": []*string{ + // to.Ptr("hanasharedpr0"), + // to.Ptr("hanasharedpr1"), + // }, + // "usrSap": []*string{ + // to.Ptr("usrsappr0"), + // }, + // }, + // HostName: to.Ptr("dbprhostName"), + // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + // { + // NetworkInterfaceName: to.Ptr("dbprnic"), + // }, + // }, + // OSDiskName: to.Ptr("dbprosdisk"), + // VMName: to.Ptr("dbvmpr"), + // }, + // { + // DataDiskNames: map[string][]*string{ + // "hanaData": []*string{ + // to.Ptr("hanadatasr0"), + // to.Ptr("hanadatasr1"), + // }, + // "hanaLog": []*string{ + // to.Ptr("hanalogsr0"), + // to.Ptr("hanalogsr1"), + // to.Ptr("hanalogsr2"), + // }, + // "hanaShared": []*string{ + // to.Ptr("hanasharedsr0"), + // to.Ptr("hanasharedsr1"), + // }, + // "usrSap": []*string{ + // to.Ptr("usrsapsr0"), + // }, + // }, + // HostName: to.Ptr("dbsrhostName"), + // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + // { + // NetworkInterfaceName: to.Ptr("dbsrnic"), + // }, + // }, + // OSDiskName: to.Ptr("dbsrosdisk"), + // VMName: to.Ptr("dbvmsr"), + // }, + // }, // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // NamingPatternType: to.Ptr(armworkloadssapvirtualinstance.NamingPatternTypeFullResourceName), + // SharedStorage: &armworkloadssapvirtualinstance.SharedStorageResourceNames{ + // SharedStorageAccountName: to.Ptr("storageacc"), + // SharedStorageAccountPrivateEndPointName: to.Ptr("peForxNFS"), + // }, + // }, + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + // InstanceCount: to.Ptr[int64](2), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_M32ts"), // }, - // VMSize: to.Ptr("Standard_M32ts"), + // }, + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + // HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ + // HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilitySet), // }, // }, - // HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ - // HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilitySet), + // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ + // SapFqdn: to.Ptr("xyz.test.com"), // }, // }, - // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - // SapFqdn: to.Ptr("xyz.test.com"), - // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatus("Unknown")), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_WithOSConfig_HA_AvZone.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConfigurationForHaSystemWithAvailabilityZoneRecommended() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_CreateInfraOsCustomResourceNamesHaAvailabilityZone.json +func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOSConfigurationWithCustomResourceNamesForHaSystemWithAvailabilityZone() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, + Location: to.Ptr("westcentralus"), Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), AppLocation: to.Ptr("eastus"), + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ InstanceCount: to.Ptr[int64](6), SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), @@ -4440,8 +3937,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -4464,8 +3961,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -4475,6 +3972,157 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf VMSize: to.Ptr("Standard_E16ds_v4"), }, }, + CustomResourceNames: &armworkloadssapvirtualinstance.ThreeTierFullResourceNames{ + ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerFullResourceNames{ + VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ + { + DataDiskNames: map[string][]*string{ + "default": { + to.Ptr("app0disk0"), + }, + }, + HostName: to.Ptr("apphostName0"), + NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + { + NetworkInterfaceName: to.Ptr("appnic0"), + }, + }, + OSDiskName: to.Ptr("app0osdisk"), + VMName: to.Ptr("appvm0"), + }, + { + DataDiskNames: map[string][]*string{ + "default": { + to.Ptr("app1disk0"), + }, + }, + HostName: to.Ptr("apphostName1"), + NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + { + NetworkInterfaceName: to.Ptr("appnic1"), + }, + }, + OSDiskName: to.Ptr("app1osdisk"), + VMName: to.Ptr("appvm1"), + }, + }, + }, + CentralServer: &armworkloadssapvirtualinstance.CentralServerFullResourceNames{ + LoadBalancer: &armworkloadssapvirtualinstance.LoadBalancerResourceNames{ + BackendPoolNames: []*string{ + to.Ptr("ascsBackendPool"), + }, + FrontendIPConfigurationNames: []*string{ + to.Ptr("ascsip0"), + to.Ptr("ersip0"), + }, + HealthProbeNames: []*string{ + to.Ptr("ascsHealthProbe"), + to.Ptr("ersHealthProbe"), + }, + LoadBalancerName: to.Ptr("ascslb"), + }, + VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ + { + HostName: to.Ptr("ascshostName"), + NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + { + NetworkInterfaceName: to.Ptr("ascsnic"), + }, + }, + OSDiskName: to.Ptr("ascsosdisk"), + VMName: to.Ptr("ascsvm"), + }, + { + HostName: to.Ptr("ershostName"), + NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + { + NetworkInterfaceName: to.Ptr("ersnic"), + }, + }, + OSDiskName: to.Ptr("ersosdisk"), + VMName: to.Ptr("ersvm"), + }, + }, + }, + DatabaseServer: &armworkloadssapvirtualinstance.DatabaseServerFullResourceNames{ + LoadBalancer: &armworkloadssapvirtualinstance.LoadBalancerResourceNames{ + BackendPoolNames: []*string{ + to.Ptr("dbBackendPool"), + }, + FrontendIPConfigurationNames: []*string{ + to.Ptr("dbip"), + }, + HealthProbeNames: []*string{ + to.Ptr("dbHealthProbe"), + }, + LoadBalancerName: to.Ptr("dblb"), + }, + VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ + { + DataDiskNames: map[string][]*string{ + "hanaData": { + to.Ptr("hanadatapr0"), + to.Ptr("hanadatapr1"), + }, + "hanaLog": { + to.Ptr("hanalogpr0"), + to.Ptr("hanalogpr1"), + to.Ptr("hanalogpr2"), + }, + "hanaShared": { + to.Ptr("hanasharedpr0"), + to.Ptr("hanasharedpr1"), + }, + "usrSap": { + to.Ptr("usrsappr0"), + }, + }, + HostName: to.Ptr("dbprhostName"), + NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + { + NetworkInterfaceName: to.Ptr("dbprnic"), + }, + }, + OSDiskName: to.Ptr("dbprosdisk"), + VMName: to.Ptr("dbvmpr"), + }, + { + DataDiskNames: map[string][]*string{ + "hanaData": { + to.Ptr("hanadatasr0"), + to.Ptr("hanadatasr1"), + }, + "hanaLog": { + to.Ptr("hanalogsr0"), + to.Ptr("hanalogsr1"), + to.Ptr("hanalogsr2"), + }, + "hanaShared": { + to.Ptr("hanasharedsr0"), + to.Ptr("hanasharedsr1"), + }, + "usrSap": { + to.Ptr("usrsapsr0"), + }, + }, + HostName: to.Ptr("dbsrhostName"), + NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + { + NetworkInterfaceName: to.Ptr("dbsrnic"), + }, + }, + OSDiskName: to.Ptr("dbsrosdisk"), + VMName: to.Ptr("dbvmsr"), + }, + }, + }, + NamingPatternType: to.Ptr(armworkloadssapvirtualinstance.NamingPatternTypeFullResourceName), + SharedStorage: &armworkloadssapvirtualinstance.SharedStorageResourceNames{ + SharedStorageAccountName: to.Ptr("storageacc"), + SharedStorageAccountPrivateEndPointName: to.Ptr("peForxNFS"), + }, + }, DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), InstanceCount: to.Ptr[int64](2), @@ -4489,8 +4137,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -4500,6 +4148,7 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf VMSize: to.Ptr("Standard_M32ts"), }, }, + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilityZone), }, @@ -4511,6 +4160,7 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), }, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -4522,138 +4172,289 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf // 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](6), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + // AppResourceGroup: to.Ptr("X00-RG"), + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + // InstanceCount: to.Ptr[int64](6), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, + // }, + // }, + // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // }, + // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ + // InstanceCount: to.Ptr[int64](2), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_E16ds_v4"), // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), + // CustomResourceNames: &armworkloadssapvirtualinstance.ThreeTierFullResourceNames{ + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerFullResourceNames{ + // VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ + // { + // DataDiskNames: map[string][]*string{ + // "default": []*string{ + // to.Ptr("app0disk0"), + // }, + // }, + // HostName: to.Ptr("apphostName0"), + // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + // { + // NetworkInterfaceName: to.Ptr("appnic0"), + // }, + // }, + // OSDiskName: to.Ptr("app0osdisk"), + // VMName: to.Ptr("appvm0"), + // }, + // { + // DataDiskNames: map[string][]*string{ + // "default": []*string{ + // to.Ptr("app1disk0"), + // }, + // }, + // HostName: to.Ptr("apphostName1"), + // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + // { + // NetworkInterfaceName: to.Ptr("appnic1"), + // }, + // }, + // OSDiskName: to.Ptr("app1osdisk"), + // VMName: to.Ptr("appvm1"), + // }, + // }, // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // CentralServer: &armworkloadssapvirtualinstance.CentralServerFullResourceNames{ + // LoadBalancer: &armworkloadssapvirtualinstance.LoadBalancerResourceNames{ + // BackendPoolNames: []*string{ + // to.Ptr("ascsBackendPool"), + // }, + // FrontendIPConfigurationNames: []*string{ + // to.Ptr("ascsip0"), + // to.Ptr("ersip0"), + // }, + // HealthProbeNames: []*string{ + // to.Ptr("ascsHealthProbe"), + // to.Ptr("ersHealthProbe"), + // }, + // LoadBalancerName: to.Ptr("ascslb"), + // }, + // VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ + // { + // HostName: to.Ptr("ascshostName"), + // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + // { + // NetworkInterfaceName: to.Ptr("ascsnic"), + // }, + // }, + // OSDiskName: to.Ptr("ascsosdisk"), + // VMName: to.Ptr("ascsvm"), + // }, + // { + // HostName: to.Ptr("ershostName"), + // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + // { + // NetworkInterfaceName: to.Ptr("ersnic"), + // }, + // }, + // OSDiskName: to.Ptr("ersosdisk"), + // VMName: to.Ptr("ersvm"), // }, // }, // }, - // VMSize: to.Ptr("Standard_E16ds_v4"), - // }, - // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseServerFullResourceNames{ + // LoadBalancer: &armworkloadssapvirtualinstance.LoadBalancerResourceNames{ + // BackendPoolNames: []*string{ + // to.Ptr("dbBackendPool"), + // }, + // FrontendIPConfigurationNames: []*string{ + // to.Ptr("dbip"), + // }, + // HealthProbeNames: []*string{ + // to.Ptr("dbHealthProbe"), + // }, + // LoadBalancerName: to.Ptr("dblb"), + // }, + // VirtualMachines: []*armworkloadssapvirtualinstance.VirtualMachineResourceNames{ + // { + // DataDiskNames: map[string][]*string{ + // "hanaData": []*string{ + // to.Ptr("hanadatapr0"), + // to.Ptr("hanadatapr1"), + // }, + // "hanaLog": []*string{ + // to.Ptr("hanalogpr0"), + // to.Ptr("hanalogpr1"), + // to.Ptr("hanalogpr2"), + // }, + // "hanaShared": []*string{ + // to.Ptr("hanasharedpr0"), + // to.Ptr("hanasharedpr1"), + // }, + // "usrSap": []*string{ + // to.Ptr("usrsappr0"), + // }, + // }, + // HostName: to.Ptr("dbprhostName"), + // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + // { + // NetworkInterfaceName: to.Ptr("dbprnic"), + // }, + // }, + // OSDiskName: to.Ptr("dbprosdisk"), + // VMName: to.Ptr("dbvmpr"), + // }, + // { + // DataDiskNames: map[string][]*string{ + // "hanaData": []*string{ + // to.Ptr("hanadatasr0"), + // to.Ptr("hanadatasr1"), + // }, + // "hanaLog": []*string{ + // to.Ptr("hanalogsr0"), + // to.Ptr("hanalogsr1"), + // to.Ptr("hanalogsr2"), + // }, + // "hanaShared": []*string{ + // to.Ptr("hanasharedsr0"), + // to.Ptr("hanasharedsr1"), + // }, + // "usrSap": []*string{ + // to.Ptr("usrsapsr0"), + // }, + // }, + // HostName: to.Ptr("dbsrhostName"), + // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + // { + // NetworkInterfaceName: to.Ptr("dbsrnic"), + // }, + // }, + // OSDiskName: to.Ptr("dbsrosdisk"), + // VMName: to.Ptr("dbvmsr"), + // }, + // }, // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // NamingPatternType: to.Ptr(armworkloadssapvirtualinstance.NamingPatternTypeFullResourceName), + // SharedStorage: &armworkloadssapvirtualinstance.SharedStorageResourceNames{ + // SharedStorageAccountName: to.Ptr("storageacc"), + // SharedStorageAccountPrivateEndPointName: to.Ptr("peForxNFS"), + // }, + // }, + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + // InstanceCount: to.Ptr[int64](2), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_M32ts"), // }, - // VMSize: to.Ptr("Standard_M32ts"), + // }, + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + // HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ + // HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilityZone), // }, // }, - // HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ - // HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilityZone), + // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ + // SapFqdn: to.Ptr("xyz.test.com"), // }, // }, - // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - // SapFqdn: to.Ptr("xyz.test.com"), - // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatus("Unknown")), - // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // }, + // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_WithOSConfig_SingleServer.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConfigurationForSingleServerSystemRecommended() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_CreateInfraOsCustomResourceNamesSingleServer.json +func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOSConfigurationWithCustomResourceNamesForSingleServerSystem() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, + Location: to.Ptr("westcentralus"), Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), AppLocation: to.Ptr("eastus"), + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), InfrastructureConfiguration: &armworkloadssapvirtualinstance.SingleServerConfiguration{ AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeSingleServer), DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeSingleServer), NetworkConfiguration: &armworkloadssapvirtualinstance.NetworkConfiguration{ IsSecondaryIPEnabled: to.Ptr(true), }, @@ -4668,8 +4469,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -4686,6 +4487,7 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), }, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -4697,88 +4499,118 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConf // 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.SingleServerConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeSingleServer), - // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - // NetworkConfiguration: &armworkloadssapvirtualinstance.NetworkConfiguration{ - // IsSecondaryIPEnabled: to.Ptr(true), - // }, - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.SingleServerConfiguration{ + // AppResourceGroup: to.Ptr("X00-RG"), + // CustomResourceNames: &armworkloadssapvirtualinstance.SingleServerFullResourceNames{ + // NamingPatternType: to.Ptr(armworkloadssapvirtualinstance.NamingPatternTypeFullResourceName), + // VirtualMachine: &armworkloadssapvirtualinstance.VirtualMachineResourceNames{ + // DataDiskNames: map[string][]*string{ + // "hanaData": []*string{ + // to.Ptr("hanadata0"), + // to.Ptr("hanadata1"), + // }, + // "hanaLog": []*string{ + // to.Ptr("hanalog0"), + // to.Ptr("hanalog1"), + // to.Ptr("hanalog2"), + // }, + // "hanaShared": []*string{ + // to.Ptr("hanashared0"), + // to.Ptr("hanashared1"), + // }, + // "usrSap": []*string{ + // to.Ptr("usrsap0"), + // }, + // }, + // HostName: to.Ptr("sshostName"), + // NetworkInterfaces: []*armworkloadssapvirtualinstance.NetworkInterfaceResourceNames{ + // { + // NetworkInterfaceName: to.Ptr("ssnic"), + // }, + // }, + // OSDiskName: to.Ptr("ssosdisk"), + // VMName: to.Ptr("ssvm"), + // }, // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeSingleServer), + // NetworkConfiguration: &armworkloadssapvirtualinstance.NetworkConfiguration{ + // IsSecondaryIPEnabled: to.Ptr(true), + // }, + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), + // }, + // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ + // SapFqdn: to.Ptr("xyz.test.com"), // }, // }, - // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - // SapFqdn: to.Ptr("xyz.test.com"), - // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatus("Unknown")), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_Distributed_CreateTransport.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithANewSapTransportDirectoryFileshare() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_CreateInfraOsDSRecommended.json +func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOSConfigurationForDistributedSystemRecommended() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, + Location: to.Ptr("westcentralus"), Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), AppLocation: to.Ptr("eastus"), + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ InstanceCount: to.Ptr[int64](6), SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), @@ -4792,8 +4624,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithANewSa OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -4816,8 +4648,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithANewSa OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -4841,8 +4673,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithANewSa OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -4852,13 +4684,7 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithANewSa VMSize: to.Ptr("Standard_M32ts"), }, }, - StorageConfiguration: &armworkloadssapvirtualinstance.StorageConfiguration{ - TransportFileShareConfiguration: &armworkloadssapvirtualinstance.CreateAndMountFileShareConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.ConfigurationTypeCreateAndMount), - ResourceGroup: to.Ptr("rgName"), - StorageAccountName: to.Ptr("storageName"), - }, - }, + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), }, OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ SapFqdn: to.Ptr("xyz.test.com"), @@ -4867,6 +4693,7 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithANewSa Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), }, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -4878,141 +4705,133 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithANewSa // 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](6), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + // AppResourceGroup: to.Ptr("X00-RG"), + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + // InstanceCount: to.Ptr[int64](6), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_E16ds_v4"), // }, - // VMSize: to.Ptr("Standard_E16ds_v4"), // }, - // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_M32ts"), // }, - // VMSize: to.Ptr("Standard_M32ts"), // }, + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), // }, - // StorageConfiguration: &armworkloadssapvirtualinstance.StorageConfiguration{ - // TransportFileShareConfiguration: &armworkloadssapvirtualinstance.CreateAndMountFileShareConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.ConfigurationTypeCreateAndMount), - // ResourceGroup: to.Ptr("rgName"), - // StorageAccountName: to.Ptr("storageName"), - // }, + // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ + // SapFqdn: to.Ptr("xyz.test.com"), // }, // }, - // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - // SapFqdn: to.Ptr("xyz.test.com"), - // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatus("Unknown")), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_Distributed_MountTransport.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithAnExistingSapTransportDirectoryFileshare() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_CreateInfraOsHaAvailabilitySetRecommended.json +func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOSConfigurationForHaSystemWithAvailabilitySetRecommended() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, + Location: to.Ptr("westcentralus"), Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), AppLocation: to.Ptr("eastus"), + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ InstanceCount: to.Ptr[int64](6), SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), @@ -5026,8 +4845,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithAnExis OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -5038,7 +4857,7 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithAnExis }, }, CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - InstanceCount: to.Ptr[int64](1), + InstanceCount: to.Ptr[int64](2), SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ @@ -5050,8 +4869,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithAnExis OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -5063,7 +4882,7 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithAnExis }, DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - InstanceCount: to.Ptr[int64](1), + InstanceCount: to.Ptr[int64](2), SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ @@ -5075,8 +4894,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithAnExis OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -5086,12 +4905,9 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithAnExis VMSize: to.Ptr("Standard_M32ts"), }, }, - StorageConfiguration: &armworkloadssapvirtualinstance.StorageConfiguration{ - TransportFileShareConfiguration: &armworkloadssapvirtualinstance.MountFileShareConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.ConfigurationTypeMount), - ID: to.Ptr("/subscriptions/49d64d54-e888-4c46-a868-1936802b762c/resourceGroups/testrg/providers/Microsoft.Network/privateEndpoints/endpoint"), - PrivateEndpointID: to.Ptr("/subscriptions/49d64d54-e888-4c46-a868-1936802b762c/resourceGroups/testrg/providers/Microsoft.Network/privateEndpoints/endpoint"), - }, + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ + HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilitySet), }, }, OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ @@ -5101,6 +4917,7 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithAnExis Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), }, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -5112,141 +4929,136 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithAnExis // 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](6), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + // AppResourceGroup: to.Ptr("X00-RG"), + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + // InstanceCount: to.Ptr[int64](6), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ + // InstanceCount: to.Ptr[int64](2), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_E16ds_v4"), // }, - // VMSize: to.Ptr("Standard_E16ds_v4"), // }, - // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + // InstanceCount: to.Ptr[int64](2), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_M32ts"), // }, - // VMSize: to.Ptr("Standard_M32ts"), // }, - // }, - // StorageConfiguration: &armworkloadssapvirtualinstance.StorageConfiguration{ - // TransportFileShareConfiguration: &armworkloadssapvirtualinstance.MountFileShareConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.ConfigurationTypeMount), - // ID: to.Ptr("/subscriptions/49d64d54-e888-4c46-a868-1936802b762c/resourceGroups/testrg/providers/Microsoft.Network/privateEndpoints/endpoint"), - // PrivateEndpointID: to.Ptr("/subscriptions/49d64d54-e888-4c46-a868-1936802b762c/resourceGroups/testrg/providers/Microsoft.Network/privateEndpoints/endpoint"), + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + // HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ + // HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilitySet), // }, // }, + // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ + // SapFqdn: to.Ptr("xyz.test.com"), + // }, // }, - // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - // SapFqdn: to.Ptr("xyz.test.com"), - // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatus("Unknown")), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_Distributed_SkipTransport.json -func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithoutASapTransportDirectoryFileshare() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_CreateInfraOsHaAvailabilityZoneRecommended.json +func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOSConfigurationForHaSystemWithAvailabilityZoneRecommended() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, + Location: to.Ptr("westcentralus"), Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), AppLocation: to.Ptr("eastus"), + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ InstanceCount: to.Ptr[int64](6), SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), @@ -5260,8 +5072,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithoutASa OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -5272,7 +5084,7 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithoutASa }, }, CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - InstanceCount: to.Ptr[int64](1), + InstanceCount: to.Ptr[int64](2), SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ @@ -5284,8 +5096,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithoutASa OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -5297,7 +5109,7 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithoutASa }, DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - InstanceCount: to.Ptr[int64](1), + InstanceCount: to.Ptr[int64](2), SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ @@ -5309,8 +5121,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithoutASa OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -5320,10 +5132,9 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithoutASa VMSize: to.Ptr("Standard_M32ts"), }, }, - StorageConfiguration: &armworkloadssapvirtualinstance.StorageConfiguration{ - TransportFileShareConfiguration: &armworkloadssapvirtualinstance.SkipFileShareConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.ConfigurationTypeSkip), - }, + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ + HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilityZone), }, }, OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ @@ -5333,6 +5144,7 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithoutASa Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), }, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -5344,228 +5156,171 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithoutASa // 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](6), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + // AppResourceGroup: to.Ptr("X00-RG"), + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + // InstanceCount: to.Ptr[int64](6), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, + // }, + // }, + // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // }, + // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ + // InstanceCount: to.Ptr[int64](2), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_E16ds_v4"), // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), + // }, + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + // InstanceCount: to.Ptr[int64](2), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, + // }, + // }, + // VMSize: to.Ptr("Standard_M32ts"), + // }, + // }, + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + // HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ + // HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilityZone), // }, // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_E16ds_v4"), - // }, - // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_M32ts"), - // }, - // }, - // StorageConfiguration: &armworkloadssapvirtualinstance.StorageConfiguration{ - // TransportFileShareConfiguration: &armworkloadssapvirtualinstance.SkipFileShareConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.ConfigurationTypeSkip), - // }, + // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ + // SapFqdn: to.Ptr("xyz.test.com"), // }, // }, - // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - // SapFqdn: to.Ptr("xyz.test.com"), - // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatus("Unknown")), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_DetectInstallation_Distributed.json -func ExampleSAPVirtualInstancesClient_BeginCreate_detectSapSoftwareInstallationOnADistributedSystem() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_CreateInfraOsSIngleServerRecommended.json +func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOSConfigurationForSingleServerSystemRecommended() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ - Location: to.Ptr("eastus2"), - Tags: map[string]*string{ - "created by": to.Ptr("azureuser"), - }, + Location: to.Ptr("westcentralus"), Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), AppLocation: to.Ptr("eastus"), - InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - AppResourceGroup: to.Ptr("{{resourcegrp}}"), - DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - InstanceCount: to.Ptr[int64](2), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), - VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP-HA"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - AdminUsername: to.Ptr("azureuser"), - OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - PrivateKey: to.Ptr("{{privateKey}}"), - PublicKey: to.Ptr("{{sshkey}}"), - }, - }, - }, - VMSize: to.Ptr("Standard_E4ds_v4"), - }, + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + InfrastructureConfiguration: &armworkloadssapvirtualinstance.SingleServerConfiguration{ + AppResourceGroup: to.Ptr("X00-RG"), + DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeSingleServer), + NetworkConfiguration: &armworkloadssapvirtualinstance.NetworkConfiguration{ + IsSecondaryIPEnabled: to.Ptr(true), }, - CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - InstanceCount: to.Ptr[int64](1), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), - VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP-HA"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - AdminUsername: to.Ptr("azureuser"), - OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - PrivateKey: to.Ptr("{{privateKey}}"), - PublicKey: to.Ptr("{{sshkey}}"), - }, - }, - }, - VMSize: to.Ptr("Standard_E4ds_v4"), + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + Offer: to.Ptr("RHEL-SAP"), + Publisher: to.Ptr("RedHat"), + SKU: to.Ptr("84sapha-gen2"), + Version: to.Ptr("latest"), }, - }, - DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - InstanceCount: to.Ptr[int64](1), - SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), - VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP-HA"), - Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("84sapha-gen2"), - Version: to.Ptr("latest"), - }, - OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - AdminUsername: to.Ptr("azureuser"), - OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - PrivateKey: to.Ptr("{{privateKey}}"), - PublicKey: to.Ptr("{{sshkey}}"), - }, + OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + AdminUsername: to.Ptr("{your-username}"), + OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + PrivateKey: to.Ptr("xyz"), + PublicKey: to.Ptr("abc"), }, }, - VMSize: to.Ptr("Standard_M32ts"), }, - }, - NetworkConfiguration: &armworkloadssapvirtualinstance.NetworkConfiguration{ - IsSecondaryIPEnabled: to.Ptr(true), + VMSize: to.Ptr("Standard_E32ds_v4"), }, }, OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - SapFqdn: to.Ptr("sap.bpaas.com"), - }, - SoftwareConfiguration: &armworkloadssapvirtualinstance.ExternalInstallationSoftwareConfiguration{ - SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeExternal), - CentralServerVMID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"), + SapFqdn: to.Ptr("xyz.test.com"), }, }, - Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), }, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -5577,147 +5332,96 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_detectSapSoftwareInstallationO // 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("microsoft.workloads/sapvirtualinstances"), - // ID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-08-18T18:25:55.240Z"); return t}()), - // CreatedBy: to.Ptr("f1bc9460-9d57-4c16-99a8-5a19378a3a93"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-08-18T18:50:59.194Z"); return t}()), - // LastModifiedBy: to.Ptr("f1bc9460-9d57-4c16-99a8-5a19378a3a93"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeApplication), - // }, - // Location: to.Ptr("eastus2"), - // Tags: map[string]*string{ - // "created by": to.Ptr("azureuser"), - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("aa-rg"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP-HA"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("azureuser"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("ssh-rsa AAA generated-by-azure"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_E4ds_v4"), + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.SingleServerConfiguration{ + // AppResourceGroup: to.Ptr("X00-RG"), + // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeSingleServer), + // NetworkConfiguration: &armworkloadssapvirtualinstance.NetworkConfiguration{ + // IsSecondaryIPEnabled: to.Ptr(true), // }, - // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP-HA"), + // Offer: to.Ptr("RHEL-SAP"), // Publisher: to.Ptr("RedHat"), // SKU: to.Ptr("84sapha-gen2"), // Version: to.Ptr("latest"), // }, // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("azureuser"), + // AdminUsername: to.Ptr("{your-username}"), // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("ssh-rsa AAA generated-by-azure"), - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_E4ds_v4"), - // }, - // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP-HA"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("azureuser"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("ssh-rsa AAA generated-by-azure"), + // PublicKey: to.Ptr("abc"), // }, // }, // }, - // VMSize: to.Ptr("Standard_M32ts"), + // VMSize: to.Ptr("Standard_E32ds_v4"), // }, // }, - // NetworkConfiguration: &armworkloadssapvirtualinstance.NetworkConfiguration{ - // IsSecondaryIPEnabled: to.Ptr(true), + // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ + // SapFqdn: to.Ptr("xyz.test.com"), // }, // }, - // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - // SapFqdn: to.Ptr("sap.bpaas.com"), - // }, - // SoftwareConfiguration: &armworkloadssapvirtualinstance.ExternalInstallationSoftwareConfiguration{ - // SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeExternal), - // CentralServerVMID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"), - // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateRegistrationComplete), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_DetectInstallation_SingleServer.json -func ExampleSAPVirtualInstancesClient_BeginCreate_detectSapSoftwareInstallationOnASingleServerSystem() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_CreateInfraSingleServer.json +func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureOnlyForSingleServerSystem() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, + Location: to.Ptr("westcentralus"), Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ AppLocation: to.Ptr("eastus"), + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), InfrastructureConfiguration: &armworkloadssapvirtualinstance.SingleServerConfiguration{ AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeSingleServer), DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeSingleServer), NetworkConfiguration: &armworkloadssapvirtualinstance.NetworkConfiguration{ IsSecondaryIPEnabled: to.Ptr(true), }, SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP-HA"), + Offer: to.Ptr("RHEL-SAP"), Publisher: to.Ptr("RedHat"), SKU: to.Ptr("84sapha-gen2"), Version: to.Ptr("latest"), @@ -5725,28 +5429,25 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_detectSapSoftwareInstallationO OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - PrivateKey: to.Ptr("xyz"), - PublicKey: to.Ptr("abc"), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + { + KeyData: to.Ptr("ssh-rsa public key"), + }, + }, }, }, }, VMSize: to.Ptr("Standard_E32ds_v4"), }, }, - OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - SapFqdn: to.Ptr("xyz.test.com"), - }, - SoftwareConfiguration: &armworkloadssapvirtualinstance.ExternalInstallationSoftwareConfiguration{ - SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeExternal), - CentralServerVMID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"), - }, }, Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), }, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -5758,96 +5459,91 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_detectSapSoftwareInstallationO // 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.SingleServerConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeSingleServer), - // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - // NetworkConfiguration: &armworkloadssapvirtualinstance.NetworkConfiguration{ - // IsSecondaryIPEnabled: to.Ptr(true), - // }, - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP-HA"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.SingleServerConfiguration{ + // AppResourceGroup: to.Ptr("X00-RG"), + // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeSingleServer), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + // { + // KeyData: to.Ptr("ssh-rsa public key"), + // }, + // }, + // }, // }, // }, + // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), // }, // }, - // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - // SapFqdn: to.Ptr("xyz.test.com"), - // }, - // SoftwareConfiguration: &armworkloadssapvirtualinstance.ExternalInstallationSoftwareConfiguration{ - // SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeExternal), - // CentralServerVMID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"), - // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateRegistrationComplete), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_DetectInstallation_HA_AvSet.json -func ExampleSAPVirtualInstancesClient_BeginCreate_detectSapSoftwareInstallationOnAnHaSystemWithAvailabilitySet() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_CreateInfraWithExistingFileshare.json +func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithAnExistingSapTransportDirectoryFileshare() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, + Location: to.Ptr("westcentralus"), Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), AppLocation: to.Ptr("eastus"), + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ InstanceCount: to.Ptr[int64](6), SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP-HA"), + Offer: to.Ptr("RHEL-SAP"), Publisher: to.Ptr("RedHat"), SKU: to.Ptr("84sapha-gen2"), Version: to.Ptr("latest"), @@ -5855,8 +5551,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_detectSapSoftwareInstallationO OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -5867,11 +5563,11 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_detectSapSoftwareInstallationO }, }, CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - InstanceCount: to.Ptr[int64](2), + InstanceCount: to.Ptr[int64](1), SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP-HA"), + Offer: to.Ptr("RHEL-SAP"), Publisher: to.Ptr("RedHat"), SKU: to.Ptr("84sapha-gen2"), Version: to.Ptr("latest"), @@ -5879,8 +5575,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_detectSapSoftwareInstallationO OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -5892,11 +5588,11 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_detectSapSoftwareInstallationO }, DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - InstanceCount: to.Ptr[int64](2), + InstanceCount: to.Ptr[int64](1), SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP-HA"), + Offer: to.Ptr("RHEL-SAP"), Publisher: to.Ptr("RedHat"), SKU: to.Ptr("84sapha-gen2"), Version: to.Ptr("latest"), @@ -5904,8 +5600,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_detectSapSoftwareInstallationO OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -5915,21 +5611,23 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_detectSapSoftwareInstallationO VMSize: to.Ptr("Standard_M32ts"), }, }, - HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ - HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilitySet), + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + StorageConfiguration: &armworkloadssapvirtualinstance.StorageConfiguration{ + TransportFileShareConfiguration: &armworkloadssapvirtualinstance.MountFileShareConfiguration{ + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.FileShareConfigurationTypeMount), + ID: to.Ptr("/subscriptions/49d64d54-e888-4c46-a868-1936802b762c/resourceGroups/testrg/providers/Microsoft.Network/privateEndpoints/endpoint"), + PrivateEndpointID: to.Ptr("/subscriptions/49d64d54-e888-4c46-a868-1936802b762c/resourceGroups/testrg/providers/Microsoft.Network/privateEndpoints/endpoint"), + }, }, }, OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ SapFqdn: to.Ptr("xyz.test.com"), }, - SoftwareConfiguration: &armworkloadssapvirtualinstance.ExternalInstallationSoftwareConfiguration{ - SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeExternal), - CentralServerVMID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"), - }, }, Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), }, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -5941,145 +5639,146 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_detectSapSoftwareInstallationO // 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](6), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP-HA"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + // AppResourceGroup: to.Ptr("X00-RG"), + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + // InstanceCount: to.Ptr[int64](6), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP-HA"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_E16ds_v4"), // }, - // VMSize: to.Ptr("Standard_E16ds_v4"), // }, - // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP-HA"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_M32ts"), + // }, + // }, + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + // StorageConfiguration: &armworkloadssapvirtualinstance.StorageConfiguration{ + // TransportFileShareConfiguration: &armworkloadssapvirtualinstance.MountFileShareConfiguration{ + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.FileShareConfigurationTypeMount), + // ID: to.Ptr("/subscriptions/49d64d54-e888-4c46-a868-1936802b762c/resourceGroups/testrg/providers/Microsoft.Network/privateEndpoints/endpoint"), + // PrivateEndpointID: to.Ptr("/subscriptions/49d64d54-e888-4c46-a868-1936802b762c/resourceGroups/testrg/providers/Microsoft.Network/privateEndpoints/endpoint"), // }, - // VMSize: to.Ptr("Standard_M32ts"), // }, // }, - // HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ - // HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilitySet), + // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ + // SapFqdn: to.Ptr("xyz.test.com"), // }, // }, - // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - // SapFqdn: to.Ptr("xyz.test.com"), - // }, - // SoftwareConfiguration: &armworkloadssapvirtualinstance.ExternalInstallationSoftwareConfiguration{ - // SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeExternal), - // CentralServerVMID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"), - // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateRegistrationComplete), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_DetectInstallation_HA_AvZone.json -func ExampleSAPVirtualInstancesClient_BeginCreate_detectSapSoftwareInstallationOnAnHaSystemWithAvailabilityZone() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_CreateInfraWithNewFileshare.json +func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithANewSapTransportDirectoryFileshare() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, + Location: to.Ptr("westcentralus"), Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), AppLocation: to.Ptr("eastus"), + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ AppResourceGroup: to.Ptr("X00-RG"), - DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ InstanceCount: to.Ptr[int64](6), SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP-HA"), + Offer: to.Ptr("RHEL-SAP"), Publisher: to.Ptr("RedHat"), SKU: to.Ptr("84sapha-gen2"), Version: to.Ptr("latest"), @@ -6087,8 +5786,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_detectSapSoftwareInstallationO OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -6099,11 +5798,11 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_detectSapSoftwareInstallationO }, }, CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - InstanceCount: to.Ptr[int64](2), + InstanceCount: to.Ptr[int64](1), SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP-HA"), + Offer: to.Ptr("RHEL-SAP"), Publisher: to.Ptr("RedHat"), SKU: to.Ptr("84sapha-gen2"), Version: to.Ptr("latest"), @@ -6111,8 +5810,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_detectSapSoftwareInstallationO OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -6124,11 +5823,11 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_detectSapSoftwareInstallationO }, DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - InstanceCount: to.Ptr[int64](2), + InstanceCount: to.Ptr[int64](1), SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP-HA"), + Offer: to.Ptr("RHEL-SAP"), Publisher: to.Ptr("RedHat"), SKU: to.Ptr("84sapha-gen2"), Version: to.Ptr("latest"), @@ -6136,8 +5835,8 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_detectSapSoftwareInstallationO OSProfile: &armworkloadssapvirtualinstance.OSProfile{ AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ PrivateKey: to.Ptr("xyz"), PublicKey: to.Ptr("abc"), @@ -6147,21 +5846,23 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_detectSapSoftwareInstallationO VMSize: to.Ptr("Standard_M32ts"), }, }, - HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ - HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilityZone), + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + StorageConfiguration: &armworkloadssapvirtualinstance.StorageConfiguration{ + TransportFileShareConfiguration: &armworkloadssapvirtualinstance.CreateAndMountFileShareConfiguration{ + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.FileShareConfigurationTypeCreateAndMount), + ResourceGroup: to.Ptr("rgName"), + StorageAccountName: to.Ptr("storageName"), + }, }, }, OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ SapFqdn: to.Ptr("xyz.test.com"), }, - SoftwareConfiguration: &armworkloadssapvirtualinstance.ExternalInstallationSoftwareConfiguration{ - SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeExternal), - CentralServerVMID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"), - }, }, Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), }, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -6173,230 +5874,451 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_detectSapSoftwareInstallationO // 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](6), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP-HA"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + // AppResourceGroup: to.Ptr("X00-RG"), + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + // InstanceCount: to.Ptr[int64](6), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP-HA"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_E16ds_v4"), // }, - // VMSize: to.Ptr("Standard_E16ds_v4"), // }, - // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP-HA"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("abc"), + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_M32ts"), + // }, + // }, + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + // StorageConfiguration: &armworkloadssapvirtualinstance.StorageConfiguration{ + // TransportFileShareConfiguration: &armworkloadssapvirtualinstance.CreateAndMountFileShareConfiguration{ + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.FileShareConfigurationTypeCreateAndMount), + // ResourceGroup: to.Ptr("rgName"), + // StorageAccountName: to.Ptr("storageName"), // }, - // VMSize: to.Ptr("Standard_M32ts"), // }, // }, - // HighAvailabilityConfig: &armworkloadssapvirtualinstance.HighAvailabilityConfiguration{ - // HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilityZone), + // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ + // SapFqdn: to.Ptr("xyz.test.com"), // }, // }, - // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - // SapFqdn: to.Ptr("xyz.test.com"), - // }, - // SoftwareConfiguration: &armworkloadssapvirtualinstance.ExternalInstallationSoftwareConfiguration{ - // SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeExternal), - // CentralServerVMID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"), - // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateRegistrationComplete), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Install_Distributed.json -func ExampleSAPVirtualInstancesClient_BeginCreate_installSapSoftwareOnDistributedSystem() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_CreateInfraWithOsTrustedAccess.json +func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOSConfigurationWithTrustedAccessEnabled() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ - Location: to.Ptr("eastus2"), - Tags: map[string]*string{ - "created by": to.Ptr("azureuser"), - }, + Location: to.Ptr("westcentralus"), Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), AppLocation: to.Ptr("eastus"), + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - AppResourceGroup: to.Ptr("{{resourcegrp}}"), - DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + AppResourceGroup: to.Ptr("X00-RG"), ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - InstanceCount: to.Ptr[int64](2), - SubnetID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), + InstanceCount: to.Ptr[int64](6), + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP-HA"), + Offer: to.Ptr("RHEL-SAP"), Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("8.2"), - Version: to.Ptr("8.2.2021091201"), + SKU: to.Ptr("84sapha-gen2"), + Version: to.Ptr("latest"), }, OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - AdminUsername: to.Ptr("azureuser"), + AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - PrivateKey: to.Ptr("{{privateKey}}"), - PublicKey: to.Ptr("{{sshkey}}"), + PrivateKey: to.Ptr("xyz"), + PublicKey: to.Ptr("abc"), }, }, }, - VMSize: to.Ptr("Standard_E4ds_v4"), + VMSize: to.Ptr("Standard_E32ds_v4"), }, }, CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ InstanceCount: to.Ptr[int64](1), - SubnetID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP-HA"), + Offer: to.Ptr("RHEL-SAP"), Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("8.2"), - Version: to.Ptr("8.2.2021091201"), + SKU: to.Ptr("84sapha-gen2"), + Version: to.Ptr("latest"), }, OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - AdminUsername: to.Ptr("azureuser"), + AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - PrivateKey: to.Ptr("{{privateKey}}"), - PublicKey: to.Ptr("{{sshkey}}"), + PrivateKey: to.Ptr("xyz"), + PublicKey: to.Ptr("abc"), }, }, }, - VMSize: to.Ptr("Standard_E4ds_v4"), + VMSize: to.Ptr("Standard_E16ds_v4"), }, }, DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), InstanceCount: to.Ptr[int64](1), - SubnetID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("RHEL-SAP-HA"), + Offer: to.Ptr("RHEL-SAP"), Publisher: to.Ptr("RedHat"), - SKU: to.Ptr("8.2"), - Version: to.Ptr("8.2.2021091201"), + SKU: to.Ptr("84sapha-gen2"), + Version: to.Ptr("latest"), }, OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - AdminUsername: to.Ptr("azureuser"), + AdminUsername: to.Ptr("{your-username}"), OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - PrivateKey: to.Ptr("{{privateKey}}"), - PublicKey: to.Ptr("{{sshkey}}"), + PrivateKey: to.Ptr("xyz"), + PublicKey: to.Ptr("abc"), }, }, }, VMSize: to.Ptr("Standard_M32ts"), }, }, - NetworkConfiguration: &armworkloadssapvirtualinstance.NetworkConfiguration{ - IsSecondaryIPEnabled: to.Ptr(true), - }, + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), }, OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - SapFqdn: to.Ptr("sap.bpaas.com"), - }, - SoftwareConfiguration: &armworkloadssapvirtualinstance.SAPInstallWithoutOSConfigSoftwareConfiguration{ - SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeSAPInstallWithoutOSConfig), - BomURL: to.Ptr("https://teststorageaccount.blob.core.windows.net/sapbits/sapfiles/boms/S41909SPS03_v0011ms/S41909SPS03_v0011ms.yaml"), - SapBitsStorageAccountID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/teststorageaccount"), - SoftwareVersion: to.Ptr("SAP S/4HANA 1909 SPS 03"), + SapFqdn: to.Ptr("xyz.test.com"), + }, + }, + Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + ManagedResourcesNetworkAccessType: to.Ptr(armworkloadssapvirtualinstance.ManagedResourcesNetworkAccessTypePrivate), + SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + }, + Tags: map[string]*string{}, + }, 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 = armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + // AppResourceGroup: to.Ptr("X00-RG"), + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + // InstanceCount: to.Ptr[int64](6), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, + // }, + // }, + // VMSize: to.Ptr("Standard_E32ds_v4"), + // }, + // }, + // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, + // }, + // }, + // VMSize: to.Ptr("Standard_E16ds_v4"), + // }, + // }, + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, + // }, + // }, + // VMSize: to.Ptr("Standard_M32ts"), + // }, + // }, + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + // }, + // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ + // SapFqdn: to.Ptr("xyz.test.com"), + // }, + // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), + // ManagedResourcesNetworkAccessType: to.Ptr(armworkloadssapvirtualinstance.ManagedResourcesNetworkAccessTypePrivate), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // }, + // }, + // } +} + +// Generated from example definition: 2024-09-01/SapVirtualInstances_CreateInfraWithoutFileshare.json +func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithoutASapTransportDirectoryFileshare() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ + Location: to.Ptr("westcentralus"), + Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ + AppLocation: to.Ptr("eastus"), + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + AppResourceGroup: to.Ptr("X00-RG"), + ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + InstanceCount: to.Ptr[int64](6), + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + Offer: to.Ptr("RHEL-SAP"), + Publisher: to.Ptr("RedHat"), + SKU: to.Ptr("84sapha-gen2"), + Version: to.Ptr("latest"), + }, + OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + AdminUsername: to.Ptr("{your-username}"), + OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + PrivateKey: to.Ptr("xyz"), + PublicKey: to.Ptr("abc"), + }, + }, + }, + VMSize: to.Ptr("Standard_E32ds_v4"), + }, + }, + CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ + InstanceCount: to.Ptr[int64](1), + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + Offer: to.Ptr("RHEL-SAP"), + Publisher: to.Ptr("RedHat"), + SKU: to.Ptr("84sapha-gen2"), + Version: to.Ptr("latest"), + }, + OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + AdminUsername: to.Ptr("{your-username}"), + OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + PrivateKey: to.Ptr("xyz"), + PublicKey: to.Ptr("abc"), + }, + }, + }, + VMSize: to.Ptr("Standard_E16ds_v4"), + }, + }, + DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + InstanceCount: to.Ptr[int64](1), + SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), + VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + Offer: to.Ptr("RHEL-SAP"), + Publisher: to.Ptr("RedHat"), + SKU: to.Ptr("84sapha-gen2"), + Version: to.Ptr("latest"), + }, + OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + AdminUsername: to.Ptr("{your-username}"), + OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + PrivateKey: to.Ptr("xyz"), + PublicKey: to.Ptr("abc"), + }, + }, + }, + VMSize: to.Ptr("Standard_M32ts"), + }, + }, + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + StorageConfiguration: &armworkloadssapvirtualinstance.StorageConfiguration{ + TransportFileShareConfiguration: &armworkloadssapvirtualinstance.SkipFileShareConfiguration{ + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.FileShareConfigurationTypeSkip), + }, + }, + }, + OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ + SapFqdn: to.Ptr("xyz.test.com"), }, }, Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), }, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -6408,945 +6330,2361 @@ func ExampleSAPVirtualInstancesClient_BeginCreate_installSapSoftwareOnDistribute // 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("microsoft.workloads/sapvirtualinstances"), - // ID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/aa-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-08-18T18:25:55.240Z"); return t}()), - // CreatedBy: to.Ptr("f1bc9460-9d57-4c16-99a8-5a19378a3a93"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-08-18T18:50:59.194Z"); return t}()), - // LastModifiedBy: to.Ptr("f1bc9460-9d57-4c16-99a8-5a19378a3a93"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeApplication), - // }, - // Location: to.Ptr("eastus2"), - // Tags: map[string]*string{ - // "created by": to.Ptr("azureuser"), - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("aa-rg"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP-HA"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + // AppResourceGroup: to.Ptr("X00-RG"), + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + // InstanceCount: to.Ptr[int64](6), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, + // }, + // }, + // VMSize: to.Ptr("Standard_E32ds_v4"), // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("azureuser"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("ssh-rsa AAA generated-by-azure"), + // }, + // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_E16ds_v4"), // }, - // VMSize: to.Ptr("Standard_E4ds_v4"), // }, - // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP-HA"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, + // }, + // }, + // VMSize: to.Ptr("Standard_M32ts"), // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("azureuser"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("ssh-rsa AAA generated-by-azure"), + // }, + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + // StorageConfiguration: &armworkloadssapvirtualinstance.StorageConfiguration{ + // TransportFileShareConfiguration: &armworkloadssapvirtualinstance.SkipFileShareConfiguration{ + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.FileShareConfigurationTypeSkip), + // }, + // }, + // }, + // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ + // SapFqdn: to.Ptr("xyz.test.com"), + // }, + // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationPending), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // }, + // }, + // } +} + +// Generated from example definition: 2024-09-01/SapVirtualInstances_CreateInstallDS.json +func ExampleSAPVirtualInstancesClient_BeginCreate_installSapSoftwareOnDistributedSystem() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ + Location: to.Ptr("eastus2"), + Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ + AppLocation: to.Ptr("eastus"), + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + AppResourceGroup: to.Ptr("{{resourcegrp}}"), + ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + InstanceCount: to.Ptr[int64](2), + SubnetID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), + VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + Offer: to.Ptr("RHEL-SAP-HA"), + Publisher: to.Ptr("RedHat"), + SKU: to.Ptr("8.2"), + Version: to.Ptr("8.2.2021091201"), + }, + OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + AdminUsername: to.Ptr("azureuser"), + OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + PrivateKey: to.Ptr("{{privateKey}}"), + PublicKey: to.Ptr("{{sshkey}}"), + }, + }, + }, + VMSize: to.Ptr("Standard_E4ds_v4"), + }, + }, + CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ + InstanceCount: to.Ptr[int64](1), + SubnetID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), + VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + Offer: to.Ptr("RHEL-SAP-HA"), + Publisher: to.Ptr("RedHat"), + SKU: to.Ptr("8.2"), + Version: to.Ptr("8.2.2021091201"), + }, + OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + AdminUsername: to.Ptr("azureuser"), + OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + PrivateKey: to.Ptr("{{privateKey}}"), + PublicKey: to.Ptr("{{sshkey}}"), + }, + }, + }, + VMSize: to.Ptr("Standard_E4ds_v4"), + }, + }, + DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + InstanceCount: to.Ptr[int64](1), + SubnetID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), + VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + Offer: to.Ptr("RHEL-SAP-HA"), + Publisher: to.Ptr("RedHat"), + SKU: to.Ptr("8.2"), + Version: to.Ptr("8.2.2021091201"), + }, + OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + AdminUsername: to.Ptr("azureuser"), + OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + PrivateKey: to.Ptr("{{privateKey}}"), + PublicKey: to.Ptr("{{sshkey}}"), + }, + }, + }, + VMSize: to.Ptr("Standard_M32ts"), + }, + }, + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + NetworkConfiguration: &armworkloadssapvirtualinstance.NetworkConfiguration{ + IsSecondaryIPEnabled: to.Ptr(true), + }, + }, + OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ + SapFqdn: to.Ptr("sap.bpaas.com"), + }, + SoftwareConfiguration: &armworkloadssapvirtualinstance.SAPInstallWithoutOSConfigSoftwareConfiguration{ + BomURL: to.Ptr("https://teststorageaccount.blob.core.windows.net/sapbits/sapfiles/boms/S41909SPS03_v0011ms/S41909SPS03_v0011ms.yaml"), + SapBitsStorageAccountID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/teststorageaccount"), + SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeSAPInstallWithoutOSConfig), + SoftwareVersion: to.Ptr("SAP S/4HANA 1909 SPS 03"), + }, + }, + Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + }, + Tags: map[string]*string{ + "created by": to.Ptr("azureuser"), + }, + }, 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 = armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("microsoft.workloads/sapvirtualinstances"), + // ID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/aa-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("eastus2"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + // AppResourceGroup: to.Ptr("aa-rg"), + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + // InstanceCount: to.Ptr[int64](2), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP-HA"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("azureuser"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("ssh-rsa AAA generated-by-azure"), + // }, + // }, + // }, + // VMSize: to.Ptr("Standard_E4ds_v4"), + // }, + // }, + // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP-HA"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("azureuser"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("ssh-rsa AAA generated-by-azure"), + // }, + // }, + // }, + // VMSize: to.Ptr("Standard_E4ds_v4"), + // }, + // }, + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP-HA"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("azureuser"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("ssh-rsa AAA generated-by-azure"), + // }, + // }, + // }, + // VMSize: to.Ptr("Standard_M32ts"), + // }, + // }, + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + // NetworkConfiguration: &armworkloadssapvirtualinstance.NetworkConfiguration{ + // IsSecondaryIPEnabled: to.Ptr(true), + // }, + // }, + // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ + // SapFqdn: to.Ptr("sap.bpaas.com"), + // }, + // SoftwareConfiguration: &armworkloadssapvirtualinstance.SAPInstallWithoutOSConfigSoftwareConfiguration{ + // BomURL: to.Ptr("https://teststorageaccount.blob.core.windows.net/sapbits/sapfiles/boms/S41909SPS03_v0011ms/S41909SPS03_v0011ms.yaml"), + // SapBitsStorageAccountID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/teststorageaccount"), + // SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeSAPInstallWithoutOSConfig), + // SoftwareVersion: to.Ptr("SAP S/4HANA 1909 SPS 03"), + // }, + // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationInProgress), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-08-18T18:25:55.2406546Z"); return t}()), + // CreatedBy: to.Ptr("f1bc9460-9d57-4c16-99a8-5a19378a3a93"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeApplication), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-08-18T18:50:59.1945444Z"); return t}()), + // LastModifiedBy: to.Ptr("f1bc9460-9d57-4c16-99a8-5a19378a3a93"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeApplication), + // }, + // Tags: map[string]*string{ + // "created by": to.Ptr("azureuser"), + // }, + // }, + // } +} + +// Generated from example definition: 2024-09-01/SapVirtualInstances_CreateInstallSingleServer.json +func ExampleSAPVirtualInstancesClient_BeginCreate_installSapSoftwareOnSingleServerSystem() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ + Location: to.Ptr("eastus2"), + Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ + AppLocation: to.Ptr("eastus"), + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + InfrastructureConfiguration: &armworkloadssapvirtualinstance.SingleServerConfiguration{ + AppResourceGroup: to.Ptr("test-rg"), + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeSingleServer), + SubnetID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/testsubnet"), + VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + Offer: to.Ptr("SLES-SAP"), + Publisher: to.Ptr("SUSE"), + SKU: to.Ptr("12-sp4-gen2"), + Version: to.Ptr("2022.02.01"), + }, + OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + AdminUsername: to.Ptr("azureappadmin"), + OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + DisablePasswordAuthentication: to.Ptr(true), + OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + PrivateKey: to.Ptr("{{privateKey}}"), + PublicKey: to.Ptr("{{sshkey}}"), + }, + }, + }, + VMSize: to.Ptr("Standard_E32ds_v4"), + }, + }, + OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ + SapFqdn: to.Ptr("sap.bpaas.com"), + }, + SoftwareConfiguration: &armworkloadssapvirtualinstance.SAPInstallWithoutOSConfigSoftwareConfiguration{ + BomURL: to.Ptr("https://teststorageaccount.blob.core.windows.net/sapbits/sapfiles/boms/S41909SPS03_v0011ms/S41909SPS03_v0011ms.yaml"), + SapBitsStorageAccountID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/teststorageaccount"), + SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeSAPInstallWithoutOSConfig), + SoftwareVersion: to.Ptr("SAP S/4HANA 1909 SPS 03"), + }, + }, + Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), + SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + }, + Tags: map[string]*string{}, + }, 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 = armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("microsoft.workloads/sapvirtualinstances"), + // ID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/aa-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("eastus2"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + // AppResourceGroup: to.Ptr("aa-rg"), + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + // InstanceCount: to.Ptr[int64](2), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP-HA"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("azureuser"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("ssh-rsa AAA generated-by-azure"), + // }, + // }, + // }, + // VMSize: to.Ptr("Standard_E4ds_v4"), + // }, + // }, + // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP-HA"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("azureuser"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("ssh-rsa AAA generated-by-azure"), + // }, + // }, + // }, + // VMSize: to.Ptr("Standard_E4ds_v4"), + // }, + // }, + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP-HA"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("azureuser"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("ssh-rsa AAA generated-by-azure"), + // }, + // }, + // }, + // VMSize: to.Ptr("Standard_M32ts"), + // }, + // }, + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + // NetworkConfiguration: &armworkloadssapvirtualinstance.NetworkConfiguration{ + // IsSecondaryIPEnabled: to.Ptr(true), + // }, + // }, + // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ + // SapFqdn: to.Ptr("sap.bpaas.com"), + // }, + // SoftwareConfiguration: &armworkloadssapvirtualinstance.SAPInstallWithoutOSConfigSoftwareConfiguration{ + // BomURL: to.Ptr("https://teststorageaccount.blob.core.windows.net/sapbits/sapfiles/boms/S41909SPS03_v0011ms/S41909SPS03_v0011ms.yaml"), + // SapBitsStorageAccountID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/teststorageaccount"), + // SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeSAPInstallWithoutOSConfig), + // SoftwareVersion: to.Ptr("SAP S/4HANA 1909 SPS 03"), + // }, + // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationInProgress), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-08-18T18:25:55.2406546Z"); return t}()), + // CreatedBy: to.Ptr("f1bc9460-9d57-4c16-99a8-5a19378a3a93"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeApplication), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-08-18T18:50:59.1945444Z"); return t}()), + // LastModifiedBy: to.Ptr("f1bc9460-9d57-4c16-99a8-5a19378a3a93"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeApplication), + // }, + // Tags: map[string]*string{ + // "created by": to.Ptr("azureuser"), + // }, + // }, + // } +} + +// Generated from example definition: 2024-09-01/SapVirtualInstances_CreateRegisterSapSolutions.json +func ExampleSAPVirtualInstancesClient_BeginCreate_registerExistingSapSystemAsVirtualInstanceForSapSolutions() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ + Location: to.Ptr("northeurope"), + Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + Configuration: &armworkloadssapvirtualinstance.DiscoveryConfiguration{ + CentralServerVMID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"), + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDiscovery), + }, + Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), + SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + }, + Tags: map[string]*string{ + "createdby": to.Ptr("abc@microsoft.com"), + "test": to.Ptr("abc"), + }, + }, 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 = armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("Q20"), + // Type: to.Ptr("microsoft.workloads/sapvirtualinstances"), + // ID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/Q20"), + // Location: to.Ptr("northeurope"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DiscoveryConfiguration{ + // AppLocation: to.Ptr("westeurope"), + // CentralServerVMID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg-infra/providers/Microsoft.Compute/virtualMachines/q20ascsvm0"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDiscovery), + // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // ManagedResourceGroupConfiguration: &armworkloadssapvirtualinstance.ManagedRGConfiguration{ + // Name: to.Ptr("mrg-Q20-5b0097"), + // }, + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateRegistrationComplete), + // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-07-27T08:22:52.3318907Z"); return t}()), + // CreatedBy: to.Ptr("abc@microsoft.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-07-27T11:44:17.9310503Z"); return t}()), + // LastModifiedBy: to.Ptr("abc@microsoft.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // }, + // } +} + +// Generated from example definition: 2024-09-01/SapVirtualInstances_CreateRegisterSapSolutionsCustom.json +func ExampleSAPVirtualInstancesClient_BeginCreate_registerExistingSapSystemAsVirtualInstanceForSapSolutionsWithOptionalCustomizations() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ + Location: to.Ptr("northeurope"), + Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + Configuration: &armworkloadssapvirtualinstance.DiscoveryConfiguration{ + CentralServerVMID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"), + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDiscovery), + ManagedRgStorageAccountName: to.Ptr("q20saacssgrs"), + }, + Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), + SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + }, + Tags: map[string]*string{ + "createdby": to.Ptr("abc@microsoft.com"), + "test": to.Ptr("abc"), + }, + }, 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 = armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("Q20"), + // Type: to.Ptr("microsoft.workloads/sapvirtualinstances"), + // ID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/Q20"), + // Location: to.Ptr("northeurope"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DiscoveryConfiguration{ + // AppLocation: to.Ptr("westeurope"), + // CentralServerVMID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg-infra/providers/Microsoft.Compute/virtualMachines/q20ascsvm0"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDiscovery), + // ManagedRgStorageAccountName: to.Ptr("q20saacssgrs"), + // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // ManagedResourceGroupConfiguration: &armworkloadssapvirtualinstance.ManagedRGConfiguration{ + // Name: to.Ptr("mrg-Q20-5b0097"), + // }, + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateRegistrationComplete), + // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-07-27T08:22:52.3318907Z"); return t}()), + // CreatedBy: to.Ptr("abc@microsoft.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-07-27T11:44:17.9310503Z"); return t}()), + // LastModifiedBy: to.Ptr("abc@microsoft.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // }, + // } +} + +// Generated from example definition: 2024-09-01/SapVirtualInstances_CreateRegisterWithTrustedAccess.json +func ExampleSAPVirtualInstancesClient_BeginCreate_registerWithTrustedAccessEnabled() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ + Location: to.Ptr("northeurope"), + Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + Configuration: &armworkloadssapvirtualinstance.DiscoveryConfiguration{ + CentralServerVMID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"), + ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDiscovery), + }, + Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), + ManagedResourcesNetworkAccessType: to.Ptr(armworkloadssapvirtualinstance.ManagedResourcesNetworkAccessTypePrivate), + SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + }, + Tags: map[string]*string{ + "createdby": to.Ptr("abc@microsoft.com"), + "test": to.Ptr("abc"), + }, + }, 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 = armworkloadssapvirtualinstance.SAPVirtualInstancesClientCreateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("Q20"), + // Type: to.Ptr("microsoft.workloads/sapvirtualinstances"), + // ID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/Q20"), + // Location: to.Ptr("northeurope"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DiscoveryConfiguration{ + // AppLocation: to.Ptr("westeurope"), + // CentralServerVMID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg-infra/providers/Microsoft.Compute/virtualMachines/q20ascsvm0"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDiscovery), + // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // ManagedResourceGroupConfiguration: &armworkloadssapvirtualinstance.ManagedRGConfiguration{ + // Name: to.Ptr("mrg-Q20-5b0097"), + // }, + // ManagedResourcesNetworkAccessType: to.Ptr(armworkloadssapvirtualinstance.ManagedResourcesNetworkAccessTypePrivate), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateRegistrationComplete), + // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-07-27T08:22:52.3318907Z"); return t}()), + // CreatedBy: to.Ptr("abc@microsoft.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-07-27T11:44:17.9310503Z"); return t}()), + // LastModifiedBy: to.Ptr("abc@microsoft.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // }, + // } +} + +// Generated from example definition: 2024-09-01/SapVirtualInstances_Delete.json +func ExampleSAPVirtualInstancesClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("6d875e77-e412-4d7d-9af4-8895278b4443", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginDelete(ctx, "test-rg", "X00", 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: 2024-09-01/SapVirtualInstances_Get.json +func ExampleSAPVirtualInstancesClient_Get_sapVirtualInstancesGet() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSAPVirtualInstancesClient().Get(ctx, "test-rg", "X00", 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 = armworkloadssapvirtualinstance.SAPVirtualInstancesClientGetResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + // AppResourceGroup: to.Ptr("X00-RG"), + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + // InstanceCount: to.Ptr[int64](10), + // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId3"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + // { + // KeyData: to.Ptr("ssh-rsa public key"), + // }, + // }, + // }, // }, // }, + // VMSize: to.Ptr("Standard_D8s_v3"), // }, - // VMSize: to.Ptr("Standard_E4ds_v4"), // }, - // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP-HA"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), + // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId1"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + // { + // KeyData: to.Ptr("ssh-rsa public key"), + // }, + // }, + // }, + // }, + // }, + // VMSize: to.Ptr("Standard_D8s_v3"), // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("azureuser"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("ssh-rsa AAA generated-by-azure"), + // }, + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId2"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + // { + // KeyData: to.Ptr("ssh-rsa public key"), + // }, + // }, + // }, // }, // }, + // VMSize: to.Ptr("Standard_D8s_v3"), // }, - // VMSize: to.Ptr("Standard_M32ts"), // }, + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), // }, - // NetworkConfiguration: &armworkloadssapvirtualinstance.NetworkConfiguration{ - // IsSecondaryIPEnabled: to.Ptr(true), + // SoftwareConfiguration: &armworkloadssapvirtualinstance.ServiceInitiatedSoftwareConfiguration{ + // BomURL: to.Ptr("https://myaccount.blob.core.windows.net/mycontainer/myblob"), + // SapBitsStorageAccountID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/ajgupt-test/providers/Microsoft.Storage/storageAccounts/ajguptsavnet"), + // SapFqdn: to.Ptr("sapsystem.contoso.net"), + // SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeServiceInitiated), + // SoftwareVersion: to.Ptr("SAP S/4HANA 2020 FPS01"), // }, // }, - // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - // SapFqdn: to.Ptr("sap.bpaas.com"), - // }, - // SoftwareConfiguration: &armworkloadssapvirtualinstance.SAPInstallWithoutOSConfigSoftwareConfiguration{ - // SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeSAPInstallWithoutOSConfig), - // BomURL: to.Ptr("https://teststorageaccount.blob.core.windows.net/sapbits/sapfiles/boms/S41909SPS03_v0011ms/S41909SPS03_v0011ms.yaml"), - // SapBitsStorageAccountID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/teststorageaccount"), - // SoftwareVersion: to.Ptr("SAP S/4HANA 1909 SPS 03"), + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // ManagedResourceGroupConfiguration: &armworkloadssapvirtualinstance.ManagedRGConfiguration{ + // Name: to.Ptr("mrg-x00-6d875e77-e412-4d7d-9af4-8895278b4443"), // }, + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateRegistrationComplete), + // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationInProgress), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Install_SingleServer.json -func ExampleSAPVirtualInstancesClient_BeginCreate_installSapSoftwareOnSingleServerSystem() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_GetAcssInstallationBlocked.json +func ExampleSAPVirtualInstancesClient_Get_sapVirtualInstancesGetWithAcssInstallationBlocked() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ - Location: to.Ptr("eastus2"), - Tags: map[string]*string{}, - Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), - AppLocation: to.Ptr("eastus"), - InfrastructureConfiguration: &armworkloadssapvirtualinstance.SingleServerConfiguration{ - AppResourceGroup: to.Ptr("test-rg"), - DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeSingleServer), - SubnetID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/testsubnet"), - VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - Offer: to.Ptr("SLES-SAP"), - Publisher: to.Ptr("SUSE"), - SKU: to.Ptr("12-sp4-gen2"), - Version: to.Ptr("2022.02.01"), - }, - OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - AdminUsername: to.Ptr("azureappadmin"), - OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - DisablePasswordAuthentication: to.Ptr(true), - SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - PrivateKey: to.Ptr("{{privateKey}}"), - PublicKey: to.Ptr("{{sshkey}}"), - }, - }, - }, - VMSize: to.Ptr("Standard_E32ds_v4"), - }, - }, - OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - SapFqdn: to.Ptr("sap.bpaas.com"), - }, - SoftwareConfiguration: &armworkloadssapvirtualinstance.SAPInstallWithoutOSConfigSoftwareConfiguration{ - SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeSAPInstallWithoutOSConfig), - BomURL: to.Ptr("https://teststorageaccount.blob.core.windows.net/sapbits/sapfiles/boms/S41909SPS03_v0011ms/S41909SPS03_v0011ms.yaml"), - SapBitsStorageAccountID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/teststorageaccount"), - SoftwareVersion: to.Ptr("SAP S/4HANA 1909 SPS 03"), - }, - }, - Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), - SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - }, - }, nil) + res, err := clientFactory.NewSAPVirtualInstancesClient().Get(ctx, "test-rg", "X00", 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("microsoft.workloads/sapvirtualinstances"), - // ID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/aa-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-08-18T18:25:55.240Z"); return t}()), - // CreatedBy: to.Ptr("f1bc9460-9d57-4c16-99a8-5a19378a3a93"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-08-18T18:50:59.194Z"); return t}()), - // LastModifiedBy: to.Ptr("f1bc9460-9d57-4c16-99a8-5a19378a3a93"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeApplication), - // }, - // Location: to.Ptr("eastus2"), - // Tags: map[string]*string{ - // "created by": to.Ptr("azureuser"), - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentWithOSConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeploymentWithOSConfig), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("aa-rg"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](2), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP-HA"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("azureuser"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("ssh-rsa AAA generated-by-azure"), + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientGetResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + // AppResourceGroup: to.Ptr("X00-RG"), + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + // InstanceCount: to.Ptr[int64](10), + // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId3"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // ID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/galleries/testgallery/images/rhelimagetest/versions/0.0.1"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + // { + // KeyData: to.Ptr("ssh-rsa public key"), + // }, + // }, + // }, // }, // }, + // VMSize: to.Ptr("Standard_D8s_v3"), // }, - // VMSize: to.Ptr("Standard_E4ds_v4"), // }, - // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP-HA"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("azureuser"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("ssh-rsa AAA generated-by-azure"), + // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId1"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // ID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/galleries/testgallery/images/rhelimagetest/versions/0.0.1"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + // { + // KeyData: to.Ptr("ssh-rsa public key"), + // }, + // }, + // }, // }, // }, + // VMSize: to.Ptr("Standard_D8s_v3"), // }, - // VMSize: to.Ptr("Standard_E4ds_v4"), // }, - // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP-HA"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("azureuser"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ - // PublicKey: to.Ptr("ssh-rsa AAA generated-by-azure"), + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId2"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // ID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/galleries/testgallery/images/rhelimagetest/versions/0.0.1"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ + // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ + // { + // KeyData: to.Ptr("ssh-rsa public key"), + // }, + // }, + // }, // }, // }, + // VMSize: to.Ptr("Standard_D8s_v3"), // }, - // VMSize: to.Ptr("Standard_M32ts"), // }, + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), // }, - // NetworkConfiguration: &armworkloadssapvirtualinstance.NetworkConfiguration{ - // IsSecondaryIPEnabled: to.Ptr(true), + // SoftwareConfiguration: &armworkloadssapvirtualinstance.ServiceInitiatedSoftwareConfiguration{ + // BomURL: to.Ptr("https://myaccount.blob.core.windows.net/mycontainer/myblob"), + // SapBitsStorageAccountID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/ajgupt-test/providers/Microsoft.Storage/storageAccounts/ajguptsavnet"), + // SapFqdn: to.Ptr("sapsystem.contoso.net"), + // SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeServiceInitiated), + // SoftwareVersion: to.Ptr("SAP S/4HANA 2020 FPS01"), // }, // }, - // OSSapConfiguration: &armworkloadssapvirtualinstance.OsSapConfiguration{ - // SapFqdn: to.Ptr("sap.bpaas.com"), - // }, - // SoftwareConfiguration: &armworkloadssapvirtualinstance.SAPInstallWithoutOSConfigSoftwareConfiguration{ - // SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeSAPInstallWithoutOSConfig), - // BomURL: to.Ptr("https://teststorageaccount.blob.core.windows.net/sapbits/sapfiles/boms/S41909SPS03_v0011ms/S41909SPS03_v0011ms.yaml"), - // SapBitsStorageAccountID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/teststorageaccount"), - // SoftwareVersion: to.Ptr("SAP S/4HANA 1909 SPS 03"), + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // ManagedResourceGroupConfiguration: &armworkloadssapvirtualinstance.ManagedRGConfiguration{ + // Name: to.Ptr("mrg-x00-6d875e77-e412-4d7d-9af4-8895278b4443"), // }, + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateACSSInstallationBlocked), + // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateSoftwareInstallationInProgress), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_Discover_CustomMrgStorageAccountName.json -func ExampleSAPVirtualInstancesClient_BeginCreate_registerExistingSapSystemAsVirtualInstanceForSapSolutionsWithOptionalCustomizations() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_InvokeAvailabilityZoneDetails_eastus.json +func ExampleSAPVirtualInstancesClient_GetAvailabilityZoneDetails_sapAvailabilityZoneDetailsInEastUs() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ - Location: to.Ptr("northeurope"), - Tags: map[string]*string{ - "createdby": to.Ptr("abc@microsoft.com"), - "test": to.Ptr("abc"), - }, - Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - Configuration: &armworkloadssapvirtualinstance.DiscoveryConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDiscovery), - CentralServerVMID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"), - ManagedRgStorageAccountName: to.Ptr("q20saacssgrs"), - }, - Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), - SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - }, + res, err := clientFactory.NewSAPVirtualInstancesClient().GetAvailabilityZoneDetails(ctx, "eastus", armworkloadssapvirtualinstance.SAPAvailabilityZoneDetailsRequest{ + AppLocation: to.Ptr("eastus"), + SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - res, err := poller.PollUntilDone(ctx, nil) + // 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 = armworkloadssapvirtualinstance.SAPVirtualInstancesClientGetAvailabilityZoneDetailsResponse{ + // SAPAvailabilityZoneDetailsResult: &armworkloadssapvirtualinstance.SAPAvailabilityZoneDetailsResult{ + // AvailabilityZonePairs: []*armworkloadssapvirtualinstance.SAPAvailabilityZonePair{ + // { + // ZoneA: to.Ptr[int64](1), + // ZoneB: to.Ptr[int64](2), + // }, + // }, + // }, + // } +} + +// Generated from example definition: 2024-09-01/SapVirtualInstances_InvokeAvailabilityZoneDetails_northeurope.json +func ExampleSAPVirtualInstancesClient_GetAvailabilityZoneDetails_sapAvailabilityZoneDetailsInNorthEurope() { + cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSAPVirtualInstancesClient().GetAvailabilityZoneDetails(ctx, "northeurope", armworkloadssapvirtualinstance.SAPAvailabilityZoneDetailsRequest{ + AppLocation: to.Ptr("northeurope"), + SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + }, 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("Q20"), - // Type: to.Ptr("microsoft.workloads/sapvirtualinstances"), - // ID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/Q20"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-07-27T08:22:52.331Z"); return t}()), - // CreatedBy: to.Ptr("abc@microsoft.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-07-27T11:44:17.931Z"); return t}()), - // LastModifiedBy: to.Ptr("abc@microsoft.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("northeurope"), - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DiscoveryConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDiscovery), - // AppLocation: to.Ptr("westeurope"), - // CentralServerVMID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg-infra/providers/Microsoft.Compute/virtualMachines/q20ascsvm0"), - // ManagedRgStorageAccountName: to.Ptr("q20saacssgrs"), + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientGetAvailabilityZoneDetailsResponse{ + // SAPAvailabilityZoneDetailsResult: &armworkloadssapvirtualinstance.SAPAvailabilityZoneDetailsResult{ + // AvailabilityZonePairs: []*armworkloadssapvirtualinstance.SAPAvailabilityZonePair{ + // { + // ZoneA: to.Ptr[int64](2), + // ZoneB: to.Ptr[int64](3), + // }, // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // ManagedResourceGroupConfiguration: &armworkloadssapvirtualinstance.ManagedRGConfiguration{ - // Name: to.Ptr("mrg-Q20-5b0097"), + // }, + // } +} + +// Generated from example definition: 2024-09-01/SapVirtualInstances_InvokeDiskConfigurations_NonProd.json +func ExampleSAPVirtualInstancesClient_GetDiskConfigurations_sapDiskConfigurationsForInputEnvironmentNonProd() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSAPVirtualInstancesClient().GetDiskConfigurations(ctx, "centralus", armworkloadssapvirtualinstance.SAPDiskConfigurationsRequest{ + AppLocation: to.Ptr("eastus"), + SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), + DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + DbVMSKU: to.Ptr("Standard_M32ts"), + }, 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 = armworkloadssapvirtualinstance.SAPVirtualInstancesClientGetDiskConfigurationsResponse{ + // SAPDiskConfigurationsResult: &armworkloadssapvirtualinstance.SAPDiskConfigurationsResult{ + // VolumeConfigurations: map[string]*armworkloadssapvirtualinstance.SAPDiskConfiguration{ + // "hana/data": &armworkloadssapvirtualinstance.SAPDiskConfiguration{ + // RecommendedConfiguration: &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // Count: to.Ptr[int64](4), + // SizeGB: to.Ptr[int64](128), + // }, + // SupportedConfigurations: []*armworkloadssapvirtualinstance.DiskDetails{ + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // SizeGB: to.Ptr[int64](128), + // MinimumSupportedDiskCount: to.Ptr[int64](4), + // MaximumSupportedDiskCount: to.Ptr[int64](5), + // IopsReadWrite: to.Ptr[int64](500), + // MbpsReadWrite: to.Ptr[int64](100), + // DiskTier: to.Ptr("P10"), + // }, + // }, + // }, + // "hana/log": &armworkloadssapvirtualinstance.SAPDiskConfiguration{ + // RecommendedConfiguration: &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // Count: to.Ptr[int64](3), + // SizeGB: to.Ptr[int64](128), + // }, + // SupportedConfigurations: []*armworkloadssapvirtualinstance.DiskDetails{ + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // SizeGB: to.Ptr[int64](128), + // MinimumSupportedDiskCount: to.Ptr[int64](3), + // MaximumSupportedDiskCount: to.Ptr[int64](5), + // IopsReadWrite: to.Ptr[int64](500), + // MbpsReadWrite: to.Ptr[int64](100), + // DiskTier: to.Ptr("P10"), + // }, + // }, + // }, + // "hana/shared": &armworkloadssapvirtualinstance.SAPDiskConfiguration{ + // RecommendedConfiguration: &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + // }, + // Count: to.Ptr[int64](1), + // SizeGB: to.Ptr[int64](256), + // }, + // SupportedConfigurations: []*armworkloadssapvirtualinstance.DiskDetails{ + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // SizeGB: to.Ptr[int64](256), + // MinimumSupportedDiskCount: to.Ptr[int64](1), + // MaximumSupportedDiskCount: to.Ptr[int64](1), + // IopsReadWrite: to.Ptr[int64](1100), + // MbpsReadWrite: to.Ptr[int64](125), + // DiskTier: to.Ptr("P15"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // SizeGB: to.Ptr[int64](512), + // MinimumSupportedDiskCount: to.Ptr[int64](1), + // MaximumSupportedDiskCount: to.Ptr[int64](1), + // IopsReadWrite: to.Ptr[int64](2300), + // MbpsReadWrite: to.Ptr[int64](150), + // DiskTier: to.Ptr("P20"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // SizeGB: to.Ptr[int64](1024), + // MinimumSupportedDiskCount: to.Ptr[int64](1), + // MaximumSupportedDiskCount: to.Ptr[int64](1), + // IopsReadWrite: to.Ptr[int64](5000), + // MbpsReadWrite: to.Ptr[int64](200), + // DiskTier: to.Ptr("P30"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // SizeGB: to.Ptr[int64](2048), + // MinimumSupportedDiskCount: to.Ptr[int64](1), + // MaximumSupportedDiskCount: to.Ptr[int64](1), + // IopsReadWrite: to.Ptr[int64](7500), + // MbpsReadWrite: to.Ptr[int64](250), + // DiskTier: to.Ptr("P40"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // SizeGB: to.Ptr[int64](4096), + // MinimumSupportedDiskCount: to.Ptr[int64](1), + // MaximumSupportedDiskCount: to.Ptr[int64](1), + // IopsReadWrite: to.Ptr[int64](7500), + // MbpsReadWrite: to.Ptr[int64](250), + // DiskTier: to.Ptr("P50"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + // }, + // SizeGB: to.Ptr[int64](256), + // MinimumSupportedDiskCount: to.Ptr[int64](1), + // MaximumSupportedDiskCount: to.Ptr[int64](1), + // IopsReadWrite: to.Ptr[int64](500), + // MbpsReadWrite: to.Ptr[int64](60), + // DiskTier: to.Ptr("E15"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + // }, + // SizeGB: to.Ptr[int64](512), + // MinimumSupportedDiskCount: to.Ptr[int64](1), + // MaximumSupportedDiskCount: to.Ptr[int64](1), + // IopsReadWrite: to.Ptr[int64](500), + // MbpsReadWrite: to.Ptr[int64](60), + // DiskTier: to.Ptr("E20"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + // }, + // SizeGB: to.Ptr[int64](1024), + // MinimumSupportedDiskCount: to.Ptr[int64](1), + // MaximumSupportedDiskCount: to.Ptr[int64](1), + // IopsReadWrite: to.Ptr[int64](500), + // MbpsReadWrite: to.Ptr[int64](60), + // DiskTier: to.Ptr("E30"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + // }, + // SizeGB: to.Ptr[int64](2048), + // MinimumSupportedDiskCount: to.Ptr[int64](1), + // MaximumSupportedDiskCount: to.Ptr[int64](1), + // IopsReadWrite: to.Ptr[int64](500), + // MbpsReadWrite: to.Ptr[int64](60), + // DiskTier: to.Ptr("E40"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + // }, + // SizeGB: to.Ptr[int64](4096), + // MinimumSupportedDiskCount: to.Ptr[int64](1), + // MaximumSupportedDiskCount: to.Ptr[int64](1), + // IopsReadWrite: to.Ptr[int64](500), + // MbpsReadWrite: to.Ptr[int64](60), + // DiskTier: to.Ptr("E50"), + // }, + // }, + // }, + // "usr/sap": &armworkloadssapvirtualinstance.SAPDiskConfiguration{ + // RecommendedConfiguration: &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // Count: to.Ptr[int64](1), + // SizeGB: to.Ptr[int64](128), + // }, + // SupportedConfigurations: []*armworkloadssapvirtualinstance.DiskDetails{ + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // SizeGB: to.Ptr[int64](128), + // MinimumSupportedDiskCount: to.Ptr[int64](1), + // MaximumSupportedDiskCount: to.Ptr[int64](1), + // IopsReadWrite: to.Ptr[int64](500), + // MbpsReadWrite: to.Ptr[int64](100), + // DiskTier: to.Ptr("P10"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // SizeGB: to.Ptr[int64](256), + // MinimumSupportedDiskCount: to.Ptr[int64](1), + // MaximumSupportedDiskCount: to.Ptr[int64](1), + // IopsReadWrite: to.Ptr[int64](1100), + // MbpsReadWrite: to.Ptr[int64](125), + // DiskTier: to.Ptr("P10"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // SizeGB: to.Ptr[int64](512), + // MinimumSupportedDiskCount: to.Ptr[int64](1), + // MaximumSupportedDiskCount: to.Ptr[int64](1), + // IopsReadWrite: to.Ptr[int64](2300), + // MbpsReadWrite: to.Ptr[int64](150), + // DiskTier: to.Ptr("P10"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + // }, + // SizeGB: to.Ptr[int64](128), + // MinimumSupportedDiskCount: to.Ptr[int64](1), + // MaximumSupportedDiskCount: to.Ptr[int64](1), + // IopsReadWrite: to.Ptr[int64](500), + // MbpsReadWrite: to.Ptr[int64](60), + // DiskTier: to.Ptr("E10"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + // }, + // SizeGB: to.Ptr[int64](256), + // MinimumSupportedDiskCount: to.Ptr[int64](1), + // MaximumSupportedDiskCount: to.Ptr[int64](1), + // IopsReadWrite: to.Ptr[int64](500), + // MbpsReadWrite: to.Ptr[int64](60), + // DiskTier: to.Ptr("E15"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + // }, + // SizeGB: to.Ptr[int64](512), + // MinimumSupportedDiskCount: to.Ptr[int64](1), + // MaximumSupportedDiskCount: to.Ptr[int64](1), + // IopsReadWrite: to.Ptr[int64](500), + // MbpsReadWrite: to.Ptr[int64](60), + // DiskTier: to.Ptr("E20"), + // }, + // }, + // }, + // "os": &armworkloadssapvirtualinstance.SAPDiskConfiguration{ + // RecommendedConfiguration: &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + // }, + // Count: to.Ptr[int64](1), + // SizeGB: to.Ptr[int64](64), + // }, + // SupportedConfigurations: []*armworkloadssapvirtualinstance.DiskDetails{ + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // SizeGB: to.Ptr[int64](64), + // MinimumSupportedDiskCount: to.Ptr[int64](1), + // MaximumSupportedDiskCount: to.Ptr[int64](1), + // IopsReadWrite: to.Ptr[int64](240), + // MbpsReadWrite: to.Ptr[int64](50), + // DiskTier: to.Ptr("P6"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // SizeGB: to.Ptr[int64](128), + // MinimumSupportedDiskCount: to.Ptr[int64](1), + // MaximumSupportedDiskCount: to.Ptr[int64](1), + // IopsReadWrite: to.Ptr[int64](500), + // MbpsReadWrite: to.Ptr[int64](100), + // DiskTier: to.Ptr("P10"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + // }, + // SizeGB: to.Ptr[int64](64), + // MinimumSupportedDiskCount: to.Ptr[int64](1), + // MaximumSupportedDiskCount: to.Ptr[int64](1), + // IopsReadWrite: to.Ptr[int64](500), + // MbpsReadWrite: to.Ptr[int64](60), + // DiskTier: to.Ptr("P6"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + // }, + // SizeGB: to.Ptr[int64](128), + // MinimumSupportedDiskCount: to.Ptr[int64](1), + // MaximumSupportedDiskCount: to.Ptr[int64](1), + // IopsReadWrite: to.Ptr[int64](500), + // MbpsReadWrite: to.Ptr[int64](60), + // DiskTier: to.Ptr("P10"), + // }, + // }, + // }, + // "backup": &armworkloadssapvirtualinstance.SAPDiskConfiguration{ + // RecommendedConfiguration: &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + // }, + // Count: to.Ptr[int64](2), + // SizeGB: to.Ptr[int64](256), + // }, + // SupportedConfigurations: []*armworkloadssapvirtualinstance.DiskDetails{ + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + // }, + // SizeGB: to.Ptr[int64](128), + // MinimumSupportedDiskCount: to.Ptr[int64](0), + // MaximumSupportedDiskCount: to.Ptr[int64](6), + // IopsReadWrite: to.Ptr[int64](500), + // MbpsReadWrite: to.Ptr[int64](60), + // DiskTier: to.Ptr("E10"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + // }, + // SizeGB: to.Ptr[int64](256), + // MinimumSupportedDiskCount: to.Ptr[int64](0), + // MaximumSupportedDiskCount: to.Ptr[int64](6), + // IopsReadWrite: to.Ptr[int64](500), + // MbpsReadWrite: to.Ptr[int64](60), + // DiskTier: to.Ptr("E15"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), + // }, + // SizeGB: to.Ptr[int64](512), + // MinimumSupportedDiskCount: to.Ptr[int64](0), + // MaximumSupportedDiskCount: to.Ptr[int64](6), + // IopsReadWrite: to.Ptr[int64](500), + // MbpsReadWrite: to.Ptr[int64](60), + // DiskTier: to.Ptr("E20"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // SizeGB: to.Ptr[int64](128), + // MinimumSupportedDiskCount: to.Ptr[int64](0), + // MaximumSupportedDiskCount: to.Ptr[int64](6), + // IopsReadWrite: to.Ptr[int64](500), + // MbpsReadWrite: to.Ptr[int64](100), + // DiskTier: to.Ptr("P10"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // SizeGB: to.Ptr[int64](256), + // MinimumSupportedDiskCount: to.Ptr[int64](0), + // MaximumSupportedDiskCount: to.Ptr[int64](6), + // IopsReadWrite: to.Ptr[int64](1100), + // MbpsReadWrite: to.Ptr[int64](125), + // DiskTier: to.Ptr("P15"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // SizeGB: to.Ptr[int64](512), + // MinimumSupportedDiskCount: to.Ptr[int64](0), + // MaximumSupportedDiskCount: to.Ptr[int64](6), + // IopsReadWrite: to.Ptr[int64](2300), + // MbpsReadWrite: to.Ptr[int64](150), + // DiskTier: to.Ptr("P20"), + // }, + // }, + // }, // }, - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateRegistrationComplete), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_Discover.json -func ExampleSAPVirtualInstancesClient_BeginCreate_registerExistingSapSystemAsVirtualInstanceForSapSolutions() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_InvokeDiskConfigurations_Prod.json +func ExampleSAPVirtualInstancesClient_GetDiskConfigurations_sapDiskConfigurationsForInputEnvironmentProd() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ - Location: to.Ptr("northeurope"), - Tags: map[string]*string{ - "createdby": to.Ptr("abc@microsoft.com"), - "test": to.Ptr("abc"), - }, - Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - Configuration: &armworkloadssapvirtualinstance.DiscoveryConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDiscovery), - CentralServerVMID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"), - }, - Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), - SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - }, + res, err := clientFactory.NewSAPVirtualInstancesClient().GetDiskConfigurations(ctx, "centralus", armworkloadssapvirtualinstance.SAPDiskConfigurationsRequest{ + AppLocation: to.Ptr("eastus"), + SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + DbVMSKU: to.Ptr("Standard_M32ts"), }, 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("Q20"), - // Type: to.Ptr("microsoft.workloads/sapvirtualinstances"), - // ID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/Q20"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-07-27T08:22:52.331Z"); return t}()), - // CreatedBy: to.Ptr("abc@microsoft.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-07-27T11:44:17.931Z"); return t}()), - // LastModifiedBy: to.Ptr("abc@microsoft.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("northeurope"), - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DiscoveryConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDiscovery), - // AppLocation: to.Ptr("westeurope"), - // CentralServerVMID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg-infra/providers/Microsoft.Compute/virtualMachines/q20ascsvm0"), - // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // ManagedResourceGroupConfiguration: &armworkloadssapvirtualinstance.ManagedRGConfiguration{ - // Name: to.Ptr("mrg-Q20-5b0097"), + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientGetDiskConfigurationsResponse{ + // SAPDiskConfigurationsResult: &armworkloadssapvirtualinstance.SAPDiskConfigurationsResult{ + // VolumeConfigurations: map[string]*armworkloadssapvirtualinstance.SAPDiskConfiguration{ + // "hana/data": &armworkloadssapvirtualinstance.SAPDiskConfiguration{ + // RecommendedConfiguration: &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // Count: to.Ptr[int64](4), + // SizeGB: to.Ptr[int64](128), + // }, + // SupportedConfigurations: []*armworkloadssapvirtualinstance.DiskDetails{ + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // SizeGB: to.Ptr[int64](128), + // MinimumSupportedDiskCount: to.Ptr[int64](4), + // MaximumSupportedDiskCount: to.Ptr[int64](5), + // IopsReadWrite: to.Ptr[int64](500), + // MbpsReadWrite: to.Ptr[int64](100), + // DiskTier: to.Ptr("P10"), + // }, + // }, + // }, + // "hana/log": &armworkloadssapvirtualinstance.SAPDiskConfiguration{ + // RecommendedConfiguration: &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // Count: to.Ptr[int64](3), + // SizeGB: to.Ptr[int64](128), + // }, + // SupportedConfigurations: []*armworkloadssapvirtualinstance.DiskDetails{ + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // SizeGB: to.Ptr[int64](128), + // MinimumSupportedDiskCount: to.Ptr[int64](3), + // MaximumSupportedDiskCount: to.Ptr[int64](5), + // IopsReadWrite: to.Ptr[int64](500), + // MbpsReadWrite: to.Ptr[int64](100), + // DiskTier: to.Ptr("P10"), + // }, + // }, + // }, + // "hana/shared": &armworkloadssapvirtualinstance.SAPDiskConfiguration{ + // RecommendedConfiguration: &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // Count: to.Ptr[int64](1), + // SizeGB: to.Ptr[int64](256), + // }, + // SupportedConfigurations: []*armworkloadssapvirtualinstance.DiskDetails{ + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // SizeGB: to.Ptr[int64](256), + // MinimumSupportedDiskCount: to.Ptr[int64](1), + // MaximumSupportedDiskCount: to.Ptr[int64](1), + // IopsReadWrite: to.Ptr[int64](1100), + // MbpsReadWrite: to.Ptr[int64](125), + // DiskTier: to.Ptr("P15"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // SizeGB: to.Ptr[int64](512), + // MinimumSupportedDiskCount: to.Ptr[int64](1), + // MaximumSupportedDiskCount: to.Ptr[int64](1), + // IopsReadWrite: to.Ptr[int64](2300), + // MbpsReadWrite: to.Ptr[int64](150), + // DiskTier: to.Ptr("P20"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // SizeGB: to.Ptr[int64](1024), + // MinimumSupportedDiskCount: to.Ptr[int64](1), + // MaximumSupportedDiskCount: to.Ptr[int64](1), + // IopsReadWrite: to.Ptr[int64](5000), + // MbpsReadWrite: to.Ptr[int64](200), + // DiskTier: to.Ptr("P30"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // SizeGB: to.Ptr[int64](2048), + // MinimumSupportedDiskCount: to.Ptr[int64](1), + // MaximumSupportedDiskCount: to.Ptr[int64](1), + // IopsReadWrite: to.Ptr[int64](7500), + // MbpsReadWrite: to.Ptr[int64](250), + // DiskTier: to.Ptr("P40"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // SizeGB: to.Ptr[int64](4096), + // MinimumSupportedDiskCount: to.Ptr[int64](1), + // MaximumSupportedDiskCount: to.Ptr[int64](1), + // IopsReadWrite: to.Ptr[int64](7500), + // MbpsReadWrite: to.Ptr[int64](250), + // DiskTier: to.Ptr("P50"), + // }, + // }, + // }, + // "usr/sap": &armworkloadssapvirtualinstance.SAPDiskConfiguration{ + // RecommendedConfiguration: &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // Count: to.Ptr[int64](1), + // SizeGB: to.Ptr[int64](128), + // }, + // SupportedConfigurations: []*armworkloadssapvirtualinstance.DiskDetails{ + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // SizeGB: to.Ptr[int64](128), + // MinimumSupportedDiskCount: to.Ptr[int64](1), + // MaximumSupportedDiskCount: to.Ptr[int64](1), + // IopsReadWrite: to.Ptr[int64](500), + // MbpsReadWrite: to.Ptr[int64](100), + // DiskTier: to.Ptr("P10"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // SizeGB: to.Ptr[int64](256), + // MinimumSupportedDiskCount: to.Ptr[int64](1), + // MaximumSupportedDiskCount: to.Ptr[int64](1), + // IopsReadWrite: to.Ptr[int64](1100), + // MbpsReadWrite: to.Ptr[int64](125), + // DiskTier: to.Ptr("P10"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // SizeGB: to.Ptr[int64](512), + // MinimumSupportedDiskCount: to.Ptr[int64](1), + // MaximumSupportedDiskCount: to.Ptr[int64](1), + // IopsReadWrite: to.Ptr[int64](2300), + // MbpsReadWrite: to.Ptr[int64](150), + // DiskTier: to.Ptr("P10"), + // }, + // }, + // }, + // "os": &armworkloadssapvirtualinstance.SAPDiskConfiguration{ + // RecommendedConfiguration: &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // Count: to.Ptr[int64](1), + // SizeGB: to.Ptr[int64](64), + // }, + // SupportedConfigurations: []*armworkloadssapvirtualinstance.DiskDetails{ + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // SizeGB: to.Ptr[int64](64), + // MinimumSupportedDiskCount: to.Ptr[int64](1), + // MaximumSupportedDiskCount: to.Ptr[int64](1), + // IopsReadWrite: to.Ptr[int64](240), + // MbpsReadWrite: to.Ptr[int64](50), + // DiskTier: to.Ptr("P6"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // SizeGB: to.Ptr[int64](128), + // MinimumSupportedDiskCount: to.Ptr[int64](1), + // MaximumSupportedDiskCount: to.Ptr[int64](1), + // IopsReadWrite: to.Ptr[int64](500), + // MbpsReadWrite: to.Ptr[int64](100), + // DiskTier: to.Ptr("P10"), + // }, + // }, + // }, + // "backup": &armworkloadssapvirtualinstance.SAPDiskConfiguration{ + // RecommendedConfiguration: &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // Count: to.Ptr[int64](2), + // SizeGB: to.Ptr[int64](256), + // }, + // SupportedConfigurations: []*armworkloadssapvirtualinstance.DiskDetails{ + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // SizeGB: to.Ptr[int64](128), + // MinimumSupportedDiskCount: to.Ptr[int64](0), + // MaximumSupportedDiskCount: to.Ptr[int64](6), + // IopsReadWrite: to.Ptr[int64](500), + // MbpsReadWrite: to.Ptr[int64](100), + // DiskTier: to.Ptr("P10"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // SizeGB: to.Ptr[int64](256), + // MinimumSupportedDiskCount: to.Ptr[int64](0), + // MaximumSupportedDiskCount: to.Ptr[int64](6), + // IopsReadWrite: to.Ptr[int64](1100), + // MbpsReadWrite: to.Ptr[int64](125), + // DiskTier: to.Ptr("P15"), + // }, + // { + // SKU: &armworkloadssapvirtualinstance.DiskSKU{ + // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), + // }, + // SizeGB: to.Ptr[int64](512), + // MinimumSupportedDiskCount: to.Ptr[int64](0), + // MaximumSupportedDiskCount: to.Ptr[int64](6), + // IopsReadWrite: to.Ptr[int64](2300), + // MbpsReadWrite: to.Ptr[int64](150), + // DiskTier: to.Ptr("P20"), + // }, + // }, + // }, // }, - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateRegistrationComplete), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_Discover_TrustedAccessEnable.json -func ExampleSAPVirtualInstancesClient_BeginCreate_registerWithTrustedAccessEnabled() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_InvokeSapSupportedSku_Distributed.json +func ExampleSAPVirtualInstancesClient_GetSapSupportedSKU_sapSupportedSkUsForDistributedNonHaEnvironment() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.SAPVirtualInstance{ - Location: to.Ptr("northeurope"), - Tags: map[string]*string{ - "createdby": to.Ptr("abc@microsoft.com"), - "test": to.Ptr("abc"), - }, - Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - Configuration: &armworkloadssapvirtualinstance.DiscoveryConfiguration{ - ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDiscovery), - CentralServerVMID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"), - }, - Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), - ManagedResourcesNetworkAccessType: to.Ptr(armworkloadssapvirtualinstance.ManagedResourcesNetworkAccessTypePrivate), - SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - }, + res, err := clientFactory.NewSAPVirtualInstancesClient().GetSapSupportedSKU(ctx, "centralus", armworkloadssapvirtualinstance.SAPSupportedSKUsRequest{ + AppLocation: to.Ptr("eastus"), + SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), }, 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("Q20"), - // Type: to.Ptr("microsoft.workloads/sapvirtualinstances"), - // ID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/Q20"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-07-27T08:22:52.331Z"); return t}()), - // CreatedBy: to.Ptr("abc@microsoft.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-07-27T11:44:17.931Z"); return t}()), - // LastModifiedBy: to.Ptr("abc@microsoft.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("northeurope"), - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DiscoveryConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDiscovery), - // AppLocation: to.Ptr("westeurope"), - // CentralServerVMID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg-infra/providers/Microsoft.Compute/virtualMachines/q20ascsvm0"), - // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // ManagedResourceGroupConfiguration: &armworkloadssapvirtualinstance.ManagedRGConfiguration{ - // Name: to.Ptr("mrg-Q20-5b0097"), + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientGetSapSupportedSKUResponse{ + // SAPSupportedResourceSKUsResult: &armworkloadssapvirtualinstance.SAPSupportedResourceSKUsResult{ + // SupportedSKUs: []*armworkloadssapvirtualinstance.SAPSupportedSKU{ + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(false), + // VMSKU: to.Ptr("Standard_E4ds_v4"), + // }, + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(false), + // VMSKU: to.Ptr("Standard_E8ds_v4"), + // }, + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(false), + // VMSKU: to.Ptr("Standard_E16ds_v4"), + // }, + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(false), + // VMSKU: to.Ptr("Standard_E20ds_v4"), + // }, + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(false), + // VMSKU: to.Ptr("Standard_E32ds_v4"), + // }, + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(false), + // VMSKU: to.Ptr("Standard_E48ds_v4"), + // }, + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(false), + // VMSKU: to.Ptr("Standard_E64ds_v4"), + // }, + // { + // IsAppServerCertified: to.Ptr(false), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M32Is"), + // }, + // { + // IsAppServerCertified: to.Ptr(false), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M32ts"), + // }, + // { + // IsAppServerCertified: to.Ptr(false), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M64Is"), + // }, + // { + // IsAppServerCertified: to.Ptr(false), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M64ms"), + // }, + // { + // IsAppServerCertified: to.Ptr(false), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M64s"), + // }, + // { + // IsAppServerCertified: to.Ptr(false), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M128ms"), + // }, + // { + // IsAppServerCertified: to.Ptr(false), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M128s"), + // }, + // { + // IsAppServerCertified: to.Ptr(false), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M208ms_v2"), + // }, + // { + // IsAppServerCertified: to.Ptr(false), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M208s_v2"), + // }, + // { + // IsAppServerCertified: to.Ptr(false), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M416ms_v2"), + // }, + // { + // IsAppServerCertified: to.Ptr(false), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M416s_v2"), + // }, // }, - // ManagedResourcesNetworkAccessType: to.Ptr(armworkloadssapvirtualinstance.ManagedResourcesNetworkAccessTypePrivate), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateRegistrationComplete), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Get_ACSSInstallationBlocked.json -func ExampleSAPVirtualInstancesClient_Get_sapVirtualInstancesGetWithAcssInstallationBlocked() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_InvokeSapSupportedSku_DistributedHA_AvSet.json +func ExampleSAPVirtualInstancesClient_GetSapSupportedSKU_sapSupportedSkUsForDistributedHaEnvironmentWithAvailabilitySet() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewSAPVirtualInstancesClient().Get(ctx, "test-rg", "X00", nil) + res, err := clientFactory.NewSAPVirtualInstancesClient().GetSapSupportedSKU(ctx, "centralus", armworkloadssapvirtualinstance.SAPSupportedSKUsRequest{ + AppLocation: to.Ptr("eastus"), + SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilitySet), + }, 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](10), - // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId3"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // ID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/galleries/testgallery/images/rhelimagetest/versions/0.0.1"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_D8s_v3"), - // }, - // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId1"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // ID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/galleries/testgallery/images/rhelimagetest/versions/0.0.1"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_D8s_v3"), - // }, - // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId2"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // ID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/galleries/testgallery/images/rhelimagetest/versions/0.0.1"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_D8s_v3"), - // }, - // }, + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientGetSapSupportedSKUResponse{ + // SAPSupportedResourceSKUsResult: &armworkloadssapvirtualinstance.SAPSupportedResourceSKUsResult{ + // SupportedSKUs: []*armworkloadssapvirtualinstance.SAPSupportedSKU{ + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(false), + // VMSKU: to.Ptr("Standard_E4ds_v4"), // }, - // SoftwareConfiguration: &armworkloadssapvirtualinstance.ServiceInitiatedSoftwareConfiguration{ - // SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeServiceInitiated), - // BomURL: to.Ptr("https://myaccount.blob.core.windows.net/mycontainer/myblob"), - // SapBitsStorageAccountID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/ajgupt-test/providers/Microsoft.Storage/storageAccounts/ajguptsavnet"), - // SapFqdn: to.Ptr("sapsystem.contoso.net"), - // SoftwareVersion: to.Ptr("SAP S/4HANA 2020 FPS01"), + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(false), + // VMSKU: to.Ptr("Standard_E8ds_v4"), + // }, + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(false), + // VMSKU: to.Ptr("Standard_E16ds_v4"), + // }, + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(false), + // VMSKU: to.Ptr("Standard_E20ds_v4"), + // }, + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(false), + // VMSKU: to.Ptr("Standard_E32ds_v4"), + // }, + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(false), + // VMSKU: to.Ptr("Standard_E48ds_v4"), + // }, + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(false), + // VMSKU: to.Ptr("Standard_E64ds_v4"), + // }, + // { + // IsAppServerCertified: to.Ptr(false), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M32Is"), + // }, + // { + // IsAppServerCertified: to.Ptr(false), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M32ts"), + // }, + // { + // IsAppServerCertified: to.Ptr(false), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M64Is"), + // }, + // { + // IsAppServerCertified: to.Ptr(false), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M64ms"), + // }, + // { + // IsAppServerCertified: to.Ptr(false), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M64s"), + // }, + // { + // IsAppServerCertified: to.Ptr(false), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M128ms"), + // }, + // { + // IsAppServerCertified: to.Ptr(false), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M128s"), + // }, + // { + // IsAppServerCertified: to.Ptr(false), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M208ms_v2"), + // }, + // { + // IsAppServerCertified: to.Ptr(false), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M208s_v2"), + // }, + // { + // IsAppServerCertified: to.Ptr(false), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M416ms_v2"), + // }, + // { + // IsAppServerCertified: to.Ptr(false), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M416s_v2"), // }, // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // ManagedResourceGroupConfiguration: &armworkloadssapvirtualinstance.ManagedRGConfiguration{ - // Name: to.Ptr("mrg-x00-6d875e77-e412-4d7d-9af4-8895278b4443"), - // }, - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateACSSInstallationBlocked), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Get.json -func ExampleSAPVirtualInstancesClient_Get_sapVirtualInstancesGet() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_InvokeSapSupportedSku_DistributedHA_AvZone.json +func ExampleSAPVirtualInstancesClient_GetSapSupportedSKU_sapSupportedSkusForHaWithAvailabilityZone() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewSAPVirtualInstancesClient().Get(ctx, "test-rg", "X00", nil) + res, err := clientFactory.NewSAPVirtualInstancesClient().GetSapSupportedSKU(ctx, "centralus", armworkloadssapvirtualinstance.SAPSupportedSKUsRequest{ + AppLocation: to.Ptr("eastus"), + SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilityZone), + }, 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](10), - // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId3"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_D8s_v3"), - // }, - // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId1"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_D8s_v3"), - // }, - // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId2"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, - // }, - // }, - // }, - // VMSize: to.Ptr("Standard_D8s_v3"), - // }, - // }, + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientGetSapSupportedSKUResponse{ + // SAPSupportedResourceSKUsResult: &armworkloadssapvirtualinstance.SAPSupportedResourceSKUsResult{ + // SupportedSKUs: []*armworkloadssapvirtualinstance.SAPSupportedSKU{ + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_E32ds_v4"), + // }, + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_E48ds_v4"), + // }, + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_E64ds_v4"), + // }, + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M32Is"), + // }, + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M32ts"), + // }, + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M64Is"), + // }, + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M64ms"), + // }, + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M64s"), + // }, + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M128ms"), + // }, + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M128s"), + // }, + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M208ms_v2"), + // }, + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M208s_v2"), + // }, + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M416ms_v2"), // }, - // SoftwareConfiguration: &armworkloadssapvirtualinstance.ServiceInitiatedSoftwareConfiguration{ - // SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeServiceInitiated), - // BomURL: to.Ptr("https://myaccount.blob.core.windows.net/mycontainer/myblob"), - // SapBitsStorageAccountID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/ajgupt-test/providers/Microsoft.Storage/storageAccounts/ajguptsavnet"), - // SapFqdn: to.Ptr("sapsystem.contoso.net"), - // SoftwareVersion: to.Ptr("SAP S/4HANA 2020 FPS01"), + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M416s_v2"), // }, // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // ManagedResourceGroupConfiguration: &armworkloadssapvirtualinstance.ManagedRGConfiguration{ - // Name: to.Ptr("mrg-x00-6d875e77-e412-4d7d-9af4-8895278b4443"), - // }, - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateRegistrationComplete), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_TrustedAccessEnable_Update.json -func ExampleSAPVirtualInstancesClient_BeginUpdate_sapVirtualInstancesTrustedAccessEnableUpdate() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_InvokeSapSupportedSku_SingleServer.json +func ExampleSAPVirtualInstancesClient_GetSapSupportedSKU_sapSupportedSkUsForSingleServer() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginUpdate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.UpdateSAPVirtualInstanceRequest{ - Identity: &armworkloadssapvirtualinstance.UserAssignedServiceIdentity{ - Type: to.Ptr(armworkloadssapvirtualinstance.ManagedServiceIdentityTypeNone), - }, - Properties: &armworkloadssapvirtualinstance.UpdateSAPVirtualInstanceProperties{ - ManagedResourcesNetworkAccessType: to.Ptr(armworkloadssapvirtualinstance.ManagedResourcesNetworkAccessTypePrivate), - }, - Tags: map[string]*string{ - "key1": to.Ptr("svi1"), - }, + res, err := clientFactory.NewSAPVirtualInstancesClient().GetSapSupportedSKU(ctx, "centralus", armworkloadssapvirtualinstance.SAPSupportedSKUsRequest{ + AppLocation: to.Ptr("eastus"), + SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), + DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeSingleServer), }, 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("svi1"), - // }, - // Identity: &armworkloadssapvirtualinstance.UserAssignedServiceIdentity{ - // Type: to.Ptr(armworkloadssapvirtualinstance.ManagedServiceIdentityTypeNone), - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), - // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), - // ManagedResourceGroupConfiguration: &armworkloadssapvirtualinstance.ManagedRGConfiguration{ - // Name: to.Ptr("mrg-x00-6d875e77-e412-4d7d-9af4-8895278b4443"), + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientGetSapSupportedSKUResponse{ + // SAPSupportedResourceSKUsResult: &armworkloadssapvirtualinstance.SAPSupportedResourceSKUsResult{ + // SupportedSKUs: []*armworkloadssapvirtualinstance.SAPSupportedSKU{ + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(false), + // VMSKU: to.Ptr("Standard_E32ds_v4"), + // }, + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(false), + // VMSKU: to.Ptr("Standard_E48ds_v4"), + // }, + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(false), + // VMSKU: to.Ptr("Standard_E64ds_v4"), + // }, + // { + // IsAppServerCertified: to.Ptr(true), + // IsDatabaseCertified: to.Ptr(true), + // VMSKU: to.Ptr("Standard_M32ts"), + // }, // }, - // ManagedResourcesNetworkAccessType: to.Ptr(armworkloadssapvirtualinstance.ManagedResourcesNetworkAccessTypePrivate), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateInfrastructureDeploymentPending), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusStarting), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Update.json -func ExampleSAPVirtualInstancesClient_BeginUpdate_sapVirtualInstancesUpdate() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_InvokeSizingRecommendations_S4HANA_Distributed.json +func ExampleSAPVirtualInstancesClient_GetSizingRecommendations_sapSizingRecommendationsForNonHaDistributedSystem() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginUpdate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.UpdateSAPVirtualInstanceRequest{ - Identity: &armworkloadssapvirtualinstance.UserAssignedServiceIdentity{ - Type: to.Ptr(armworkloadssapvirtualinstance.ManagedServiceIdentityTypeNone), - }, - Tags: map[string]*string{ - "key1": to.Ptr("svi1"), - }, + res, err := clientFactory.NewSAPVirtualInstancesClient().GetSizingRecommendations(ctx, "centralus", armworkloadssapvirtualinstance.SAPSizingRecommendationRequest{ + AppLocation: to.Ptr("eastus"), + Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + Saps: to.Ptr[int64](20000), + DbMemory: to.Ptr[int64](1024), + DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + DbScaleMethod: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseScaleMethodScaleUp), }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - res, err := poller.PollUntilDone(ctx, nil) + // 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 = armworkloadssapvirtualinstance.SAPVirtualInstancesClientGetSizingRecommendationsResponse{ + // ThreeTierRecommendationResult: &armworkloadssapvirtualinstance.ThreeTierRecommendationResult{ + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + // ApplicationServerVMSKU: to.Ptr("Standard_E8ds_v4"), + // ApplicationServerInstanceCount: to.Ptr[int64](2), + // CentralServerVMSKU: to.Ptr("Standard_E4ds_v4"), + // CentralServerInstanceCount: to.Ptr[int64](1), + // DbVMSKU: to.Ptr("Standard_M64s"), + // DatabaseInstanceCount: to.Ptr[int64](1), + // }, + // } +} + +// Generated from example definition: 2024-09-01/SapVirtualInstances_InvokeSizingRecommendations_S4HANA_HA_AvSet.json +func ExampleSAPVirtualInstancesClient_GetSizingRecommendations_sapSizingRecommendationsForHaWithAvailabilitySet() { + cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSAPVirtualInstancesClient().GetSizingRecommendations(ctx, "centralus", armworkloadssapvirtualinstance.SAPSizingRecommendationRequest{ + AppLocation: to.Ptr("eastus"), + Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + Saps: to.Ptr[int64](75000), + DbMemory: to.Ptr[int64](1024), + DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + DbScaleMethod: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseScaleMethodScaleUp), + HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilitySet), + }, 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.SAPVirtualInstance = armworkloadssapvirtualinstance.SAPVirtualInstance{ - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("svi1"), - // }, - // Identity: &armworkloadssapvirtualinstance.UserAssignedServiceIdentity{ - // Type: to.Ptr(armworkloadssapvirtualinstance.ManagedServiceIdentityTypeNone), - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), - // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), - // ManagedResourceGroupConfiguration: &armworkloadssapvirtualinstance.ManagedRGConfiguration{ - // Name: to.Ptr("mrg-x00-6d875e77-e412-4d7d-9af4-8895278b4443"), - // }, - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateInfrastructureDeploymentPending), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusStarting), + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientGetSizingRecommendationsResponse{ + // ThreeTierRecommendationResult: &armworkloadssapvirtualinstance.ThreeTierRecommendationResult{ + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + // ApplicationServerVMSKU: to.Ptr("Standard_E16ds_v4"), + // ApplicationServerInstanceCount: to.Ptr[int64](3), + // CentralServerVMSKU: to.Ptr("Standard_E8ds_v4"), + // CentralServerInstanceCount: to.Ptr[int64](2), + // DbVMSKU: to.Ptr("Standard_M64s"), + // DatabaseInstanceCount: to.Ptr[int64](2), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Delete.json -func ExampleSAPVirtualInstancesClient_BeginDelete() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_InvokeSizingRecommendations_S4HANA_HA_AvZone.json +func ExampleSAPVirtualInstancesClient_GetSizingRecommendations_sapSizingRecommendationsForHaWithAvailabilityZone() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginDelete(ctx, "test-rg", "X00", nil) + res, err := clientFactory.NewSAPVirtualInstancesClient().GetSizingRecommendations(ctx, "centralus", armworkloadssapvirtualinstance.SAPSizingRecommendationRequest{ + AppLocation: to.Ptr("eastus"), + Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + Saps: to.Ptr[int64](75000), + DbMemory: to.Ptr[int64](1024), + DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + DbScaleMethod: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseScaleMethodScaleUp), + HighAvailabilityType: to.Ptr(armworkloadssapvirtualinstance.SAPHighAvailabilityTypeAvailabilityZone), + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - _, err = poller.PollUntilDone(ctx, nil) + // 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 = armworkloadssapvirtualinstance.SAPVirtualInstancesClientGetSizingRecommendationsResponse{ + // ThreeTierRecommendationResult: &armworkloadssapvirtualinstance.ThreeTierRecommendationResult{ + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + // ApplicationServerVMSKU: to.Ptr("Standard_E8ds_v4"), + // ApplicationServerInstanceCount: to.Ptr[int64](6), + // CentralServerVMSKU: to.Ptr("Standard_E4ds_v4"), + // CentralServerInstanceCount: to.Ptr[int64](2), + // DbVMSKU: to.Ptr("Standard_M64s"), + // DatabaseInstanceCount: to.Ptr[int64](2), + // }, + // } +} + +// Generated from example definition: 2024-09-01/SapVirtualInstances_InvokeSizingRecommendations_S4HANA_SingleServer.json +func ExampleSAPVirtualInstancesClient_GetSizingRecommendations_sapSizingRecommendationsForSingleServer() { + cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSAPVirtualInstancesClient().GetSizingRecommendations(ctx, "centralus", armworkloadssapvirtualinstance.SAPSizingRecommendationRequest{ + AppLocation: to.Ptr("eastus"), + Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeNonProd), + SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeSingleServer), + Saps: to.Ptr[int64](60000), + DbMemory: to.Ptr[int64](2000), + DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + DbScaleMethod: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseScaleMethodScaleUp), + }, 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 = armworkloadssapvirtualinstance.SAPVirtualInstancesClientGetSizingRecommendationsResponse{ + // SingleServerRecommendationResult: &armworkloadssapvirtualinstance.SingleServerRecommendationResult{ + // VMSKU: to.Ptr("Standard_M128s"), + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeSingleServer), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_ListByResourceGroup.json +// Generated from example definition: 2024-09-01/SapVirtualInstances_ListByResourceGroup.json func ExampleSAPVirtualInstancesClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("6d875e77-e412-4d7d-9af4-8895278b4443", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -7361,259 +8699,244 @@ func ExampleSAPVirtualInstancesClient_NewListByResourceGroupPager() { _ = 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.SAPVirtualInstanceList = armworkloadssapvirtualinstance.SAPVirtualInstanceList{ - // Value: []*armworkloadssapvirtualinstance.SAPVirtualInstance{ - // { - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](10), - // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId3"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, + // page = armworkloadssapvirtualinstance.SAPVirtualInstancesClientListByResourceGroupResponse{ + // SAPVirtualInstanceListResult: armworkloadssapvirtualinstance.SAPVirtualInstanceListResult{ + // Value: []*armworkloadssapvirtualinstance.SAPVirtualInstance{ + // { + // Name: to.Ptr("X00"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + // AppResourceGroup: to.Ptr("X00-RG"), + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + // InstanceCount: to.Ptr[int64](10), + // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId3"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_D8s_v3"), // }, - // VMSize: to.Ptr("Standard_D8s_v3"), // }, - // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId1"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, + // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId1"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_D8s_v3"), // }, - // VMSize: to.Ptr("Standard_D8s_v3"), // }, - // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId2"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId2"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_D8s_v3"), // }, - // VMSize: to.Ptr("Standard_D8s_v3"), // }, + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + // }, + // SoftwareConfiguration: &armworkloadssapvirtualinstance.ServiceInitiatedSoftwareConfiguration{ + // BomURL: to.Ptr("https://myaccount.blob.core.windows.net/mycontainer/myblob"), + // SapBitsStorageAccountID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/ajgupt-test/providers/Microsoft.Storage/storageAccounts/ajguptsavnet"), + // SapFqdn: to.Ptr("sapsystem.contoso.net"), + // SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeServiceInitiated), + // SoftwareVersion: to.Ptr("SAP S/4HANA 2020 FPS01"), // }, // }, - // SoftwareConfiguration: &armworkloadssapvirtualinstance.ServiceInitiatedSoftwareConfiguration{ - // SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeServiceInitiated), - // BomURL: to.Ptr("https://myaccount.blob.core.windows.net/mycontainer/myblob"), - // SapBitsStorageAccountID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/ajgupt-test/providers/Microsoft.Storage/storageAccounts/ajguptsavnet"), - // SapFqdn: to.Ptr("sapsystem.contoso.net"), - // SoftwareVersion: to.Ptr("SAP S/4HANA 2020 FPS01"), + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // ManagedResourceGroupConfiguration: &armworkloadssapvirtualinstance.ManagedRGConfiguration{ + // Name: to.Ptr("mrg-x00-6d875e77-e412-4d7d-9af4-8895278b4443"), // }, + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateRegistrationComplete), + // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // ManagedResourceGroupConfiguration: &armworkloadssapvirtualinstance.ManagedRGConfiguration{ - // Name: to.Ptr("mrg-x00-6d875e77-e412-4d7d-9af4-8895278b4443"), + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ // }, - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateRegistrationComplete), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), - // }, - // }, - // { - // Name: to.Ptr("X01"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X01"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](10), - // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId3"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, + // { + // Name: to.Ptr("X01"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X01"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + // AppResourceGroup: to.Ptr("X00-RG"), + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + // InstanceCount: to.Ptr[int64](10), + // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId3"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_D8s_v3"), // }, - // VMSize: to.Ptr("Standard_D8s_v3"), // }, - // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId1"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, + // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId1"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_D8s_v3"), // }, - // VMSize: to.Ptr("Standard_D8s_v3"), // }, - // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId2"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId2"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_D8s_v3"), // }, - // VMSize: to.Ptr("Standard_D8s_v3"), // }, + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + // }, + // SoftwareConfiguration: &armworkloadssapvirtualinstance.ServiceInitiatedSoftwareConfiguration{ + // BomURL: to.Ptr("https://myaccount.blob.core.windows.net/mycontainer/myblob"), + // SapBitsStorageAccountID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/ajgupt-test/providers/Microsoft.Storage/storageAccounts/ajguptsavnet"), + // SapFqdn: to.Ptr("sapsystem.contoso.net"), + // SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeServiceInitiated), + // SoftwareVersion: to.Ptr("SAP S/4HANA 2020 FPS01"), // }, // }, - // SoftwareConfiguration: &armworkloadssapvirtualinstance.ServiceInitiatedSoftwareConfiguration{ - // SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeServiceInitiated), - // BomURL: to.Ptr("https://myaccount.blob.core.windows.net/mycontainer/myblob"), - // SapBitsStorageAccountID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/ajgupt-test/providers/Microsoft.Storage/storageAccounts/ajguptsavnet"), - // SapFqdn: to.Ptr("sapsystem.contoso.net"), - // SoftwareVersion: to.Ptr("SAP S/4HANA 2020 FPS01"), - // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateRegistrationComplete), + // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateRegistrationComplete), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), // }, - // }}, + // }, + // }, // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_ListBySubscription.json +// Generated from example definition: 2024-09-01/SapVirtualInstances_ListBySubscription.json func ExampleSAPVirtualInstancesClient_NewListBySubscriptionPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("6d875e77-e412-4d7d-9af4-8895278b4443", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -7628,263 +8951,323 @@ func ExampleSAPVirtualInstancesClient_NewListBySubscriptionPager() { _ = 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.SAPVirtualInstanceList = armworkloadssapvirtualinstance.SAPVirtualInstanceList{ - // Value: []*armworkloadssapvirtualinstance.SAPVirtualInstance{ - // { - // Name: to.Ptr("X00"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](10), - // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId3"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, + // page = armworkloadssapvirtualinstance.SAPVirtualInstancesClientListBySubscriptionResponse{ + // SAPVirtualInstanceListResult: armworkloadssapvirtualinstance.SAPVirtualInstanceListResult{ + // Value: []*armworkloadssapvirtualinstance.SAPVirtualInstance{ + // { + // Name: to.Ptr("X00"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + // AppResourceGroup: to.Ptr("X00-RG"), + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + // InstanceCount: to.Ptr[int64](10), + // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId3"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_D8s_v3"), // }, - // VMSize: to.Ptr("Standard_D8s_v3"), // }, - // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId1"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, + // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId1"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_D8s_v3"), // }, - // VMSize: to.Ptr("Standard_D8s_v3"), // }, - // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId2"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId2"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_D8s_v3"), // }, - // VMSize: to.Ptr("Standard_D8s_v3"), // }, + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + // }, + // SoftwareConfiguration: &armworkloadssapvirtualinstance.ServiceInitiatedSoftwareConfiguration{ + // BomURL: to.Ptr("https://myaccount.blob.core.windows.net/mycontainer/myblob"), + // SapBitsStorageAccountID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/ajgupt-test/providers/Microsoft.Storage/storageAccounts/ajguptsavnet"), + // SapFqdn: to.Ptr("sapsystem.contoso.net"), + // SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeServiceInitiated), + // SoftwareVersion: to.Ptr("SAP S/4HANA 2020 FPS01"), // }, // }, - // SoftwareConfiguration: &armworkloadssapvirtualinstance.ServiceInitiatedSoftwareConfiguration{ - // SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeServiceInitiated), - // BomURL: to.Ptr("https://myaccount.blob.core.windows.net/mycontainer/myblob"), - // SapBitsStorageAccountID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/ajgupt-test/providers/Microsoft.Storage/storageAccounts/ajguptsavnet"), - // SapFqdn: to.Ptr("sapsystem.contoso.net"), - // SoftwareVersion: to.Ptr("SAP S/4HANA 2020 FPS01"), + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // ManagedResourceGroupConfiguration: &armworkloadssapvirtualinstance.ManagedRGConfiguration{ + // Name: to.Ptr("mrg-x00-6d875e77-e412-4d7d-9af4-8895278b4443"), // }, + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateRegistrationComplete), + // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // ManagedResourceGroupConfiguration: &armworkloadssapvirtualinstance.ManagedRGConfiguration{ - // Name: to.Ptr("mrg-x00-6d875e77-e412-4d7d-9af4-8895278b4443"), + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ // }, - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateRegistrationComplete), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), - // }, - // }, - // { - // Name: to.Ptr("X01"), - // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X01"), - // SystemData: &armworkloadssapvirtualinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // CreatedBy: to.Ptr("user@xyz.com"), - // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), - // LastModifiedBy: to.Ptr("user@xyz.com"), - // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ // }, - // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ - // Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ - // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), - // AppLocation: to.Ptr("eastus"), - // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ - // AppResourceGroup: to.Ptr("X00-RG"), - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ - // InstanceCount: to.Ptr[int64](10), - // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId3"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, + // { + // Name: to.Ptr("X01"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X01"), + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ + // AppLocation: to.Ptr("eastus"), + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), + // InfrastructureConfiguration: &armworkloadssapvirtualinstance.ThreeTierConfiguration{ + // AppResourceGroup: to.Ptr("X00-RG"), + // ApplicationServer: &armworkloadssapvirtualinstance.ApplicationServerConfiguration{ + // InstanceCount: to.Ptr[int64](10), + // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId3"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_D8s_v3"), // }, - // VMSize: to.Ptr("Standard_D8s_v3"), // }, - // }, - // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId1"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, + // CentralServer: &armworkloadssapvirtualinstance.CentralServerConfiguration{ + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId1"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_D8s_v3"), // }, - // VMSize: to.Ptr("Standard_D8s_v3"), // }, - // }, - // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ - // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), - // InstanceCount: to.Ptr[int64](1), - // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId2"), - // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ - // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ - // Offer: to.Ptr("RHEL-SAP"), - // Publisher: to.Ptr("RedHat"), - // SKU: to.Ptr("84sapha-gen2"), - // Version: to.Ptr("latest"), - // }, - // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ - // AdminUsername: to.Ptr("{your-username}"), - // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ - // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), - // DisablePasswordAuthentication: to.Ptr(true), - // SSH: &armworkloadssapvirtualinstance.SSHConfiguration{ - // PublicKeys: []*armworkloadssapvirtualinstance.SSHPublicKey{ - // { - // KeyData: to.Ptr("ssh-rsa public key"), - // }}, + // DatabaseServer: &armworkloadssapvirtualinstance.DatabaseConfiguration{ + // DatabaseType: to.Ptr(armworkloadssapvirtualinstance.SAPDatabaseTypeHANA), + // InstanceCount: to.Ptr[int64](1), + // SubnetID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/vnet1/subnets/subnetId2"), + // VirtualMachineConfiguration: &armworkloadssapvirtualinstance.VirtualMachineConfiguration{ + // ImageReference: &armworkloadssapvirtualinstance.ImageReference{ + // Offer: to.Ptr("RHEL-SAP"), + // Publisher: to.Ptr("RedHat"), + // SKU: to.Ptr("84sapha-gen2"), + // Version: to.Ptr("latest"), + // }, + // OSProfile: &armworkloadssapvirtualinstance.OSProfile{ + // AdminUsername: to.Ptr("{your-username}"), + // OSConfiguration: &armworkloadssapvirtualinstance.LinuxConfiguration{ + // DisablePasswordAuthentication: to.Ptr(true), + // OSType: to.Ptr(armworkloadssapvirtualinstance.OSTypeLinux), + // SSHKeyPair: &armworkloadssapvirtualinstance.SSHKeyPair{ + // PublicKey: to.Ptr("abc"), + // }, // }, // }, + // VMSize: to.Ptr("Standard_D8s_v3"), // }, - // VMSize: to.Ptr("Standard_D8s_v3"), // }, + // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), + // }, + // SoftwareConfiguration: &armworkloadssapvirtualinstance.ServiceInitiatedSoftwareConfiguration{ + // BomURL: to.Ptr("https://myaccount.blob.core.windows.net/mycontainer/myblob"), + // SapBitsStorageAccountID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/ajgupt-test/providers/Microsoft.Storage/storageAccounts/ajguptsavnet"), + // SapFqdn: to.Ptr("sapsystem.contoso.net"), + // SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeServiceInitiated), + // SoftwareVersion: to.Ptr("SAP S/4HANA 2020 FPS01"), // }, // }, - // SoftwareConfiguration: &armworkloadssapvirtualinstance.ServiceInitiatedSoftwareConfiguration{ - // SoftwareInstallationType: to.Ptr(armworkloadssapvirtualinstance.SAPSoftwareInstallationTypeServiceInitiated), - // BomURL: to.Ptr("https://myaccount.blob.core.windows.net/mycontainer/myblob"), - // SapBitsStorageAccountID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/ajgupt-test/providers/Microsoft.Storage/storageAccounts/ajguptsavnet"), - // SapFqdn: to.Ptr("sapsystem.contoso.net"), - // SoftwareVersion: to.Ptr("SAP S/4HANA 2020 FPS01"), - // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateRegistrationComplete), + // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ // }, - // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), - // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateHealthy), - // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), - // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), - // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateRegistrationComplete), - // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusRunning), // }, - // }}, + // }, + // }, // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Start.json -func ExampleSAPVirtualInstancesClient_BeginStart_startTheSapSystem() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_Start.json +func ExampleSAPVirtualInstancesClient_BeginStart_sapVirtualInstancesStart() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginStart(ctx, "test-rg", "X00", &SAPVirtualInstancesClientBeginStartOptions{ + body: &armworkloadssapvirtualinstance.StartRequest{ + StartVM: to.Ptr(true), + }}) + 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 = armworkloadssapvirtualinstance.SAPVirtualInstancesClientStartResponse{ + // OperationStatusResult: &armworkloadssapvirtualinstance.OperationStatusResult{ + // Name: to.Ptr("1e4193c3-206e-4916-b124-1da16175eb0e"), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/operations/locations/centralus/1e4193c3-206e-4916-b124-1da16175eb0e"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), + // Status: to.Ptr("Succeeded"), + // }, + // } +} + +// Generated from example definition: 2024-09-01/SapVirtualInstances_StartWithInfraOperations.json +func ExampleSAPVirtualInstancesClient_BeginStart_sapVirtualInstancesStartWithInfraOperations() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginStart(ctx, "test-rg", "X00", &SAPVirtualInstancesClientBeginStartOptions{ + body: &armworkloadssapvirtualinstance.StartRequest{ + StartVM: to.Ptr(true), + }}) + 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 = armworkloadssapvirtualinstance.SAPVirtualInstancesClientStartResponse{ + // OperationStatusResult: &armworkloadssapvirtualinstance.OperationStatusResult{ + // Name: to.Ptr("1e4193c3-206e-4916-b124-1da16175eb0e"), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/operations/locations/centralus/1e4193c3-206e-4916-b124-1da16175eb0e"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), + // Status: to.Ptr("Succeeded"), + // }, + // } +} + +// Generated from example definition: 2024-09-01/SapVirtualInstances_SoftStop.json +func ExampleSAPVirtualInstancesClient_BeginStop_softStopOfSapVirtualInstancesStop() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginStart(ctx, "test-rg", "X00", &armworkloadssapvirtualinstance.SAPVirtualInstancesClientBeginStartOptions{Body: nil}) + poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginStop(ctx, "test-rg", "X00", &SAPVirtualInstancesClientBeginStopOptions{ + body: &armworkloadssapvirtualinstance.StopRequest{ + SoftStopTimeoutSeconds: to.Ptr[int64](300), + }}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -7895,30 +9278,33 @@ func ExampleSAPVirtualInstancesClient_BeginStart_startTheSapSystem() { // 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.OperationStatusResult = armworkloadssapvirtualinstance.OperationStatusResult{ - // Name: to.Ptr("1e4193c3-206e-4916-b124-1da16175eb0e"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/operations/locations/centralus/1e4193c3-206e-4916-b124-1da16175eb0e"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), - // Status: to.Ptr("Succeeded"), + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientStopResponse{ + // OperationStatusResult: &armworkloadssapvirtualinstance.OperationStatusResult{ + // Name: to.Ptr("1e4193c3-206e-4916-b124-1da16175eb0e"), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/operations/locations/centralus/1e4193c3-206e-4916-b124-1da16175eb0e"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), + // Status: to.Ptr("Succeeded"), + // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Start_WithInfraOperations.json -func ExampleSAPVirtualInstancesClient_BeginStart_startTheVirtualMachinesAndTheSapSystem() { +// Generated from example definition: 2024-09-01/SapVirtualInstances_SoftStopVMAndSystem.json +func ExampleSAPVirtualInstancesClient_BeginStop_softStopTheVirtualMachineSAndTheSapSystemOnIt() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginStart(ctx, "test-rg", "X00", &armworkloadssapvirtualinstance.SAPVirtualInstancesClientBeginStartOptions{Body: &armworkloadssapvirtualinstance.StartRequest{ - StartVM: to.Ptr(true), - }, - }) + poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginStop(ctx, "test-rg", "X00", &SAPVirtualInstancesClientBeginStopOptions{ + body: &armworkloadssapvirtualinstance.StopRequest{ + DeallocateVM: to.Ptr(true), + SoftStopTimeoutSeconds: to.Ptr[int64](300), + }}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -7929,30 +9315,32 @@ func ExampleSAPVirtualInstancesClient_BeginStart_startTheVirtualMachinesAndTheSa // 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.OperationStatusResult = armworkloadssapvirtualinstance.OperationStatusResult{ - // Name: to.Ptr("1e4193c3-206e-4916-b124-1da16175eb0e"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/operations/locations/centralus/1e4193c3-206e-4916-b124-1da16175eb0e"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), - // Status: to.Ptr("Succeeded"), + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientStopResponse{ + // OperationStatusResult: &armworkloadssapvirtualinstance.OperationStatusResult{ + // Name: to.Ptr("1e4193c3-206e-4916-b124-1da16175eb0e"), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/operations/locations/centralus/1e4193c3-206e-4916-b124-1da16175eb0e"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), + // Status: to.Ptr("Succeeded"), + // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Stop.json +// Generated from example definition: 2024-09-01/SapVirtualInstances_Stop.json func ExampleSAPVirtualInstancesClient_BeginStop_sapVirtualInstancesStop() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginStop(ctx, "test-rg", "X00", &armworkloadssapvirtualinstance.SAPVirtualInstancesClientBeginStopOptions{Body: &armworkloadssapvirtualinstance.StopRequest{ - SoftStopTimeoutSeconds: to.Ptr[int64](0), - }, - }) + poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginStop(ctx, "test-rg", "X00", &SAPVirtualInstancesClientBeginStopOptions{ + body: &armworkloadssapvirtualinstance.StopRequest{ + SoftStopTimeoutSeconds: to.Ptr[int64](0), + }}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -7963,31 +9351,144 @@ func ExampleSAPVirtualInstancesClient_BeginStop_sapVirtualInstancesStop() { // 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.OperationStatusResult = armworkloadssapvirtualinstance.OperationStatusResult{ - // Name: to.Ptr("1e4193c3-206e-4916-b124-1da16175eb0e"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/operations/locations/centralus/1e4193c3-206e-4916-b124-1da16175eb0e"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), - // Status: to.Ptr("Succeeded"), + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientStopResponse{ + // OperationStatusResult: &armworkloadssapvirtualinstance.OperationStatusResult{ + // Name: to.Ptr("1e4193c3-206e-4916-b124-1da16175eb0e"), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/operations/locations/centralus/1e4193c3-206e-4916-b124-1da16175eb0e"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), + // Status: to.Ptr("Succeeded"), + // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Stop_WithInfraOperations.json +// Generated from example definition: 2024-09-01/SapVirtualInstances_StopVMAndSystem.json func ExampleSAPVirtualInstancesClient_BeginStop_stopTheVirtualMachineSAndTheSapSystemOnIt() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginStop(ctx, "test-rg", "X00", &SAPVirtualInstancesClientBeginStopOptions{ + body: &armworkloadssapvirtualinstance.StopRequest{ + DeallocateVM: to.Ptr(true), + SoftStopTimeoutSeconds: to.Ptr[int64](0), + }}) + 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 = armworkloadssapvirtualinstance.SAPVirtualInstancesClientStopResponse{ + // OperationStatusResult: &armworkloadssapvirtualinstance.OperationStatusResult{ + // Name: to.Ptr("1e4193c3-206e-4916-b124-1da16175eb0e"), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/operations/locations/centralus/1e4193c3-206e-4916-b124-1da16175eb0e"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), + // Status: to.Ptr("Succeeded"), + // }, + // } +} + +// Generated from example definition: 2024-09-01/SapVirtualInstances_Update.json +func ExampleSAPVirtualInstancesClient_BeginUpdate_sapVirtualInstancesUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginUpdate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.UpdateSAPVirtualInstanceRequest{ + Identity: &armworkloadssapvirtualinstance.SAPVirtualInstanceIdentity{ + Type: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceIdentityTypeNone), + }, + Properties: &armworkloadssapvirtualinstance.UpdateSAPVirtualInstanceProperties{}, + Tags: map[string]*string{ + "key1": to.Ptr("svi1"), + }, + }, 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 = armworkloadssapvirtualinstance.SAPVirtualInstancesClientUpdateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Identity: &armworkloadssapvirtualinstance.SAPVirtualInstanceIdentity{ + // Type: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceIdentityTypeNone), + // }, + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), + // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), + // ManagedResourceGroupConfiguration: &armworkloadssapvirtualinstance.ManagedRGConfiguration{ + // Name: to.Ptr("mrg-x00-6d875e77-e412-4d7d-9af4-8895278b4443"), + // }, + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateInfrastructureDeploymentPending), + // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusStarting), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // "key1": to.Ptr("svi1"), + // }, + // }, + // } +} + +// Generated from example definition: 2024-09-01/SapVirtualInstances_UpdateTrustedAccess.json +func ExampleSAPVirtualInstancesClient_BeginUpdate_sapVirtualInstancesTrustedAccessEnableUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("8e17e36c-42e9-4cd5-a078-7b44883414e0", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginStop(ctx, "test-rg", "X00", &armworkloadssapvirtualinstance.SAPVirtualInstancesClientBeginStopOptions{Body: &armworkloadssapvirtualinstance.StopRequest{ - DeallocateVM: to.Ptr(true), - SoftStopTimeoutSeconds: to.Ptr[int64](0), - }, - }) + poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginUpdate(ctx, "test-rg", "X00", armworkloadssapvirtualinstance.UpdateSAPVirtualInstanceRequest{ + Identity: &armworkloadssapvirtualinstance.SAPVirtualInstanceIdentity{ + Type: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceIdentityTypeNone), + }, + Properties: &armworkloadssapvirtualinstance.UpdateSAPVirtualInstanceProperties{ + ManagedResourcesNetworkAccessType: to.Ptr(armworkloadssapvirtualinstance.ManagedResourcesNetworkAccessTypePrivate), + }, + Tags: map[string]*string{ + "key1": to.Ptr("svi1"), + }, + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -7998,11 +9499,41 @@ func ExampleSAPVirtualInstancesClient_BeginStop_stopTheVirtualMachineSAndTheSapS // 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.OperationStatusResult = armworkloadssapvirtualinstance.OperationStatusResult{ - // Name: to.Ptr("1e4193c3-206e-4916-b124-1da16175eb0e"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:38:07.000Z"); return t}()), - // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/operations/locations/centralus/1e4193c3-206e-4916-b124-1da16175eb0e"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T03:36:07.000Z"); return t}()), - // Status: to.Ptr("Succeeded"), + // res = armworkloadssapvirtualinstance.SAPVirtualInstancesClientUpdateResponse{ + // SAPVirtualInstance: &armworkloadssapvirtualinstance.SAPVirtualInstance{ + // Name: to.Ptr("X00"), + // Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"), + // ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"), + // Identity: &armworkloadssapvirtualinstance.SAPVirtualInstanceIdentity{ + // Type: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceIdentityTypeNone), + // }, + // Location: to.Ptr("westcentralus"), + // Properties: &armworkloadssapvirtualinstance.SAPVirtualInstanceProperties{ + // Configuration: &armworkloadssapvirtualinstance.DeploymentConfiguration{ + // ConfigurationType: to.Ptr(armworkloadssapvirtualinstance.SAPConfigurationTypeDeployment), + // }, + // Environment: to.Ptr(armworkloadssapvirtualinstance.SAPEnvironmentTypeProd), + // Health: to.Ptr(armworkloadssapvirtualinstance.SAPHealthStateUnknown), + // ManagedResourceGroupConfiguration: &armworkloadssapvirtualinstance.ManagedRGConfiguration{ + // Name: to.Ptr("mrg-x00-6d875e77-e412-4d7d-9af4-8895278b4443"), + // }, + // ManagedResourcesNetworkAccessType: to.Ptr(armworkloadssapvirtualinstance.ManagedResourcesNetworkAccessTypePrivate), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningStateSucceeded), + // SapProduct: to.Ptr(armworkloadssapvirtualinstance.SAPProductTypeS4HANA), + // State: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStateInfrastructureDeploymentPending), + // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatusStarting), + // }, + // SystemData: &armworkloadssapvirtualinstance.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // CreatedBy: to.Ptr("user@xyz.com"), + // CreatedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()), + // LastModifiedBy: to.Ptr("user@xyz.com"), + // LastModifiedByType: to.Ptr(armworkloadssapvirtualinstance.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // "key1": to.Ptr("svi1"), + // }, + // }, // } } diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/time_rfc3339.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/time_rfc3339.go index 09e8f6ac88ee..8bb5d8bfeb1d 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/time_rfc3339.go +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/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 armworkloadssapvirtualinstance @@ -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/workloadssapvirtualinstance/armworkloadssapvirtualinstance/tsp-location.yaml b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/tsp-location.yaml new file mode 100644 index 000000000000..7021f253771c --- /dev/null +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/workloads/Workloads.SAPVirtualInstance.Management +commit: 405438c72094a0a43fbcba18a56aa71110b78db8 +repo: Azure/azure-rest-api-specs +additionalDirectories: \ No newline at end of file diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/workloads_client.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/workloads_client.go deleted file mode 100644 index 41f67e9e5343..000000000000 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/workloads_client.go +++ /dev/null @@ -1,309 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armworkloadssapvirtualinstance - -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" -) - -// WorkloadsClient contains the methods for the WorkloadsClient group. -// Don't use this type directly, use NewWorkloadsClient() instead. -type WorkloadsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewWorkloadsClient creates a new instance of WorkloadsClient with the specified values. -// - subscriptionID - The ID of the target subscription. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewWorkloadsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*WorkloadsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &WorkloadsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// SAPAvailabilityZoneDetails - Get the recommended SAP Availability Zone Pair Details for your region. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-10-01-preview -// - location - The name of Azure region. -// - options - WorkloadsClientSAPAvailabilityZoneDetailsOptions contains the optional parameters for the WorkloadsClient.SAPAvailabilityZoneDetails -// method. -func (client *WorkloadsClient) SAPAvailabilityZoneDetails(ctx context.Context, location string, options *WorkloadsClientSAPAvailabilityZoneDetailsOptions) (WorkloadsClientSAPAvailabilityZoneDetailsResponse, error) { - var err error - const operationName = "WorkloadsClient.SAPAvailabilityZoneDetails" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.sapAvailabilityZoneDetailsCreateRequest(ctx, location, options) - if err != nil { - return WorkloadsClientSAPAvailabilityZoneDetailsResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return WorkloadsClientSAPAvailabilityZoneDetailsResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return WorkloadsClientSAPAvailabilityZoneDetailsResponse{}, err - } - resp, err := client.sapAvailabilityZoneDetailsHandleResponse(httpResp) - return resp, err -} - -// sapAvailabilityZoneDetailsCreateRequest creates the SAPAvailabilityZoneDetails request. -func (client *WorkloadsClient) sapAvailabilityZoneDetailsCreateRequest(ctx context.Context, location string, options *WorkloadsClientSAPAvailabilityZoneDetailsOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getAvailabilityZoneDetails" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if location == "" { - return nil, errors.New("parameter location cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.SAPAvailabilityZoneDetails != nil { - if err := runtime.MarshalAsJSON(req, *options.SAPAvailabilityZoneDetails); err != nil { - return nil, err - } - return req, nil - } - return req, nil -} - -// sapAvailabilityZoneDetailsHandleResponse handles the SAPAvailabilityZoneDetails response. -func (client *WorkloadsClient) sapAvailabilityZoneDetailsHandleResponse(resp *http.Response) (WorkloadsClientSAPAvailabilityZoneDetailsResponse, error) { - result := WorkloadsClientSAPAvailabilityZoneDetailsResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.SAPAvailabilityZoneDetailsResult); err != nil { - return WorkloadsClientSAPAvailabilityZoneDetailsResponse{}, err - } - return result, nil -} - -// SAPDiskConfigurations - Get the SAP Disk Configuration Layout prod/non-prod SAP System. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-10-01-preview -// - location - The name of Azure region. -// - options - WorkloadsClientSAPDiskConfigurationsOptions contains the optional parameters for the WorkloadsClient.SAPDiskConfigurations -// method. -func (client *WorkloadsClient) SAPDiskConfigurations(ctx context.Context, location string, options *WorkloadsClientSAPDiskConfigurationsOptions) (WorkloadsClientSAPDiskConfigurationsResponse, error) { - var err error - const operationName = "WorkloadsClient.SAPDiskConfigurations" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.sapDiskConfigurationsCreateRequest(ctx, location, options) - if err != nil { - return WorkloadsClientSAPDiskConfigurationsResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return WorkloadsClientSAPDiskConfigurationsResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return WorkloadsClientSAPDiskConfigurationsResponse{}, err - } - resp, err := client.sapDiskConfigurationsHandleResponse(httpResp) - return resp, err -} - -// sapDiskConfigurationsCreateRequest creates the SAPDiskConfigurations request. -func (client *WorkloadsClient) sapDiskConfigurationsCreateRequest(ctx context.Context, location string, options *WorkloadsClientSAPDiskConfigurationsOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getDiskConfigurations" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if location == "" { - return nil, errors.New("parameter location cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.SAPDiskConfigurations != nil { - if err := runtime.MarshalAsJSON(req, *options.SAPDiskConfigurations); err != nil { - return nil, err - } - return req, nil - } - return req, nil -} - -// sapDiskConfigurationsHandleResponse handles the SAPDiskConfigurations response. -func (client *WorkloadsClient) sapDiskConfigurationsHandleResponse(resp *http.Response) (WorkloadsClientSAPDiskConfigurationsResponse, error) { - result := WorkloadsClientSAPDiskConfigurationsResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.SAPDiskConfigurationsResult); err != nil { - return WorkloadsClientSAPDiskConfigurationsResponse{}, err - } - return result, nil -} - -// SAPSizingRecommendations - Get SAP sizing recommendations by providing input SAPS for application tier and memory required -// for database tier -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-10-01-preview -// - location - The name of Azure region. -// - options - WorkloadsClientSAPSizingRecommendationsOptions contains the optional parameters for the WorkloadsClient.SAPSizingRecommendations -// method. -func (client *WorkloadsClient) SAPSizingRecommendations(ctx context.Context, location string, options *WorkloadsClientSAPSizingRecommendationsOptions) (WorkloadsClientSAPSizingRecommendationsResponse, error) { - var err error - const operationName = "WorkloadsClient.SAPSizingRecommendations" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.sapSizingRecommendationsCreateRequest(ctx, location, options) - if err != nil { - return WorkloadsClientSAPSizingRecommendationsResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return WorkloadsClientSAPSizingRecommendationsResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return WorkloadsClientSAPSizingRecommendationsResponse{}, err - } - resp, err := client.sapSizingRecommendationsHandleResponse(httpResp) - return resp, err -} - -// sapSizingRecommendationsCreateRequest creates the SAPSizingRecommendations request. -func (client *WorkloadsClient) sapSizingRecommendationsCreateRequest(ctx context.Context, location string, options *WorkloadsClientSAPSizingRecommendationsOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getSizingRecommendations" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if location == "" { - return nil, errors.New("parameter location cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.SAPSizingRecommendation != nil { - if err := runtime.MarshalAsJSON(req, *options.SAPSizingRecommendation); err != nil { - return nil, err - } - return req, nil - } - return req, nil -} - -// sapSizingRecommendationsHandleResponse handles the SAPSizingRecommendations response. -func (client *WorkloadsClient) sapSizingRecommendationsHandleResponse(resp *http.Response) (WorkloadsClientSAPSizingRecommendationsResponse, error) { - result := WorkloadsClientSAPSizingRecommendationsResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result); err != nil { - return WorkloadsClientSAPSizingRecommendationsResponse{}, err - } - return result, nil -} - -// SAPSupportedSKU - Get a list of SAP supported SKUs for ASCS, Application and Database tier. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-10-01-preview -// - location - The name of Azure region. -// - options - WorkloadsClientSAPSupportedSKUOptions contains the optional parameters for the WorkloadsClient.SAPSupportedSKU -// method. -func (client *WorkloadsClient) SAPSupportedSKU(ctx context.Context, location string, options *WorkloadsClientSAPSupportedSKUOptions) (WorkloadsClientSAPSupportedSKUResponse, error) { - var err error - const operationName = "WorkloadsClient.SAPSupportedSKU" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.sapSupportedSKUCreateRequest(ctx, location, options) - if err != nil { - return WorkloadsClientSAPSupportedSKUResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return WorkloadsClientSAPSupportedSKUResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return WorkloadsClientSAPSupportedSKUResponse{}, err - } - resp, err := client.sapSupportedSKUHandleResponse(httpResp) - return resp, err -} - -// sapSupportedSKUCreateRequest creates the SAPSupportedSKU request. -func (client *WorkloadsClient) sapSupportedSKUCreateRequest(ctx context.Context, location string, options *WorkloadsClientSAPSupportedSKUOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getSapSupportedSku" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if location == "" { - return nil, errors.New("parameter location cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.SAPSupportedSKU != nil { - if err := runtime.MarshalAsJSON(req, *options.SAPSupportedSKU); err != nil { - return nil, err - } - return req, nil - } - return req, nil -} - -// sapSupportedSKUHandleResponse handles the SAPSupportedSKU response. -func (client *WorkloadsClient) sapSupportedSKUHandleResponse(resp *http.Response) (WorkloadsClientSAPSupportedSKUResponse, error) { - result := WorkloadsClientSAPSupportedSKUResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.SAPSupportedResourceSKUsResult); err != nil { - return WorkloadsClientSAPSupportedSKUResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/workloads_client_example_test.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/workloads_client_example_test.go deleted file mode 100644 index 6df69bcbd252..000000000000 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/workloads_client_example_test.go +++ /dev/null @@ -1,1194 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armworkloadssapvirtualinstance_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPSizingRecommendations_S4HANA_Distributed.json -func ExampleWorkloadsClient_SAPSizingRecommendations_sapSizingRecommendationsS4HanaDistributed() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWorkloadsClient().SAPSizingRecommendations(ctx, "centralus", &armworkloadssapvirtualinstance.WorkloadsClientSAPSizingRecommendationsOptions{SAPSizingRecommendation: 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 = armworkloadssapvirtualinstance.WorkloadsClientSAPSizingRecommendationsResponse{ - // SAPSizingRecommendationResultClassification: &armworkloadssapvirtualinstance.ThreeTierRecommendationResult{ - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServerInstanceCount: to.Ptr[int64](2), - // ApplicationServerVMSKU: to.Ptr("Standard_E8ds_v4"), - // CentralServerInstanceCount: to.Ptr[int64](1), - // CentralServerVMSKU: to.Ptr("Standard_E4ds_v4"), - // DatabaseInstanceCount: to.Ptr[int64](1), - // DbVMSKU: to.Ptr("Standard_M64s"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPSizingRecommendations_S4HANA_HA_AvSet.json -func ExampleWorkloadsClient_SAPSizingRecommendations_sapSizingRecommendationsS4HanaDistributedHaAvSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWorkloadsClient().SAPSizingRecommendations(ctx, "centralus", &armworkloadssapvirtualinstance.WorkloadsClientSAPSizingRecommendationsOptions{SAPSizingRecommendation: 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 = armworkloadssapvirtualinstance.WorkloadsClientSAPSizingRecommendationsResponse{ - // SAPSizingRecommendationResultClassification: &armworkloadssapvirtualinstance.ThreeTierRecommendationResult{ - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServerInstanceCount: to.Ptr[int64](3), - // ApplicationServerVMSKU: to.Ptr("Standard_E16ds_v4"), - // CentralServerInstanceCount: to.Ptr[int64](2), - // CentralServerVMSKU: to.Ptr("Standard_E8ds_v4"), - // DatabaseInstanceCount: to.Ptr[int64](2), - // DbVMSKU: to.Ptr("Standard_M64s"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPSizingRecommendations_S4HANA_HA_AvZone.json -func ExampleWorkloadsClient_SAPSizingRecommendations_sapSizingRecommendationsS4HanaDistributedHaAvZone() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWorkloadsClient().SAPSizingRecommendations(ctx, "centralus", &armworkloadssapvirtualinstance.WorkloadsClientSAPSizingRecommendationsOptions{SAPSizingRecommendation: 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 = armworkloadssapvirtualinstance.WorkloadsClientSAPSizingRecommendationsResponse{ - // SAPSizingRecommendationResultClassification: &armworkloadssapvirtualinstance.ThreeTierRecommendationResult{ - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeThreeTier), - // ApplicationServerInstanceCount: to.Ptr[int64](6), - // ApplicationServerVMSKU: to.Ptr("Standard_E8ds_v4"), - // CentralServerInstanceCount: to.Ptr[int64](2), - // CentralServerVMSKU: to.Ptr("Standard_E4ds_v4"), - // DatabaseInstanceCount: to.Ptr[int64](2), - // DbVMSKU: to.Ptr("Standard_M64s"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPSizingRecommendations_S4HANA_SingleServer.json -func ExampleWorkloadsClient_SAPSizingRecommendations_sapSizingRecommendationsS4HanaSingleServer() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWorkloadsClient().SAPSizingRecommendations(ctx, "centralus", &armworkloadssapvirtualinstance.WorkloadsClientSAPSizingRecommendationsOptions{SAPSizingRecommendation: 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 = armworkloadssapvirtualinstance.WorkloadsClientSAPSizingRecommendationsResponse{ - // SAPSizingRecommendationResultClassification: &armworkloadssapvirtualinstance.SingleServerRecommendationResult{ - // DeploymentType: to.Ptr(armworkloadssapvirtualinstance.SAPDeploymentTypeSingleServer), - // VMSKU: to.Ptr("Standard_M128s"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPSupportedSkus_Distributed.json -func ExampleWorkloadsClient_SAPSupportedSKU_sapSupportedSkusDistributed() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWorkloadsClient().SAPSupportedSKU(ctx, "centralus", &armworkloadssapvirtualinstance.WorkloadsClientSAPSupportedSKUOptions{SAPSupportedSKU: 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.SAPSupportedResourceSKUsResult = armworkloadssapvirtualinstance.SAPSupportedResourceSKUsResult{ - // SupportedSKUs: []*armworkloadssapvirtualinstance.SAPSupportedSKU{ - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(false), - // VMSKU: to.Ptr("Standard_E4ds_v4"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(false), - // VMSKU: to.Ptr("Standard_E8ds_v4"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(false), - // VMSKU: to.Ptr("Standard_E16ds_v4"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(false), - // VMSKU: to.Ptr("Standard_E20ds_v4"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(false), - // VMSKU: to.Ptr("Standard_E32ds_v4"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(false), - // VMSKU: to.Ptr("Standard_E48ds_v4"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(false), - // VMSKU: to.Ptr("Standard_E64ds_v4"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M32Is"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M32ts"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M64Is"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M64ms"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M64s"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M128ms"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M128s"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M208ms_v2"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M208s_v2"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M416ms_v2"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M416s_v2"), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPSupportedSkus_DistributedHA_AvSet.json -func ExampleWorkloadsClient_SAPSupportedSKU_sapSupportedSkusDistributedHaAvSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWorkloadsClient().SAPSupportedSKU(ctx, "centralus", &armworkloadssapvirtualinstance.WorkloadsClientSAPSupportedSKUOptions{SAPSupportedSKU: 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.SAPSupportedResourceSKUsResult = armworkloadssapvirtualinstance.SAPSupportedResourceSKUsResult{ - // SupportedSKUs: []*armworkloadssapvirtualinstance.SAPSupportedSKU{ - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(false), - // VMSKU: to.Ptr("Standard_E4ds_v4"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(false), - // VMSKU: to.Ptr("Standard_E8ds_v4"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(false), - // VMSKU: to.Ptr("Standard_E16ds_v4"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(false), - // VMSKU: to.Ptr("Standard_E20ds_v4"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(false), - // VMSKU: to.Ptr("Standard_E32ds_v4"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(false), - // VMSKU: to.Ptr("Standard_E48ds_v4"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(false), - // VMSKU: to.Ptr("Standard_E64ds_v4"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M32Is"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M32ts"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M64Is"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M64ms"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M64s"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M128ms"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M128s"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M208ms_v2"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M208s_v2"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M416ms_v2"), - // }, - // { - // IsAppServerCertified: to.Ptr(false), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M416s_v2"), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPSupportedSkus_DistributedHA_AvZone.json -func ExampleWorkloadsClient_SAPSupportedSKU_sapSupportedSkusDistributedHaAvZone() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWorkloadsClient().SAPSupportedSKU(ctx, "centralus", &armworkloadssapvirtualinstance.WorkloadsClientSAPSupportedSKUOptions{SAPSupportedSKU: 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.SAPSupportedResourceSKUsResult = armworkloadssapvirtualinstance.SAPSupportedResourceSKUsResult{ - // SupportedSKUs: []*armworkloadssapvirtualinstance.SAPSupportedSKU{ - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_E32ds_v4"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_E48ds_v4"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_E64ds_v4"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M32Is"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M32ts"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M64Is"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M64ms"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M64s"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M128ms"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M128s"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M208ms_v2"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M208s_v2"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M416ms_v2"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M416s_v2"), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPSupportedSkus_SingleServer.json -func ExampleWorkloadsClient_SAPSupportedSKU_sapSupportedSkusSingleServer() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWorkloadsClient().SAPSupportedSKU(ctx, "centralus", &armworkloadssapvirtualinstance.WorkloadsClientSAPSupportedSKUOptions{SAPSupportedSKU: 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.SAPSupportedResourceSKUsResult = armworkloadssapvirtualinstance.SAPSupportedResourceSKUsResult{ - // SupportedSKUs: []*armworkloadssapvirtualinstance.SAPSupportedSKU{ - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(false), - // VMSKU: to.Ptr("Standard_E32ds_v4"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(false), - // VMSKU: to.Ptr("Standard_E48ds_v4"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(false), - // VMSKU: to.Ptr("Standard_E64ds_v4"), - // }, - // { - // IsAppServerCertified: to.Ptr(true), - // IsDatabaseCertified: to.Ptr(true), - // VMSKU: to.Ptr("Standard_M32ts"), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPDiskConfigurations_NonProd.json -func ExampleWorkloadsClient_SAPDiskConfigurations_sapDiskConfigurationsNonProd() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWorkloadsClient().SAPDiskConfigurations(ctx, "centralus", &armworkloadssapvirtualinstance.WorkloadsClientSAPDiskConfigurationsOptions{SAPDiskConfigurations: 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.SAPDiskConfigurationsResult = armworkloadssapvirtualinstance.SAPDiskConfigurationsResult{ - // VolumeConfigurations: map[string]*armworkloadssapvirtualinstance.SAPDiskConfiguration{ - // "backup": &armworkloadssapvirtualinstance.SAPDiskConfiguration{ - // RecommendedConfiguration: &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](2), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - // }, - // }, - // SupportedConfigurations: []*armworkloadssapvirtualinstance.DiskDetails{ - // { - // DiskTier: to.Ptr("E10"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](6), - // MbpsReadWrite: to.Ptr[int64](60), - // MinimumSupportedDiskCount: to.Ptr[int64](0), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("E15"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](6), - // MbpsReadWrite: to.Ptr[int64](60), - // MinimumSupportedDiskCount: to.Ptr[int64](0), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("E20"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](6), - // MbpsReadWrite: to.Ptr[int64](60), - // MinimumSupportedDiskCount: to.Ptr[int64](0), - // SizeGB: to.Ptr[int64](512), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P10"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](6), - // MbpsReadWrite: to.Ptr[int64](100), - // MinimumSupportedDiskCount: to.Ptr[int64](0), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P15"), - // IopsReadWrite: to.Ptr[int64](1100), - // MaximumSupportedDiskCount: to.Ptr[int64](6), - // MbpsReadWrite: to.Ptr[int64](125), - // MinimumSupportedDiskCount: to.Ptr[int64](0), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P20"), - // IopsReadWrite: to.Ptr[int64](2300), - // MaximumSupportedDiskCount: to.Ptr[int64](6), - // MbpsReadWrite: to.Ptr[int64](150), - // MinimumSupportedDiskCount: to.Ptr[int64](0), - // SizeGB: to.Ptr[int64](512), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }}, - // }, - // "hana/data": &armworkloadssapvirtualinstance.SAPDiskConfiguration{ - // RecommendedConfiguration: &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](4), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // SupportedConfigurations: []*armworkloadssapvirtualinstance.DiskDetails{ - // { - // DiskTier: to.Ptr("P10"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](5), - // MbpsReadWrite: to.Ptr[int64](100), - // MinimumSupportedDiskCount: to.Ptr[int64](4), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }}, - // }, - // "hana/log": &armworkloadssapvirtualinstance.SAPDiskConfiguration{ - // RecommendedConfiguration: &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](3), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // SupportedConfigurations: []*armworkloadssapvirtualinstance.DiskDetails{ - // { - // DiskTier: to.Ptr("P10"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](5), - // MbpsReadWrite: to.Ptr[int64](100), - // MinimumSupportedDiskCount: to.Ptr[int64](3), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }}, - // }, - // "hana/shared": &armworkloadssapvirtualinstance.SAPDiskConfiguration{ - // RecommendedConfiguration: &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - // }, - // }, - // SupportedConfigurations: []*armworkloadssapvirtualinstance.DiskDetails{ - // { - // DiskTier: to.Ptr("P15"), - // IopsReadWrite: to.Ptr[int64](1100), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](125), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P20"), - // IopsReadWrite: to.Ptr[int64](2300), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](150), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](512), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P30"), - // IopsReadWrite: to.Ptr[int64](5000), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](200), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](1024), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P40"), - // IopsReadWrite: to.Ptr[int64](7500), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](250), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](2048), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P50"), - // IopsReadWrite: to.Ptr[int64](7500), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](250), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](4096), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("E15"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](60), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("E20"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](60), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](512), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("E30"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](60), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](1024), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("E40"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](60), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](2048), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("E50"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](60), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](4096), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - // }, - // }}, - // }, - // "os": &armworkloadssapvirtualinstance.SAPDiskConfiguration{ - // RecommendedConfiguration: &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](64), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - // }, - // }, - // SupportedConfigurations: []*armworkloadssapvirtualinstance.DiskDetails{ - // { - // DiskTier: to.Ptr("P6"), - // IopsReadWrite: to.Ptr[int64](240), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](50), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](64), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P10"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](100), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P6"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](60), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](64), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P10"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](60), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - // }, - // }}, - // }, - // "usr/sap": &armworkloadssapvirtualinstance.SAPDiskConfiguration{ - // RecommendedConfiguration: &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // SupportedConfigurations: []*armworkloadssapvirtualinstance.DiskDetails{ - // { - // DiskTier: to.Ptr("P10"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](100), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P10"), - // IopsReadWrite: to.Ptr[int64](1100), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](125), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P10"), - // IopsReadWrite: to.Ptr[int64](2300), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](150), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](512), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("E10"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](60), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("E15"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](60), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("E20"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](60), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](512), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNameStandardSSDLRS), - // }, - // }}, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPDiskConfigurations_Prod.json -func ExampleWorkloadsClient_SAPDiskConfigurations_sapDiskConfigurationsProd() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWorkloadsClient().SAPDiskConfigurations(ctx, "centralus", &armworkloadssapvirtualinstance.WorkloadsClientSAPDiskConfigurationsOptions{SAPDiskConfigurations: 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.SAPDiskConfigurationsResult = armworkloadssapvirtualinstance.SAPDiskConfigurationsResult{ - // VolumeConfigurations: map[string]*armworkloadssapvirtualinstance.SAPDiskConfiguration{ - // "backup": &armworkloadssapvirtualinstance.SAPDiskConfiguration{ - // RecommendedConfiguration: &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](2), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // SupportedConfigurations: []*armworkloadssapvirtualinstance.DiskDetails{ - // { - // DiskTier: to.Ptr("P10"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](6), - // MbpsReadWrite: to.Ptr[int64](100), - // MinimumSupportedDiskCount: to.Ptr[int64](0), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P15"), - // IopsReadWrite: to.Ptr[int64](1100), - // MaximumSupportedDiskCount: to.Ptr[int64](6), - // MbpsReadWrite: to.Ptr[int64](125), - // MinimumSupportedDiskCount: to.Ptr[int64](0), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P20"), - // IopsReadWrite: to.Ptr[int64](2300), - // MaximumSupportedDiskCount: to.Ptr[int64](6), - // MbpsReadWrite: to.Ptr[int64](150), - // MinimumSupportedDiskCount: to.Ptr[int64](0), - // SizeGB: to.Ptr[int64](512), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }}, - // }, - // "hana/data": &armworkloadssapvirtualinstance.SAPDiskConfiguration{ - // RecommendedConfiguration: &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](4), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // SupportedConfigurations: []*armworkloadssapvirtualinstance.DiskDetails{ - // { - // DiskTier: to.Ptr("P10"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](5), - // MbpsReadWrite: to.Ptr[int64](100), - // MinimumSupportedDiskCount: to.Ptr[int64](4), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }}, - // }, - // "hana/log": &armworkloadssapvirtualinstance.SAPDiskConfiguration{ - // RecommendedConfiguration: &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](3), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // SupportedConfigurations: []*armworkloadssapvirtualinstance.DiskDetails{ - // { - // DiskTier: to.Ptr("P10"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](5), - // MbpsReadWrite: to.Ptr[int64](100), - // MinimumSupportedDiskCount: to.Ptr[int64](3), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }}, - // }, - // "hana/shared": &armworkloadssapvirtualinstance.SAPDiskConfiguration{ - // RecommendedConfiguration: &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // SupportedConfigurations: []*armworkloadssapvirtualinstance.DiskDetails{ - // { - // DiskTier: to.Ptr("P15"), - // IopsReadWrite: to.Ptr[int64](1100), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](125), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P20"), - // IopsReadWrite: to.Ptr[int64](2300), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](150), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](512), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P30"), - // IopsReadWrite: to.Ptr[int64](5000), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](200), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](1024), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P40"), - // IopsReadWrite: to.Ptr[int64](7500), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](250), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](2048), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P50"), - // IopsReadWrite: to.Ptr[int64](7500), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](250), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](4096), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }}, - // }, - // "os": &armworkloadssapvirtualinstance.SAPDiskConfiguration{ - // RecommendedConfiguration: &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](64), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // SupportedConfigurations: []*armworkloadssapvirtualinstance.DiskDetails{ - // { - // DiskTier: to.Ptr("P6"), - // IopsReadWrite: to.Ptr[int64](240), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](50), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](64), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P10"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](100), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }}, - // }, - // "usr/sap": &armworkloadssapvirtualinstance.SAPDiskConfiguration{ - // RecommendedConfiguration: &armworkloadssapvirtualinstance.DiskVolumeConfiguration{ - // Count: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // SupportedConfigurations: []*armworkloadssapvirtualinstance.DiskDetails{ - // { - // DiskTier: to.Ptr("P10"), - // IopsReadWrite: to.Ptr[int64](500), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](100), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](128), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P10"), - // IopsReadWrite: to.Ptr[int64](1100), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](125), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](256), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }, - // { - // DiskTier: to.Ptr("P10"), - // IopsReadWrite: to.Ptr[int64](2300), - // MaximumSupportedDiskCount: to.Ptr[int64](1), - // MbpsReadWrite: to.Ptr[int64](150), - // MinimumSupportedDiskCount: to.Ptr[int64](1), - // SizeGB: to.Ptr[int64](512), - // SKU: &armworkloadssapvirtualinstance.DiskSKU{ - // Name: to.Ptr(armworkloadssapvirtualinstance.DiskSKUNamePremiumLRS), - // }, - // }}, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPAvailabilityZoneDetails_eastus.json -func ExampleWorkloadsClient_SAPAvailabilityZoneDetails_sapAvailabilityZoneDetailsEastus() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWorkloadsClient().SAPAvailabilityZoneDetails(ctx, "centralus", &armworkloadssapvirtualinstance.WorkloadsClientSAPAvailabilityZoneDetailsOptions{SAPAvailabilityZoneDetails: 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.SAPAvailabilityZoneDetailsResult = armworkloadssapvirtualinstance.SAPAvailabilityZoneDetailsResult{ - // AvailabilityZonePairs: []*armworkloadssapvirtualinstance.SAPAvailabilityZonePair{ - // { - // ZoneA: to.Ptr[int64](1), - // ZoneB: to.Ptr[int64](2), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b1e318cbfd2e239db54c80af5e6aea7fdf658851/specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPAvailabilityZoneDetails_northeurope.json -func ExampleWorkloadsClient_SAPAvailabilityZoneDetails_sapAvailabilityZoneDetailsNortheurope() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWorkloadsClient().SAPAvailabilityZoneDetails(ctx, "centralus", &armworkloadssapvirtualinstance.WorkloadsClientSAPAvailabilityZoneDetailsOptions{SAPAvailabilityZoneDetails: 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.SAPAvailabilityZoneDetailsResult = armworkloadssapvirtualinstance.SAPAvailabilityZoneDetailsResult{ - // AvailabilityZonePairs: []*armworkloadssapvirtualinstance.SAPAvailabilityZonePair{ - // { - // ZoneA: to.Ptr[int64](2), - // ZoneB: to.Ptr[int64](3), - // }}, - // } -}