Documentation
¶
Index ¶
- Constants
- func BindEnvToFlag(cmd *cobra.Command, flagName, envVar string)
- func BuildServices(ctx context.Context, servicesToBuild map[string]composetypes.ServiceConfig, ...) error
- func Confirm() (bool, error)
- func ConnectCluster(ctx context.Context, conn config.MachineConnection, opts ConnectOptions) (*client.Client, error)
- func ExpandCommaSeparatedValues(values []string) []string
- func GetServicesThatNeedBuild(project *composetypes.Project) map[string]composetypes.ServiceConfig
- func IsStdinTerminal() bool
- func IsStdoutTerminal() bool
- type AddMachineOptions
- type BuildOptions
- type CLI
- func (cli *CLI) AddMachine(ctx context.Context, opts AddMachineOptions) (*client.Client, *client.Client, error)
- func (cli *CLI) ConnectCluster(ctx context.Context, contextName string) (*client.Client, error)
- func (cli *CLI) ConnectClusterWithOptions(ctx context.Context, contextName string, opts ConnectOptions) (*client.Client, error)
- func (cli *CLI) CreateContext(name string) error
- func (cli *CLI) InitCluster(ctx context.Context, opts InitClusterOptions) (*client.Client, error)
- func (cli *CLI) ProgressOut() *streams.Out
- func (cli *CLI) SetCurrentContext(name string) error
- type ConnectOptions
- type InitClusterOptions
- type RemoteMachine
Constants ¶
const ( // DefaultSSHKeyPath is the fallback location for the SSH private key when provisioning remote machines. // Used when no key is explicitly provided and SSH agent authentication fails. DefaultSSHKeyPath = "~/.ssh/id_ed25519" DefaultContextName = "default" )
Variables ¶
This section is empty.
Functions ¶
func BindEnvToFlag ¶ added in v0.12.2
BindEnvToFlag assigns the value of an environment variable to the given command flag if the flag has not been set.
func BuildServices ¶ added in v0.8.0
func BuildServices(ctx context.Context, servicesToBuild map[string]composetypes.ServiceConfig, opts BuildOptions) error
BuildServices builds the services defined in the provided map.
func ConnectCluster ¶ added in v0.12.2
func ConnectCluster(ctx context.Context, conn config.MachineConnection, opts ConnectOptions) (*client.Client, error)
func ExpandCommaSeparatedValues ¶ added in v0.6.0
ExpandCommaSeparatedValues takes a slice of strings and expands any comma-separated values into individual elements.
func GetServicesThatNeedBuild ¶ added in v0.8.0
func GetServicesThatNeedBuild(project *composetypes.Project) map[string]composetypes.ServiceConfig
GetServicesThatNeedBuild returns a map of services that require building
func IsStdinTerminal ¶ added in v0.12.2
func IsStdinTerminal() bool
IsStdinTerminal checks if the standard input is a terminal (TTY).
func IsStdoutTerminal ¶ added in v0.12.2
func IsStdoutTerminal() bool
IsStdoutTerminal checks if the standard output is a terminal (TTY).
Types ¶
type AddMachineOptions ¶ added in v0.7.0
type BuildOptions ¶ added in v0.8.0
type CLI ¶
func New ¶
func New(configPath string, conn *config.MachineConnection) (*CLI, error)
New creates a new CLI instance with the given config path or remote machine connection. If the connection is provided, the config is ignored for all operations which is useful for interacting with a cluster without creating a config.
func (*CLI) AddMachine ¶
func (cli *CLI) AddMachine(ctx context.Context, opts AddMachineOptions) (*client.Client, *client.Client, error)
AddMachine provisions a remote machine and adds it to the cluster. It returns a cluster client and a machine client. The cluster client is connected to the existing machine in the cluster. It was used to add the new machine to the cluster. The machine client is connected to the new machine and can be used to interact with it. Both client should be closed after use by the caller.
func (*CLI) ConnectCluster ¶
ConnectCluster connects to a cluster using the given context name or the current context if not specified. If the CLI was initialised with a machine connection, the config is ignored and the connection is used instead.
func (*CLI) ConnectClusterWithOptions ¶ added in v0.12.2
func (cli *CLI) ConnectClusterWithOptions(ctx context.Context, contextName string, opts ConnectOptions) (*client.Client, error)
ConnectClusterWithOptions connects to a cluster using the given context name and options. If the CLI was initialised with a machine connection, the config is ignored and the connection is used instead. Options are useful when using the CLI as a library where you may want to disable visual feedback.
func (*CLI) CreateContext ¶ added in v0.6.0
func (*CLI) InitCluster ¶
InitCluster initialises a new cluster on a remote machine and returns a client to interact with the cluster. The client should be closed after use by the caller.
func (*CLI) ProgressOut ¶
ProgressOut returns an output stream for progress writer.
func (*CLI) SetCurrentContext ¶ added in v0.6.0
type ConnectOptions ¶ added in v0.12.2
type ConnectOptions struct {
// Whether to show connection progress spinner if stdout is a terminal or progress logs if not.
ShowProgress bool
}
ConnectOptions configures the behavior of cluster connection attempts.