Connection¶
Defines the connection between Execution Environment and Network Link.
Schema¶
Field |
Type |
Required |
Readonly |
Auto Managed |
Example |
---|---|---|---|---|---|
|
String |
True |
True |
False |
http-db-connection |
|
String |
True |
True |
False |
mysql-server |
|
String |
True |
True |
False |
eth0 |
|
String |
False |
False |
False |
Connection for the HTTP and DB Servers. |
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.exec_env_id
should be one of those stored in Execution Environment index.network_link_id
should be one of those stored in Network Link index.
Create¶
To create a new connection use the following REST call:
- POST /connection/(string: id)¶
with the request body in JSON format:
POST /connection HTTP/1.1 Host: cb-manager.example.com Content-Type: application/json { "id": "<connection-id>", "exec_env_id": "<exec-env-id>", "network_link_id": "<network-link-id>", "description": "<human-readable-description>" }
- Parameters
id – optional connection id.
- Request Headers
Authorization – JWT Authentication.
Content-Type – application/json
- Response Headers
Content-Type – application/json
- Status Codes
201 Created – Connections correctly created.
204 No Content – No content to create connections 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 connections based on the request.
500 Internal Server Error – Server not available to satisfy the request.
Replace the data with the correct values, for example <connection-id> with
http-db-connection
.Note
It is possible to add additional data specific for this connection.
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": "Connection with id=<connection-id> correctly created" } ]
Otherwise, if, for example, a connection 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
exec_env_id
), the response could be:HTTP/1.1 406 Not Acceptable Content-Type: application/json [ { "status": "Not Acceptable", "code": 406, "error": true, "message": { "exec_env_id": "required" } } ]
Read¶
To get the list of connections:
- GET /connection/(string: id)¶
The response includes all the connections created.
It is possible to filter the results using the following request body:
GET /connection HTTP/1.1 Host: cb-manager.example.com Content-Type: application/json { "select": [ "network_link_id" ], "where": { "equals": { "target:" "id", "expr": "<connection-id>" } } }
- Parameters
id – optional connection id.
- Request Headers
Authorization – JWT Authentication.
Content-Type – application/json
- Response Headers
Content-Type – application/json
- Status Codes
200 OK – List of connections filtered by the query in the request body.
400 Bad Request – Request not valid.
401 Unauthorized – Authentication failed.
404 Not Found – Connections 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 connections with the request query.
500 Internal Server Error – Server not available to satisfy the request.
In this way, it will be returned only the
network_link_id
of the connection withid
= “<connection-id>”
Update¶
To update a connection, use:
- PUT /connection/(string: id)¶
PUT /connection HTTP/1.1 Host: cb-manager.example.com Content-Type: application/json { "id": "<connection-id>", "description":"<new-description>" }
- Parameters
id – optional connection id.
- Request Headers
Authorization – JWT Authentication.
Content-Type – application/json
- Response Headers
Content-Type – application/json
- Status Codes
200 OK – All connections correctly updated.
204 No Content – No content to update connections based on the request.
304 Not Modified – Update for one or more connections 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 connections based on the request.
500 Internal Server Error – Server not available to satisfy the request.
This example set the new
description
for the connection withid
= “<connection-id>”.Note
Also during the update it is possible to add additional data for the specific connection.
A possible response is:
HTTP/1.1 200 OK Content-Type: application/json [ { "status": "OK", "code": 200, "error": false, "message": "Connection with id=<connection-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 connection with id=<connection-id> not necessary" } ]
Delete¶
To delete connections, use:
- DELETE /connection/(string: id)¶
DELETE /connection HTTP/1.1 Host: cb-manager.example.com Content-Type: application/json { "where": { "equals": { "target:" "id", "expr": "<connection-id>" } } }
- Parameters
id – optional connection id.
- Request Headers
Authorization – JWT Authentication.
Content-Type – application/json
- Response Headers
Content-Type – application/json
- Status Codes
205 Reset Content – All connections correctly deleted.
400 Bad Request – Request not valid.
401 Unauthorized – Authentication failed.
404 Not Found – Connections 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 connections based on the request query.
500 Internal Server Error – Server not available to satisfy the request.
This request removes the connection with
id
= <connection-id>”.This is a possible response:
HTTP/1.1 205 Reset Content Content-Type: application/json [ { "status": "Reset Content", "code": 200, "error": false, "message": "Connection with id=<connection-id> correctly deleted" } ]
Caution
Without request body, it removes all the connections.