Documentation
¶
Overview ¶
Package gcp_adc implements the gcp/adc authentication provider.
This provider obtains credentials from Google Cloud Application Default Credentials (ADC), which searches for credentials in this order:
- GOOGLE_APPLICATION_CREDENTIALS environment variable
- User credentials from gcloud auth application-default login
- Service account attached to GCP resource (GCE, Cloud Run, etc.)
Configuration example in atmos.yaml:
auth:
providers:
my-gcp-adc:
kind: gcp/adc
spec:
project_id: my-project # optional, defaults to ADC project
region: us-central1 # optional
scopes: # optional, defaults to cloud-platform
- https://www.googleapis.com/auth/cloud-platform
Index ¶
- Constants
- type Provider
- func (p *Provider) Authenticate(ctx context.Context) (types.ICredentials, error)
- func (p *Provider) Environment() (map[string]string, error)
- func (p *Provider) GetFilesDisplayPath() string
- func (p *Provider) Kind() string
- func (p *Provider) Logout(ctx context.Context) error
- func (p *Provider) Name() string
- func (p *Provider) Paths() ([]types.Path, error)
- func (p *Provider) PreAuthenticate(_ types.AuthManager) error
- func (p *Provider) PrepareEnvironment(ctx context.Context, environ map[string]string) (map[string]string, error)
- func (p *Provider) SetName(name string)
- func (p *Provider) SetRealm(realm string)
- func (p *Provider) Validate() error
Constants ¶
const ( // ProviderKind is the kind identifier for this provider. ProviderKind = types.ProviderKindGCPADC // "gcp/adc" // DefaultScope is the default OAuth scope. DefaultScope = "https://www.googleapis.com/auth/cloud-platform" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider implements the gcp/adc authentication provider.
func New ¶
func New(spec *types.GCPADCProviderSpec) (*Provider, error)
New creates a new ADC provider from the given spec.
func (*Provider) Authenticate ¶
Authenticate obtains credentials from ADC.
func (*Provider) Environment ¶
Environment returns environment variables for this provider.
func (*Provider) GetFilesDisplayPath ¶
GetFilesDisplayPath returns the display path for credential files.
func (*Provider) Logout ¶
Logout removes provider-specific credential storage. ADC credentials are managed by gcloud or env; this provider does not store credentials.
func (*Provider) Paths ¶
Paths returns credential files/directories used by this provider. ADC uses GOOGLE_APPLICATION_CREDENTIALS or gcloud config; this provider does not manage paths.
func (*Provider) PreAuthenticate ¶
func (p *Provider) PreAuthenticate(_ types.AuthManager) error
PreAuthenticate is a no-op for GCP ADC provider.
func (*Provider) PrepareEnvironment ¶
func (p *Provider) PrepareEnvironment(ctx context.Context, environ map[string]string) (map[string]string, error)
PrepareEnvironment prepares environment variables for external processes. Returns a copy of environ; ADC is resolved at auth time, so no provider-specific env is required here.