Added Notification management aligned with CloudEvents format#75
Added Notification management aligned with CloudEvents format#75
Conversation
Aligned with CloudEvents format
|
@akoshunyadi correct ! - fixed. |
Align with DG
bigludo7
left a comment
There was a problem hiding this comment.
Aligned with merged DG for event & subscriptions
@akoshunyadi @sachinvodafone
| requestBody: | ||
| required: true | ||
| content: | ||
| application/json: |
There was a problem hiding this comment.
We may need to use application/cloudevents+json as stated in
https://github.com/cloudevents/spec/blob/main/cloudevents/formats/json-format.md#3-envelope
There was a problem hiding this comment.
@jlurien Yes make sense.
I will apply.
Do you think we need to go on this detail in the design guideline document as well? I tend to think yes.
There was a problem hiding this comment.
yes, I think it will be useful to add this and maybe provide a template or artifact as example. I learned about this from some @patrice-conil 's PR indeed
Changed to
content:
application/cloudevents+json
bigludo7
left a comment
There was a problem hiding this comment.
Changed content: application/json to content: application/cloudevents+json for alignement with CloudEvents specification
| summary: 'Create a device status event subscription for a device' | ||
| description: Create a device status event subscription for a device | ||
| operationId: createDevicStatusEventSubscription | ||
| operationId: createDevicStatusSubscription |
There was a problem hiding this comment.
typo:
createDeviceStatusSubscription
| - id | ||
| - source | ||
| - specversion | ||
| - type |
There was a problem hiding this comment.
"time" is missing as required.
See Commonalities:
Note: Attribute time is tagged as optional in CloudEvents specification but from CAMARA perspective we mandate to value this attributes.
https://github.com/camaraproject/Commonalities/blob/main/documentation/API-design-guidelines.md#event-notification-definition
| roaming: true | ||
| countryCode: 208 | ||
| countryName: FR | ||
| roaming: true |
There was a problem hiding this comment.
As per the document, it's mentioned that "The event subscription identifier must have a value when dealing with Resource-based subscriptions." So we should include the "subscriptionId" in the callback response if it's relevant or applicable in that context.
Took into account team review requests
bigludo7
left a comment
There was a problem hiding this comment.
Took @maxl2287 and @sachinvodafone review comments into account;
Thanks for the review.
|
|
||
| API consumer is able to verify whether a certain user device is in roaming situation (or not). This capability is provided in 2 ways: | ||
| - via direct request with the roaming situation in the response. | ||
| - via a subscription request - in this case the roaming situation is not in the response but event notification is sent back to the event subscriber when roaming situation change. |
There was a problem hiding this comment.
Typo: change => changed or has changed
|
|
||
| ## Device status subscription | ||
|
|
||
| Theses endpoints allow to manage event subscription on roaming device status event. |
There was a problem hiding this comment.
Typo: theses => these
| - ``org.camaraproject.device-status.v0.roaming-change-country``: Event triggered when the device in roaming change country code | ||
|
|
||
| Note: Additionnally to these list, ``org.camaraproject.device-status.v0.subscription-ends`` notification `type` is sent when the subscription ends. | ||
| This notification did not requires dedicated subscription. |
There was a problem hiding this comment.
Typo: did not requires => does not require
| schema: | ||
| $ref: "#/components/schemas/CloudEvent" | ||
| examples: | ||
| ROAMING_STATUS: |
There was a problem hiding this comment.
Do we want to keep these old constants, since they are not used for the type?
There was a problem hiding this comment.
I've changed the constant name to be closer to the type but I kept only the significant part;
| type: string | ||
| description: | | ||
| ROAMING_STATUS - Event triggered when the device switch from roaming ON to roaming OFF and conversely | ||
| roaming-status - Event triggered when the device switch from roaming ON to roaming OFF and conversely |
There was a problem hiding this comment.
I think it would be better to use SubscriptionType or SubscriptionEventType instead of RoamingEventType.
- to better distinguish between subscription event type and notification event type
- as a preparation for other type of events
|
|
||
| EventRoamingOff: | ||
| description: event structure for roaming on and roaming off change | ||
| description: event structure for roaming on and roaming off change |
There was a problem hiding this comment.
This is only for roaming off
| RoamingStatus: | ||
| description: Event detail structure for ROAMING_STATUS event | ||
| type : object | ||
| type: object |
There was a problem hiding this comment.
There is no ROAMING_STATUS event anymore
| RoamingChange: | ||
| description: Event detail structure for ROAMING_ON & ROAMING_OFF event | ||
| type : object | ||
| type: object |
There was a problem hiding this comment.
There are no ROAMING_ON and ROAMING_OFF events anymore
| SubscriptionEnds: | ||
| description: Event detail structure for SUBSCRIPTION_ENDS event | ||
| type : object | ||
| type: object |
There was a problem hiding this comment.
There is no SUBSCRIPTION_ENDS event
| RoamingChangeCountry: | ||
| description: Event detail structure for ROAMING_CHANGE_COUNTRY event | ||
| type : object | ||
| type: object |
There was a problem hiding this comment.
There is no ROAMING_CHANGE_COUNTRY event
Took into account @akoshunyadi review comments.
bigludo7
left a comment
There was a problem hiding this comment.
Took into account @akoshunyadi review comments.
| schema: | ||
| $ref: "#/components/schemas/CloudEvent" | ||
| examples: | ||
| ROAMING_STATUS: |
There was a problem hiding this comment.
I've changed the constant name to be closer to the type but I kept only the significant part;
fernandopradocabrillo
left a comment
There was a problem hiding this comment.
@bigludo7
Sorry I didn't review before. I leave here a comment regarding the scopes. This is a topic that was raised in Sim swap too, regarding in terms of privacy what scopes should we use for each operation. For example, I might be able to read the roaming status but maybe not to create a subscription, but on the other hand, I should not be able to create a subscription if I don't have permission to read the roaming status
| - device-status:roaming:read | ||
| - device-status:roaming-event-subscriptions:create |
There was a problem hiding this comment.
How are we going to manage the scopes for the subscriptions? I can see that we have an scope for creating subscriptions but I think we are missing an additional scope to delete subscriptions too. And, in order to retrieve the available subscriptions, are we going to use the same scope as we use to read the roaming status?
| - device-status:roaming:read | |
| - device-status:roaming-event-subscriptions:create | |
| - device-status:roaming:read | |
| - device-status:roaming-event-subscriptions:read | |
| - device-status:roaming-event-subscriptions:create | |
| - device-status:roaming-event-subscriptions:delete |
Whether we decide to use specific scopes or not, we should use the security property for each individual operation because right now, using the global property some operations don't have a correct scope. For example we have a create scope for a delete operation:
| $ref: '#/components/responses/Generic503' | ||
| /event-subscriptions/{eventSubscriptionId}: | ||
| $ref: "#/components/responses/Generic503" | ||
| /subscriptions/{subscriptionId}: |
There was a problem hiding this comment.
It seems, we have missed to define valid security scope for get/delete subscription operation
| 503: | ||
| $ref: '#/components/responses/Generic503' | ||
| $ref: "#/components/responses/Generic503" | ||
| get: |
There was a problem hiding this comment.
No valid security scope to "list" subscriptions (get operation)
| $ref: '#/components/schemas/RoamingStatusResponse' | ||
| $ref: "#/components/schemas/RoamingStatusResponse" | ||
| examples: | ||
| No-Country-Code: |
Updated following @sachinvodafone and @fernandopradocabrillo review
bigludo7
left a comment
There was a problem hiding this comment.
Updated following @sachinvodafone and @fernandopradocabrillo review
bigludo7
left a comment
There was a problem hiding this comment.
Fixed typo for error 500 (Thanks @sachinvodafone )
Added 202 for GET /subscriptions/{subscriptionId} as suggested by @sachinvodafone
bigludo7
left a comment
There was a problem hiding this comment.
Added 202 for GET /subscriptions/{subscriptionId} as suggested by @sachinvodafone
|
Thanks @sachinvodafone for the approval; |
| operationId: createDeviceStatusSubscription | ||
| security: | ||
| - openId: | ||
| - device-status:roaming-subscriptions:create |
There was a problem hiding this comment.
It is a generic operation to create a subscription as the endpoint, description, operationId say, so I think also the scope shouldn't contain "roaming".
Similar for other subscription operations too.
There was a problem hiding this comment.
@akoshunyadi Yes make sense. Fixed. I've kept device-status as prefix.
Remove 202 for GET following @fernandopradocabrillo comment. Rename scope Following @akoshunyadi comment
There was a problem hiding this comment.
Remove 202 for GET following @fernandopradocabrillo comment.
Rename scope for subscription operation following @akoshunyadi comment
OK! |
Co-authored-by: Rafal Artych <121048129+rartych@users.noreply.github.com>
Co-authored-by: Rafal Artych <121048129+rartych@users.noreply.github.com>
Co-authored-by: Rafal Artych <121048129+rartych@users.noreply.github.com>
Co-authored-by: Rafal Artych <121048129+rartych@users.noreply.github.com>
Co-authored-by: Rafal Artych <121048129+rartych@users.noreply.github.com>
Co-authored-by: Rafal Artych <121048129+rartych@users.noreply.github.com>
Co-authored-by: Rafal Artych <121048129+rartych@users.noreply.github.com>





What type of PR is this?
What this PR does / why we need it:
Aligned with CloudEvents format as defined in Commonalities here: camaraproject/Commonalities#56
Which issue(s) this PR fixes:
Fixes #74 #57
Special notes for reviewers:
Changelog input
Additional documentation
This section can be blank.