diff --git a/go.mod b/go.mod index 3ce1bfec78c6..0c9bfffb47d0 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,7 @@ require ( github.com/google/go-cmp v0.5.9 github.com/google/uuid v1.3.0 github.com/hashicorp/go-azure-helpers v0.59.0 - github.com/hashicorp/go-azure-sdk v0.20230823.1052657 + github.com/hashicorp/go-azure-sdk v0.20230824.1130652 github.com/hashicorp/go-hclog v1.4.0 github.com/hashicorp/go-multierror v1.1.1 github.com/hashicorp/go-uuid v1.0.3 diff --git a/go.sum b/go.sum index 6699d876c25d..f2294bf227e2 100644 --- a/go.sum +++ b/go.sum @@ -121,8 +121,8 @@ github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brv github.com/hashicorp/go-azure-helpers v0.12.0/go.mod h1:Zc3v4DNeX6PDdy7NljlYpnrdac1++qNW0I4U+ofGwpg= github.com/hashicorp/go-azure-helpers v0.59.0 h1:E73yoPN2r1y0vvZ4dgAh8NRGuVTNXH3lZKRjT+4oNmA= github.com/hashicorp/go-azure-helpers v0.59.0/go.mod h1:BQUQp5udwbJ8pnzl0wByCLVEEyPMAFpJ9vOREiCzObo= -github.com/hashicorp/go-azure-sdk v0.20230823.1052657 h1:Dk78GhVOIT78Wn7oS/TB9tmgC/HPa7yoYsBx8WowRDA= -github.com/hashicorp/go-azure-sdk v0.20230823.1052657/go.mod h1:Rk63T4GsVOHb/WohiAX7F0tMEd8MIKV+g4aV0Jv4XEk= +github.com/hashicorp/go-azure-sdk v0.20230824.1130652 h1:IOQTvyj3JvUfc8oTmLrh3pXVCjZlozp3aqhM243Pzzo= +github.com/hashicorp/go-azure-sdk v0.20230824.1130652/go.mod h1:Rk63T4GsVOHb/WohiAX7F0tMEd8MIKV+g4aV0Jv4XEk= github.com/hashicorp/go-checkpoint v0.5.0 h1:MFYpPZCnQqQTE18jFwSII6eUQrD/oxMFp3mlgcqk5mU= github.com/hashicorp/go-checkpoint v0.5.0/go.mod h1:7nfLNL10NsxqO4iWuW6tWW0HjZuDrwkBuEQsVcpCOgg= github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/python3package/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/python3package/README.md index 34e5385a25e3..e32596335414 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/python3package/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/python3package/README.md @@ -31,13 +31,9 @@ payload := python3package.PythonPackageCreateParameters{ } -read, err := client.CreateOrUpdate(ctx, id, payload) -if err != nil { +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { // handle the error } -if model := read.Model; model != nil { - // do something with the model/response object -} ``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/python3package/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/python3package/method_createorupdate.go index 49082f0bfebc..3cb1a1e40ce5 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/python3package/method_createorupdate.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/python3package/method_createorupdate.go @@ -2,9 +2,12 @@ package python3package import ( "context" + "fmt" "net/http" "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" "github.com/hashicorp/go-azure-sdk/sdk/odata" ) @@ -12,9 +15,9 @@ import ( // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller HttpResponse *http.Response OData *odata.OData - Model *Module } // CreateOrUpdate ... @@ -48,9 +51,24 @@ func (c Python3PackageClient) CreateOrUpdate(ctx context.Context, id Python3Pack return } - if err = resp.Unmarshal(&result.Model); err != nil { + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { return } return } + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c Python3PackageClient) CreateOrUpdateThenPoll(ctx context.Context, id Python3PackageId, input PythonPackageCreateParameters) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/client.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/client.go index 3abae532a0d8..05682f8bcaab 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/client.go @@ -290,7 +290,10 @@ func (c *Client) NewRequest(ctx context.Context, input RequestOptions) (*Request req.Method = input.HttpMethod req.Header = make(http.Header) - req.Header.Add("Content-Type", input.ContentType) + + if input.ContentType != "" { + req.Header.Add("Content-Type", input.ContentType) + } if c.UserAgent != "" { req.Header.Add("User-Agent", c.UserAgent) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/msgraph/client.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/msgraph/client.go index 49141d3161e5..32ffa14d51a1 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/msgraph/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/msgraph/client.go @@ -56,6 +56,9 @@ func (c *Client) NewRequest(ctx context.Context, input client.RequestOptions) (* if err := input.Validate(); err != nil { return nil, fmt.Errorf("pre-validating request payload: %+v", err) } + if input.ContentType == "" { + return nil, fmt.Errorf("pre-validating request payload: missing `ContentType`") + } req, err := c.Client.NewRequest(ctx, input) if err != nil { diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/request_options.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/request_options.go index b0e0b653bcf1..402b497c0b0c 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/request_options.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/request_options.go @@ -31,9 +31,6 @@ type RequestOptions struct { } func (ro RequestOptions) Validate() error { - if ro.ContentType == "" { - return fmt.Errorf("missing `ContentType`") - } if len(ro.ExpectedStatusCodes) == 0 { return fmt.Errorf("missing `ExpectedStatusCodes`") } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager/client.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager/client.go index 16c4b7d8be97..d712ca12c831 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager/client.go @@ -42,6 +42,9 @@ func (c *Client) NewRequest(ctx context.Context, input client.RequestOptions) (* if err := input.Validate(); err != nil { return nil, fmt.Errorf("pre-validating request payload: %+v", err) } + if input.ContentType == "" { + return nil, fmt.Errorf("pre-validating request payload: missing `ContentType`") + } req, err := c.Client.NewRequest(ctx, input) if err != nil { diff --git a/vendor/modules.txt b/vendor/modules.txt index 293904c20610..046b4f0e0d7c 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -127,7 +127,7 @@ github.com/hashicorp/go-azure-helpers/resourcemanager/tags github.com/hashicorp/go-azure-helpers/resourcemanager/zones github.com/hashicorp/go-azure-helpers/sender github.com/hashicorp/go-azure-helpers/storage -# github.com/hashicorp/go-azure-sdk v0.20230823.1052657 +# github.com/hashicorp/go-azure-sdk v0.20230824.1130652 ## explicit; go 1.19 github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview