Help us shape the future of Go! Take the 2026 Go Developer Survey

gcp

package
v1.233.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 20, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetClientOptions

func GetClientOptions(opts AuthOptions) []option.ClientOption

GetClientOptions returns Google Cloud client options based on the provided authentication configuration. This function provides unified authentication handling across all Google Cloud services in Atmos.

Authentication precedence: 1. Explicit credentials (JSON content or file path) 2. GOOGLE_OAUTH_ACCESS_TOKEN environment variable (static access token) 3. Application Default Credentials (ADC) which automatically handles:

  • GOOGLE_APPLICATION_CREDENTIALS environment variable
  • Compute Engine metadata service
  • Cloud Shell credentials
  • gcloud user credentials (from `gcloud auth application-default login`)
  • Workload Identity (in GKE)

func GetCredentialsFromBackend

func GetCredentialsFromBackend(backend map[string]any) string

GetCredentialsFromBackend extracts credentials from a Terraform backend configuration. This is used by the GCS Terraform backend.

func GetCredentialsFromStore

func GetCredentialsFromStore(credentials *string) string

GetCredentialsFromStore extracts credentials from a store configuration. This is used by the Google Secret Manager store.

Types

type AuthOptions

type AuthOptions struct {
	// Credentials can be either:
	// - JSON content (if starts with "{")
	// - File path to service account JSON file
	// - Empty string to use Application Default Credentials (ADC)
	Credentials string

	// AccessToken is an OAuth2 access token to use directly. This is preferred
	// by Atmos GCP WIF/service-account identities because their generated ADC
	// files do not contain refresh tokens.
	AccessToken string //nolint:gosec // Intentional credential field passed directly to Google client options.
	TokenExpiry time.Time

	// Endpoint overrides the default Google API endpoint. This is primarily used
	// by local emulators and integration tests.
	Endpoint string

	// EndpointInsecure allows plaintext gRPC for local endpoints.
	EndpointInsecure bool

	// WithoutAuthentication disables Google authentication for local endpoints
	// that do not validate credentials.
	WithoutAuthentication bool
}

AuthOptions contains configuration for Google Cloud authentication.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL