Skip to content

Commit

Permalink
Merge pull request hashicorp#14083 from magodo/upgrade_storage_accoun…
Browse files Browse the repository at this point in the history
…t_sdk_to_2021_04_01

Upgrade storage sdk to 2021-04-01
  • Loading branch information
tombuildsstuff authored Nov 15, 2021
2 parents 8b67f3b + 61ed4e7 commit dc05e90
Show file tree
Hide file tree
Showing 37 changed files with 15,285 additions and 84 deletions.
7 changes: 4 additions & 3 deletions internal/services/storage/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import (
"context"
"fmt"

"github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-01-01/storage"
legacystorage "github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-01-01/storage"
"github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage"
"github.com/Azure/azure-sdk-for-go/services/storagesync/mgmt/2020-03-01/storagesync"
"github.com/Azure/go-autorest/autorest"
az "github.com/Azure/go-autorest/autorest/azure"
Expand All @@ -29,7 +30,7 @@ type Client struct {
ADLSGen2PathsClient *paths.Client
ManagementPoliciesClient *storage.ManagementPoliciesClient
BlobServicesClient *storage.BlobServicesClient
BlobInventoryPoliciesClient *storage.BlobInventoryPoliciesClient
BlobInventoryPoliciesClient *legacystorage.BlobInventoryPoliciesClient
CloudEndpointsClient *storagesync.CloudEndpointsClient
EncryptionScopesClient *storage.EncryptionScopesClient
Environment az.Environment
Expand Down Expand Up @@ -59,7 +60,7 @@ func NewClient(options *common.ClientOptions) *Client {
blobServicesClient := storage.NewBlobServicesClientWithBaseURI(options.ResourceManagerEndpoint, options.SubscriptionId)
options.ConfigureClient(&blobServicesClient.Client, options.ResourceManagerAuthorizer)

blobInventoryPoliciesClient := storage.NewBlobInventoryPoliciesClientWithBaseURI(options.ResourceManagerEndpoint, options.SubscriptionId)
blobInventoryPoliciesClient := legacystorage.NewBlobInventoryPoliciesClientWithBaseURI(options.ResourceManagerEndpoint, options.SubscriptionId)
options.ConfigureClient(&blobInventoryPoliciesClient.Client, options.ResourceManagerAuthorizer)

cloudEndpointsClient := storagesync.NewCloudEndpointsClientWithBaseURI(options.ResourceManagerEndpoint, options.SubscriptionId)
Expand Down
4 changes: 2 additions & 2 deletions internal/services/storage/client/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"log"
"sync"

"github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-01-01/storage"
"github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/parse"
)

Expand Down Expand Up @@ -35,7 +35,7 @@ func (ad *accountDetails) AccountKey(ctx context.Context, client Client) (*strin
}

log.Printf("[DEBUG] Cache Miss - looking up the account key for storage account %q..", ad.name)
props, err := client.AccountsClient.ListKeys(ctx, ad.ResourceGroup, ad.name, storage.Kerb)
props, err := client.AccountsClient.ListKeys(ctx, ad.ResourceGroup, ad.name, storage.ListKeyExpandKerb)
if err != nil {
return nil, fmt.Errorf("Listing Keys for Storage Account %q (Resource Group %q): %+v", ad.name, ad.ResourceGroup, err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"time"

"github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-01-01/storage"
"github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage"
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/locks"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"testing"

"github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-01-01/storage"
"github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage"
"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
4 changes: 2 additions & 2 deletions internal/services/storage/storage_account_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"strings"
"time"

"github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-01-01/storage"
"github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage"
azautorest "github.com/Azure/go-autorest/autorest"
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
Expand Down Expand Up @@ -287,7 +287,7 @@ func dataSourceStorageAccountRead(d *pluginsdk.ResourceData, meta interface{}) e
d.Set("primary_access_key", "")
d.Set("secondary_access_key", "")

keys, err := client.ListKeys(ctx, resourceGroup, name, storage.Kerb)
keys, err := client.ListKeys(ctx, resourceGroup, name, storage.ListKeyExpandKerb)
if err != nil {
// the API returns a 200 with an inner error of a 409..
var hasWriteLock bool
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"strings"
"time"

"github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-01-01/storage"
"github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage"
"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 @@ -94,10 +94,10 @@ func resourceStorageAccountNetworkRules() *pluginsdk.Resource {
Elem: &pluginsdk.Schema{
Type: pluginsdk.TypeString,
ValidateFunc: validation.StringInSlice([]string{
string(storage.AzureServices),
string(storage.Logging),
string(storage.Metrics),
string(storage.None),
string(storage.BypassAzureServices),
string(storage.BypassLogging),
string(storage.BypassMetrics),
string(storage.BypassNone),
}, false),
},
Set: pluginsdk.HashString,
Expand Down Expand Up @@ -306,7 +306,7 @@ func resourceStorageAccountNetworkRulesDelete(d *pluginsdk.ResourceData, meta in
opts := storage.AccountUpdateParameters{
AccountPropertiesUpdateParameters: &storage.AccountPropertiesUpdateParameters{
NetworkRuleSet: &storage.NetworkRuleSet{
Bypass: storage.AzureServices,
Bypass: storage.BypassAzureServices,
DefaultAction: storage.DefaultActionAllow,
},
},
Expand Down Expand Up @@ -350,7 +350,7 @@ func expandStorageAccountNetworkRuleIpRules(ipRulesInfo []interface{}) *[]storag
attrs := ipRuleConfig.(string)
ipRule := storage.IPRule{
IPAddressOrRange: utils.String(attrs),
Action: storage.Allow,
Action: storage.ActionAllow,
}
ipRules[i] = ipRule
}
Expand All @@ -365,7 +365,7 @@ func expandStorageAccountNetworkRuleVirtualRules(virtualNetworkInfo []interface{
attrs := virtualNetworkConfig.(string)
virtualNetwork := storage.VirtualNetworkRule{
VirtualNetworkResourceID: utils.String(attrs),
Action: storage.Allow,
Action: storage.ActionAllow,
}
virtualNetworks[i] = virtualNetwork
}
Expand Down
Loading

0 comments on commit dc05e90

Please sign in to comment.