Skip to content

Commit

Permalink
Merge pull request #568 from hashicorp/f/storage-clients-from-unique-…
Browse files Browse the repository at this point in the history
…endpoints

sdk/client/dataplane/storage: updating the storage base client to take the baseUri rather than computing it
  • Loading branch information
tombuildsstuff authored Jul 27, 2023
2 parents fae4f1c + 5de28b6 commit 0128168
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions sdk/client/dataplane/storage/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"github.com/hashicorp/go-azure-sdk/sdk/auth"
"github.com/hashicorp/go-azure-sdk/sdk/client"
"github.com/hashicorp/go-azure-sdk/sdk/client/dataplane"
"github.com/hashicorp/go-azure-sdk/sdk/environments"
)

var storageDefaultRetryFunctions = []client.RequestRetryFunc{
Expand All @@ -22,12 +21,9 @@ type BaseClient struct {
Client *dataplane.Client
}

func NewBaseClient(accountName string, accountType string, api environments.Api, componentName, apiVersion string) (*BaseClient, error) {
domainSuffix, ok := api.DomainSuffix()
if !ok {
return nil, fmt.Errorf("`api` did not return a domain suffix for this environment")
}
baseUri := fmt.Sprintf("https://%s.%s.%s", accountName, accountType, *domainSuffix)
func NewBaseClient(baseUri string, componentName, apiVersion string) (*BaseClient, error) {
// NOTE: both the domain name _and_ the domain format can change entirely depending on the type of storage account being used
// when provisioned in an edge zone, and when AzureDNSZone is used, as such we require the baseUri is provided here
return &BaseClient{
Client: dataplane.NewDataPlaneClient(baseUri, fmt.Sprintf("storage/%s", componentName), apiVersion),
}, nil
Expand Down

0 comments on commit 0128168

Please sign in to comment.