Skip to content

Commit

Permalink
Proposal for a way to handle multiple concurrent activations (#15)
Browse files Browse the repository at this point in the history
* Proposal for a way to handle multiple concurrent activations with supporting docs
  • Loading branch information
simonrankine committed Dec 20, 2018
1 parent 42104fd commit c5bde50
Show file tree
Hide file tree
Showing 17 changed files with 342 additions and 162 deletions.
60 changes: 32 additions & 28 deletions APIs/ChannelMappingAPI.raml
Expand Up @@ -38,47 +38,51 @@ documentation:
200:
body:
example: !include ../examples/map/map-root-get-200.json
/staged:
displayName: Staged mapping table
/activations:
displayName: Activation resource
get:
responses:
200:
body:
example: !include ../examples/map/map-tables-get-200.json
type: !include schemas/map-tables-response-schema.json
patch:
example: !include ../examples/map/map-activations-get-200.json
type: !include schemas/map-activations-get-response-schema.json
post:
body:
example: !include ../examples/map/map-staged-patch-activate-immediate.json
type: !include schemas/map-tables-request-schema.json
responses:
type: !include schemas/map-activations-request-schema.json
example: !include ../examples/map/map-activations-post.json
responses:
200:
body:
example: !include ../examples/map/map-staged-patch-200.json
type: !include schemas/map-tables-response-schema.json
type: !include schemas/map-activations-post-response-schema.json
example: !include ../examples/map/map-activations-post-200.json
400:
body:
type: !include schemas/error.json
example: !include ../examples/map/map-tables-patch-400.json
example: !include ../examples/map/map-activations-post-400.json
423:
description: >
Returned when the resource is locked because an activation has been scheduled.
A resource may be unlocked by setting `mode` in `activation` to `null`, which
will cancel the pending activation. This may be done in the same request as a change
to other parameters.
body:
type: !include schemas/error.json
example: !include ../examples/map/map-tables-patch-423.json
500:
body:
type: !include schemas/error.json
example: !include ../examples/map/map-tables-patch-500.json
404:
description: Returned when the requested resource does not exist
options:
description: A pre-flight check generally used for Cross-Origin Resource Sharing (CORS) purposes
responses:
200:
403:
example: !include ../examples/map/map-activations-post-423.json
/{activation-id}:
displayName: Individual activation resource
get:
responses:
200:
body:
example: !include ../examples/map/map-activation-activationid-get-200.json
type: !include schemas/map-activations-activationid-get-response-schema.json
404:
description: Could not find the requested resource
delete:
responses:
204:
description: Resource deleted successfully
400:
body:
type: !include schemas/error.json
example: !include ../examples/map/map-activation-activationid-delete-400.json
404:
description: Could not find the requested resource
/active:
displayName: Active mapping resource
get:
Expand Down
43 changes: 43 additions & 0 deletions APIs/schemas/map-activations-activationid-get-response-schema.json
@@ -0,0 +1,43 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Single activation endpoint",
"description": "A single pending activation",
"type": "object",
"additionalPropertes": false,
"properties": {
"activation":{
"$ref": "activation-response-schema.json"
},
"action:":{
"^[a-z A-Z 0-9 \\- _]+$": {
"description": "Names of outputs",
"patternProperties":{
"^(0|([1-9][0-9]*))$":{
"description": "Index of channels",
"required":[
"input",
"channel_index"
],
"properties": {
"input":{
"description": "Name of the input the channel to be connected belongs to. null for disconnected.",
"pattern": "^[a-z A-Z 0-9 \\- _]+$",
"type": [
"string",
"null"
]
},
"channel_index":{
"description": "Index of channel to be connected.",
"type": [
"integer",
"null"
]
}
}
}
}
}
}
}
}
48 changes: 48 additions & 0 deletions APIs/schemas/map-activations-get-response-schema.json
@@ -0,0 +1,48 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Activations endpoint",
"description": "List of all currently pending activations",
"type": "object",
"patternProperties": {
"^[0-9]+$": {
"type": "object",
"additionalPropertes": false,
"properties": {
"activation":{
"$ref": "activation-response-schema.json"
},
"action:":{
"^[a-z A-Z 0-9 \\- _]+$": {
"description": "Names of outputs",
"patternProperties":{
"^(0|([1-9][0-9]*))$":{
"description": "Index of channels",
"required":[
"input",
"channel_index"
],
"properties": {
"input":{
"description": "Name of the input the channel to be connected belongs to. null for disconnected.",
"pattern": "^[a-z A-Z 0-9 \\- _]+$",
"type": [
"string",
"null"
]
},
"channel_index":{
"description": "Index of channel to be connected.",
"type": [
"integer",
"null"
]
}
}
}
}
}
}
}
}
}
}
49 changes: 49 additions & 0 deletions APIs/schemas/map-activations-post-response-schema.json
@@ -0,0 +1,49 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Activations endpoint",
"description": "Activation response",
"type": "object",
"maxProperties": 1,
"patternProperties": {
"^[0-9]+$": {
"type": "object",
"additionalPropertes": false,
"properties": {
"activation":{
"$ref": "activation-response-schema.json"
},
"action:":{
"^[a-z A-Z 0-9 \\- _]+$": {
"description": "Names of outputs",
"patternProperties":{
"^(0|([1-9][0-9]*))$":{
"description": "Index of channels",
"required":[
"input",
"channel_index"
],
"properties": {
"input":{
"description": "Name of the input the channel to be connected belongs to. null for disconnected.",
"pattern": "^[a-z A-Z 0-9 \\- _]+$",
"type": [
"string",
"null"
]
},
"channel_index":{
"description": "Index of channel to be connected.",
"type": [
"integer",
"null"
]
}
}
}
}
}
}
}
}
}
}
43 changes: 43 additions & 0 deletions APIs/schemas/map-activations-request-schema.json
@@ -0,0 +1,43 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Activations endpoint",
"description": "Add a new activation to the activations list",
"type": "object",
"additionalPropertes": false,
"properties": {
"activation":{
"$ref": "activation-schema.json"
},
"action:":{
"^[a-z A-Z 0-9 \\- _]+$": {
"description": "Names of outputs",
"patternProperties":{
"^(0|([1-9][0-9]*))$":{
"description": "Index of channels",
"required":[
"input",
"channel_index"
],
"properties": {
"input":{
"description": "Name of the input the channel to be connected belongs to. null for disconnected.",
"pattern": "^[a-z A-Z 0-9 \\- _]+$",
"type": [
"string",
"null"
]
},
"channel_index":{
"description": "Index of channel to be connected.",
"type": [
"integer",
"null"
]
}
}
}
}
}
}
}
}
44 changes: 0 additions & 44 deletions APIs/schemas/map-tables-request-schema.json

This file was deleted.

0 comments on commit c5bde50

Please sign in to comment.