Execution Environment¶
The execution environment represents the remove service.
When the service is deployed by the the orchestrator, it is necessary to insert related info to the Context Broker.
Schema¶
Field |
Type |
Required |
Readonly |
Auto Managed |
Example |
|
---|---|---|---|---|---|---|
|
String | True |
True |
False |
mysql-server |
||
|
String |
True |
False |
False |
10.0.0.1 |
|
|
String |
True |
False |
False |
vm |
|
|
LCP |
False |
False |
False |
||
|
String |
False |
False |
False |
Open-source RDBMS |
|
|
Boolean |
True |
False |
False |
Yes |
LCP Schema¶
Field |
Type |
Required |
Readonly |
Auto managed |
Example |
|
---|---|---|---|---|---|---|
|
Integer |
True |
False |
False |
4000 |
|
|
Boolean |
True |
True |
False |
True |
|
|
Date |
False |
True |
True |
||
|
Date |
False |
True |
True |
||
|
String |
False |
True |
True |
||
|
String |
False |
True |
True |
Warning
It is not possible to update readonly fields.
it is not possible to set the auto managed fields.
Note
id
is required but it is auto-generated if not provided. It is recommended to provide a friendly for simplify the retrieve of connected date in other indices.type_id
should be one of those stored in Execution Environment Type index.https
indicate if the communication with the LCP is done with HTTPS instead of HTTP.
Create¶
To create a new Execution Environment use the following REST call:
-
POST
/exec-env/
(string: id)¶ with the request body in JSON format:
POST /exec-env HTTP/1.1 Host: cb-manager.example.com Content-Type: application/json { "id": "<exec-env-id>", "description": "<description>", "type_id": "<exec-env-type-id>", "hostname":"<ip-address>", "lcp": { "port": "<lcp-port>", "https": "<use-https> } }
- Parameters
id – optional execution environments id.
- Request Headers
Authorization – HTTP Basic Authentication with username and password.
Content-Type – application/json
- Response Headers
Content-Type – application/json
- Status Codes
201 Created – Execution environments correctly created.
204 No Content – No content to create execution environments based on the request.
400 Bad Request – Request not valid.
401 Unauthorized – Authentication failed.
406 Not Acceptable – Request validation failed.
415 Unsupported Media Type – Media type not supported.
422 Unprocessable Entity – Not possible to create ore or more execution environments based on the request.
500 Internal Server Error – Server not available to satisfy the request.
Replace the data with the correct values, for example <exec-env-id> with
apache-server
.Note
It is possible to add additional data specific for this execution environment.
If the creation is correctly executed the response is:
HTTP/1.1 201 Created Content-Type: application/json [ { "status": "Created", "code": 201, "error": false, "message": "Executed environment with id=<exec-env-id> correctly created" } ]
Otherwise, if, for example, an execution environment with the given
id
is already found, this is the response:HTTP/1.1 406 Not Acceptable Content-Type: application/json [ { "status": "Not Acceptable", "code": 406, "error": true, "message": "Id already found" } ]
If some required data is missing (for example
hostname
), the response could be:HTTP/1.1 406 Not Acceptable Content-Type: application/json [ { "status": "Not Acceptable", "code": 406, "error": true, "message": { "hostname": "required" } } ]
Read¶
To get the list of execution environment:
-
GET
/exec-env/(string: id)
¶ The response includes all the execution environments created.
It is possible to filter the results using the following request body:
GET /exec-env HTTP/1.1 Host: cb-manager.example.com Content-Type: application/json { "select": [ "hostname" ], "where": { "equals": { "target:" "id", "expr": "<exec-env-id>" } } }
- Parameters
id – optional execution environment id.
- Request Headers
Authorization – HTTP Basic Authentication with username and password.
Content-Type – application/json
- Response Headers
Content-Type – application/json
- Status Codes
200 OK – List of execution environments filtered by the query in the request body.
400 Bad Request – Request not valid.
401 Unauthorized – Authentication failed.
404 Not Found – Execution environments based on the request query not found.
406 Not Acceptable – Request validation failed.
415 Unsupported Media Type – Media type not supported.
422 Unprocessable Entity – Not possible to get execution environments with the request query.
500 Internal Server Error – Server not available to satisfy the request.
In this way, it will be returned only the
hostname
of all the execution environments withid
= “<exec-env-id>”
Update¶
To update an execution environment, use:
-
PUT
/exec-env/
(string: id)¶ PUT /exec-env HTTP/1.1 Host: cb-manager.example.com Content-Type: application/json { "id": "<exec-env-id>", "hostname":"<new-ip-address>", }
- Parameters
id – optional execution environment id.
- Request Headers
Authorization – HTTP Basic Authentication with username and password.
Content-Type – application/json
- Response Headers
Content-Type – application/json
- Status Codes
200 OK – All execution environments correctly updated.
204 No Content – No content to update execution environments based on the request.
304 Not Modified – Update for one or more execution environments not necessary.
400 Bad Request – Request not valid.
401 Unauthorized – Authentication failed.
406 Not Acceptable – Request validation failed.
415 Unsupported Media Type – Media type not supported.
422 Unprocessable Entity – Not possible to update one or more execution environments based on the request.
500 Internal Server Error – Server not available to satisfy the request.
This example set the new
hostname
for execution environment withid
= “<exec-env-id>”.Note
Also during the update it is possible to add additional data for the specific execution environment.
A possible response is:
HTTP/1.1 200 OK Content-Type: application/json [ { "status": "OK", "code": 200, "error": false, "message": "Execution environment with id=<exec-env-id> correctly updated" } ]
Instead, if the are not changes the response is:
HTTP/1.1 304 Not Modified Content-Type: application/json [ { "status": "Not Modified", "code": 304, "error": false, "message": "Update for execution environment with id=<exec-env-id> not necessary" } ]
Delete¶
To delete an execution environment, use:
-
DELETE
/exec-env/
(string: id)¶ DELETE /exec-env HTTP/1.1 Host: cb-manager.example.com Content-Type: application/json { "where": { "equals": { "target:" "id", "expr": "<exec-env-id>" } } }
- Parameters
id – optional execution environment id.
- Request Headers
Authorization – HTTP Basic Authentication with username and password.
Content-Type – application/json
- Response Headers
Content-Type – application/json
- Status Codes
205 Reset Content – All execution environments correctly deleted.
400 Bad Request – Request not valid.
401 Unauthorized – Authentication failed.
404 Not Found – Execution environments based on the request query not found.
406 Not Acceptable – Request validation failed.
415 Unsupported Media Type – Media type not supported.
422 Unprocessable Entity – Not possible to delete one or more execution environments based on the request query.
500 Internal Server Error – Server not available to satisfy the request.
This request removes the execution environment with
id
= <exec-env-id>”.This is a possible response:
HTTP/1.1 205 Reset Content Content-Type: application/json [ { "status": "Reset Content", "code": 200, "error": false, "message": "Execution environment with id=<exec-env-id> correctly deleted" } ]
Caution
Without request body, it removes all the execution environments.