events

package
v2.7.14 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CorrelationIDKey  = "Correlation-ID"
	SubscriptionIDKey = "Subscription-ID"
	ContentTypeKey    = "Content-Type"
	AcceptKey         = "Accept"
	EventTypeKey      = "Event-Type"
	SequenceNumberKey = "Sequence-Number"
	EventTimestampKey = "Event-Timestamp"
	EventSignatureKey = "Event-Signature"
	AcceptEncodingKey = "Accept-Encoding"
)

https://github.com/openconnectivityfoundation/cloud-services/blob/master/swagger2.0/oic.r.cloudapiforcloudservices.swagger.json

View Source
const ContentEncodingKey = "Content-Encoding"

Variables

View Source
var (
	ContentType_JSON       = message.AppJSON.String()
	ContentType_VNDOCFCBOR = message.AppOcfCbor.String()
)

Functions

func CalculateEventSignature

func CalculateEventSignature(secret, contentType string, eventType EventType, subscriptionID string, seqNum uint64, timeStamp time.Time, body []byte) string

Types

type Device

type Device struct {
	ID string `json:"di"`
}

type EventHeader

type EventHeader struct {
	CorrelationID   string
	ID              string
	ContentType     string
	EventType       EventType
	SequenceNumber  uint64
	EventTimestamp  time.Time
	EventSignature  string
	AcceptEncoding  []string
	ContentEncoding string
}

func ParseEventHeader

func ParseEventHeader(r *http.Request) (h EventHeader, _ error)

func (EventHeader) GetContentDecoder

func (h EventHeader) GetContentDecoder() (func(w []byte, v interface{}) error, error)

type EventType

type EventType string
const (
	// resource
	EventType_ResourceChanged EventType = "resource_contentchanged"

	// device
	EventType_ResourcesPublished   EventType = "resources_published"
	EventType_ResourcesUnpublished EventType = "resources_unpublished"

	// devices
	EventType_DevicesOnline       EventType = "devices_online"
	EventType_DevicesOffline      EventType = "devices_offline"
	EventType_DevicesRegistered   EventType = "devices_registered"
	EventType_DevicesUnregistered EventType = "devices_unregistered"

	// among all
	EventType_SubscriptionCanceled EventType = "subscription_cancelled"
)

https://github.com/openconnectivityfoundation/cloud-services/blob/master/swagger2.0/oic.r.cloudapiforcloudservices.swagger.json#/definitions/EventType

type EventTypes

type EventTypes []EventType

func (EventTypes) Has

func (e EventTypes) Has(ev EventType) bool

type ResourceChanged

type ResourceChanged []byte

type ResourcesPublished

type ResourcesPublished []schema.ResourceLink

type ResourcesUnpublished

type ResourcesUnpublished []schema.ResourceLink

Jump to

Keyboard shortcuts

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