Documentation
¶
Index ¶
- func GetRootCmd() *cobra.Command
- func NewCachingTokenSource(ts TokenSourceWithCacheKey) (oauth2.TokenSource, error)
- func Token() (*oauth2.Token, error)
- func TokenSource() (oauth2.TokenSource, error)
- func WriteApplicationCredentials(ac *ApplicationCredentials) error
- type ApplicationCredentials
- type CachingTokenSource
- type DockerHelperRes
- type GoogleComputeTokenSourceWrapper
- type GoogleImpersonateTokenSourceWrapper
- type TokenSourceWithCacheKey
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetRootCmd ¶
func NewCachingTokenSource ¶ added in v0.0.9
func NewCachingTokenSource(ts TokenSourceWithCacheKey) (oauth2.TokenSource, error)
func TokenSource ¶
func TokenSource() (oauth2.TokenSource, error)
TokenSource returns a cached application default credentials or falls back to the compute token source
func WriteApplicationCredentials ¶ added in v0.0.9
func WriteApplicationCredentials(ac *ApplicationCredentials) error
WriteApplicationCredentials idempotently writes out the application credentials to disk
Types ¶
type ApplicationCredentials ¶ added in v0.0.5
type ApplicationCredentials struct { ClientID string `json:"client_id,omitempty"` ClientSecret string `json:"client_secret,omitempty"` QuotaProjectId string `json:"quota_project_id,omitempty"` RefreshToken string `json:"refresh_token,omitempty"` Type string `json:"type,omitempty"` AuthUri string `json:"auth_uri,omitempty"` TokenUri string `json:"token_uri,omitempty"` // service account fields ProjectID string `json:"project_id,omitempty"` PrivateKeyID string `json:"private_key_id,omitempty"` PrivateKey string `json:"private_key,omitempty"` ClientEmail string `json:"client_email,omitempty"` AuthProviderX509CertUrl string `json:"auth_provider_x509_cert_url,omitempty"` ClientX509CertUrl string `json:"client_x509_cert_url,omitempty"` // contains filtered or unexported fields }
ApplicationCredentials is the a struct representing the application_default_credentials.json format. We add access_token and access_token_expiry for easy token caching and refresh.
func ReadApplicationCredentials ¶ added in v0.0.9
func ReadApplicationCredentials() (*ApplicationCredentials, error)
func (*ApplicationCredentials) CacheKey ¶ added in v0.0.9
func (a *ApplicationCredentials) CacheKey() string
func (*ApplicationCredentials) SetContext ¶ added in v0.0.5
func (a *ApplicationCredentials) SetContext(ctx context.Context)
SetContext allows you to set the context on token refresh operations
func (*ApplicationCredentials) Token ¶ added in v0.0.5
func (a *ApplicationCredentials) Token() (*oauth2.Token, error)
Token ensures that we cache the access token. You should probably be using auth.Token() which conditionally calls this. This is slightly better than google.DefaultTokenSource because it has caching.
type CachingTokenSource ¶ added in v0.0.9
type CachingTokenSource struct {
// contains filtered or unexported fields
}
type DockerHelperRes ¶ added in v0.0.5
type GoogleComputeTokenSourceWrapper ¶ added in v0.0.9
type GoogleComputeTokenSourceWrapper struct {
// contains filtered or unexported fields
}
func NewGoogleComputeTokenSourceWrapper ¶ added in v0.0.9
func NewGoogleComputeTokenSourceWrapper(ctx context.Context) (*GoogleComputeTokenSourceWrapper, error)
func (*GoogleComputeTokenSourceWrapper) CacheKey ¶ added in v0.0.9
func (m *GoogleComputeTokenSourceWrapper) CacheKey() string
type GoogleImpersonateTokenSourceWrapper ¶ added in v0.0.9
type GoogleImpersonateTokenSourceWrapper struct {
// contains filtered or unexported fields
}
func NewGoogleImpersonateTokenSourceWrapper ¶ added in v0.0.9
func NewGoogleImpersonateTokenSourceWrapper(ctx context.Context, email string, parentTs oauth2.TokenSource) (*GoogleImpersonateTokenSourceWrapper, error)
func (*GoogleImpersonateTokenSourceWrapper) CacheKey ¶ added in v0.0.9
func (m *GoogleImpersonateTokenSourceWrapper) CacheKey() string
Click to show internal directories.
Click to hide internal directories.