gcpcfg

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: MIT Imports: 19 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package gcpcfg holds the Google Cloud connection settings shared by state backends, encrypters, and Go libraries. Load resolves a Configuration into credentials and client settings.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultScopes

func DefaultScopes() []string

DefaultScopes returns the OAuth scopes used when a config does not set scopes explicitly.

Types

type Configuration

type Configuration struct {
	Project                            *string
	BillingProject                     *string
	Region                             *string
	Zone                               *string
	CredentialsFile                    *string
	ImpersonateServiceAccount          *string
	ImpersonateServiceAccountDelegates *[]string
	Scopes                             *[]string
	Endpoints                          *map[string]string
	UserProjectOverride                *bool
	RequestReason                      *string
	RequestTimeout                     *string
	UniverseDomain                     *string
	PreferRegionalEndpoints            *bool
	PreferGlobalEndpoints              *bool
}

Configuration selects how a component reaches Google Cloud. Credentials come from Application Default Credentials, metadata credentials, or a credentials file path; inline tokens and private keys do not belong here.

func (*Configuration) ClientOptions

func (c *Configuration) ClientOptions(service string) ([]option.ClientOption, error)

ClientOptions returns Google API client options for service.

func (Configuration) Defaults

func (c Configuration) Defaults() []defaults.Default

Defaults declares schema defaults for source analysis.

func (*Configuration) Endpoint

func (c *Configuration) Endpoint(service string) string

Endpoint returns the endpoint configured for service.

func (*Configuration) KMSEndpoint

func (c *Configuration) KMSEndpoint() string

KMSEndpoint returns the Google Cloud KMS endpoint override.

func (*Configuration) ScopeValues

func (c *Configuration) ScopeValues() []string

ScopeValues returns configured scopes, or the default scopes when absent.

func (*Configuration) StorageEndpoint

func (c *Configuration) StorageEndpoint() string

StorageEndpoint returns the Google Cloud Storage endpoint override.

func (*Configuration) Timeout

func (c *Configuration) Timeout() (time.Duration, error)

Timeout returns the request timeout duration.

func (*Configuration) Validate

func (c *Configuration) Validate() error

Validate checks static configuration that can be rejected without network I/O.

type ResolvedConfig

type ResolvedConfig struct {
	Project                 string
	BillingProject          string
	Region                  string
	Zone                    string
	Credentials             *auth.Credentials
	TokenSource             oauth2.TokenSource
	Scopes                  []string
	Endpoints               map[string]string
	UserProjectOverride     bool
	RequestReason           string
	RequestTimeout          time.Duration
	UniverseDomain          string
	PreferRegionalEndpoints bool
	PreferGlobalEndpoints   bool
}

ResolvedConfig contains resolved Google Cloud client settings and credentials.

func Load

Load builds a ResolvedConfig from c through Application Default Credentials and environment defaults. A nil c applies no explicit overrides.

func (*ResolvedConfig) ClientOptions

func (c *ResolvedConfig) ClientOptions(service string) []option.ClientOption

ClientOptions returns Google API client options for service.

Jump to

Keyboard shortcuts

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