Documentation ¶
Overview ¶
Package genericclioptions contains flags which can be added to you command, bound, completed, and produce useful helper functions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CommandHeaderRoundTripper ¶
type CommandHeaderRoundTripper struct { Delegate http.RoundTripper Headers map[string]string }
CommandHeaderRoundTripper adds a layer around the standard round tripper to add Request headers before delegation. Implements the go standard library "http.RoundTripper" interface.
func (*CommandHeaderRoundTripper) CancelRequest ¶
func (c *CommandHeaderRoundTripper) CancelRequest(req *http.Request)
CancelRequest is propagated to the Delegate RoundTripper within if the wrapped RoundTripper implements this function.
func (*CommandHeaderRoundTripper) ParseCommandHeaders ¶
func (c *CommandHeaderRoundTripper) ParseCommandHeaders(cmd *cobra.Command, args []string)
ParseCommandHeaders fills in a map of custom headers into the CommandHeaderRoundTripper. These headers are then filled into each request. For details on the custom headers see:
https://github.com/kubernetes/enhancements/tree/master/keps/sig-cli/859-kubectl-headers
Each call overwrites the previously parsed command headers (not additive). TODO(seans3): Parse/add flags removing PII from flag values.
func (*CommandHeaderRoundTripper) RoundTrip ¶
CommandHeaderRoundTripper adds Request headers before delegating to standard round tripper. These headers are kubectl command headers which detail the kubectl command. See SIG CLI KEP 859:
https://github.com/kubernetes/enhancements/tree/master/keps/sig-cli/859-kubectl-headers
type IOStreams ¶
type IOStreams struct { // In think, os.Stdin In io.Reader // Out think, os.Stdout Out io.Writer // ErrOut think, os.Stderr ErrOut io.Writer }
IOStreams provides the standard names for iostreams. This is useful for embedding and for unit testing. Inconsistent and different names make it hard to read and review code.
func NewTestIOStreams ¶
NewTestIOStreams returns a valid IOStreams and in, out, errout buffers for unit tests.
func NewTestIOStreamsDiscard ¶
func NewTestIOStreamsDiscard() IOStreams
NewTestIOStreamsDiscard returns a valid IOStreams that just discards.