Documentation
¶
Index ¶
- Constants
- type Client
- func (c *Client) FindDefaultCredentials(ctx context.Context, scopes []string, options ...fetch_config.Option) (token_source.TokenSource, error)
- func (c *Client) GetIdToken(ctx context.Context, audience string, options ...fetch_config.Option) (string, error)
- func (c *Client) GetProjectId(ctx context.Context, options ...fetch_config.Option) (string, error)
- func (c *Client) GetServiceAccountEmail(ctx context.Context, options ...fetch_config.Option) (string, error)
Constants ¶
View Source
const (
DefaultTokenUrl = "https://oauth2.googleapis.com/token" //nolint:gosec // G101: public OAuth token endpoint URL, not a credential
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(options ...gcp_config.Option) *Client
func NewClientWithUrls ¶
func (*Client) FindDefaultCredentials ¶
func (c *Client) FindDefaultCredentials(ctx context.Context, scopes []string, options ...fetch_config.Option) (token_source.TokenSource, error)
FindDefaultCredentials discovers Google credentials using the Application Default Credentials chain:
- GOOGLE_APPLICATION_CREDENTIALS env var — reads the JSON file it points to.
- Well-known file — user credentials from gcloud auth application-default login.
- Metadata server — if running on GCP (Compute Engine, Cloud Run, etc.).
func (*Client) GetIdToken ¶
func (*Client) GetProjectId ¶
func (*Client) GetServiceAccountEmail ¶
func (c *Client) GetServiceAccountEmail(ctx context.Context, options ...fetch_config.Option) (string, error)
GetServiceAccountEmail returns the email address of the runtime's default service account by querying the GCP metadata server. Only works when running inside a GCP environment that exposes the metadata server (Compute Engine, Cloud Run, GKE, etc.).
Click to show internal directories.
Click to hide internal directories.