features

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2025 License: AGPL-3.0 Imports: 28 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 (*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 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 NewContentCommand

func NewContentCommand(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 KubeClusterCommand

type KubeClusterCommand struct {
	KubernetesCommand
}

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

type KubernetesCommand

type KubernetesCommand struct {
	ConfigOverrides    clientcmd.ConfigOverrides
	ExplicitConfigPath string
}

Gives a command the ability to interact with Kubernetes API.

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

func (*KubernetesCommand) NewKubeClusterClient

func (kc *KubernetesCommand) NewKubeClusterClient() (kubecluster.ClientInterface, error)

Jump to

Keyboard shortcuts

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