gocloud.devgocloud.dev/gcp Index | Files | Directories

package gcp

import "gocloud.dev/gcp"

Package gcp provides fundamental Wire providers and types for Google Cloud Platform (GCP).

Index

Variables

var DefaultIdentity = wire.NewSet(
	CredentialsTokenSource,
	DefaultCredentials,
	DefaultProjectID)

DefaultIdentity is a Wire provider set that provides the project ID and token source from Application Default Credentials (ADC).

Functions

func DefaultCredentials

func DefaultCredentials(ctx context.Context) (*google.Credentials, error)

DefaultCredentials obtains the default GCP credentials with Cloud Platform scope.

func DefaultTransport

func DefaultTransport() http.RoundTripper

DefaultTransport returns http.DefaultTransport.

Types

type HTTPClient

type HTTPClient struct {
	http.Client
}

HTTPClient is an HTTP client that makes requests authenticated with Cloud- Platform-scoped authentication tokens.

func NewAnonymousHTTPClient

func NewAnonymousHTTPClient(transport http.RoundTripper) *HTTPClient

NewAnonymousHTTPClient creates a new anonymous HTTP client.

func NewHTTPClient

func NewHTTPClient(transport http.RoundTripper, ts TokenSource) (*HTTPClient, error)

NewHTTPClient creates a new authenticated HTTP client.

type ProjectID

type ProjectID string

ProjectID is a GCP Project ID.

func DefaultProjectID

func DefaultProjectID(creds *google.Credentials) (ProjectID, error)

DefaultProjectID obtains the project ID from the default GCP credentials.

type TokenSource

type TokenSource oauth2.TokenSource

TokenSource wraps a GCP token source that provides Cloud-Platform- scoped tokens.

func CredentialsTokenSource

func CredentialsTokenSource(creds *google.Credentials) TokenSource

CredentialsTokenSource extracts the token source from GCP credentials.

Source Files

gcp.go

Directories

PathSynopsis
gcp/cloudsqlPackage cloudsql contains Wire providers that are common across Google Cloud SQL.
gcp/gcpcloudPackage gcpcloud contains Wire providers for GCP services.
Version
v0.41.0 (latest)
Published
Mar 30, 2025
Platform
linux/amd64
Imports
6 packages
Last checked
56 seconds ago

Tools for package owners.