diff --git a/go.mod b/go.mod index b7c143f771..5e9a213043 100644 --- a/go.mod +++ b/go.mod @@ -4,10 +4,10 @@ go 1.21 require ( github.com/Azure/azure-sdk-for-go v68.0.0+incompatible - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.8.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5 v5.2.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4 v4.2.0 - github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.1.1 + github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.2.0 github.com/Azure/go-autorest/autorest/date v0.3.0 github.com/container-storage-interface/spec v1.9.0 github.com/golang/mock v1.6.0 @@ -45,7 +45,7 @@ require ( require ( github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0 // indirect - github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4 v4.3.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns v1.1.0 // indirect github.com/Azure/go-autorest v14.2.0+incompatible // indirect diff --git a/go.sum b/go.sum index 1fc6d99255..c9da6a27f7 100644 --- a/go.sum +++ b/go.sum @@ -18,26 +18,28 @@ cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiy dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/Azure/azure-sdk-for-go v68.0.0+incompatible h1:fcYLmCpyNYRnvJbPerq7U0hS+6+I79yEDJBqVNcqUzU= github.com/Azure/azure-sdk-for-go v68.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.8.0 h1:9kDVnTz3vbfweTqAUmk/a/pH5pWFCHtvRpHYC0G/dcA= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.8.0/go.mod h1:3Ug6Qzto9anB6mGlEdgYMDF5zHQ+wwhEaYR4s17PHMw= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.0 h1:fb8kj/Dh4CSwgsOzHeZY4Xh68cFVbzXx+ONXGMY//4w= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.0/go.mod h1:uReU2sSxZExRPBAg3qKzmAucSi51+SP1OhohieR821Q= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0 h1:BMAjVKJM0U/CYF27gA0ZMmXGkOcvfFtD0oHVZ1TIPRI= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0/go.mod h1:1fXstnBMas5kzG+S3q8UoJcmyU6nUeunJcMDHcRYHhs= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.0 h1:d81/ng9rET2YqdVkVwkb6EXeRrLJIwyGnJcAlAWKwhs= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.0/go.mod h1:s4kgfzA0covAXNicZHDMN58jExvcng2mC/DepXiF1EI= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5 v5.2.0 h1:PutmjTnIYf/rM5OlNGpAXcL+b2Fa2ErD5IsOjXEHYyg= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5 v5.2.0/go.mod h1:c3iwOnL5Xq5K9ZOvxBrfZYD4pBDNTGK5b7ptkHN6SDs= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4 v4.3.0 h1:U73ZEM5QTwb7x/VrXLTi+sb6Aw9DqFJxOpWuj+pDPfk= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4 v4.3.0/go.mod h1:WpiaNrHqgIy+P5gTYbOA/JuMmxq7uq8onUvVBybjIlI= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.2 h1:mLY+pNLjCUeKhgnAJWAKhEUQM+RJQo2H1fuGSw1Ky1E= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.2/go.mod h1:FbdwsQ2EzwvXxOPcMFYO8ogEc9uMMIj3YkmCdXdAFmk= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v2 v2.0.0 h1:PTFGRSlMKCQelWwxUyYVEUqseBJVemLyqWJjvMyt0do= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v2 v2.0.0/go.mod h1:LRr2FzBTQlONPPa5HREE5+RjSCTXl7BwOvYOaWTqCaI= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managementgroups/armmanagementgroups v1.0.0 h1:pPvTJ1dY0sA35JOeFq6TsY2xj6Z85Yo23Pj4wCCvu4o= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managementgroups/armmanagementgroups v1.0.0/go.mod h1:mLfWfj8v3jfWKsL9G4eoBoXVcsqcIUTapmdKy7uGOp0= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4 v4.2.0 h1:iGj7n4SmssnseLryJRs/0lb4Db129ioYOCPSPC+vEsw= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4 v4.2.0/go.mod h1:qeBrdANBgW4QsU1bF5/9qjrPRwFIt+AnOMxyH5Bwkhk= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns v1.1.0 h1:rR8ZW79lE/ppfXTfiYSnMFv5EzmVuY4pfZWIkscIJ64= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns v1.1.0/go.mod h1:y2zXtLSMM/X5Mfawq0lOftpWn3f4V6OCsRdINsvWBPI= -github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.1.1 h1:7CBQ+Ei8SP2c6ydQTGCCrS35bDxgTMfoP2miAwK++OU= -github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.1.1/go.mod h1:c/wcGeGx5FUPbM/JltUYHZcKmigwyVLJlDq+4HdtXaw= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.2.0 h1:Dd+RhdJn0OTtVGaeDLZpcumkIVCtA/3/Fo42+eoYvVM= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.2.0/go.mod h1:5kakwfW5CjC9KK+Q4wjXAg+ShuIm2mBMua0ZFj2C8PE= github.com/Azure/go-autorest v14.2.0+incompatible h1:V5VMDjClD3GiElqLWO7mz2MxNAK/vTfRHdAubSIPRgs= github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI= diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/CHANGELOG.md index b618676c59..aa30abf373 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/CHANGELOG.md +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/CHANGELOG.md @@ -1,13 +1,43 @@ # Release History +## 1.9.0 (2023-11-06) + +### Breaking Changes +> These changes affect only code written against previous beta versions of `v1.7.0` and `v1.8.0` +* The function `NewTokenCredential` has been removed from the `fake` package. Use a literal `&fake.TokenCredential{}` instead. +* The field `TracingNamespace` in `runtime.PipelineOptions` has been replaced by `TracingOptions`. + +### Bugs Fixed + +* Fixed an issue that could cause some allowed HTTP header values to not show up in logs. +* Include error text instead of error type in traces when the transport returns an error. +* Fixed an issue that could cause an HTTP/2 request to hang when the TCP connection becomes unresponsive. +* Block key and SAS authentication for non TLS protected endpoints. +* Passing a `nil` credential value will no longer cause a panic. Instead, the authentication is skipped. +* Calling `Error` on a zero-value `azcore.ResponseError` will no longer panic. +* Fixed an issue in `fake.PagerResponder[T]` that would cause a trailing error to be omitted when iterating over pages. +* Context values created by `azcore` will no longer flow across disjoint HTTP requests. + +### Other Changes + +* Skip generating trace info for no-op tracers. +* The `clientName` paramater in client constructors has been renamed to `moduleName`. + +## 1.9.0-beta.1 (2023-10-05) + +### Other Changes + +* The beta features for tracing and fakes have been reinstated. + ## 1.8.0 (2023-10-05) ### Features Added -* Added `Claims` and `EnableCAE` fields to `policy.TokenRequestOptions`. -* ARM bearer token policy handles CAE challenges. -* `messaging/CloudEvent` allows you to serialize/deserialize CloudEvents, as described in the CloudEvents 1.0 specification: [link](https://github.com/cloudevents/spec) -* Added functions `FetcherForNextLink` and `EncodeQueryParams` along with `FetcherForNextLinkOptions` to the `runtime` package to centralize creation of `Pager[T].Fetcher` from a next link URL. +* This includes the following features from `v1.8.0-beta.N` releases. + * Claims and CAE for authentication. + * New `messaging` package. + * Various helpers in the `runtime` package. + * Deprecation of `runtime.With*` funcs and their replacements in the `policy` package. * Added types `KeyCredential` and `SASCredential` to the `azcore` package. * Includes their respective constructor functions. * Added types `KeyCredentialPolicy` and `SASCredentialPolicy` to the `azcore/runtime` package. @@ -24,11 +54,24 @@ ### Other Changes +* Updated dependencies. + +## 1.8.0-beta.3 (2023-09-07) + +### Features Added + +* Added function `FetcherForNextLink` and `FetcherForNextLinkOptions` to the `runtime` package to centralize creation of `Pager[T].Fetcher` from a next link URL. + +### Bugs Fixed + +* Suppress creating spans for nested SDK API calls. The HTTP span will be a child of the outer API span. + +### Other Changes + * The following functions in the `runtime` package are now exposed from the `policy` package, and the `runtime` versions have been deprecated. * `WithCaptureResponse` * `WithHTTPHeader` * `WithRetryOptions` -* Updated dependencies. ## 1.7.2 (2023-09-06) @@ -36,12 +79,41 @@ * Fix default HTTP transport to work in WASM modules. +## 1.8.0-beta.2 (2023-08-14) + +### Features Added + +* Added function `SanitizePagerPollerPath` to the `server` package to centralize sanitization and formalize the contract. +* Added `TokenRequestOptions.EnableCAE` to indicate whether to request a CAE token. + +### Breaking Changes + +> This change affects only code written against beta version `v1.8.0-beta.1`. +* `messaging.CloudEvent` deserializes JSON objects as `[]byte`, instead of `json.RawMessage`. See the documentation for CloudEvent.Data for more information. + +> This change affects only code written against beta versions `v1.7.0-beta.2` and `v1.8.0-beta.1`. +* Removed parameter from method `Span.End()` and its type `tracing.SpanEndOptions`. This API GA'ed in `v1.2.0` so we cannot change it. + +### Bugs Fixed + +* Propagate any query parameters when constructing a fake poller and/or injecting next links. + ## 1.7.1 (2023-08-14) ## Bugs Fixed * Enable TLS renegotiation in the default transport policy. +## 1.8.0-beta.1 (2023-07-12) + +### Features Added + +- `messaging/CloudEvent` allows you to serialize/deserialize CloudEvents, as described in the CloudEvents 1.0 specification: [link](https://github.com/cloudevents/spec) + +### Other Changes + +* The beta features for CAE, tracing, and fakes have been reinstated. + ## 1.7.0 (2023-07-12) ### Features Added diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/client.go index aa34575f66..c373cc43fd 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/client.go @@ -28,17 +28,11 @@ type Client struct { // NewClient creates a new Client instance with the provided values. // This client is intended to be used with Azure Resource Manager endpoints. -// - clientName - the fully qualified name of the client ("module/package.Client"); this is used by the telemetry policy and tracing provider. -// if module and package are the same value, the "module/" prefix can be omitted. -// - moduleVersion - the version of the containing module; used by the telemetry policy +// - moduleName - the fully qualified name of the module where the client is defined; used by the telemetry policy and tracing provider. +// - moduleVersion - the semantic version of the module; used by the telemetry policy and tracing provider. // - cred - the TokenCredential used to authenticate the request // - options - optional client configurations; pass nil to accept the default values -func NewClient(clientName, moduleVersion string, cred azcore.TokenCredential, options *ClientOptions) (*Client, error) { - mod, client, err := shared.ExtractModuleName(clientName) - if err != nil { - return nil, err - } - +func NewClient(moduleName, moduleVersion string, cred azcore.TokenCredential, options *ClientOptions) (*Client, error) { if options == nil { options = &ClientOptions{} } @@ -53,12 +47,12 @@ func NewClient(clientName, moduleVersion string, cred azcore.TokenCredential, op if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { ep = c.Endpoint } - pl, err := armruntime.NewPipeline(mod, moduleVersion, cred, runtime.PipelineOptions{}, options) + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, cred, runtime.PipelineOptions{}, options) if err != nil { return nil, err } - tr := options.TracingProvider.NewTracer(client, moduleVersion) + tr := options.TracingProvider.NewTracer(moduleName, moduleVersion) return &Client{ep: ep, pl: pl, tr: tr}, nil } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime/pipeline.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime/pipeline.go index 266c74b17b..302c19cd42 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime/pipeline.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime/pipeline.go @@ -13,6 +13,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" armpolicy "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported" azpolicy "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" azruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) @@ -34,7 +35,7 @@ func NewPipeline(module, version string, cred azcore.TokenCredential, plOpts azr }) perRetry := make([]azpolicy.Policy, len(plOpts.PerRetry), len(plOpts.PerRetry)+1) copy(perRetry, plOpts.PerRetry) - plOpts.PerRetry = append(perRetry, authPolicy) + plOpts.PerRetry = append(perRetry, authPolicy, exported.PolicyFunc(httpTraceNamespacePolicy)) if !options.DisableRPRegistration { regRPOpts := armpolicy.RegistrationOptions{ClientOptions: options.ClientOptions} regPolicy, err := NewRPRegistrationPolicy(cred, ®RPOpts) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime/policy_register_rp.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime/policy_register_rp.go index 7380f02398..83e15949aa 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime/policy_register_rp.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime/policy_register_rp.go @@ -126,12 +126,13 @@ func (r *rpRegistrationPolicy) Do(req *azpolicy.Request) (*http.Response, error) u: r.endpoint, subID: subID, } - if _, err = rpOps.Register(req.Raw().Context(), rp); err != nil { + if _, err = rpOps.Register(&shared.ContextWithDeniedValues{Context: req.Raw().Context()}, rp); err != nil { logRegistrationExit(err) return resp, err } + // RP was registered, however we need to wait for the registration to complete - pollCtx, pollCancel := context.WithTimeout(req.Raw().Context(), r.options.PollingDuration) + pollCtx, pollCancel := context.WithTimeout(&shared.ContextWithDeniedValues{Context: req.Raw().Context()}, r.options.PollingDuration) var lastRegState string for { // get the current registration state diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime/policy_trace_namespace.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime/policy_trace_namespace.go new file mode 100644 index 0000000000..6cea184240 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime/policy_trace_namespace.go @@ -0,0 +1,30 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package runtime + +import ( + "net/http" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/internal/resource" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/tracing" +) + +// httpTraceNamespacePolicy is a policy that adds the az.namespace attribute to the current Span +func httpTraceNamespacePolicy(req *policy.Request) (resp *http.Response, err error) { + rawTracer := req.Raw().Context().Value(shared.CtxWithTracingTracer{}) + if tracer, ok := rawTracer.(tracing.Tracer); ok && tracer.Enabled() { + rt, err := resource.ParseResourceType(req.Raw().URL.Path) + if err == nil { + // add the namespace attribute to the current span + span := tracer.SpanFromContext(req.Raw().Context()) + span.SetAttributes(tracing.Attribute{Key: shared.TracingNamespaceAttrName, Value: rt.Namespace}) + } + } + return req.Next() +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/core.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/core.go index 9f051ba4ae..8eef8633a7 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/core.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/core.go @@ -84,7 +84,9 @@ func IsNullValue[T any](v T) bool { return false } -// ClientOptions contains configuration settings for a client's pipeline. +// ClientOptions contains optional settings for a client's pipeline. +// Instances can be shared across calls to SDK client constructors when uniform configuration is desired. +// Zero-value fields will have their specified default values applied during use. type ClientOptions = policy.ClientOptions // Client is a basic HTTP client. It consists of a pipeline and tracing provider. @@ -93,22 +95,17 @@ type Client struct { tr tracing.Tracer // cached on the client to support shallow copying with new values - tp tracing.Provider - modVer string + tp tracing.Provider + modVer string + namespace string } // NewClient creates a new Client instance with the provided values. -// - clientName - the fully qualified name of the client ("module/package.Client"); this is used by the telemetry policy and tracing provider. -// if module and package are the same value, the "module/" prefix can be omitted. -// - moduleVersion - the semantic version of the containing module; used by the telemetry policy +// - moduleName - the fully qualified name of the module where the client is defined; used by the telemetry policy and tracing provider. +// - moduleVersion - the semantic version of the module; used by the telemetry policy and tracing provider. // - plOpts - pipeline configuration options; can be the zero-value // - options - optional client configurations; pass nil to accept the default values -func NewClient(clientName, moduleVersion string, plOpts runtime.PipelineOptions, options *ClientOptions) (*Client, error) { - mod, client, err := shared.ExtractModuleName(clientName) - if err != nil { - return nil, err - } - +func NewClient(moduleName, moduleVersion string, plOpts runtime.PipelineOptions, options *ClientOptions) (*Client, error) { if options == nil { options = &ClientOptions{} } @@ -119,15 +116,19 @@ func NewClient(clientName, moduleVersion string, plOpts runtime.PipelineOptions, } } - pl := runtime.NewPipeline(mod, moduleVersion, plOpts, options) + pl := runtime.NewPipeline(moduleName, moduleVersion, plOpts, options) - tr := options.TracingProvider.NewTracer(client, moduleVersion) + tr := options.TracingProvider.NewTracer(moduleName, moduleVersion) + if tr.Enabled() && plOpts.Tracing.Namespace != "" { + tr.SetAttributes(tracing.Attribute{Key: shared.TracingNamespaceAttrName, Value: plOpts.Tracing.Namespace}) + } return &Client{ - pl: pl, - tr: tr, - tp: options.TracingProvider, - modVer: moduleVersion, + pl: pl, + tr: tr, + tp: options.TracingProvider, + modVer: moduleVersion, + namespace: plOpts.Tracing.Namespace, }, nil } @@ -146,5 +147,8 @@ func (c *Client) Tracer() tracing.Tracer { // - clientName - the fully qualified name of the client ("package.Client"); this is used by the tracing provider when creating spans func (c *Client) WithClientName(clientName string) *Client { tr := c.tp.NewTracer(clientName, c.modVer) - return &Client{pl: c.pl, tr: tr, tp: c.tp, modVer: c.modVer} + if tr.Enabled() && c.namespace != "" { + tr.SetAttributes(tracing.Attribute{Key: shared.TracingNamespaceAttrName, Value: c.namespace}) + } + return &Client{pl: c.pl, tr: tr, tp: c.tp, modVer: c.modVer, namespace: c.namespace} } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/doc.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/doc.go index 28c64678c7..654a5f4043 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/doc.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/doc.go @@ -253,5 +253,12 @@ When resuming a poller, no IO is performed, and zero-value arguments can be used Resume tokens are unique per service client and operation. Attempting to resume a poller for LRO BeginB() with a token from LRO BeginA() will result in an error. + +# 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. */ package azcore diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported/exported.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported/exported.go index e793b31db2..f2b296b6dc 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported/exported.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported/exported.go @@ -8,6 +8,8 @@ package exported import ( "context" + "encoding/base64" + "fmt" "io" "net/http" "sync/atomic" @@ -78,6 +80,38 @@ type TokenCredential interface { GetToken(ctx context.Context, options TokenRequestOptions) (AccessToken, error) } +// DecodeByteArray will base-64 decode the provided string into v. +// Exported as runtime.DecodeByteArray() +func DecodeByteArray(s string, v *[]byte, format Base64Encoding) error { + if len(s) == 0 { + return nil + } + payload := string(s) + if payload[0] == '"' { + // remove surrounding quotes + payload = payload[1 : len(payload)-1] + } + switch format { + case Base64StdFormat: + decoded, err := base64.StdEncoding.DecodeString(payload) + if err == nil { + *v = decoded + return nil + } + return err + case Base64URLFormat: + // use raw encoding as URL format should not contain any '=' characters + decoded, err := base64.RawURLEncoding.DecodeString(payload) + if err == nil { + *v = decoded + return nil + } + return err + default: + return fmt.Errorf("unrecognized byte array format: %d", format) + } +} + // KeyCredential contains an authentication key used to authenticate to an Azure service. // Exported as azcore.KeyCredential. type KeyCredential struct { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported/pipeline.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported/pipeline.go index c44efd6eff..e45f831ed2 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported/pipeline.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported/pipeline.go @@ -8,10 +8,7 @@ package exported import ( "errors" - "fmt" "net/http" - - "golang.org/x/net/http/httpguts" ) // Policy represents an extensibility point for the Pipeline that can mutate the specified @@ -75,23 +72,6 @@ func (p Pipeline) Do(req *Request) (*http.Response, error) { if req == nil { return nil, errors.New("request cannot be nil") } - // check copied from Transport.roundTrip() - for k, vv := range req.Raw().Header { - if !httpguts.ValidHeaderFieldName(k) { - if req.Raw().Body != nil { - req.Raw().Body.Close() - } - return nil, fmt.Errorf("invalid header field name %q", k) - } - for _, v := range vv { - if !httpguts.ValidHeaderFieldValue(v) { - if req.Raw().Body != nil { - req.Raw().Body.Close() - } - return nil, fmt.Errorf("invalid header field value %q for key %v", v, k) - } - } - } req.policies = p.policies return req.Next() } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported/request.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported/request.go index fa99d1b7ed..659f2a7d2e 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported/request.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported/request.go @@ -8,6 +8,7 @@ package exported import ( "context" + "encoding/base64" "errors" "fmt" "io" @@ -18,6 +19,28 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared" ) +// Base64Encoding is usesd to specify which base-64 encoder/decoder to use when +// encoding/decoding a slice of bytes to/from a string. +// Exported as runtime.Base64Encoding +type Base64Encoding int + +const ( + // Base64StdFormat uses base64.StdEncoding for encoding and decoding payloads. + Base64StdFormat Base64Encoding = 0 + + // Base64URLFormat uses base64.RawURLEncoding for encoding and decoding payloads. + Base64URLFormat Base64Encoding = 1 +) + +// EncodeByteArray will base-64 encode the byte slice v. +// Exported as runtime.EncodeByteArray() +func EncodeByteArray(v []byte, format Base64Encoding) string { + if format == Base64URLFormat { + return base64.RawURLEncoding.EncodeToString(v) + } + return base64.StdEncoding.EncodeToString(v) +} + // Request is an abstraction over the creation of an HTTP request as it passes through the pipeline. // Don't use this type directly, use NewRequest() instead. // Exported as policy.Request. @@ -170,6 +193,14 @@ func (req *Request) Clone(ctx context.Context) *Request { return &r2 } +// WithContext returns a shallow copy of the request with its context changed to ctx. +func (req *Request) WithContext(ctx context.Context) *Request { + r2 := new(Request) + *r2 = *req + r2.req = r2.req.WithContext(ctx) + return r2 +} + // not exported but dependent on Request // PolicyFunc is a type that implements the Policy interface. diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported/response_error.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported/response_error.go index 7df2f88c1c..f243552885 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported/response_error.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported/response_error.go @@ -13,6 +13,7 @@ import ( "net/http" "regexp" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared" "github.com/Azure/azure-sdk-for-go/sdk/internal/exported" ) @@ -25,7 +26,7 @@ func NewResponseError(resp *http.Response) error { } // prefer the error code in the response header - if ec := resp.Header.Get("x-ms-error-code"); ec != "" { + if ec := resp.Header.Get(shared.HeaderXMSErrorCode); ec != "" { respErr.ErrorCode = ec return respErr } @@ -112,33 +113,45 @@ type ResponseError struct { // Error implements the error interface for type ResponseError. // Note that the message contents are not contractual and can change over time. func (e *ResponseError) Error() string { + const separator = "--------------------------------------------------------------------------------" // write the request method and URL with response status code msg := &bytes.Buffer{} - fmt.Fprintf(msg, "%s %s://%s%s\n", e.RawResponse.Request.Method, e.RawResponse.Request.URL.Scheme, e.RawResponse.Request.URL.Host, e.RawResponse.Request.URL.Path) - fmt.Fprintln(msg, "--------------------------------------------------------------------------------") - fmt.Fprintf(msg, "RESPONSE %d: %s\n", e.RawResponse.StatusCode, e.RawResponse.Status) + if e.RawResponse != nil { + if e.RawResponse.Request != nil { + fmt.Fprintf(msg, "%s %s://%s%s\n", e.RawResponse.Request.Method, e.RawResponse.Request.URL.Scheme, e.RawResponse.Request.URL.Host, e.RawResponse.Request.URL.Path) + } else { + fmt.Fprintln(msg, "Request information not available") + } + fmt.Fprintln(msg, separator) + fmt.Fprintf(msg, "RESPONSE %d: %s\n", e.RawResponse.StatusCode, e.RawResponse.Status) + } else { + fmt.Fprintln(msg, "Missing RawResponse") + fmt.Fprintln(msg, separator) + } if e.ErrorCode != "" { fmt.Fprintf(msg, "ERROR CODE: %s\n", e.ErrorCode) } else { fmt.Fprintln(msg, "ERROR CODE UNAVAILABLE") } - fmt.Fprintln(msg, "--------------------------------------------------------------------------------") - body, err := exported.Payload(e.RawResponse, nil) - if err != nil { - // this really shouldn't fail at this point as the response - // body is already cached (it was read in NewResponseError) - fmt.Fprintf(msg, "Error reading response body: %v", err) - } else if len(body) > 0 { - if err := json.Indent(msg, body, "", " "); err != nil { - // failed to pretty-print so just dump it verbatim - fmt.Fprint(msg, string(body)) + if e.RawResponse != nil { + fmt.Fprintln(msg, separator) + body, err := exported.Payload(e.RawResponse, nil) + if err != nil { + // this really shouldn't fail at this point as the response + // body is already cached (it was read in NewResponseError) + fmt.Fprintf(msg, "Error reading response body: %v", err) + } else if len(body) > 0 { + if err := json.Indent(msg, body, "", " "); err != nil { + // failed to pretty-print so just dump it verbatim + fmt.Fprint(msg, string(body)) + } + // the standard library doesn't have a pretty-printer for XML + fmt.Fprintln(msg) + } else { + fmt.Fprintln(msg, "Response contained no body") } - // the standard library doesn't have a pretty-printer for XML - fmt.Fprintln(msg) - } else { - fmt.Fprintln(msg, "Response contained no body") } - fmt.Fprintln(msg, "--------------------------------------------------------------------------------") + fmt.Fprintln(msg, separator) return msg.String() } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/pollers/fake/fake.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/pollers/fake/fake.go new file mode 100644 index 0000000000..2598347186 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/pollers/fake/fake.go @@ -0,0 +1,133 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package fake + +import ( + "context" + "errors" + "fmt" + "net/http" + "strings" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/log" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/pollers" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared" + "github.com/Azure/azure-sdk-for-go/sdk/internal/poller" +) + +// Applicable returns true if the LRO is a fake. +func Applicable(resp *http.Response) bool { + return resp.Header.Get(shared.HeaderFakePollerStatus) != "" +} + +// CanResume returns true if the token can rehydrate this poller type. +func CanResume(token map[string]interface{}) bool { + _, ok := token["fakeURL"] + return ok +} + +// Poller is an LRO poller that uses the Core-Fake-Poller pattern. +type Poller[T any] struct { + pl exported.Pipeline + + resp *http.Response + + // The API name from CtxAPINameKey + APIName string `json:"apiName"` + + // The URL from Core-Fake-Poller header. + FakeURL string `json:"fakeURL"` + + // The LRO's current state. + FakeStatus string `json:"status"` +} + +// lroStatusURLSuffix is the URL path suffix for a faked LRO. +const lroStatusURLSuffix = "/get/fake/status" + +// New creates a new Poller from the provided initial response. +// Pass nil for response to create an empty Poller for rehydration. +func New[T any](pl exported.Pipeline, resp *http.Response) (*Poller[T], error) { + if resp == nil { + log.Write(log.EventLRO, "Resuming Core-Fake-Poller poller.") + return &Poller[T]{pl: pl}, nil + } + + log.Write(log.EventLRO, "Using Core-Fake-Poller poller.") + fakeStatus := resp.Header.Get(shared.HeaderFakePollerStatus) + if fakeStatus == "" { + return nil, errors.New("response is missing Fake-Poller-Status header") + } + + ctxVal := resp.Request.Context().Value(shared.CtxAPINameKey{}) + if ctxVal == nil { + return nil, errors.New("missing value for CtxAPINameKey") + } + + apiName, ok := ctxVal.(string) + if !ok { + return nil, fmt.Errorf("expected string for CtxAPINameKey, the type was %T", ctxVal) + } + + qp := "" + if resp.Request.URL.RawQuery != "" { + qp = "?" + resp.Request.URL.RawQuery + } + + p := &Poller[T]{ + pl: pl, + resp: resp, + APIName: apiName, + // NOTE: any changes to this path format MUST be reflected in SanitizePollerPath() + FakeURL: fmt.Sprintf("%s://%s%s%s%s", resp.Request.URL.Scheme, resp.Request.URL.Host, resp.Request.URL.Path, lroStatusURLSuffix, qp), + FakeStatus: fakeStatus, + } + return p, nil +} + +// Done returns true if the LRO is in a terminal state. +func (p *Poller[T]) Done() bool { + return poller.IsTerminalState(p.FakeStatus) +} + +// Poll retrieves the current state of the LRO. +func (p *Poller[T]) Poll(ctx context.Context) (*http.Response, error) { + ctx = context.WithValue(ctx, shared.CtxAPINameKey{}, p.APIName) + err := pollers.PollHelper(ctx, p.FakeURL, p.pl, func(resp *http.Response) (string, error) { + if !poller.StatusCodeValid(resp) { + p.resp = resp + return "", exported.NewResponseError(resp) + } + fakeStatus := resp.Header.Get(shared.HeaderFakePollerStatus) + if fakeStatus == "" { + return "", errors.New("response is missing Fake-Poller-Status header") + } + p.resp = resp + p.FakeStatus = fakeStatus + return p.FakeStatus, nil + }) + if err != nil { + return nil, err + } + return p.resp, nil +} + +func (p *Poller[T]) Result(ctx context.Context, out *T) error { + if p.resp.StatusCode == http.StatusNoContent { + return nil + } else if poller.Failed(p.FakeStatus) { + return exported.NewResponseError(p.resp) + } + + return pollers.ResultHelper(p.resp, poller.Failed(p.FakeStatus), out) +} + +// SanitizePollerPath removes any fake-appended suffix from a URL's path. +func SanitizePollerPath(path string) string { + return strings.TrimSuffix(path, lroStatusURLSuffix) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared/constants.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared/constants.go index 05e53aa76e..272f06155e 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared/constants.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared/constants.go @@ -7,8 +7,9 @@ package shared const ( - ContentTypeAppJSON = "application/json" - ContentTypeAppXML = "application/xml" + ContentTypeAppJSON = "application/json" + ContentTypeAppXML = "application/xml" + ContentTypeTextPlain = "text/plain" ) const ( @@ -17,20 +18,25 @@ const ( HeaderAzureAsync = "Azure-AsyncOperation" HeaderContentLength = "Content-Length" HeaderContentType = "Content-Type" + HeaderFakePollerStatus = "Fake-Poller-Status" HeaderLocation = "Location" HeaderOperationLocation = "Operation-Location" HeaderRetryAfter = "Retry-After" HeaderUserAgent = "User-Agent" HeaderWWWAuthenticate = "WWW-Authenticate" HeaderXMSClientRequestID = "x-ms-client-request-id" + HeaderXMSRequestID = "x-ms-request-id" + HeaderXMSErrorCode = "x-ms-error-code" ) const BearerTokenPrefix = "Bearer " +const TracingNamespaceAttrName = "az.namespace" + const ( // Module is the name of the calling module used in telemetry data. Module = "azcore" // Version is the semantic version (see http://semver.org) of this module. - Version = "v1.8.0" + Version = "v1.9.0" ) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared/shared.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared/shared.go index 1bf3aca918..16bc105f48 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared/shared.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared/shared.go @@ -14,10 +14,11 @@ import ( "regexp" "strconv" "time" - - "github.com/Azure/azure-sdk-for-go/sdk/internal/errorinfo" ) +// NOTE: when adding a new context key type, it likely needs to be +// added to the deny-list of key types in ContextWithDeniedValues + // CtxWithHTTPHeaderKey is used as a context key for adding/retrieving http.Header. type CtxWithHTTPHeaderKey struct{} @@ -27,6 +28,12 @@ type CtxWithRetryOptionsKey struct{} // CtxWithCaptureResponse is used as a context key for retrieving the raw response. type CtxWithCaptureResponse struct{} +// CtxWithTracingTracer is used as a context key for adding/retrieving tracing.Tracer. +type CtxWithTracingTracer struct{} + +// CtxAPINameKey is used as a context key for adding/retrieving the API name. +type CtxAPINameKey struct{} + // Delay waits for the duration to elapse or the context to be cancelled. func Delay(ctx context.Context, delay time.Duration) error { select { @@ -80,49 +87,21 @@ func ValidateModVer(moduleVersion string) error { return nil } -// ExtractModuleName returns "module", "package.Client" from "module/package.Client" or -// "package", "package.Client" from "package.Client" when there's no "module/" prefix. -// If clientName is malformed, an error is returned. -func ExtractModuleName(clientName string) (string, string, error) { - // uses unnamed capturing for "module", "package.Client", and "package" - regex, err := regexp.Compile(`^(?:([a-z0-9]+)/)?(([a-z0-9]+)\.(?:[A-Za-z0-9]+))$`) - if err != nil { - return "", "", err - } - - matches := regex.FindStringSubmatch(clientName) - if len(matches) < 4 { - return "", "", fmt.Errorf("malformed clientName %s", clientName) - } - - // the first match is the entire string, the second is "module", the third is - // "package.Client" and the fourth is "package". - // if there was no "module/" prefix, the second match will be the empty string - if matches[1] != "" { - return matches[1], matches[2], nil - } - return matches[3], matches[2], nil -} - -// NonRetriableError marks the specified error as non-retriable. -func NonRetriableError(err error) error { - return &nonRetriableError{err} -} - -type nonRetriableError struct { - error -} - -func (p *nonRetriableError) Error() string { - return p.error.Error() +// ContextWithDeniedValues wraps an existing [context.Context], denying access to certain context values. +// Pipeline policies that create new requests to be sent down their own pipeline MUST wrap the caller's +// context with an instance of this type. This is to prevent context values from flowing across disjoint +// requests which can have unintended side-effects. +type ContextWithDeniedValues struct { + context.Context } -func (*nonRetriableError) NonRetriable() { - // marker method -} - -func (p *nonRetriableError) Unwrap() error { - return p.error +// Value implements part of the [context.Context] interface. +// It acts as a deny-list for certain context keys. +func (c *ContextWithDeniedValues) Value(key any) any { + switch key.(type) { + case CtxAPINameKey, CtxWithCaptureResponse, CtxWithHTTPHeaderKey, CtxWithRetryOptionsKey, CtxWithTracingTracer: + return nil + default: + return c.Context.Value(key) + } } - -var _ errorinfo.NonRetriable = (*nonRetriableError)(nil) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/policy/policy.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/policy/policy.go index f73704cf01..d934f1dc5f 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/policy/policy.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/policy/policy.go @@ -29,9 +29,11 @@ type Transporter = exported.Transporter type Request = exported.Request // ClientOptions contains optional settings for a client's pipeline. -// All zero-value fields will be initialized with default values. +// Instances can be shared across calls to SDK client constructors when uniform configuration is desired. +// Zero-value fields will have their specified default values applied during use. type ClientOptions struct { - // APIVersion overrides the default version requested of the service. Set with caution as this package version has not been tested with arbitrary service versions. + // APIVersion overrides the default version requested of the service. + // Set with caution as this package version has not been tested with arbitrary service versions. APIVersion string // Cloud specifies a cloud for the client. The default is Azure Public Cloud. diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/pager.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/pager.go index 8a2e6c61ed..cffe692d7e 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/pager.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/pager.go @@ -10,9 +10,12 @@ import ( "context" "encoding/json" "errors" + "fmt" "net/http" + "reflect" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/tracing" ) // PagingHandler contains the required data for constructing a Pager. @@ -23,12 +26,16 @@ type PagingHandler[T any] struct { // Fetcher fetches the first and subsequent pages. Fetcher func(context.Context, *T) (T, error) + + // Tracer contains the Tracer from the client that's creating the Pager. + Tracer tracing.Tracer } // Pager provides operations for iterating over paged responses. type Pager[T any] struct { current *T handler PagingHandler[T] + tracer tracing.Tracer firstPage bool } @@ -37,6 +44,7 @@ type Pager[T any] struct { func NewPager[T any](handler PagingHandler[T]) *Pager[T] { return &Pager[T]{ handler: handler, + tracer: handler.Tracer, firstPage: true, } } @@ -51,8 +59,6 @@ func (p *Pager[T]) More() bool { // NextPage advances the pager to the next page. func (p *Pager[T]) NextPage(ctx context.Context) (T, error) { - var resp T - var err error if p.current != nil { if p.firstPage { // we get here if it's an LRO-pager, we already have the first page @@ -61,12 +67,16 @@ func (p *Pager[T]) NextPage(ctx context.Context) (T, error) { } else if !p.handler.More(*p.current) { return *new(T), errors.New("no more pages") } - resp, err = p.handler.Fetcher(ctx, p.current) } else { // non-LRO case, first page p.firstPage = false - resp, err = p.handler.Fetcher(ctx, nil) } + + var err error + ctx, endSpan := StartSpan(ctx, fmt.Sprintf("%s.NextPage", shortenTypeName(reflect.TypeOf(*p).Name())), p.tracer, nil) + defer func() { endSpan(err) }() + + resp, err := p.handler.Fetcher(ctx, p.current) if err != nil { return *new(T), err } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/pipeline.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/pipeline.go index 9d9288f53d..6b1f5c083e 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/pipeline.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/pipeline.go @@ -13,9 +13,35 @@ import ( // PipelineOptions contains Pipeline options for SDK developers type PipelineOptions struct { - AllowedHeaders, AllowedQueryParameters []string - APIVersion APIVersionOptions - PerCall, PerRetry []policy.Policy + // AllowedHeaders is the slice of headers to log with their values intact. + // All headers not in the slice will have their values REDACTED. + // Applies to request and response headers. + AllowedHeaders []string + + // AllowedQueryParameters is the slice of query parameters to log with their values intact. + // All query parameters not in the slice will have their values REDACTED. + AllowedQueryParameters []string + + // APIVersion overrides the default version requested of the service. + // Set with caution as this package version has not been tested with arbitrary service versions. + APIVersion APIVersionOptions + + // PerCall contains custom policies to inject into the pipeline. + // Each policy is executed once per request. + PerCall []policy.Policy + + // PerRetry contains custom policies to inject into the pipeline. + // Each policy is executed once per request, and for each retry of that request. + PerRetry []policy.Policy + + // Tracing contains options used to configure distributed tracing. + Tracing TracingOptions +} + +// TracingOptions contains tracing options for SDK developers. +type TracingOptions struct { + // Namespace contains the value to use for the az.namespace span attribute. + Namespace string } // Pipeline represents a primitive for sending HTTP requests and receiving responses. @@ -56,8 +82,10 @@ func NewPipeline(module, version string, plOpts PipelineOptions, options *policy policies = append(policies, NewRetryPolicy(&cp.Retry)) policies = append(policies, plOpts.PerRetry...) policies = append(policies, cp.PerRetryPolicies...) + policies = append(policies, exported.PolicyFunc(httpHeaderPolicy)) + policies = append(policies, newHTTPTracePolicy(cp.Logging.AllowedQueryParams)) policies = append(policies, NewLogPolicy(&cp.Logging)) - policies = append(policies, exported.PolicyFunc(httpHeaderPolicy), exported.PolicyFunc(bodyDownloadPolicy)) + policies = append(policies, exported.PolicyFunc(bodyDownloadPolicy)) transport := cp.Transport if transport == nil { transport = defaultHTTPClient diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_bearer_token.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_bearer_token.go index ff4931cd24..f0f2803559 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_bearer_token.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_bearer_token.go @@ -35,7 +35,7 @@ type acquiringResourceState struct { // acquire acquires or updates the resource; only one // thread/goroutine at a time ever calls this function func acquire(state acquiringResourceState) (newResource exported.AccessToken, newExpiration time.Time, err error) { - tk, err := state.p.cred.GetToken(state.req.Raw().Context(), state.tro) + tk, err := state.p.cred.GetToken(&shared.ContextWithDeniedValues{Context: state.req.Raw().Context()}, state.tro) if err != nil { return exported.AccessToken{}, time.Time{}, err } @@ -73,9 +73,17 @@ func (b *BearerTokenPolicy) authenticateAndAuthorize(req *policy.Request) func(p // Do authorizes a request with a bearer token func (b *BearerTokenPolicy) Do(req *policy.Request) (*http.Response, error) { - if strings.ToLower(req.Raw().URL.Scheme) != "https" { - return nil, shared.NonRetriableError(errors.New("bearer token authentication is not permitted for non TLS protected (https) endpoints")) + // skip adding the authorization header if no TokenCredential was provided. + // this prevents a panic that might be hard to diagnose and allows testing + // against http endpoints that don't require authentication. + if b.cred == nil { + return req.Next() + } + + if err := checkHTTPSForAuth(req); err != nil { + return nil, err } + var err error if b.authzHandler.OnRequest != nil { err = b.authzHandler.OnRequest(req, b.authenticateAndAuthorize(req)) @@ -83,7 +91,7 @@ func (b *BearerTokenPolicy) Do(req *policy.Request) (*http.Response, error) { err = b.authenticateAndAuthorize(req)(policy.TokenRequestOptions{Scopes: b.scopes}) } if err != nil { - return nil, ensureNonRetriable(err) + return nil, errorinfo.NonRetriableError(err) } res, err := req.Next() @@ -99,22 +107,15 @@ func (b *BearerTokenPolicy) Do(req *policy.Request) (*http.Response, error) { } } } - return res, ensureNonRetriable(err) -} - -func ensureNonRetriable(err error) error { - var nre errorinfo.NonRetriable - if err != nil && !errors.As(err, &nre) { - err = btpError{err} + if err != nil { + err = errorinfo.NonRetriableError(err) } - return err + return res, err } -// btpError is a wrapper that ensures RetryPolicy doesn't retry requests BearerTokenPolicy couldn't authorize -type btpError struct { - error +func checkHTTPSForAuth(req *policy.Request) error { + if strings.ToLower(req.Raw().URL.Scheme) != "https" { + return errorinfo.NonRetriableError(errors.New("authenticated requests are not permitted for non TLS protected (https) endpoints")) + } + return nil } - -func (btpError) NonRetriable() {} - -var _ errorinfo.NonRetriable = (*btpError)(nil) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_http_trace.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_http_trace.go new file mode 100644 index 0000000000..3df1c12189 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_http_trace.go @@ -0,0 +1,143 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package runtime + +import ( + "context" + "errors" + "fmt" + "net/http" + "net/url" + "strings" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/tracing" +) + +const ( + attrHTTPMethod = "http.method" + attrHTTPURL = "http.url" + attrHTTPUserAgent = "http.user_agent" + attrHTTPStatusCode = "http.status_code" + + attrAZClientReqID = "az.client_request_id" + attrAZServiceReqID = "az.service_request_id" + + attrNetPeerName = "net.peer.name" +) + +// newHTTPTracePolicy creates a new instance of the httpTracePolicy. +// - allowedQueryParams contains the user-specified query parameters that don't need to be redacted from the trace +func newHTTPTracePolicy(allowedQueryParams []string) exported.Policy { + return &httpTracePolicy{allowedQP: getAllowedQueryParams(allowedQueryParams)} +} + +// httpTracePolicy is a policy that creates a trace for the HTTP request and its response +type httpTracePolicy struct { + allowedQP map[string]struct{} +} + +// Do implements the pipeline.Policy interfaces for the httpTracePolicy type. +func (h *httpTracePolicy) Do(req *policy.Request) (resp *http.Response, err error) { + rawTracer := req.Raw().Context().Value(shared.CtxWithTracingTracer{}) + if tracer, ok := rawTracer.(tracing.Tracer); ok && tracer.Enabled() { + attributes := []tracing.Attribute{ + {Key: attrHTTPMethod, Value: req.Raw().Method}, + {Key: attrHTTPURL, Value: getSanitizedURL(*req.Raw().URL, h.allowedQP)}, + {Key: attrNetPeerName, Value: req.Raw().URL.Host}, + } + + if ua := req.Raw().Header.Get(shared.HeaderUserAgent); ua != "" { + attributes = append(attributes, tracing.Attribute{Key: attrHTTPUserAgent, Value: ua}) + } + if reqID := req.Raw().Header.Get(shared.HeaderXMSClientRequestID); reqID != "" { + attributes = append(attributes, tracing.Attribute{Key: attrAZClientReqID, Value: reqID}) + } + + ctx := req.Raw().Context() + ctx, span := tracer.Start(ctx, "HTTP "+req.Raw().Method, &tracing.SpanOptions{ + Kind: tracing.SpanKindClient, + Attributes: attributes, + }) + + defer func() { + if resp != nil { + span.SetAttributes(tracing.Attribute{Key: attrHTTPStatusCode, Value: resp.StatusCode}) + if resp.StatusCode > 399 { + span.SetStatus(tracing.SpanStatusError, resp.Status) + } + if reqID := resp.Header.Get(shared.HeaderXMSRequestID); reqID != "" { + span.SetAttributes(tracing.Attribute{Key: attrAZServiceReqID, Value: reqID}) + } + } else if err != nil { + var urlErr *url.Error + if errors.As(err, &urlErr) { + // calling *url.Error.Error() will include the unsanitized URL + // which we don't want. in addition, we already have the HTTP verb + // and sanitized URL in the trace so we aren't losing any info + err = urlErr.Err + } + span.SetStatus(tracing.SpanStatusError, err.Error()) + } + span.End() + }() + + req = req.WithContext(ctx) + } + resp, err = req.Next() + return +} + +// StartSpanOptions contains the optional values for StartSpan. +type StartSpanOptions struct { + // for future expansion +} + +// StartSpan starts a new tracing span. +// You must call the returned func to terminate the span. Pass the applicable error +// if the span will exit with an error condition. +// - ctx is the parent context of the newly created context +// - name is the name of the span. this is typically the fully qualified name of an API ("Client.Method") +// - tracer is the client's Tracer for creating spans +// - options contains optional values. pass nil to accept any default values +func StartSpan(ctx context.Context, name string, tracer tracing.Tracer, options *StartSpanOptions) (context.Context, func(error)) { + if !tracer.Enabled() { + return ctx, func(err error) {} + } + + // we MUST propagate the active tracer before returning so that the trace policy can access it + ctx = context.WithValue(ctx, shared.CtxWithTracingTracer{}, tracer) + + const newSpanKind = tracing.SpanKindInternal + if activeSpan := ctx.Value(ctxActiveSpan{}); activeSpan != nil { + // per the design guidelines, if a SDK method Foo() calls SDK method Bar(), + // then the span for Bar() must be suppressed. however, if Bar() makes a REST + // call, then Bar's HTTP span must be a child of Foo's span. + // however, there is an exception to this rule. if the SDK method Foo() is a + // messaging producer/consumer, and it takes a callback that's a SDK method + // Bar(), then the span for Bar() must _not_ be suppressed. + if kind := activeSpan.(tracing.SpanKind); kind == tracing.SpanKindClient || kind == tracing.SpanKindInternal { + return ctx, func(err error) {} + } + } + ctx, span := tracer.Start(ctx, name, &tracing.SpanOptions{ + Kind: newSpanKind, + }) + ctx = context.WithValue(ctx, ctxActiveSpan{}, newSpanKind) + return ctx, func(err error) { + if err != nil { + errType := strings.Replace(fmt.Sprintf("%T", err), "*exported.", "*azcore.", 1) + span.SetStatus(tracing.SpanStatusError, fmt.Sprintf("%s:\n%s", errType, err.Error())) + } + span.End() + } +} + +// ctxActiveSpan is used as a context key for indicating a SDK client span is in progress. +type ctxActiveSpan struct{} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_key_credential.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_key_credential.go index 2e47a5bad0..6f577fa7a9 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_key_credential.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_key_credential.go @@ -40,10 +40,18 @@ func NewKeyCredentialPolicy(cred *exported.KeyCredential, header string, options // Do implementes the Do method on the [policy.Polilcy] interface. func (k *KeyCredentialPolicy) Do(req *policy.Request) (*http.Response, error) { - val := exported.KeyCredentialGet(k.cred) - if k.prefix != "" { - val = k.prefix + val + // skip adding the authorization header if no KeyCredential was provided. + // this prevents a panic that might be hard to diagnose and allows testing + // against http endpoints that don't require authentication. + if k.cred != nil { + if err := checkHTTPSForAuth(req); err != nil { + return nil, err + } + val := exported.KeyCredentialGet(k.cred) + if k.prefix != "" { + val = k.prefix + val + } + req.Raw().Header.Add(k.header, val) } - req.Raw().Header.Add(k.header, val) return req.Next() } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_logging.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_logging.go index 8514f57d5c..f048d7fb53 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_logging.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_logging.go @@ -191,7 +191,8 @@ func (p *logPolicy) writeHeader(b *bytes.Buffer, header http.Header) { } sort.Strings(keys) for _, k := range keys { - value := header.Get(k) + // don't use Get() as it will canonicalize k which might cause a mismatch + value := header[k][0] // redact all header values not in the allow-list if _, ok := p.allowedHeaders[strings.ToLower(k)]; !ok { value = redactedValue diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_retry.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_retry.go index 21fcb39682..04d7bb4ecb 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_retry.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_retry.go @@ -59,15 +59,7 @@ func setDefaults(o *policy.RetryOptions) { } func calcDelay(o policy.RetryOptions, try int32) time.Duration { // try is >=1; never 0 - pow := func(number int64, exponent int32) int64 { // pow is nested helper function - var result int64 = 1 - for n := int32(0); n < exponent; n++ { - result *= number - } - return result - } - - delay := time.Duration(pow(2, try)-1) * o.RetryDelay + delay := time.Duration((1< -1 { + mod = mod[i+1:] + } b.WriteString(formatTelemetry(mod, ver)) b.WriteRune(' ') b.WriteString(platformInfo) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/poller.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/poller.go index 3d029a3d15..c373f68962 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/poller.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/poller.go @@ -13,6 +13,8 @@ import ( "flag" "fmt" "net/http" + "reflect" + "strings" "time" "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported" @@ -20,9 +22,11 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/pollers" "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/pollers/async" "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/pollers/body" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/pollers/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/pollers/loc" "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/pollers/op" "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/tracing" "github.com/Azure/azure-sdk-for-go/sdk/internal/poller" ) @@ -54,6 +58,9 @@ type NewPollerOptions[T any] struct { // Handler[T] contains a custom polling implementation. Handler PollingHandler[T] + + // Tracer contains the Tracer from the client that's creating the Poller. + Tracer tracing.Tracer } // NewPoller creates a Poller based on the provided initial response. @@ -70,6 +77,7 @@ func NewPoller[T any](resp *http.Response, pl exported.Pipeline, options *NewPol op: options.Handler, resp: resp, result: result, + tracer: options.Tracer, }, nil } @@ -83,7 +91,9 @@ func NewPoller[T any](resp *http.Response, pl exported.Pipeline, options *NewPol // determine the polling method var opr PollingHandler[T] var err error - if async.Applicable(resp) { + if fake.Applicable(resp) { + opr, err = fake.New[T](pl, resp) + } else if async.Applicable(resp) { // async poller must be checked first as it can also have a location header opr, err = async.New[T](pl, resp, options.FinalStateVia) } else if op.Applicable(resp) { @@ -110,6 +120,7 @@ func NewPoller[T any](resp *http.Response, pl exported.Pipeline, options *NewPol op: opr, resp: resp, result: result, + tracer: options.Tracer, }, nil } @@ -121,6 +132,9 @@ type NewPollerFromResumeTokenOptions[T any] struct { // Handler[T] contains a custom polling implementation. Handler PollingHandler[T] + + // Tracer contains the Tracer from the client that's creating the Poller. + Tracer tracing.Tracer } // NewPollerFromResumeToken creates a Poller from a resume token string. @@ -147,7 +161,9 @@ func NewPollerFromResumeToken[T any](token string, pl exported.Pipeline, options opr := options.Handler // now rehydrate the poller based on the encoded poller type - if opr != nil { + if fake.CanResume(asJSON) { + opr, _ = fake.New[T](pl, nil) + } else if opr != nil { log.Writef(log.EventLRO, "Resuming custom poller %T.", opr) } else if async.CanResume(asJSON) { opr, _ = async.New[T](pl, nil, "") @@ -166,6 +182,7 @@ func NewPollerFromResumeToken[T any](token string, pl exported.Pipeline, options return &Poller[T]{ op: opr, result: result, + tracer: options.Tracer, }, nil } @@ -188,6 +205,7 @@ type Poller[T any] struct { resp *http.Response err error result *T + tracer tracing.Tracer done bool } @@ -203,7 +221,7 @@ type PollUntilDoneOptions struct { // options: pass nil to accept the default values. // NOTE: the default polling frequency is 30 seconds which works well for most operations. However, some operations might // benefit from a shorter or longer duration. -func (p *Poller[T]) PollUntilDone(ctx context.Context, options *PollUntilDoneOptions) (T, error) { +func (p *Poller[T]) PollUntilDone(ctx context.Context, options *PollUntilDoneOptions) (res T, err error) { if options == nil { options = &PollUntilDoneOptions{} } @@ -212,9 +230,13 @@ func (p *Poller[T]) PollUntilDone(ctx context.Context, options *PollUntilDoneOpt cp.Frequency = 30 * time.Second } + ctx, endSpan := StartSpan(ctx, fmt.Sprintf("%s.PollUntilDone", shortenTypeName(reflect.TypeOf(*p).Name())), p.tracer, nil) + defer func() { endSpan(err) }() + // skip the floor check when executing tests so they don't take so long if isTest := flag.Lookup("test.v"); isTest == nil && cp.Frequency < time.Second { - return *new(T), errors.New("polling frequency minimum is one second") + err = errors.New("polling frequency minimum is one second") + return } start := time.Now() @@ -226,22 +248,24 @@ func (p *Poller[T]) PollUntilDone(ctx context.Context, options *PollUntilDoneOpt // initial check for a retry-after header existing on the initial response if retryAfter := shared.RetryAfter(p.resp); retryAfter > 0 { log.Writef(log.EventLRO, "initial Retry-After delay for %s", retryAfter.String()) - if err := shared.Delay(ctx, retryAfter); err != nil { + if err = shared.Delay(ctx, retryAfter); err != nil { logPollUntilDoneExit(err) - return *new(T), err + return } } } // begin polling the endpoint until a terminal state is reached for { - resp, err := p.Poll(ctx) + var resp *http.Response + resp, err = p.Poll(ctx) if err != nil { logPollUntilDoneExit(err) - return *new(T), err + return } if p.Done() { logPollUntilDoneExit("succeeded") - return p.Result(ctx) + res, err = p.Result(ctx) + return } d := cp.Frequency if retryAfter := shared.RetryAfter(resp); retryAfter > 0 { @@ -252,7 +276,7 @@ func (p *Poller[T]) PollUntilDone(ctx context.Context, options *PollUntilDoneOpt } if err = shared.Delay(ctx, d); err != nil { logPollUntilDoneExit(err) - return *new(T), err + return } } } @@ -261,17 +285,22 @@ func (p *Poller[T]) PollUntilDone(ctx context.Context, options *PollUntilDoneOpt // If Poll succeeds, the poller's state is updated and the HTTP response is returned. // If Poll fails, the poller's state is unmodified and the error is returned. // Calling Poll on an LRO that has reached a terminal state will return the last HTTP response. -func (p *Poller[T]) Poll(ctx context.Context) (*http.Response, error) { +func (p *Poller[T]) Poll(ctx context.Context) (resp *http.Response, err error) { if p.Done() { // the LRO has reached a terminal state, don't poll again - return p.resp, nil + resp = p.resp + return } - resp, err := p.op.Poll(ctx) + + ctx, endSpan := StartSpan(ctx, fmt.Sprintf("%s.Poll", shortenTypeName(reflect.TypeOf(*p).Name())), p.tracer, nil) + defer func() { endSpan(err) }() + + resp, err = p.op.Poll(ctx) if err != nil { - return nil, err + return } p.resp = resp - return p.resp, nil + return } // Done returns true if the LRO has reached a terminal state. @@ -284,31 +313,40 @@ func (p *Poller[T]) Done() bool { // If the LRO completed successfully, a populated instance of T is returned. // If the LRO failed or was canceled, an *azcore.ResponseError error is returned. // Calling this on an LRO in a non-terminal state will return an error. -func (p *Poller[T]) Result(ctx context.Context) (T, error) { +func (p *Poller[T]) Result(ctx context.Context) (res T, err error) { if !p.Done() { - return *new(T), errors.New("poller is in a non-terminal state") + err = errors.New("poller is in a non-terminal state") + return } if p.done { // the result has already been retrieved, return the cached value if p.err != nil { - return *new(T), p.err + err = p.err + return } - return *p.result, nil + res = *p.result + return } - err := p.op.Result(ctx, p.result) + + ctx, endSpan := StartSpan(ctx, fmt.Sprintf("%s.Result", shortenTypeName(reflect.TypeOf(*p).Name())), p.tracer, nil) + defer func() { endSpan(err) }() + + err = p.op.Result(ctx, p.result) var respErr *exported.ResponseError if errors.As(err, &respErr) { // the LRO failed. record the error p.err = err } else if err != nil { // the call to Result failed, don't cache anything in this case - return *new(T), err + return } p.done = true if p.err != nil { - return *new(T), p.err + err = p.err + return } - return *p.result, nil + res = *p.result + return } // ResumeToken returns a value representing the poller that can be used to resume @@ -325,3 +363,22 @@ func (p *Poller[T]) ResumeToken() (string, error) { } return tk, err } + +// extracts the type name from the string returned from reflect.Value.Name() +func shortenTypeName(s string) string { + // the value is formatted as follows + // Poller[module/Package.Type].Method + // we want to shorten the generic type parameter string to Type + // anything we don't recognize will be left as-is + begin := strings.Index(s, "[") + end := strings.Index(s, "]") + if begin == -1 || end == -1 { + return s + } + + typeName := s[begin+1 : end] + if i := strings.LastIndex(typeName, "."); i > -1 { + typeName = typeName[i+1:] + } + return s[:begin+1] + typeName + s[end:] +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/request.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/request.go index b7e6fb26f9..e97223da29 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/request.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/request.go @@ -9,18 +9,14 @@ package runtime import ( "bytes" "context" - "encoding/base64" "encoding/json" "encoding/xml" "fmt" "io" "mime/multipart" "net/url" - "os" "path" - "reflect" "strings" - "time" "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported" "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared" @@ -29,14 +25,14 @@ import ( // Base64Encoding is usesd to specify which base-64 encoder/decoder to use when // encoding/decoding a slice of bytes to/from a string. -type Base64Encoding int +type Base64Encoding = exported.Base64Encoding const ( // Base64StdFormat uses base64.StdEncoding for encoding and decoding payloads. - Base64StdFormat Base64Encoding = 0 + Base64StdFormat Base64Encoding = exported.Base64StdFormat // Base64URLFormat uses base64.RawURLEncoding for encoding and decoding payloads. - Base64URLFormat Base64Encoding = 1 + Base64URLFormat Base64Encoding = exported.Base64URLFormat ) // NewRequest creates a new policy.Request with the specified input. @@ -93,10 +89,7 @@ func JoinPaths(root string, paths ...string) string { // EncodeByteArray will base-64 encode the byte slice v. func EncodeByteArray(v []byte, format Base64Encoding) string { - if format == Base64URLFormat { - return base64.RawURLEncoding.EncodeToString(v) - } - return base64.StdEncoding.EncodeToString(v) + return exported.EncodeByteArray(v, format) } // MarshalAsByteArray will base-64 encode the byte slice v, then calls SetBody. @@ -109,9 +102,6 @@ func MarshalAsByteArray(req *policy.Request, v []byte, format Base64Encoding) er // MarshalAsJSON calls json.Marshal() to get the JSON encoding of v then calls SetBody. func MarshalAsJSON(req *policy.Request, v interface{}) error { - if omit := os.Getenv("AZURE_SDK_GO_OMIT_READONLY"); omit == "true" { - v = cloneWithoutReadOnlyFields(v) - } b, err := json.Marshal(v) if err != nil { return fmt.Errorf("error marshalling type %T: %s", v, err) @@ -183,80 +173,5 @@ func SkipBodyDownload(req *policy.Request) { req.SetOperationValue(bodyDownloadPolicyOpValues{Skip: true}) } -// returns a clone of the object graph pointed to by v, omitting values of all read-only -// fields. if there are no read-only fields in the object graph, no clone is created. -func cloneWithoutReadOnlyFields(v interface{}) interface{} { - val := reflect.Indirect(reflect.ValueOf(v)) - if val.Kind() != reflect.Struct { - // not a struct, skip - return v - } - // first walk the graph to find any R/O fields. - // if there aren't any, skip cloning the graph. - if !recursiveFindReadOnlyField(val) { - return v - } - return recursiveCloneWithoutReadOnlyFields(val) -} - -// returns true if any field in the object graph of val contains the `azure:"ro"` tag value -func recursiveFindReadOnlyField(val reflect.Value) bool { - t := val.Type() - // iterate over the fields, looking for the "azure" tag. - for i := 0; i < t.NumField(); i++ { - field := t.Field(i) - aztag := field.Tag.Get("azure") - if azureTagIsReadOnly(aztag) { - return true - } else if reflect.Indirect(val.Field(i)).Kind() == reflect.Struct && recursiveFindReadOnlyField(reflect.Indirect(val.Field(i))) { - return true - } - } - return false -} - -// clones the object graph of val. all non-R/O properties are copied to the clone -func recursiveCloneWithoutReadOnlyFields(val reflect.Value) interface{} { - t := val.Type() - clone := reflect.New(t) - // iterate over the fields, looking for the "azure" tag. - for i := 0; i < t.NumField(); i++ { - field := t.Field(i) - aztag := field.Tag.Get("azure") - if azureTagIsReadOnly(aztag) { - // omit from payload - continue - } - // clone field will receive the same value as the source field... - value := val.Field(i) - v := reflect.Indirect(value) - if v.IsValid() && v.Type() != reflect.TypeOf(time.Time{}) && v.Kind() == reflect.Struct { - // ...unless the source value is a struct, in which case we recurse to clone that struct. - // (We can't recursively clone time.Time because it contains unexported fields.) - c := recursiveCloneWithoutReadOnlyFields(v) - if field.Anonymous { - // NOTE: this does not handle the case of embedded fields of unexported struct types. - // this should be ok as we don't generate any code like this at present - value = reflect.Indirect(reflect.ValueOf(c)) - } else { - value = reflect.ValueOf(c) - } - } - reflect.Indirect(clone).Field(i).Set(value) - } - return clone.Interface() -} - -// returns true if the "azure" tag contains the option "ro" -func azureTagIsReadOnly(tag string) bool { - if tag == "" { - return false - } - parts := strings.Split(tag, ",") - for _, part := range parts { - if part == "ro" { - return true - } - } - return false -} +// CtxAPINameKey is used as a context key for adding/retrieving the API name. +type CtxAPINameKey = shared.CtxAPINameKey diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/response.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/response.go index d1f58e9e29..003c875b1f 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/response.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/response.go @@ -8,13 +8,13 @@ package runtime import ( "bytes" - "encoding/base64" "encoding/json" "encoding/xml" "fmt" "io" "net/http" + azexported "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported" "github.com/Azure/azure-sdk-for-go/sdk/internal/exported" ) @@ -105,31 +105,5 @@ func removeBOM(resp *http.Response) error { // DecodeByteArray will base-64 decode the provided string into v. func DecodeByteArray(s string, v *[]byte, format Base64Encoding) error { - if len(s) == 0 { - return nil - } - payload := string(s) - if payload[0] == '"' { - // remove surrounding quotes - payload = payload[1 : len(payload)-1] - } - switch format { - case Base64StdFormat: - decoded, err := base64.StdEncoding.DecodeString(payload) - if err == nil { - *v = decoded - return nil - } - return err - case Base64URLFormat: - // use raw encoding as URL format should not contain any '=' characters - decoded, err := base64.RawURLEncoding.DecodeString(payload) - if err == nil { - *v = decoded - return nil - } - return err - default: - return fmt.Errorf("unrecognized byte array format: %d", format) - } + return azexported.DecodeByteArray(s, v, format) } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/transport_default_http_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/transport_default_http_client.go index 589d09f2c0..2124c1d48b 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/transport_default_http_client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/transport_default_http_client.go @@ -11,6 +11,8 @@ import ( "net" "net/http" "time" + + "golang.org/x/net/http2" ) var defaultHTTPClient *http.Client @@ -24,6 +26,7 @@ func init() { }), ForceAttemptHTTP2: true, MaxIdleConns: 100, + MaxIdleConnsPerHost: 10, IdleConnTimeout: 90 * time.Second, TLSHandshakeTimeout: 10 * time.Second, ExpectContinueTimeout: 1 * time.Second, @@ -32,6 +35,13 @@ func init() { Renegotiation: tls.RenegotiateFreelyAsClient, }, } + // TODO: evaluate removing this once https://github.com/golang/go/issues/59690 has been fixed + if http2Transport, err := http2.ConfigureTransports(defaultTransport); err == nil { + // if the connection has been idle for 10 seconds, send a ping frame for a health check + http2Transport.ReadIdleTimeout = 10 * time.Second + // if there's no response to the ping within the timeout, the connection will be closed + http2Transport.PingTimeout = 5 * time.Second + } defaultHTTPClient = &http.Client{ Transport: defaultTransport, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/tracing/tracing.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/tracing/tracing.go index 75f757cedd..1ade7c560f 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/tracing/tracing.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/tracing/tracing.go @@ -31,12 +31,12 @@ type Provider struct { newTracerFn func(name, version string) Tracer } -// NewTracer creates a new Tracer for the specified name and version. -// - name - the name of the tracer object, typically the fully qualified name of the service client -// - version - the version of the module in which the service client resides -func (p Provider) NewTracer(name, version string) (tracer Tracer) { +// NewTracer creates a new Tracer for the specified module name and version. +// - module - the fully qualified name of the module +// - version - the version of the module +func (p Provider) NewTracer(module, version string) (tracer Tracer) { if p.newTracerFn != nil { - tracer = p.newTracerFn(name, version) + tracer = p.newTracerFn(module, version) } return } @@ -45,21 +45,28 @@ func (p Provider) NewTracer(name, version string) (tracer Tracer) { // TracerOptions contains the optional values when creating a Tracer. type TracerOptions struct { - // for future expansion + // SpanFromContext contains the implementation for the Tracer.SpanFromContext method. + SpanFromContext func(context.Context) Span } // NewTracer creates a Tracer with the specified values. // - newSpanFn is the underlying implementation for creating Span instances // - options contains optional values; pass nil to accept the default value func NewTracer(newSpanFn func(ctx context.Context, spanName string, options *SpanOptions) (context.Context, Span), options *TracerOptions) Tracer { + if options == nil { + options = &TracerOptions{} + } return Tracer{ - newSpanFn: newSpanFn, + newSpanFn: newSpanFn, + spanFromContextFn: options.SpanFromContext, } } // Tracer is the factory that creates Span instances. type Tracer struct { - newSpanFn func(ctx context.Context, spanName string, options *SpanOptions) (context.Context, Span) + attrs []Attribute + newSpanFn func(ctx context.Context, spanName string, options *SpanOptions) (context.Context, Span) + spanFromContextFn func(ctx context.Context) Span } // Start creates a new span and a context.Context that contains it. @@ -68,11 +75,37 @@ type Tracer struct { // - options contains optional values for the span, pass nil to accept any defaults func (t Tracer) Start(ctx context.Context, spanName string, options *SpanOptions) (context.Context, Span) { if t.newSpanFn != nil { - return t.newSpanFn(ctx, spanName, options) + opts := SpanOptions{} + if options != nil { + opts = *options + } + opts.Attributes = append(opts.Attributes, t.attrs...) + return t.newSpanFn(ctx, spanName, &opts) } return ctx, Span{} } +// SetAttributes sets attrs to be applied to each Span. If a key from attrs +// already exists for an attribute of the Span it will be overwritten with +// the value contained in attrs. +func (t *Tracer) SetAttributes(attrs ...Attribute) { + t.attrs = append(t.attrs, attrs...) +} + +// Enabled returns true if this Tracer is capable of creating Spans. +func (t Tracer) Enabled() bool { + return t.newSpanFn != nil +} + +// SpanFromContext returns the Span associated with the current context. +// If the provided context has no Span, false is returned. +func (t Tracer) SpanFromContext(ctx context.Context) Span { + if t.spanFromContextFn != nil { + return t.spanFromContextFn(ctx) + } + return Span{} +} + // SpanOptions contains optional settings for creating a span. type SpanOptions struct { // Kind indicates the kind of Span. @@ -97,9 +130,6 @@ type SpanImpl struct { // AddEvent contains the implementation for the Span.AddEvent method. AddEvent func(string, ...Attribute) - // AddError contains the implementation for the Span.AddError method. - AddError func(err error) - // SetStatus contains the implementation for the Span.SetStatus method. SetStatus func(SpanStatus, string) } @@ -140,13 +170,6 @@ func (s Span) AddEvent(name string, attrs ...Attribute) { } } -// AddError adds the specified error event to the span. -func (s Span) AddError(err error) { - if s.impl.AddError != nil { - s.impl.AddError(err) - } -} - // SetStatus sets the status on the span along with a description. func (s Span) SetStatus(code SpanStatus, desc string) { if s.impl.SetStatus != nil { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/internal/errorinfo/errorinfo.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/internal/errorinfo/errorinfo.go index ade7b348e3..8ee66b5267 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/internal/errorinfo/errorinfo.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/internal/errorinfo/errorinfo.go @@ -14,3 +14,33 @@ type NonRetriable interface { error NonRetriable() } + +// NonRetriableError marks the specified error as non-retriable. +// This function takes an error as input and returns a new error that is marked as non-retriable. +func NonRetriableError(err error) error { + return &nonRetriableError{err} +} + +// nonRetriableError is a struct that embeds the error interface. +// It is used to represent errors that should not be retried. +type nonRetriableError struct { + error +} + +// Error method for nonRetriableError struct. +// It returns the error message of the embedded error. +func (p *nonRetriableError) Error() string { + return p.error.Error() +} + +// NonRetriable is a marker method for nonRetriableError struct. +// Non-functional and indicates that the error is non-retriable. +func (*nonRetriableError) NonRetriable() { + // marker method +} + +// Unwrap method for nonRetriableError struct. +// It returns the original error that was marked as non-retriable. +func (p *nonRetriableError) Unwrap() error { + return p.error +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/CHANGELOG.md index 5a20e9c9b9..7186a65f14 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/CHANGELOG.md +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/CHANGELOG.md @@ -1,5 +1,29 @@ # Release History +## 1.2.0 (2023-11-24) +### Features Added + +- Support for test fakes and OpenTelemetry trace spans. + + +## 1.2.0-beta.3 (2023-10-09) + +### Other Changes + +- Updated to latest `azcore` beta. + +## 1.2.0-beta.2 (2023-07-19) + +### Bug Fixes + +- Fixed a potential panic in faked paged and long-running operations. + +## 1.2.0-beta.1 (2023-06-12) + +### Features Added + +- Support for test fakes and OpenTelemetry trace spans. + ## 1.1.1 (2023-04-14) ### Bug Fixes diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/README.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/README.md index 675c52705c..fbe11f6c64 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/README.md +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/README.md @@ -60,8 +60,16 @@ A client groups a set of related APIs, providing access to its functionality. C client := clientFactory.NewClient() ``` +## 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. + ## More sample code +- [Creating a Fake](https://github.com/Azure/azure-sdk-for-go/blob/main/sdk/resourcemanager/resources/armresources/fake_example_test.go) - [Deployment](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/resource/deployment) - [Provider](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/resource/provider) - [Resource Group](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/resource/resourcegroups) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/autorest.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/autorest.md index 2767ecb00d..58dea419a4 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/autorest.md +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/autorest.md @@ -8,6 +8,6 @@ require: - https://github.com/Azure/azure-rest-api-specs/blob/4fd842fb73656039ec94ce367bcedee25a57bd18/specification/resources/resource-manager/readme.md - https://github.com/Azure/azure-rest-api-specs/blob/4fd842fb73656039ec94ce367bcedee25a57bd18/specification/resources/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.1.1 +module-version: 1.2.0 package-resources: true -``` \ No newline at end of file +``` diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/client.go index 4d78cab137..46fde2c78c 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/client.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armresources @@ -34,7 +33,7 @@ type Client struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*Client, error) { - cl, err := arm.NewClient(moduleName+".Client", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -56,18 +55,24 @@ func NewClient(subscriptionID string, credential azcore.TokenCredential, options // - apiVersion - The API version to use for the operation. // - options - ClientCheckExistenceOptions contains the optional parameters for the Client.CheckExistence method. func (client *Client) CheckExistence(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, apiVersion string, options *ClientCheckExistenceOptions) (ClientCheckExistenceResponse, error) { + var err error + const operationName = "Client.CheckExistence" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.checkExistenceCreateRequest(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, options) if err != nil { return ClientCheckExistenceResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ClientCheckExistenceResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusNoContent, http.StatusNotFound) { - return ClientCheckExistenceResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusNoContent, http.StatusNotFound) { + err = runtime.NewResponseError(httpResp) + return ClientCheckExistenceResponse{}, err } - return ClientCheckExistenceResponse{Success: resp.StatusCode >= 200 && resp.StatusCode < 300}, nil + return ClientCheckExistenceResponse{Success: httpResp.StatusCode >= 200 && httpResp.StatusCode < 300}, nil } // checkExistenceCreateRequest creates the CheckExistence request. @@ -110,18 +115,24 @@ func (client *Client) checkExistenceCreateRequest(ctx context.Context, resourceG // - apiVersion - The API version to use for the operation. // - options - ClientCheckExistenceByIDOptions contains the optional parameters for the Client.CheckExistenceByID method. func (client *Client) CheckExistenceByID(ctx context.Context, resourceID string, apiVersion string, options *ClientCheckExistenceByIDOptions) (ClientCheckExistenceByIDResponse, error) { + var err error + const operationName = "Client.CheckExistenceByID" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.checkExistenceByIDCreateRequest(ctx, resourceID, apiVersion, options) if err != nil { return ClientCheckExistenceByIDResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ClientCheckExistenceByIDResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusNoContent, http.StatusNotFound) { - return ClientCheckExistenceByIDResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusNoContent, http.StatusNotFound) { + err = runtime.NewResponseError(httpResp) + return ClientCheckExistenceByIDResponse{}, err } - return ClientCheckExistenceByIDResponse{Success: resp.StatusCode >= 200 && resp.StatusCode < 300}, nil + return ClientCheckExistenceByIDResponse{Success: httpResp.StatusCode >= 200 && httpResp.StatusCode < 300}, nil } // checkExistenceByIDCreateRequest creates the CheckExistenceByID request. @@ -157,9 +168,14 @@ func (client *Client) BeginCreateOrUpdate(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller[ClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[ClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -168,18 +184,24 @@ func (client *Client) BeginCreateOrUpdate(ctx context.Context, resourceGroupName // // Generated from API version 2021-04-01 func (client *Client) createOrUpdate(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, apiVersion string, parameters GenericResource, options *ClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "Client.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, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -211,7 +233,10 @@ func (client *Client) createOrUpdateCreateRequest(ctx context.Context, resourceG reqQP.Set("api-version", apiVersion) req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginCreateOrUpdateByID - Create a resource by ID. @@ -230,9 +255,14 @@ func (client *Client) BeginCreateOrUpdateByID(ctx context.Context, resourceID st if err != nil { return nil, err } - return runtime.NewPoller[ClientCreateOrUpdateByIDResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientCreateOrUpdateByIDResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[ClientCreateOrUpdateByIDResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ClientCreateOrUpdateByIDResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -241,18 +271,24 @@ func (client *Client) BeginCreateOrUpdateByID(ctx context.Context, resourceID st // // Generated from API version 2021-04-01 func (client *Client) createOrUpdateByID(ctx context.Context, resourceID string, apiVersion string, parameters GenericResource, options *ClientBeginCreateOrUpdateByIDOptions) (*http.Response, error) { + var err error + const operationName = "Client.BeginCreateOrUpdateByID" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.createOrUpdateByIDCreateRequest(ctx, resourceID, apiVersion, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateByIDCreateRequest creates the CreateOrUpdateByID request. @@ -267,7 +303,10 @@ func (client *Client) createOrUpdateByIDCreateRequest(ctx context.Context, resou reqQP.Set("api-version", apiVersion) req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes a resource. @@ -287,9 +326,14 @@ func (client *Client) BeginDelete(ctx context.Context, resourceGroupName string, if err != nil { return nil, err } - return runtime.NewPoller[ClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[ClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -298,18 +342,24 @@ func (client *Client) BeginDelete(ctx context.Context, resourceGroupName string, // // Generated from API version 2021-04-01 func (client *Client) deleteOperation(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, apiVersion string, options *ClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "Client.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, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -358,9 +408,14 @@ func (client *Client) BeginDeleteByID(ctx context.Context, resourceID string, ap if err != nil { return nil, err } - return runtime.NewPoller[ClientDeleteByIDResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientDeleteByIDResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[ClientDeleteByIDResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ClientDeleteByIDResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -369,18 +424,24 @@ func (client *Client) BeginDeleteByID(ctx context.Context, resourceID string, ap // // Generated from API version 2021-04-01 func (client *Client) deleteByID(ctx context.Context, resourceID string, apiVersion string, options *ClientBeginDeleteByIDOptions) (*http.Response, error) { + var err error + const operationName = "Client.BeginDeleteByID" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.deleteByIDCreateRequest(ctx, resourceID, apiVersion, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteByIDCreateRequest creates the DeleteByID request. @@ -410,18 +471,25 @@ func (client *Client) deleteByIDCreateRequest(ctx context.Context, resourceID st // - apiVersion - The API version to use for the operation. // - options - ClientGetOptions contains the optional parameters for the Client.Get method. func (client *Client) Get(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, apiVersion string, options *ClientGetOptions) (ClientGetResponse, error) { + var err error + const operationName = "Client.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, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, options) if err != nil { return ClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -474,18 +542,25 @@ func (client *Client) getHandleResponse(resp *http.Response) (ClientGetResponse, // - apiVersion - The API version to use for the operation. // - options - ClientGetByIDOptions contains the optional parameters for the Client.GetByID method. func (client *Client) GetByID(ctx context.Context, resourceID string, apiVersion string, options *ClientGetByIDOptions) (ClientGetByIDResponse, error) { + var err error + const operationName = "Client.GetByID" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getByIDCreateRequest(ctx, resourceID, apiVersion, options) if err != nil { return ClientGetByIDResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ClientGetByIDResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ClientGetByIDResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ClientGetByIDResponse{}, err } - return client.getByIDHandleResponse(resp) + resp, err := client.getByIDHandleResponse(httpResp) + return resp, err } // getByIDCreateRequest creates the GetByID request. @@ -522,25 +597,20 @@ func (client *Client) NewListPager(options *ClientListOptions) *runtime.Pager[Cl return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *ClientListResponse) (ClientListResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "Client.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 ClientListResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ClientListResponse{}, runtime.NewResponseError(resp) - } return client.listHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -592,25 +662,20 @@ func (client *Client) NewListByResourceGroupPager(resourceGroupName string, opti return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *ClientListByResourceGroupResponse) (ClientListByResourceGroupResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return ClientListByResourceGroupResponse{}, err + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "Client.NewListByResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + 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 ClientListByResourceGroupResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) - } return client.listByResourceGroupHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -670,9 +735,14 @@ func (client *Client) BeginMoveResources(ctx context.Context, sourceResourceGrou if err != nil { return nil, err } - return runtime.NewPoller[ClientMoveResourcesResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientMoveResourcesResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[ClientMoveResourcesResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ClientMoveResourcesResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -684,18 +754,24 @@ func (client *Client) BeginMoveResources(ctx context.Context, sourceResourceGrou // // Generated from API version 2021-04-01 func (client *Client) moveResources(ctx context.Context, sourceResourceGroupName string, parameters MoveInfo, options *ClientBeginMoveResourcesOptions) (*http.Response, error) { + var err error + const operationName = "Client.BeginMoveResources" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.moveResourcesCreateRequest(ctx, sourceResourceGroupName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // moveResourcesCreateRequest creates the MoveResources request. @@ -717,7 +793,10 @@ func (client *Client) moveResourcesCreateRequest(ctx context.Context, sourceReso reqQP.Set("api-version", "2021-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginUpdate - Updates a resource. @@ -738,9 +817,14 @@ func (client *Client) BeginUpdate(ctx context.Context, resourceGroupName string, if err != nil { return nil, err } - return runtime.NewPoller[ClientUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[ClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -749,18 +833,24 @@ func (client *Client) BeginUpdate(ctx context.Context, resourceGroupName string, // // Generated from API version 2021-04-01 func (client *Client) update(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, apiVersion string, parameters GenericResource, options *ClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "Client.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, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. @@ -792,7 +882,10 @@ func (client *Client) updateCreateRequest(ctx context.Context, resourceGroupName reqQP.Set("api-version", apiVersion) req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginUpdateByID - Updates a resource by ID. @@ -810,9 +903,14 @@ func (client *Client) BeginUpdateByID(ctx context.Context, resourceID string, ap if err != nil { return nil, err } - return runtime.NewPoller[ClientUpdateByIDResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientUpdateByIDResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[ClientUpdateByIDResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ClientUpdateByIDResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -821,18 +919,24 @@ func (client *Client) BeginUpdateByID(ctx context.Context, resourceID string, ap // // Generated from API version 2021-04-01 func (client *Client) updateByID(ctx context.Context, resourceID string, apiVersion string, parameters GenericResource, options *ClientBeginUpdateByIDOptions) (*http.Response, error) { + var err error + const operationName = "Client.BeginUpdateByID" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.updateByIDCreateRequest(ctx, resourceID, apiVersion, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateByIDCreateRequest creates the UpdateByID request. @@ -847,7 +951,10 @@ func (client *Client) updateByIDCreateRequest(ctx context.Context, resourceID st reqQP.Set("api-version", apiVersion) req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginValidateMoveResources - This operation checks whether the specified resources can be moved to the target. The resources @@ -869,9 +976,14 @@ func (client *Client) BeginValidateMoveResources(ctx context.Context, sourceReso if err != nil { return nil, err } - return runtime.NewPoller[ClientValidateMoveResourcesResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientValidateMoveResourcesResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[ClientValidateMoveResourcesResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ClientValidateMoveResourcesResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -884,18 +996,24 @@ func (client *Client) BeginValidateMoveResources(ctx context.Context, sourceReso // // Generated from API version 2021-04-01 func (client *Client) validateMoveResources(ctx context.Context, sourceResourceGroupName string, parameters MoveInfo, options *ClientBeginValidateMoveResourcesOptions) (*http.Response, error) { + var err error + const operationName = "Client.BeginValidateMoveResources" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.validateMoveResourcesCreateRequest(ctx, sourceResourceGroupName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // validateMoveResourcesCreateRequest creates the ValidateMoveResources request. @@ -917,5 +1035,8 @@ func (client *Client) validateMoveResourcesCreateRequest(ctx context.Context, so reqQP.Set("api-version", "2021-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/client_factory.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/client_factory.go index 3b42ee5045..bcd6487d69 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/client_factory.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/client_factory.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armresources @@ -28,7 +27,7 @@ type ClientFactory struct { // - 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) { - _, err := arm.NewClient(moduleName+".ClientFactory", moduleVersion, credential, options) + _, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -38,42 +37,50 @@ func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, }, nil } -func (c *ClientFactory) NewOperationsClient() *OperationsClient { - subClient, _ := NewOperationsClient(c.credential, c.options) +// NewClient creates a new instance of Client. +func (c *ClientFactory) NewClient() *Client { + subClient, _ := NewClient(c.subscriptionID, c.credential, c.options) return subClient } +// NewDeploymentOperationsClient creates a new instance of DeploymentOperationsClient. +func (c *ClientFactory) NewDeploymentOperationsClient() *DeploymentOperationsClient { + subClient, _ := NewDeploymentOperationsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewDeploymentsClient creates a new instance of DeploymentsClient. func (c *ClientFactory) NewDeploymentsClient() *DeploymentsClient { subClient, _ := NewDeploymentsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewProvidersClient() *ProvidersClient { - subClient, _ := NewProvidersClient(c.subscriptionID, c.credential, c.options) +// NewOperationsClient creates a new instance of OperationsClient. +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + subClient, _ := NewOperationsClient(c.credential, c.options) return subClient } +// NewProviderResourceTypesClient creates a new instance of ProviderResourceTypesClient. func (c *ClientFactory) NewProviderResourceTypesClient() *ProviderResourceTypesClient { subClient, _ := NewProviderResourceTypesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewClient() *Client { - subClient, _ := NewClient(c.subscriptionID, c.credential, c.options) +// NewProvidersClient creates a new instance of ProvidersClient. +func (c *ClientFactory) NewProvidersClient() *ProvidersClient { + subClient, _ := NewProvidersClient(c.subscriptionID, c.credential, c.options) return subClient } +// NewResourceGroupsClient creates a new instance of ResourceGroupsClient. func (c *ClientFactory) NewResourceGroupsClient() *ResourceGroupsClient { subClient, _ := NewResourceGroupsClient(c.subscriptionID, c.credential, c.options) return subClient } +// NewTagsClient creates a new instance of TagsClient. func (c *ClientFactory) NewTagsClient() *TagsClient { subClient, _ := NewTagsClient(c.subscriptionID, c.credential, c.options) return subClient } - -func (c *ClientFactory) NewDeploymentOperationsClient() *DeploymentOperationsClient { - subClient, _ := NewDeploymentOperationsClient(c.subscriptionID, c.credential, c.options) - return subClient -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/constants.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/constants.go index 2e355a761f..6cf0f0dc33 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/constants.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/constants.go @@ -3,15 +3,14 @@ // 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. +// 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. -// DO NOT EDIT. package armresources const ( - moduleName = "armresources" - moduleVersion = "v1.1.1" + moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources" + moduleVersion = "v1.2.0" ) // AliasPathAttributes - The attributes of the token that the alias path is referring to. @@ -72,17 +71,17 @@ func PossibleAliasPathTokenTypeValues() []AliasPathTokenType { type AliasPatternType string const ( - // AliasPatternTypeNotSpecified - NotSpecified is not allowed. - AliasPatternTypeNotSpecified AliasPatternType = "NotSpecified" // AliasPatternTypeExtract - Extract is the only allowed value. AliasPatternTypeExtract AliasPatternType = "Extract" + // AliasPatternTypeNotSpecified - NotSpecified is not allowed. + AliasPatternTypeNotSpecified AliasPatternType = "NotSpecified" ) // PossibleAliasPatternTypeValues returns the possible values for the AliasPatternType const type. func PossibleAliasPatternTypeValues() []AliasPatternType { return []AliasPatternType{ - AliasPatternTypeNotSpecified, AliasPatternTypeExtract, + AliasPatternTypeNotSpecified, } } @@ -90,20 +89,20 @@ func PossibleAliasPatternTypeValues() []AliasPatternType { type AliasType string const ( + // AliasTypeMask - Alias value is secret. + AliasTypeMask AliasType = "Mask" // AliasTypeNotSpecified - Alias type is unknown (same as not providing alias type). AliasTypeNotSpecified AliasType = "NotSpecified" // AliasTypePlainText - Alias value is not secret. AliasTypePlainText AliasType = "PlainText" - // AliasTypeMask - Alias value is secret. - AliasTypeMask AliasType = "Mask" ) // PossibleAliasTypeValues returns the possible values for the AliasType const type. func PossibleAliasTypeValues() []AliasType { return []AliasType{ + AliasTypeMask, AliasTypeNotSpecified, AliasTypePlainText, - AliasTypeMask, } } @@ -117,18 +116,18 @@ const ( // ChangeTypeDelete - The resource exists in the current state and is missing from the desired state. The resource will be // deleted when the deployment is executed. ChangeTypeDelete ChangeType = "Delete" - // ChangeTypeIgnore - The resource exists in the current state and is missing from the desired state. The resource will not - // be deployed or modified when the deployment is executed. - ChangeTypeIgnore ChangeType = "Ignore" // ChangeTypeDeploy - The resource exists in the current state and the desired state and will be redeployed when the deployment // is executed. The properties of the resource may or may not change. ChangeTypeDeploy ChangeType = "Deploy" - // ChangeTypeNoChange - The resource exists in the current state and the desired state and will be redeployed when the deployment - // is executed. The properties of the resource will not change. - ChangeTypeNoChange ChangeType = "NoChange" + // ChangeTypeIgnore - The resource exists in the current state and is missing from the desired state. The resource will not + // be deployed or modified when the deployment is executed. + ChangeTypeIgnore ChangeType = "Ignore" // ChangeTypeModify - The resource exists in the current state and the desired state and will be redeployed when the deployment // is executed. The properties of the resource will change. ChangeTypeModify ChangeType = "Modify" + // ChangeTypeNoChange - The resource exists in the current state and the desired state and will be redeployed when the deployment + // is executed. The properties of the resource will not change. + ChangeTypeNoChange ChangeType = "NoChange" // ChangeTypeUnsupported - The resource is not supported by What-If. ChangeTypeUnsupported ChangeType = "Unsupported" ) @@ -138,10 +137,10 @@ func PossibleChangeTypeValues() []ChangeType { return []ChangeType{ ChangeTypeCreate, ChangeTypeDelete, - ChangeTypeIgnore, ChangeTypeDeploy, - ChangeTypeNoChange, + ChangeTypeIgnore, ChangeTypeModify, + ChangeTypeNoChange, ChangeTypeUnsupported, } } @@ -154,15 +153,15 @@ func PossibleChangeTypeValues() []ChangeType { type DeploymentMode string const ( - DeploymentModeIncremental DeploymentMode = "Incremental" DeploymentModeComplete DeploymentMode = "Complete" + DeploymentModeIncremental DeploymentMode = "Incremental" ) // PossibleDeploymentModeValues returns the possible values for the DeploymentMode const type. func PossibleDeploymentModeValues() []DeploymentMode { return []DeploymentMode{ - DeploymentModeIncremental, DeploymentModeComplete, + DeploymentModeIncremental, } } @@ -219,6 +218,8 @@ func PossibleOnErrorDeploymentTypeValues() []OnErrorDeploymentType { type PropertyChangeType string const ( + // PropertyChangeTypeArray - The property is an array and contains nested changes. + PropertyChangeTypeArray PropertyChangeType = "Array" // PropertyChangeTypeCreate - The property does not exist in the current state but is present in the desired state. The property // will be created when the deployment is executed. PropertyChangeTypeCreate PropertyChangeType = "Create" @@ -228,8 +229,6 @@ const ( // PropertyChangeTypeModify - The property exists in both current and desired state and is different. The value of the property // will change when the deployment is executed. PropertyChangeTypeModify PropertyChangeType = "Modify" - // PropertyChangeTypeArray - The property is an array and contains nested changes. - PropertyChangeTypeArray PropertyChangeType = "Array" // PropertyChangeTypeNoEffect - The property will not be set or updated. PropertyChangeTypeNoEffect PropertyChangeType = "NoEffect" ) @@ -237,10 +236,10 @@ const ( // PossiblePropertyChangeTypeValues returns the possible values for the PropertyChangeType const type. func PossiblePropertyChangeTypeValues() []PropertyChangeType { return []PropertyChangeType{ + PropertyChangeTypeArray, PropertyChangeTypeCreate, PropertyChangeTypeDelete, PropertyChangeTypeModify, - PropertyChangeTypeArray, PropertyChangeTypeNoEffect, } } @@ -269,42 +268,42 @@ func PossibleProviderAuthorizationConsentStateValues() []ProviderAuthorizationCo type ProvisioningOperation string const ( - // ProvisioningOperationNotSpecified - The provisioning operation is not specified. - ProvisioningOperationNotSpecified ProvisioningOperation = "NotSpecified" + // ProvisioningOperationAction - The provisioning operation is action. + ProvisioningOperationAction ProvisioningOperation = "Action" + // ProvisioningOperationAzureAsyncOperationWaiting - The provisioning operation is waiting Azure async operation. + ProvisioningOperationAzureAsyncOperationWaiting ProvisioningOperation = "AzureAsyncOperationWaiting" // ProvisioningOperationCreate - The provisioning operation is create. ProvisioningOperationCreate ProvisioningOperation = "Create" // ProvisioningOperationDelete - The provisioning operation is delete. ProvisioningOperationDelete ProvisioningOperation = "Delete" - // ProvisioningOperationWaiting - The provisioning operation is waiting. - ProvisioningOperationWaiting ProvisioningOperation = "Waiting" - // ProvisioningOperationAzureAsyncOperationWaiting - The provisioning operation is waiting Azure async operation. - ProvisioningOperationAzureAsyncOperationWaiting ProvisioningOperation = "AzureAsyncOperationWaiting" - // ProvisioningOperationResourceCacheWaiting - The provisioning operation is waiting for resource cache. - ProvisioningOperationResourceCacheWaiting ProvisioningOperation = "ResourceCacheWaiting" - // ProvisioningOperationAction - The provisioning operation is action. - ProvisioningOperationAction ProvisioningOperation = "Action" - // ProvisioningOperationRead - The provisioning operation is read. - ProvisioningOperationRead ProvisioningOperation = "Read" - // ProvisioningOperationEvaluateDeploymentOutput - The provisioning operation is evaluate output. - ProvisioningOperationEvaluateDeploymentOutput ProvisioningOperation = "EvaluateDeploymentOutput" // ProvisioningOperationDeploymentCleanup - The provisioning operation is cleanup. This operation is part of the 'complete' // mode deployment. ProvisioningOperationDeploymentCleanup ProvisioningOperation = "DeploymentCleanup" + // ProvisioningOperationEvaluateDeploymentOutput - The provisioning operation is evaluate output. + ProvisioningOperationEvaluateDeploymentOutput ProvisioningOperation = "EvaluateDeploymentOutput" + // ProvisioningOperationNotSpecified - The provisioning operation is not specified. + ProvisioningOperationNotSpecified ProvisioningOperation = "NotSpecified" + // ProvisioningOperationRead - The provisioning operation is read. + ProvisioningOperationRead ProvisioningOperation = "Read" + // ProvisioningOperationResourceCacheWaiting - The provisioning operation is waiting for resource cache. + ProvisioningOperationResourceCacheWaiting ProvisioningOperation = "ResourceCacheWaiting" + // ProvisioningOperationWaiting - The provisioning operation is waiting. + ProvisioningOperationWaiting ProvisioningOperation = "Waiting" ) // PossibleProvisioningOperationValues returns the possible values for the ProvisioningOperation const type. func PossibleProvisioningOperationValues() []ProvisioningOperation { return []ProvisioningOperation{ - ProvisioningOperationNotSpecified, + ProvisioningOperationAction, + ProvisioningOperationAzureAsyncOperationWaiting, ProvisioningOperationCreate, ProvisioningOperationDelete, - ProvisioningOperationWaiting, - ProvisioningOperationAzureAsyncOperationWaiting, - ProvisioningOperationResourceCacheWaiting, - ProvisioningOperationAction, - ProvisioningOperationRead, - ProvisioningOperationEvaluateDeploymentOutput, ProvisioningOperationDeploymentCleanup, + ProvisioningOperationEvaluateDeploymentOutput, + ProvisioningOperationNotSpecified, + ProvisioningOperationRead, + ProvisioningOperationResourceCacheWaiting, + ProvisioningOperationWaiting, } } @@ -348,19 +347,19 @@ func PossibleProvisioningStateValues() []ProvisioningState { type ResourceIdentityType string const ( + ResourceIdentityTypeNone ResourceIdentityType = "None" ResourceIdentityTypeSystemAssigned ResourceIdentityType = "SystemAssigned" - ResourceIdentityTypeUserAssigned ResourceIdentityType = "UserAssigned" ResourceIdentityTypeSystemAssignedUserAssigned ResourceIdentityType = "SystemAssigned, UserAssigned" - ResourceIdentityTypeNone ResourceIdentityType = "None" + ResourceIdentityTypeUserAssigned ResourceIdentityType = "UserAssigned" ) // PossibleResourceIdentityTypeValues returns the possible values for the ResourceIdentityType const type. func PossibleResourceIdentityTypeValues() []ResourceIdentityType { return []ResourceIdentityType{ + ResourceIdentityTypeNone, ResourceIdentityTypeSystemAssigned, - ResourceIdentityTypeUserAssigned, ResourceIdentityTypeSystemAssignedUserAssigned, - ResourceIdentityTypeNone, + ResourceIdentityTypeUserAssigned, } } @@ -390,14 +389,14 @@ func PossibleTagsPatchOperationValues() []TagsPatchOperation { type WhatIfResultFormat string const ( - WhatIfResultFormatResourceIDOnly WhatIfResultFormat = "ResourceIdOnly" WhatIfResultFormatFullResourcePayloads WhatIfResultFormat = "FullResourcePayloads" + WhatIfResultFormatResourceIDOnly WhatIfResultFormat = "ResourceIdOnly" ) // PossibleWhatIfResultFormatValues returns the possible values for the WhatIfResultFormat const type. func PossibleWhatIfResultFormatValues() []WhatIfResultFormat { return []WhatIfResultFormat{ - WhatIfResultFormatResourceIDOnly, WhatIfResultFormatFullResourcePayloads, + WhatIfResultFormatResourceIDOnly, } } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/deploymentoperations_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/deploymentoperations_client.go index d990b76095..ec1e1ab800 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/deploymentoperations_client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/deploymentoperations_client.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armresources @@ -34,7 +33,7 @@ type DeploymentOperationsClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewDeploymentOperationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DeploymentOperationsClient, error) { - cl, err := arm.NewClient(moduleName+".DeploymentOperationsClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -55,18 +54,25 @@ func NewDeploymentOperationsClient(subscriptionID string, credential azcore.Toke // - options - DeploymentOperationsClientGetOptions contains the optional parameters for the DeploymentOperationsClient.Get // method. func (client *DeploymentOperationsClient) Get(ctx context.Context, resourceGroupName string, deploymentName string, operationID string, options *DeploymentOperationsClientGetOptions) (DeploymentOperationsClientGetResponse, error) { + var err error + const operationName = "DeploymentOperationsClient.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, deploymentName, operationID, options) if err != nil { return DeploymentOperationsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DeploymentOperationsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DeploymentOperationsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DeploymentOperationsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -118,18 +124,25 @@ func (client *DeploymentOperationsClient) getHandleResponse(resp *http.Response) // - options - DeploymentOperationsClientGetAtManagementGroupScopeOptions contains the optional parameters for the DeploymentOperationsClient.GetAtManagementGroupScope // method. func (client *DeploymentOperationsClient) GetAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string, operationID string, options *DeploymentOperationsClientGetAtManagementGroupScopeOptions) (DeploymentOperationsClientGetAtManagementGroupScopeResponse, error) { + var err error + const operationName = "DeploymentOperationsClient.GetAtManagementGroupScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getAtManagementGroupScopeCreateRequest(ctx, groupID, deploymentName, operationID, options) if err != nil { return DeploymentOperationsClientGetAtManagementGroupScopeResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DeploymentOperationsClientGetAtManagementGroupScopeResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DeploymentOperationsClientGetAtManagementGroupScopeResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DeploymentOperationsClientGetAtManagementGroupScopeResponse{}, err } - return client.getAtManagementGroupScopeHandleResponse(resp) + resp, err := client.getAtManagementGroupScopeHandleResponse(httpResp) + return resp, err } // getAtManagementGroupScopeCreateRequest creates the GetAtManagementGroupScope request. @@ -177,18 +190,25 @@ func (client *DeploymentOperationsClient) getAtManagementGroupScopeHandleRespons // - options - DeploymentOperationsClientGetAtScopeOptions contains the optional parameters for the DeploymentOperationsClient.GetAtScope // method. func (client *DeploymentOperationsClient) GetAtScope(ctx context.Context, scope string, deploymentName string, operationID string, options *DeploymentOperationsClientGetAtScopeOptions) (DeploymentOperationsClientGetAtScopeResponse, error) { + var err error + const operationName = "DeploymentOperationsClient.GetAtScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getAtScopeCreateRequest(ctx, scope, deploymentName, operationID, options) if err != nil { return DeploymentOperationsClientGetAtScopeResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DeploymentOperationsClientGetAtScopeResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DeploymentOperationsClientGetAtScopeResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DeploymentOperationsClientGetAtScopeResponse{}, err } - return client.getAtScopeHandleResponse(resp) + resp, err := client.getAtScopeHandleResponse(httpResp) + return resp, err } // getAtScopeCreateRequest creates the GetAtScope request. @@ -232,18 +252,25 @@ func (client *DeploymentOperationsClient) getAtScopeHandleResponse(resp *http.Re // - options - DeploymentOperationsClientGetAtSubscriptionScopeOptions contains the optional parameters for the DeploymentOperationsClient.GetAtSubscriptionScope // method. func (client *DeploymentOperationsClient) GetAtSubscriptionScope(ctx context.Context, deploymentName string, operationID string, options *DeploymentOperationsClientGetAtSubscriptionScopeOptions) (DeploymentOperationsClientGetAtSubscriptionScopeResponse, error) { + var err error + const operationName = "DeploymentOperationsClient.GetAtSubscriptionScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getAtSubscriptionScopeCreateRequest(ctx, deploymentName, operationID, options) if err != nil { return DeploymentOperationsClientGetAtSubscriptionScopeResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DeploymentOperationsClientGetAtSubscriptionScopeResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DeploymentOperationsClientGetAtSubscriptionScopeResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DeploymentOperationsClientGetAtSubscriptionScopeResponse{}, err } - return client.getAtSubscriptionScopeHandleResponse(resp) + resp, err := client.getAtSubscriptionScopeHandleResponse(httpResp) + return resp, err } // getAtSubscriptionScopeCreateRequest creates the GetAtSubscriptionScope request. @@ -290,18 +317,25 @@ func (client *DeploymentOperationsClient) getAtSubscriptionScopeHandleResponse(r // - options - DeploymentOperationsClientGetAtTenantScopeOptions contains the optional parameters for the DeploymentOperationsClient.GetAtTenantScope // method. func (client *DeploymentOperationsClient) GetAtTenantScope(ctx context.Context, deploymentName string, operationID string, options *DeploymentOperationsClientGetAtTenantScopeOptions) (DeploymentOperationsClientGetAtTenantScopeResponse, error) { + var err error + const operationName = "DeploymentOperationsClient.GetAtTenantScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getAtTenantScopeCreateRequest(ctx, deploymentName, operationID, options) if err != nil { return DeploymentOperationsClientGetAtTenantScopeResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DeploymentOperationsClientGetAtTenantScopeResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DeploymentOperationsClientGetAtTenantScopeResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DeploymentOperationsClientGetAtTenantScopeResponse{}, err } - return client.getAtTenantScopeHandleResponse(resp) + resp, err := client.getAtTenantScopeHandleResponse(httpResp) + return resp, err } // getAtTenantScopeCreateRequest creates the GetAtTenantScope request. @@ -348,25 +382,20 @@ func (client *DeploymentOperationsClient) NewListPager(resourceGroupName string, return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *DeploymentOperationsClientListResponse) (DeploymentOperationsClientListResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listCreateRequest(ctx, resourceGroupName, deploymentName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DeploymentOperationsClient.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, resourceGroupName, deploymentName, options) + }, nil) if err != nil { return DeploymentOperationsClientListResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DeploymentOperationsClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DeploymentOperationsClientListResponse{}, runtime.NewResponseError(resp) - } return client.listHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -421,25 +450,20 @@ func (client *DeploymentOperationsClient) NewListAtManagementGroupScopePager(gro return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *DeploymentOperationsClientListAtManagementGroupScopeResponse) (DeploymentOperationsClientListAtManagementGroupScopeResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listAtManagementGroupScopeCreateRequest(ctx, groupID, deploymentName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return DeploymentOperationsClientListAtManagementGroupScopeResponse{}, err + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DeploymentOperationsClient.NewListAtManagementGroupScopePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listAtManagementGroupScopeCreateRequest(ctx, groupID, deploymentName, options) + }, nil) if err != nil { return DeploymentOperationsClientListAtManagementGroupScopeResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DeploymentOperationsClientListAtManagementGroupScopeResponse{}, runtime.NewResponseError(resp) - } return client.listAtManagementGroupScopeHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -490,25 +514,20 @@ func (client *DeploymentOperationsClient) NewListAtScopePager(scope string, depl return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *DeploymentOperationsClientListAtScopeResponse) (DeploymentOperationsClientListAtScopeResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listAtScopeCreateRequest(ctx, scope, deploymentName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DeploymentOperationsClient.NewListAtScopePager") + 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.listAtScopeCreateRequest(ctx, scope, deploymentName, options) + }, nil) if err != nil { return DeploymentOperationsClientListAtScopeResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DeploymentOperationsClientListAtScopeResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DeploymentOperationsClientListAtScopeResponse{}, runtime.NewResponseError(resp) - } return client.listAtScopeHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -555,25 +574,20 @@ func (client *DeploymentOperationsClient) NewListAtSubscriptionScopePager(deploy return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *DeploymentOperationsClientListAtSubscriptionScopeResponse) (DeploymentOperationsClientListAtSubscriptionScopeResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listAtSubscriptionScopeCreateRequest(ctx, deploymentName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return DeploymentOperationsClientListAtSubscriptionScopeResponse{}, err + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DeploymentOperationsClient.NewListAtSubscriptionScopePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listAtSubscriptionScopeCreateRequest(ctx, deploymentName, options) + }, nil) if err != nil { return DeploymentOperationsClientListAtSubscriptionScopeResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DeploymentOperationsClientListAtSubscriptionScopeResponse{}, runtime.NewResponseError(resp) - } return client.listAtSubscriptionScopeHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -623,25 +637,20 @@ func (client *DeploymentOperationsClient) NewListAtTenantScopePager(deploymentNa return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *DeploymentOperationsClientListAtTenantScopeResponse) (DeploymentOperationsClientListAtTenantScopeResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listAtTenantScopeCreateRequest(ctx, deploymentName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return DeploymentOperationsClientListAtTenantScopeResponse{}, err + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DeploymentOperationsClient.NewListAtTenantScopePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listAtTenantScopeCreateRequest(ctx, deploymentName, options) + }, nil) if err != nil { return DeploymentOperationsClientListAtTenantScopeResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DeploymentOperationsClientListAtTenantScopeResponse{}, runtime.NewResponseError(resp) - } return client.listAtTenantScopeHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/deployments_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/deployments_client.go index 11d005c641..2e9eff6b77 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/deployments_client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/deployments_client.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armresources @@ -34,7 +33,7 @@ type DeploymentsClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewDeploymentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DeploymentsClient, error) { - cl, err := arm.NewClient(moduleName+".DeploymentsClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -53,18 +52,25 @@ func NewDeploymentsClient(subscriptionID string, credential azcore.TokenCredenti // - options - DeploymentsClientCalculateTemplateHashOptions contains the optional parameters for the DeploymentsClient.CalculateTemplateHash // method. func (client *DeploymentsClient) CalculateTemplateHash(ctx context.Context, templateParam any, options *DeploymentsClientCalculateTemplateHashOptions) (DeploymentsClientCalculateTemplateHashResponse, error) { + var err error + const operationName = "DeploymentsClient.CalculateTemplateHash" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.calculateTemplateHashCreateRequest(ctx, templateParam, options) if err != nil { return DeploymentsClientCalculateTemplateHashResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DeploymentsClientCalculateTemplateHashResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DeploymentsClientCalculateTemplateHashResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DeploymentsClientCalculateTemplateHashResponse{}, err } - return client.calculateTemplateHashHandleResponse(resp) + resp, err := client.calculateTemplateHashHandleResponse(httpResp) + return resp, err } // calculateTemplateHashCreateRequest creates the CalculateTemplateHash request. @@ -78,7 +84,10 @@ func (client *DeploymentsClient) calculateTemplateHashCreateRequest(ctx context. reqQP.Set("api-version", "2021-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, templateParam) + if err := runtime.MarshalAsJSON(req, templateParam); err != nil { + return nil, err + } + return req, nil } // calculateTemplateHashHandleResponse handles the CalculateTemplateHash response. @@ -100,16 +109,22 @@ func (client *DeploymentsClient) calculateTemplateHashHandleResponse(resp *http. // - deploymentName - The name of the deployment. // - options - DeploymentsClientCancelOptions contains the optional parameters for the DeploymentsClient.Cancel method. func (client *DeploymentsClient) Cancel(ctx context.Context, resourceGroupName string, deploymentName string, options *DeploymentsClientCancelOptions) (DeploymentsClientCancelResponse, error) { + var err error + const operationName = "DeploymentsClient.Cancel" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.cancelCreateRequest(ctx, resourceGroupName, deploymentName, options) if err != nil { return DeploymentsClientCancelResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DeploymentsClientCancelResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusNoContent) { - return DeploymentsClientCancelResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return DeploymentsClientCancelResponse{}, err } return DeploymentsClientCancelResponse{}, nil } @@ -151,16 +166,22 @@ func (client *DeploymentsClient) cancelCreateRequest(ctx context.Context, resour // - options - DeploymentsClientCancelAtManagementGroupScopeOptions contains the optional parameters for the DeploymentsClient.CancelAtManagementGroupScope // method. func (client *DeploymentsClient) CancelAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string, options *DeploymentsClientCancelAtManagementGroupScopeOptions) (DeploymentsClientCancelAtManagementGroupScopeResponse, error) { + var err error + const operationName = "DeploymentsClient.CancelAtManagementGroupScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.cancelAtManagementGroupScopeCreateRequest(ctx, groupID, deploymentName, options) if err != nil { return DeploymentsClientCancelAtManagementGroupScopeResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DeploymentsClientCancelAtManagementGroupScopeResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusNoContent) { - return DeploymentsClientCancelAtManagementGroupScopeResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return DeploymentsClientCancelAtManagementGroupScopeResponse{}, err } return DeploymentsClientCancelAtManagementGroupScopeResponse{}, nil } @@ -198,16 +219,22 @@ func (client *DeploymentsClient) cancelAtManagementGroupScopeCreateRequest(ctx c // - options - DeploymentsClientCancelAtScopeOptions contains the optional parameters for the DeploymentsClient.CancelAtScope // method. func (client *DeploymentsClient) CancelAtScope(ctx context.Context, scope string, deploymentName string, options *DeploymentsClientCancelAtScopeOptions) (DeploymentsClientCancelAtScopeResponse, error) { + var err error + const operationName = "DeploymentsClient.CancelAtScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.cancelAtScopeCreateRequest(ctx, scope, deploymentName, options) if err != nil { return DeploymentsClientCancelAtScopeResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DeploymentsClientCancelAtScopeResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusNoContent) { - return DeploymentsClientCancelAtScopeResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return DeploymentsClientCancelAtScopeResponse{}, err } return DeploymentsClientCancelAtScopeResponse{}, nil } @@ -241,16 +268,22 @@ func (client *DeploymentsClient) cancelAtScopeCreateRequest(ctx context.Context, // - options - DeploymentsClientCancelAtSubscriptionScopeOptions contains the optional parameters for the DeploymentsClient.CancelAtSubscriptionScope // method. func (client *DeploymentsClient) CancelAtSubscriptionScope(ctx context.Context, deploymentName string, options *DeploymentsClientCancelAtSubscriptionScopeOptions) (DeploymentsClientCancelAtSubscriptionScopeResponse, error) { + var err error + const operationName = "DeploymentsClient.CancelAtSubscriptionScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.cancelAtSubscriptionScopeCreateRequest(ctx, deploymentName, options) if err != nil { return DeploymentsClientCancelAtSubscriptionScopeResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DeploymentsClientCancelAtSubscriptionScopeResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusNoContent) { - return DeploymentsClientCancelAtSubscriptionScopeResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return DeploymentsClientCancelAtSubscriptionScopeResponse{}, err } return DeploymentsClientCancelAtSubscriptionScopeResponse{}, nil } @@ -287,16 +320,22 @@ func (client *DeploymentsClient) cancelAtSubscriptionScopeCreateRequest(ctx cont // - options - DeploymentsClientCancelAtTenantScopeOptions contains the optional parameters for the DeploymentsClient.CancelAtTenantScope // method. func (client *DeploymentsClient) CancelAtTenantScope(ctx context.Context, deploymentName string, options *DeploymentsClientCancelAtTenantScopeOptions) (DeploymentsClientCancelAtTenantScopeResponse, error) { + var err error + const operationName = "DeploymentsClient.CancelAtTenantScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.cancelAtTenantScopeCreateRequest(ctx, deploymentName, options) if err != nil { return DeploymentsClientCancelAtTenantScopeResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DeploymentsClientCancelAtTenantScopeResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusNoContent) { - return DeploymentsClientCancelAtTenantScopeResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return DeploymentsClientCancelAtTenantScopeResponse{}, err } return DeploymentsClientCancelAtTenantScopeResponse{}, nil } @@ -327,18 +366,24 @@ func (client *DeploymentsClient) cancelAtTenantScopeCreateRequest(ctx context.Co // - options - DeploymentsClientCheckExistenceOptions contains the optional parameters for the DeploymentsClient.CheckExistence // method. func (client *DeploymentsClient) CheckExistence(ctx context.Context, resourceGroupName string, deploymentName string, options *DeploymentsClientCheckExistenceOptions) (DeploymentsClientCheckExistenceResponse, error) { + var err error + const operationName = "DeploymentsClient.CheckExistence" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.checkExistenceCreateRequest(ctx, resourceGroupName, deploymentName, options) if err != nil { return DeploymentsClientCheckExistenceResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DeploymentsClientCheckExistenceResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusNoContent, http.StatusNotFound) { - return DeploymentsClientCheckExistenceResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusNoContent, http.StatusNotFound) { + err = runtime.NewResponseError(httpResp) + return DeploymentsClientCheckExistenceResponse{}, err } - return DeploymentsClientCheckExistenceResponse{Success: resp.StatusCode >= 200 && resp.StatusCode < 300}, nil + return DeploymentsClientCheckExistenceResponse{Success: httpResp.StatusCode >= 200 && httpResp.StatusCode < 300}, nil } // checkExistenceCreateRequest creates the CheckExistence request. @@ -375,18 +420,24 @@ func (client *DeploymentsClient) checkExistenceCreateRequest(ctx context.Context // - options - DeploymentsClientCheckExistenceAtManagementGroupScopeOptions contains the optional parameters for the DeploymentsClient.CheckExistenceAtManagementGroupScope // method. func (client *DeploymentsClient) CheckExistenceAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string, options *DeploymentsClientCheckExistenceAtManagementGroupScopeOptions) (DeploymentsClientCheckExistenceAtManagementGroupScopeResponse, error) { + var err error + const operationName = "DeploymentsClient.CheckExistenceAtManagementGroupScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.checkExistenceAtManagementGroupScopeCreateRequest(ctx, groupID, deploymentName, options) if err != nil { return DeploymentsClientCheckExistenceAtManagementGroupScopeResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DeploymentsClientCheckExistenceAtManagementGroupScopeResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusNoContent, http.StatusNotFound) { - return DeploymentsClientCheckExistenceAtManagementGroupScopeResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusNoContent, http.StatusNotFound) { + err = runtime.NewResponseError(httpResp) + return DeploymentsClientCheckExistenceAtManagementGroupScopeResponse{}, err } - return DeploymentsClientCheckExistenceAtManagementGroupScopeResponse{Success: resp.StatusCode >= 200 && resp.StatusCode < 300}, nil + return DeploymentsClientCheckExistenceAtManagementGroupScopeResponse{Success: httpResp.StatusCode >= 200 && httpResp.StatusCode < 300}, nil } // checkExistenceAtManagementGroupScopeCreateRequest creates the CheckExistenceAtManagementGroupScope request. @@ -419,18 +470,24 @@ func (client *DeploymentsClient) checkExistenceAtManagementGroupScopeCreateReque // - options - DeploymentsClientCheckExistenceAtScopeOptions contains the optional parameters for the DeploymentsClient.CheckExistenceAtScope // method. func (client *DeploymentsClient) CheckExistenceAtScope(ctx context.Context, scope string, deploymentName string, options *DeploymentsClientCheckExistenceAtScopeOptions) (DeploymentsClientCheckExistenceAtScopeResponse, error) { + var err error + const operationName = "DeploymentsClient.CheckExistenceAtScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.checkExistenceAtScopeCreateRequest(ctx, scope, deploymentName, options) if err != nil { return DeploymentsClientCheckExistenceAtScopeResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DeploymentsClientCheckExistenceAtScopeResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusNoContent, http.StatusNotFound) { - return DeploymentsClientCheckExistenceAtScopeResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusNoContent, http.StatusNotFound) { + err = runtime.NewResponseError(httpResp) + return DeploymentsClientCheckExistenceAtScopeResponse{}, err } - return DeploymentsClientCheckExistenceAtScopeResponse{Success: resp.StatusCode >= 200 && resp.StatusCode < 300}, nil + return DeploymentsClientCheckExistenceAtScopeResponse{Success: httpResp.StatusCode >= 200 && httpResp.StatusCode < 300}, nil } // checkExistenceAtScopeCreateRequest creates the CheckExistenceAtScope request. @@ -459,18 +516,24 @@ func (client *DeploymentsClient) checkExistenceAtScopeCreateRequest(ctx context. // - options - DeploymentsClientCheckExistenceAtSubscriptionScopeOptions contains the optional parameters for the DeploymentsClient.CheckExistenceAtSubscriptionScope // method. func (client *DeploymentsClient) CheckExistenceAtSubscriptionScope(ctx context.Context, deploymentName string, options *DeploymentsClientCheckExistenceAtSubscriptionScopeOptions) (DeploymentsClientCheckExistenceAtSubscriptionScopeResponse, error) { + var err error + const operationName = "DeploymentsClient.CheckExistenceAtSubscriptionScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.checkExistenceAtSubscriptionScopeCreateRequest(ctx, deploymentName, options) if err != nil { return DeploymentsClientCheckExistenceAtSubscriptionScopeResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DeploymentsClientCheckExistenceAtSubscriptionScopeResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusNoContent, http.StatusNotFound) { - return DeploymentsClientCheckExistenceAtSubscriptionScopeResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusNoContent, http.StatusNotFound) { + err = runtime.NewResponseError(httpResp) + return DeploymentsClientCheckExistenceAtSubscriptionScopeResponse{}, err } - return DeploymentsClientCheckExistenceAtSubscriptionScopeResponse{Success: resp.StatusCode >= 200 && resp.StatusCode < 300}, nil + return DeploymentsClientCheckExistenceAtSubscriptionScopeResponse{Success: httpResp.StatusCode >= 200 && httpResp.StatusCode < 300}, nil } // checkExistenceAtSubscriptionScopeCreateRequest creates the CheckExistenceAtSubscriptionScope request. @@ -502,18 +565,24 @@ func (client *DeploymentsClient) checkExistenceAtSubscriptionScopeCreateRequest( // - options - DeploymentsClientCheckExistenceAtTenantScopeOptions contains the optional parameters for the DeploymentsClient.CheckExistenceAtTenantScope // method. func (client *DeploymentsClient) CheckExistenceAtTenantScope(ctx context.Context, deploymentName string, options *DeploymentsClientCheckExistenceAtTenantScopeOptions) (DeploymentsClientCheckExistenceAtTenantScopeResponse, error) { + var err error + const operationName = "DeploymentsClient.CheckExistenceAtTenantScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.checkExistenceAtTenantScopeCreateRequest(ctx, deploymentName, options) if err != nil { return DeploymentsClientCheckExistenceAtTenantScopeResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DeploymentsClientCheckExistenceAtTenantScopeResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusNoContent, http.StatusNotFound) { - return DeploymentsClientCheckExistenceAtTenantScopeResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusNoContent, http.StatusNotFound) { + err = runtime.NewResponseError(httpResp) + return DeploymentsClientCheckExistenceAtTenantScopeResponse{}, err } - return DeploymentsClientCheckExistenceAtTenantScopeResponse{Success: resp.StatusCode >= 200 && resp.StatusCode < 300}, nil + return DeploymentsClientCheckExistenceAtTenantScopeResponse{Success: httpResp.StatusCode >= 200 && httpResp.StatusCode < 300}, nil } // checkExistenceAtTenantScopeCreateRequest creates the CheckExistenceAtTenantScope request. @@ -550,9 +619,14 @@ func (client *DeploymentsClient) BeginCreateOrUpdate(ctx context.Context, resour if err != nil { return nil, err } - return runtime.NewPoller[DeploymentsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeploymentsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[DeploymentsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DeploymentsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -561,18 +635,24 @@ func (client *DeploymentsClient) BeginCreateOrUpdate(ctx context.Context, resour // // Generated from API version 2021-04-01 func (client *DeploymentsClient) createOrUpdate(ctx context.Context, resourceGroupName string, deploymentName string, parameters Deployment, options *DeploymentsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "DeploymentsClient.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, deploymentName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -598,7 +678,10 @@ func (client *DeploymentsClient) createOrUpdateCreateRequest(ctx context.Context reqQP.Set("api-version", "2021-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginCreateOrUpdateAtManagementGroupScope - You can provide the template and parameters directly in the request or link @@ -617,9 +700,14 @@ func (client *DeploymentsClient) BeginCreateOrUpdateAtManagementGroupScope(ctx c if err != nil { return nil, err } - return runtime.NewPoller[DeploymentsClientCreateOrUpdateAtManagementGroupScopeResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeploymentsClientCreateOrUpdateAtManagementGroupScopeResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[DeploymentsClientCreateOrUpdateAtManagementGroupScopeResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DeploymentsClientCreateOrUpdateAtManagementGroupScopeResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -629,18 +717,24 @@ func (client *DeploymentsClient) BeginCreateOrUpdateAtManagementGroupScope(ctx c // // Generated from API version 2021-04-01 func (client *DeploymentsClient) createOrUpdateAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string, parameters ScopedDeployment, options *DeploymentsClientBeginCreateOrUpdateAtManagementGroupScopeOptions) (*http.Response, error) { + var err error + const operationName = "DeploymentsClient.BeginCreateOrUpdateAtManagementGroupScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.createOrUpdateAtManagementGroupScopeCreateRequest(ctx, groupID, deploymentName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateAtManagementGroupScopeCreateRequest creates the CreateOrUpdateAtManagementGroupScope request. @@ -662,7 +756,10 @@ func (client *DeploymentsClient) createOrUpdateAtManagementGroupScopeCreateReque reqQP.Set("api-version", "2021-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginCreateOrUpdateAtScope - You can provide the template and parameters directly in the request or link to JSON files. @@ -680,9 +777,14 @@ func (client *DeploymentsClient) BeginCreateOrUpdateAtScope(ctx context.Context, if err != nil { return nil, err } - return runtime.NewPoller[DeploymentsClientCreateOrUpdateAtScopeResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeploymentsClientCreateOrUpdateAtScopeResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[DeploymentsClientCreateOrUpdateAtScopeResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DeploymentsClientCreateOrUpdateAtScopeResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -691,18 +793,24 @@ func (client *DeploymentsClient) BeginCreateOrUpdateAtScope(ctx context.Context, // // Generated from API version 2021-04-01 func (client *DeploymentsClient) createOrUpdateAtScope(ctx context.Context, scope string, deploymentName string, parameters Deployment, options *DeploymentsClientBeginCreateOrUpdateAtScopeOptions) (*http.Response, error) { + var err error + const operationName = "DeploymentsClient.BeginCreateOrUpdateAtScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.createOrUpdateAtScopeCreateRequest(ctx, scope, deploymentName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateAtScopeCreateRequest creates the CreateOrUpdateAtScope request. @@ -721,7 +829,10 @@ func (client *DeploymentsClient) createOrUpdateAtScopeCreateRequest(ctx context. reqQP.Set("api-version", "2021-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginCreateOrUpdateAtSubscriptionScope - You can provide the template and parameters directly in the request or link to @@ -739,9 +850,14 @@ func (client *DeploymentsClient) BeginCreateOrUpdateAtSubscriptionScope(ctx cont if err != nil { return nil, err } - return runtime.NewPoller[DeploymentsClientCreateOrUpdateAtSubscriptionScopeResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeploymentsClientCreateOrUpdateAtSubscriptionScopeResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[DeploymentsClientCreateOrUpdateAtSubscriptionScopeResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DeploymentsClientCreateOrUpdateAtSubscriptionScopeResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -751,18 +867,24 @@ func (client *DeploymentsClient) BeginCreateOrUpdateAtSubscriptionScope(ctx cont // // Generated from API version 2021-04-01 func (client *DeploymentsClient) createOrUpdateAtSubscriptionScope(ctx context.Context, deploymentName string, parameters Deployment, options *DeploymentsClientBeginCreateOrUpdateAtSubscriptionScopeOptions) (*http.Response, error) { + var err error + const operationName = "DeploymentsClient.BeginCreateOrUpdateAtSubscriptionScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.createOrUpdateAtSubscriptionScopeCreateRequest(ctx, deploymentName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateAtSubscriptionScopeCreateRequest creates the CreateOrUpdateAtSubscriptionScope request. @@ -784,7 +906,10 @@ func (client *DeploymentsClient) createOrUpdateAtSubscriptionScopeCreateRequest( reqQP.Set("api-version", "2021-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginCreateOrUpdateAtTenantScope - You can provide the template and parameters directly in the request or link to JSON @@ -802,9 +927,14 @@ func (client *DeploymentsClient) BeginCreateOrUpdateAtTenantScope(ctx context.Co if err != nil { return nil, err } - return runtime.NewPoller[DeploymentsClientCreateOrUpdateAtTenantScopeResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeploymentsClientCreateOrUpdateAtTenantScopeResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[DeploymentsClientCreateOrUpdateAtTenantScopeResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DeploymentsClientCreateOrUpdateAtTenantScopeResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -813,18 +943,24 @@ func (client *DeploymentsClient) BeginCreateOrUpdateAtTenantScope(ctx context.Co // // Generated from API version 2021-04-01 func (client *DeploymentsClient) createOrUpdateAtTenantScope(ctx context.Context, deploymentName string, parameters ScopedDeployment, options *DeploymentsClientBeginCreateOrUpdateAtTenantScopeOptions) (*http.Response, error) { + var err error + const operationName = "DeploymentsClient.BeginCreateOrUpdateAtTenantScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.createOrUpdateAtTenantScopeCreateRequest(ctx, deploymentName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateAtTenantScopeCreateRequest creates the CreateOrUpdateAtTenantScope request. @@ -842,7 +978,10 @@ func (client *DeploymentsClient) createOrUpdateAtTenantScopeCreateRequest(ctx co reqQP.Set("api-version", "2021-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - A template deployment that is currently running cannot be deleted. Deleting a template deployment removes @@ -865,9 +1004,14 @@ func (client *DeploymentsClient) BeginDelete(ctx context.Context, resourceGroupN if err != nil { return nil, err } - return runtime.NewPoller[DeploymentsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeploymentsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[DeploymentsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DeploymentsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -883,18 +1027,24 @@ func (client *DeploymentsClient) BeginDelete(ctx context.Context, resourceGroupN // // Generated from API version 2021-04-01 func (client *DeploymentsClient) deleteOperation(ctx context.Context, resourceGroupName string, deploymentName string, options *DeploymentsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "DeploymentsClient.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, deploymentName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -943,9 +1093,14 @@ func (client *DeploymentsClient) BeginDeleteAtManagementGroupScope(ctx context.C if err != nil { return nil, err } - return runtime.NewPoller[DeploymentsClientDeleteAtManagementGroupScopeResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeploymentsClientDeleteAtManagementGroupScopeResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[DeploymentsClientDeleteAtManagementGroupScopeResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DeploymentsClientDeleteAtManagementGroupScopeResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -960,18 +1115,24 @@ func (client *DeploymentsClient) BeginDeleteAtManagementGroupScope(ctx context.C // // Generated from API version 2021-04-01 func (client *DeploymentsClient) deleteAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string, options *DeploymentsClientBeginDeleteAtManagementGroupScopeOptions) (*http.Response, error) { + var err error + const operationName = "DeploymentsClient.BeginDeleteAtManagementGroupScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.deleteAtManagementGroupScopeCreateRequest(ctx, groupID, deploymentName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteAtManagementGroupScopeCreateRequest creates the DeleteAtManagementGroupScope request. @@ -1016,9 +1177,14 @@ func (client *DeploymentsClient) BeginDeleteAtScope(ctx context.Context, scope s if err != nil { return nil, err } - return runtime.NewPoller[DeploymentsClientDeleteAtScopeResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeploymentsClientDeleteAtScopeResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[DeploymentsClientDeleteAtScopeResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DeploymentsClientDeleteAtScopeResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -1033,18 +1199,24 @@ func (client *DeploymentsClient) BeginDeleteAtScope(ctx context.Context, scope s // // Generated from API version 2021-04-01 func (client *DeploymentsClient) deleteAtScope(ctx context.Context, scope string, deploymentName string, options *DeploymentsClientBeginDeleteAtScopeOptions) (*http.Response, error) { + var err error + const operationName = "DeploymentsClient.BeginDeleteAtScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.deleteAtScopeCreateRequest(ctx, scope, deploymentName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteAtScopeCreateRequest creates the DeleteAtScope request. @@ -1085,9 +1257,14 @@ func (client *DeploymentsClient) BeginDeleteAtSubscriptionScope(ctx context.Cont if err != nil { return nil, err } - return runtime.NewPoller[DeploymentsClientDeleteAtSubscriptionScopeResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeploymentsClientDeleteAtSubscriptionScopeResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[DeploymentsClientDeleteAtSubscriptionScopeResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DeploymentsClientDeleteAtSubscriptionScopeResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -1102,18 +1279,24 @@ func (client *DeploymentsClient) BeginDeleteAtSubscriptionScope(ctx context.Cont // // Generated from API version 2021-04-01 func (client *DeploymentsClient) deleteAtSubscriptionScope(ctx context.Context, deploymentName string, options *DeploymentsClientBeginDeleteAtSubscriptionScopeOptions) (*http.Response, error) { + var err error + const operationName = "DeploymentsClient.BeginDeleteAtSubscriptionScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.deleteAtSubscriptionScopeCreateRequest(ctx, deploymentName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteAtSubscriptionScopeCreateRequest creates the DeleteAtSubscriptionScope request. @@ -1157,9 +1340,14 @@ func (client *DeploymentsClient) BeginDeleteAtTenantScope(ctx context.Context, d if err != nil { return nil, err } - return runtime.NewPoller[DeploymentsClientDeleteAtTenantScopeResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeploymentsClientDeleteAtTenantScopeResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[DeploymentsClientDeleteAtTenantScopeResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DeploymentsClientDeleteAtTenantScopeResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -1174,18 +1362,24 @@ func (client *DeploymentsClient) BeginDeleteAtTenantScope(ctx context.Context, d // // Generated from API version 2021-04-01 func (client *DeploymentsClient) deleteAtTenantScope(ctx context.Context, deploymentName string, options *DeploymentsClientBeginDeleteAtTenantScopeOptions) (*http.Response, error) { + var err error + const operationName = "DeploymentsClient.BeginDeleteAtTenantScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.deleteAtTenantScopeCreateRequest(ctx, deploymentName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteAtTenantScopeCreateRequest creates the DeleteAtTenantScope request. @@ -1215,18 +1409,25 @@ func (client *DeploymentsClient) deleteAtTenantScopeCreateRequest(ctx context.Co // - options - DeploymentsClientExportTemplateOptions contains the optional parameters for the DeploymentsClient.ExportTemplate // method. func (client *DeploymentsClient) ExportTemplate(ctx context.Context, resourceGroupName string, deploymentName string, options *DeploymentsClientExportTemplateOptions) (DeploymentsClientExportTemplateResponse, error) { + var err error + const operationName = "DeploymentsClient.ExportTemplate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.exportTemplateCreateRequest(ctx, resourceGroupName, deploymentName, options) if err != nil { return DeploymentsClientExportTemplateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DeploymentsClientExportTemplateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DeploymentsClientExportTemplateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DeploymentsClientExportTemplateResponse{}, err } - return client.exportTemplateHandleResponse(resp) + resp, err := client.exportTemplateHandleResponse(httpResp) + return resp, err } // exportTemplateCreateRequest creates the ExportTemplate request. @@ -1273,18 +1474,25 @@ func (client *DeploymentsClient) exportTemplateHandleResponse(resp *http.Respons // - options - DeploymentsClientExportTemplateAtManagementGroupScopeOptions contains the optional parameters for the DeploymentsClient.ExportTemplateAtManagementGroupScope // method. func (client *DeploymentsClient) ExportTemplateAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string, options *DeploymentsClientExportTemplateAtManagementGroupScopeOptions) (DeploymentsClientExportTemplateAtManagementGroupScopeResponse, error) { + var err error + const operationName = "DeploymentsClient.ExportTemplateAtManagementGroupScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.exportTemplateAtManagementGroupScopeCreateRequest(ctx, groupID, deploymentName, options) if err != nil { return DeploymentsClientExportTemplateAtManagementGroupScopeResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DeploymentsClientExportTemplateAtManagementGroupScopeResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DeploymentsClientExportTemplateAtManagementGroupScopeResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DeploymentsClientExportTemplateAtManagementGroupScopeResponse{}, err } - return client.exportTemplateAtManagementGroupScopeHandleResponse(resp) + resp, err := client.exportTemplateAtManagementGroupScopeHandleResponse(httpResp) + return resp, err } // exportTemplateAtManagementGroupScopeCreateRequest creates the ExportTemplateAtManagementGroupScope request. @@ -1327,18 +1535,25 @@ func (client *DeploymentsClient) exportTemplateAtManagementGroupScopeHandleRespo // - options - DeploymentsClientExportTemplateAtScopeOptions contains the optional parameters for the DeploymentsClient.ExportTemplateAtScope // method. func (client *DeploymentsClient) ExportTemplateAtScope(ctx context.Context, scope string, deploymentName string, options *DeploymentsClientExportTemplateAtScopeOptions) (DeploymentsClientExportTemplateAtScopeResponse, error) { + var err error + const operationName = "DeploymentsClient.ExportTemplateAtScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.exportTemplateAtScopeCreateRequest(ctx, scope, deploymentName, options) if err != nil { return DeploymentsClientExportTemplateAtScopeResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DeploymentsClientExportTemplateAtScopeResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DeploymentsClientExportTemplateAtScopeResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DeploymentsClientExportTemplateAtScopeResponse{}, err } - return client.exportTemplateAtScopeHandleResponse(resp) + resp, err := client.exportTemplateAtScopeHandleResponse(httpResp) + return resp, err } // exportTemplateAtScopeCreateRequest creates the ExportTemplateAtScope request. @@ -1377,18 +1592,25 @@ func (client *DeploymentsClient) exportTemplateAtScopeHandleResponse(resp *http. // - options - DeploymentsClientExportTemplateAtSubscriptionScopeOptions contains the optional parameters for the DeploymentsClient.ExportTemplateAtSubscriptionScope // method. func (client *DeploymentsClient) ExportTemplateAtSubscriptionScope(ctx context.Context, deploymentName string, options *DeploymentsClientExportTemplateAtSubscriptionScopeOptions) (DeploymentsClientExportTemplateAtSubscriptionScopeResponse, error) { + var err error + const operationName = "DeploymentsClient.ExportTemplateAtSubscriptionScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.exportTemplateAtSubscriptionScopeCreateRequest(ctx, deploymentName, options) if err != nil { return DeploymentsClientExportTemplateAtSubscriptionScopeResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DeploymentsClientExportTemplateAtSubscriptionScopeResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DeploymentsClientExportTemplateAtSubscriptionScopeResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DeploymentsClientExportTemplateAtSubscriptionScopeResponse{}, err } - return client.exportTemplateAtSubscriptionScopeHandleResponse(resp) + resp, err := client.exportTemplateAtSubscriptionScopeHandleResponse(httpResp) + return resp, err } // exportTemplateAtSubscriptionScopeCreateRequest creates the ExportTemplateAtSubscriptionScope request. @@ -1430,18 +1652,25 @@ func (client *DeploymentsClient) exportTemplateAtSubscriptionScopeHandleResponse // - options - DeploymentsClientExportTemplateAtTenantScopeOptions contains the optional parameters for the DeploymentsClient.ExportTemplateAtTenantScope // method. func (client *DeploymentsClient) ExportTemplateAtTenantScope(ctx context.Context, deploymentName string, options *DeploymentsClientExportTemplateAtTenantScopeOptions) (DeploymentsClientExportTemplateAtTenantScopeResponse, error) { + var err error + const operationName = "DeploymentsClient.ExportTemplateAtTenantScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.exportTemplateAtTenantScopeCreateRequest(ctx, deploymentName, options) if err != nil { return DeploymentsClientExportTemplateAtTenantScopeResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DeploymentsClientExportTemplateAtTenantScopeResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DeploymentsClientExportTemplateAtTenantScopeResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DeploymentsClientExportTemplateAtTenantScopeResponse{}, err } - return client.exportTemplateAtTenantScopeHandleResponse(resp) + resp, err := client.exportTemplateAtTenantScopeHandleResponse(httpResp) + return resp, err } // exportTemplateAtTenantScopeCreateRequest creates the ExportTemplateAtTenantScope request. @@ -1479,18 +1708,25 @@ func (client *DeploymentsClient) exportTemplateAtTenantScopeHandleResponse(resp // - deploymentName - The name of the deployment. // - options - DeploymentsClientGetOptions contains the optional parameters for the DeploymentsClient.Get method. func (client *DeploymentsClient) Get(ctx context.Context, resourceGroupName string, deploymentName string, options *DeploymentsClientGetOptions) (DeploymentsClientGetResponse, error) { + var err error + const operationName = "DeploymentsClient.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, deploymentName, options) if err != nil { return DeploymentsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DeploymentsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DeploymentsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DeploymentsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -1537,18 +1773,25 @@ func (client *DeploymentsClient) getHandleResponse(resp *http.Response) (Deploym // - options - DeploymentsClientGetAtManagementGroupScopeOptions contains the optional parameters for the DeploymentsClient.GetAtManagementGroupScope // method. func (client *DeploymentsClient) GetAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string, options *DeploymentsClientGetAtManagementGroupScopeOptions) (DeploymentsClientGetAtManagementGroupScopeResponse, error) { + var err error + const operationName = "DeploymentsClient.GetAtManagementGroupScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getAtManagementGroupScopeCreateRequest(ctx, groupID, deploymentName, options) if err != nil { return DeploymentsClientGetAtManagementGroupScopeResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DeploymentsClientGetAtManagementGroupScopeResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DeploymentsClientGetAtManagementGroupScopeResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DeploymentsClientGetAtManagementGroupScopeResponse{}, err } - return client.getAtManagementGroupScopeHandleResponse(resp) + resp, err := client.getAtManagementGroupScopeHandleResponse(httpResp) + return resp, err } // getAtManagementGroupScopeCreateRequest creates the GetAtManagementGroupScope request. @@ -1590,18 +1833,25 @@ func (client *DeploymentsClient) getAtManagementGroupScopeHandleResponse(resp *h // - deploymentName - The name of the deployment. // - options - DeploymentsClientGetAtScopeOptions contains the optional parameters for the DeploymentsClient.GetAtScope method. func (client *DeploymentsClient) GetAtScope(ctx context.Context, scope string, deploymentName string, options *DeploymentsClientGetAtScopeOptions) (DeploymentsClientGetAtScopeResponse, error) { + var err error + const operationName = "DeploymentsClient.GetAtScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getAtScopeCreateRequest(ctx, scope, deploymentName, options) if err != nil { return DeploymentsClientGetAtScopeResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DeploymentsClientGetAtScopeResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DeploymentsClientGetAtScopeResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DeploymentsClientGetAtScopeResponse{}, err } - return client.getAtScopeHandleResponse(resp) + resp, err := client.getAtScopeHandleResponse(httpResp) + return resp, err } // getAtScopeCreateRequest creates the GetAtScope request. @@ -1640,18 +1890,25 @@ func (client *DeploymentsClient) getAtScopeHandleResponse(resp *http.Response) ( // - options - DeploymentsClientGetAtSubscriptionScopeOptions contains the optional parameters for the DeploymentsClient.GetAtSubscriptionScope // method. func (client *DeploymentsClient) GetAtSubscriptionScope(ctx context.Context, deploymentName string, options *DeploymentsClientGetAtSubscriptionScopeOptions) (DeploymentsClientGetAtSubscriptionScopeResponse, error) { + var err error + const operationName = "DeploymentsClient.GetAtSubscriptionScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getAtSubscriptionScopeCreateRequest(ctx, deploymentName, options) if err != nil { return DeploymentsClientGetAtSubscriptionScopeResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DeploymentsClientGetAtSubscriptionScopeResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DeploymentsClientGetAtSubscriptionScopeResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DeploymentsClientGetAtSubscriptionScopeResponse{}, err } - return client.getAtSubscriptionScopeHandleResponse(resp) + resp, err := client.getAtSubscriptionScopeHandleResponse(httpResp) + return resp, err } // getAtSubscriptionScopeCreateRequest creates the GetAtSubscriptionScope request. @@ -1693,18 +1950,25 @@ func (client *DeploymentsClient) getAtSubscriptionScopeHandleResponse(resp *http // - options - DeploymentsClientGetAtTenantScopeOptions contains the optional parameters for the DeploymentsClient.GetAtTenantScope // method. func (client *DeploymentsClient) GetAtTenantScope(ctx context.Context, deploymentName string, options *DeploymentsClientGetAtTenantScopeOptions) (DeploymentsClientGetAtTenantScopeResponse, error) { + var err error + const operationName = "DeploymentsClient.GetAtTenantScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getAtTenantScopeCreateRequest(ctx, deploymentName, options) if err != nil { return DeploymentsClientGetAtTenantScopeResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DeploymentsClientGetAtTenantScopeResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DeploymentsClientGetAtTenantScopeResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DeploymentsClientGetAtTenantScopeResponse{}, err } - return client.getAtTenantScopeHandleResponse(resp) + resp, err := client.getAtTenantScopeHandleResponse(httpResp) + return resp, err } // getAtTenantScopeCreateRequest creates the GetAtTenantScope request. @@ -1746,25 +2010,20 @@ func (client *DeploymentsClient) NewListAtManagementGroupScopePager(groupID stri return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *DeploymentsClientListAtManagementGroupScopeResponse) (DeploymentsClientListAtManagementGroupScopeResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listAtManagementGroupScopeCreateRequest(ctx, groupID, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DeploymentsClient.NewListAtManagementGroupScopePager") + 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.listAtManagementGroupScopeCreateRequest(ctx, groupID, options) + }, nil) if err != nil { return DeploymentsClientListAtManagementGroupScopeResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DeploymentsClientListAtManagementGroupScopeResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DeploymentsClientListAtManagementGroupScopeResponse{}, runtime.NewResponseError(resp) - } return client.listAtManagementGroupScopeHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -1813,25 +2072,20 @@ func (client *DeploymentsClient) NewListAtScopePager(scope string, options *Depl return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *DeploymentsClientListAtScopeResponse) (DeploymentsClientListAtScopeResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listAtScopeCreateRequest(ctx, scope, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DeploymentsClient.NewListAtScopePager") + 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.listAtScopeCreateRequest(ctx, scope, options) + }, nil) if err != nil { return DeploymentsClientListAtScopeResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DeploymentsClientListAtScopeResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DeploymentsClientListAtScopeResponse{}, runtime.NewResponseError(resp) - } return client.listAtScopeHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -1876,25 +2130,20 @@ func (client *DeploymentsClient) NewListAtSubscriptionScopePager(options *Deploy return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *DeploymentsClientListAtSubscriptionScopeResponse) (DeploymentsClientListAtSubscriptionScopeResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listAtSubscriptionScopeCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return DeploymentsClientListAtSubscriptionScopeResponse{}, err + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DeploymentsClient.NewListAtSubscriptionScopePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listAtSubscriptionScopeCreateRequest(ctx, options) + }, nil) if err != nil { return DeploymentsClientListAtSubscriptionScopeResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DeploymentsClientListAtSubscriptionScopeResponse{}, runtime.NewResponseError(resp) - } return client.listAtSubscriptionScopeHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -1942,25 +2191,20 @@ func (client *DeploymentsClient) NewListAtTenantScopePager(options *DeploymentsC return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *DeploymentsClientListAtTenantScopeResponse) (DeploymentsClientListAtTenantScopeResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listAtTenantScopeCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return DeploymentsClientListAtTenantScopeResponse{}, err + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DeploymentsClient.NewListAtTenantScopePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listAtTenantScopeCreateRequest(ctx, options) + }, nil) if err != nil { return DeploymentsClientListAtTenantScopeResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DeploymentsClientListAtTenantScopeResponse{}, runtime.NewResponseError(resp) - } return client.listAtTenantScopeHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -2005,25 +2249,20 @@ func (client *DeploymentsClient) NewListByResourceGroupPager(resourceGroupName s return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *DeploymentsClientListByResourceGroupResponse) (DeploymentsClientListByResourceGroupResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return DeploymentsClientListByResourceGroupResponse{}, err + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DeploymentsClient.NewListByResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + 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 DeploymentsClientListByResourceGroupResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DeploymentsClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) - } return client.listByResourceGroupHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -2080,9 +2319,14 @@ func (client *DeploymentsClient) BeginValidate(ctx context.Context, resourceGrou if err != nil { return nil, err } - return runtime.NewPoller[DeploymentsClientValidateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeploymentsClientValidateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[DeploymentsClientValidateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DeploymentsClientValidateResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -2091,18 +2335,24 @@ func (client *DeploymentsClient) BeginValidate(ctx context.Context, resourceGrou // // Generated from API version 2021-04-01 func (client *DeploymentsClient) validate(ctx context.Context, resourceGroupName string, deploymentName string, parameters Deployment, options *DeploymentsClientBeginValidateOptions) (*http.Response, error) { + var err error + const operationName = "DeploymentsClient.BeginValidate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.validateCreateRequest(ctx, resourceGroupName, deploymentName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusBadRequest) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusBadRequest) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // validateCreateRequest creates the Validate request. @@ -2128,7 +2378,10 @@ func (client *DeploymentsClient) validateCreateRequest(ctx context.Context, reso reqQP.Set("api-version", "2021-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginValidateAtManagementGroupScope - Validates whether the specified template is syntactically correct and will be accepted @@ -2147,9 +2400,14 @@ func (client *DeploymentsClient) BeginValidateAtManagementGroupScope(ctx context if err != nil { return nil, err } - return runtime.NewPoller[DeploymentsClientValidateAtManagementGroupScopeResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeploymentsClientValidateAtManagementGroupScopeResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[DeploymentsClientValidateAtManagementGroupScopeResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DeploymentsClientValidateAtManagementGroupScopeResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -2159,18 +2417,24 @@ func (client *DeploymentsClient) BeginValidateAtManagementGroupScope(ctx context // // Generated from API version 2021-04-01 func (client *DeploymentsClient) validateAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string, parameters ScopedDeployment, options *DeploymentsClientBeginValidateAtManagementGroupScopeOptions) (*http.Response, error) { + var err error + const operationName = "DeploymentsClient.BeginValidateAtManagementGroupScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.validateAtManagementGroupScopeCreateRequest(ctx, groupID, deploymentName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusBadRequest) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusBadRequest) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // validateAtManagementGroupScopeCreateRequest creates the ValidateAtManagementGroupScope request. @@ -2192,7 +2456,10 @@ func (client *DeploymentsClient) validateAtManagementGroupScopeCreateRequest(ctx reqQP.Set("api-version", "2021-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginValidateAtScope - Validates whether the specified template is syntactically correct and will be accepted by Azure @@ -2211,9 +2478,14 @@ func (client *DeploymentsClient) BeginValidateAtScope(ctx context.Context, scope if err != nil { return nil, err } - return runtime.NewPoller[DeploymentsClientValidateAtScopeResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeploymentsClientValidateAtScopeResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[DeploymentsClientValidateAtScopeResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DeploymentsClientValidateAtScopeResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -2223,18 +2495,24 @@ func (client *DeploymentsClient) BeginValidateAtScope(ctx context.Context, scope // // Generated from API version 2021-04-01 func (client *DeploymentsClient) validateAtScope(ctx context.Context, scope string, deploymentName string, parameters Deployment, options *DeploymentsClientBeginValidateAtScopeOptions) (*http.Response, error) { + var err error + const operationName = "DeploymentsClient.BeginValidateAtScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.validateAtScopeCreateRequest(ctx, scope, deploymentName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusBadRequest) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusBadRequest) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // validateAtScopeCreateRequest creates the ValidateAtScope request. @@ -2253,7 +2531,10 @@ func (client *DeploymentsClient) validateAtScopeCreateRequest(ctx context.Contex reqQP.Set("api-version", "2021-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginValidateAtSubscriptionScope - Validates whether the specified template is syntactically correct and will be accepted @@ -2271,9 +2552,14 @@ func (client *DeploymentsClient) BeginValidateAtSubscriptionScope(ctx context.Co if err != nil { return nil, err } - return runtime.NewPoller[DeploymentsClientValidateAtSubscriptionScopeResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeploymentsClientValidateAtSubscriptionScopeResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[DeploymentsClientValidateAtSubscriptionScopeResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DeploymentsClientValidateAtSubscriptionScopeResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -2283,18 +2569,24 @@ func (client *DeploymentsClient) BeginValidateAtSubscriptionScope(ctx context.Co // // Generated from API version 2021-04-01 func (client *DeploymentsClient) validateAtSubscriptionScope(ctx context.Context, deploymentName string, parameters Deployment, options *DeploymentsClientBeginValidateAtSubscriptionScopeOptions) (*http.Response, error) { + var err error + const operationName = "DeploymentsClient.BeginValidateAtSubscriptionScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.validateAtSubscriptionScopeCreateRequest(ctx, deploymentName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusBadRequest) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusBadRequest) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // validateAtSubscriptionScopeCreateRequest creates the ValidateAtSubscriptionScope request. @@ -2316,7 +2608,10 @@ func (client *DeploymentsClient) validateAtSubscriptionScopeCreateRequest(ctx co reqQP.Set("api-version", "2021-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginValidateAtTenantScope - Validates whether the specified template is syntactically correct and will be accepted by @@ -2334,9 +2629,14 @@ func (client *DeploymentsClient) BeginValidateAtTenantScope(ctx context.Context, if err != nil { return nil, err } - return runtime.NewPoller[DeploymentsClientValidateAtTenantScopeResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeploymentsClientValidateAtTenantScopeResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[DeploymentsClientValidateAtTenantScopeResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DeploymentsClientValidateAtTenantScopeResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -2346,18 +2646,24 @@ func (client *DeploymentsClient) BeginValidateAtTenantScope(ctx context.Context, // // Generated from API version 2021-04-01 func (client *DeploymentsClient) validateAtTenantScope(ctx context.Context, deploymentName string, parameters ScopedDeployment, options *DeploymentsClientBeginValidateAtTenantScopeOptions) (*http.Response, error) { + var err error + const operationName = "DeploymentsClient.BeginValidateAtTenantScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.validateAtTenantScopeCreateRequest(ctx, deploymentName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusBadRequest) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusBadRequest) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // validateAtTenantScopeCreateRequest creates the ValidateAtTenantScope request. @@ -2375,7 +2681,10 @@ func (client *DeploymentsClient) validateAtTenantScopeCreateRequest(ctx context. reqQP.Set("api-version", "2021-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginWhatIf - Returns changes that will be made by the deployment if executed at the scope of the resource group. @@ -2392,11 +2701,15 @@ func (client *DeploymentsClient) BeginWhatIf(ctx context.Context, resourceGroupN if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeploymentsClientWhatIfResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeploymentsClientWhatIfResponse]{ FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[DeploymentsClientWhatIfResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DeploymentsClientWhatIfResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -2405,18 +2718,24 @@ func (client *DeploymentsClient) BeginWhatIf(ctx context.Context, resourceGroupN // // Generated from API version 2021-04-01 func (client *DeploymentsClient) whatIf(ctx context.Context, resourceGroupName string, deploymentName string, parameters DeploymentWhatIf, options *DeploymentsClientBeginWhatIfOptions) (*http.Response, error) { + var err error + const operationName = "DeploymentsClient.BeginWhatIf" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.whatIfCreateRequest(ctx, resourceGroupName, deploymentName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // whatIfCreateRequest creates the WhatIf request. @@ -2442,7 +2761,10 @@ func (client *DeploymentsClient) whatIfCreateRequest(ctx context.Context, resour reqQP.Set("api-version", "2021-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginWhatIfAtManagementGroupScope - Returns changes that will be made by the deployment if executed at the scope of the @@ -2461,11 +2783,15 @@ func (client *DeploymentsClient) BeginWhatIfAtManagementGroupScope(ctx context.C if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeploymentsClientWhatIfAtManagementGroupScopeResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeploymentsClientWhatIfAtManagementGroupScopeResponse]{ FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[DeploymentsClientWhatIfAtManagementGroupScopeResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DeploymentsClientWhatIfAtManagementGroupScopeResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -2475,18 +2801,24 @@ func (client *DeploymentsClient) BeginWhatIfAtManagementGroupScope(ctx context.C // // Generated from API version 2021-04-01 func (client *DeploymentsClient) whatIfAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string, parameters ScopedDeploymentWhatIf, options *DeploymentsClientBeginWhatIfAtManagementGroupScopeOptions) (*http.Response, error) { + var err error + const operationName = "DeploymentsClient.BeginWhatIfAtManagementGroupScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.whatIfAtManagementGroupScopeCreateRequest(ctx, groupID, deploymentName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // whatIfAtManagementGroupScopeCreateRequest creates the WhatIfAtManagementGroupScope request. @@ -2508,7 +2840,10 @@ func (client *DeploymentsClient) whatIfAtManagementGroupScopeCreateRequest(ctx c reqQP.Set("api-version", "2021-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginWhatIfAtSubscriptionScope - Returns changes that will be made by the deployment if executed at the scope of the subscription. @@ -2525,11 +2860,15 @@ func (client *DeploymentsClient) BeginWhatIfAtSubscriptionScope(ctx context.Cont if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeploymentsClientWhatIfAtSubscriptionScopeResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeploymentsClientWhatIfAtSubscriptionScopeResponse]{ FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[DeploymentsClientWhatIfAtSubscriptionScopeResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DeploymentsClientWhatIfAtSubscriptionScopeResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -2538,18 +2877,24 @@ func (client *DeploymentsClient) BeginWhatIfAtSubscriptionScope(ctx context.Cont // // Generated from API version 2021-04-01 func (client *DeploymentsClient) whatIfAtSubscriptionScope(ctx context.Context, deploymentName string, parameters DeploymentWhatIf, options *DeploymentsClientBeginWhatIfAtSubscriptionScopeOptions) (*http.Response, error) { + var err error + const operationName = "DeploymentsClient.BeginWhatIfAtSubscriptionScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.whatIfAtSubscriptionScopeCreateRequest(ctx, deploymentName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // whatIfAtSubscriptionScopeCreateRequest creates the WhatIfAtSubscriptionScope request. @@ -2571,7 +2916,10 @@ func (client *DeploymentsClient) whatIfAtSubscriptionScopeCreateRequest(ctx cont reqQP.Set("api-version", "2021-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginWhatIfAtTenantScope - Returns changes that will be made by the deployment if executed at the scope of the tenant group. @@ -2588,11 +2936,15 @@ func (client *DeploymentsClient) BeginWhatIfAtTenantScope(ctx context.Context, d if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeploymentsClientWhatIfAtTenantScopeResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeploymentsClientWhatIfAtTenantScopeResponse]{ FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[DeploymentsClientWhatIfAtTenantScopeResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DeploymentsClientWhatIfAtTenantScopeResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -2601,18 +2953,24 @@ func (client *DeploymentsClient) BeginWhatIfAtTenantScope(ctx context.Context, d // // Generated from API version 2021-04-01 func (client *DeploymentsClient) whatIfAtTenantScope(ctx context.Context, deploymentName string, parameters ScopedDeploymentWhatIf, options *DeploymentsClientBeginWhatIfAtTenantScopeOptions) (*http.Response, error) { + var err error + const operationName = "DeploymentsClient.BeginWhatIfAtTenantScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.whatIfAtTenantScopeCreateRequest(ctx, deploymentName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // whatIfAtTenantScopeCreateRequest creates the WhatIfAtTenantScope request. @@ -2630,5 +2988,8 @@ func (client *DeploymentsClient) whatIfAtTenantScopeCreateRequest(ctx context.Co reqQP.Set("api-version", "2021-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/models.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/models.go index 4c1ed376b5..ce98f859a6 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/models.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armresources @@ -87,128 +86,6 @@ type BasicDependency struct { ResourceType *string } -// ClientBeginCreateOrUpdateByIDOptions contains the optional parameters for the Client.BeginCreateOrUpdateByID method. -type ClientBeginCreateOrUpdateByIDOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ClientBeginCreateOrUpdateOptions contains the optional parameters for the Client.BeginCreateOrUpdate method. -type ClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ClientBeginDeleteByIDOptions contains the optional parameters for the Client.BeginDeleteByID method. -type ClientBeginDeleteByIDOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ClientBeginDeleteOptions contains the optional parameters for the Client.BeginDelete method. -type ClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ClientBeginMoveResourcesOptions contains the optional parameters for the Client.BeginMoveResources method. -type ClientBeginMoveResourcesOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ClientBeginUpdateByIDOptions contains the optional parameters for the Client.BeginUpdateByID method. -type ClientBeginUpdateByIDOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ClientBeginUpdateOptions contains the optional parameters for the Client.BeginUpdate method. -type ClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ClientBeginValidateMoveResourcesOptions contains the optional parameters for the Client.BeginValidateMoveResources method. -type ClientBeginValidateMoveResourcesOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ClientCheckExistenceByIDOptions contains the optional parameters for the Client.CheckExistenceByID method. -type ClientCheckExistenceByIDOptions struct { - // placeholder for future optional parameters -} - -// ClientCheckExistenceOptions contains the optional parameters for the Client.CheckExistence method. -type ClientCheckExistenceOptions struct { - // placeholder for future optional parameters -} - -// ClientGetByIDOptions contains the optional parameters for the Client.GetByID method. -type ClientGetByIDOptions struct { - // placeholder for future optional parameters -} - -// ClientGetOptions contains the optional parameters for the Client.Get method. -type ClientGetOptions struct { - // placeholder for future optional parameters -} - -// ClientListByResourceGroupOptions contains the optional parameters for the Client.NewListByResourceGroupPager method. -type ClientListByResourceGroupOptions struct { - // Comma-separated list of additional properties to be included in the response. Valid values include createdTime, changedTime - // and provisioningState. For example, $expand=createdTime,changedTime. - Expand *string - // The filter to apply on the operation. - // The properties you can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, identity, - // identity/principalId, plan, plan/publisher, plan/product, plan/name, - // plan/version, and plan/promotionCode. - // For example, to filter by a resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks' - // You can use substringof(value, property) in the filter. The properties you can use for substring are: name and resourceGroup. - // For example, to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', name) - // You can link more than one substringof together by adding and/or operators. - // You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' - // and tagValue eq 'Value1'. When you filter by a tag name and value, the tags for - // each resource are not returned in the results. - // You can use some properties together when filtering. The combinations you can use are: substringof and/or resourceType, - // plan and plan/publisher and plan/name, identity and identity/principalId. - Filter *string - // The number of results to return. If null is passed, returns all resources. - Top *int32 -} - -// ClientListOptions contains the optional parameters for the Client.NewListPager method. -type ClientListOptions struct { - // Comma-separated list of additional properties to be included in the response. Valid values include createdTime, changedTime - // and provisioningState. For example, $expand=createdTime,changedTime. - Expand *string - // The filter to apply on the operation. - // Filter comparison operators include eq (equals) and ne (not equals) and may be used with the following properties: location, - // resourceType, name, resourceGroup, identity, identity/principalId, plan, - // plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode. - // For example, to filter by a resource type, use $filter=resourceType eq 'Microsoft.Network/virtualNetworks' - // substringof(value, property) can be used to filter for substrings of the following currently-supported properties: name - // and resourceGroup - // For example, to get all resources with 'demo' anywhere in the resource name, use $filter=substringof('demo', name) - // Multiple substring operations can also be combined using and/or operators. - // Note that any truncated number of results queried via $top may also not be compatible when using a filter. - // Resources can be filtered by tag names and values. For example, to filter for a tag name and value, use $filter=tagName - // eq 'tag1' and tagValue eq 'Value1'. Note that when resources are filtered by tag - // name and value, the original tags for each resource will not be returned in the results. Any list of additional properties - // queried via $expand may also not be compatible when filtering by tag - // names/values. - // For tag names only, resources can be filtered by prefix using the following syntax: $filter=startswith(tagName, 'depart'). - // This query will return all resources with a tag name prefixed by the phrase - // depart (i.e.department, departureDate, departureTime, etc.) - // Note that some properties can be combined when filtering resources, which include the following: substringof() and/or resourceType, - // plan and plan/publisher and plan/name, and identity and - // identity/principalId. - Filter *string - // The number of results to return. If null is passed, returns all resources. - Top *int32 -} - // DebugSetting - The debug setting. type DebugSetting struct { // Specifies the type of information to log for debugging. The permitted values are none, requestContent, responseContent, @@ -335,70 +212,6 @@ type DeploymentOperationProperties struct { Timestamp *time.Time } -// DeploymentOperationsClientGetAtManagementGroupScopeOptions contains the optional parameters for the DeploymentOperationsClient.GetAtManagementGroupScope -// method. -type DeploymentOperationsClientGetAtManagementGroupScopeOptions struct { - // placeholder for future optional parameters -} - -// DeploymentOperationsClientGetAtScopeOptions contains the optional parameters for the DeploymentOperationsClient.GetAtScope -// method. -type DeploymentOperationsClientGetAtScopeOptions struct { - // placeholder for future optional parameters -} - -// DeploymentOperationsClientGetAtSubscriptionScopeOptions contains the optional parameters for the DeploymentOperationsClient.GetAtSubscriptionScope -// method. -type DeploymentOperationsClientGetAtSubscriptionScopeOptions struct { - // placeholder for future optional parameters -} - -// DeploymentOperationsClientGetAtTenantScopeOptions contains the optional parameters for the DeploymentOperationsClient.GetAtTenantScope -// method. -type DeploymentOperationsClientGetAtTenantScopeOptions struct { - // placeholder for future optional parameters -} - -// DeploymentOperationsClientGetOptions contains the optional parameters for the DeploymentOperationsClient.Get method. -type DeploymentOperationsClientGetOptions struct { - // placeholder for future optional parameters -} - -// DeploymentOperationsClientListAtManagementGroupScopeOptions contains the optional parameters for the DeploymentOperationsClient.NewListAtManagementGroupScopePager -// method. -type DeploymentOperationsClientListAtManagementGroupScopeOptions struct { - // The number of results to return. - Top *int32 -} - -// DeploymentOperationsClientListAtScopeOptions contains the optional parameters for the DeploymentOperationsClient.NewListAtScopePager -// method. -type DeploymentOperationsClientListAtScopeOptions struct { - // The number of results to return. - Top *int32 -} - -// DeploymentOperationsClientListAtSubscriptionScopeOptions contains the optional parameters for the DeploymentOperationsClient.NewListAtSubscriptionScopePager -// method. -type DeploymentOperationsClientListAtSubscriptionScopeOptions struct { - // The number of results to return. - Top *int32 -} - -// DeploymentOperationsClientListAtTenantScopeOptions contains the optional parameters for the DeploymentOperationsClient.NewListAtTenantScopePager -// method. -type DeploymentOperationsClientListAtTenantScopeOptions struct { - // The number of results to return. - Top *int32 -} - -// DeploymentOperationsClientListOptions contains the optional parameters for the DeploymentOperationsClient.NewListPager -// method. -type DeploymentOperationsClientListOptions struct { - // The number of results to return. - Top *int32 -} - // DeploymentOperationsListResult - List of deployment operations. type DeploymentOperationsListResult struct { // An array of deployment operations. @@ -565,299 +378,6 @@ type DeploymentWhatIfSettings struct { ResultFormat *WhatIfResultFormat } -// DeploymentsClientBeginCreateOrUpdateAtManagementGroupScopeOptions contains the optional parameters for the DeploymentsClient.BeginCreateOrUpdateAtManagementGroupScope -// method. -type DeploymentsClientBeginCreateOrUpdateAtManagementGroupScopeOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DeploymentsClientBeginCreateOrUpdateAtScopeOptions contains the optional parameters for the DeploymentsClient.BeginCreateOrUpdateAtScope -// method. -type DeploymentsClientBeginCreateOrUpdateAtScopeOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DeploymentsClientBeginCreateOrUpdateAtSubscriptionScopeOptions contains the optional parameters for the DeploymentsClient.BeginCreateOrUpdateAtSubscriptionScope -// method. -type DeploymentsClientBeginCreateOrUpdateAtSubscriptionScopeOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DeploymentsClientBeginCreateOrUpdateAtTenantScopeOptions contains the optional parameters for the DeploymentsClient.BeginCreateOrUpdateAtTenantScope -// method. -type DeploymentsClientBeginCreateOrUpdateAtTenantScopeOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DeploymentsClientBeginCreateOrUpdateOptions contains the optional parameters for the DeploymentsClient.BeginCreateOrUpdate -// method. -type DeploymentsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DeploymentsClientBeginDeleteAtManagementGroupScopeOptions contains the optional parameters for the DeploymentsClient.BeginDeleteAtManagementGroupScope -// method. -type DeploymentsClientBeginDeleteAtManagementGroupScopeOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DeploymentsClientBeginDeleteAtScopeOptions contains the optional parameters for the DeploymentsClient.BeginDeleteAtScope -// method. -type DeploymentsClientBeginDeleteAtScopeOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DeploymentsClientBeginDeleteAtSubscriptionScopeOptions contains the optional parameters for the DeploymentsClient.BeginDeleteAtSubscriptionScope -// method. -type DeploymentsClientBeginDeleteAtSubscriptionScopeOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DeploymentsClientBeginDeleteAtTenantScopeOptions contains the optional parameters for the DeploymentsClient.BeginDeleteAtTenantScope -// method. -type DeploymentsClientBeginDeleteAtTenantScopeOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DeploymentsClientBeginDeleteOptions contains the optional parameters for the DeploymentsClient.BeginDelete method. -type DeploymentsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DeploymentsClientBeginValidateAtManagementGroupScopeOptions contains the optional parameters for the DeploymentsClient.BeginValidateAtManagementGroupScope -// method. -type DeploymentsClientBeginValidateAtManagementGroupScopeOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DeploymentsClientBeginValidateAtScopeOptions contains the optional parameters for the DeploymentsClient.BeginValidateAtScope -// method. -type DeploymentsClientBeginValidateAtScopeOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DeploymentsClientBeginValidateAtSubscriptionScopeOptions contains the optional parameters for the DeploymentsClient.BeginValidateAtSubscriptionScope -// method. -type DeploymentsClientBeginValidateAtSubscriptionScopeOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DeploymentsClientBeginValidateAtTenantScopeOptions contains the optional parameters for the DeploymentsClient.BeginValidateAtTenantScope -// method. -type DeploymentsClientBeginValidateAtTenantScopeOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DeploymentsClientBeginValidateOptions contains the optional parameters for the DeploymentsClient.BeginValidate method. -type DeploymentsClientBeginValidateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DeploymentsClientBeginWhatIfAtManagementGroupScopeOptions contains the optional parameters for the DeploymentsClient.BeginWhatIfAtManagementGroupScope -// method. -type DeploymentsClientBeginWhatIfAtManagementGroupScopeOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DeploymentsClientBeginWhatIfAtSubscriptionScopeOptions contains the optional parameters for the DeploymentsClient.BeginWhatIfAtSubscriptionScope -// method. -type DeploymentsClientBeginWhatIfAtSubscriptionScopeOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DeploymentsClientBeginWhatIfAtTenantScopeOptions contains the optional parameters for the DeploymentsClient.BeginWhatIfAtTenantScope -// method. -type DeploymentsClientBeginWhatIfAtTenantScopeOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DeploymentsClientBeginWhatIfOptions contains the optional parameters for the DeploymentsClient.BeginWhatIf method. -type DeploymentsClientBeginWhatIfOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DeploymentsClientCalculateTemplateHashOptions contains the optional parameters for the DeploymentsClient.CalculateTemplateHash -// method. -type DeploymentsClientCalculateTemplateHashOptions struct { - // placeholder for future optional parameters -} - -// DeploymentsClientCancelAtManagementGroupScopeOptions contains the optional parameters for the DeploymentsClient.CancelAtManagementGroupScope -// method. -type DeploymentsClientCancelAtManagementGroupScopeOptions struct { - // placeholder for future optional parameters -} - -// DeploymentsClientCancelAtScopeOptions contains the optional parameters for the DeploymentsClient.CancelAtScope method. -type DeploymentsClientCancelAtScopeOptions struct { - // placeholder for future optional parameters -} - -// DeploymentsClientCancelAtSubscriptionScopeOptions contains the optional parameters for the DeploymentsClient.CancelAtSubscriptionScope -// method. -type DeploymentsClientCancelAtSubscriptionScopeOptions struct { - // placeholder for future optional parameters -} - -// DeploymentsClientCancelAtTenantScopeOptions contains the optional parameters for the DeploymentsClient.CancelAtTenantScope -// method. -type DeploymentsClientCancelAtTenantScopeOptions struct { - // placeholder for future optional parameters -} - -// DeploymentsClientCancelOptions contains the optional parameters for the DeploymentsClient.Cancel method. -type DeploymentsClientCancelOptions struct { - // placeholder for future optional parameters -} - -// DeploymentsClientCheckExistenceAtManagementGroupScopeOptions contains the optional parameters for the DeploymentsClient.CheckExistenceAtManagementGroupScope -// method. -type DeploymentsClientCheckExistenceAtManagementGroupScopeOptions struct { - // placeholder for future optional parameters -} - -// DeploymentsClientCheckExistenceAtScopeOptions contains the optional parameters for the DeploymentsClient.CheckExistenceAtScope -// method. -type DeploymentsClientCheckExistenceAtScopeOptions struct { - // placeholder for future optional parameters -} - -// DeploymentsClientCheckExistenceAtSubscriptionScopeOptions contains the optional parameters for the DeploymentsClient.CheckExistenceAtSubscriptionScope -// method. -type DeploymentsClientCheckExistenceAtSubscriptionScopeOptions struct { - // placeholder for future optional parameters -} - -// DeploymentsClientCheckExistenceAtTenantScopeOptions contains the optional parameters for the DeploymentsClient.CheckExistenceAtTenantScope -// method. -type DeploymentsClientCheckExistenceAtTenantScopeOptions struct { - // placeholder for future optional parameters -} - -// DeploymentsClientCheckExistenceOptions contains the optional parameters for the DeploymentsClient.CheckExistence method. -type DeploymentsClientCheckExistenceOptions struct { - // placeholder for future optional parameters -} - -// DeploymentsClientExportTemplateAtManagementGroupScopeOptions contains the optional parameters for the DeploymentsClient.ExportTemplateAtManagementGroupScope -// method. -type DeploymentsClientExportTemplateAtManagementGroupScopeOptions struct { - // placeholder for future optional parameters -} - -// DeploymentsClientExportTemplateAtScopeOptions contains the optional parameters for the DeploymentsClient.ExportTemplateAtScope -// method. -type DeploymentsClientExportTemplateAtScopeOptions struct { - // placeholder for future optional parameters -} - -// DeploymentsClientExportTemplateAtSubscriptionScopeOptions contains the optional parameters for the DeploymentsClient.ExportTemplateAtSubscriptionScope -// method. -type DeploymentsClientExportTemplateAtSubscriptionScopeOptions struct { - // placeholder for future optional parameters -} - -// DeploymentsClientExportTemplateAtTenantScopeOptions contains the optional parameters for the DeploymentsClient.ExportTemplateAtTenantScope -// method. -type DeploymentsClientExportTemplateAtTenantScopeOptions struct { - // placeholder for future optional parameters -} - -// DeploymentsClientExportTemplateOptions contains the optional parameters for the DeploymentsClient.ExportTemplate method. -type DeploymentsClientExportTemplateOptions struct { - // placeholder for future optional parameters -} - -// DeploymentsClientGetAtManagementGroupScopeOptions contains the optional parameters for the DeploymentsClient.GetAtManagementGroupScope -// method. -type DeploymentsClientGetAtManagementGroupScopeOptions struct { - // placeholder for future optional parameters -} - -// DeploymentsClientGetAtScopeOptions contains the optional parameters for the DeploymentsClient.GetAtScope method. -type DeploymentsClientGetAtScopeOptions struct { - // placeholder for future optional parameters -} - -// DeploymentsClientGetAtSubscriptionScopeOptions contains the optional parameters for the DeploymentsClient.GetAtSubscriptionScope -// method. -type DeploymentsClientGetAtSubscriptionScopeOptions struct { - // placeholder for future optional parameters -} - -// DeploymentsClientGetAtTenantScopeOptions contains the optional parameters for the DeploymentsClient.GetAtTenantScope method. -type DeploymentsClientGetAtTenantScopeOptions struct { - // placeholder for future optional parameters -} - -// DeploymentsClientGetOptions contains the optional parameters for the DeploymentsClient.Get method. -type DeploymentsClientGetOptions struct { - // placeholder for future optional parameters -} - -// DeploymentsClientListAtManagementGroupScopeOptions contains the optional parameters for the DeploymentsClient.NewListAtManagementGroupScopePager -// method. -type DeploymentsClientListAtManagementGroupScopeOptions struct { - // The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. - Filter *string - // The number of results to get. If null is passed, returns all deployments. - Top *int32 -} - -// DeploymentsClientListAtScopeOptions contains the optional parameters for the DeploymentsClient.NewListAtScopePager method. -type DeploymentsClientListAtScopeOptions struct { - // The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. - Filter *string - // The number of results to get. If null is passed, returns all deployments. - Top *int32 -} - -// DeploymentsClientListAtSubscriptionScopeOptions contains the optional parameters for the DeploymentsClient.NewListAtSubscriptionScopePager -// method. -type DeploymentsClientListAtSubscriptionScopeOptions struct { - // The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. - Filter *string - // The number of results to get. If null is passed, returns all deployments. - Top *int32 -} - -// DeploymentsClientListAtTenantScopeOptions contains the optional parameters for the DeploymentsClient.NewListAtTenantScopePager -// method. -type DeploymentsClientListAtTenantScopeOptions struct { - // The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. - Filter *string - // The number of results to get. If null is passed, returns all deployments. - Top *int32 -} - -// DeploymentsClientListByResourceGroupOptions contains the optional parameters for the DeploymentsClient.NewListByResourceGroupPager -// method. -type DeploymentsClientListByResourceGroupOptions struct { - // The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. - Filter *string - // The number of results to get. If null is passed, returns all deployments. - Top *int32 -} - // ErrorAdditionalInfo - The resource management error additional info. type ErrorAdditionalInfo struct { // READ-ONLY; The additional info. @@ -1107,11 +627,6 @@ type OperationListResult struct { Value []*Operation } -// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. -type OperationsClientListOptions struct { - // placeholder for future optional parameters -} - // ParametersLink - Entity representing the reference to the deployment parameters. type ParametersLink struct { // REQUIRED; The URI of the parameters file. @@ -1272,64 +787,6 @@ type ProviderResourceTypeListResult struct { NextLink *string } -// ProviderResourceTypesClientListOptions contains the optional parameters for the ProviderResourceTypesClient.List method. -type ProviderResourceTypesClientListOptions struct { - // The $expand query parameter. For example, to include property aliases in response, use $expand=resourceTypes/aliases. - Expand *string -} - -// ProvidersClientGetAtTenantScopeOptions contains the optional parameters for the ProvidersClient.GetAtTenantScope method. -type ProvidersClientGetAtTenantScopeOptions struct { - // The $expand query parameter. For example, to include property aliases in response, use $expand=resourceTypes/aliases. - Expand *string -} - -// ProvidersClientGetOptions contains the optional parameters for the ProvidersClient.Get method. -type ProvidersClientGetOptions struct { - // The $expand query parameter. For example, to include property aliases in response, use $expand=resourceTypes/aliases. - Expand *string -} - -// ProvidersClientListAtTenantScopeOptions contains the optional parameters for the ProvidersClient.NewListAtTenantScopePager -// method. -type ProvidersClientListAtTenantScopeOptions struct { - // The properties to include in the results. For example, use &$expand=metadata in the query string to retrieve resource provider - // metadata. To include property aliases in response, use - // $expand=resourceTypes/aliases. - Expand *string -} - -// ProvidersClientListOptions contains the optional parameters for the ProvidersClient.NewListPager method. -type ProvidersClientListOptions struct { - // The properties to include in the results. For example, use &$expand=metadata in the query string to retrieve resource provider - // metadata. To include property aliases in response, use - // $expand=resourceTypes/aliases. - Expand *string -} - -// ProvidersClientProviderPermissionsOptions contains the optional parameters for the ProvidersClient.ProviderPermissions -// method. -type ProvidersClientProviderPermissionsOptions struct { - // placeholder for future optional parameters -} - -// ProvidersClientRegisterAtManagementGroupScopeOptions contains the optional parameters for the ProvidersClient.RegisterAtManagementGroupScope -// method. -type ProvidersClientRegisterAtManagementGroupScopeOptions struct { - // placeholder for future optional parameters -} - -// ProvidersClientRegisterOptions contains the optional parameters for the ProvidersClient.Register method. -type ProvidersClientRegisterOptions struct { - // The third party consent for S2S. - Properties *ProviderRegistrationRequest -} - -// ProvidersClientUnregisterOptions contains the optional parameters for the ProvidersClient.Unregister method. -type ProvidersClientUnregisterOptions struct { - // placeholder for future optional parameters -} - // Resource - Specified resource. type Resource struct { // Resource extended location. @@ -1424,53 +881,6 @@ type ResourceGroupProperties struct { ProvisioningState *string } -// ResourceGroupsClientBeginDeleteOptions contains the optional parameters for the ResourceGroupsClient.BeginDelete method. -type ResourceGroupsClientBeginDeleteOptions struct { - // The resource types you want to force delete. Currently, only the following is supported: forceDeletionTypes=Microsoft.Compute/virtualMachines,Microsoft.Compute/virtualMachineScaleSets - ForceDeletionTypes *string - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ResourceGroupsClientBeginExportTemplateOptions contains the optional parameters for the ResourceGroupsClient.BeginExportTemplate -// method. -type ResourceGroupsClientBeginExportTemplateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ResourceGroupsClientCheckExistenceOptions contains the optional parameters for the ResourceGroupsClient.CheckExistence -// method. -type ResourceGroupsClientCheckExistenceOptions struct { - // placeholder for future optional parameters -} - -// ResourceGroupsClientCreateOrUpdateOptions contains the optional parameters for the ResourceGroupsClient.CreateOrUpdate -// method. -type ResourceGroupsClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// ResourceGroupsClientGetOptions contains the optional parameters for the ResourceGroupsClient.Get method. -type ResourceGroupsClientGetOptions struct { - // placeholder for future optional parameters -} - -// ResourceGroupsClientListOptions contains the optional parameters for the ResourceGroupsClient.NewListPager method. -type ResourceGroupsClientListOptions struct { - // The filter to apply on the operation. - // You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' - // and tagValue eq 'Value1' - Filter *string - // The number of results to return. If null is passed, returns all resource groups. - Top *int32 -} - -// ResourceGroupsClientUpdateOptions contains the optional parameters for the ResourceGroupsClient.Update method. -type ResourceGroupsClientUpdateOptions struct { - // placeholder for future optional parameters -} - // ResourceListResult - List of resource groups. type ResourceListResult struct { // An array of resources. @@ -1622,51 +1032,6 @@ type Tags struct { Tags map[string]*string } -// TagsClientCreateOrUpdateAtScopeOptions contains the optional parameters for the TagsClient.CreateOrUpdateAtScope method. -type TagsClientCreateOrUpdateAtScopeOptions struct { - // placeholder for future optional parameters -} - -// TagsClientCreateOrUpdateOptions contains the optional parameters for the TagsClient.CreateOrUpdate method. -type TagsClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// TagsClientCreateOrUpdateValueOptions contains the optional parameters for the TagsClient.CreateOrUpdateValue method. -type TagsClientCreateOrUpdateValueOptions struct { - // placeholder for future optional parameters -} - -// TagsClientDeleteAtScopeOptions contains the optional parameters for the TagsClient.DeleteAtScope method. -type TagsClientDeleteAtScopeOptions struct { - // placeholder for future optional parameters -} - -// TagsClientDeleteOptions contains the optional parameters for the TagsClient.Delete method. -type TagsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// TagsClientDeleteValueOptions contains the optional parameters for the TagsClient.DeleteValue method. -type TagsClientDeleteValueOptions struct { - // placeholder for future optional parameters -} - -// TagsClientGetAtScopeOptions contains the optional parameters for the TagsClient.GetAtScope method. -type TagsClientGetAtScopeOptions struct { - // placeholder for future optional parameters -} - -// TagsClientListOptions contains the optional parameters for the TagsClient.NewListPager method. -type TagsClientListOptions struct { - // placeholder for future optional parameters -} - -// TagsClientUpdateAtScopeOptions contains the optional parameters for the TagsClient.UpdateAtScope method. -type TagsClientUpdateAtScopeOptions struct { - // placeholder for future optional parameters -} - // TagsListResult - List of subscription tags. type TagsListResult struct { // An array of tags. diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/models_serde.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/models_serde.go index df592fc850..5c6e3ac77c 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/models_serde.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/models_serde.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armresources @@ -514,7 +513,7 @@ func (d DeploymentOperationProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "statusCode", d.StatusCode) populate(objectMap, "statusMessage", d.StatusMessage) populate(objectMap, "targetResource", d.TargetResource) - populateTimeRFC3339(objectMap, "timestamp", d.Timestamp) + populateDateTimeRFC3339(objectMap, "timestamp", d.Timestamp) return json.Marshal(objectMap) } @@ -555,7 +554,7 @@ func (d *DeploymentOperationProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, "TargetResource", &d.TargetResource) delete(rawMsg, key) case "timestamp": - err = unpopulateTimeRFC3339(val, "Timestamp", &d.Timestamp) + err = unpopulateDateTimeRFC3339(val, "Timestamp", &d.Timestamp) delete(rawMsg, key) } if err != nil { @@ -669,7 +668,7 @@ func (d DeploymentPropertiesExtended) MarshalJSON() ([]byte, error) { populate(objectMap, "provisioningState", d.ProvisioningState) populate(objectMap, "templateHash", d.TemplateHash) populate(objectMap, "templateLink", d.TemplateLink) - populateTimeRFC3339(objectMap, "timestamp", d.Timestamp) + populateDateTimeRFC3339(objectMap, "timestamp", d.Timestamp) populate(objectMap, "validatedResources", d.ValidatedResources) return json.Marshal(objectMap) } @@ -729,7 +728,7 @@ func (d *DeploymentPropertiesExtended) UnmarshalJSON(data []byte) error { err = unpopulate(val, "TemplateLink", &d.TemplateLink) delete(rawMsg, key) case "timestamp": - err = unpopulateTimeRFC3339(val, "Timestamp", &d.Timestamp) + err = unpopulateDateTimeRFC3339(val, "Timestamp", &d.Timestamp) delete(rawMsg, key) case "validatedResources": err = unpopulate(val, "ValidatedResources", &d.ValidatedResources) @@ -1127,8 +1126,8 @@ func (g *GenericResource) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type GenericResourceExpanded. func (g GenericResourceExpanded) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateTimeRFC3339(objectMap, "changedTime", g.ChangedTime) - populateTimeRFC3339(objectMap, "createdTime", g.CreatedTime) + populateDateTimeRFC3339(objectMap, "changedTime", g.ChangedTime) + populateDateTimeRFC3339(objectMap, "createdTime", g.CreatedTime) populate(objectMap, "extendedLocation", g.ExtendedLocation) populate(objectMap, "id", g.ID) populate(objectMap, "identity", g.Identity) @@ -1155,10 +1154,10 @@ func (g *GenericResourceExpanded) UnmarshalJSON(data []byte) error { var err error switch key { case "changedTime": - err = unpopulateTimeRFC3339(val, "ChangedTime", &g.ChangedTime) + err = unpopulateDateTimeRFC3339(val, "ChangedTime", &g.ChangedTime) delete(rawMsg, key) case "createdTime": - err = unpopulateTimeRFC3339(val, "CreatedTime", &g.CreatedTime) + err = unpopulateDateTimeRFC3339(val, "CreatedTime", &g.CreatedTime) delete(rawMsg, key) case "extendedLocation": err = unpopulate(val, "ExtendedLocation", &g.ExtendedLocation) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/operations_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/operations_client.go index bd4359ecee..e0fc6b961f 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/operations_client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/operations_client.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armresources @@ -28,7 +27,7 @@ type OperationsClient struct { // - 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+".OperationsClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -48,25 +47,20 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + 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 } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return OperationsClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return OperationsClientListResponse{}, runtime.NewResponseError(resp) - } return client.listHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/options.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/options.go new file mode 100644 index 0000000000..dfdb23b0cc --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/options.go @@ -0,0 +1,654 @@ +//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 armresources + +// ClientBeginCreateOrUpdateByIDOptions contains the optional parameters for the Client.BeginCreateOrUpdateByID method. +type ClientBeginCreateOrUpdateByIDOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClientBeginCreateOrUpdateOptions contains the optional parameters for the Client.BeginCreateOrUpdate method. +type ClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClientBeginDeleteByIDOptions contains the optional parameters for the Client.BeginDeleteByID method. +type ClientBeginDeleteByIDOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClientBeginDeleteOptions contains the optional parameters for the Client.BeginDelete method. +type ClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClientBeginMoveResourcesOptions contains the optional parameters for the Client.BeginMoveResources method. +type ClientBeginMoveResourcesOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClientBeginUpdateByIDOptions contains the optional parameters for the Client.BeginUpdateByID method. +type ClientBeginUpdateByIDOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClientBeginUpdateOptions contains the optional parameters for the Client.BeginUpdate method. +type ClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClientBeginValidateMoveResourcesOptions contains the optional parameters for the Client.BeginValidateMoveResources method. +type ClientBeginValidateMoveResourcesOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClientCheckExistenceByIDOptions contains the optional parameters for the Client.CheckExistenceByID method. +type ClientCheckExistenceByIDOptions struct { + // placeholder for future optional parameters +} + +// ClientCheckExistenceOptions contains the optional parameters for the Client.CheckExistence method. +type ClientCheckExistenceOptions struct { + // placeholder for future optional parameters +} + +// ClientGetByIDOptions contains the optional parameters for the Client.GetByID method. +type ClientGetByIDOptions struct { + // placeholder for future optional parameters +} + +// ClientGetOptions contains the optional parameters for the Client.Get method. +type ClientGetOptions struct { + // placeholder for future optional parameters +} + +// ClientListByResourceGroupOptions contains the optional parameters for the Client.NewListByResourceGroupPager method. +type ClientListByResourceGroupOptions struct { + // Comma-separated list of additional properties to be included in the response. Valid values include createdTime, changedTime + // and provisioningState. For example, $expand=createdTime,changedTime. + Expand *string + + // The filter to apply on the operation. + // The properties you can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, identity, + // identity/principalId, plan, plan/publisher, plan/product, plan/name, + // plan/version, and plan/promotionCode. + // For example, to filter by a resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks' + // You can use substringof(value, property) in the filter. The properties you can use for substring are: name and resourceGroup. + // For example, to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', name) + // You can link more than one substringof together by adding and/or operators. + // You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' + // and tagValue eq 'Value1'. When you filter by a tag name and value, the tags for + // each resource are not returned in the results. + // You can use some properties together when filtering. The combinations you can use are: substringof and/or resourceType, + // plan and plan/publisher and plan/name, identity and identity/principalId. + Filter *string + + // The number of results to return. If null is passed, returns all resources. + Top *int32 +} + +// ClientListOptions contains the optional parameters for the Client.NewListPager method. +type ClientListOptions struct { + // Comma-separated list of additional properties to be included in the response. Valid values include createdTime, changedTime + // and provisioningState. For example, $expand=createdTime,changedTime. + Expand *string + + // The filter to apply on the operation. + // Filter comparison operators include eq (equals) and ne (not equals) and may be used with the following properties: location, + // resourceType, name, resourceGroup, identity, identity/principalId, plan, + // plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode. + // For example, to filter by a resource type, use $filter=resourceType eq 'Microsoft.Network/virtualNetworks' + // substringof(value, property) can be used to filter for substrings of the following currently-supported properties: name + // and resourceGroup + // For example, to get all resources with 'demo' anywhere in the resource name, use $filter=substringof('demo', name) + // Multiple substring operations can also be combined using and/or operators. + // Note that any truncated number of results queried via $top may also not be compatible when using a filter. + // Resources can be filtered by tag names and values. For example, to filter for a tag name and value, use $filter=tagName + // eq 'tag1' and tagValue eq 'Value1'. Note that when resources are filtered by tag + // name and value, the original tags for each resource will not be returned in the results. Any list of additional properties + // queried via $expand may also not be compatible when filtering by tag + // names/values. + // For tag names only, resources can be filtered by prefix using the following syntax: $filter=startswith(tagName, 'depart'). + // This query will return all resources with a tag name prefixed by the phrase + // depart (i.e.department, departureDate, departureTime, etc.) + // Note that some properties can be combined when filtering resources, which include the following: substringof() and/or resourceType, + // plan and plan/publisher and plan/name, and identity and + // identity/principalId. + Filter *string + + // The number of results to return. If null is passed, returns all resources. + Top *int32 +} + +// DeploymentOperationsClientGetAtManagementGroupScopeOptions contains the optional parameters for the DeploymentOperationsClient.GetAtManagementGroupScope +// method. +type DeploymentOperationsClientGetAtManagementGroupScopeOptions struct { + // placeholder for future optional parameters +} + +// DeploymentOperationsClientGetAtScopeOptions contains the optional parameters for the DeploymentOperationsClient.GetAtScope +// method. +type DeploymentOperationsClientGetAtScopeOptions struct { + // placeholder for future optional parameters +} + +// DeploymentOperationsClientGetAtSubscriptionScopeOptions contains the optional parameters for the DeploymentOperationsClient.GetAtSubscriptionScope +// method. +type DeploymentOperationsClientGetAtSubscriptionScopeOptions struct { + // placeholder for future optional parameters +} + +// DeploymentOperationsClientGetAtTenantScopeOptions contains the optional parameters for the DeploymentOperationsClient.GetAtTenantScope +// method. +type DeploymentOperationsClientGetAtTenantScopeOptions struct { + // placeholder for future optional parameters +} + +// DeploymentOperationsClientGetOptions contains the optional parameters for the DeploymentOperationsClient.Get method. +type DeploymentOperationsClientGetOptions struct { + // placeholder for future optional parameters +} + +// DeploymentOperationsClientListAtManagementGroupScopeOptions contains the optional parameters for the DeploymentOperationsClient.NewListAtManagementGroupScopePager +// method. +type DeploymentOperationsClientListAtManagementGroupScopeOptions struct { + // The number of results to return. + Top *int32 +} + +// DeploymentOperationsClientListAtScopeOptions contains the optional parameters for the DeploymentOperationsClient.NewListAtScopePager +// method. +type DeploymentOperationsClientListAtScopeOptions struct { + // The number of results to return. + Top *int32 +} + +// DeploymentOperationsClientListAtSubscriptionScopeOptions contains the optional parameters for the DeploymentOperationsClient.NewListAtSubscriptionScopePager +// method. +type DeploymentOperationsClientListAtSubscriptionScopeOptions struct { + // The number of results to return. + Top *int32 +} + +// DeploymentOperationsClientListAtTenantScopeOptions contains the optional parameters for the DeploymentOperationsClient.NewListAtTenantScopePager +// method. +type DeploymentOperationsClientListAtTenantScopeOptions struct { + // The number of results to return. + Top *int32 +} + +// DeploymentOperationsClientListOptions contains the optional parameters for the DeploymentOperationsClient.NewListPager +// method. +type DeploymentOperationsClientListOptions struct { + // The number of results to return. + Top *int32 +} + +// DeploymentsClientBeginCreateOrUpdateAtManagementGroupScopeOptions contains the optional parameters for the DeploymentsClient.BeginCreateOrUpdateAtManagementGroupScope +// method. +type DeploymentsClientBeginCreateOrUpdateAtManagementGroupScopeOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DeploymentsClientBeginCreateOrUpdateAtScopeOptions contains the optional parameters for the DeploymentsClient.BeginCreateOrUpdateAtScope +// method. +type DeploymentsClientBeginCreateOrUpdateAtScopeOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DeploymentsClientBeginCreateOrUpdateAtSubscriptionScopeOptions contains the optional parameters for the DeploymentsClient.BeginCreateOrUpdateAtSubscriptionScope +// method. +type DeploymentsClientBeginCreateOrUpdateAtSubscriptionScopeOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DeploymentsClientBeginCreateOrUpdateAtTenantScopeOptions contains the optional parameters for the DeploymentsClient.BeginCreateOrUpdateAtTenantScope +// method. +type DeploymentsClientBeginCreateOrUpdateAtTenantScopeOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DeploymentsClientBeginCreateOrUpdateOptions contains the optional parameters for the DeploymentsClient.BeginCreateOrUpdate +// method. +type DeploymentsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DeploymentsClientBeginDeleteAtManagementGroupScopeOptions contains the optional parameters for the DeploymentsClient.BeginDeleteAtManagementGroupScope +// method. +type DeploymentsClientBeginDeleteAtManagementGroupScopeOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DeploymentsClientBeginDeleteAtScopeOptions contains the optional parameters for the DeploymentsClient.BeginDeleteAtScope +// method. +type DeploymentsClientBeginDeleteAtScopeOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DeploymentsClientBeginDeleteAtSubscriptionScopeOptions contains the optional parameters for the DeploymentsClient.BeginDeleteAtSubscriptionScope +// method. +type DeploymentsClientBeginDeleteAtSubscriptionScopeOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DeploymentsClientBeginDeleteAtTenantScopeOptions contains the optional parameters for the DeploymentsClient.BeginDeleteAtTenantScope +// method. +type DeploymentsClientBeginDeleteAtTenantScopeOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DeploymentsClientBeginDeleteOptions contains the optional parameters for the DeploymentsClient.BeginDelete method. +type DeploymentsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DeploymentsClientBeginValidateAtManagementGroupScopeOptions contains the optional parameters for the DeploymentsClient.BeginValidateAtManagementGroupScope +// method. +type DeploymentsClientBeginValidateAtManagementGroupScopeOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DeploymentsClientBeginValidateAtScopeOptions contains the optional parameters for the DeploymentsClient.BeginValidateAtScope +// method. +type DeploymentsClientBeginValidateAtScopeOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DeploymentsClientBeginValidateAtSubscriptionScopeOptions contains the optional parameters for the DeploymentsClient.BeginValidateAtSubscriptionScope +// method. +type DeploymentsClientBeginValidateAtSubscriptionScopeOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DeploymentsClientBeginValidateAtTenantScopeOptions contains the optional parameters for the DeploymentsClient.BeginValidateAtTenantScope +// method. +type DeploymentsClientBeginValidateAtTenantScopeOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DeploymentsClientBeginValidateOptions contains the optional parameters for the DeploymentsClient.BeginValidate method. +type DeploymentsClientBeginValidateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DeploymentsClientBeginWhatIfAtManagementGroupScopeOptions contains the optional parameters for the DeploymentsClient.BeginWhatIfAtManagementGroupScope +// method. +type DeploymentsClientBeginWhatIfAtManagementGroupScopeOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DeploymentsClientBeginWhatIfAtSubscriptionScopeOptions contains the optional parameters for the DeploymentsClient.BeginWhatIfAtSubscriptionScope +// method. +type DeploymentsClientBeginWhatIfAtSubscriptionScopeOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DeploymentsClientBeginWhatIfAtTenantScopeOptions contains the optional parameters for the DeploymentsClient.BeginWhatIfAtTenantScope +// method. +type DeploymentsClientBeginWhatIfAtTenantScopeOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DeploymentsClientBeginWhatIfOptions contains the optional parameters for the DeploymentsClient.BeginWhatIf method. +type DeploymentsClientBeginWhatIfOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DeploymentsClientCalculateTemplateHashOptions contains the optional parameters for the DeploymentsClient.CalculateTemplateHash +// method. +type DeploymentsClientCalculateTemplateHashOptions struct { + // placeholder for future optional parameters +} + +// DeploymentsClientCancelAtManagementGroupScopeOptions contains the optional parameters for the DeploymentsClient.CancelAtManagementGroupScope +// method. +type DeploymentsClientCancelAtManagementGroupScopeOptions struct { + // placeholder for future optional parameters +} + +// DeploymentsClientCancelAtScopeOptions contains the optional parameters for the DeploymentsClient.CancelAtScope method. +type DeploymentsClientCancelAtScopeOptions struct { + // placeholder for future optional parameters +} + +// DeploymentsClientCancelAtSubscriptionScopeOptions contains the optional parameters for the DeploymentsClient.CancelAtSubscriptionScope +// method. +type DeploymentsClientCancelAtSubscriptionScopeOptions struct { + // placeholder for future optional parameters +} + +// DeploymentsClientCancelAtTenantScopeOptions contains the optional parameters for the DeploymentsClient.CancelAtTenantScope +// method. +type DeploymentsClientCancelAtTenantScopeOptions struct { + // placeholder for future optional parameters +} + +// DeploymentsClientCancelOptions contains the optional parameters for the DeploymentsClient.Cancel method. +type DeploymentsClientCancelOptions struct { + // placeholder for future optional parameters +} + +// DeploymentsClientCheckExistenceAtManagementGroupScopeOptions contains the optional parameters for the DeploymentsClient.CheckExistenceAtManagementGroupScope +// method. +type DeploymentsClientCheckExistenceAtManagementGroupScopeOptions struct { + // placeholder for future optional parameters +} + +// DeploymentsClientCheckExistenceAtScopeOptions contains the optional parameters for the DeploymentsClient.CheckExistenceAtScope +// method. +type DeploymentsClientCheckExistenceAtScopeOptions struct { + // placeholder for future optional parameters +} + +// DeploymentsClientCheckExistenceAtSubscriptionScopeOptions contains the optional parameters for the DeploymentsClient.CheckExistenceAtSubscriptionScope +// method. +type DeploymentsClientCheckExistenceAtSubscriptionScopeOptions struct { + // placeholder for future optional parameters +} + +// DeploymentsClientCheckExistenceAtTenantScopeOptions contains the optional parameters for the DeploymentsClient.CheckExistenceAtTenantScope +// method. +type DeploymentsClientCheckExistenceAtTenantScopeOptions struct { + // placeholder for future optional parameters +} + +// DeploymentsClientCheckExistenceOptions contains the optional parameters for the DeploymentsClient.CheckExistence method. +type DeploymentsClientCheckExistenceOptions struct { + // placeholder for future optional parameters +} + +// DeploymentsClientExportTemplateAtManagementGroupScopeOptions contains the optional parameters for the DeploymentsClient.ExportTemplateAtManagementGroupScope +// method. +type DeploymentsClientExportTemplateAtManagementGroupScopeOptions struct { + // placeholder for future optional parameters +} + +// DeploymentsClientExportTemplateAtScopeOptions contains the optional parameters for the DeploymentsClient.ExportTemplateAtScope +// method. +type DeploymentsClientExportTemplateAtScopeOptions struct { + // placeholder for future optional parameters +} + +// DeploymentsClientExportTemplateAtSubscriptionScopeOptions contains the optional parameters for the DeploymentsClient.ExportTemplateAtSubscriptionScope +// method. +type DeploymentsClientExportTemplateAtSubscriptionScopeOptions struct { + // placeholder for future optional parameters +} + +// DeploymentsClientExportTemplateAtTenantScopeOptions contains the optional parameters for the DeploymentsClient.ExportTemplateAtTenantScope +// method. +type DeploymentsClientExportTemplateAtTenantScopeOptions struct { + // placeholder for future optional parameters +} + +// DeploymentsClientExportTemplateOptions contains the optional parameters for the DeploymentsClient.ExportTemplate method. +type DeploymentsClientExportTemplateOptions struct { + // placeholder for future optional parameters +} + +// DeploymentsClientGetAtManagementGroupScopeOptions contains the optional parameters for the DeploymentsClient.GetAtManagementGroupScope +// method. +type DeploymentsClientGetAtManagementGroupScopeOptions struct { + // placeholder for future optional parameters +} + +// DeploymentsClientGetAtScopeOptions contains the optional parameters for the DeploymentsClient.GetAtScope method. +type DeploymentsClientGetAtScopeOptions struct { + // placeholder for future optional parameters +} + +// DeploymentsClientGetAtSubscriptionScopeOptions contains the optional parameters for the DeploymentsClient.GetAtSubscriptionScope +// method. +type DeploymentsClientGetAtSubscriptionScopeOptions struct { + // placeholder for future optional parameters +} + +// DeploymentsClientGetAtTenantScopeOptions contains the optional parameters for the DeploymentsClient.GetAtTenantScope method. +type DeploymentsClientGetAtTenantScopeOptions struct { + // placeholder for future optional parameters +} + +// DeploymentsClientGetOptions contains the optional parameters for the DeploymentsClient.Get method. +type DeploymentsClientGetOptions struct { + // placeholder for future optional parameters +} + +// DeploymentsClientListAtManagementGroupScopeOptions contains the optional parameters for the DeploymentsClient.NewListAtManagementGroupScopePager +// method. +type DeploymentsClientListAtManagementGroupScopeOptions struct { + // The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + Filter *string + + // The number of results to get. If null is passed, returns all deployments. + Top *int32 +} + +// DeploymentsClientListAtScopeOptions contains the optional parameters for the DeploymentsClient.NewListAtScopePager method. +type DeploymentsClientListAtScopeOptions struct { + // The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + Filter *string + + // The number of results to get. If null is passed, returns all deployments. + Top *int32 +} + +// DeploymentsClientListAtSubscriptionScopeOptions contains the optional parameters for the DeploymentsClient.NewListAtSubscriptionScopePager +// method. +type DeploymentsClientListAtSubscriptionScopeOptions struct { + // The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + Filter *string + + // The number of results to get. If null is passed, returns all deployments. + Top *int32 +} + +// DeploymentsClientListAtTenantScopeOptions contains the optional parameters for the DeploymentsClient.NewListAtTenantScopePager +// method. +type DeploymentsClientListAtTenantScopeOptions struct { + // The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + Filter *string + + // The number of results to get. If null is passed, returns all deployments. + Top *int32 +} + +// DeploymentsClientListByResourceGroupOptions contains the optional parameters for the DeploymentsClient.NewListByResourceGroupPager +// method. +type DeploymentsClientListByResourceGroupOptions struct { + // The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + Filter *string + + // The number of results to get. If null is passed, returns all deployments. + Top *int32 +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// ProviderResourceTypesClientListOptions contains the optional parameters for the ProviderResourceTypesClient.List method. +type ProviderResourceTypesClientListOptions struct { + // The $expand query parameter. For example, to include property aliases in response, use $expand=resourceTypes/aliases. + Expand *string +} + +// ProvidersClientGetAtTenantScopeOptions contains the optional parameters for the ProvidersClient.GetAtTenantScope method. +type ProvidersClientGetAtTenantScopeOptions struct { + // The $expand query parameter. For example, to include property aliases in response, use $expand=resourceTypes/aliases. + Expand *string +} + +// ProvidersClientGetOptions contains the optional parameters for the ProvidersClient.Get method. +type ProvidersClientGetOptions struct { + // The $expand query parameter. For example, to include property aliases in response, use $expand=resourceTypes/aliases. + Expand *string +} + +// ProvidersClientListAtTenantScopeOptions contains the optional parameters for the ProvidersClient.NewListAtTenantScopePager +// method. +type ProvidersClientListAtTenantScopeOptions struct { + // The properties to include in the results. For example, use &$expand=metadata in the query string to retrieve resource provider + // metadata. To include property aliases in response, use + // $expand=resourceTypes/aliases. + Expand *string +} + +// ProvidersClientListOptions contains the optional parameters for the ProvidersClient.NewListPager method. +type ProvidersClientListOptions struct { + // The properties to include in the results. For example, use &$expand=metadata in the query string to retrieve resource provider + // metadata. To include property aliases in response, use + // $expand=resourceTypes/aliases. + Expand *string +} + +// ProvidersClientProviderPermissionsOptions contains the optional parameters for the ProvidersClient.ProviderPermissions +// method. +type ProvidersClientProviderPermissionsOptions struct { + // placeholder for future optional parameters +} + +// ProvidersClientRegisterAtManagementGroupScopeOptions contains the optional parameters for the ProvidersClient.RegisterAtManagementGroupScope +// method. +type ProvidersClientRegisterAtManagementGroupScopeOptions struct { + // placeholder for future optional parameters +} + +// ProvidersClientRegisterOptions contains the optional parameters for the ProvidersClient.Register method. +type ProvidersClientRegisterOptions struct { + // The third party consent for S2S. + Properties *ProviderRegistrationRequest +} + +// ProvidersClientUnregisterOptions contains the optional parameters for the ProvidersClient.Unregister method. +type ProvidersClientUnregisterOptions struct { + // placeholder for future optional parameters +} + +// ResourceGroupsClientBeginDeleteOptions contains the optional parameters for the ResourceGroupsClient.BeginDelete method. +type ResourceGroupsClientBeginDeleteOptions struct { + // The resource types you want to force delete. Currently, only the following is supported: forceDeletionTypes=Microsoft.Compute/virtualMachines,Microsoft.Compute/virtualMachineScaleSets + ForceDeletionTypes *string + + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ResourceGroupsClientBeginExportTemplateOptions contains the optional parameters for the ResourceGroupsClient.BeginExportTemplate +// method. +type ResourceGroupsClientBeginExportTemplateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ResourceGroupsClientCheckExistenceOptions contains the optional parameters for the ResourceGroupsClient.CheckExistence +// method. +type ResourceGroupsClientCheckExistenceOptions struct { + // placeholder for future optional parameters +} + +// ResourceGroupsClientCreateOrUpdateOptions contains the optional parameters for the ResourceGroupsClient.CreateOrUpdate +// method. +type ResourceGroupsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// ResourceGroupsClientGetOptions contains the optional parameters for the ResourceGroupsClient.Get method. +type ResourceGroupsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ResourceGroupsClientListOptions contains the optional parameters for the ResourceGroupsClient.NewListPager method. +type ResourceGroupsClientListOptions struct { + // The filter to apply on the operation. + // You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' + // and tagValue eq 'Value1' + Filter *string + + // The number of results to return. If null is passed, returns all resource groups. + Top *int32 +} + +// ResourceGroupsClientUpdateOptions contains the optional parameters for the ResourceGroupsClient.Update method. +type ResourceGroupsClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// TagsClientCreateOrUpdateAtScopeOptions contains the optional parameters for the TagsClient.CreateOrUpdateAtScope method. +type TagsClientCreateOrUpdateAtScopeOptions struct { + // placeholder for future optional parameters +} + +// TagsClientCreateOrUpdateOptions contains the optional parameters for the TagsClient.CreateOrUpdate method. +type TagsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// TagsClientCreateOrUpdateValueOptions contains the optional parameters for the TagsClient.CreateOrUpdateValue method. +type TagsClientCreateOrUpdateValueOptions struct { + // placeholder for future optional parameters +} + +// TagsClientDeleteAtScopeOptions contains the optional parameters for the TagsClient.DeleteAtScope method. +type TagsClientDeleteAtScopeOptions struct { + // placeholder for future optional parameters +} + +// TagsClientDeleteOptions contains the optional parameters for the TagsClient.Delete method. +type TagsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// TagsClientDeleteValueOptions contains the optional parameters for the TagsClient.DeleteValue method. +type TagsClientDeleteValueOptions struct { + // placeholder for future optional parameters +} + +// TagsClientGetAtScopeOptions contains the optional parameters for the TagsClient.GetAtScope method. +type TagsClientGetAtScopeOptions struct { + // placeholder for future optional parameters +} + +// TagsClientListOptions contains the optional parameters for the TagsClient.NewListPager method. +type TagsClientListOptions struct { + // placeholder for future optional parameters +} + +// TagsClientUpdateAtScopeOptions contains the optional parameters for the TagsClient.UpdateAtScope method. +type TagsClientUpdateAtScopeOptions struct { + // placeholder for future optional parameters +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/providerresourcetypes_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/providerresourcetypes_client.go index c4b54fa844..a64c08f021 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/providerresourcetypes_client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/providerresourcetypes_client.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armresources @@ -33,7 +32,7 @@ type ProviderResourceTypesClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewProviderResourceTypesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ProviderResourceTypesClient, error) { - cl, err := arm.NewClient(moduleName+".ProviderResourceTypesClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -52,18 +51,25 @@ func NewProviderResourceTypesClient(subscriptionID string, credential azcore.Tok // - options - ProviderResourceTypesClientListOptions contains the optional parameters for the ProviderResourceTypesClient.List // method. func (client *ProviderResourceTypesClient) List(ctx context.Context, resourceProviderNamespace string, options *ProviderResourceTypesClientListOptions) (ProviderResourceTypesClientListResponse, error) { + var err error + const operationName = "ProviderResourceTypesClient.List" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.listCreateRequest(ctx, resourceProviderNamespace, options) if err != nil { return ProviderResourceTypesClientListResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ProviderResourceTypesClientListResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ProviderResourceTypesClientListResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ProviderResourceTypesClientListResponse{}, err } - return client.listHandleResponse(resp) + resp, err := client.listHandleResponse(httpResp) + return resp, err } // listCreateRequest creates the List request. diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/providers_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/providers_client.go index cefb0e0393..e1612d1609 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/providers_client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/providers_client.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armresources @@ -33,7 +32,7 @@ type ProvidersClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewProvidersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ProvidersClient, error) { - cl, err := arm.NewClient(moduleName+".ProvidersClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -51,18 +50,25 @@ func NewProvidersClient(subscriptionID string, credential azcore.TokenCredential // - resourceProviderNamespace - The namespace of the resource provider. // - options - ProvidersClientGetOptions contains the optional parameters for the ProvidersClient.Get method. func (client *ProvidersClient) Get(ctx context.Context, resourceProviderNamespace string, options *ProvidersClientGetOptions) (ProvidersClientGetResponse, error) { + var err error + const operationName = "ProvidersClient.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, resourceProviderNamespace, options) if err != nil { return ProvidersClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ProvidersClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ProvidersClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ProvidersClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -107,18 +113,25 @@ func (client *ProvidersClient) getHandleResponse(resp *http.Response) (Providers // - options - ProvidersClientGetAtTenantScopeOptions contains the optional parameters for the ProvidersClient.GetAtTenantScope // method. func (client *ProvidersClient) GetAtTenantScope(ctx context.Context, resourceProviderNamespace string, options *ProvidersClientGetAtTenantScopeOptions) (ProvidersClientGetAtTenantScopeResponse, error) { + var err error + const operationName = "ProvidersClient.GetAtTenantScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getAtTenantScopeCreateRequest(ctx, resourceProviderNamespace, options) if err != nil { return ProvidersClientGetAtTenantScopeResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ProvidersClientGetAtTenantScopeResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ProvidersClientGetAtTenantScopeResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ProvidersClientGetAtTenantScopeResponse{}, err } - return client.getAtTenantScopeHandleResponse(resp) + resp, err := client.getAtTenantScopeHandleResponse(httpResp) + return resp, err } // getAtTenantScopeCreateRequest creates the GetAtTenantScope request. @@ -161,25 +174,20 @@ func (client *ProvidersClient) NewListPager(options *ProvidersClientListOptions) return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *ProvidersClientListResponse) (ProvidersClientListResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ProvidersClient.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 ProvidersClientListResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ProvidersClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ProvidersClientListResponse{}, runtime.NewResponseError(resp) - } return client.listHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -224,25 +232,20 @@ func (client *ProvidersClient) NewListAtTenantScopePager(options *ProvidersClien return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *ProvidersClientListAtTenantScopeResponse) (ProvidersClientListAtTenantScopeResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listAtTenantScopeCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return ProvidersClientListAtTenantScopeResponse{}, err + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ProvidersClient.NewListAtTenantScopePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listAtTenantScopeCreateRequest(ctx, options) + }, nil) if err != nil { return ProvidersClientListAtTenantScopeResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ProvidersClientListAtTenantScopeResponse{}, runtime.NewResponseError(resp) - } return client.listAtTenantScopeHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -280,18 +283,25 @@ func (client *ProvidersClient) listAtTenantScopeHandleResponse(resp *http.Respon // - options - ProvidersClientProviderPermissionsOptions contains the optional parameters for the ProvidersClient.ProviderPermissions // method. func (client *ProvidersClient) ProviderPermissions(ctx context.Context, resourceProviderNamespace string, options *ProvidersClientProviderPermissionsOptions) (ProvidersClientProviderPermissionsResponse, error) { + var err error + const operationName = "ProvidersClient.ProviderPermissions" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.providerPermissionsCreateRequest(ctx, resourceProviderNamespace, options) if err != nil { return ProvidersClientProviderPermissionsResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ProvidersClientProviderPermissionsResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ProvidersClientProviderPermissionsResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ProvidersClientProviderPermissionsResponse{}, err } - return client.providerPermissionsHandleResponse(resp) + resp, err := client.providerPermissionsHandleResponse(httpResp) + return resp, err } // providerPermissionsCreateRequest creates the ProviderPermissions request. @@ -332,18 +342,25 @@ func (client *ProvidersClient) providerPermissionsHandleResponse(resp *http.Resp // - resourceProviderNamespace - The namespace of the resource provider to register. // - options - ProvidersClientRegisterOptions contains the optional parameters for the ProvidersClient.Register method. func (client *ProvidersClient) Register(ctx context.Context, resourceProviderNamespace string, options *ProvidersClientRegisterOptions) (ProvidersClientRegisterResponse, error) { + var err error + const operationName = "ProvidersClient.Register" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.registerCreateRequest(ctx, resourceProviderNamespace, options) if err != nil { return ProvidersClientRegisterResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ProvidersClientRegisterResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ProvidersClientRegisterResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ProvidersClientRegisterResponse{}, err } - return client.registerHandleResponse(resp) + resp, err := client.registerHandleResponse(httpResp) + return resp, err } // registerCreateRequest creates the Register request. @@ -366,7 +383,10 @@ func (client *ProvidersClient) registerCreateRequest(ctx context.Context, resour req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Properties != nil { - return req, runtime.MarshalAsJSON(req, *options.Properties) + if err := runtime.MarshalAsJSON(req, *options.Properties); err != nil { + return nil, err + } + return req, nil } return req, nil } @@ -389,16 +409,22 @@ func (client *ProvidersClient) registerHandleResponse(resp *http.Response) (Prov // - options - ProvidersClientRegisterAtManagementGroupScopeOptions contains the optional parameters for the ProvidersClient.RegisterAtManagementGroupScope // method. func (client *ProvidersClient) RegisterAtManagementGroupScope(ctx context.Context, resourceProviderNamespace string, groupID string, options *ProvidersClientRegisterAtManagementGroupScopeOptions) (ProvidersClientRegisterAtManagementGroupScopeResponse, error) { + var err error + const operationName = "ProvidersClient.RegisterAtManagementGroupScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.registerAtManagementGroupScopeCreateRequest(ctx, resourceProviderNamespace, groupID, options) if err != nil { return ProvidersClientRegisterAtManagementGroupScopeResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ProvidersClientRegisterAtManagementGroupScopeResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ProvidersClientRegisterAtManagementGroupScopeResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ProvidersClientRegisterAtManagementGroupScopeResponse{}, err } return ProvidersClientRegisterAtManagementGroupScopeResponse{}, nil } @@ -432,18 +458,25 @@ func (client *ProvidersClient) registerAtManagementGroupScopeCreateRequest(ctx c // - resourceProviderNamespace - The namespace of the resource provider to unregister. // - options - ProvidersClientUnregisterOptions contains the optional parameters for the ProvidersClient.Unregister method. func (client *ProvidersClient) Unregister(ctx context.Context, resourceProviderNamespace string, options *ProvidersClientUnregisterOptions) (ProvidersClientUnregisterResponse, error) { + var err error + const operationName = "ProvidersClient.Unregister" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.unregisterCreateRequest(ctx, resourceProviderNamespace, options) if err != nil { return ProvidersClientUnregisterResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ProvidersClientUnregisterResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ProvidersClientUnregisterResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ProvidersClientUnregisterResponse{}, err } - return client.unregisterHandleResponse(resp) + resp, err := client.unregisterHandleResponse(httpResp) + return resp, err } // unregisterCreateRequest creates the Unregister request. diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/resourcegroups_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/resourcegroups_client.go index cf48c26f51..b228d9f643 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/resourcegroups_client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/resourcegroups_client.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armresources @@ -34,7 +33,7 @@ type ResourceGroupsClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewResourceGroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ResourceGroupsClient, error) { - cl, err := arm.NewClient(moduleName+".ResourceGroupsClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -52,18 +51,24 @@ func NewResourceGroupsClient(subscriptionID string, credential azcore.TokenCrede // - options - ResourceGroupsClientCheckExistenceOptions contains the optional parameters for the ResourceGroupsClient.CheckExistence // method. func (client *ResourceGroupsClient) CheckExistence(ctx context.Context, resourceGroupName string, options *ResourceGroupsClientCheckExistenceOptions) (ResourceGroupsClientCheckExistenceResponse, error) { + var err error + const operationName = "ResourceGroupsClient.CheckExistence" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.checkExistenceCreateRequest(ctx, resourceGroupName, options) if err != nil { return ResourceGroupsClientCheckExistenceResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ResourceGroupsClientCheckExistenceResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusNoContent, http.StatusNotFound) { - return ResourceGroupsClientCheckExistenceResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusNoContent, http.StatusNotFound) { + err = runtime.NewResponseError(httpResp) + return ResourceGroupsClientCheckExistenceResponse{}, err } - return ResourceGroupsClientCheckExistenceResponse{Success: resp.StatusCode >= 200 && resp.StatusCode < 300}, nil + return ResourceGroupsClientCheckExistenceResponse{Success: httpResp.StatusCode >= 200 && httpResp.StatusCode < 300}, nil } // checkExistenceCreateRequest creates the CheckExistence request. @@ -98,18 +103,25 @@ func (client *ResourceGroupsClient) checkExistenceCreateRequest(ctx context.Cont // - options - ResourceGroupsClientCreateOrUpdateOptions contains the optional parameters for the ResourceGroupsClient.CreateOrUpdate // method. func (client *ResourceGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, parameters ResourceGroup, options *ResourceGroupsClientCreateOrUpdateOptions) (ResourceGroupsClientCreateOrUpdateResponse, error) { + var err error + const operationName = "ResourceGroupsClient.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, resourceGroupName, parameters, options) if err != nil { return ResourceGroupsClientCreateOrUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ResourceGroupsClientCreateOrUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return ResourceGroupsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return ResourceGroupsClientCreateOrUpdateResponse{}, err } - return client.createOrUpdateHandleResponse(resp) + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -131,7 +143,10 @@ func (client *ResourceGroupsClient) createOrUpdateCreateRequest(ctx context.Cont reqQP.Set("api-version", "2021-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // createOrUpdateHandleResponse handles the CreateOrUpdate response. @@ -157,9 +172,14 @@ func (client *ResourceGroupsClient) BeginDelete(ctx context.Context, resourceGro if err != nil { return nil, err } - return runtime.NewPoller[ResourceGroupsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ResourceGroupsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[ResourceGroupsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ResourceGroupsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -169,18 +189,24 @@ func (client *ResourceGroupsClient) BeginDelete(ctx context.Context, resourceGro // // Generated from API version 2021-04-01 func (client *ResourceGroupsClient) deleteOperation(ctx context.Context, resourceGroupName string, options *ResourceGroupsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "ResourceGroupsClient.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, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -222,11 +248,15 @@ func (client *ResourceGroupsClient) BeginExportTemplate(ctx context.Context, res if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ResourceGroupsClientExportTemplateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ResourceGroupsClientExportTemplateResponse]{ FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[ResourceGroupsClientExportTemplateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ResourceGroupsClientExportTemplateResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -235,18 +265,24 @@ func (client *ResourceGroupsClient) BeginExportTemplate(ctx context.Context, res // // Generated from API version 2021-04-01 func (client *ResourceGroupsClient) exportTemplate(ctx context.Context, resourceGroupName string, parameters ExportTemplateRequest, options *ResourceGroupsClientBeginExportTemplateOptions) (*http.Response, error) { + var err error + const operationName = "ResourceGroupsClient.BeginExportTemplate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.exportTemplateCreateRequest(ctx, resourceGroupName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // exportTemplateCreateRequest creates the ExportTemplate request. @@ -268,7 +304,10 @@ func (client *ResourceGroupsClient) exportTemplateCreateRequest(ctx context.Cont reqQP.Set("api-version", "2021-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // Get - Gets a resource group. @@ -278,18 +317,25 @@ func (client *ResourceGroupsClient) exportTemplateCreateRequest(ctx context.Cont // - resourceGroupName - The name of the resource group to get. The name is case insensitive. // - options - ResourceGroupsClientGetOptions contains the optional parameters for the ResourceGroupsClient.Get method. func (client *ResourceGroupsClient) Get(ctx context.Context, resourceGroupName string, options *ResourceGroupsClientGetOptions) (ResourceGroupsClientGetResponse, error) { + var err error + const operationName = "ResourceGroupsClient.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, options) if err != nil { return ResourceGroupsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ResourceGroupsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ResourceGroupsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ResourceGroupsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -333,25 +379,20 @@ func (client *ResourceGroupsClient) NewListPager(options *ResourceGroupsClientLi return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *ResourceGroupsClientListResponse) (ResourceGroupsClientListResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return ResourceGroupsClientListResponse{}, err + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ResourceGroupsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + 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 ResourceGroupsClientListResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ResourceGroupsClientListResponse{}, runtime.NewResponseError(resp) - } return client.listHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -398,18 +439,25 @@ func (client *ResourceGroupsClient) listHandleResponse(resp *http.Response) (Res // - parameters - Parameters supplied to update a resource group. // - options - ResourceGroupsClientUpdateOptions contains the optional parameters for the ResourceGroupsClient.Update method. func (client *ResourceGroupsClient) Update(ctx context.Context, resourceGroupName string, parameters ResourceGroupPatchable, options *ResourceGroupsClientUpdateOptions) (ResourceGroupsClientUpdateResponse, error) { + var err error + const operationName = "ResourceGroupsClient.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, parameters, options) if err != nil { return ResourceGroupsClientUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ResourceGroupsClientUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ResourceGroupsClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ResourceGroupsClientUpdateResponse{}, err } - return client.updateHandleResponse(resp) + resp, err := client.updateHandleResponse(httpResp) + return resp, err } // updateCreateRequest creates the Update request. @@ -431,7 +479,10 @@ func (client *ResourceGroupsClient) updateCreateRequest(ctx context.Context, res reqQP.Set("api-version", "2021-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // updateHandleResponse handles the Update response. diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/response_types.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/response_types.go index f1a7793b52..fb04138cd7 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/response_types.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/response_types.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armresources @@ -23,11 +22,13 @@ type ClientCheckExistenceResponse struct { // ClientCreateOrUpdateByIDResponse contains the response from method Client.BeginCreateOrUpdateByID. type ClientCreateOrUpdateByIDResponse struct { + // Resource information. GenericResource } // ClientCreateOrUpdateResponse contains the response from method Client.BeginCreateOrUpdate. type ClientCreateOrUpdateResponse struct { + // Resource information. GenericResource } @@ -43,21 +44,25 @@ type ClientDeleteResponse struct { // ClientGetByIDResponse contains the response from method Client.GetByID. type ClientGetByIDResponse struct { + // Resource information. GenericResource } // ClientGetResponse contains the response from method Client.Get. type ClientGetResponse struct { + // Resource information. GenericResource } // ClientListByResourceGroupResponse contains the response from method Client.NewListByResourceGroupPager. type ClientListByResourceGroupResponse struct { + // List of resource groups. ResourceListResult } // ClientListResponse contains the response from method Client.NewListPager. type ClientListResponse struct { + // List of resource groups. ResourceListResult } @@ -68,11 +73,13 @@ type ClientMoveResourcesResponse struct { // ClientUpdateByIDResponse contains the response from method Client.BeginUpdateByID. type ClientUpdateByIDResponse struct { + // Resource information. GenericResource } // ClientUpdateResponse contains the response from method Client.BeginUpdate. type ClientUpdateResponse struct { + // Resource information. GenericResource } @@ -83,56 +90,67 @@ type ClientValidateMoveResourcesResponse struct { // DeploymentOperationsClientGetAtManagementGroupScopeResponse contains the response from method DeploymentOperationsClient.GetAtManagementGroupScope. type DeploymentOperationsClientGetAtManagementGroupScopeResponse struct { + // Deployment operation information. DeploymentOperation } // DeploymentOperationsClientGetAtScopeResponse contains the response from method DeploymentOperationsClient.GetAtScope. type DeploymentOperationsClientGetAtScopeResponse struct { + // Deployment operation information. DeploymentOperation } // DeploymentOperationsClientGetAtSubscriptionScopeResponse contains the response from method DeploymentOperationsClient.GetAtSubscriptionScope. type DeploymentOperationsClientGetAtSubscriptionScopeResponse struct { + // Deployment operation information. DeploymentOperation } // DeploymentOperationsClientGetAtTenantScopeResponse contains the response from method DeploymentOperationsClient.GetAtTenantScope. type DeploymentOperationsClientGetAtTenantScopeResponse struct { + // Deployment operation information. DeploymentOperation } // DeploymentOperationsClientGetResponse contains the response from method DeploymentOperationsClient.Get. type DeploymentOperationsClientGetResponse struct { + // Deployment operation information. DeploymentOperation } // DeploymentOperationsClientListAtManagementGroupScopeResponse contains the response from method DeploymentOperationsClient.NewListAtManagementGroupScopePager. type DeploymentOperationsClientListAtManagementGroupScopeResponse struct { + // List of deployment operations. DeploymentOperationsListResult } // DeploymentOperationsClientListAtScopeResponse contains the response from method DeploymentOperationsClient.NewListAtScopePager. type DeploymentOperationsClientListAtScopeResponse struct { + // List of deployment operations. DeploymentOperationsListResult } // DeploymentOperationsClientListAtSubscriptionScopeResponse contains the response from method DeploymentOperationsClient.NewListAtSubscriptionScopePager. type DeploymentOperationsClientListAtSubscriptionScopeResponse struct { + // List of deployment operations. DeploymentOperationsListResult } // DeploymentOperationsClientListAtTenantScopeResponse contains the response from method DeploymentOperationsClient.NewListAtTenantScopePager. type DeploymentOperationsClientListAtTenantScopeResponse struct { + // List of deployment operations. DeploymentOperationsListResult } // DeploymentOperationsClientListResponse contains the response from method DeploymentOperationsClient.NewListPager. type DeploymentOperationsClientListResponse struct { + // List of deployment operations. DeploymentOperationsListResult } // DeploymentsClientCalculateTemplateHashResponse contains the response from method DeploymentsClient.CalculateTemplateHash. type DeploymentsClientCalculateTemplateHashResponse struct { + // Result of the request to calculate template hash. It contains a string of minified template and its hash. TemplateHashResult } @@ -193,26 +211,31 @@ type DeploymentsClientCheckExistenceResponse struct { // DeploymentsClientCreateOrUpdateAtManagementGroupScopeResponse contains the response from method DeploymentsClient.BeginCreateOrUpdateAtManagementGroupScope. type DeploymentsClientCreateOrUpdateAtManagementGroupScopeResponse struct { + // Deployment information. DeploymentExtended } // DeploymentsClientCreateOrUpdateAtScopeResponse contains the response from method DeploymentsClient.BeginCreateOrUpdateAtScope. type DeploymentsClientCreateOrUpdateAtScopeResponse struct { + // Deployment information. DeploymentExtended } // DeploymentsClientCreateOrUpdateAtSubscriptionScopeResponse contains the response from method DeploymentsClient.BeginCreateOrUpdateAtSubscriptionScope. type DeploymentsClientCreateOrUpdateAtSubscriptionScopeResponse struct { + // Deployment information. DeploymentExtended } // DeploymentsClientCreateOrUpdateAtTenantScopeResponse contains the response from method DeploymentsClient.BeginCreateOrUpdateAtTenantScope. type DeploymentsClientCreateOrUpdateAtTenantScopeResponse struct { + // Deployment information. DeploymentExtended } // DeploymentsClientCreateOrUpdateResponse contains the response from method DeploymentsClient.BeginCreateOrUpdate. type DeploymentsClientCreateOrUpdateResponse struct { + // Deployment information. DeploymentExtended } @@ -243,156 +266,188 @@ type DeploymentsClientDeleteResponse struct { // DeploymentsClientExportTemplateAtManagementGroupScopeResponse contains the response from method DeploymentsClient.ExportTemplateAtManagementGroupScope. type DeploymentsClientExportTemplateAtManagementGroupScopeResponse struct { + // The deployment export result. DeploymentExportResult } // DeploymentsClientExportTemplateAtScopeResponse contains the response from method DeploymentsClient.ExportTemplateAtScope. type DeploymentsClientExportTemplateAtScopeResponse struct { + // The deployment export result. DeploymentExportResult } // DeploymentsClientExportTemplateAtSubscriptionScopeResponse contains the response from method DeploymentsClient.ExportTemplateAtSubscriptionScope. type DeploymentsClientExportTemplateAtSubscriptionScopeResponse struct { + // The deployment export result. DeploymentExportResult } // DeploymentsClientExportTemplateAtTenantScopeResponse contains the response from method DeploymentsClient.ExportTemplateAtTenantScope. type DeploymentsClientExportTemplateAtTenantScopeResponse struct { + // The deployment export result. DeploymentExportResult } // DeploymentsClientExportTemplateResponse contains the response from method DeploymentsClient.ExportTemplate. type DeploymentsClientExportTemplateResponse struct { + // The deployment export result. DeploymentExportResult } // DeploymentsClientGetAtManagementGroupScopeResponse contains the response from method DeploymentsClient.GetAtManagementGroupScope. type DeploymentsClientGetAtManagementGroupScopeResponse struct { + // Deployment information. DeploymentExtended } // DeploymentsClientGetAtScopeResponse contains the response from method DeploymentsClient.GetAtScope. type DeploymentsClientGetAtScopeResponse struct { + // Deployment information. DeploymentExtended } // DeploymentsClientGetAtSubscriptionScopeResponse contains the response from method DeploymentsClient.GetAtSubscriptionScope. type DeploymentsClientGetAtSubscriptionScopeResponse struct { + // Deployment information. DeploymentExtended } // DeploymentsClientGetAtTenantScopeResponse contains the response from method DeploymentsClient.GetAtTenantScope. type DeploymentsClientGetAtTenantScopeResponse struct { + // Deployment information. DeploymentExtended } // DeploymentsClientGetResponse contains the response from method DeploymentsClient.Get. type DeploymentsClientGetResponse struct { + // Deployment information. DeploymentExtended } // DeploymentsClientListAtManagementGroupScopeResponse contains the response from method DeploymentsClient.NewListAtManagementGroupScopePager. type DeploymentsClientListAtManagementGroupScopeResponse struct { + // List of deployments. DeploymentListResult } // DeploymentsClientListAtScopeResponse contains the response from method DeploymentsClient.NewListAtScopePager. type DeploymentsClientListAtScopeResponse struct { + // List of deployments. DeploymentListResult } // DeploymentsClientListAtSubscriptionScopeResponse contains the response from method DeploymentsClient.NewListAtSubscriptionScopePager. type DeploymentsClientListAtSubscriptionScopeResponse struct { + // List of deployments. DeploymentListResult } // DeploymentsClientListAtTenantScopeResponse contains the response from method DeploymentsClient.NewListAtTenantScopePager. type DeploymentsClientListAtTenantScopeResponse struct { + // List of deployments. DeploymentListResult } // DeploymentsClientListByResourceGroupResponse contains the response from method DeploymentsClient.NewListByResourceGroupPager. type DeploymentsClientListByResourceGroupResponse struct { + // List of deployments. DeploymentListResult } // DeploymentsClientValidateAtManagementGroupScopeResponse contains the response from method DeploymentsClient.BeginValidateAtManagementGroupScope. type DeploymentsClientValidateAtManagementGroupScopeResponse struct { + // Information from validate template deployment response. DeploymentValidateResult } // DeploymentsClientValidateAtScopeResponse contains the response from method DeploymentsClient.BeginValidateAtScope. type DeploymentsClientValidateAtScopeResponse struct { + // Information from validate template deployment response. DeploymentValidateResult } // DeploymentsClientValidateAtSubscriptionScopeResponse contains the response from method DeploymentsClient.BeginValidateAtSubscriptionScope. type DeploymentsClientValidateAtSubscriptionScopeResponse struct { + // Information from validate template deployment response. DeploymentValidateResult } // DeploymentsClientValidateAtTenantScopeResponse contains the response from method DeploymentsClient.BeginValidateAtTenantScope. type DeploymentsClientValidateAtTenantScopeResponse struct { + // Information from validate template deployment response. DeploymentValidateResult } // DeploymentsClientValidateResponse contains the response from method DeploymentsClient.BeginValidate. type DeploymentsClientValidateResponse struct { + // Information from validate template deployment response. DeploymentValidateResult } // DeploymentsClientWhatIfAtManagementGroupScopeResponse contains the response from method DeploymentsClient.BeginWhatIfAtManagementGroupScope. type DeploymentsClientWhatIfAtManagementGroupScopeResponse struct { + // Result of the What-If operation. Contains a list of predicted changes and a URL link to get to the next set of results. WhatIfOperationResult } // DeploymentsClientWhatIfAtSubscriptionScopeResponse contains the response from method DeploymentsClient.BeginWhatIfAtSubscriptionScope. type DeploymentsClientWhatIfAtSubscriptionScopeResponse struct { + // Result of the What-If operation. Contains a list of predicted changes and a URL link to get to the next set of results. WhatIfOperationResult } // DeploymentsClientWhatIfAtTenantScopeResponse contains the response from method DeploymentsClient.BeginWhatIfAtTenantScope. type DeploymentsClientWhatIfAtTenantScopeResponse struct { + // Result of the What-If operation. Contains a list of predicted changes and a URL link to get to the next set of results. WhatIfOperationResult } // DeploymentsClientWhatIfResponse contains the response from method DeploymentsClient.BeginWhatIf. type DeploymentsClientWhatIfResponse struct { + // Result of the What-If operation. Contains a list of predicted changes and a URL link to get to the next set of results. WhatIfOperationResult } // OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { + // Result of the request to list Microsoft.Resources operations. It contains a list of operations and a URL link to get the + // next set of results. OperationListResult } // ProviderResourceTypesClientListResponse contains the response from method ProviderResourceTypesClient.List. type ProviderResourceTypesClientListResponse struct { + // List of resource types of a resource provider. ProviderResourceTypeListResult } // ProvidersClientGetAtTenantScopeResponse contains the response from method ProvidersClient.GetAtTenantScope. type ProvidersClientGetAtTenantScopeResponse struct { + // Resource provider information. Provider } // ProvidersClientGetResponse contains the response from method ProvidersClient.Get. type ProvidersClientGetResponse struct { + // Resource provider information. Provider } // ProvidersClientListAtTenantScopeResponse contains the response from method ProvidersClient.NewListAtTenantScopePager. type ProvidersClientListAtTenantScopeResponse struct { + // List of resource providers. ProviderListResult } // ProvidersClientListResponse contains the response from method ProvidersClient.NewListPager. type ProvidersClientListResponse struct { + // List of resource providers. ProviderListResult } // ProvidersClientProviderPermissionsResponse contains the response from method ProvidersClient.ProviderPermissions. type ProvidersClientProviderPermissionsResponse struct { + // List of provider permissions. ProviderPermissionListResult } @@ -403,11 +458,13 @@ type ProvidersClientRegisterAtManagementGroupScopeResponse struct { // ProvidersClientRegisterResponse contains the response from method ProvidersClient.Register. type ProvidersClientRegisterResponse struct { + // Resource provider information. Provider } // ProvidersClientUnregisterResponse contains the response from method ProvidersClient.Unregister. type ProvidersClientUnregisterResponse struct { + // Resource provider information. Provider } @@ -419,6 +476,7 @@ type ResourceGroupsClientCheckExistenceResponse struct { // ResourceGroupsClientCreateOrUpdateResponse contains the response from method ResourceGroupsClient.CreateOrUpdate. type ResourceGroupsClientCreateOrUpdateResponse struct { + // Resource group information. ResourceGroup } @@ -429,36 +487,43 @@ type ResourceGroupsClientDeleteResponse struct { // ResourceGroupsClientExportTemplateResponse contains the response from method ResourceGroupsClient.BeginExportTemplate. type ResourceGroupsClientExportTemplateResponse struct { + // Resource group export result. ResourceGroupExportResult } // ResourceGroupsClientGetResponse contains the response from method ResourceGroupsClient.Get. type ResourceGroupsClientGetResponse struct { + // Resource group information. ResourceGroup } // ResourceGroupsClientListResponse contains the response from method ResourceGroupsClient.NewListPager. type ResourceGroupsClientListResponse struct { + // List of resource groups. ResourceGroupListResult } // ResourceGroupsClientUpdateResponse contains the response from method ResourceGroupsClient.Update. type ResourceGroupsClientUpdateResponse struct { + // Resource group information. ResourceGroup } // TagsClientCreateOrUpdateAtScopeResponse contains the response from method TagsClient.CreateOrUpdateAtScope. type TagsClientCreateOrUpdateAtScopeResponse struct { + // Wrapper resource for tags API requests and responses. TagsResource } // TagsClientCreateOrUpdateResponse contains the response from method TagsClient.CreateOrUpdate. type TagsClientCreateOrUpdateResponse struct { + // Tag details. TagDetails } // TagsClientCreateOrUpdateValueResponse contains the response from method TagsClient.CreateOrUpdateValue. type TagsClientCreateOrUpdateValueResponse struct { + // Tag information. TagValue } @@ -479,15 +544,18 @@ type TagsClientDeleteValueResponse struct { // TagsClientGetAtScopeResponse contains the response from method TagsClient.GetAtScope. type TagsClientGetAtScopeResponse struct { + // Wrapper resource for tags API requests and responses. TagsResource } // TagsClientListResponse contains the response from method TagsClient.NewListPager. type TagsClientListResponse struct { + // List of subscription tags. TagsListResult } // TagsClientUpdateAtScopeResponse contains the response from method TagsClient.UpdateAtScope. type TagsClientUpdateAtScopeResponse struct { + // Wrapper resource for tags API requests and responses. TagsResource } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/tags_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/tags_client.go index b508c6a2ef..b6d0fc2492 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/tags_client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/tags_client.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armresources @@ -33,7 +32,7 @@ type TagsClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewTagsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*TagsClient, error) { - cl, err := arm.NewClient(moduleName+".TagsClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -53,18 +52,25 @@ func NewTagsClient(subscriptionID string, credential azcore.TokenCredential, opt // - tagName - The name of the tag to create. // - options - TagsClientCreateOrUpdateOptions contains the optional parameters for the TagsClient.CreateOrUpdate method. func (client *TagsClient) CreateOrUpdate(ctx context.Context, tagName string, options *TagsClientCreateOrUpdateOptions) (TagsClientCreateOrUpdateResponse, error) { + var err error + const operationName = "TagsClient.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, tagName, options) if err != nil { return TagsClientCreateOrUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return TagsClientCreateOrUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return TagsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return TagsClientCreateOrUpdateResponse{}, err } - return client.createOrUpdateHandleResponse(resp) + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -107,18 +113,25 @@ func (client *TagsClient) createOrUpdateHandleResponse(resp *http.Response) (Tag // - options - TagsClientCreateOrUpdateAtScopeOptions contains the optional parameters for the TagsClient.CreateOrUpdateAtScope // method. func (client *TagsClient) CreateOrUpdateAtScope(ctx context.Context, scope string, parameters TagsResource, options *TagsClientCreateOrUpdateAtScopeOptions) (TagsClientCreateOrUpdateAtScopeResponse, error) { + var err error + const operationName = "TagsClient.CreateOrUpdateAtScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.createOrUpdateAtScopeCreateRequest(ctx, scope, parameters, options) if err != nil { return TagsClientCreateOrUpdateAtScopeResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return TagsClientCreateOrUpdateAtScopeResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return TagsClientCreateOrUpdateAtScopeResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return TagsClientCreateOrUpdateAtScopeResponse{}, err } - return client.createOrUpdateAtScopeHandleResponse(resp) + resp, err := client.createOrUpdateAtScopeHandleResponse(httpResp) + return resp, err } // createOrUpdateAtScopeCreateRequest creates the CreateOrUpdateAtScope request. @@ -133,7 +146,10 @@ func (client *TagsClient) createOrUpdateAtScopeCreateRequest(ctx context.Context reqQP.Set("api-version", "2021-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // createOrUpdateAtScopeHandleResponse handles the CreateOrUpdateAtScope response. @@ -155,18 +171,25 @@ func (client *TagsClient) createOrUpdateAtScopeHandleResponse(resp *http.Respons // - options - TagsClientCreateOrUpdateValueOptions contains the optional parameters for the TagsClient.CreateOrUpdateValue // method. func (client *TagsClient) CreateOrUpdateValue(ctx context.Context, tagName string, tagValue string, options *TagsClientCreateOrUpdateValueOptions) (TagsClientCreateOrUpdateValueResponse, error) { + var err error + const operationName = "TagsClient.CreateOrUpdateValue" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.createOrUpdateValueCreateRequest(ctx, tagName, tagValue, options) if err != nil { return TagsClientCreateOrUpdateValueResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return TagsClientCreateOrUpdateValueResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return TagsClientCreateOrUpdateValueResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return TagsClientCreateOrUpdateValueResponse{}, err } - return client.createOrUpdateValueHandleResponse(resp) + resp, err := client.createOrUpdateValueHandleResponse(httpResp) + return resp, err } // createOrUpdateValueCreateRequest creates the CreateOrUpdateValue request. @@ -213,16 +236,22 @@ func (client *TagsClient) createOrUpdateValueHandleResponse(resp *http.Response) // - tagName - The name of the tag. // - options - TagsClientDeleteOptions contains the optional parameters for the TagsClient.Delete method. func (client *TagsClient) Delete(ctx context.Context, tagName string, options *TagsClientDeleteOptions) (TagsClientDeleteResponse, error) { + var err error + const operationName = "TagsClient.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, tagName, options) if err != nil { return TagsClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return TagsClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return TagsClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return TagsClientDeleteResponse{}, err } return TagsClientDeleteResponse{}, nil } @@ -256,16 +285,22 @@ func (client *TagsClient) deleteCreateRequest(ctx context.Context, tagName strin // - scope - The resource scope. // - options - TagsClientDeleteAtScopeOptions contains the optional parameters for the TagsClient.DeleteAtScope method. func (client *TagsClient) DeleteAtScope(ctx context.Context, scope string, options *TagsClientDeleteAtScopeOptions) (TagsClientDeleteAtScopeResponse, error) { + var err error + const operationName = "TagsClient.DeleteAtScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.deleteAtScopeCreateRequest(ctx, scope, options) if err != nil { return TagsClientDeleteAtScopeResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return TagsClientDeleteAtScopeResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return TagsClientDeleteAtScopeResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return TagsClientDeleteAtScopeResponse{}, err } return TagsClientDeleteAtScopeResponse{}, nil } @@ -295,16 +330,22 @@ func (client *TagsClient) deleteAtScopeCreateRequest(ctx context.Context, scope // - tagValue - The value of the tag to delete. // - options - TagsClientDeleteValueOptions contains the optional parameters for the TagsClient.DeleteValue method. func (client *TagsClient) DeleteValue(ctx context.Context, tagName string, tagValue string, options *TagsClientDeleteValueOptions) (TagsClientDeleteValueResponse, error) { + var err error + const operationName = "TagsClient.DeleteValue" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.deleteValueCreateRequest(ctx, tagName, tagValue, options) if err != nil { return TagsClientDeleteValueResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return TagsClientDeleteValueResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return TagsClientDeleteValueResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return TagsClientDeleteValueResponse{}, err } return TagsClientDeleteValueResponse{}, nil } @@ -342,18 +383,25 @@ func (client *TagsClient) deleteValueCreateRequest(ctx context.Context, tagName // - scope - The resource scope. // - options - TagsClientGetAtScopeOptions contains the optional parameters for the TagsClient.GetAtScope method. func (client *TagsClient) GetAtScope(ctx context.Context, scope string, options *TagsClientGetAtScopeOptions) (TagsClientGetAtScopeResponse, error) { + var err error + const operationName = "TagsClient.GetAtScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getAtScopeCreateRequest(ctx, scope, options) if err != nil { return TagsClientGetAtScopeResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return TagsClientGetAtScopeResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return TagsClientGetAtScopeResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return TagsClientGetAtScopeResponse{}, err } - return client.getAtScopeHandleResponse(resp) + resp, err := client.getAtScopeHandleResponse(httpResp) + return resp, err } // getAtScopeCreateRequest creates the GetAtScope request. @@ -392,25 +440,20 @@ func (client *TagsClient) NewListPager(options *TagsClientListOptions) *runtime. return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *TagsClientListResponse) (TagsClientListResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "TagsClient.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 TagsClientListResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return TagsClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return TagsClientListResponse{}, runtime.NewResponseError(resp) - } return client.listHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -452,18 +495,25 @@ func (client *TagsClient) listHandleResponse(resp *http.Response) (TagsClientLis // - scope - The resource scope. // - options - TagsClientUpdateAtScopeOptions contains the optional parameters for the TagsClient.UpdateAtScope method. func (client *TagsClient) UpdateAtScope(ctx context.Context, scope string, parameters TagsPatchResource, options *TagsClientUpdateAtScopeOptions) (TagsClientUpdateAtScopeResponse, error) { + var err error + const operationName = "TagsClient.UpdateAtScope" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.updateAtScopeCreateRequest(ctx, scope, parameters, options) if err != nil { return TagsClientUpdateAtScopeResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return TagsClientUpdateAtScopeResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return TagsClientUpdateAtScopeResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return TagsClientUpdateAtScopeResponse{}, err } - return client.updateAtScopeHandleResponse(resp) + resp, err := client.updateAtScopeHandleResponse(httpResp) + return resp, err } // updateAtScopeCreateRequest creates the UpdateAtScope request. @@ -478,7 +528,10 @@ func (client *TagsClient) updateAtScopeCreateRequest(ctx context.Context, scope reqQP.Set("api-version", "2021-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // updateAtScopeHandleResponse handles the UpdateAtScope response. diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/time_rfc3339.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/time_rfc3339.go index cb02b976b3..5026e349b2 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/time_rfc3339.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/time_rfc3339.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armresources @@ -19,50 +18,50 @@ import ( "time" ) -const ( - utcLayoutJSON = `"2006-01-02T15:04:05.999999999"` - utcLayout = "2006-01-02T15:04:05.999999999" - rfc3339JSON = `"` + time.RFC3339Nano + `"` -) - // 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+)*"*$`) -type timeRFC3339 time.Time +const ( + utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` + utcDateTime = "2006-01-02T15:04:05.999999999" + dateTimeJSON = `"` + time.RFC3339Nano + `"` +) + +type dateTimeRFC3339 time.Time -func (t timeRFC3339) MarshalJSON() (json []byte, err error) { +func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { tt := time.Time(t) return tt.MarshalJSON() } -func (t timeRFC3339) MarshalText() (text []byte, err error) { +func (t dateTimeRFC3339) MarshalText() ([]byte, error) { tt := time.Time(t) return tt.MarshalText() } -func (t *timeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcLayoutJSON +func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { + layout := utcDateTimeJSON if tzOffsetRegex.Match(data) { - layout = rfc3339JSON + layout = dateTimeJSON } return t.Parse(layout, string(data)) } -func (t *timeRFC3339) UnmarshalText(data []byte) (err error) { - layout := utcLayout +func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + layout := utcDateTime if tzOffsetRegex.Match(data) { layout = time.RFC3339Nano } return t.Parse(layout, string(data)) } -func (t *timeRFC3339) Parse(layout, value string) error { +func (t *dateTimeRFC3339) Parse(layout, value string) error { p, err := time.Parse(layout, strings.ToUpper(value)) - *t = timeRFC3339(p) + *t = dateTimeRFC3339(p) return err } -func populateTimeRFC3339(m map[string]any, k string, t *time.Time) { +func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return } else if azcore.IsNullValue(t) { @@ -71,14 +70,14 @@ func populateTimeRFC3339(m map[string]any, k string, t *time.Time) { } else if reflect.ValueOf(t).IsNil() { return } - m[k] = (*timeRFC3339)(t) + m[k] = (*dateTimeRFC3339)(t) } -func unpopulateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { +func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { if data == nil || strings.EqualFold(string(data), "null") { return nil } - var aux timeRFC3339 + var aux dateTimeRFC3339 if err := json.Unmarshal(data, &aux); err != nil { return fmt.Errorf("struct field %s: %v", fn, err) } diff --git a/vendor/modules.txt b/vendor/modules.txt index f43cff4c7a..1ca35d8c99 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -7,7 +7,7 @@ github.com/Azure/azure-sdk-for-go/services/privatedns/mgmt/2018-09-01/privatedns github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2017-05-10/resources github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage github.com/Azure/azure-sdk-for-go/version -# github.com/Azure/azure-sdk-for-go/sdk/azcore v1.8.0 +# github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.0 ## explicit; go 1.18 github.com/Azure/azure-sdk-for-go/sdk/azcore github.com/Azure/azure-sdk-for-go/sdk/azcore/arm @@ -20,6 +20,7 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/log github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/pollers github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/pollers/async github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/pollers/body +github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/pollers/fake github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/pollers/loc github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/pollers/op github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared @@ -32,7 +33,7 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore/tracing # github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0 ## explicit; go 1.18 github.com/Azure/azure-sdk-for-go/sdk/azidentity -# github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 +# github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.0 ## explicit; go 1.18 github.com/Azure/azure-sdk-for-go/sdk/internal/diag github.com/Azure/azure-sdk-for-go/sdk/internal/errorinfo @@ -53,7 +54,7 @@ github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4 # github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns v1.1.0 ## explicit; go 1.18 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns -# github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.1.1 +# github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.2.0 ## explicit; go 1.18 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources # github.com/Azure/go-autorest v14.2.0+incompatible