Documentation ¶
Overview ¶
Package cloudevents provides a cloudevents handler publishing the event using the go-micro/client
Index ¶
Constants ¶
View Source
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" )
Variables ¶
View Source
var (
Handler = "cloudevents"
)
Functions ¶
Types ¶
type Event ¶
type Event struct { EventType string `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 map[string]interface{} `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.
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.
Click to show internal directories.
Click to hide internal directories.