Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sdk/client/resourcemanager: support for LROs which also return immediately #583

Merged
merged 1 commit into from
Aug 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion sdk/client/resourcemanager/poller_provisioning_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,16 @@ func (p *provisioningStatePoller) Poll(ctx context.Context) (*pollers.PollResult
status = string(result.Properties.ProvisioningState)
}
if status == "" {
return nil, fmt.Errorf("API didn't return either `provisioningState` or `status`")
// Some Operations support both an LRO and immediate completion, but _don't_ return a provisioningState field
// since we're checking for a 200 OK, if we didn't get a provisioningState field, for the moment we have to
// assume that we're done.
// Examples: `APIManagement` API Versions `2021-08-01` and `2022-08-01` - `Services.GlobalSchemaCreateOrUpdate`.
// Examples: `Automation` API Versions `2020-01-13-preview` - `DscNodeConfiguration.CreateOrUpdate`.
// https://github.com/hashicorp/go-azure-sdk/issues/542
return &pollers.PollResult{
PollInterval: p.initialRetryDuration,
Status: pollers.PollingStatusSucceeded,
}, nil
}

if strings.EqualFold(status, string(statusCanceled)) || strings.EqualFold(status, string(statusCancelled)) {
Expand Down
Loading