action

package
v1.0.0-beta.7 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: AGPL-3.0 Imports: 50 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EditForCreate  = "create"
	EditForPatched = "patched"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateDependency

type CreateDependency func(dryRun []string) error

type CreateOptions

type CreateOptions struct {
	Factory   cmdutil.Factory
	Namespace string

	// Name Resource name of the command line operation
	Name             string
	Args             []string
	Dynamic          dynamic.Interface
	Client           kubernetes.Interface
	Format           printer.Format
	ToPrinter        func(*meta.RESTMapping, bool) (printers.ResourcePrinterFunc, error)
	DryRun           string
	EditBeforeCreate bool

	// CueTemplateName cue template file name to render the resource
	CueTemplateName string

	// Options a command options object which extends CreateOptions that will be used
	// to render the cue template
	Options interface{}

	// GVR is the GroupVersionResource of the resource to be created
	GVR schema.GroupVersionResource

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

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

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

	// CreateDependencies will be executed before creating.
	CreateDependencies CreateDependency

	// Quiet minimize unnecessary output
	Quiet bool

	genericiooptions.IOStreams
}

CreateOptions the options of creation command should inherit baseOptions

func (*CreateOptions) AddCommonFlags

func (o *CreateOptions) AddCommonFlags(cmd *cobra.Command)

func (*CreateOptions) CleanUp

func (o *CreateOptions) CleanUp() error

func (*CreateOptions) Complete

func (o *CreateOptions) Complete() error

func (*CreateOptions) GetDryRunStrategy

func (o *CreateOptions) GetDryRunStrategy() (DryRunStrategy, error)

func (*CreateOptions) Run

func (o *CreateOptions) Run() error

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

type CustomEditOptions

type CustomEditOptions struct {
	Factory    cmdutil.Factory
	PrintFlags *genericclioptions.PrintFlags
	Method     string
	TestEnv    bool

	genericiooptions.IOStreams
}

CustomEditOptions is used to edit the resource manifest when creating or updating the resource, instead of using -o yaml to output the yaml file before editing the manifest.

func NewCustomEditOptions

func NewCustomEditOptions(f cmdutil.Factory, streams genericiooptions.IOStreams, method string) *CustomEditOptions

func (*CustomEditOptions) Run

func (o *CustomEditOptions) Run(originalObj runtime.Object) error

type DeleteHook

type DeleteHook func(options *DeleteOptions, object runtime.Object) error

type DeleteOptions

type DeleteOptions struct {
	Factory       cmdutil.Factory
	Namespace     string
	LabelSelector string
	AllNamespaces bool
	Force         bool
	GracePeriod   int
	Now           bool
	AutoApprove   bool

	// Names are the resource names
	Names []string
	// ConfirmedNames used to double-check the resource names to delete, sometimes Names are used to build
	// label selector and be set to nil, ConfirmedNames should be used to record the names to be confirmed.
	ConfirmedNames []string
	GVR            schema.GroupVersionResource
	Result         *resource.Result

	PreDeleteHook  DeleteHook
	PostDeleteHook DeleteHook

	genericiooptions.IOStreams
}

func (*DeleteOptions) AddFlags

func (o *DeleteOptions) AddFlags(cmd *cobra.Command)

func (*DeleteOptions) Run

func (o *DeleteOptions) Run() error

type DryRunStrategy

type DryRunStrategy int
const (
	DryRunNone DryRunStrategy = iota
	DryRunClient
	DryRunServer
)

type EditOptions

type EditOptions struct {
	editor.EditOptions
	Factory cmdutil.Factory
	// Name is the resource name
	Name string
	GVR  schema.GroupVersionResource
}

func (*EditOptions) AddFlags

func (o *EditOptions) AddFlags(cmd *cobra.Command)

func (*EditOptions) Complete

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

type ExecOptions

type ExecOptions struct {
	cmdexec.StreamOptions

	Factory  cmdutil.Factory
	Executor cmdexec.RemoteExecutor
	Config   *restclient.Config
	Client   *kubernetes.Clientset
	Dynamic  dynamic.Interface

	// Pod target pod to execute command
	Pod *corev1.Pod

	// Command is the command to execute
	Command []string
}

func NewExecOptions

func NewExecOptions(f cmdutil.Factory, streams genericiooptions.IOStreams) *ExecOptions

func (*ExecOptions) Complete

func (o *ExecOptions) Complete() error

Complete receives exec parameters

func (*ExecOptions) Run

func (o *ExecOptions) Run() error

func (*ExecOptions) RunWithRedirect

func (o *ExecOptions) RunWithRedirect(outWriter io.Writer, errWriter io.Writer) error

type ListOptions

type ListOptions struct {
	Factory       cmdutil.Factory
	Namespace     string
	AllNamespaces bool
	LabelSelector string
	FieldSelector string
	ShowLabels    bool
	ToPrinter     func(*meta.RESTMapping, bool) (printers.ResourcePrinterFunc, error)

	// Names are the resource names
	Names  []string
	GVR    schema.GroupVersionResource
	Format printer.Format

	// print the result or not, if true, use default printer to print, otherwise,
	// only return the result to caller.
	Print  bool
	SortBy string
	Status string
	genericiooptions.IOStreams
}

func (*ListOptions) AddFlags

func (o *ListOptions) AddFlags(cmd *cobra.Command, isClusterScope ...bool)

func (*ListOptions) Complete

func (o *ListOptions) Complete() error

func (*ListOptions) ListObjects

func (o *ListOptions) ListObjects() (*unstructured.UnstructuredList, error)

func (*ListOptions) PrintNotFoundResources

func (o *ListOptions) PrintNotFoundResources()

func (*ListOptions) PrintObjectList

func (o *ListOptions) PrintObjectList(headers []interface{}, addTableRow func(tbl *printer.TablePrinter, unstructuredObj unstructured.Unstructured) error) error

func (*ListOptions) Run

func (o *ListOptions) Run() (*resource.Result, error)

type OutputOperation

type OutputOperation func(bool) string

type PatchOptions

type PatchOptions struct {
	Factory cmdutil.Factory

	// resource names
	Names           []string
	GVR             schema.GroupVersionResource
	OutputOperation OutputOperation

	// following fields are similar to kubectl patch
	PrintFlags  *genericclioptions.PrintFlags
	ToPrinter   func(string) (printers.ResourcePrinter, error)
	Patch       string
	Subresource string

	EditBeforeUpdate bool

	genericiooptions.IOStreams
	// contains filtered or unexported fields
}

func (*PatchOptions) AddFlags

func (o *PatchOptions) AddFlags(cmd *cobra.Command)

func (*PatchOptions) CmdComplete added in v0.7.2

func (o *PatchOptions) CmdComplete(cmd *cobra.Command) error

func (*PatchOptions) Run

func (o *PatchOptions) Run() error

type UnstructuredList

type UnstructuredList []unstructured.Unstructured

func (UnstructuredList) Len

func (us UnstructuredList) Len() int

func (UnstructuredList) Less

func (us UnstructuredList) Less(i, j int) bool

func (UnstructuredList) Swap

func (us UnstructuredList) Swap(i, j int)

Jump to

Keyboard shortcuts

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