Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Align event notification with CloudEvents spec #224

Merged
122 changes: 51 additions & 71 deletions code/API_definitions/qod-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ paths:
requestBody:
required: true
content:
application/json:
application/cloudevents+json:
schema:
$ref: "#/components/schemas/EventNotification"
$ref: "#/components/schemas/CloudEvent"
responses:
"204":
description: Successful notification
Expand Down Expand Up @@ -730,83 +730,53 @@ components:
- Gbps
- Tbps

EventNotification:
type: object
CloudEvent:
hdamker marked this conversation as resolved.
Show resolved Hide resolved
description: Event compliant with the CloudEvents specification
required:
- event
- id
- source
- specversion
- type
- time
properties:
event:
$ref: "#/components/schemas/Event"
eventSubscriptionId:
id:
description: Identifier of this event, that must be unique in the source context.
type: string
description: 'The ID of explicit subscription or none in case of implicit subscription'
example:
{
"event": {
"eventId": "5698d710-9b1b-4695-a958-7b228f08128c",
"eventType": "QOS_STATUS_CHANGED",
"eventTime": "2023-05-30T10:18:28Z",
"eventDetail": {
"sessionId": "7698d710-98b7-4695-a958-7b228f08128c",
"qosStatus": "UNAVAILABLE",
"statusInfo": "DURATION_EXPIRED"
}
}
}

Event:
description: The event being notified
type: object
required:
- eventType
- eventTime
properties:
eventId:
$ref: "#/components/schemas/EventId"
eventType:
$ref: "#/components/schemas/EventType"
eventTime:
$ref: "#/components/schemas/EventTime"
source:
description: Identifies the context in which an event happened in the specific Provider Implementation.
type: string
format: uri-reference
type:
description: The type of the event.
type: string
enum:
- 'org.camaraproject.qod.v0.qos-status-changed'
specversion:
description: Version of the specification to which this event conforms (must be 1.0 if it conforms to cloudevents 1.0.2 version)
type: string
enum:
- '1.0'
datacontenttype:
description: 'media-type that describes the event payload encoding, must be "application/json" for CAMARA APIs'
type: string
enum:
- 'application/json'
time:
description: |
Timestamp of when the occurrence happened. It must follow RFC 3339
type: string
format: date-time
discriminator:
propertyName: eventType
propertyName: 'type'
mapping:
QOS_STATUS_CHANGED: "#/components/schemas/QosStatusChangedEvent"
example:
hdamker marked this conversation as resolved.
Show resolved Hide resolved
{
"eventId": "5698d710-9b1b-4695-a958-7b228f08128c",
"eventType": "QOS_STATUS_CHANGED",
"eventTime": "2023-05-30T10:18:28Z",
"eventDetail": {
"sessionId": "7698d710-98b7-4695-a958-7b228f08128c",
"qosStatus": "UNAVAILABLE",
"statusInfo": "DURATION_EXPIRED"
}
}

EventId:
type: string
format: uuid
example: 5698d710-9b1b-4695-a958-7b228f08128c
description: Unique identifier of the event
org.camaraproject.qod.v0.qos-status-changed: '#/components/schemas/EventQosStatusChanged'

EventType:
type: string
enum:
- QOS_STATUS_CHANGED
description: Type of the event

EventTime:
type: string
format: date-time
example: 2023-05-30T10:18:28Z
description: Date time when the event occurred

QosStatusChangedEvent:
EventQosStatusChanged:
allOf:
- $ref: "#/components/schemas/Event"
- $ref: "#/components/schemas/CloudEvent"
- type: object
properties:
eventDetail:
data:
type: object
description: Event details depending on the event type
required:
Expand All @@ -820,7 +790,17 @@ components:
statusInfo:
$ref: "#/components/schemas/StatusInfo"
required:
- eventDetail
- data
example:
id: 83a0d986-0866-4f38-b8c0-fc65bfcda452
source: 'https://api.example.com/qod/v0/sessions/123e4567-e89b-12d3-a456-426614174000'
specversion: '1.0'
type: 'org.camaraproject.qod.v0.qos-status-changed'
time: '2021-12-12T00:00:00Z'
data:
sessionId: '123e4567-e89b-12d3-a456-426614174000'
qosStatus: 'UNAVAILABLE'
statusInfo: 'DURATION_EXPIRED'

StatusInfo:
description: |
Expand Down