features

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2025 License: AGPL-3.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigFileCommand

type ConfigFileCommand[T interface{}] struct {
	ConfigFilePath string
}

Gets a config file path from the command line and reads the config file into a struct of type T. The flag is required. The struct is then validated using the "jsonschema" and "validate" tags.

func NewConfigFileCommand added in v0.0.2

func NewConfigFileCommand[T interface{}]() *ConfigFileCommand[T]

func (*ConfigFileCommand[T]) ConfigureFlags

func (cfc *ConfigFileCommand[T]) ConfigureFlags(cmd *cobra.Command)

func (*ConfigFileCommand[T]) GenerateConfigSchema

func (cfc *ConfigFileCommand[T]) GenerateConfigSchema() ([]byte, error)

func (*ConfigFileCommand[T]) ReadConfigFile

func (cfc *ConfigFileCommand[T]) ReadConfigFile(ctx context.Context) (T, error)

Read a configuration file provided via CLI flag, validate it, and return the loaded configuration.

type ConfigFileCommandInterface added in v0.0.2

type ConfigFileCommandInterface[T interface{}] interface {
	ConfigureFlags(cmd *cobra.Command)
	ReadConfigFile(ctx context.Context) (T, error)
	GenerateConfigSchema() ([]byte, error)
}

type ContextCommand

type ContextCommand struct {
	Timeout time.Duration
	// If false, the command will not have a timeout, and will not have a timeout flag.
	EnableTimeout bool
	// contains filtered or unexported fields
}

Gives the command the ability to create a context for its execution.

func NewContextCommand added in v0.0.2

func NewContextCommand(enableTimeout bool) *ContextCommand

func (*ContextCommand) ConfigureFlags

func (ctc *ContextCommand) ConfigureFlags(cmd *cobra.Command)

func (*ContextCommand) GetCommandContext

func (ctc *ContextCommand) GetCommandContext() (*contexts.Context, context.CancelFunc)

Get a context suited for a command's primary function. This will include a timeout and a signal handler.

type ContextCommandInterface added in v0.0.2

type ContextCommandInterface interface {
	ConfigureFlags(cmd *cobra.Command)
	GetCommandContext() (*contexts.Context, context.CancelFunc)
}

type KubeClusterCommand

type KubeClusterCommand struct {
	KubernetesCommand
	// contains filtered or unexported fields
}

Gives a command the ability to interact with Kubernetes clusters (all supported APIs).

func NewKubeClusterCommand added in v0.0.2

func NewKubeClusterCommand() *KubeClusterCommand

func (*KubeClusterCommand) ConfigureFlags added in v0.0.9

func (kcc *KubeClusterCommand) ConfigureFlags(cmd *cobra.Command)

func (*KubeClusterCommand) NewKubeClusterClient added in v0.0.9

func (kcc *KubeClusterCommand) NewKubeClusterClient() (kubecluster.ClientInterface, error)

type KubeClusterCommandInterface added in v0.0.2

type KubeClusterCommandInterface interface {
	KubernetesCommandInterface
	NewKubeClusterClient() (kubecluster.ClientInterface, error)
}

type KubernetesCommand

type KubernetesCommand struct {
	ConfigOverrides    clientcmd.ConfigOverrides
	ExplicitConfigPath string
}

Gives a command the ability to interact with Kubernetes API.

func NewKubernetesCommand added in v0.0.2

func NewKubernetesCommand() *KubernetesCommand

func (*KubernetesCommand) ConfigureFlags

func (kc *KubernetesCommand) ConfigureFlags(cmd *cobra.Command)

func (*KubernetesCommand) GetClusterConfig

func (kc *KubernetesCommand) GetClusterConfig() (*rest.Config, error)

Get the cluster configurations from the following sources, in order of precedence: 1. A provided "kubeconfig" flag 2. The default kubeconfig file, at ~/.kube/config 3. The in-cluster kubeconfig, if running in a pod

type KubernetesCommandInterface added in v0.0.2

type KubernetesCommandInterface interface {
	ConfigureFlags(cmd *cobra.Command)
	GetClusterConfig() (*rest.Config, error)
}

type MockConfigFileCommandInterface added in v0.0.2

type MockConfigFileCommandInterface[T interface{}] struct {
	mock.Mock
}

MockConfigFileCommandInterface is an autogenerated mock type for the ConfigFileCommandInterface type

func NewMockConfigFileCommandInterface added in v0.0.2

func NewMockConfigFileCommandInterface[T interface{}](t interface {
	mock.TestingT
	Cleanup(func())
}) *MockConfigFileCommandInterface[T]

NewMockConfigFileCommandInterface creates a new instance of MockConfigFileCommandInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockConfigFileCommandInterface[T]) ConfigureFlags added in v0.0.2

func (_m *MockConfigFileCommandInterface[T]) ConfigureFlags(cmd *cobra.Command)

ConfigureFlags provides a mock function with given fields: cmd

func (*MockConfigFileCommandInterface[T]) EXPECT added in v0.0.2

func (*MockConfigFileCommandInterface[T]) GenerateConfigSchema added in v0.0.2

func (_m *MockConfigFileCommandInterface[T]) GenerateConfigSchema() ([]byte, error)

GenerateConfigSchema provides a mock function with no fields

func (*MockConfigFileCommandInterface[T]) ReadConfigFile added in v0.0.2

func (_m *MockConfigFileCommandInterface[T]) ReadConfigFile(ctx context.Context) (T, error)

ReadConfigFile provides a mock function with given fields: ctx

type MockConfigFileCommandInterface_ConfigureFlags_Call added in v0.0.2

type MockConfigFileCommandInterface_ConfigureFlags_Call[T interface{}] struct {
	*mock.Call
}

MockConfigFileCommandInterface_ConfigureFlags_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ConfigureFlags'

func (*MockConfigFileCommandInterface_ConfigureFlags_Call[T]) Return added in v0.0.2

func (*MockConfigFileCommandInterface_ConfigureFlags_Call[T]) Run added in v0.0.2

func (*MockConfigFileCommandInterface_ConfigureFlags_Call[T]) RunAndReturn added in v0.0.2

type MockConfigFileCommandInterface_Expecter added in v0.0.2

type MockConfigFileCommandInterface_Expecter[T interface{}] struct {
	// contains filtered or unexported fields
}

func (*MockConfigFileCommandInterface_Expecter[T]) ConfigureFlags added in v0.0.2

ConfigureFlags is a helper method to define mock.On call

  • cmd *cobra.Command

func (*MockConfigFileCommandInterface_Expecter[T]) GenerateConfigSchema added in v0.0.2

GenerateConfigSchema is a helper method to define mock.On call

func (*MockConfigFileCommandInterface_Expecter[T]) ReadConfigFile added in v0.0.2

ReadConfigFile is a helper method to define mock.On call

  • ctx context.Context

type MockConfigFileCommandInterface_GenerateConfigSchema_Call added in v0.0.2

type MockConfigFileCommandInterface_GenerateConfigSchema_Call[T interface{}] struct {
	*mock.Call
}

MockConfigFileCommandInterface_GenerateConfigSchema_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GenerateConfigSchema'

func (*MockConfigFileCommandInterface_GenerateConfigSchema_Call[T]) Return added in v0.0.2

func (*MockConfigFileCommandInterface_GenerateConfigSchema_Call[T]) Run added in v0.0.2

func (*MockConfigFileCommandInterface_GenerateConfigSchema_Call[T]) RunAndReturn added in v0.0.2

type MockConfigFileCommandInterface_ReadConfigFile_Call added in v0.0.2

type MockConfigFileCommandInterface_ReadConfigFile_Call[T interface{}] struct {
	*mock.Call
}

MockConfigFileCommandInterface_ReadConfigFile_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ReadConfigFile'

func (*MockConfigFileCommandInterface_ReadConfigFile_Call[T]) Return added in v0.0.2

func (*MockConfigFileCommandInterface_ReadConfigFile_Call[T]) Run added in v0.0.2

func (*MockConfigFileCommandInterface_ReadConfigFile_Call[T]) RunAndReturn added in v0.0.2

type MockContextCommandInterface added in v0.0.2

type MockContextCommandInterface struct {
	mock.Mock
}

MockContextCommandInterface is an autogenerated mock type for the ContextCommandInterface type

func NewMockContextCommandInterface added in v0.0.2

func NewMockContextCommandInterface(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockContextCommandInterface

NewMockContextCommandInterface creates a new instance of MockContextCommandInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockContextCommandInterface) ConfigureFlags added in v0.0.2

func (_m *MockContextCommandInterface) ConfigureFlags(cmd *cobra.Command)

ConfigureFlags provides a mock function with given fields: cmd

func (*MockContextCommandInterface) EXPECT added in v0.0.2

func (*MockContextCommandInterface) GetCommandContext added in v0.0.2

func (_m *MockContextCommandInterface) GetCommandContext() (*contexts.Context, context.CancelFunc)

GetCommandContext provides a mock function with no fields

type MockContextCommandInterface_ConfigureFlags_Call added in v0.0.2

type MockContextCommandInterface_ConfigureFlags_Call struct {
	*mock.Call
}

MockContextCommandInterface_ConfigureFlags_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ConfigureFlags'

func (*MockContextCommandInterface_ConfigureFlags_Call) Return added in v0.0.2

func (*MockContextCommandInterface_ConfigureFlags_Call) Run added in v0.0.2

func (*MockContextCommandInterface_ConfigureFlags_Call) RunAndReturn added in v0.0.2

type MockContextCommandInterface_Expecter added in v0.0.2

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

func (*MockContextCommandInterface_Expecter) ConfigureFlags added in v0.0.2

ConfigureFlags is a helper method to define mock.On call

  • cmd *cobra.Command

func (*MockContextCommandInterface_Expecter) GetCommandContext added in v0.0.2

GetCommandContext is a helper method to define mock.On call

type MockContextCommandInterface_GetCommandContext_Call added in v0.0.2

type MockContextCommandInterface_GetCommandContext_Call struct {
	*mock.Call
}

MockContextCommandInterface_GetCommandContext_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetCommandContext'

func (*MockContextCommandInterface_GetCommandContext_Call) Return added in v0.0.2

func (*MockContextCommandInterface_GetCommandContext_Call) Run added in v0.0.2

func (*MockContextCommandInterface_GetCommandContext_Call) RunAndReturn added in v0.0.2

type MockKubeClusterCommandInterface added in v0.0.2

type MockKubeClusterCommandInterface struct {
	mock.Mock
}

MockKubeClusterCommandInterface is an autogenerated mock type for the KubeClusterCommandInterface type

func NewMockKubeClusterCommandInterface added in v0.0.2

func NewMockKubeClusterCommandInterface(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockKubeClusterCommandInterface

NewMockKubeClusterCommandInterface creates a new instance of MockKubeClusterCommandInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockKubeClusterCommandInterface) ConfigureFlags added in v0.0.2

func (_m *MockKubeClusterCommandInterface) ConfigureFlags(cmd *cobra.Command)

ConfigureFlags provides a mock function with given fields: cmd

func (*MockKubeClusterCommandInterface) EXPECT added in v0.0.2

func (*MockKubeClusterCommandInterface) GetClusterConfig added in v0.0.2

func (_m *MockKubeClusterCommandInterface) GetClusterConfig() (*rest.Config, error)

GetClusterConfig provides a mock function with no fields

func (*MockKubeClusterCommandInterface) NewKubeClusterClient added in v0.0.2

func (_m *MockKubeClusterCommandInterface) NewKubeClusterClient() (kubecluster.ClientInterface, error)

NewKubeClusterClient provides a mock function with no fields

type MockKubeClusterCommandInterface_ConfigureFlags_Call added in v0.0.2

type MockKubeClusterCommandInterface_ConfigureFlags_Call struct {
	*mock.Call
}

MockKubeClusterCommandInterface_ConfigureFlags_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ConfigureFlags'

func (*MockKubeClusterCommandInterface_ConfigureFlags_Call) Return added in v0.0.2

func (*MockKubeClusterCommandInterface_ConfigureFlags_Call) Run added in v0.0.2

func (*MockKubeClusterCommandInterface_ConfigureFlags_Call) RunAndReturn added in v0.0.2

type MockKubeClusterCommandInterface_Expecter added in v0.0.2

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

func (*MockKubeClusterCommandInterface_Expecter) ConfigureFlags added in v0.0.2

ConfigureFlags is a helper method to define mock.On call

  • cmd *cobra.Command

func (*MockKubeClusterCommandInterface_Expecter) GetClusterConfig added in v0.0.2

GetClusterConfig is a helper method to define mock.On call

func (*MockKubeClusterCommandInterface_Expecter) NewKubeClusterClient added in v0.0.2

NewKubeClusterClient is a helper method to define mock.On call

type MockKubeClusterCommandInterface_GetClusterConfig_Call added in v0.0.2

type MockKubeClusterCommandInterface_GetClusterConfig_Call struct {
	*mock.Call
}

MockKubeClusterCommandInterface_GetClusterConfig_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetClusterConfig'

func (*MockKubeClusterCommandInterface_GetClusterConfig_Call) Return added in v0.0.2

func (*MockKubeClusterCommandInterface_GetClusterConfig_Call) Run added in v0.0.2

func (*MockKubeClusterCommandInterface_GetClusterConfig_Call) RunAndReturn added in v0.0.2

type MockKubeClusterCommandInterface_NewKubeClusterClient_Call added in v0.0.2

type MockKubeClusterCommandInterface_NewKubeClusterClient_Call struct {
	*mock.Call
}

MockKubeClusterCommandInterface_NewKubeClusterClient_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewKubeClusterClient'

func (*MockKubeClusterCommandInterface_NewKubeClusterClient_Call) Return added in v0.0.2

func (*MockKubeClusterCommandInterface_NewKubeClusterClient_Call) Run added in v0.0.2

func (*MockKubeClusterCommandInterface_NewKubeClusterClient_Call) RunAndReturn added in v0.0.2

type MockKubernetesCommandInterface added in v0.0.2

type MockKubernetesCommandInterface struct {
	mock.Mock
}

MockKubernetesCommandInterface is an autogenerated mock type for the KubernetesCommandInterface type

func NewMockKubernetesCommandInterface added in v0.0.2

func NewMockKubernetesCommandInterface(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockKubernetesCommandInterface

NewMockKubernetesCommandInterface creates a new instance of MockKubernetesCommandInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockKubernetesCommandInterface) ConfigureFlags added in v0.0.2

func (_m *MockKubernetesCommandInterface) ConfigureFlags(cmd *cobra.Command)

ConfigureFlags provides a mock function with given fields: cmd

func (*MockKubernetesCommandInterface) EXPECT added in v0.0.2

func (*MockKubernetesCommandInterface) GetClusterConfig added in v0.0.2

func (_m *MockKubernetesCommandInterface) GetClusterConfig() (*rest.Config, error)

GetClusterConfig provides a mock function with no fields

type MockKubernetesCommandInterface_ConfigureFlags_Call added in v0.0.2

type MockKubernetesCommandInterface_ConfigureFlags_Call struct {
	*mock.Call
}

MockKubernetesCommandInterface_ConfigureFlags_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ConfigureFlags'

func (*MockKubernetesCommandInterface_ConfigureFlags_Call) Return added in v0.0.2

func (*MockKubernetesCommandInterface_ConfigureFlags_Call) Run added in v0.0.2

func (*MockKubernetesCommandInterface_ConfigureFlags_Call) RunAndReturn added in v0.0.2

type MockKubernetesCommandInterface_Expecter added in v0.0.2

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

func (*MockKubernetesCommandInterface_Expecter) ConfigureFlags added in v0.0.2

ConfigureFlags is a helper method to define mock.On call

  • cmd *cobra.Command

func (*MockKubernetesCommandInterface_Expecter) GetClusterConfig added in v0.0.2

GetClusterConfig is a helper method to define mock.On call

type MockKubernetesCommandInterface_GetClusterConfig_Call added in v0.0.2

type MockKubernetesCommandInterface_GetClusterConfig_Call struct {
	*mock.Call
}

MockKubernetesCommandInterface_GetClusterConfig_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetClusterConfig'

func (*MockKubernetesCommandInterface_GetClusterConfig_Call) Return added in v0.0.2

func (*MockKubernetesCommandInterface_GetClusterConfig_Call) Run added in v0.0.2

func (*MockKubernetesCommandInterface_GetClusterConfig_Call) RunAndReturn added in v0.0.2

Jump to

Keyboard shortcuts

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