config

package
v0.24.0-beta.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2022 License: Apache-2.0 Imports: 27 Imported by: 19

Documentation

Overview

Example (View)
expectedConfig := newRedFederalCowHammerConfig()
test := configCommandTest{
	args:           []string{"view"},
	startingConfig: newRedFederalCowHammerConfig(),
	expectedConfig: expectedConfig,
}

output := test.run(nil)
fmt.Printf("%v", output)
Output:

apiVersion: v1
clusters:
- cluster:
    server: http://cow.org:8080
  name: cow-cluster
contexts:
- context:
    cluster: cow-cluster
    user: red-user
  name: federal-context
current-context: federal-context
kind: Config
preferences: {}
users:
- name: red-user
  user:
    token: REDACTED

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCmdConfig

func NewCmdConfig(pathOptions *clientcmd.PathOptions, streams genericclioptions.IOStreams) *cobra.Command

NewCmdConfig creates a command object for the "config" action, and adds all child commands to it.

func NewCmdConfigCurrentContext

func NewCmdConfigCurrentContext(out io.Writer, configAccess clientcmd.ConfigAccess) *cobra.Command

NewCmdConfigCurrentContext returns a Command instance for 'config current-context' sub command

func NewCmdConfigDeleteCluster

func NewCmdConfigDeleteCluster(out io.Writer, configAccess clientcmd.ConfigAccess) *cobra.Command

NewCmdConfigDeleteCluster returns a Command instance for 'config delete-cluster' sub command

func NewCmdConfigDeleteContext

func NewCmdConfigDeleteContext(out, errOut io.Writer, configAccess clientcmd.ConfigAccess) *cobra.Command

NewCmdConfigDeleteContext returns a Command instance for 'config delete-context' sub command

func NewCmdConfigDeleteUser added in v0.20.0

func NewCmdConfigDeleteUser(streams genericclioptions.IOStreams, configAccess clientcmd.ConfigAccess) *cobra.Command

NewCmdConfigDeleteUser returns a Command instance for 'config delete-user' sub command

func NewCmdConfigGetClusters

func NewCmdConfigGetClusters(out io.Writer, configAccess clientcmd.ConfigAccess) *cobra.Command

NewCmdConfigGetClusters creates a command object for the "get-clusters" action, which lists all clusters defined in the kubeconfig.

func NewCmdConfigGetContexts

func NewCmdConfigGetContexts(streams genericclioptions.IOStreams, configAccess clientcmd.ConfigAccess) *cobra.Command

NewCmdConfigGetContexts creates a command object for the "get-contexts" action, which retrieves one or more contexts from a kubeconfig.

func NewCmdConfigGetUsers added in v0.20.0

func NewCmdConfigGetUsers(streams genericclioptions.IOStreams, configAccess clientcmd.ConfigAccess) *cobra.Command

NewCmdConfigGetUsers creates a command object for the "get-users" action, which lists all users defined in the kubeconfig.

func NewCmdConfigRenameContext

func NewCmdConfigRenameContext(out io.Writer, configAccess clientcmd.ConfigAccess) *cobra.Command

NewCmdConfigRenameContext creates a command object for the "rename-context" action

func NewCmdConfigSet

func NewCmdConfigSet(out io.Writer, configAccess clientcmd.ConfigAccess) *cobra.Command

NewCmdConfigSet returns a Command instance for 'config set' sub command

func NewCmdConfigSetAuthInfo

func NewCmdConfigSetAuthInfo(out io.Writer, configAccess clientcmd.ConfigAccess) *cobra.Command

NewCmdConfigSetAuthInfo returns a Command instance for 'config set-credentials' sub command DEPRECATED: Use NewCmdConfigSetCredentials instead

func NewCmdConfigSetCluster

func NewCmdConfigSetCluster(out io.Writer, configAccess clientcmd.ConfigAccess) *cobra.Command

NewCmdConfigSetCluster returns a Command instance for 'config set-cluster' sub command

func NewCmdConfigSetContext

func NewCmdConfigSetContext(out io.Writer, configAccess clientcmd.ConfigAccess) *cobra.Command

NewCmdConfigSetContext returns a Command instance for 'config set-context' sub command

func NewCmdConfigSetCredentials added in v0.24.0

func NewCmdConfigSetCredentials(out io.Writer, configAccess clientcmd.ConfigAccess) *cobra.Command

NewCmdConfigSetCredentials returns a Command instance for 'config set-credentials' sub command

func NewCmdConfigUnset

func NewCmdConfigUnset(out io.Writer, configAccess clientcmd.ConfigAccess) *cobra.Command

NewCmdConfigUnset returns a Command instance for 'config unset' sub command

func NewCmdConfigUseContext

func NewCmdConfigUseContext(out io.Writer, configAccess clientcmd.ConfigAccess) *cobra.Command

NewCmdConfigUseContext returns a Command instance for 'config use-context' sub command

func NewCmdConfigView

func NewCmdConfigView(streams genericclioptions.IOStreams, ConfigAccess clientcmd.ConfigAccess) *cobra.Command

NewCmdConfigView returns a Command instance for 'config view' sub command

func RunCurrentContext

func RunCurrentContext(out io.Writer, options *CurrentContextOptions) error

RunCurrentContext performs the execution of 'config current-context' sub command

Types

type CurrentContextOptions

type CurrentContextOptions struct {
	ConfigAccess clientcmd.ConfigAccess
}

CurrentContextOptions holds the command-line options for 'config current-context' sub command

type DeleteUserOptions added in v0.20.0

type DeleteUserOptions struct {
	genericclioptions.IOStreams
	// contains filtered or unexported fields
}

DeleteUserOptions holds the data needed to run the command

func NewDeleteUserOptions added in v0.20.0

func NewDeleteUserOptions(ioStreams genericclioptions.IOStreams, configAccess clientcmd.ConfigAccess) *DeleteUserOptions

NewDeleteUserOptions creates the options for the command

func (*DeleteUserOptions) Complete added in v0.20.0

func (o *DeleteUserOptions) Complete(cmd *cobra.Command, args []string) error

Complete sets up the command to run

func (*DeleteUserOptions) Run added in v0.20.0

func (o *DeleteUserOptions) Run() error

Run performs the command

func (*DeleteUserOptions) Validate added in v0.20.0

func (o *DeleteUserOptions) Validate() error

Validate ensures the command has enough info to run

type GetContextsOptions

type GetContextsOptions struct {
	genericclioptions.IOStreams
	// contains filtered or unexported fields
}

GetContextsOptions contains the assignable options from the args.

func (*GetContextsOptions) Complete

func (o *GetContextsOptions) Complete(cmd *cobra.Command, args []string) error

Complete assigns GetContextsOptions from the args.

func (GetContextsOptions) RunGetContexts

func (o GetContextsOptions) RunGetContexts() error

RunGetContexts implements all the necessary functionality for context retrieval.

func (*GetContextsOptions) Validate added in v0.20.0

func (o *GetContextsOptions) Validate(cmd *cobra.Command) error

Validate ensures the of output format

type GetUsersOptions added in v0.20.0

type GetUsersOptions struct {
	genericclioptions.IOStreams
	// contains filtered or unexported fields
}

GetUsersOptions holds the data needed to run the command

func NewGetUsersOptions added in v0.20.0

func NewGetUsersOptions(ioStreams genericclioptions.IOStreams, configAccess clientcmd.ConfigAccess) *GetUsersOptions

NewGetUsersOptions creates the options for the command

func (*GetUsersOptions) Run added in v0.20.0

func (o *GetUsersOptions) Run() error

Run performs the command

type RenameContextOptions

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

RenameContextOptions contains the options for running the rename-context cli command.

func (*RenameContextOptions) Complete

func (o *RenameContextOptions) Complete(cmd *cobra.Command, args []string, out io.Writer) error

Complete assigns RenameContextOptions from the args.

func (RenameContextOptions) RunRenameContext

func (o RenameContextOptions) RunRenameContext(out io.Writer) error

RunRenameContext performs the execution for 'config rename-context' sub command

func (RenameContextOptions) Validate

func (o RenameContextOptions) Validate() error

Validate makes sure that provided values for command-line options are valid

type ViewOptions

type ViewOptions struct {
	PrintFlags  *genericclioptions.PrintFlags
	PrintObject printers.ResourcePrinterFunc

	ConfigAccess clientcmd.ConfigAccess
	Merge        cliflag.Tristate
	Flatten      bool
	Minify       bool
	RawByteData  bool

	Context      string
	OutputFormat string

	genericclioptions.IOStreams
}

ViewOptions holds the command-line options for 'config view' sub command

func (*ViewOptions) Complete

func (o *ViewOptions) Complete(cmd *cobra.Command, args []string) error

Complete completes the required command-line options

func (ViewOptions) Run

func (o ViewOptions) Run() error

Run performs the execution of 'config view' sub command

func (ViewOptions) Validate

func (o ViewOptions) Validate() error

Validate makes sure that provided values for command-line options are valid

Jump to

Keyboard shortcuts

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