commands

package
v0.29.0-stable-cadence-3 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2022 License: AGPL-3.0 Imports: 3 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertToInterfaceList added in v0.24.5

func ConvertToInterfaceList(list interface{}) ([]interface{}, error)

func ConvertToMap added in v0.24.5

func ConvertToMap(object interface{}) (map[string]interface{}, error)

Types

type AdminCommand

type AdminCommand interface {
	// Validator is responsible for validating the input of a command, available in
	// the Data field of the request argument. By convention, Validator may set the
	// ValidatorData field on the request, and this will persist when the request
	// is passed to Handler.
	// Returns Invalid if request validation fails
	// Any error returned will abort the command execution and will be returned to the caller with InvalidArg error code.
	// TODO define sentinel error type for expected errors
	Validator(request *admin.CommandRequest) error

	// Handler is responsible for handling the request. It applies any state
	// changes associated with the request and returns any values which should
	// be displayed to the initiator of the request.
	// All errors indicate an invalid request, or benign failure to satisfy the request.
	// Any returned error will be returned to the caller with an error status code.
	// If no error is returned, the first return value is serialized and returned to a caller in an `Output` field.
	// TODO define sentinel error type for expected errors
	Handler(ctx context.Context, request *admin.CommandRequest) (interface{}, error)
}

AdminCommand defines the interface expected for admin command handlers.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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