util

package
v0.13.1 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2015 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddPrinterFlags

func AddPrinterFlags(cmd *cobra.Command)

func CheckErr added in v0.13.0

func CheckErr(err error)

func CompareNamespace

func CompareNamespace(defaultNamespace, namespace string) error

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. DEPRECATED: Use resource.Builder

func GetFlagBool

func GetFlagBool(cmd *cobra.Command, flag string) bool

func GetFlagDuration

func GetFlagDuration(cmd *cobra.Command, flag string) time.Duration

func GetFlagInt

func GetFlagInt(cmd *cobra.Command, flag string) int

Assumes the flag has a default value.

func GetFlagString

func GetFlagString(cmd *cobra.Command, flag string) string

func Merge

func Merge(dst runtime.Object, fragment, kind string) (runtime.Object, error)

func OutputVersion

func OutputVersion(cmd *cobra.Command, defaultVersion string) string

OutputVersion returns the preferred output version for generic content (JSON, YAML, or templates)

func PrinterForCommand

func PrinterForCommand(cmd *cobra.Command) (kubectl.ResourcePrinter, bool, error)

PrinterForCommand returns the default printer for this command. Requires that printer flags have been added to cmd (see AddPrinterFlags).

func ReadConfigData

func ReadConfigData(location string) ([]byte, error)

ReadConfigData reads the bytes from the specified filesytem or network location or from stdin if location == "-". TODO: replace with resource.Builder

func ReadConfigDataFromLocation

func ReadConfigDataFromLocation(location string) ([]byte, error)

TODO: replace with resource.Builder

func ReadConfigDataFromReader added in v0.13.0

func ReadConfigDataFromReader(reader io.Reader, source string) ([]byte, error)

func ResourceFromArgs

func ResourceFromArgs(cmd *cobra.Command, args []string, mapper meta.RESTMapper, cmdNamespace string) (mapping *meta.RESTMapping, namespace, name string, err error)

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. DEPRECATED: Use resource.Builder

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, err error)

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. DEPRECATED: Use resource.Builder

func UsageError added in v0.13.0

func UsageError(cmd *cobra.Command, format string, args ...interface{}) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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