cmd

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultRateLimiter default rate limiter for cmd client
	DefaultRateLimiter = flowcontrol.NewTokenBucketRateLimiter(100, 200)
)

Functions

func GetApplicationsForCompletion

func GetApplicationsForCompletion(ctx context.Context, f Factory, namespace string, toComplete string) ([]string, cobra.ShellCompDirective)

GetApplicationsForCompletion auto-complete application

func GetCluster added in v1.4.0

func GetCluster(cmd *cobra.Command) string

GetCluster get cluster from command flags

func GetClusters added in v1.4.0

func GetClusters(cmd *cobra.Command) []string

GetClusters get cluster from command flags

func GetClustersForCompletion added in v1.4.0

func GetClustersForCompletion(ctx context.Context, f Factory, toComplete string) ([]string, cobra.ShellCompDirective)

GetClustersForCompletion auto-complete the cluster

func GetNamespace

func GetNamespace(f Factory, cmd *cobra.Command) string

GetNamespace get namespace from command flags and env

func GetNamespacesForCompletion

func GetNamespacesForCompletion(ctx context.Context, f Factory, toComplete string) ([]string, cobra.ShellCompDirective)

GetNamespacesForCompletion auto-complete the namespace

func GetRevisionForCompletion

func GetRevisionForCompletion(ctx context.Context, f Factory, appName string, namespace string, toComplete string) ([]string, cobra.ShellCompDirective)

GetRevisionForCompletion auto-complete the revision according to the application

func GetServiceAccountForCompletion added in v1.4.0

func GetServiceAccountForCompletion(ctx context.Context, f Factory, namespace string, toComplete string) ([]string, cobra.ShellCompDirective)

GetServiceAccountForCompletion auto-complete serviceaccount

Types

type Builder

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

Builder build command with factory

func NewCommandBuilder

func NewCommandBuilder(f Factory, cmd *cobra.Command) *Builder

NewCommandBuilder builder for command

func (*Builder) Build

func (builder *Builder) Build() *cobra.Command

Build construct the command

func (*Builder) WithClusterFlag added in v1.4.0

func (builder *Builder) WithClusterFlag(options ...ClusterFlagOption) *Builder

WithClusterFlag add cluster flag to the command

func (*Builder) WithEnvFlag

func (builder *Builder) WithEnvFlag() *Builder

WithEnvFlag add env flag to the command

func (*Builder) WithNamespaceFlag

func (builder *Builder) WithNamespaceFlag(options ...NamespaceFlagOption) *Builder

WithNamespaceFlag add namespace flag to the command, by default, it will also add env flag to the command

func (*Builder) WithResponsiveWriter

func (builder *Builder) WithResponsiveWriter() *Builder

WithResponsiveWriter format the command outputs

func (*Builder) WithStreams added in v1.4.0

func (builder *Builder) WithStreams(streams util.IOStreams) *Builder

WithStreams set the in/out/err streams for the command

type ClientGetter

type ClientGetter func() (client.Client, error)

ClientGetter function for getting client

type ClusterFlagConfig added in v1.4.0

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

ClusterFlagConfig config for cluster flag in cmd

type ClusterFlagDisableSliceInputOption added in v1.4.0

type ClusterFlagDisableSliceInputOption struct{}

ClusterFlagDisableSliceInputOption set the cluster flag to allow multiple input

func (ClusterFlagDisableSliceInputOption) ApplyToClusterFlagOptions added in v1.4.0

func (option ClusterFlagDisableSliceInputOption) ApplyToClusterFlagOptions(cfg *ClusterFlagConfig)

ApplyToClusterFlagOptions .

type ClusterFlagOption added in v1.4.0

type ClusterFlagOption interface {
	ApplyToClusterFlagOptions(*ClusterFlagConfig)
}

ClusterFlagOption the option for configuring cluster flag

type ConfigGetter added in v1.4.0

type ConfigGetter func() (*rest.Config, error)

ConfigGetter function for getting config

type Factory

type Factory interface {
	Client() client.Client
	Config() *rest.Config
}

Factory client factory for running command

func NewDefaultFactory

func NewDefaultFactory(cfg *rest.Config) Factory

NewDefaultFactory create a factory based on client getter function

func NewDeferredFactory added in v1.4.1

func NewDeferredFactory(getter ConfigGetter) Factory

NewDeferredFactory create a factory that will only get KubeConfig until it is needed for the first time

func NewDelegateFactory added in v1.4.0

func NewDelegateFactory(clientGetter ClientGetter, configGetter ConfigGetter) Factory

NewDelegateFactory create a factory based on getter function

func NewTestFactory added in v1.6.0

func NewTestFactory(cfg *rest.Config,
	cli client.Client) Factory

NewTestFactory new a factory for the testing

type FlagNoCompletionOption added in v1.4.0

type FlagNoCompletionOption struct{}

FlagNoCompletionOption disable auto-completion for flag

func (FlagNoCompletionOption) ApplyToClusterFlagOptions added in v1.4.0

func (option FlagNoCompletionOption) ApplyToClusterFlagOptions(cfg *ClusterFlagConfig)

ApplyToClusterFlagOptions .

func (FlagNoCompletionOption) ApplyToNamespaceFlagOptions added in v1.4.0

func (option FlagNoCompletionOption) ApplyToNamespaceFlagOptions(cfg *NamespaceFlagConfig)

ApplyToNamespaceFlagOptions .

type NamespaceFlagConfig

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

NamespaceFlagConfig config for namespace flag in cmd

type NamespaceFlagDisableEnvOption

type NamespaceFlagDisableEnvOption struct{}

NamespaceFlagDisableEnvOption disable loading namespace from env

func (NamespaceFlagDisableEnvOption) ApplyToNamespaceFlagOptions

func (option NamespaceFlagDisableEnvOption) ApplyToNamespaceFlagOptions(cfg *NamespaceFlagConfig)

ApplyToNamespaceFlagOptions .

type NamespaceFlagOption

type NamespaceFlagOption interface {
	ApplyToNamespaceFlagOptions(*NamespaceFlagConfig)
}

NamespaceFlagOption the option for configuring namespace flag in cmd

type UsageOption added in v1.4.0

type UsageOption string

UsageOption the usage description for flag

func (UsageOption) ApplyToClusterFlagOptions added in v1.4.0

func (option UsageOption) ApplyToClusterFlagOptions(cfg *ClusterFlagConfig)

ApplyToClusterFlagOptions .

func (UsageOption) ApplyToNamespaceFlagOptions added in v1.4.0

func (option UsageOption) ApplyToNamespaceFlagOptions(cfg *NamespaceFlagConfig)

ApplyToNamespaceFlagOptions .

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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