cmd

package
v0.0.0-...-a9402ed Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2020 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DebugMode bool
View Source
var DefaultConfigPath string

DefaultConfigPath is the path where the default config is located

Functions

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func FatalOnError

func FatalOnError(err error)

FatalOnError is an helper function to transform error to fatl

func RunClusterCreate

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

RunClusterCreate executes the cluster creation

Types

type AppConfig

type AppConfig struct {
	Client         *hcloud.Client
	Context        context.Context
	CurrentContext *HetznerContext
	Config         *HetznerConfig
	SSHClient      clustermanager.NodeCommunicator
}

AppConfig define the application configuration

var AppConf AppConfig

AppConf is the default configuration from the local system. var AppConf = NewAppConfig()

func NewAppConfig

func NewAppConfig(debug bool) AppConfig

NewAppConfig creates a new AppConfig struct using the locally saved configuration file. If no local configuration file is found a new config will be created.

func (*AppConfig) DeleteContextByName

func (app *AppConfig) DeleteContextByName(name string) error

DeleteContextByName deletes a context by name from the current config

func (*AppConfig) FindContextByName

func (app *AppConfig) FindContextByName(name string) (*HetznerContext, error)

FindContextByName find a context using name

func (*AppConfig) SwitchContextByName

func (app *AppConfig) SwitchContextByName(name string) error

SwitchContextByName switch to context with a specific name in app

type AppSSHClient

type AppSSHClient struct {
}

AppSSHClient is the SSH client

type HetznerConfig

type HetznerConfig struct {
	ActiveContextName string                   `json:"active_context_name"`
	Contexts          []HetznerContext         `json:"contexts"`
	SSHKeys           []clustermanager.SSHKey  `json:"ssh_keys"`
	Clusters          []clustermanager.Cluster `json:"clusters"`
}

HetznerConfig define the hetzner cloud provider config

func (*HetznerConfig) AddCluster

func (config *HetznerConfig) AddCluster(cluster clustermanager.Cluster)

AddCluster add a cluster in config

func (*HetznerConfig) AddContext

func (config *HetznerConfig) AddContext(context HetznerContext)

AddContext add context to config

func (*HetznerConfig) AddSSHKey

func (config *HetznerConfig) AddSSHKey(key clustermanager.SSHKey)

AddSSHKey add a new SSH key to config

func (*HetznerConfig) DeleteCluster

func (config *HetznerConfig) DeleteCluster(name string) error

DeleteCluster remove cluster from config

func (*HetznerConfig) DeleteSSHKey

func (config *HetznerConfig) DeleteSSHKey(name string) error

DeleteSSHKey remove the SSH key from config

func (*HetznerConfig) FindClusterByName

func (config *HetznerConfig) FindClusterByName(name string) (int, *clustermanager.Cluster)

FindClusterByName find a cluster by name in config

func (*HetznerConfig) FindSSHKeyByName

func (config *HetznerConfig) FindSSHKeyByName(name string) (int, error)

FindSSHKeyByName find a SSH key in config by name

func (HetznerConfig) WriteCurrentConfig

func (config HetznerConfig) WriteCurrentConfig()

WriteCurrentConfig write the configuration to file

type HetznerContext

type HetznerContext struct {
	Token string `json:"token"`
	Name  string `json:"name"`
}

HetznerContext declare the hetzner cloud context

type SSHKey

type SSHKey struct {
	Name           string `json:"name"`
	PrivateKeyPath string `json:"private_key_path"`
	PublicKeyPath  string `json:"public_key_path"`
}

SSHKey (deprecated)

Jump to

Keyboard shortcuts

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