state

package
v1.33.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package state is a generated GoMock package.

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

func WrapCtx added in v1.23.0

func WrapCtx(
	ctx context.Context,
	fn func(context.Context, *cobra.Command, []string) error,
) func(*cobra.Command, []string) error

Types

type ActionWaiter added in v1.23.0

type ActionWaiter interface {
	ActionProgress(context.Context, *hcloud.Action) error
	WaitForActions(context.Context, []*hcloud.Action) error
}

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 MockActionWaiter added in v1.23.0

type MockActionWaiter struct {
	// contains filtered or unexported fields
}

MockActionWaiter is a mock of ActionWaiter interface.

func NewMockActionWaiter added in v1.23.0

func NewMockActionWaiter(ctrl *gomock.Controller) *MockActionWaiter

NewMockActionWaiter creates a new mock instance.

func (*MockActionWaiter) ActionProgress added in v1.23.0

func (m *MockActionWaiter) ActionProgress(arg0 context.Context, arg1 *hcloud.Action) error

ActionProgress mocks base method.

func (*MockActionWaiter) EXPECT added in v1.23.0

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockActionWaiter) WaitForActions added in v1.23.0

func (m *MockActionWaiter) WaitForActions(arg0 context.Context, arg1 []*hcloud.Action) error

WaitForActions mocks base method.

type MockActionWaiterMockRecorder added in v1.23.0

type MockActionWaiterMockRecorder struct {
	// contains filtered or unexported fields
}

MockActionWaiterMockRecorder is the mock recorder for MockActionWaiter.

func (*MockActionWaiterMockRecorder) ActionProgress added in v1.23.0

func (mr *MockActionWaiterMockRecorder) ActionProgress(arg0, arg1 interface{}) *gomock.Call

ActionProgress indicates an expected call of ActionProgress.

func (*MockActionWaiterMockRecorder) WaitForActions added in v1.23.0

func (mr *MockActionWaiterMockRecorder) WaitForActions(arg0, arg1 interface{}) *gomock.Call

WaitForActions indicates an expected call of WaitForActions.

type MockTokenEnsurer added in v1.23.0

type MockTokenEnsurer struct {
	// contains filtered or unexported fields
}

MockTokenEnsurer is a mock of TokenEnsurer interface.

func NewMockTokenEnsurer added in v1.23.0

func NewMockTokenEnsurer(ctrl *gomock.Controller) *MockTokenEnsurer

NewMockTokenEnsurer creates a new mock instance.

func (*MockTokenEnsurer) EXPECT added in v1.23.0

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockTokenEnsurer) EnsureToken added in v1.23.0

func (m *MockTokenEnsurer) EnsureToken(arg0 *cobra.Command, arg1 []string) error

EnsureToken mocks base method.

type MockTokenEnsurerMockRecorder added in v1.23.0

type MockTokenEnsurerMockRecorder struct {
	// contains filtered or unexported fields
}

MockTokenEnsurerMockRecorder is the mock recorder for MockTokenEnsurer.

func (*MockTokenEnsurerMockRecorder) EnsureToken added in v1.23.0

func (mr *MockTokenEnsurerMockRecorder) EnsureToken(arg0, arg1 interface{}) *gomock.Call

EnsureToken indicates an expected call of EnsureToken.

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) Client

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

func (*State) EnsureToken

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

func (*State) ReadConfig

func (c *State) ReadConfig() error

func (*State) ReadEnv

func (c *State) ReadEnv()

func (*State) Terminal

func (c *State) Terminal() bool

Terminal returns whether the CLI is run in a terminal.

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

type TokenEnsurer added in v1.23.0

type TokenEnsurer interface {
	EnsureToken(cmd *cobra.Command, args []string) error
}

Jump to

Keyboard shortcuts

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