flags

package
v0.3.61 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUnavailable is for when the resource status reports unready.
	ErrUnavailable = errors.New("resource unavailable")

	// ErrNamespace is for when the resource status doesn't contain a namespace.
	ErrNamespace = errors.New("namespace error")
)

Functions

func CompleteControlPlaneApplicationBundle

func CompleteControlPlaneApplicationBundle(f cmdutil.Factory) func(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective)

CompleteControlPlaneApplicationBundle provides tab completion for application bundles.

func CompleteKubernetesClusterApplicationBundle

func CompleteKubernetesClusterApplicationBundle(f cmdutil.Factory) func(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective)

CompleteKubernetesClusterApplicationBundle provides tab completion for application bundles.

func CompleteProject

func CompleteProject(f cmdutil.Factory) func(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective)

CompleteProject provides tab completion for the specified resource type.

func RequiredStringVar

func RequiredStringVar(cmd *cobra.Command, p *string, name, value, usage string)

RequireStringdVar registers a string flag marked as required.

func RequiredStringVarWithCompletion

func RequiredStringVarWithCompletion(cmd *cobra.Command, p *string, name, value, usage string, f func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective))

RequiredStringVarWithCompletion registers a string flag marked as required and with a completion function.

func RequiredVar

func RequiredVar(cmd *cobra.Command, p pflag.Value, name, usage string)

String returns the current value. RequiredVar registers a generic flag marked as required.

func StringVarWithCompletion

func StringVarWithCompletion(cmd *cobra.Command, p *string, name, value, usage string, f func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective))

StringVarWithCompletion registers a string flag with a completion function.

Types

type ClusterFlags

type ClusterFlags struct {
	// ControlPlaneFlags define the project and control plane for a cluster.
	ControlPlaneFlags

	// Cluster defines the cluster a resource belongs to.
	Cluster string

	// Indicates whether the cluster parameter is required by the CLI.
	ClusterRequired bool
}

ClusterFlags are flags for a cluster scoped resource. Unlike projects and control planes there is a 1:* cardinality so they aren't required.

func (*ClusterFlags) AddFlags

func (o *ClusterFlags) AddFlags(f cmdutil.Factory, cmd *cobra.Command)

AddFlags adds the flags to a cobra command.

type ControlPlaneFlags

type ControlPlaneFlags struct {
	// ProjectFlags define the project for a control plane.
	ProjectFlags

	// ControlPlane defines the control plane a resource is under.
	ControlPlane string
}

ControlPlaneFlags are required flags for a project scoped resource.

func (*ControlPlaneFlags) AddFlags

func (o *ControlPlaneFlags) AddFlags(f cmdutil.Factory, cmd *cobra.Command)

AddFlags adds the flags to a cobra command.

func (*ControlPlaneFlags) CompleteCluster

func (o *ControlPlaneFlags) CompleteCluster(f cmdutil.Factory) func(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective)

CompleteCluster provides tab completion for the specified resource type.

func (*ControlPlaneFlags) GetControlPlaneNamespace

func (o *ControlPlaneFlags) GetControlPlaneNamespace(ctx context.Context, client unikorn.Interface) (string, error)

GetControlPlaneNamespace figures out the namespace associated with a project's control plane.

type DeleteFlags

type DeleteFlags struct {
	// All defines whether to delete all resources.
	All bool
}

DeleteFlags define common deletion options.

func (*DeleteFlags) AddFlags

func (o *DeleteFlags) AddFlags(_ cmdutil.Factory, cmd *cobra.Command)

AddFlags adds the flags to a cobra command.

type IPNetSliceFlag

type IPNetSliceFlag struct {
	IPNetworks []net.IPNet
}

IPNetSliceFlag provides a way to accumulate IP networks.

func (*IPNetSliceFlag) Set

func (s *IPNetSliceFlag) Set(in string) error

Set sets the value and does any error checking.

func (IPNetSliceFlag) String

func (s IPNetSliceFlag) String() string

String returns the current value.

func (IPNetSliceFlag) Type

func (s IPNetSliceFlag) Type() string

Type returns the human readable type information.

type ProjectFlags

type ProjectFlags struct {
	// project defines the project a resource is under.
	Project string
}

ProjectFlags are required flags for a project scoped resource.

func (*ProjectFlags) AddFlags

func (o *ProjectFlags) AddFlags(f cmdutil.Factory, cmd *cobra.Command)

AddFlags adds the flags to a cobra command.

func (*ProjectFlags) CompleteControlPlane

func (o *ProjectFlags) CompleteControlPlane(f cmdutil.Factory) func(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective)

CompleteControlPlane provides tab completion for the specified resource type.

func (*ProjectFlags) GetProjectNamespace

func (o *ProjectFlags) GetProjectNamespace(ctx context.Context, client unikorn.Interface) (string, error)

GetProjectNamespace figures out the namespace associated with a project.

type QuantityFlag

type QuantityFlag struct {
	Quantity *resource.Quantity
}

QuantityFlag provides parsing and type checking of quanities.

func (*QuantityFlag) Set

func (s *QuantityFlag) Set(in string) error

Set sets the value and does any error checking.

func (QuantityFlag) String

func (s QuantityFlag) String() string

String returns the current value.

func (QuantityFlag) Type

func (s QuantityFlag) Type() string

Type returns the human readable type information.

type SemverFlag

type SemverFlag struct {
	// Semver specifies a default if set, and can be overridden by
	// a call to Set().
	Semver string
}

SemverFlag provides parsing and type checking of semantic versions.

func (*SemverFlag) Set

func (s *SemverFlag) Set(in string) error

Set sets the value and does any error checking.

func (SemverFlag) String

func (s SemverFlag) String() string

String returns the current value.

func (SemverFlag) Type

func (s SemverFlag) Type() string

Type returns the human readable type information.

Jump to

Keyboard shortcuts

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