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
credentials/google: introduce a new API NewComputeEngineCredsWithOptions
#4767
Changes from 5 commits
10790dc
2436373
6270425
33ebd02
72552c8
e314a44
514cda1
7e645f9
af130ed
18f6f5e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -76,6 +76,26 @@ func NewComputeEngineCredentials() credentials.Bundle { | |
return bundle | ||
} | ||
|
||
// NewComputeEngineCredsWithPerRPC returns a credentials bundle that is configured to work | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
// with google services. This API must only be used when running on GCE. | ||
// | ||
// This API is experimental. | ||
func NewComputeEngineCredsWithPerRPC(cc credentials.PerRPCCredentials) credentials.Bundle { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rename There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
c := &creds{ | ||
newPerRPCCreds: func() credentials.PerRPCCredentials { | ||
if cc != nil { | ||
return cc | ||
} | ||
return oauth.NewComputeEngine() | ||
}, | ||
} | ||
bundle, err := c.NewWithMode(internal.CredsBundleModeFallback) | ||
if err != nil { | ||
logger.Warningf("compute engine creds with per rpc: failed to create new creds: %v", err) | ||
} | ||
return bundle | ||
} | ||
|
||
// creds implements credentials.Bundle. | ||
type creds struct { | ||
// Supported modes are defined in internal/internal.go. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change
NewComputeEngineCredentials
to call the new functionThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done