api

package
v2.0.0-...-98cc131 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KIND_ACTION     = "action"
	KIND_ACTIONTYPE = "action type"
)

Variables

This section is empty.

Functions

func EncodeActionResult

func EncodeActionResult(spec ActionResult, marshaler runtime.Marshaler) ([]byte, error)

func EncodeActionSpec

func EncodeActionSpec(spec ActionSpec, marshaler runtime.Marshaler) ([]byte, error)

func RegisterAction

func RegisterAction(name string, description string, usage string, attrs []string) error

func RegisterType

func RegisterType(typ ActionType) error

func SupportedActionVersions

func SupportedActionVersions(name string) []string

Types

type Action

type Action interface {
	Name() string
	Description() string
	Usage() string
	ConsumerAttributes() []string
	GetVersion(string) ActionType
	SupportedVersions() []string
}

func GetAction

func GetAction(name string) Action

type ActionResult

type ActionResult interface {
	runtime.VersionedTypedObject
	SetVersion(string)
	SetType(string)
	GetMessage() string
}

func DecodeActionResult

func DecodeActionResult(data []byte, unmarshaler runtime.Unmarshaler) (ActionResult, error)

type ActionSpec

type ActionSpec interface {
	runtime.VersionedTypedObject
	SetVersion(string)
	Selector() Selector
	GetConsumerAttributes() common.Properties
}

func DecodeActionSpec

func DecodeActionSpec(data []byte, unmarshaler runtime.Unmarshaler) (ActionSpec, error)

type ActionType

type ActionType interface {
	runtime.VersionedTypedObject
	SpecificationType() ActionSpecType
	ResultType() ActionResultType
}

func NewActionType

func NewActionType[IS ActionSpec, IR ActionResult](kind, version string) ActionType

func NewActionTypeByConverter

func NewActionTypeByConverter[IS ActionSpec, VS runtime.TypedObject, IR ActionResult, VR runtime.TypedObject](kind, version string, specconv runtime.Converter[IS, VS], resconv runtime.Converter[IR, VR]) ActionType

type ActionTypeRegistry

type ActionTypeRegistry interface {
	RegisterAction(name string, description string, usage string, attrs []string) error
	RegisterActionType(typ ActionType) error

	DecodeActionSpec(data []byte, unmarshaler runtime.Unmarshaler) (ActionSpec, error)
	EncodeActionSpec(spec ActionSpec, marshaler runtime.Marshaler) ([]byte, error)

	DecodeActionResult(data []byte, unmarshaler runtime.Unmarshaler) (ActionResult, error)
	EncodeActionResult(spec ActionResult, marshaler runtime.Marshaler) ([]byte, error)

	GetAction(name string) Action
	SupportedActionVersions(name string) []string

	Copy() ActionTypeRegistry
}

func DefaultRegistry

func DefaultRegistry() ActionTypeRegistry

func NewActionTypeRegistry

func NewActionTypeRegistry() ActionTypeRegistry

type CommonResult

type CommonResult struct {
	runtime.ObjectVersionedType `json:",inline"`
	Message                     string `json:"message,omitempty"`
}

CommonResult is the minimal action result.

func (*CommonResult) GetMessage

func (r *CommonResult) GetMessage() string

func (*CommonResult) SetType

func (r *CommonResult) SetType(typ string)

type Option

type Option interface {
	ApplyActionHandlerOptionTo(*Options)
}

type Options

type Options struct {
	Action    string
	Selectors []Selector
	Priority  int
	Versions  []string
}

func NewOptions

func NewOptions(olist ...Option) *Options

func (*Options) ApplyActionHandlerOptionTo

func (o *Options) ApplyActionHandlerOptionTo(opts *Options)

type Selector

type Selector string

func (Selector) ApplyActionHandlerOptionTo

func (s Selector) ApplyActionHandlerOptionTo(opts *Options)

Jump to

Keyboard shortcuts

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