Documentation ¶
Index ¶
- Constants
- func AskToProceedS(message string) string
- func CheckError(err error)
- func DeleteResource(apiServer string, token string, skipCheck bool, resource string, ...) error
- func Execute(apiServer string, token string, filePath string, skipCheck bool, ...) error
- func Fatal(exitcode int, args ...interface{})
- func NewResourceCommand(clientOptions *types.ClientOptions, resourceType reflect.Type, ...) (ccCommands []*cobra.Command)
- func PrintResource(resource interface{}, output string) error
- func PrintResourceResponseList(resources interface{}, output string, single bool) error
- func SaveResource(apiServer string, token string, skipCheck bool, resource string, ...) error
- func SubDeleteCommand(clientOptions *types.ClientOptions, resourceHandler types.ResourceHandler, ...) *cobra.Command
- func SubGetCommand(clientOptions *types.ClientOptions, resourceHandler types.ResourceHandler, ...) *cobra.Command
Constants ¶
const ( OutputYaml = "yaml" OutputJson = "json" OutputWide = "wide" )
const ( MethodGet = "GET" MethodDelete = "DELETE" MethodPost = "POST" IgnoreProductOfCluster = "Cluster" IgnoreProductOfProduct = "Product" CodeRepoBinding = "CodeRepoBinding" )
Variables ¶
This section is empty.
Functions ¶
func AskToProceedS ¶
AskToProceedS prompts the user with a message (typically a yes, no or all question) and returns string "a", "y" or "n".
func CheckError ¶
func CheckError(err error)
CheckError logs a fatal message and exits with error code if err is not nil
func DeleteResource ¶
func Execute ¶
func Execute(apiServer string, token string, filePath string, skipCheck bool, resourceTypeArr []types.ResourcesType, resourceFunc types.ResourceFunc) error
func Fatal ¶
func Fatal(exitcode int, args ...interface{})
Fatal is a wrapper for logrus.Fatal() to exit with custom code
func NewResourceCommand ¶
func NewResourceCommand(clientOptions *types.ClientOptions, resourceType reflect.Type, responseItemType reflect.Type, subCommandFunc func(clientOptions *types.ClientOptions, resourceHandler types.ResourceHandler, resourceName string, resourceType, responseItemType reflect.Type) *cobra.Command) (ccCommands []*cobra.Command)
NewResourceCommand creates and returns a set of Cobra commands for a resource type based on reflection and provided options. It takes client options, resource type, response item type, and a subCommandFunc responsible for creating subcommands. The generated commands include those for the resource itself, its plural form, and any short commands specified in tags. The subCommandFunc is called to create subcommands for each of these names.
func PrintResource ¶
PrintResource prints a single resource in YAML or JSON format to stdout according to the output format
func PrintResourceResponseList ¶
PrintResourceResponseList marshals & prints a list of resources to stdout according to the output format
func SaveResource ¶
func SubDeleteCommand ¶
func SubDeleteCommand(clientOptions *types.ClientOptions, resourceHandler types.ResourceHandler, resourceName string, _, _ reflect.Type) *cobra.Command
SubDeleteCommand creates a Cobra command for the "delete" subcommand of a resource. It removes one or more resources based on the provided arguments and options. The command supports confirmation prompts and the option to bypass prompts using the "--yes" flag. The "product" flag allows filtering resources by product name.
func SubGetCommand ¶
func SubGetCommand(clientOptions *types.ClientOptions, resourceHandler types.ResourceHandler, resourceName string, _, responseItemType reflect.Type) *cobra.Command
SubGetCommand creates a Cobra command for the "get" subcommand of a resource. It retrieves information about a specific resource or a list of resources based on the provided arguments. The command supports various output formats such as json, yaml, or a wide table format. The "product" flag allows filtering resources by product name.
Types ¶
This section is empty.