plugin

package
v1.0.107 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 16, 2024 License: MIT Imports: 4 Imported by: 0

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

View Source
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

type AuthResult struct {
	Header map[string]string
}

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
	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 NewCommand(service string) *Command

func (*Command) IsHidden

func (c *Command) IsHidden() *Command

func (*Command) WithCategory

func (c *Command) WithCategory(name string, description string) *Command

func (*Command) WithOperation

func (c *Command) WithOperation(name string, description string) *Command

func (*Command) WithParameter

func (c *Command) WithParameter(name string, type_ string, description string, required bool) *Command

type CommandCategory

type CommandCategory struct {
	Name        string
	Description string
}

CommandCategory allows grouping multiple operations under a common resource.

Example command with category: uipath service category operation --parameter my-value

func NewCommandCategory

func NewCommandCategory(name string, description string) *CommandCategory

type CommandParameter

type CommandParameter struct {
	Name        string
	Type        string
	Description string
	Required    bool
}

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL