Documentation
¶
Overview ¶
Package cloudsql contains Wire providers that are common across Google Cloud SQL.
Index ¶
- Variables
- func NewCertSource(c *gcp.HTTPClient) *certs.RemoteCertSourcedeprecated
- func NewCertSourceWithIAM(c *gcp.HTTPClient, t oauth2.TokenSource) *certs.RemoteCertSourcedeprecated
- func NewDialer(ctx context.Context, ts oauth2.TokenSource) (*cloudsqlconn.Dialer, func() error, error)
- func NewDialerWithIAM(ctx context.Context, ts oauth2.TokenSource) (*cloudsqlconn.Dialer, func() error, error)
- type IPType
Constants ¶
This section is empty.
Variables ¶
var CertSourceSet = wire.NewSet( NewCertSource, wire.Bind(new(proxy.CertSource), new(*certs.RemoteCertSource)))
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.
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
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.