Documentation
¶
Index ¶
- Constants
- func ComposeResourcePath(namespace string, items ...string) string
- func ComposeResourcePathRaw(items ...string) string
- func NewCloudEvent(eventSpec EventSpec, payload CloudEventsPayload) (event.Event, error)
- func ParseCloudEvent[PayloadType CloudEventsPayload](ev event.Event) (PayloadType, error)
- type CloudEventsPayload
- type EventName
- type EventSpec
- type EventSpecVersion
- type EventSubjectKind
- type EventSubsystem
- type EventTypeSpec
- type EventVersion
- type ParsedCloudEvent
Constants ¶
View Source
const ( EntityEntitlement = "entitlement" EntitySubjectKey = "subjectKey" EntityGrant = "grant" )
Entitlements
View Source
const (
EntityEvent = "event"
)
Ingestion/Events
Variables ¶
This section is empty.
Functions ¶
func ComposeResourcePath ¶
func ComposeResourcePathRaw ¶
func NewCloudEvent ¶
func NewCloudEvent(eventSpec EventSpec, payload CloudEventsPayload) (event.Event, error)
NewCloudEvent creates a new CloudEvent with the given event spec and payload example usage:
ev, err := CreateCloudEvent(EventSpec{ ID: "123", Source: "test", }, IngestEvent{...})
func ParseCloudEvent ¶
func ParseCloudEvent[PayloadType CloudEventsPayload](ev event.Event) (PayloadType, error)
ParseCloudEvent unmarshals and validates a single CloudEvent into the given payload example usage: ingest, err := ParseCloudEvent[schema.IngestEvent](ev)
Types ¶
type CloudEventsPayload ¶
type CloudEventsPayload interface { Spec() *EventTypeSpec Validate() error }
type EventSpec ¶
type EventSpec struct { // ID of the event ID string // Time specifies when the event occurred Time time.Time // Subject meta // Examples for source and subject pairs // grant: // source: //openmeter.io/namespace/<id>/entitlement/<id>/grant/<id> // subject: //openmeter.io/namespace/<id>/subject/<subjectID> // // entitlement: // source: //openmeter.io/namespace/<id>/entitlement/<id> // subject: //openmeter.io/namespace/<id>/subject/<subjectID> // // ingest: // source: //openmeter.io/namespace/<id>/event // subject: //openmeter.io/namespace/<id>/subject/<subjectID> Subject string Source string }
type EventSpecVersion ¶
type EventSpecVersion string
type EventSubjectKind ¶
type EventSubjectKind string
type EventSubsystem ¶
type EventSubsystem string
type EventTypeSpec ¶
type EventTypeSpec struct { // Subsystem defines which connector/component is responsible for the event (e.g. ingest, entitlements, etc) Subsystem EventSubsystem // Type is the actual event type (e.g. ingestion, flush, etc) Name EventName // Version is the version of the event (e.g. v1, v2, etc) Version EventVersion // contains filtered or unexported fields }
func (*EventTypeSpec) Type ¶
func (s *EventTypeSpec) Type() string
type EventVersion ¶
type EventVersion string
type ParsedCloudEvent ¶
type ParsedCloudEvent[PayloadType CloudEventsPayload] struct { Event event.Event Payload PayloadType }
func ParseCloudEventFromBytes ¶
func ParseCloudEventFromBytes[PayloadType CloudEventsPayload](data []byte) (*ParsedCloudEvent[PayloadType], error)
Click to show internal directories.
Click to hide internal directories.