Documentation
¶
Index ¶
- Constants
- Variables
- func CompleteBuilderImageList(cmd *cobra.Command, args []string, complete string) (builderImages []string, directive cobra.ShellCompDirective)
- func CompleteBuilderList(cmd *cobra.Command, args []string, complete string) (matches []string, d cobra.ShellCompDirective)
- func CompleteFunctionList(cmd *cobra.Command, args []string, toComplete string) (strings []string, directive cobra.ShellCompDirective)
- func CompleteOutputFormatList(cmd *cobra.Command, args []string, toComplete string) (strings []string, directive cobra.ShellCompDirective)
- func CompleteRegistryList(cmd *cobra.Command, args []string, toComplete string) (strings []string, directive cobra.ShellCompDirective)
- func CompleteRuntimeList(cmd *cobra.Command, args []string, toComplete string, client *fn.Client) (matches []string, directive cobra.ShellCompDirective)
- func CompleteTemplateList(cmd *cobra.Command, args []string, toComplete string, client *fn.Client) (matches []string, directive cobra.ShellCompDirective)
- func GetDefaultRegistry() string
- func KnownBuilders() builders.Known
- func NewBuildCmd(newClient ClientFactory) *cobra.Command
- func NewClient(cfg ClientConfig, options ...fn.Option) (*fn.Client, func())
- func NewCompletionCmd() *cobra.Command
- func NewConfigCmd(loadSaver functionLoaderSaver) *cobra.Command
- func NewConfigEnvsAddCmd(loadSaver functionLoaderSaver) *cobra.Command
- func NewConfigEnvsCmd(loadSaver functionLoaderSaver) *cobra.Command
- func NewConfigEnvsRemoveCmd() *cobra.Command
- func NewConfigLabelsCmd(loaderSaver functionLoaderSaver) *cobra.Command
- func NewConfigVolumesAddCmd() *cobra.Command
- func NewConfigVolumesCmd() *cobra.Command
- func NewConfigVolumesRemoveCmd() *cobra.Command
- func NewCreateCmd(newClient ClientFactory) *cobra.Command
- func NewDeleteCmd(newClient ClientFactory) *cobra.Command
- func NewDeployCmd(newClient ClientFactory) *cobra.Command
- func NewInfoCmd(newClient ClientFactory) *cobra.Command
- func NewInvokeCmd(newClient ClientFactory) *cobra.Command
- func NewLanguagesCmd(newClient ClientFactory) *cobra.Command
- func NewListCmd(newClient ClientFactory) *cobra.Command
- func NewRegistryValidator(path string) survey.Validator
- func NewRepositoryAddCmd(newClient ClientFactory) *cobra.Command
- func NewRepositoryCmd(newClient ClientFactory) *cobra.Command
- func NewRepositoryListCmd(newClient ClientFactory) *cobra.Command
- func NewRepositoryRemoveCmd(newClient ClientFactory) *cobra.Command
- func NewRepositoryRenameCmd(newClient ClientFactory) *cobra.Command
- func NewRootCmd(config RootCommandConfig) *cobra.Command
- func NewRunCmd(newClient ClientFactory) *cobra.Command
- func NewTemplatesCmd(newClient ClientFactory) *cobra.Command
- func NewVersionCmd(version Version) *cobra.Command
- func RuntimeTemplateOptions(client *fn.Client) (string, error)
- func ValidateBuilder(name string) (err error)
- type ClientConfig
- type ClientFactory
- type ErrInvalidRuntime
- type ErrInvalidTemplate
- type ErrNoRuntime
- type Format
- type Formatter
- type RootCommandConfig
- type Version
Constants ¶
const ( Human Format = "human" // Headers, indentation, justification etc. Plain = "plain" // Suitable for cli automation via sed/awk etc. JSON = "json" // Technically a ⊆ yaml, but no one likes yaml. XML = "xml" YAML = "yaml" URL = "url" )
Variables ¶
var ErrRegistryRequired = errors.New(`A container registry is required. For example:
--registry docker.io/myusername
To run the command in an interactive mode, use --confirm (-c)`)
var ErrTemplateRepoDoesNotExist = errors.New("template repo does not exist")
ErrTemplateRepoDoesNotExist is a sentinel error if a template repository responds with 404 status code
var ErrURLRequired = errors.New(`The function is not associated with a Git repository, and needs one in order to perform a remote deployment. For example:
--remote --git-url=https://git.example.com/namespace/myFunction
To run the deploy command in an interactive mode, use --confirm (-c)`)
Functions ¶
func CompleteBuilderImageList ¶ added in v0.23.0
func CompleteBuilderList ¶
func CompleteFunctionList ¶
func CompleteRegistryList ¶
func CompleteRuntimeList ¶
func CompleteTemplateList ¶ added in v0.19.0
func GetDefaultRegistry ¶ added in v0.22.0
func GetDefaultRegistry() string
func KnownBuilders ¶ added in v0.26.0
KnownBuilders are a typed string slice of builder short names which this CLI understands. Includes a customized String() representation intended for use in flags and help text.
func NewBuildCmd ¶
func NewBuildCmd(newClient ClientFactory) *cobra.Command
func NewClient ¶ added in v0.23.0
func NewClient(cfg ClientConfig, options ...fn.Option) (*fn.Client, func())
NewClient constructs an fn.Client with the majority of the concrete implementations set. Provide additional Options to this constructor to override or augment as needed, or override the ClientFactory passed to commands entirely to mock for testing. Note the returned cleanup function. 'Namespace' is optional. If not provided (see DefaultNamespace commentary), the currently configured is used. 'Verbose' indicates the system should write out a higher amount of logging. Example:
client, done := NewClient("",false)
defer done()
func NewCompletionCmd ¶ added in v0.22.0
func NewConfigCmd ¶ added in v0.22.0
func NewConfigEnvsAddCmd ¶ added in v0.22.0
func NewConfigEnvsCmd ¶ added in v0.22.0
func NewConfigEnvsRemoveCmd ¶ added in v0.22.0
func NewConfigLabelsCmd ¶ added in v0.18.0
func NewConfigVolumesAddCmd ¶ added in v0.22.0
func NewConfigVolumesCmd ¶ added in v0.22.0
func NewConfigVolumesRemoveCmd ¶ added in v0.22.0
func NewCreateCmd ¶
func NewCreateCmd(newClient ClientFactory) *cobra.Command
NewCreateCmd creates a create command using the given client creator.
func NewDeleteCmd ¶
func NewDeleteCmd(newClient ClientFactory) *cobra.Command
func NewDeployCmd ¶
func NewDeployCmd(newClient ClientFactory) *cobra.Command
func NewInfoCmd ¶ added in v0.18.0
func NewInfoCmd(newClient ClientFactory) *cobra.Command
func NewInvokeCmd ¶ added in v0.22.0
func NewInvokeCmd(newClient ClientFactory) *cobra.Command
func NewLanguagesCmd ¶ added in v0.26.0
func NewLanguagesCmd(newClient ClientFactory) *cobra.Command
func NewListCmd ¶
func NewListCmd(newClient ClientFactory) *cobra.Command
func NewRegistryValidator ¶ added in v0.34.0
func NewRepositoryAddCmd ¶ added in v0.18.0
func NewRepositoryAddCmd(newClient ClientFactory) *cobra.Command
func NewRepositoryCmd ¶ added in v0.18.0
func NewRepositoryCmd(newClient ClientFactory) *cobra.Command
func NewRepositoryListCmd ¶ added in v0.18.0
func NewRepositoryListCmd(newClient ClientFactory) *cobra.Command
func NewRepositoryRemoveCmd ¶ added in v0.18.0
func NewRepositoryRemoveCmd(newClient ClientFactory) *cobra.Command
func NewRepositoryRenameCmd ¶ added in v0.18.0
func NewRepositoryRenameCmd(newClient ClientFactory) *cobra.Command
func NewRootCmd ¶
func NewRootCmd(config RootCommandConfig) *cobra.Command
NewRootCmd creates the root of the command tree defines the command name, description, globally available flags, etc. It has no action of its own, such that running the resultant binary with no arguments prints the help/usage text.
func NewRunCmd ¶
func NewRunCmd(newClient ClientFactory) *cobra.Command
func NewTemplatesCmd ¶ added in v0.26.0
func NewTemplatesCmd(newClient ClientFactory) *cobra.Command
func NewVersionCmd ¶ added in v0.22.0
func RuntimeTemplateOptions ¶ added in v0.26.0
RuntimeTemplateOptions is a human-friendly table of valid Language Runtime to Template combinations.
func ValidateBuilder ¶ added in v0.26.0
ValidateBuilder ensures that the given builder is one that the CLI knows how to instantiate, returning a builkder.ErrUnknownBuilder otherwise.
Types ¶
type ClientConfig ¶ added in v0.23.0
type ClientConfig struct {
// Namespace in the remote cluster to use for any client commands which
// touch the remote. Optional. Empty namespace indicates the namespace
// currently configured in the client's connection should be used.
Namespace string
// Verbose logging. By default, logging output is kept to the bare minimum.
// Use this flag to configure verbose logging throughout.
Verbose bool
// Allow insecure server connections when using SSL
InsecureSkipVerify bool
}
ClientConfig settings for use with NewClient These are the minimum settings necessary to create the default client instance which has most subsystems initialized.
type ClientFactory ¶ added in v0.22.0
type ClientFactory func(ClientConfig, ...fn.Option) (*fn.Client, func())
ClientFactory defines a constructor which assists in the creation of a Client for use by commands. See the NewClient constructor which is the fully populated ClientFactory used by commands by default. See NewClientFactory which constructs a minimal ClientFactory for use during testing.
func NewClientFactory ¶ added in v0.23.0
func NewClientFactory(n func() *fn.Client) ClientFactory
NewClientFactory enables simple instantiation of an fn.Client, such as for mocking during tests or for minimal api usage. Given is a minimal Client constructor, Returned is full ClientFactory with the aspects of normal (full) Client construction (namespace, verbosity level, additional options and the returned cleanup function) ignored.
type ErrInvalidRuntime ¶ added in v0.20.0
type ErrInvalidRuntime error
ErrInvalidRuntime indicates that the passed language runtime was invalid.
type ErrInvalidTemplate ¶ added in v0.20.0
type ErrInvalidTemplate error
ErrInvalidTemplate indicates that the passed template was invalid.
type ErrNoRuntime ¶ added in v0.20.0
type ErrNoRuntime error
ErrNoRuntime indicates that the language runtime flag was not passed.
type Formatter ¶
type Formatter interface {
Human(io.Writer) error
Plain(io.Writer) error
JSON(io.Writer) error
XML(io.Writer) error
YAML(io.Writer) error
URL(io.Writer) error
}
formatter is any structure which has methods for serialization.
type RootCommandConfig ¶ added in v0.22.0
type RootCommandConfig struct {
Name string // usually `func` or `kn func`
Version
NewClient ClientFactory
}
type Version ¶
type Version struct {
// Date of compilation
Date string
// Version tag of the git commit, or 'tip' if no tag.
Vers string
// Hash of the currently active git commit on build.
Hash string
// Verbose printing enabled for the string representation.
Verbose bool
}
func (Version) String ¶
Return the stringification of the Version struct, which takes into account the verbosity setting.
func (Version) StringVerbose ¶ added in v0.23.0
StringVerbose returns the verbose version of the version stringification. The format returned is [semver]-hash-[date] where the special value 'v0.0.0' and 'source' are used when version is not available and/or the libray has been built from source, respectively.