instance

package
v1.24.0 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsInstanceDNSName added in v1.24.0

func IsInstanceDNSName(dnsName string) bool

IsInstanceDNSName returns true if the domain name matches the well-known Cloud SQL instance DNS name pattern.

func IsValidDomain added in v1.16.0

func IsValidDomain(dn string) bool

IsValidDomain validates that a string is a well-formed domain name

func ParseInstanceDNSName added in v1.24.0

func ParseInstanceDNSName(dnsName string) (instanceLabel, projectLabel, region, suffix string, ok bool)

ParseInstanceDNSName parses a DNS name into its constituent parts. Instance DNS names follow this template: {instance-dns-label}.{project-dns-label}.{cloud-region}.{dns-suffix} Suffix is one of: sql.goog, sql-psa.goog, sql-psc.goog (with optional trailing dot). This returns ok == false when the region is "global"

Types

type ConnName

type ConnName struct {
	// contains filtered or unexported fields
}

ConnName represents the "instance connection name", in the format "project:region:name".

func ParseConnName

func ParseConnName(cn string) (ConnName, error)

ParseConnName initializes a new ConnName struct.

func ParseConnNameWithDomainName added in v1.13.0

func ParseConnNameWithDomainName(cn string, dn string) (ConnName, error)

ParseConnNameWithDomainName initializes a new ConnName struct, also setting the domain name.

func (*ConnName) DomainName added in v1.13.0

func (c *ConnName) DomainName() string

DomainName returns the domain name for this instance

func (*ConnName) HasDomainName added in v1.13.0

func (c *ConnName) HasDomainName() bool

HasDomainName returns whether the Cloud SQL instance has a domain name

func (*ConnName) Name

func (c *ConnName) Name() string

Name returns the Cloud SQL instance name

func (*ConnName) Project

func (c *ConnName) Project() string

Project returns the project within which the Cloud SQL instance runs.

func (*ConnName) Region

func (c *ConnName) Region() string

Region returns the region where the Cloud SQL instance runs.

func (*ConnName) String

func (c *ConnName) String() string

type ConnectionNameResolver added in v1.12.0

type ConnectionNameResolver interface {
	// Resolve accepts a name, and returns a ConnName with the instance
	// connection string for the name. If the name cannot be resolved, returns
	// an error.
	Resolve(ctx context.Context, name string) (ConnName, error)
}

ConnectionNameResolver resolves the connection name string into a valid instance name. This allows an application to replace the default resolver with a custom implementation.

Jump to

Keyboard shortcuts

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