Skip to content

Commit

Permalink
move NewIamCredentialsClient method to framework_provider_clients.go
Browse files Browse the repository at this point in the history
  • Loading branch information
BBBmau committed Oct 23, 2024
1 parent b13b3b0 commit 799cb87
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
14 changes: 0 additions & 14 deletions mmv1/third_party/terraform/fwtransport/framework_config.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -529,20 +529,6 @@ func RemoveBasePathVersion(url string) string {
return re.ReplaceAllString(url, "$1/")
}

func (p *FrameworkProviderConfig) NewIamCredentialsClient(userAgent string) *iamcredentials.Service {
iamCredentialsClientBasePath := RemoveBasePathVersion(p.IAMCredentialsBasePath)
log.Printf("[INFO] Instantiating Google Cloud IAMCredentials client for path %s", iamCredentialsClientBasePath)
clientIamCredentials, err := iamcredentials.NewService(p.Context, option.WithHTTPClient(p.Client))
if err != nil {
log.Printf("[WARN] Error creating client iam credentials: %s", err)
return nil
}
clientIamCredentials.UserAgent = userAgent
clientIamCredentials.BasePath = iamCredentialsClientBasePath

return clientIamCredentials
}

func (p *FrameworkProviderConfig) logGoogleIdentities(ctx context.Context, data fwmodels.ProviderModel, diags *diag.Diagnostics) {
// GetCurrentUserEmailFramework doesn't pass an error back from logGoogleIdentities, so we want
// a separate diagnostics here
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,20 @@ func (p *FrameworkProviderConfig) NewDnsClient(userAgent string, diags *diag.Dia
return clientDns
}

func (p *FrameworkProviderConfig) NewIamCredentialsClient(userAgent string) *iamcredentials.Service {
iamCredentialsClientBasePath := RemoveBasePathVersion(p.IAMCredentialsBasePath)
log.Printf("[INFO] Instantiating Google Cloud IAMCredentials client for path %s", iamCredentialsClientBasePath)
clientIamCredentials, err := iamcredentials.NewService(p.Context, option.WithHTTPClient(p.Client))
if err != nil {
log.Printf("[WARN] Error creating client iam credentials: %s", err)
return nil
}
clientIamCredentials.UserAgent = userAgent
clientIamCredentials.BasePath = iamCredentialsClientBasePath

return clientIamCredentials
}

{{ if ne $.TargetVersionName `ga` -}}
func (p *FrameworkProviderConfig) NewFirebaseClient(userAgent string, diags *diag.Diagnostics) *firebase.Service {
firebaseClientBasePath := transport_tpg.RemoveBasePathVersion(p.FirebaseBasePath)
Expand Down

0 comments on commit 799cb87

Please sign in to comment.