Skip to content

Commit

Permalink
update application gateways to use hashicorp/go-azure-sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
stephybun committed May 7, 2024
1 parent 6ac642d commit 3aee37e
Show file tree
Hide file tree
Showing 4,099 changed files with 167,313 additions and 1,068 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
298 changes: 152 additions & 146 deletions internal/services/network/application_gateway_data_source.go

Large diffs are not rendered by default.

1,715 changes: 799 additions & 916 deletions internal/services/network/application_gateway_resource.go

Large diffs are not rendered by default.

11 changes: 6 additions & 5 deletions internal/services/network/application_gateway_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ import (
"testing"
"time"

"github.com/hashicorp/go-azure-helpers/lang/pointer"
"github.com/hashicorp/go-azure-sdk/resource-manager/network/2023-09-01/applicationgateways"
"github.com/hashicorp/terraform-provider-azurerm/internal/acceptance"
"github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
"github.com/hashicorp/terraform-provider-azurerm/utils"
"github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network"
Expand Down Expand Up @@ -1322,17 +1323,17 @@ func TestAccApplicationGateway_removeFirewallPolicy(t *testing.T) {
}

func (t ApplicationGatewayResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) {
id, err := parse.ApplicationGatewayID(state.ID)
id, err := applicationgateways.ParseApplicationGatewayID(state.ID)
if err != nil {
return nil, err
}

resp, err := clients.Network.ApplicationGatewaysClient.Get(ctx, id.ResourceGroup, id.Name)
resp, err := clients.Network.Client.ApplicationGateways.Get(ctx, *id)
if err != nil {
return nil, fmt.Errorf("reading Application Gateway (%s): %+v", id, err)
return nil, fmt.Errorf("retrieving %s: %+v", id, err)
}

return utils.Bool(resp.ID != nil), nil
return pointer.To(resp.Model != nil), nil
}

func (r ApplicationGatewayResource) basic(data acceptance.TestData) string {
Expand Down
14 changes: 13 additions & 1 deletion internal/services/network/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package client
import (
"fmt"

network_2022_07_01 "github.com/hashicorp/go-azure-sdk/resource-manager/network/2022-07-01"
network_2023_09_01 "github.com/hashicorp/go-azure-sdk/resource-manager/network/2023-09-01"
"github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager"
"github.com/hashicorp/terraform-provider-azurerm/internal/common"
Expand All @@ -15,6 +16,10 @@ import (
type Client struct {
*network_2023_09_01.Client

// this additional version has been added to facilitate migration of the remaining network
// resources to `hashicorp/go-azure-sdk`
V20220701Client *network_2022_07_01.Client

// Usages of the clients below use `Azure/azure-sdk-for-go` and should be updated
// to use `hashicorp/go-azure-sdk` (available above).
ApplicationGatewaysClient *network.ApplicationGatewaysClient
Expand Down Expand Up @@ -179,8 +184,15 @@ func NewClient(o *common.ClientOptions) (*Client, error) {
return nil, fmt.Errorf("building clients for Network: %+v", err)
}

v20220701Client, err := network_2022_07_01.NewClientWithBaseURI(o.Environment.ResourceManager, func(c *resourcemanager.Client) {
o.Configure(c, o.Authorizers.ResourceManager)
})
if err != nil {
return nil, fmt.Errorf("building 2022-07-01 clients for Network: %+v", err)
}
return &Client{
Client: client,
Client: client,
V20220701Client: v20220701Client,

ApplicationGatewaysClient: &ApplicationGatewaysClient,
CustomIPPrefixesClient: &customIpPrefixesClient,
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3aee37e

Please sign in to comment.