Documentation
¶
Index ¶
- Constants
- Variables
- func CheckVersionMismatch(configArg, allowMismatchArg interface{}) error
- func ExecuteResourceAction(args map[string]interface{}, client client.Interface, ...) ([]runtime.Object, error)
- type CommandResults
- type ResourcePrinter
- type ResourcePrinterJSON
- type ResourcePrinterTable
- type ResourcePrinterTemplate
- type ResourcePrinterTemplateFile
- type ResourcePrinterYAML
Constants ¶
const ( ActionApply action = iota ActionCreate ActionUpdate ActionDelete ActionGetOrList ActionPatch )
Variables ¶
var VERSION string
Functions ¶
func CheckVersionMismatch ¶ added in v3.20.2
func CheckVersionMismatch(configArg, allowMismatchArg interface{}) error
func ExecuteResourceAction ¶
func ExecuteResourceAction(args map[string]interface{}, client client.Interface, resource resourcemgr.ResourceObject, action action) ([]runtime.Object, error)
ExecuteResourceAction fans out the specific resource action to the appropriate method on the ResourceManager for the specific resource.
Types ¶
type CommandResults ¶
type CommandResults struct { // Whether the input file was invalid. FileInvalid bool // The number of resources that are being configured. NumResources int // The number of resources that were actually configured. This will // never be 0 without an associated error. NumHandled int // The associated error. Err error // The single type of resource that is being configured, or blank // if multiple resource types are being configured in a single shot. SingleKind string // The results returned from each invocation Resources []runtime.Object // Errors associated with individual resources ResErrs []error // The Calico API client used for the requests (useful if required // again). Client client.Interface }
CommandResults contains the results from executing a CLI command
func ExecuteConfigCommand ¶
func ExecuteConfigCommand(args map[string]interface{}, action action) CommandResults
ExecuteConfigCommand is main function called by all of the resource management commands in calicoctl (apply, create, replace, get, delete and patch). This provides common function for all these commands:
- Load resources from file (or if not specified determine the resource from the command line options).
- Convert the loaded resources into a list of resources (easier to handle)
- Process each resource individually, fanning out to the appropriate methods on the client interface, collate results and exit on the first error.
type ResourcePrinter ¶
type ResourcePrinterJSON ¶
type ResourcePrinterJSON struct{}
ResourcePrinterJSON implements the ResourcePrinter interface and is used to display a slice of resources in JSON format.
type ResourcePrinterTable ¶
type ResourcePrinterTable struct { // The headings to display in the table. If this is nil, the default headings for the // resource are used instead (in which case the `wide` boolean below is used to specify // whether wide or narrow format is required. Headings []string // Wide format. When headings have not been explicitly specified, this is used to // determine whether to the resource-specific default wide or narrow headings. Wide bool // Namespace included. When a resource being printed is namespaced, this is used // to determine if the namespace column should be printed or not. PrintNamespace bool }
ResourcePrinterTable implements the ResourcePrinter interface and is used to display a slice of resources in ps table format.
type ResourcePrinterTemplate ¶
type ResourcePrinterTemplate struct {
Template string
}
ResourcePrinterTemplate implements the ResourcePrinter interface and is used to display a slice of resources using a user-defined go-lang template string.
type ResourcePrinterTemplateFile ¶
type ResourcePrinterTemplateFile struct {
TemplateFile string
}
ResourcePrinterTemplateFile implements the ResourcePrinter interface and is used to display a slice of resources using a user-defined go-lang template specified in a file.
type ResourcePrinterYAML ¶
type ResourcePrinterYAML struct{}
ResourcePrinterYAML implements the ResourcePrinter interface and is used to display a slice of resources in YAML format.