Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewRootCommand ¶
func NewRootCommand(deps Dependencies) *cobra.Command
Types ¶
type APIClient ¶
type APIClient interface {
ListDeployments(ctx context.Context, project, env, deployment string) ([]api.Deployment, error)
ListRecords(ctx context.Context, domain, recordType string) ([]api.Record, error)
CreateRecord(ctx context.Context, domain string, input api.RecordInput) (*api.Record, error)
UpdateRecord(ctx context.Context, domain, id string, input api.RecordInput) (*api.Record, error)
DeleteRecord(ctx context.Context, domain, id string) (*api.Record, error)
ListMailboxes(ctx context.Context, domain string) ([]api.Mailbox, error)
ListForwardings(ctx context.Context, domain string) ([]api.Forwarding, error)
GetSecrets(ctx context.Context, project, env, deployment, format string) (*api.SecretsResult, error)
GetAuthStatus(ctx context.Context) (*api.AuthStatus, error)
ListWebSites(ctx context.Context, zone, server, host string) ([]api.WebSite, error)
CreateWebURI(ctx context.Context, zone, server string, fields map[string]string, dryRun bool) (*api.WebResult, error)
UpdateWebURI(ctx context.Context, zone, server, id string, fields map[string]string, dryRun bool) (*api.WebResult, error)
DeleteWebURI(ctx context.Context, zone, server, id string, dryRun bool) (*api.WebResult, error)
RestoreWebURI(ctx context.Context, zone, server, id string) (*api.WebResult, error)
ListWebServers(ctx context.Context) ([]api.WebServer, error)
ListWebBuckets(ctx context.Context) ([]api.WebBucket, error)
GetWebOptions(ctx context.Context, zone, server, host string) (*api.WebOptions, error)
SetWebOptions(ctx context.Context, zone, server, host string, options map[string]any, dryRun bool) (*api.WebOptions, error)
}
APIClient is the subset of *api.Client the domain, mailbox, forwarding, and (in a later task) project commands depend on. Tests inject a fake implementation; production code resolves a real *api.Client lazily.
type Dependencies ¶
type Dependencies struct {
Out, Err io.Writer
Store credentials.Store
Env func(string) string
ReadSecret func(prompt string) (string, error)
// API, when set, is used instead of resolving a real *api.Client from
// stored credentials. Left nil in production so credential resolution
// stays lazy: it happens inside each domain/mailbox/forwarding
// command's RunE (see resolveAPI in domain.go), never here, so that
// credential-free commands like "auth login" keep working with zero
// stored credentials.
API APIClient
// BaseURL is the Dymmer API base URL; defaults to
// "https://dymmer.com/api/v1" when empty.
BaseURL string
// IsTerminal reports whether stdin is an interactive terminal; used to
// decide whether a destructive command may prompt for confirmation.
IsTerminal func() bool
// Confirm prompts the user with a yes/no question and reports the
// answer. It defaults to a real stderr/stdin prompt (internal/confirm).
Confirm func(prompt string) (bool, error)
// ExtensionsFile, when non-empty, is used directly as the path to the
// user-defined extensions.yaml (see ext.go), bypassing the
// --extensions-file flag/DYM_EXTENSIONS_FILE env var/default-location
// resolution entirely. Left empty in production; tests set it directly
// to point at a scratch file rather than faking env vars or flags.
ExtensionsFile string
// Pair, RunDaemon and Inventory are what `dym auth daemon` and `dym daemon` use to talk to Dymmer and to read the
// host. Nil in production (the real ones); tests give their own so that nothing connects anywhere.
Pair PairFunc
RunDaemon RunDaemonFunc
Inventory func() daemon.Inventory
}
type RunDaemonFunc ¶ added in v0.12.0
type RunDaemonFunc func(ctx context.Context, o daemon.RunOptions) error
RunDaemonFunc keeps this host connected to Dymmer until ctx ends; tests replace it.