cli

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2019 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultShell = "bash"

DefaultShell is the default shell used to print the export and unset commands

View Source
const EnvConfigPrefix = "KUBEKIT_VAR_"

EnvConfigPrefix is the prefix for the variables to pass to KubeKit through environment variables

Variables

This section is empty.

Functions

func AddCertFlags

func AddCertFlags(cmd *cobra.Command)

AddCertFlags adds the flags to the given command to receive certificate files: private key and certificate.

func GetCertFlags

func GetCertFlags(cmd *cobra.Command) (tls.KeyPairs, error)

GetCertFlags creates the list of CA certificates with the original file name and CN. The original filename will be replaced when the certificate is saved in the certificates directory.

func GetCredentials

func GetCredentials(platform string, cmd *cobra.Command) map[string]string

GetCredentials get the credentials from cobra CLI flags and insert them into the list of variables. Returns, as a warning, the list of variables ignored or replaced

func GetFilters

func GetFilters(cmd *cobra.Command) (filter map[string]string, warns []string, err error)

GetFilters returns the cluster filters to from commands such as `get clusters`. It returns warning or errors if the filters are not use correctly

func GetGenericCredentials

func GetGenericCredentials(cmd *cobra.Command) map[string]string

GetGenericCredentials get the credentials from cobra CLI flags for any given platform and insert them into the list of variables. Returns, as a warning, the list of variables ignored or replaced

func GetMultipleClustersName

func GetMultipleClustersName(cmd *cobra.Command, args []string) ([]string, error)

GetMultipleClustersName retrive from the CLI (cobra) arguments one or more clusters name

func GetOneClusterName

func GetOneClusterName(cmd *cobra.Command, args []string, validate bool) (clusterName string, err error)

GetOneClusterName retrive from the CLI (cobra) arguments one cluster name which could be valid or not

func GetVariables

func GetVariables(varsStr string) (variables map[string]string, warns []string, err error)

GetVariables return a map for variable name and its value from the CLI parmeters and environment variables

func HardConfirmation

func HardConfirmation(question, answer string) bool

HardConfirmation ask to the user a question, the answer has to be typed, it's not defaulted. If the received answer is same as the expected one, the confirmation succeed

func StringToArray

func StringToArray(val string) ([]string, error)

StringToArray convert the cobra flag of type StringArray to an array of strings

func StringToMap

func StringToMap(str string) (map[string]string, []string, error)

StringToMap convert the cobra flag of type StringArray in the form of 'key=value' to an map of strings of strings

Types

type ApplyOpts

type ApplyOpts struct {
	ClusterName  string
	Action       string
	PackageURL   string
	ForcePackage bool
	UserCACerts  tls.KeyPairs
}

ApplyOpts encapsulate all the CLI parameters received from the `apply` command

func ApplyGetOpts

func ApplyGetOpts(cmd *cobra.Command, args []string) (opts *ApplyOpts, warns []string, err error)

ApplyGetOpts get the `apply` command parameters from the cobra commands and arguments

type ClusterNodeInfo

type ClusterNodeInfo map[string]configurator.Hosts

ClusterNodeInfo is an list of hosts with their important information

func (ClusterNodeInfo) IPs

func (cni ClusterNodeInfo) IPs() string

IPs returns only the IP address of the nodes

func (ClusterNodeInfo) JSON

func (cni ClusterNodeInfo) JSON(pp bool) (string, error)

JSON returns the nodes information in JSON format

func (ClusterNodeInfo) Sprintf

func (cni ClusterNodeInfo) Sprintf(format string, pp bool) (string, error)

Sprintf returns a string to print in the given format. Pretty Print (`pp`) applies only for JSON

func (ClusterNodeInfo) TOML

func (cni ClusterNodeInfo) TOML() (string, error)

TOML returns the nodes information in TOML format

func (ClusterNodeInfo) Table

func (cni ClusterNodeInfo) Table(wide bool) error

Table returns the nodes information as a table

func (ClusterNodeInfo) YAML

func (cni ClusterNodeInfo) YAML() (string, error)

YAML returns the nodes information in YAML format

type DeleteOpts

type DeleteOpts struct {
	ClusterName string
	DestroyAll  bool
	Force       bool
}

DeleteOpts encapsulate all the CLI parameters received from the `delete` command

func DeleteGetOpts

func DeleteGetOpts(cmd *cobra.Command, args []string) (opts *DeleteOpts, warns []string, err error)

DeleteGetOpts get the `delete` command parameters from the cobra commands and arguments

func (*DeleteOpts) Confirm

func (opts *DeleteOpts) Confirm() bool

Confirm ask to the user to confirm to delete the cluster

type GetEnvOpts

type GetEnvOpts struct {
	ClusterName    string
	Shell          string
	Unset          bool
	KubeconfigFile string
}

GetEnvOpts encapsulate all the CLI parameters received from the `get env` command

func GetEnvGetOpts

func GetEnvGetOpts(cmd *cobra.Command, args []string) (opts *GetEnvOpts, warns []string, err error)

GetEnvGetOpts get the `get env` command parameters from the cobra commands and arguments

func (*GetEnvOpts) SprintEnv

func (o *GetEnvOpts) SprintEnv(env map[string]string) string

SprintEnv returns the string to print to export the cluster environment variable. This is to be executed with `eval`

type GetNodesOpts

type GetNodesOpts struct {
	ClustersName []string
	Output       string
	Pp           bool
	Nodes        []string
	Pools        []string
}

GetNodesOpts encapsulate all the CLI parameters received from the `get nodes` command

func GetNodesGetOpts

func GetNodesGetOpts(cmd *cobra.Command, args []string) (opts *GetNodesOpts, warns []string, err error)

GetNodesGetOpts get the `get env` command parameters from the cobra commands and arguments

type InitOpts

type InitOpts struct {
	ClusterName  string
	Platform     string
	Path         string
	Format       string
	Variables    map[string]string
	Credentials  map[string]string
	TemplateName string // --template flags is not functional yet
	Update       bool   // Deprecate --update flag when `update` command exists
}

InitOpts encapsulate all the CLI parameters received from the `init` command

func InitGetOpts

func InitGetOpts(cmd *cobra.Command, args []string) (opts *InitOpts, warns []string, err error)

InitGetOpts get the `init` command parameters from the cobra commands and arguments

type UpdateOpts

type UpdateOpts struct {
	ClusterName  string
	Variables    map[string]string
	Credentials  map[string]string
	TemplateName string // --template flags is not functional yet
}

UpdateOpts encapsulate all the CLI parameters received from the `update` command

func UpdateGetOpts

func UpdateGetOpts(cmd *cobra.Command, args []string) (opts *UpdateOpts, warns []string, err error)

UpdateGetOpts get the `update` command parameters from the cobra commands and arguments

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL