Algorithm Instance

Contains the Algorithm Catalog instances.

Schema

Field

Type

Required

Readonly

Auto Managed

Example

id

String

True

True

False

ddos-predictor-1

algorithm_catalog_id

String

True

True

False

ddos-predictor

endpoint

String

True

False

False

10.1.1.2:9999

operations

List(Operation)

False

True

False

description

String

False

False

False

DDoS predictor.

container

String

False

False

False

algo-1-1-2

Operation Schema

Field

Type

Required

Readonly

Auto Managed

Example

parameters

List(Parameter)

False

False

False

Parameter Schema

Field

Type

Required

Readonly

Auto Managed

Example

id

String

True

True

False

period

value

Any

True

False

False

10s

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. A common syntax is to use and id that includes the algorithm_catalog_id.

  • algorithm_catalog_id should be one of those stored in Algorithm Catalog index.

Create

To create a new algorithm instance use the following REST call:

POST /instance/algorithm/(string: id)

with the request body in JSON format:

POST /instance/algorithm HTTP/1.1
Host: cb-manager.example.com
Content-Type: application/json

{
    "id": "<algorithm-instance-id>",
    "algorithm_catalog_id": "<algorithm-id>",
    "operations": [
        "parameters": [
            {
                "id": "<parameter-id>",
                "value": "<parameter-value>",
            }
        ]
    ]
}
Parameters
  • id – optional algorithm instance id.

Request Headers
Response Headers
Status Codes

Replace the data with the correct values, for example <algorithm-instance-id> with “firewall@mysql-server”.

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": "Algorithm instance with id=<algorithm-instance-id> correctly created"
    }
]

Otherwise, if, for example, an algorithm instance 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 status), the response could be:

HTTP/1.1 406 Not Acceptable
Content-Type: application/json

[
    {
        "status": "Not Acceptable",
        "code": 406,
        "error": true,
        "message": {
            "status": "required"
        }
    }
]

Read

To get the list of the algorithm instances:

GET /instance/algorithm/(string: id)

The response includes all the algorithm instances.

It is possible to filter the results using the following request body:

GET /instance/algorithm HTTP/1.1
Host: cb-manager.example.com
Content-Type: application/json

{
    "select": [ "parameters" ],
    "where": {
        "equals": {
            "target": "id",
            "expr": "<algorithm-instance-id>"
        }
    }
}

In this way, it will be returned only the parameters of the algorithm instance with id = “<algorithm-instance-id>”.

Update

To update an algorithm instance, use:

PUT /instance/algorithm/(string: id)
PUT /instance/algorithm HTTP/1.1
Host: cb-manager.example.com
Content-Type: application/json

{
    "id": "<algorithm-instance-id}",
    "operations": [
        "parameters": [
            {
                "id": "<parameter-id>",
                "value": "<new-parameter-value>"
            }
        ]
    ]
}
Parameters
  • id – optional algorithm instance id.

Request Headers
Response Headers
Status Codes

This example updates the value of the parameter with id = “<parameter-id>” of the algorithm instance with id = “<algorithm-instance-id>”.

A possible response is:

HTTP/1.1 200 OK
Content-Type: application/json

[
    {
        "status": "OK",
        "code": 200,
        "error": false,
        "message": "Algorithm instance with id=<algorithm-instance-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 algorithm instance with id=<algorithm-instance-id> not necessary"
    }
]

Delete

To delete algorithm instances, use:

DELETE /instance/algorithm/(string: id)
DELETE /instance/algorithm HTTP/1.1
Host: cb-manager.example.com
Content-Type: application/json

{
    "where": {
        "equals": {
            "target": "id",
            "expr": "<algorithm-instance-id>"
        }
    }
}
Parameters
  • id – optional algorithm instance id.

Request Headers
Response Headers
Status Codes

This request removes the algorithm instance with id = “<algorithm-instance-id>”.

This is a possible response:

HTTP/1.1 205 Reset Content
Content-Type: application/json

[
    {
        "status": "Reset Content",
        "code": 200,
        "error": false,
        "message": "Algorithm instance the id=<algorithm-instance-id> correctly deleted"
    }
]

Caution

Without request body, it removes all the algorithm instances.