Connection

Defines the connection between Execution Environment and Network Link.

Schema

Field

Type

Required

Readonly

Auto Managed

Example

id

String

True

True

False

http-db-connection

exec_env_id

String

True

True

False

mysql-server

network_link_id

String

True

True

False

eth0

description

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
Response Headers
Status Codes

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
Response Headers
Status Codes

In this way, it will be returned only the network_link_id of the connection with id = “<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
Response Headers
Status Codes

This example set the new description for the connection with id = “<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
Response Headers
Status Codes

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.