Documentation
¶
Overview ¶
Package command holds the root command and what every subcommand shares (Deps). Subcommands live in command/<resource> and import this package; main.go is the only place that attaches them to the root.
Index ¶
- func ApiTokenFromEnv(getenv func(string) string) string
- func EndpointsFromEnv(getenv func(string) string) session.Endpoints
- func ExitCodeOf(code int) int
- func NewIdempotencyKey() string
- func NewRoot(deps *Deps) *cobra.Command
- func NewVersion(deps *Deps) *cobra.Command
- func OpenBrowser(url string) error
- func RunSSH(ctx context.Context, args []string) error
- type Deps
- type ExitCode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApiTokenFromEnv ¶
ApiTokenFromEnv is OPENVICLOUD_TOKEN without the spaces or newline a copy and paste brings along.
func ExitCodeOf ¶
ExitCodeOf is the exit code to pass on for an ssh that ended with code: -1 (killed by a signal, no exit status) becomes 255, the code ssh uses for its own errors.
func NewIdempotencyKey ¶
func NewIdempotencyKey() string
NewIdempotencyKey is the key of one create: sent with every attempt of that create, never with another (titan-ops architecture/http-contract.md#idempotency-key).
func NewVersion ¶
NewVersion prints the build and the endpoints it targets: the two things support asks first.
func OpenBrowser ¶
OpenBrowser opens url in the default browser of the machine.
Types ¶
type Deps ¶
type Deps struct {
Endpoints session.Endpoints
Sessions *session.Manager
Printer *output.Printer
HTTP *http.Client
Version string
OpenBrowser func(url string) error
// For `vm ssh` and its tunnel: the tunnel reads ssh's bytes from Stdin; `vm ssh` starts the system ssh and
// names this binary as its ProxyCommand.
Stdin io.Reader
Executable func() (string, error)
RunSSH func(ctx context.Context, args []string) error
// For --wait and for retrying a create.
Clock wait.Clock
// From OPENVICLOUD_TOKEN: when set, every request carries it instead of the login session, for CI and scripts
// (titan-ops features/cli/design.md#api-token).
ApiToken string
}
func (*Deps) AccessToken ¶
AccessToken is the API token when one is set, else the logged-in customer's token for this endpoint, or the error that says how to log in.
func (*Deps) Client ¶
Client is an API client for a customer who is logged in to this endpoint and has accepted the current terms. Every command that needs a login starts here.
func (*Deps) Confirm ¶
Confirm asks the person at the terminal a yes/no question; only "y" or "yes" is yes. No answer (end of input) is no.
func (*Deps) TermsReminder ¶
TermsReminder tells a customer who just logged in that the terms still need accepting. It never fails the login.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package auth is `openvicloud auth login|logout|status`.
|
Package auth is `openvicloud auth login|logout|status`. |
|
Package catalog is what a customer chooses from when creating a VM: `cluster list`, `template list`, `size list`.
|
Package catalog is what a customer chooses from when creating a VM: `cluster list`, `template list`, `size list`. |
|
Package sshkey is `openvicloud ssh-key`: the public keys of the tenant, picked when a VM is created (titan-ops features/vm/design.md#ssh-key).
|
Package sshkey is `openvicloud ssh-key`: the public keys of the tenant, picked when a VM is created (titan-ops features/vm/design.md#ssh-key). |
|
Package tenant is `openvicloud tenant get`.
|
Package tenant is `openvicloud tenant get`. |
|
Package vm is `openvicloud vm`: the VM lifecycle (lifecycle.go), and `vm ssh` with the tunnel it runs as ssh's ProxyCommand.
|
Package vm is `openvicloud vm`: the VM lifecycle (lifecycle.go), and `vm ssh` with the tunnel it runs as ssh's ProxyCommand. |