Documentation ¶
Index ¶
- Constants
- func BoolFlag(flagset *pflag.FlagSet, p *bool, long, short, usage string)
- func CheckFlags(requiredFlags ...interface{})
- func ConstructBrokerURL(host, project, broker string) string
- func PrintMissingFlags(missingFlags []Names)
- func StringArrayFlag(flagset *pflag.FlagSet, p *[]string, long, short, usage string)
- func StringFlag(flagset *pflag.FlagSet, p *string, long, short, usage string)
- func StringFlagWithDefault(flagset *pflag.FlagSet, p *string, long, short, defaultValue, usage string)
- type BrokerURLConstructor
- type Names
Constants ¶
const ( ApiVersionLongName = "version" ApiVersionShortName = "v" ApiVersionDefault = "2.13" ApiVersionDescription = "[Optional] The version number of OSB API the request will use." BrokerLongName = "broker" BrokerShortName = "b" HostLongName = "host" HostBrokerDefault = "https://servicebroker.googleapis.com" ProjectLongName = "project" ProjectShortName = "p" ServerLongName = "server" ServerShortName = "s" )
Variables ¶
This section is empty.
Functions ¶
func BoolFlag ¶
BoolFlag is a wrapper to *FlagSet.BoolVarP which also does some book keeping so that the flag can be used with GetShortName and GetLongName.
func CheckFlags ¶
func CheckFlags(requiredFlags ...interface{})
CheckFlags checks whether all given flags were specified. If any are missing this will print an error message and call os.Exit(2). requiredFlags should be pointers to the flag variables (e.g. &credsFlag).
func ConstructBrokerURL ¶
func PrintMissingFlags ¶
func PrintMissingFlags(missingFlags []Names)
Prints error message to user about missing flags.
func StringArrayFlag ¶
StringArrayFlag is a wrapper to *FlagSet.StringArrayVarP but does some additional stuff so that you can use CheckRequiredFlags with the given pointer p.
func StringFlag ¶
StringFlag is a wrapper to *FlagSet.StringVarP which also does some book keeping so that the flag can be used with GetShortName and GetLongName.
func StringFlagWithDefault ¶
func StringFlagWithDefault(flagset *pflag.FlagSet, p *string, long, short, defaultValue, usage string)
StringFlagWithDefault is a wrapper to *FlagSet.StringVarP which accepts the default value for the flag. It also does some book keeping so that the flag can be used with GetShortName and GetLongName.
Types ¶
type BrokerURLConstructor ¶
BrokerURLConstructor is a struct that describes the fields which can be used to generate a broker URL via BrokerURL().
func (*BrokerURLConstructor) BrokerURL ¶
func (flags *BrokerURLConstructor) BrokerURL() (string, error)
There are two available options for service broker commands. Users are allowed to pass either --server or (--project and --broker). If the latter is used then we generate the URL assuming we are using a GCP broker. BrokerURL checks that only one of the two options is passed in, that is, only either (--server) or (--project and --broker) are used, and returns the generated broker URL.
type Names ¶
type Names struct {
// contains filtered or unexported fields
}
Names keeps the long and short flag names.
func CheckRequiredFlags ¶
func CheckRequiredFlags(requiredFlags ...interface{}) []Names
CheckRequiredFlags will check that all required flags are there. You must use this package's *VarP functions instead of the *FlagSet methods for all the flags that you are passed into this function. Note that requiredFlags are not actually flags but rather pointers to the variables which are set by the user flags.