Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send billing_project for every request when set #769

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions google/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ func (c *Config) LoadAndValidate(ctx context.Context) error {
if err != nil {
return err
}

// Userinfo is fetched before request logging is enabled to reduce additional noise.
err = c.logGoogleIdentities()
if err != nil {
Expand All @@ -390,6 +391,12 @@ func (c *Config) LoadAndValidate(ctx context.Context) error {
headerTransport.Set("X-Goog-Request-Reason", c.RequestReason)
}

// Ensure $userProject is set for all HTTP requests using the client if specified by the provider config
// See https://cloud.google.com/apis/docs/system-parameters
if c.UserProjectOverride && c.BillingProject != "" {
headerTransport.Set("X-Goog-User-Project", c.BillingProject)
}

// Set final transport value.
client.Transport = headerTransport

Expand Down