Documentation
¶
Overview ¶
Package runner executes one catalog operation end to end: input checks, policy, credentials, the Restish engine, pagination, secrets and downloads. The CLI and the TUI both call it, so humans and agents get the same behaviour.
Index ¶
- func ValidateBody(op *catalog.Operation, raw []byte) error
- type Options
- type Runner
- func (r *Runner) Credential() (*auth.Credential, error)
- func (r *Runner) Identity(ctx context.Context) (*auth.Identity, error)
- func (r *Runner) Run(ctx context.Context, o Options) (*contract.Result, error)
- func (r *Runner) SignIn(ctx context.Context, rawServer, token string) (*auth.Profile, error)
- func (r *Runner) UseCredential(c *auth.Credential)
- func (r *Runner) Whoami(ctx context.Context, cred *auth.Credential) (*auth.Identity, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Options ¶
type Options struct {
Op *catalog.Operation
// Params holds parameter values by flag name; arrays repeat.
Params map[string][]string
// BodyFile is a JSON or binary body file; "-" reads Stdin.
BodyFile string
Stdin io.Reader
// Body is a JSON body given directly by cchp's own workflows.
Body []byte
// FormFiles maps multipart file fields to local paths.
FormFiles map[string]string
// SecretOut receives one-time secrets.
SecretOut string
// Output receives a binary download; "-" means Stdout.
Output string
Stdout io.Writer
// PageLimit is the number of pages to fetch (default 1).
PageLimit int
// MaxItems stops paging once this many items arrived.
MaxItems int
// MaxEvents stops a stream after this many events.
MaxEvents int
// Timeout bounds the whole run.
Timeout time.Duration
// Agent turns on the agent policy: read-only unless allowed.
Agent bool
AllowWrite bool
Confirm string
// HumanConfirmed records an interactive confirmation in human mode.
HumanConfirmed bool
DryRun bool
// OnEvent receives stream events as they arrive.
OnEvent func(*contract.Event) error
}
Options is one operation call.
type Runner ¶
type Runner struct {
Store *auth.Store
Catalog *catalog.Catalog
UserAgent string
// Debug, when set, receives a redacted trace of each request.
Debug io.Writer
// contains filtered or unexported fields
}
Runner holds what every call needs.
func (*Runner) Credential ¶
func (r *Runner) Credential() (*auth.Credential, error)
Credential resolves and remembers the credential for this process.
func (*Runner) SignIn ¶
SignIn checks the server address and token with whoami, then saves them as the current sign-in. Nothing is saved when the server rejects the token.
func (*Runner) UseCredential ¶
func (r *Runner) UseCredential(c *auth.Credential)
UseCredential sets the credential explicitly (login verifies a new token).