Skip to content

Commit 91ab10b

Browse files
CloudEvent update
According to: camaraproject/Commonalities#345 (comment)
1 parent c8f11b1 commit 91ab10b

File tree

1 file changed

+113
-11
lines changed

1 file changed

+113
-11
lines changed

code/API_definitions/Traffic_Influence.yaml

+113-11
Original file line numberDiff line numberDiff line change
@@ -293,11 +293,12 @@ info:
293293
\
294294
**Notification:**
295295
Developers can specify a callback URL on which notifications
296-
regarding the requested intent can be received. For example to be notified
297-
when the requested optimal routing is active. It is also provided back
298-
the identificator for the selected EAS instace ("selected_appInstanceId")
299-
from which the Client Application can retrive the destination IP address
300-
of its backend server, to properly configure the service data flow. This
296+
regarding the requested intent can be received. The notification will be
297+
sent as a CloudEvent compliant message. For example to be notified when the
298+
requested optimal routing is active. It is also provided back the
299+
identificator for the selected EAS instace ("selected_appInstanceId")
300+
from which the Client Application can retrive the destination IP address of
301+
its backend server, to properly configure the service data flow. This
301302
information can be retrived using the CAMARA API: [Edge
302303
Application Management](https://github.com/camaraproject/EdgeCloud/blob\
303304
/main/code/API_definitions/Edge-Application-Management.yaml).
@@ -681,6 +682,11 @@ components:
681682
to the TrafficInfluence resource
682683
'traffic-influence:traffic-influences:update': Grants update
683684
access to the TrafficInfluence resource
685+
notificationsBearerAuth:
686+
description: Bearer authentication for notifications
687+
type: http
688+
scheme: bearer
689+
bearerFormat: "{$request.body#sinkCredential.credentialType}"
684690
parameters:
685691
x-correlator:
686692
name: x-correlator
@@ -698,9 +704,8 @@ components:
698704
#########################################################################
699705
callbacks:
700706
onTrafficInfluenceChanged:
701-
# when data is sent, it will be sent to the `callbackUrl` provided
702-
# when making the subscription PLUS the suffix `/event`
703-
'{$request.body.notificationUri}/event':
707+
# when data is sent, it will be sent to the callback url provided
708+
'{$request.body.notificationSink.sink}':
704709
post:
705710
tags:
706711
- Traffic Influence CALLBACK Operation
@@ -709,16 +714,18 @@ components:
709714
description: Creating, modifying or delating a Traffic Influece
710715
resourece is an asycronous task. For this reason a notification
711716
channel via callback to a specified URL is provided.
712-
operationId: postTrafficInfluence
717+
operationId: trafficInfluenceCloudEvent
713718
parameters:
714719
- $ref: '#/components/parameters/x-correlator'
720+
security:
721+
- notificationsBearerAuth: []
715722
requestBody:
716723
description: subscription payload which contains the updated
717724
traffic influence instance
718725
content:
719-
application/json:
726+
application/cloudevents+json:
720727
schema:
721-
$ref: '#/components/schemas/TrafficInfluenceNotification'
728+
$ref: '#/components/schemas/CloudEvent'
722729
responses:
723730
'202':
724731
description: Your server implementation should return this HTTP
@@ -820,6 +827,8 @@ components:
820827
readOnly: true
821828
state:
822829
readOnly: true
830+
notificationSink:
831+
$ref: '#/components/schemas/NotificationSink'
823832
PostTrafficInfluenceDevice:
824833
description: iherits from TrafficInfluence restricting the access
825834
(readonly) to "trafficInfluenceID" and "state", to be used by the API
@@ -833,6 +842,8 @@ components:
833842
readOnly: true
834843
state:
835844
readOnly: true
845+
notificationSink:
846+
$ref: '#/components/schemas/NotificationSink'
836847
PatchTrafficInfluence:
837848
description: inherits from TrafficInfluence and restricts the access to
838849
certain parameters.
@@ -848,6 +859,75 @@ components:
848859
readOnly: true
849860
state:
850861
readOnly: true
862+
notificationSink:
863+
$ref: '#/components/schemas/NotificationSink'
864+
CloudEvent:
865+
description: The notification callback
866+
required:
867+
- id
868+
- source
869+
- specversion
870+
- type
871+
- time
872+
properties:
873+
id:
874+
type: string
875+
description: identifier of this event, that must be unique in the source context.
876+
minLength: 1
877+
source:
878+
$ref: '#/components/schemas/Source'
879+
type:
880+
type: string
881+
description: 'type of event as defined in each CAMARA API'
882+
example: 'org.camaraproject.iot.dta-status-changed-event'
883+
minLength: 25
884+
specversion:
885+
type: string
886+
description: Version of the specification to which this event conforms (must be 1.0 if it conforms to cloudevents 1.0.2 version)
887+
enum:
888+
- "1.0"
889+
datacontenttype:
890+
type: string
891+
description: 'media-type that describes the event payload encoding, must be "application/json" for CAMARA APIs'
892+
enum:
893+
- application/json
894+
data:
895+
type: object
896+
description: Event details payload described in each CAMARA API and referenced by its type
897+
allOf:
898+
- $ref: '#/components/schemas/TrafficInfluenceNotification'
899+
time:
900+
$ref: "#/components/schemas/DateTime"
901+
NotificationSink:
902+
description: ""
903+
type: object
904+
required:
905+
- sink
906+
properties:
907+
sink:
908+
description: 'https callback address where the notification must be POST-ed'
909+
type: string
910+
sinkCredentials:
911+
description: Sink credential provides authorization information necessary to enable delivery of events to a target
912+
type: object
913+
properties:
914+
credentialtype:
915+
type: string
916+
description: Type of the credential - MUST be set to ACCESSTOKEN for now
917+
enum:
918+
- "ACCESSTOKEN"
919+
accessToken:
920+
type: string
921+
description: Access Token granting access to the POST operation to create notification
922+
accessTokenExpireUtc:
923+
type: string
924+
format: date-time
925+
description: An absolute UTC instant at which the access token shall be considered expired.
926+
accessTokenType:
927+
type: string
928+
description: Type of access token - MUST be set to bearer for now
929+
enum:
930+
- "bearer"
851931
TrafficInfluenceNotification:
852932
type: object
853933
description: Notifican channel for changes in the TrafficInfluence
@@ -859,6 +939,28 @@ components:
859939
properties:
860940
selected_appInstanceId:
861941
$ref: '#/components/schemas/AppInstanceId'
942+
DateTime:
943+
type: string
944+
format: date-time
945+
description: |
946+
Timestamp of when the occurrence happened. Must adhere to RFC 3339.
947+
WARN: This optional field in CloudEvents specification is required in CAMARA APIs implementation.
948+
example: '2018-04-05T17:31:00Z'
949+
Source:
950+
type: string
951+
format: uri-reference
952+
minLength: 1
953+
description: |
954+
Identifies the context in which an event happened - be a non-empty `URI-reference` like:
955+
- URI with a DNS authority:
956+
* https://github.com/cloudevents
957+
958+
- Universally-unique URN with a UUID:
959+
* urn:uuid:6e8bc430-9c3a-11d9-9669-0800200c9a66
960+
- Application-specific identifier:
961+
* /cloudevents/spec/pull/123
962+
* 1-555-123-4567
963+
example: "https://notificationSendServer12.supertelco.com"
862964
########################################################################
863965
# Types #
864966
########################################################################

0 commit comments

Comments
 (0)