Skip to content
79 changes: 79 additions & 0 deletions code/API_definitions/Edge-Application-Management.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,8 @@ paths:
$ref: '#/components/schemas/EdgeCloudZoneId'
kubernetesClusterRef:
$ref: '#/components/schemas/KubernetesClusterRef'
notificationSink:
$ref: '#/components/schemas/NotificationSink'
required: true
responses:
'202':
Expand Down Expand Up @@ -434,6 +436,9 @@ paths:
$ref: '#/components/responses/501'
'503':
$ref: '#/components/responses/503'
callbacks:
onAppInstanceStatusChange:
$ref: '#/components/callbacks/onAppInstanceStatusChange'
get:
security:
- openId:
Expand Down Expand Up @@ -679,6 +684,42 @@ components:
schema:
type: string
format: uuid
#########################################################################
# Events/Callbacks #
#########################################################################
callbacks:
onAppInstanceStatusChange:
'{$request.body.notificationSink.sink}':
post:
tags:
- App Instance CALLBACK Operation
summary: Provide a notification for a change in status
of the instantiated application
description: Instantiating an application is an asyncronous task. After the
application has been started, the server will return a callback response
at the specified URL.
operationId: EdgeApplicationManagementCallback
parameters:
- $ref: '#/components/parameters/x-correlator'
security:
- notificationsBearerAuth: []
requestBody:
description: Body containing the status of the Application
required: true
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/AppInstanceInfo'
responses:
'202':
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @travishepworth ,

Some comments from my side. According to Commonalities (https://github.com/camaraproject/Commonalities/blob/main/documentation/CAMARA-API-Event-Subscription-and-Notification-Guide.md), the expected response code for notifications is 204 instead of 202.

In addition to that, some errors are also mandatory to be included on any notifications. The Following Error codes must be present:

  • for POST: 400, 401, 403, 410, 429

I recommend that we use the template available at Commonalities repo: https://github.com/camaraproject/Commonalities/blob/main/artifacts/camara-cloudevents/event-subscription-template.yaml

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, I can start looking at implementing based off the template and the missing codes.

description: Your server implementation should return this HTTP
status code if the data was received successfully
content: {}
headers:
x-correlator:
$ref: '#/components/headers/x-correlator'

schemas:
AccessEndpoint:
Expand Down Expand Up @@ -1163,6 +1204,44 @@ components:
- vfio-pci
- interface

NotificationSink:
description: ""
type: object
required:
- sink
properties:
sink:
description: 'https callback address where the notification
must be POST-ed'
type: string
format: uri
sinkCredentials:
description: Sink credential provides authorization information
necessary to enable delivery of events to a target
type: object
properties:
credentialtype:
type: string
description: Type of the credential - MUST be set to
ACCESSTOKEN for now
enum:
- "ACCESSTOKEN"
accessToken:
type: string
description: Access Token granting access to the POST
operation to create notification
accessTokenExpireUtc:
type: string
format: date-time
description: An absolute UTC instant at which the access
token shall be considered expired.
accessTokenType:
type: string
description: Type of access token - MUST be set to bearer
for now
enum:
- "bearer"

AdditionalStorage:
description: Additional storage for the application.
type: array
Expand Down