cli

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2021 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUnsupportedOutputMode if user passed unsupported output mode.
	ErrUnsupportedOutputMode = errors.New("unsupported output mode")

	// ErrInvalidFormat if user pass an un-parsable format.
	ErrInvalidFormat = errors.New("invalid format")
)
View Source
var (
	// ErrCantUseBothToURLAndToFlags will be raised if user use both --to and
	// --to-url flags.
	ErrCantUseBothToURLAndToFlags = errors.New("can't use both --to and --to-url flags")
	// ErrUseToURLOrToFlagIsRequired will be raised if user didn't used --to or
	// --to-url flags.
	ErrUseToURLOrToFlagIsRequired = errors.New("use --to or --to-url flag is required")
	// ErrInvalidURLFormat will be raised if given URL is invalid.
	ErrInvalidURLFormat = errors.New("invalid URL format")
	// ErrInvalidToFormat will be raised if given addressable doesn't have valid
	// expected format.
	ErrInvalidToFormat = errors.New("--to flag needs to be in format " +
		"kind:apiVersion:name for named resources or " +
		"kind:apiVersion:labelKey1=value1,labelKey2=value2 for matching via " +
		"a label selector")
)

Functions

func ValidateTarget added in v0.2.0

func ValidateTarget(args *TargetArgs) error

ValidateTarget will perform validation on App element of target.

Types

type App added in v0.3.0

type App struct {
	event.Binding
}

App object.

func (*App) CreateWithArgs added in v0.3.0

func (c *App) CreateWithArgs(args *EventArgs) (*cloudevents.Event, error)

CreateWithArgs will create an event by parsing given args.

func (*App) PresentWith added in v0.3.0

func (c *App) PresentWith(e *cloudevents.Event, output OutputMode) (string, error)

PresentWith will present an event with specified output.

func (*App) Send added in v0.3.0

func (c *App) Send(ce cloudevents.Event, target *TargetArgs, options *OptionsArgs) error

Send will send CloudEvent to target.

type EventArgs

type EventArgs struct {
	Type      string
	ID        string
	Source    string
	Fields    []string
	RawFields []string
}

EventArgs holds args of event to be created with.

type OptionsArgs added in v0.2.0

type OptionsArgs struct {
	event.KnPluginOptions

	// Output define type of output commands should be producing.
	Output OutputMode

	// Verbose tells does commands should display additional information about
	// what's happening? Verbose information is printed on stderr.
	Verbose bool

	OutWriter io.Writer
	ErrWriter io.Writer
}

OptionsArgs holds a general args for all commands.

func (*OptionsArgs) WithLogger added in v0.2.0

func (opts *OptionsArgs) WithLogger() *event.Properties

WithLogger will create an event suitable OptionsArgs from CLI ones.

type OutputMode

type OutputMode enumflag.Flag

OutputMode is type of output to produce.

const (
	HumanReadable OutputMode = iota
	JSON
	YAML
)

OutputMode enumeration values.

type TargetArgs added in v0.2.0

type TargetArgs struct {
	URL             string
	Addressable     string
	Namespace       string
	SenderNamespace string
	AddressableURI  string
}

TargetArgs holds args specific for even sending.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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