alloydb

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// RefreshTimeout is the maximum amount of time to wait for a refresh
	// cycle to complete. This value should be greater than the
	// refreshInterval.
	RefreshTimeout = 60 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Instance

type Instance struct {
	// OpenConns is the number of open connections to the instance.
	OpenConns uint64

	InstanceURI
	// contains filtered or unexported fields
}

Instance manages the information used to connect to the AlloyDB instance by periodically calling the AlloyDB Admin API. It automatically refreshes the required information approximately 4 minutes before the previous certificate expires (every ~56 minutes).

func NewInstance

func NewInstance(
	instance InstanceURI,
	client *alloydbadmin.AlloyDBAdminClient,
	key *rsa.PrivateKey,
	refreshTimeout time.Duration,
	dialerID string,
) *Instance

NewInstance initializes a new Instance given an instance URI

func (*Instance) Close

func (i *Instance) Close()

Close closes the instance; it stops the refresh cycle and prevents it from making additional calls to the AlloyDB Admin API.

func (*Instance) ConnectInfo

func (i *Instance) ConnectInfo(ctx context.Context) (string, *tls.Config, error)

ConnectInfo returns an IP address of the AlloyDB instance.

func (*Instance) ForceRefresh

func (i *Instance) ForceRefresh()

ForceRefresh triggers an immediate refresh operation to be scheduled and used for future connection attempts if valid.

func (*Instance) String

func (i *Instance) String() string

String returns the instance's URI.

type InstanceURI added in v1.2.2

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

InstanceURI represents an AlloyDB instance.

func ParseInstURI added in v1.2.2

func ParseInstURI(cn string) (InstanceURI, error)

ParseInstURI initializes a new InstanceURI struct.

func (*InstanceURI) String added in v1.2.2

func (i *InstanceURI) String() string

Jump to

Keyboard shortcuts

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