create

package
v0.5.2-beta.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2023 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildCommand

func BuildCommand(inputs Inputs) *cobra.Command

BuildCommand build create command

Types

type BaseOptions

type BaseOptions struct {
	// Namespace k8s namespace
	Namespace string `json:"namespace"`

	// Name Resource name of the command line operation
	Name string `json:"name"`

	Dynamic dynamic.Interface `json:"-"`

	Client kubernetes.Interface `json:"-"`

	// Quiet minimize unnecessary output
	Quiet bool

	genericclioptions.IOStreams
}

BaseOptions the options of creation command should inherit baseOptions

func (*BaseOptions) CleanUp

func (o *BaseOptions) CleanUp(inputs Inputs) error

func (*BaseOptions) Complete

func (o *BaseOptions) Complete(inputs Inputs, args []string) error

func (*BaseOptions) Run

func (o *BaseOptions) Run(inputs Inputs) error

Run execute command. the options of parameter contain the command flags and args.

func (*BaseOptions) RunAsApply

func (o *BaseOptions) RunAsApply(inputs Inputs) error

RunAsApply execute command. the options of parameter contain the command flags and args. if the resource exists, run as "kubectl apply".

func (*BaseOptions) Validate

func (o *BaseOptions) Validate(inputs Inputs) error

type CreateDependency

type CreateDependency func(dryRun []string) error

type Inputs

type Inputs struct {
	// Use cobra command use
	Use string

	// Short is the short description shown in the 'help' output.
	Short string

	// Example is examples of how to use the command.
	Example string

	// BaseOptionsObj
	BaseOptionsObj *BaseOptions

	// Options a command options object which extends BaseOptions
	Options interface{}

	// CueTemplateName cue template file name
	CueTemplateName string

	// ResourceName k8s resource name
	ResourceName string

	// Group of API, default is apps
	Group string

	// Group of Version, default is v1alpha1
	Version string

	// Factory
	Factory cmdutil.Factory

	// ValidateFunc optional, custom validate func
	Validate func() error

	// Complete optional, do custom complete options
	Complete func() error

	BuildFlags func(*cobra.Command)

	// PreCreate optional, make changes on yaml before create
	PreCreate func(*unstructured.Unstructured) error

	// CustomOutPut will be executed after creating successfully.
	CustomOutPut func(options *BaseOptions)

	// CleanUpFn will be executed after creating failed.
	CleanUpFn func() error

	// CreateDependencies will be executed before creating.
	CreateDependencies CreateDependency

	// ResourceNameGVRForCompletion resource name for completion.
	ResourceNameGVRForCompletion schema.GroupVersionResource
}

Jump to

Keyboard shortcuts

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