Documentation ¶
Index ¶
- Constants
- type ErrAuthorizerDoesNotExists
- type ErrEventTypeAlreadyExists
- type ErrEventTypeHasSubscriptions
- type ErrEventTypeNotFound
- type ErrEventTypeValidation
- type ErrParsingCloudEvent
- type Event
- type HTTPRequestData
- type Service
- type SystemEventReceivedData
- type SystemFunctionInvocationFailedData
- type SystemFunctionInvokedData
- type SystemFunctionInvokingData
- type Type
- type TypeName
- type Types
Constants ¶
const ( // TransformationVersion is indicative of the revision of how Event Gateway transforms a request into CloudEvents format. TransformationVersion = "0.1" // CloudEventsVersion currently supported by Event Gateway CloudEventsVersion = "0.1" )
const SystemEventReceivedType = TypeName("eventgateway.event.received")
SystemEventReceivedType is a system event emitted when the Event Gateway receives an event.
const SystemFunctionInvocationFailedType = TypeName("eventgateway.function.invocationFailed")
SystemFunctionInvocationFailedType is a system event emitted after successful function invocation.
const SystemFunctionInvokedType = TypeName("eventgateway.function.invoked")
SystemFunctionInvokedType is a system event emitted after successful function invocation.
const SystemFunctionInvokingType = TypeName("eventgateway.function.invoking")
SystemFunctionInvokingType is a system event emitted before invoking a function.
const ( // TypeHTTPRequest is a special type of event HTTP requests that are not CloudEvents. TypeHTTPRequest = TypeName("http.request") )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrAuthorizerDoesNotExists ¶
type ErrAuthorizerDoesNotExists struct{}
ErrAuthorizerDoesNotExists occurs when there authorizer function doesn't exists.
func (ErrAuthorizerDoesNotExists) Error ¶
func (e ErrAuthorizerDoesNotExists) Error() string
type ErrEventTypeAlreadyExists ¶
type ErrEventTypeAlreadyExists struct {
Name TypeName
}
ErrEventTypeAlreadyExists occurs when event type with specified name already exists.
func (ErrEventTypeAlreadyExists) Error ¶
func (e ErrEventTypeAlreadyExists) Error() string
type ErrEventTypeHasSubscriptions ¶
type ErrEventTypeHasSubscriptions struct{}
ErrEventTypeHasSubscriptions occurs when there are subscription for the event type.
func (ErrEventTypeHasSubscriptions) Error ¶
func (e ErrEventTypeHasSubscriptions) Error() string
type ErrEventTypeNotFound ¶
type ErrEventTypeNotFound struct {
Name TypeName
}
ErrEventTypeNotFound occurs when event type cannot be found.
func (ErrEventTypeNotFound) Error ¶
func (e ErrEventTypeNotFound) Error() string
type ErrEventTypeValidation ¶
type ErrEventTypeValidation struct {
Message string
}
ErrEventTypeValidation occurs when event type payload doesn't validate.
func (ErrEventTypeValidation) Error ¶
func (e ErrEventTypeValidation) Error() string
type ErrParsingCloudEvent ¶
type ErrParsingCloudEvent struct {
Message string
}
ErrParsingCloudEvent occurs when payload is not valid CloudEvent.
func (ErrParsingCloudEvent) Error ¶
func (e ErrParsingCloudEvent) Error() string
type Event ¶
type Event struct { EventType TypeName `json:"eventType" validate:"required"` EventTypeVersion string `json:"eventTypeVersion,omitempty"` CloudEventsVersion string `json:"cloudEventsVersion" validate:"required"` Source string `json:"source" validate:"uri,required"` EventID string `json:"eventID" validate:"required"` EventTime *time.Time `json:"eventTime,omitempty"` SchemaURL string `json:"schemaURL,omitempty"` Extensions zap.MapStringInterface `json:"extensions,omitempty"` ContentType string `json:"contentType,omitempty"` Data interface{} `json:"data"` }
Event is a default event structure. All data that passes through the Event Gateway is formatted to a format defined CloudEvents v0.1 spec.
func FromRequest ¶
FromRequest takes an HTTP request and returns an Event along with path. Most of the implementation is based on https://github.com/cloudevents/spec/blob/master/http-transport-binding.md. This function also supports legacy mode where event type is sent in Event header.
func (Event) MarshalLogObject ¶
func (e Event) MarshalLogObject(enc zapcore.ObjectEncoder) error
MarshalLogObject is a part of zapcore.ObjectMarshaler interface
type HTTPRequestData ¶
type HTTPRequestData struct { Headers map[string]string `json:"headers"` Query map[string][]string `json:"query"` Body interface{} `json:"body"` Host string `json:"host"` Path string `json:"path"` Method string `json:"method"` Params map[string]string `json:"params"` }
HTTPRequestData is a event schema used for sending events to HTTP subscriptions.
func NewHTTPRequestData ¶
func NewHTTPRequestData(r *http.Request, eventData interface{}) *HTTPRequestData
NewHTTPRequestData returns a new instance of HTTPRequestData
type Service ¶
type Service interface { GetEventType(space string, name TypeName) (*Type, error) ListEventTypes(space string, filters ...metadata.Filter) (Types, error) CreateEventType(eventType *Type) (*Type, error) UpdateEventType(newEventType *Type) (*Type, error) DeleteEventType(space string, name TypeName) error }
Service represents service for managing event types.
type SystemEventReceivedData ¶
type SystemEventReceivedData struct { Path string `json:"path"` Event Event `json:"event"` Headers map[string]string `json:"headers"` }
SystemEventReceivedData struct.
type SystemFunctionInvocationFailedData ¶
type SystemFunctionInvocationFailedData struct { Space string `json:"space"` FunctionID function.ID `json:"functionId"` Event Event `json:"event"` Error error `json:"error"` }
SystemFunctionInvocationFailedData struct.
type SystemFunctionInvokedData ¶
type SystemFunctionInvokedData struct { Space string `json:"space"` FunctionID function.ID `json:"functionId"` Event Event `json:"event"` Result []byte `json:"result"` }
SystemFunctionInvokedData struct.
type SystemFunctionInvokingData ¶
type SystemFunctionInvokingData struct { Space string `json:"space"` FunctionID function.ID `json:"functionId"` Event Event `json:"event"` }
SystemFunctionInvokingData struct.
type Type ¶
type Type struct { Space string `json:"space" validate:"required,min=3,space"` Name TypeName `json:"name" validate:"required"` AuthorizerID *function.ID `json:"authorizerId,omitempty"` Metadata metadata.Metadata `json:"metadata,omitempty"` }
Type is a registered event type.
func (Type) MarshalLogObject ¶
func (t Type) MarshalLogObject(enc zapcore.ObjectEncoder) error
MarshalLogObject is a part of zapcore.ObjectMarshaler interface