Skip to main content

Module dispatch

Module dispatch 

Source
Expand description

Clap-derive dispatcher for greentic-deployer op … (A3).

Owns the OpCommand clap tree + the dispatch_op entry point. The actual per-noun command logic lives in cli::env/cli::env_packs/etc; this module is the wiring layer that converts argv → typed payloads → library calls and prints the JSON envelope to stdout.

Structs§

BundleDeployArgs
Args for op deploy. All fields are optional at the clap layer so --answers / --schema keep working unchanged; the dispatcher builds a BundleDeployPayload only when args are supplied, and requires --bundle on that direct path.
EnvApplyArgs
Args for op env apply. The manifest itself arrives via the global --answers <PATH> flag (it IS the verb’s payload); these flags only shape how the plan is executed.
EnvApplyRevisionArgs
Args for op env apply-revision <env_id> <revision_id> [--kind <descriptor>]. Surgical single-revision counterpart of reconcile: brings ONE revision’s worker resources into agreement with its recorded lifecycle (present → apply, absent → tear down). Assumes the env-level set (namespace, router) already exists — reconcile establishes that.
EnvApplyTrafficArgs
Args for op env apply-traffic <env_id> <deployment_id> [--kind <descriptor>]. Pushes the deployment’s recorded traffic split to its live ALB listener (AWS-ECS only). Record the split first with op traffic set.
EnvCreateArgs
Args for op env create and op env update. All fields are optional at the clap layer so --answers / --schema keep working unchanged; the dispatcher builds an EnvCreatePayload only when the required inline flags are supplied, otherwise hands None to the library function (resolve_payload then defers to --answers).
EnvInitArgs
Args for op env init. Only --public-url is settable inline; init is otherwise an idempotent bootstrap of the canonical local env. If the env already exists, an inline --public-url is NOT applied — use op env set-public-url (or op config set --public-url) to mutate an existing env’s URL.
EnvReconcileArgs
Args for op env reconcile. Applies desired state to the live cluster — the apply-side counterpart of render (use render for a no-side-effect preview).
EnvRenderArgs
Args for op env render <env_id> [--kind <descriptor>] [--output <dir>]. Read-only: renders without applying. --answers/--schema payload machinery does not apply — the inputs are these three direct args.
EnvSetPublicUrlArgs
Args for op env set-public-url <env_id> <URL>. Both fields are required positional — this verb only sets the public URL, no other host_config fields. --answers is rejected: this is a dedicated single-purpose verb, not an op config set alias.
EnvUpdateArgs
Args for op env update. Update accepts the metadata fields only. URL changes go through op env set-public-url (single-field verb) or op config set --public-url (URL inside a multi-field host_config update); listen-addr changes through op config set --listen-addr.
MessagingEndpointAddArgs
Inline-flag form of messaging.endpoint add. When all required fields (--env, --provider-type, --provider-id, --display-name, --idempotency-key, --updated-by) are present, the payload is built directly from these flags. Otherwise dispatch falls through to --answers <PATH> / --schema, matching the trust-root add precedent.
MessagingEndpointLinkBundleArgs
Inline-flag form of messaging.endpoint link-bundle and unlink-bundle. When all four required fields are present the payload is built directly; otherwise dispatch falls through to --answers / --schema.
MessagingEndpointRemoveArgs
Inline-flag form of messaging.endpoint remove and rotate-webhook-secret. When all four required fields are present the payload is built directly; otherwise dispatch falls through to --answers / --schema.
MessagingEndpointSetWelcomeFlowArgs
Inline-flag form of messaging.endpoint set-welcome-flow. When all six required fields are present the payload is built directly; otherwise dispatch falls through to --answers / --schema.
OpCommand
greentic-deployer op …. Mirrors the gtc op … surface; the gtc-side passthrough shells out to greentic-operator op …, which dispatches through the same OpCommand clap tree.
PayloadArg
RevisionStageArgs
Args for op revisions stage. All fields are optional at the clap layer so --answers / --payload-json / --schema keep working unchanged; the dispatcher builds a RevisionStagePayload only when the positional args are supplied, otherwise hands None to the library function.
TrafficSetArgs
Args for op traffic set. All fields are optional at the clap layer so that --answers / --payload-json / --schema continue to work unchanged; the dispatcher builds a TrafficSetPayload only when the required clap args are supplied, and otherwise hands None to the library function so it can resolve the payload from --answers.
TrafficTargetArgs
TrustRootAddArgs
TrustRootRemoveArgs
UpdatesApplyArgs
UpdatesConfigSetArgs
UpdatesEnrollArgs
UpdatesGetArgs
UpdatesPlanBuildArgs
UpdatesRecoverArgs

Enums§

BundlesVerb
ConfigVerb
CredentialsVerb
EnvPacksVerb
EnvVerb
ExtensionsVerb
MessagingEndpointVerb
MessagingNoun
OpNoun
RevisionsVerb
SecretsVerb
TrafficVerb
TrustRootVerb
UpdatesVerb

Functions§

build_store
Build a LocalFsStore honoring --store-root, falling back to the per-user default.
dispatch_op
Top-level dispatcher. The verb modules each load their own payload via --answers or --payload-json; this function only routes argv into the right library call.
dispatch_op_with_registry
Phase D plug-in entry point — register handlers on the registry, then call this. The credentials noun (and any future noun that resolves handlers through the registry) will see every handler the caller registered.
noun_verb_labels
Map an OpNoun to its (noun, verb) static label pair for envelope rendering. Kept in lockstep with the verb enums above; adding a new noun/verb requires extending the match here too.
print_error
Print a typed error in the JSON envelope and return the same error so the caller can map it to the process exit code.
print_outcome
Print an OpOutcome to stdout as compact JSON and return Ok(()).