Algorithm Instance¶
Contains the Algorithm Catalog instances.
Schema¶
Field |
Type |
Required |
Readonly |
Auto Managed |
Example |
---|---|---|---|---|---|
|
String |
True |
True |
False |
ddos-predictor-1 |
|
String |
True |
True |
False |
ddos-predictor |
|
String |
True |
False |
False |
10.1.1.2:9999 |
|
List(Operation) |
False |
True |
False |
|
|
String |
False |
False |
False |
DDoS predictor. |
|
String |
False |
False |
False |
algo-1-1-2 |
Operation Schema¶
Field |
Type |
Required |
Readonly |
Auto Managed |
Example |
---|---|---|---|---|---|
|
List(Parameter) |
False |
False |
False |
Parameter Schema¶
Field |
Type |
Required |
Readonly |
Auto Managed |
Example |
---|---|---|---|---|---|
|
String |
True |
True |
False |
period |
|
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 andid
that includes thealgorithm_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
Authorization – JWT Authentication.
Content-Type – application/json
- Response Headers
Content-Type – application/json
- Status Codes
201 Created – Algorithm instances correctly created.
204 No Content – No content to create algorithm instances 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 algorithm instances based on the request.
500 Internal Server Error – Server not available to satisfy the request.
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 withid
= “<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
Authorization – JWT Authentication.
Content-Type – application/json
- Response Headers
Content-Type – application/json
- Status Codes
200 OK – All algorithm instances correctly updated.
204 No Content – No content to update algorithm instances based on the request.
304 Not Modified – Update for one or more algorithm instances 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 algorithm instances based on the request.
500 Internal Server Error – Server not available to satisfy the request.
This example updates the
value
of theparameter
withid
= “<parameter-id>” of the algorithm instance withid
= “<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
Authorization – JWT Authentication.
Content-Type – application/json
- Response Headers
Content-Type – application/json
- Status Codes
205 Reset Content – All algorithm instances correctly deleted.
400 Bad Request – Request not valid.
401 Unauthorized – Authentication failed.
404 Not Found – Algorithm instances 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 algorithm instances based on the request query.
500 Internal Server Error – Server not available to satisfy the request.
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.