Documentation
¶
Overview ¶
Package deploydb resolves a database connection from a deployed blueprint instance's state so the CLI can run schema migrations against a deployed environment.
Resolution is provider-specific: how the concrete database and credential resources appear in state, and where credentials are fetched from, differ per cloud. Celerity is not AWS-only, so resolution is modular. A Resolver is selected by the deploy target (see ResolverFor), with one implementation per provider (aws.go today, with gcloud and azure to follow).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ResolveInput ¶
type ResolveInput struct {
// SQLDatabaseName is the celerity/sqlDatabase resource's name in the
// blueprint.
SQLDatabaseName string
// Engine is the database engine ("postgres", "mysql"), which determines the
// shape of the connection string as well as the driver.
Engine string
// FallbackDatabase is the database name to use when deployed state does not
// carry one.
FallbackDatabase string
}
ResolveInput names the database to resolve a connection for.
type ResolvedConnection ¶
type ResolvedConnection struct {
// ConnectionString is the full connection URL (contains credentials).
ConnectionString string
// Target is a human-readable host/db summary, safe to print (no credentials).
Target string
}
ResolvedConnection is a ready-to-use database connection derived from deployed state, with credentials already resolved from the provider's secret store.
type Resolver ¶
type Resolver interface {
Resolve(
ctx context.Context,
instance *state.InstanceState,
input ResolveInput,
) (*ResolvedConnection, error)
}
Resolver derives a database connection from deployed instance state for a particular deploy target's provider.
func ResolverFor ¶
ResolverFor returns the connection resolver for a deploy target, or an error if that target's resolution is not supported yet.