Documentation ¶
Overview ¶
Package plugin provides all the APIs and types for implementing custom commands.
Plugins can provide commands which implement custom functionality. They can implement complex operations and provide convenient CLI commands for them.
Index ¶
- Constants
- type AuthResult
- type Command
- func (c *Command) IsHidden() *Command
- func (c *Command) WithCategory(name string, summary string, description string) *Command
- func (c *Command) WithOperation(name string, summary string, description string) *Command
- func (c *Command) WithParameter(name string, type_ string, description string, required bool) *Command
- type CommandCategory
- type CommandParameter
- type CommandPlugin
- type ExecutionContext
- type ExecutionParameter
Constants ¶
const ( ParameterTypeString = "string" ParameterTypeBinary = "binary" ParameterTypeInteger = "integer" ParameterTypeNumber = "number" ParameterTypeBoolean = "boolean" ParameterTypeObject = "object" ParameterTypeStringArray = "stringArray" ParameterTypeIntegerArray = "integerArray" ParameterTypeNumberArray = "numberArray" ParameterTypeBooleanArray = "booleanArray" ParameterTypeObjectArray = "objectArray" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthResult ¶
AuthResult provides authentication information provided by the configured authenticators. Typically, it contains the Authorization HTTP header with a bearer token.
type Command ¶
type Command struct { Service string Name string Summary string Description string Parameters []CommandParameter Hidden bool Category *CommandCategory }
Command is used to define the metadata of the plugin.
Command defines the service name, command name and its available parameters.
func NewCommand ¶
func (*Command) WithCategory ¶ added in v1.0.26
func (*Command) WithOperation ¶ added in v1.0.26
type CommandCategory ¶ added in v1.0.26
CommandCategory allows grouping multiple operations under a common resource.
Example command with category: uipath service category operation --parameter my-value
func NewCommandCategory ¶ added in v1.0.26
func NewCommandCategory(name string, summary string, description string) *CommandCategory
type CommandParameter ¶
CommandParameter defines the parameters the plugin command supports.
func NewCommandParameter ¶
func NewCommandParameter(name string, type_ string, description string, required bool) *CommandParameter
type CommandPlugin ¶
type CommandPlugin interface { Command() Command Execute(context ExecutionContext, writer output.OutputWriter, logger log.Logger) error }
CommandPlugin is the interface plugin commands need to implement so they can be integrated with the CLI.
The Command() operation defines the metadata for the command. The Execute() operation is invoked when the user runs the CLI command.
type ExecutionContext ¶
type ExecutionContext struct { Organization string Tenant string BaseUri url.URL Auth AuthResult Input utils.Stream Parameters []ExecutionParameter Insecure bool Debug bool }
The ExecutionContext provides all the data needed by the plugin to perform the operation.
func NewExecutionContext ¶
func NewExecutionContext( organization string, tenant string, baseUri url.URL, auth AuthResult, input utils.Stream, parameters []ExecutionParameter, insecure bool, debug bool) *ExecutionContext
type ExecutionParameter ¶
type ExecutionParameter struct { Name string Value interface{} }
An ExecutionParameter is a value which is used by the executor to build the request. Parameter values are typicall provided by multiple sources like config files, command line arguments and environment variables.
func NewExecutionParameter ¶
func NewExecutionParameter(name string, value interface{}) *ExecutionParameter