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

id

String | True

True

False

mysql-server

hostname

String

True

False

False

10.0.0.1

type_id

String

True

False

False

vm

lcp

LCP

False

False

False

description

String

False

False

False

Open-source RDBMS

enabled

Boolean

True

False

False

Yes

LCP Schema

Field

Type

Required

Readonly

Auto managed

Example

port

Integer

True

False

False

4000

https

Boolean

True

False

False

True

endpoint

String

False

False

False

lcp

started

Date

False

True

True

last_heartbeat

Date

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

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

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

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

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.