Skip to content

Commit

Permalink
Merge pull request #22676 from hashicorp/refactor/network-gets-a-meta…
Browse files Browse the repository at this point in the history
…-client

`network` - refactoring the usages of `hashicorp/go-azure-sdk` to use a Meta Client
  • Loading branch information
tombuildsstuff authored Jul 28, 2023
2 parents 641642b + 562ea76 commit 44d0a50
Show file tree
Hide file tree
Showing 4,104 changed files with 143,091 additions and 4,960 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"strings"

"github.com/hashicorp/go-azure-helpers/resourcemanager/commonids"
"github.com/hashicorp/go-azure-sdk/resource-manager/network/2022-09-01/applicationsecuritygroups"
"github.com/hashicorp/go-azure-sdk/resource-manager/network/2023-02-01/applicationsecuritygroups"
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
azValidate "github.com/hashicorp/terraform-provider-azurerm/helpers/validate"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/validate"
Expand Down
2 changes: 1 addition & 1 deletion internal/services/compute/virtual_machine_scale_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonids"
"github.com/hashicorp/go-azure-helpers/resourcemanager/identity"
"github.com/hashicorp/go-azure-sdk/resource-manager/compute/2022-03-03/galleryapplicationversions"
"github.com/hashicorp/go-azure-sdk/resource-manager/network/2022-09-01/applicationsecuritygroups"
"github.com/hashicorp/go-azure-sdk/resource-manager/network/2023-02-01/applicationsecuritygroups"
azValidate "github.com/hashicorp/terraform-provider-azurerm/helpers/validate"
"github.com/hashicorp/terraform-provider-azurerm/internal/features"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/validate"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

"github.com/hashicorp/go-azure-helpers/lang/response"
"github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces"
"github.com/hashicorp/go-azure-sdk/resource-manager/network/2022-09-01/privateendpoints"
"github.com/hashicorp/go-azure-sdk/resource-manager/network/2023-02-01/privateendpoints"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
"github.com/hashicorp/terraform-provider-azurerm/internal/timeouts"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema"
"github.com/hashicorp/go-azure-helpers/resourcemanager/location"
"github.com/hashicorp/go-azure-helpers/resourcemanager/tags"
"github.com/hashicorp/go-azure-sdk/resource-manager/network/2022-09-01/applicationsecuritygroups"
"github.com/hashicorp/go-azure-sdk/resource-manager/network/2023-02-01/applicationsecuritygroups"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
"github.com/hashicorp/terraform-provider-azurerm/internal/timeouts"
Expand Down Expand Up @@ -41,7 +41,7 @@ func dataSourceApplicationSecurityGroup() *pluginsdk.Resource {
}

func dataSourceApplicationSecurityGroupRead(d *pluginsdk.ResourceData, meta interface{}) error {
client := meta.(*clients.Client).Network.ApplicationSecurityGroupsClient
client := meta.(*clients.Client).Network.ApplicationSecurityGroups
subscriptionId := meta.(*clients.Client).Account.SubscriptionId
ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d)
defer cancel()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema"
"github.com/hashicorp/go-azure-helpers/resourcemanager/location"
"github.com/hashicorp/go-azure-helpers/resourcemanager/tags"
"github.com/hashicorp/go-azure-sdk/resource-manager/network/2022-09-01/applicationsecuritygroups"
"github.com/hashicorp/go-azure-sdk/resource-manager/network/2023-02-01/applicationsecuritygroups"
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
Expand Down Expand Up @@ -56,7 +56,7 @@ func resourceApplicationSecurityGroup() *pluginsdk.Resource {
}

func resourceApplicationSecurityGroupCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) error {
client := meta.(*clients.Client).Network.ApplicationSecurityGroupsClient
client := meta.(*clients.Client).Network.ApplicationSecurityGroups
subscriptionId := meta.(*clients.Client).Account.SubscriptionId
ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d)
defer cancel()
Expand Down Expand Up @@ -91,7 +91,7 @@ func resourceApplicationSecurityGroupCreateUpdate(d *pluginsdk.ResourceData, met
}

func resourceApplicationSecurityGroupRead(d *pluginsdk.ResourceData, meta interface{}) error {
client := meta.(*clients.Client).Network.ApplicationSecurityGroupsClient
client := meta.(*clients.Client).Network.ApplicationSecurityGroups
ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d)
defer cancel()

Expand Down Expand Up @@ -122,7 +122,7 @@ func resourceApplicationSecurityGroupRead(d *pluginsdk.ResourceData, meta interf
}

func resourceApplicationSecurityGroupDelete(d *pluginsdk.ResourceData, meta interface{}) error {
client := meta.(*clients.Client).Network.ApplicationSecurityGroupsClient
client := meta.(*clients.Client).Network.ApplicationSecurityGroups
ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d)
defer cancel()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"fmt"
"testing"

"github.com/hashicorp/go-azure-sdk/resource-manager/network/2022-09-01/applicationsecuritygroups"
"github.com/hashicorp/go-azure-sdk/resource-manager/network/2023-02-01/applicationsecuritygroups"
"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"
Expand Down Expand Up @@ -96,7 +96,7 @@ func (t ApplicationSecurityGroupResource) Exists(ctx context.Context, clients *c
return nil, err
}

resp, err := clients.Network.ApplicationSecurityGroupsClient.Get(ctx, *id)
resp, err := clients.Network.ApplicationSecurityGroups.Get(ctx, *id)
if err != nil {
return nil, fmt.Errorf("reading %s: %+v", *id, err)
}
Expand Down
4 changes: 2 additions & 2 deletions internal/services/network/bastion_host_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/hashicorp/go-azure-helpers/lang/response"
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema"
"github.com/hashicorp/go-azure-helpers/resourcemanager/tags"
"github.com/hashicorp/go-azure-sdk/resource-manager/network/2022-09-01/bastionhosts"
"github.com/hashicorp/go-azure-sdk/resource-manager/network/2023-02-01/bastionhosts"
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate"
Expand Down Expand Up @@ -104,7 +104,7 @@ func dataSourceBastionHost() *pluginsdk.Resource {
}

func dataSourceBastionHostRead(d *pluginsdk.ResourceData, meta interface{}) error {
client := meta.(*clients.Client).Network.BastionHostsClient
client := meta.(*clients.Client).Network.BastionHosts
subscriptionId := meta.(*clients.Client).Account.SubscriptionId
ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d)
defer cancel()
Expand Down
8 changes: 4 additions & 4 deletions internal/services/network/bastion_host_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/hashicorp/go-azure-helpers/lang/response"
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema"
"github.com/hashicorp/go-azure-helpers/resourcemanager/tags"
"github.com/hashicorp/go-azure-sdk/resource-manager/network/2022-09-01/bastionhosts"
"github.com/hashicorp/go-azure-sdk/resource-manager/network/2023-02-01/bastionhosts"
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
Expand Down Expand Up @@ -157,7 +157,7 @@ func resourceBastionHost() *pluginsdk.Resource {
}

func resourceBastionHostCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) error {
client := meta.(*clients.Client).Network.BastionHostsClient
client := meta.(*clients.Client).Network.BastionHosts
subscriptionId := meta.(*clients.Client).Account.SubscriptionId
ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d)
defer cancel()
Expand Down Expand Up @@ -234,7 +234,7 @@ func resourceBastionHostCreateUpdate(d *pluginsdk.ResourceData, meta interface{}
}

func resourceBastionHostRead(d *pluginsdk.ResourceData, meta interface{}) error {
client := meta.(*clients.Client).Network.BastionHostsClient
client := meta.(*clients.Client).Network.BastionHosts
ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d)
defer cancel()

Expand Down Expand Up @@ -293,7 +293,7 @@ func resourceBastionHostRead(d *pluginsdk.ResourceData, meta interface{}) error
}

func resourceBastionHostDelete(d *pluginsdk.ResourceData, meta interface{}) error {
client := meta.(*clients.Client).Network.BastionHostsClient
client := meta.(*clients.Client).Network.BastionHosts
ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d)
defer cancel()

Expand Down
4 changes: 2 additions & 2 deletions internal/services/network/bastion_host_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"fmt"
"testing"

"github.com/hashicorp/go-azure-sdk/resource-manager/network/2022-09-01/bastionhosts"
"github.com/hashicorp/go-azure-sdk/resource-manager/network/2023-02-01/bastionhosts"
"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"
Expand Down Expand Up @@ -129,7 +129,7 @@ func (BastionHostResource) Exists(ctx context.Context, clients *clients.Client,
return nil, err
}

resp, err := clients.Network.BastionHostsClient.Get(ctx, *id)
resp, err := clients.Network.BastionHosts.Get(ctx, *id)
if err != nil {
return nil, fmt.Errorf("reading Bastion Host (%s): %+v", *id, err)
}
Expand Down
Loading

0 comments on commit 44d0a50

Please sign in to comment.