cloudsql

package
v0.48.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: Apache-2.0 Imports: 9 Imported by: 14

Documentation

Overview

Package cloudsql contains Wire providers that are common across Google Cloud SQL.

Index

Constants

This section is empty.

Variables

CertSourceSet is a Wire provider set that binds a Cloud SQL proxy certificate source from an GCP-authenticated HTTP client.

Deprecated: Use DialerSet instead, which supports PSC and explicit IP type selection via URLOpener.IPType or the "ip_type" URL query parameter.

View Source
var DialerSet = wire.NewSet(NewDialer)

DialerSet is a Wire provider set that binds a Cloud SQL Dialer from a GCP token source. Use this instead of CertSourceSet when PSC or explicit IP type selection is required.

Functions

func NewCertSource deprecated

func NewCertSource(c *gcp.HTTPClient) *certs.RemoteCertSource

NewCertSource creates a local certificate source that uses the given HTTP client. The client is assumed to make authenticated requests.

Deprecated: Use NewDialer instead.

func NewCertSourceWithIAM deprecated added in v0.28.0

func NewCertSourceWithIAM(c *gcp.HTTPClient, t oauth2.TokenSource) *certs.RemoteCertSource

NewCertSourceWithIAM creates a local certificate source, including Token source for token information used in cert creation, that uses the given HTTP client. The client is assumed to make authenticated requests.

Deprecated: Use NewDialerWithIAM instead.

func NewDialer added in v0.48.0

func NewDialer(ctx context.Context, ts oauth2.TokenSource) (*cloudsqlconn.Dialer, func() error, error)

NewDialer creates a Cloud SQL Dialer using the given OAuth2 token source. The returned cleanup function must be called when the dialer is no longer needed.

func NewDialerWithIAM added in v0.48.0

func NewDialerWithIAM(ctx context.Context, ts oauth2.TokenSource) (*cloudsqlconn.Dialer, func() error, error)

NewDialerWithIAM creates a Cloud SQL Dialer with IAM authentication enabled, using the given OAuth2 token source. IAM authentication allows passwordless connections to Cloud SQL instances. The returned cleanup function must be called when the dialer is no longer needed.

Types

type IPType added in v0.48.0

type IPType int

IPType specifies the type of IP address to use when connecting to a Cloud SQL instance.

const (
	// IPTypeAuto uses a public IP if one is assigned to the instance; otherwise
	// falls back to private IP. This is the default and matches the behavior of
	// the legacy cloudsql-proxy v1 (equivalent to --auto-ip).
	IPTypeAuto IPType = iota
	// IPTypePublic uses the instance's public IP address.
	IPTypePublic
	// IPTypePrivate uses the instance's private IP address (requires VPC peering).
	IPTypePrivate
	// IPTypePSC uses a Private Service Connect endpoint.
	IPTypePSC
)

func ParseIPType added in v0.48.0

func ParseIPType(s string) (IPType, error)

ParseIPType parses the IPType from a string (likely a URL parameter).

func (IPType) DialOptions added in v0.48.0

func (t IPType) DialOptions() []cloudsqlconn.DialOption

DialOptions returns the cloudsqlconn.DialOption(s) for this IPType.

Jump to

Keyboard shortcuts

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