Skip to content

Commit

Permalink
Resolve rebase modifications
Browse files Browse the repository at this point in the history
thogarty committed Aug 6, 2024
1 parent 43f6d85 commit 0f97aa0
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions internal/config/config.go
Original file line number Diff line number Diff line change
@@ -124,7 +124,7 @@ func (c *Config) Load(ctx context.Context) error {
// equinix-sdk-go/fabricv4 client to be used to access Fabric's V4 APIs
// Deprecated: migrate to NewFabricClientForFramework instead
func (c *Config) NewFabricClientForSDK(d *schema.ResourceData) *fabricv4.APIClient {
client := c.newFabricClient()
client := c.newFabricClient(context.WithValue(context.Background(), "fabricSDKv2", "no_oauth_reload"))

Check failure on line 127 in internal/config/config.go

GitHub Actions / lint

SA1029: should not use built-in type string as key for value; define your own type to avoid collisions (staticcheck)

baseUserAgent := c.tfSdkUserAgent(client.GetConfig().UserAgent)
client.GetConfig().UserAgent = generateModuleUserAgentString(d, baseUserAgent)
@@ -135,15 +135,15 @@ func (c *Config) NewFabricClientForSDK(d *schema.ResourceData) *fabricv4.APIClie
// Shim for Fabric tests.
// Deprecated: when the acceptance package starts to contain API clients for testing/cleanup this will move with them
func (c *Config) NewFabricClientForTesting() *fabricv4.APIClient {
client := c.newFabricClient()
client := c.newFabricClient(context.WithValue(context.Background(), "fabricSDKv2", "no_oauth_reload"))

Check failure on line 138 in internal/config/config.go

GitHub Actions / lint

SA1029: should not use built-in type string as key for value; define your own type to avoid collisions (staticcheck)

client.GetConfig().UserAgent = fmt.Sprintf("tf-acceptance-tests %v", client.GetConfig().UserAgent)

return client
}

func (c *Config) NewFabricClientForFramework(ctx context.Context, meta tfsdk.Config) *fabricv4.APIClient {
client := c.newFabricClient()
client := c.newFabricClient(ctx)

baseUserAgent := c.tfFrameworkUserAgent(client.GetConfig().UserAgent)
client.GetConfig().UserAgent = generateFwModuleUserAgentString(ctx, meta, baseUserAgent)
@@ -153,9 +153,18 @@ func (c *Config) NewFabricClientForFramework(ctx context.Context, meta tfsdk.Con

// newFabricClient returns the base fabricv4 client that is then used for either the sdkv2 or framework
// implementations of the Terraform Provider with exported Methods
func (c *Config) newFabricClient() *fabricv4.APIClient {
func (c *Config) newFabricClient(ctx context.Context) *fabricv4.APIClient {
//nolint:staticcheck // We should move to subsystem loggers, but that is a much bigger change
transport := logging.NewTransport("Equinix Fabric (fabricv4)", c.authClient.Transport)
if v := ctx.Value("fabricSDKv2"); v == nil {
authConfig := oauth2.Config{
ClientID: c.ClientID,
ClientSecret: c.ClientSecret,
BaseURL: c.BaseURL,
}
authClient := authConfig.New(ctx)
transport = logging.NewTransport("Equinix Fabric (fabricv4)", authClient.Transport)

Check failure on line 166 in internal/config/config.go

GitHub Actions / lint

SA1019: logging.NewTransport is deprecated: This will log the content of every http request/response at `[DEBUG]` level, without any filtering. Any sensitive information will appear as-is in your logs. Please use NewSubsystemLoggingHTTPTransport instead. (staticcheck)
}

retryClient := retryablehttp.NewClient()
retryClient.HTTPClient.Transport = transport

0 comments on commit 0f97aa0

Please sign in to comment.