Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
180 changes: 10 additions & 170 deletions code/API_definitions/device-media-streaming-rate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ info:

The list of error codes in this API specification is not exhaustive. Therefore the API specification MAY not document some non-mandatory error statuses as indicated in `CAMARA API Design Guide`.

Please refer to the `CAMARA_common.yaml` of the Commonalities Release associated to this API version for a complete list of error responses. The applicable Commonalities Release can be identified in the `API Readiness Checklist` document associated to this API version.
Please refer to the `CAMARA_common.yaml` of the Commonalities Release associated to this API version for a complete list of error responses. The applicable Commonalities Release can be identified from the `x-camara-commonalities` field, the changelog and the metadata of the released API version.

As a specific rule, error `501 - NOT_IMPLEMENTED` can be only a possible error response if it is explicitly documented in the API.
<!-- CAMARA:MANDATORY:additional-error-responses:END -->
Expand Down Expand Up @@ -154,176 +154,25 @@ paths:
schema:
$ref: "#/components/schemas/DeviceMediaStreamingRateResponse"
"400":
$ref: "#/components/responses/Generic400"
$ref: "../common/CAMARA_common.yaml#/components/responses/BadRequest400"
"401":
$ref: "#/components/responses/Generic401"
$ref: "../common/CAMARA_common.yaml#/components/responses/Unauthenticated401"
"403":
$ref: "#/components/responses/Generic403"
$ref: "../common/CAMARA_common.yaml#/components/responses/PermissionDenied403"
"404":
$ref: "#/components/responses/Generic404"
$ref: "../common/CAMARA_common.yaml#/components/responses/IdentifierNotFound404"
"422":
$ref: "#/components/responses/Generic422"
$ref: "../common/CAMARA_common.yaml#/components/responses/DeviceIdentifier422"
"429":
$ref: "#/components/responses/Generic429"
$ref: "#/components/responses/DeviceMediaStreamingRateTooManyRequests429"

components:
securitySchemes:
openId:
$ref: "../common/CAMARA_common.yaml#/components/securitySchemes/openId"

responses:
Generic400:
description: Bad Request
headers:
x-correlator:
$ref: "../common/CAMARA_common.yaml#/components/headers/x-correlator"
content:
application/json:
schema:
allOf:
- $ref: "../common/CAMARA_common.yaml#/components/schemas/ErrorInfo"
- type: object
properties:
status:
enum:
- 400
code:
enum:
- INVALID_ARGUMENT
examples:
GENERIC_400_INVALID_ARGUMENT:
description: Invalid Argument. Generic Syntax Exception
value:
status: 400
code: INVALID_ARGUMENT
message: Client specified an invalid argument, request body or query param.

Generic401:
description: Unauthorized
headers:
x-correlator:
$ref: "../common/CAMARA_common.yaml#/components/headers/x-correlator"
content:
application/json:
schema:
allOf:
- $ref: "../common/CAMARA_common.yaml#/components/schemas/ErrorInfo"
- type: object
properties:
status:
enum:
- 401
code:
enum:
- UNAUTHENTICATED
examples:
GENERIC_401_UNAUTHENTICATED:
description: Request cannot be authenticated and a new authentication is required
value:
status: 401
code: UNAUTHENTICATED
message: Request not authenticated due to missing, invalid, or expired credentials. A new authentication is required.

Generic403:
description: Forbidden
headers:
x-correlator:
$ref: "../common/CAMARA_common.yaml#/components/headers/x-correlator"
content:
application/json:
schema:
allOf:
- $ref: "../common/CAMARA_common.yaml#/components/schemas/ErrorInfo"
- type: object
properties:
status:
enum:
- 403
code:
enum:
- PERMISSION_DENIED
examples:
GENERIC_403_PERMISSION_DENIED:
description: Permission denied. OAuth2 token access does not have the required scope or when the user fails operational security
value:
status: 403
code: PERMISSION_DENIED
message: Client does not have sufficient permissions to perform this action.

Generic404:
description: Not found
headers:
x-correlator:
$ref: "../common/CAMARA_common.yaml#/components/headers/x-correlator"
content:
application/json:
schema:
allOf:
- $ref: "../common/CAMARA_common.yaml#/components/schemas/ErrorInfo"
- type: object
properties:
status:
enum:
- 404
code:
enum:
- IDENTIFIER_NOT_FOUND
examples:
GENERIC_404_IDENTIFIER_NOT_FOUND:
description: Some identifier cannot be matched to a device
value:
status: 404
code: IDENTIFIER_NOT_FOUND
message: Device identifier not found.

Generic422:
description: Unprocessable Content
headers:
x-correlator:
$ref: "../common/CAMARA_common.yaml#/components/headers/x-correlator"
content:
application/json:
schema:
allOf:
- $ref: "../common/CAMARA_common.yaml#/components/schemas/ErrorInfo"
- type: object
properties:
status:
enum:
- 422
code:
enum:
- SERVICE_NOT_APPLICABLE
- MISSING_IDENTIFIER
- UNSUPPORTED_IDENTIFIER
- UNNECESSARY_IDENTIFIER
examples:
GENERIC_422_SERVICE_NOT_APPLICABLE:
description: Service not applicable for the provided identifier
value:
status: 422
code: SERVICE_NOT_APPLICABLE
message: The service is not available for the provided identifier.
GENERIC_422_MISSING_IDENTIFIER:
description: An identifier is not included in the request and the device identification cannot be derived from the 3-legged access token
value:
status: 422
code: MISSING_IDENTIFIER
message: The device cannot be identified.
GENERIC_422_UNSUPPORTED_IDENTIFIER:
description: None of the provided identifiers is supported by the implementation
value:
status: 422
code: UNSUPPORTED_IDENTIFIER
message: The identifier provided is not supported.
GENERIC_422_UNNECESSARY_IDENTIFIER:
description: An explicit identifier is provided when a device has already been identified from the access token
value:
status: 422
code: UNNECESSARY_IDENTIFIER
message: The device is already identified by the access token.

Generic429:
DeviceMediaStreamingRateTooManyRequests429:
description: Too Many Requests
headers:
x-correlator:
Expand All @@ -344,18 +193,9 @@ components:
- TOO_MANY_REQUESTS
examples:
GENERIC_429_QUOTA_EXCEEDED:
description: Request is rejected due to exceeding a business quota limit
value:
status: 429
code: QUOTA_EXCEEDED
message: Out of resource quota.
$ref: "../common/CAMARA_common.yaml#/components/examples/GENERIC_429_QUOTA_EXCEEDED"
GENERIC_429_TOO_MANY_REQUESTS:
description: Access to the API has been temporarily blocked due to rate or spike arrest limits being reached
value:
status: 429
code: TOO_MANY_REQUESTS
message: Rate limit reached.

$ref: "../common/CAMARA_common.yaml#/components/examples/GENERIC_429_TOO_MANY_REQUESTS"
schemas:
DeviceMediaStreamingRateRequest:
type: object
Expand Down
36 changes: 32 additions & 4 deletions code/Test_definitions/device-media-streaming-rate.feature
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ Feature: CAMARA Device Media Streaming Rate API, vwip - Operation retrieveMaximu
Then the response status code is 422
And the response property "$.status" is 422
And the response property "$.code" is "UNNECESSARY_IDENTIFIER"
And the response property "$.message" contains a user friendly text
And the response property "$.message" contains a user-friendly text

@device_media_streaming_rate_C01.05_missing_device
Scenario: Device not included and cannot be deduced from the access token
Expand All @@ -171,7 +171,7 @@ Feature: CAMARA Device Media Streaming Rate API, vwip - Operation retrieveMaximu
Then the response status code is 422
And the response property "$.status" is 422
And the response property "$.code" is "MISSING_IDENTIFIER"
And the response property "$.message" contains a user friendly text
And the response property "$.message" contains a user-friendly text

@device_media_streaming_rate_C01.06_unsupported_device
Scenario: None of the provided device identifiers is supported by the implementation
Expand All @@ -182,7 +182,7 @@ Feature: CAMARA Device Media Streaming Rate API, vwip - Operation retrieveMaximu
Then the response status code is 422
And the response property "$.status" is 422
And the response property "$.code" is "UNSUPPORTED_IDENTIFIER"
And the response property "$.message" contains a user friendly text
And the response property "$.message" contains a user-friendly text

# When the service is only offered to certain types of devices or subscriptions, e.g. IoT, B2C, etc.
@device_media_streaming_rate_C01.07_device_not_supported
Expand All @@ -193,7 +193,7 @@ Feature: CAMARA Device Media Streaming Rate API, vwip - Operation retrieveMaximu
Then the response status code is 422
And the response property "$.status" is 422
And the response property "$.code" is "SERVICE_NOT_APPLICABLE"
And the response property "$.message" contains a user friendly text
And the response property "$.message" contains a user-friendly text

##########################
# 401 - Authentication errors
Expand Down Expand Up @@ -242,3 +242,31 @@ Feature: CAMARA Device Media Streaming Rate API, vwip - Operation retrieveMaximu
And the response property "$.status" is 403
And the response property "$.code" is "PERMISSION_DENIED"
And the response property "$.message" contains a user friendly text

##########################
# 429 - Too many requests
##########################

# To test this scenario the environment has to be configured to reject requests reaching the threshold limit set.
@device_media_streaming_rate_429.1_too_many_requests
Scenario: Request is rejected due to threshold policy
Given a valid request for "retrieveMaximumDownstreamMediaRate"
And the header "Authorization" is set to a valid access token
And the threshold of requests has been reached
When the request "retrieveMaximumDownstreamMediaRate" is sent
Then the response status code is 429
And the response property "$.status" is 429
And the response property "$.code" is "TOO_MANY_REQUESTS"
And the response property "$.message" contains a user friendly text

# To test this scenario the environment has to be configured with a business quota for the API consumer that has been exhausted.
@device_media_streaming_rate_429.2_quota_exceeded
Scenario: Request is rejected due to exceeded business quota
Given a valid request for "retrieveMaximumDownstreamMediaRate"
And the header "Authorization" is set to a valid access token
And the business quota for the API consumer has been exceeded
When the request "retrieveMaximumDownstreamMediaRate" is sent
Then the response status code is 429
And the response property "$.status" is 429
And the response property "$.code" is "QUOTA_EXCEEDED"
And the response property "$.message" contains a user friendly text
Loading