-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
storage
- add support for storage_account_id
to `azurerm_storage_…
…container` and `azurerm_storage_share` (#27733) * start of dataplane / rm separation * refactor resrouce functions * review comments and feedback * missed review comment * missed review comment * update comment * missed review comments
- Loading branch information
1 parent
45c06a4
commit 8f3f582
Showing
13 changed files
with
2,230 additions
and
538 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
internal/services/storage/custompollers/storage_share_create_poller.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package custompollers | ||
|
||
import ( | ||
"context" | ||
"time" | ||
|
||
"github.com/hashicorp/go-azure-helpers/lang/response" | ||
"github.com/hashicorp/go-azure-sdk/resource-manager/storage/2023-01-01/fileshares" | ||
"github.com/hashicorp/go-azure-sdk/sdk/client/pollers" | ||
) | ||
|
||
var _ pollers.PollerType = storageShareCreatePoller{} | ||
|
||
type storageShareCreatePoller struct { | ||
id fileshares.ShareId | ||
client *fileshares.FileSharesClient | ||
payload fileshares.FileShare | ||
} | ||
|
||
func NewStorageShareCreatePoller(client *fileshares.FileSharesClient, id fileshares.ShareId, payload fileshares.FileShare) *storageShareCreatePoller { | ||
return &storageShareCreatePoller{ | ||
id: id, | ||
client: client, | ||
payload: payload, | ||
} | ||
} | ||
|
||
func (p storageShareCreatePoller) Poll(ctx context.Context) (*pollers.PollResult, error) { | ||
// Note - Whilst this is an antipattern for the Provider, the API provides no way currently to poll for deletion | ||
// to ensure it's removed. To support rapid delete then re-creation we check for 409's that indicate the resource | ||
// is still being removed. | ||
resp, err := p.client.Create(ctx, p.id, p.payload, fileshares.DefaultCreateOperationOptions()) | ||
if err != nil { | ||
if response.WasConflict(resp.HttpResponse) { | ||
return &pollers.PollResult{ | ||
PollInterval: 5 * time.Second, | ||
Status: pollers.PollingStatusInProgress, | ||
}, nil | ||
} | ||
|
||
return &pollers.PollResult{ | ||
HttpResponse: nil, | ||
PollInterval: 5 * time.Second, | ||
Status: pollers.PollingStatusFailed, | ||
}, err | ||
} | ||
|
||
return &pollers.PollResult{ | ||
PollInterval: 5, | ||
Status: pollers.PollingStatusSucceeded, | ||
}, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.