Documentation ¶
Overview ¶
package gcp provides utilities for working with GCP
Index ¶
Constants ¶
View Source
const (
// CredentialDirPermMode unix permission max suitable for directory storing credentials
CredentialDirPermMode = 0700
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CachedCredentialHelper ¶
type CachedCredentialHelper struct { CredentialHelper CredentialHelper TokenCache TokenCache Log logr.Logger }
CachedCredentialHelper is a credential helper that will cache the credential.
func (*CachedCredentialHelper) GetOAuthConfig ¶
func (h *CachedCredentialHelper) GetOAuthConfig() *oauth2.Config
func (*CachedCredentialHelper) GetTokenSource ¶
func (c *CachedCredentialHelper) GetTokenSource(ctx context.Context) (oauth2.TokenSource, error)
type CredentialHelper ¶
type CredentialHelper interface { //GetTokenAndConfig() (*TokenAndConfig, error) GetTokenSource(ctx context.Context) (oauth2.TokenSource, error) // GetOAuthConfig returns the OAuth2 client configuration GetOAuthConfig() *oauth2.Config }
CredentialHelper defines an interface for getting tokens.
type FileTokenCache ¶
FileTokenCache implements caching to a file.
type SecretCache ¶
type SecretCache struct { Project string Secret string Version string Log logr.Logger // contains filtered or unexported fields }
SecretCache implements a cache for an OAuth2 credential using GCP secret manager
func NewSecretCache ¶
func NewSecretCache(project string, secret string, version string) (*SecretCache, error)
type TokenCache ¶
TokenCache defines an interface for caching tokens
type WebFlowHelper ¶
WebFlowHelper helps get credentials using the webflow.
func NewWebFlowHelper ¶
func NewWebFlowHelper(oAuthClientFile string, scopes []string) (*WebFlowHelper, error)
NewWebFlowHelper constructs a new web flow helper. oAuthClientFile should be the path to a credentials.json downloaded from the API console.
func (*WebFlowHelper) GetOAuthConfig ¶
func (h *WebFlowHelper) GetOAuthConfig() *oauth2.Config
func (*WebFlowHelper) GetTokenSource ¶
func (h *WebFlowHelper) GetTokenSource(ctx context.Context) (oauth2.TokenSource, error)
GetTokenSource requests a token from the web, then returns the retrieved token.
Click to show internal directories.
Click to hide internal directories.