Documentation ¶
Index ¶
- Constants
- Variables
- func CreateFromSpec(spec *Spec) (*cloudevents.Event, error)
- func DefaultSource() string
- func NewDefault() *cloudevents.Event
- func NewID() string
- type AddressableSpec
- type Binding
- type CreateSender
- type DefaultNamespace
- type FieldSpec
- type KnPluginOptions
- type KubeconfigOptions
- type Properties
- type Sender
- type Spec
- type Target
- type TargetType
Constants ¶
const (
// DefaultType holds a default type for a event.
DefaultType = "dev.knative.cli.plugin.event.generic"
)
Variables ¶
var ( // ErrCantMarshalAsJSON is returned if given CE data can't be marshalled // as JSON. ErrCantMarshalAsJSON = errors.New("can't marshal as JSON") // ErrCantSetField is returned if given field can't be applied. ErrCantSetField = errors.New("can't set field") )
var ErrCantSentEvent = errors.New("can't sent event")
ErrCantSentEvent if event can't be sent.
var ErrUnexpected = errors.New("unexpected")
ErrUnexpected if unexpected error found.
Functions ¶
func CreateFromSpec ¶
func CreateFromSpec(spec *Spec) (*cloudevents.Event, error)
CreateFromSpec will create an event by parsing given args.
Types ¶
type AddressableSpec ¶
AddressableSpec specify destination of a event to be sent, as well as sender namespace that should be used to create a sender Job in.
type Binding ¶
type Binding struct { CreateSender DefaultNamespace }
Binding holds injectable dependencies.
type CreateSender ¶
CreateSender creates a Sender.
type DefaultNamespace ¶
type DefaultNamespace func(props *Properties) (string, error)
DefaultNamespace returns a default namespace for connected K8s cluster or error is namespace can't be determined.
type FieldSpec ¶
type FieldSpec struct { Path string Value interface{} }
FieldSpec holds a specification of a event's data field.
type KnPluginOptions ¶
type KnPluginOptions struct {
KubeconfigOptions
}
KnPluginOptions holds options inherited to every Kn plugin.
type KubeconfigOptions ¶
KubeconfigOptions holds options for Kubernetes Client.
type Properties ¶
type Properties struct { KnPluginOptions Log *zap.SugaredLogger }
Properties holds a general properties.
type Sender ¶
type Sender interface { // Send will send cloudevents.Event to configured target, or return an error // if one occur. Send(ce cloudevents.Event) error }
Sender will send event to specified target.
type Target ¶
type Target struct { Type TargetType URLVal *url.URL AddressableVal *AddressableSpec *Properties }
Target is a target to send event to.
type TargetType ¶
type TargetType int
TargetType specify a type of a event target.
const ( // TargetTypeReachable specify a type of event target that is network // reachable, and direct HTTP communication can be performed. TargetTypeReachable TargetType = iota // TargetTypeAddressable represent a type of event target that is cluster // private, and direct communication can't be performed. In this case in // cluster sender Job will be created to send the event. TargetTypeAddressable )