Documentation ¶
Overview ¶
Package genericclioptions contains flags which can be added to you command, bound, completed, and produce useful helper functions.
Index ¶
- Constants
- type ConfigFlags
- func (f *ConfigFlags) AddFlags(flags *pflag.FlagSet)
- func (f *ConfigFlags) ToRESTConfig() (*rest.Config, error)
- func (f *ConfigFlags) ToRawIAMConfigLoader() clientcmd.ClientConfig
- func (f *ConfigFlags) WithDeprecatedPasswordFlag() *ConfigFlags
- func (f *ConfigFlags) WithDeprecatedSecretFlag() *ConfigFlags
- type IOStreams
- type RESTClientGetter
Constants ¶
const ( FlagIAMConfig = "iamconfig" FlagBearerToken = "user.token" FlagUsername = "user.username" FlagPassword = "user.password" FlagSecretID = "user.secret-id" FlagSecretKey = "user.secret-key" FlagCertFile = "user.client-certificate" FlagKeyFile = "user.client-key" FlagTLSServerName = "server.tls-server-name" FlagInsecure = "server.insecure-skip-tls-verify" FlagCAFile = "server.certificate-authority" FlagAPIServer = "server.address" FlagTimeout = "server.timeout" FlagMaxRetries = "server.max-retries" FlagRetryInterval = "server.retry-interval" )
Defines flag for iamctl.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConfigFlags ¶
type ConfigFlags struct { IAMConfig *string BearerToken *string Username *string Password *string SecretID *string SecretKey *string Insecure *bool TLSServerName *string CertFile *string KeyFile *string CAFile *string APIServer *string Timeout *time.Duration MaxRetries *int RetryInterval *time.Duration // contains filtered or unexported fields }
ConfigFlags composes the set of values necessary for obtaining a REST client config.
func NewConfigFlags ¶
func NewConfigFlags(usePersistentConfig bool) *ConfigFlags
NewConfigFlags returns ConfigFlags with default values set.
func (*ConfigFlags) AddFlags ¶
func (f *ConfigFlags) AddFlags(flags *pflag.FlagSet)
AddFlags binds client configuration flags to a given flagset.
func (*ConfigFlags) ToRESTConfig ¶
func (f *ConfigFlags) ToRESTConfig() (*rest.Config, error)
ToRESTConfig implements RESTClientGetter. Returns a REST client configuration based on a provided path to a .iamconfig file, loading rules, and config flag overrides. Expects the AddFlags method to have been called.
func (*ConfigFlags) ToRawIAMConfigLoader ¶
func (f *ConfigFlags) ToRawIAMConfigLoader() clientcmd.ClientConfig
ToRawIAMConfigLoader binds config flag values to config overrides Returns an interactive clientConfig if the password flag is enabled, or a non-interactive clientConfig otherwise.
func (*ConfigFlags) WithDeprecatedPasswordFlag ¶
func (f *ConfigFlags) WithDeprecatedPasswordFlag() *ConfigFlags
WithDeprecatedPasswordFlag enables the username and password config flags.
func (*ConfigFlags) WithDeprecatedSecretFlag ¶
func (f *ConfigFlags) WithDeprecatedSecretFlag() *ConfigFlags
WithDeprecatedSecretFlag enables the secretID and secretKey config flags.
type IOStreams ¶
type IOStreams struct { // In think, os.Stdin In io.Reader // Out think, os.Stdout Out io.Writer // ErrOut think, os.Stderr ErrOut io.Writer }
IOStreams provides the standard names for iostreams. This is useful for embedding and for unit testing. Inconsistent and different names make it hard to read and review code.
func NewTestIOStreams ¶
NewTestIOStreams returns a valid IOStreams and in, out, errout buffers for unit tests.
func NewTestIOStreamsDiscard ¶
func NewTestIOStreamsDiscard() IOStreams
NewTestIOStreamsDiscard returns a valid IOStreams that just discards.
type RESTClientGetter ¶
type RESTClientGetter interface { // ToRESTConfig returns restconfig ToRESTConfig() (*rest.Config, error) // ToRawIAMConfigLoader return iamconfig loader as-is ToRawIAMConfigLoader() clientcmd.ClientConfig }
RESTClientGetter is an interface that the ConfigFlags describe to provide an easier way to mock for commands and eliminate the direct coupling to a struct type. Users may wish to duplicate this type in their own packages as per the golang type overlapping.