Usage¶
An API HTTP REST is implemented to manage the communication and the work of the Dynamic Policy Manager.
All URIs are relative to http://localhost:8080/api/v1.
Mainly the Dynamic Policy Manager use in the first version the method get for to return one or all policies created, and post to create a new policies.
API calls for the DPM¶
Several API endpoints are provided in this component, as shown in the following. For a full definition of the URL and the schema on this REST calls see the Annexes documentation.
| HTTP Request | Description |
| GET/policies/{id} | Get a policy id |
| GET/policies/ | Return the list of policies created/updated |
| POST/policies/ | Add new policy |
| GET/policies/status | Read items |
| POST/alertmanager/ | AlertManager Webhooks |
| POST/registry/icos | ICOS Process App descriptor |
Endpoints¶
GET/registry/api/v1/policies/{id}¶
- Parameters: an authorization access token is requested as String
- Request body is provided from the following schema;
| AttributeName | Type | Description |
| id | Long | Unique identifier of the deployment |
GET /registry/api/v1/policies/¶
- Parameters: an authorization access token is requested as String.
- No schema is provided.
POST/registry/ap1/v1/policies/{policy}¶
- Parameters: an authorization access token is requested as String.
- Request body is provided from the following schema;
| AttributeName | Type | Description |
| subject | Subject[] | Provides a set of information about the type of application, name of the application, component and instance |
| spec | Spec[] | Set of information about the template used |
| action | Action[] | Set of information about the action to provided. [DEFAULT] is webhook. |
| variables | Variables[] | [OPTIONAL] addtional properties. It can a string, an integer or a number. [DEFAULT] is {}. |
| properties | Properties[] | [OPTIONAL] additional properties [DEFAULT] is {}. |
Subject[]
| AttributeName | Type | Description |
| type | const | Default is "app" Name of app |
appName | String | Name of app |
| appComponent | String | Component of app |
| appInstance | String | Instance of app |
Spec[]
| AttributeName | Type | Description |
| type description |
String | [DEFAULT] is empty |
| type | Const | [DEFAULT] is template |
| templateName | String | Name of template |
Http methods from the following RFCs are all observed:
- RFC 7231: Hypertext Transfer Protocol (HTTP/1.1), obsoletes 2616
- RFC 5789: PATCH Method for HTTP
Allowed values are : CONNECT, DELETE, GET, HEAD, OPTIONS, PATCH, POST,PUT, TRACE.
Variables[]
| AttributeName | Type | Description |
| #0 | String | [OPTIONAL] |
| #1 | integer | [OPTIONAL] |
| #2 | number | [OPTIONAL] |
Properties[]
| AttributeName | Type | Description |
| oneoff | boolean | boolean |
| interval | String | Interval where the policy should be acts |
| pendingInterval | String | Information about the interval status |
POST/registry/api/v1/icos/¶
- Parameters: authorization access token
- Request body is provided from the following schema:
| AttributeName | Type | Description |
| app_descriptor | App_descriptor[] | Object that provided a set of information. |
| app_instance | String | Instance name of the app descriptor. |
| common_action | Common_action[] | Object that provides a set of information about the service, specifically for the icos-service. |
| service | String | name of the service |
app_descriptor[]
| AttributeName | Type | Description |
| name | String | Name of the app descripton |
| description | String | [DEFAULT] is “”. |
| components | Components[] | Object that providesa a set of information about. |
| policies | Policies[] | Object that provided a set of information about the policies |
Component[]
| name | Name of the component | Object that provided a set of information. |
| type | String | Type of the component |
| policies | policies[] | Array Object that providesa a set of information about the policies for the icos service.. [DEFAULT ] is empty : [] |
Policies[]
| name | Name of the component | Object that provided a set of information. |
| name | string | Name of the policies |
| component | string | It can be Null |
| fromTemplate | string | It can be null |
| spec | Spec[] | Object provides a set of information about policies template, telemetry and constraints. |
| remediation | string | It can be null |
| variables | Variables[] | [DEFAULT] is {} |
| properties | Properties[] | [DEFAULT] is {} |
common_action[]
| Attribute Name | Type | Description |
| uri | String | Link to the alermanager |
| type | Const | [DEFAULT] is “icos-service” |
| httpMethod | String | [DEFAULT] is “CONNECT” |
| extraParams | [] | Additional properties. [DEFAULT] is empty {} |
| includeAccessToken | boolean | Token to acces to the webhook, default is FALSE |
POST/watcher/api/v1/webhooks/alertmanager¶
- Parameters: access token
| Attribute Name | Type | Description |
| version | String | |
| groupKey | string | |
| truncatedAlerts | 0 | |
| status | String | |
| receiver | String | |
| groupLabels | GroupLabels[] | [DEFAULT] is {} |
| commonLabels | CommonLabels[] | DEFAULT] is {} |
| commonAnnotations | CommonAnnotations[] | DEFAULT] is {} |
| externalURL | string | |
| alerts | AlertsArray<object> | Array Object provides items as status, label, ... |
Grouplabels[]
| Attribute Name | Type | Description |
| Additional properties | String | [DEFAULT] : {} |
CommonLabels[]
| Attribute Name | Type | Description |
| Additional properties | String | [DEFAULT] : {} |
CommonAnnotations[]
| Attribute Name | Type | Description |
| Additional properties | String | [DEFAULT] : {} |
Alerts[]
| Attribute Name | Type | Description |
| Items | Items[] | - |
Items []
| Attribute Name | Type | Description |
| status | String | It can be null |
| labels | Labels[] | Additional properties |
| annotations | Annotations[] | Additional properties |
| startsAt | String | It provides the date-times when the policies started. |
| endsAt | String | It provides the date-time when the policies ended. |
| generatorUrl | String | Url of the generator |
| fingerprint | String | It can be null. |
Labels
| Attribute Name | Type | Description |
| Additional properties | String | [DEFAULT] : {} |
Annotations[]
| Attribute Name | Type | Description |
| Additional properties | String | [DEFAULT] : {} |
GET/status/¶
- Parameters: access token
Reference¶
Designed and architecture refer to the deliverable D3.1 Meta-kernel Layer Module Developed (IT-1) provides about the implementation. API models and how to work refer to the deliverable D3.2 Metakernel Layer Module Develope (IT-2)