state

package
v1.21.1 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfigPath string
View Source
var ErrConfigPathUnknown = errors.New("config file path unknown")

Functions

func MarshalConfig

func MarshalConfig(c *Config) ([]byte, error)

func UnmarshalConfig

func UnmarshalConfig(config *Config, data []byte) error

Types

type Config

type Config struct {
	Endpoint      string
	ActiveContext *ConfigContext
	Contexts      []*ConfigContext
}

func (*Config) ContextByName

func (config *Config) ContextByName(name string) *ConfigContext

func (*Config) ContextNames

func (config *Config) ContextNames() []string

func (*Config) RemoveContext

func (config *Config) RemoveContext(context *ConfigContext)

type ConfigContext

type ConfigContext struct {
	Name  string
	Token string
}

type RawConfig

type RawConfig struct {
	ActiveContext string             `toml:"active_context,omitempty"`
	Contexts      []RawConfigContext `toml:"contexts"`
}

type RawConfigContext

type RawConfigContext struct {
	Name  string `toml:"name"`
	Token string `toml:"token"`
}

type State

type State struct {
	Token         string
	Endpoint      string
	Context       context.Context
	Config        *Config
	ConfigPath    string
	Debug         bool
	DebugFilePath string
	// contains filtered or unexported fields
}

func New

func New() *State

func (*State) ActionProgress

func (c *State) ActionProgress(ctx context.Context, action *hcloud.Action) error

func (*State) ActionsProgresses

func (c *State) ActionsProgresses(ctx context.Context, actions []*hcloud.Action) error

func (*State) CertificateLabelKeys

func (c *State) CertificateLabelKeys(idOrName string) []string

func (*State) CertificateNames

func (c *State) CertificateNames() []string

func (*State) Client

func (c *State) Client() *hcloud.Client

func (*State) DataCenterNames

func (c *State) DataCenterNames() []string

func (*State) EnsureToken

func (c *State) EnsureToken(cmd *cobra.Command, args []string) error

func (*State) FirewallLabelKeys

func (c *State) FirewallLabelKeys(idOrName string) []string

func (*State) FirewallNames

func (c *State) FirewallNames() []string

func (*State) FloatingIPLabelKeys

func (c *State) FloatingIPLabelKeys(idOrName string) []string

func (*State) FloatingIPNames

func (c *State) FloatingIPNames() []string

func (*State) ISONames

func (c *State) ISONames() []string

func (*State) ImageLabelKeys

func (c *State) ImageLabelKeys(idOrName string) []string

func (*State) ImageNames

func (c *State) ImageNames() []string

func (*State) LoadBalancerLabelKeys

func (c *State) LoadBalancerLabelKeys(idOrName string) []string

func (*State) LoadBalancerNames

func (c *State) LoadBalancerNames() []string

func (*State) LoadBalancerTypeNames

func (c *State) LoadBalancerTypeNames() []string

func (*State) LocationNames

func (c *State) LocationNames() []string

func (*State) NetworkLabelKeys

func (c *State) NetworkLabelKeys(idOrName string) []string

func (*State) NetworkName

func (c *State) NetworkName(id int) string

func (*State) NetworkNames

func (c *State) NetworkNames() []string

func (*State) ReadConfig

func (c *State) ReadConfig() error

func (*State) ReadEnv

func (c *State) ReadEnv()

func (*State) SSHKeyLabelKeys

func (c *State) SSHKeyLabelKeys(idOrName string) []string

func (*State) SSHKeyNames

func (c *State) SSHKeyNames() []string

func (*State) ServerLabelKeys

func (c *State) ServerLabelKeys(idOrName string) []string

func (*State) ServerName

func (c *State) ServerName(id int) string

func (*State) ServerNames

func (c *State) ServerNames() []string

func (*State) ServerTypeNames

func (c *State) ServerTypeNames() []string

func (*State) Terminal

func (c *State) Terminal() bool

Terminal returns whether the CLI is run in a terminal.

func (*State) VolumeLabelKeys

func (c *State) VolumeLabelKeys(idOrName string) []string

func (*State) VolumeNames

func (c *State) VolumeNames() []string

func (*State) WaitForActions

func (c *State) WaitForActions(ctx context.Context, actions []*hcloud.Action) error

func (*State) Wrap

func (c *State) Wrap(f func(*State, *cobra.Command, []string) error) func(*cobra.Command, []string) error

func (*State) WriteConfig

func (c *State) WriteConfig() error

Jump to

Keyboard shortcuts

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