Documentation ¶
Index ¶
- func AddPrinterFlags(cmd *cobra.Command)
- func CompareNamespace(defaultNamespace, namespace string) error
- func FirstNonEmptyString(args ...string) string
- func GetFilesFromDir(directory string, fileType string) []string
- func GetFlagBool(cmd *cobra.Command, flag string) bool
- func GetFlagBoolPtr(cmd *cobra.Command, flag string) *bool
- func GetFlagDuration(cmd *cobra.Command, flag string) time.Duration
- func GetFlagInt(cmd *cobra.Command, flag string) int
- func GetFlagString(cmd *cobra.Command, flag string) string
- func Merge(dst runtime.Object, fragment, kind string) (runtime.Object, error)
- func OutputVersion(cmd *cobra.Command, defaultVersion string) string
- func PrinterForCommand(cmd *cobra.Command) (kubectl.ResourcePrinter, bool, error)
- func ReadConfigData(location string) ([]byte, error)
- func ReadConfigDataFromLocation(location string) ([]byte, error)
- func ResourceFromArgs(cmd *cobra.Command, args []string, mapper meta.RESTMapper, cmdNamespace string) (mapping *meta.RESTMapping, namespace, name string)
- func ResourceFromArgsOrFile(cmd *cobra.Command, args []string, filename string, typer runtime.ObjectTyper, ...) (mapping *meta.RESTMapping, namespace, name string)
- func ResourceFromFile(filename string, typer runtime.ObjectTyper, mapper meta.RESTMapper, ...) (mapping *meta.RESTMapping, namespace, name string, data []byte)
- func ResourceOrTypeFromArgs(cmd *cobra.Command, args []string, mapper meta.RESTMapper, ...) (mapping *meta.RESTMapping, namespace, name string)
- func ResourcesFromArgsOrFile(cmd *cobra.Command, args []string, filename, selector string, ...) resource.Visitor
- func SplitResourceArgument(arg string) []string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddPrinterFlags ¶
func CompareNamespace ¶
CompareNamespace returns an error if the namespace the user has provided on the CLI or via the default namespace file does not match the namespace of an input file. This prevents a user from unintentionally updating the wrong namespace.
func FirstNonEmptyString ¶
Returns the first non-empty string out of the ones provided. If all strings are empty, returns an empty string.
func GetFilesFromDir ¶
Return a list of file names of a certain type within a given directory. TODO: replace with resource.Builder
func GetFlagBoolPtr ¶
Returns nil if the flag wasn't set.
func GetFlagInt ¶
Assumes the flag has a default value.
func OutputVersion ¶
OutputVersion returns the preferred output version for generic content (JSON, YAML, or templates)
func PrinterForCommand ¶
PrinterForCommand returns the default printer for this command. Requires that printer flags have been added to cmd (see AddPrinterFlags).
func ReadConfigData ¶
ReadConfigData reads the bytes from the specified filesytem or network location or from stdin if location == "-". TODO: replace with resource.Builder
func ReadConfigDataFromLocation ¶
TODO: replace with resource.Builder
func ResourceFromArgs ¶
func ResourceFromArgs(cmd *cobra.Command, args []string, mapper meta.RESTMapper, cmdNamespace string) (mapping *meta.RESTMapping, namespace, name string)
ResourceFromArgs expects two arguments with a given type, and extracts the fields necessary to uniquely locate a resource. Displays a usageError if that contract is not satisfied, or a generic error if any other problems occur.
func ResourceFromArgsOrFile ¶
func ResourceFromArgsOrFile(cmd *cobra.Command, args []string, filename string, typer runtime.ObjectTyper, mapper meta.RESTMapper, schema validation.Schema, cmdNamespace, cmdVersion string) (mapping *meta.RESTMapping, namespace, name string)
ResourceFromArgsOrFile expects two arguments or a valid file with a given type, and extracts the fields necessary to uniquely locate a resource. Displays a usageError if that contract is not satisfied, or a generic error if any other problems occur.
func ResourceFromFile ¶
func ResourceFromFile(filename string, typer runtime.ObjectTyper, mapper meta.RESTMapper, schema validation.Schema, cmdVersion string) (mapping *meta.RESTMapping, namespace, name string, data []byte)
ResourceFromFile retrieves the name and namespace from a valid file. If the file does not resolve to a known type an error is returned. The returned mapping can be used to determine the correct REST endpoint to modify this resource with.
func ResourceOrTypeFromArgs ¶
func ResourceOrTypeFromArgs(cmd *cobra.Command, args []string, mapper meta.RESTMapper, cmdNamespace, cmdVersion string) (mapping *meta.RESTMapping, namespace, name string)
ResourceFromArgs expects two arguments with a given type, and extracts the fields necessary to uniquely locate a resource. Displays a usageError if that contract is not satisfied, or a generic error if any other problems occur.
func ResourcesFromArgsOrFile ¶
func ResourcesFromArgsOrFile( cmd *cobra.Command, args []string, filename, selector string, typer runtime.ObjectTyper, mapper meta.RESTMapper, clientBuilder func(cmd *cobra.Command, mapping *meta.RESTMapping) (resource.RESTClient, error), schema validation.Schema, requireNames bool, cmdNamespace, cmdVersion string, ) resource.Visitor
ResourcesFromArgsOrFile computes a list of Resources by extracting info from filename or args. It will handle label selectors provided.
func SplitResourceArgument ¶
Types ¶
This section is empty.