Documentation ¶
Index ¶
- Constants
- func ConfigError(err error) bool
- func CreateProxy(w io.Writer, host, gateway string) *httputil.ReverseProxy
- func GetBuildConfig() build.BuildV1alpha1Interface
- func GetServingConfig() cserving.ServingV1alpha1Interface
- func NewPrefixFilter(prefixes map[string]io.Writer, defaultWriter io.Writer) io.Writer
- func PrintCurlExamples(w io.Writer, listener net.Listener, host, gateway string, withProxy bool)
- func ValidateNamespace(p *config.KfParams) error
- type AsyncFlags
- type Config
- type ConfigErr
- type KfParams
Examples ¶
Constants ¶
const (
AsyncLogSuffix = "" /* 137-byte string literal not displayed */
)
const (
EmptyNamespaceError = "no space targeted, use 'kf target --space SPACE' to target a space"
)
Variables ¶
This section is empty.
Functions ¶
func ConfigError ¶
ConfigError returns true if the error is due to user error.
func CreateProxy ¶
func CreateProxy(w io.Writer, host, gateway string) *httputil.ReverseProxy
CreateProxy creates a proxy to the specified gateway with the specified host in the request header.
func GetBuildConfig ¶
func GetBuildConfig() build.BuildV1alpha1Interface
GetBuildConfig returns the build interface.
func GetServingConfig ¶
func GetServingConfig() cserving.ServingV1alpha1Interface
GetServingConfig returns the serving interface.
func NewPrefixFilter ¶
func PrintCurlExamples ¶
PrintCurlExamples lists example HTTP requests the user can send.
func ValidateNamespace ¶
ValidateNamespace validate non-empty namespace param
Types ¶
type AsyncFlags ¶
type AsyncFlags struct {
// contains filtered or unexported fields
}
AsyncFlags is a flag set for managing whether or not a command runs asynchronously.
Example ¶
var async AsyncFlags cmd := &cobra.Command{ Run: func(cmd *cobra.Command, args []string) { fmt.Println("Running async?", async.IsAsync()) }, } async.Add(cmd) cmd.SetArgs([]string{}) cmd.ExecuteC() cmd.SetArgs([]string{"--async"}) cmd.ExecuteC()
Output: Running async? false Running async? true
func (*AsyncFlags) Add ¶
func (flags *AsyncFlags) Add(cmd *cobra.Command)
Add adds the async flag to the Cobra command.
func (*AsyncFlags) AwaitAndLog ¶
AwaitAndLog waits for the action to be completed if the flag specifies the command should run synchronously. In either case, it will notify the user of the decision by logging to the writer whether it waited or not. If an error is returned by the callback the result will be an error, otherwise the error will be nil.
func (*AsyncFlags) IsAsync ¶
func (flags *AsyncFlags) IsAsync() bool
IsAsync returns true if the user wanted the operation to run asynchronously.
func (*AsyncFlags) IsSynchronous ¶
func (flags *AsyncFlags) IsSynchronous() bool
IsSynchronous returns true if the user wants the operation to be completed synchronously.
Example ¶
var async AsyncFlags cmd := &cobra.Command{ Run: func(cmd *cobra.Command, args []string) { fmt.Println("Running sync?", async.IsSynchronous()) }, } async.Add(cmd) cmd.SetArgs([]string{}) cmd.ExecuteC() cmd.SetArgs([]string{"--async"}) cmd.ExecuteC()
Output: Running sync? true Running sync? false
type Config ¶
type Config struct { Namespace string Args []string AllArgs []string Flags map[string][]string SourceImage string Stdout io.Writer Stderr io.Writer }
func InBuildParseConfig ¶
func InBuildParseConfig() Config
InBuildParseConfig is used by container images that parse args and flags.