Skip to content

Commit

Permalink
Update FrameworkProviderConfig to use plugin framework types packag…
Browse files Browse the repository at this point in the history
…e for `UserProjectOverride` boolean
  • Loading branch information
SarahFrench committed Sep 5, 2023
1 parent 3854ebd commit dbe4952
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ type FrameworkProviderConfig struct {
Scopes []string
TokenSource oauth2.TokenSource
UserAgent string
UserProjectOverride bool
UserProjectOverride types.Bool

// paths for client setup
<% products.each do |product| -%>
Expand Down Expand Up @@ -101,6 +101,7 @@ func (p *FrameworkProviderConfig) LoadAndValidateFramework(ctx context.Context,
p.Project = data.Project
p.Region = data.Region
p.Zone = data.Zone
p.UserProjectOverride = data.UserProjectOverride
p.PollInterval = 10 * time.Second
p.RequestBatcherServiceUsage = transport_tpg.NewRequestBatcher("Service Usage", ctx, batchingConfig)
p.RequestBatcherIam = transport_tpg.NewRequestBatcher("IAM", ctx, batchingConfig)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func SendFrameworkRequestWithTimeout(p *FrameworkProviderConfig, method, project
reqHeaders.Set("User-Agent", userAgent)
reqHeaders.Set("Content-Type", "application/json")

if p.UserProjectOverride && project != "" {
if p.UserProjectOverride.ValueBool() && project != "" {
// When project is "NO_BILLING_PROJECT_OVERRIDE" in the function GetCurrentUserEmail,
// set the header X-Goog-User-Project to be empty string.
if project == "NO_BILLING_PROJECT_OVERRIDE" {
Expand Down

0 comments on commit dbe4952

Please sign in to comment.