-
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.
…25905) * update to use hashicorp/go-azure-sdk * use NewCompositeResourceID and swap more resources over * update nat gateway data source to use hashicorp/go-azure-sdk * tflint * add exceptions to the gradually deprecated script * add TODO comment to ip group cidr resource and extend context for destroy step in local network gateway resource tests * double timeout for updating address space * use CreateOrUpdate method to circumvent broken polling behaviour * add custom poller for local network gateway * goimports
- Loading branch information
Showing
21 changed files
with
891 additions
and
840 deletions.
There are no files selected for viewing
333 changes: 168 additions & 165 deletions
333
internal/services/network/custom_ip_prefix_resource.go
Large diffs are not rendered by default.
Oops, something went wrong.
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
53 changes: 53 additions & 0 deletions
53
internal/services/network/custompollers/local_network_gateway_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,53 @@ | ||
package custompollers | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"strings" | ||
"time" | ||
|
||
"github.com/hashicorp/go-azure-sdk/resource-manager/network/2023-09-01/localnetworkgateways" | ||
"github.com/hashicorp/go-azure-sdk/sdk/client/pollers" | ||
) | ||
|
||
var _ pollers.PollerType = &localNetworkGatewayPoller{} | ||
|
||
type localNetworkGatewayPoller struct { | ||
client *localnetworkgateways.LocalNetworkGatewaysClient | ||
id localnetworkgateways.LocalNetworkGatewayId | ||
} | ||
|
||
var ( | ||
pollingSuccess = pollers.PollResult{ | ||
Status: pollers.PollingStatusSucceeded, | ||
PollInterval: 10 * time.Second, | ||
} | ||
pollingInProgress = pollers.PollResult{ | ||
Status: pollers.PollingStatusInProgress, | ||
PollInterval: 10 * time.Second, | ||
} | ||
) | ||
|
||
func NewLocalNetworkGatewayPoller(client *localnetworkgateways.LocalNetworkGatewaysClient, id localnetworkgateways.LocalNetworkGatewayId) *localNetworkGatewayPoller { | ||
return &localNetworkGatewayPoller{ | ||
client: client, | ||
id: id, | ||
} | ||
} | ||
|
||
func (p localNetworkGatewayPoller) Poll(ctx context.Context) (*pollers.PollResult, error) { | ||
resp, err := p.client.Get(ctx, p.id) | ||
if err != nil { | ||
return nil, fmt.Errorf("retrieving %s: %+v", p.id, err) | ||
} | ||
|
||
if resp.Model != nil { | ||
if provisioningStatus := resp.Model.Properties.ProvisioningState; provisioningStatus != nil { | ||
if !strings.EqualFold(string(*provisioningStatus), string(pollingSuccess.Status)) { | ||
return &pollingInProgress, nil | ||
} | ||
} | ||
} | ||
|
||
return &pollingSuccess, 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.