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 {
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)
}
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
}
Click to show internal directories.
Click to hide internal directories.