Documentation
¶
Overview ¶
Package nemo is nemo's API. The nemo CLI and the Terraform provider are its clients: they turn their inputs into requests, and render the results. Nothing here prints.
Index ¶
- Constants
- type ActionRequest
- type BundleVersion
- type DownRequest
- type InstallationState
- type LogsRequest
- type Nemo
- func (nemo *Nemo) Down(ctx context.Context, request DownRequest) (StackResult, error)
- func (nemo *Nemo) Install(ctx context.Context, request ActionRequest) (Run, error)
- func (nemo *Nemo) Installation(ctx context.Context, stack, name string) (storage.Installation, error)
- func (nemo *Nemo) Installations(ctx context.Context, stack string) ([]storage.Installation, error)
- func (nemo *Nemo) Logs(ctx context.Context, request LogsRequest) error
- func (nemo *Nemo) Runs(ctx context.Context, stack, name string) ([]Run, error)
- func (nemo *Nemo) Status(ctx context.Context, stack string) (StackStatus, error)
- func (nemo *Nemo) Uninstall(ctx context.Context, request ActionRequest) (Run, error)
- func (nemo *Nemo) Up(ctx context.Context, request UpRequest) (StackResult, error)
- func (nemo *Nemo) Upgrade(ctx context.Context, request ActionRequest) (Run, error)
- type Options
- type Run
- type ServiceState
- type StackResult
- type StackStatus
- type UpRequest
Constants ¶
const Redacted = "*******"
Redacted replaces the value of a sensitive parameter or output.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionRequest ¶
type ActionRequest struct {
// InstallationSpec names the installation and its stack; its name can
// be left out when BundleSource is given. Its parameters and
// credentials override the installation's, and its bundle reference is
// recorded with it.
storage.InstallationSpec
// BundleSource is the bundle to run: a bundle.json, or where it was
// pushed, docker://REFERENCE or oci:PATH. Install needs it; upgrade and
// uninstall take the installation's when it is left out.
BundleSource string
// Target receives the deployment. Left empty, it is the installation's;
// it can't change once installed.
Target target.Target
// Installer says where the invocation image runs. Left empty, it is the
// installation's.
Installer target.Installer
// Progress receives the events of the action.
Progress progress.Sink
}
ActionRequest is an action on one installation of a bundle. What it leaves out comes from the installation, when nemo knows it.
type BundleVersion ¶
BundleVersion identifies a bundle, by its name and version.
type DownRequest ¶
type DownRequest struct {
Name string
// Purge also removes the volumes.
Purge bool
Progress progress.Sink
}
DownRequest removes a stack, by its name.
type InstallationState ¶
type InstallationState struct {
Name string `json:"name"`
Version string `json:"version"`
Installed bool `json:"installed"`
Action string `json:"action"`
Result string `json:"result"`
Modified time.Time `json:"modified"`
Services []ServiceState `json:"services,omitempty"`
}
InstallationState is where an installation stands: its last action, and its services.
type LogsRequest ¶
type LogsRequest struct {
Stack string
// Installation and Service narrow the services; empty, every one.
Installation string
Service string
Follow bool
// Tail is how many lines of each service to start with: a number, or all.
Tail string
// Line receives each line with its service, from as many goroutines as
// there are services.
Line func(service, line string)
}
LogsRequest follows the logs of the services of a stack.
type Nemo ¶
type Nemo struct {
// contains filtered or unexported fields
}
Nemo is the entry point of the API.
func (*Nemo) Down ¶
func (nemo *Nemo) Down(ctx context.Context, request DownRequest) (StackResult, error)
Down uninstalls every installation of the stack, dependants first. It needs nothing but the stack's name: the rest comes from the installations.
func (*Nemo) Install ¶
Install installs the bundle. Installing again an installed bundle applies it again, as an upgrade does.
func (*Nemo) Installation ¶
func (nemo *Nemo) Installation(ctx context.Context, stack, name string) (storage.Installation, error)
Installation returns an installation, as nemo keeps it.
func (*Nemo) Installations ¶
Installations returns the installations of the stack, as nemo keeps them.
func (*Nemo) Logs ¶
func (nemo *Nemo) Logs(ctx context.Context, request LogsRequest) error
Logs writes the logs of the services until they end, or until the context is done when following them.
func (*Nemo) Runs ¶
Runs returns the actions of an installation, oldest first, each as up and the actions return it: its claim, with its result and outputs.
func (*Nemo) Status ¶
Status reads the installations of the stack, then the services they run on their target.
type Options ¶
type Options struct {
// Home is where nemo keeps its files. Empty, it is $NEMO_HOME, or ~/.nemo.
Home string
}
Options configure nemo.
type Run ¶
type Run struct {
Installation string `json:"installation"`
Revision string `json:"revision"`
Action string `json:"action"`
Bundle BundleVersion `json:"bundle"`
Target target.Target `json:"target"`
Driver string `json:"driver"`
Parameters map[string]any `json:"parameters,omitempty"`
Credentials []string `json:"credentials,omitempty"`
Status string `json:"status"`
Started time.Time `json:"started"`
Ended time.Time `json:"ended"`
Outputs map[string]string `json:"outputs,omitempty"`
}
Run is the record of an action: what was asked, and what came of it. Values of sensitive parameters and outputs are redacted, and credentials appear by name only.
type ServiceState ¶
type ServiceState struct {
Name string `json:"name"`
Running int `json:"running"`
Desired int `json:"desired"`
State string `json:"state"`
}
ServiceState is a service as the target runs it: its tasks or containers running out of those wanted, and the state of the least advanced.
type StackResult ¶
type StackResult struct {
Runs []Run `json:"runs"`
}
StackResult is the runs of an up or a down, in the order they ran.
type StackStatus ¶
type StackStatus struct {
Name string `json:"name"`
Target target.Target `json:"target"`
Installations []InstallationState `json:"installations"`
}
StackStatus is where a stack stands: each installation as nemo keeps it, and its services as the target runs them.
type UpRequest ¶
type UpRequest struct {
Stack stack.Stack
// Only names the installations to act on, with their dependencies not
// installed yet; empty, all of the stack's.
// Up then leaves alone the others, and what the stack no longer has.
Only []string
// Purge also removes the volumes of the bundles the stack no longer has.
Purge bool
// Progress receives the events of the actions: first each installation
// pending, then what each action does.
Progress progress.Sink
}
UpRequest brings a stack to its file.