|
a/readme.md |
|
b/readme.md |
|
... |
|
... |
23 |
`Whenever it's needed to have this enabler runnig, please execute `docker-compose up`.`
|
23 |
`Whenever it's needed to have this enabler runnig, please execute `docker-compose up`.`
|
24 |
|
24 |
|
25 |
`On the browser please navigate to `localhost:5000` to reach the frontend module.`
|
25 |
`On the browser please navigate to `localhost:5000` to reach the frontend module.`
|
26 |
|
26 |
|
27 |
Notification enabler will need the following Environment Variables:
|
27 |
Notification enabler will need the following Environment Variables:
|
|
|
28 |
`
|
28 |
`PORT
|
29 |
PORT
|
29 |
USEREMAIL
|
30 |
USEREMAIL
|
30 |
USERPWD
|
31 |
USERPWD
|
31 |
DBUSER
|
32 |
DBUSER
|
32 |
DBPASSWORD
|
33 |
DBPASSWORD
|
33 |
DATABASE
|
34 |
DATABASE
|
|
|
35 |
DBDEBUG
|
34 |
DBCONLIMIT`
|
36 |
DBCONLIMIT
|
|
|
37 |
EMAILON
|
|
|
38 |
DEBUGLEVEL`
|
35 |
|
39 |
|
36 |
`This Environment Variables will be in data.env file, locate on the clone directory.`
|
40 |
`This Environment Variables will be in data.env file, locate on the clone directory.`
|
37 |
|
41 |
|
38 |
#### 3. API
|
42 |
#### 3. API
|
39 |
|
43 |
|
|
... |
|
... |
56 |
|
60 |
|
57 |
{
|
61 |
{
|
58 |
"success": true,
|
62 |
"success": true,
|
59 |
"data": [
|
63 |
"data": [
|
60 |
{
|
64 |
{
|
|
|
65 |
"rulesID": ruleID,
|
|
|
66 |
"description": "Description",
|
|
|
67 |
"parameter": "Parameter",
|
|
|
68 |
"conditionValue": "Condition Value",
|
|
|
69 |
"controlValue": "Control Value",
|
|
|
70 |
"threshold": "Threshold",
|
|
|
71 |
"notifyType": "Notify Type",
|
|
|
72 |
"emailTo": "Emails",
|
|
|
73 |
"notificationType": notificationType,
|
|
|
74 |
"hostname": "Hostname",
|
|
|
75 |
"port": Port,
|
|
|
76 |
"path": "Path",
|
|
|
77 |
"method": "Method",
|
|
|
78 |
"token": "Token"
|
|
|
79 |
}
|
|
|
80 |
]
|
|
|
81 |
}
|
|
|
82 |
```
|
|
|
83 |
|
|
|
84 |
Use this API call whenever is needed to retrieve all rules related to vApp.
|
|
|
85 |
|
|
|
86 |
#### Request
|
|
|
87 |
`GET /api/vf-os-enabler/<api_version>/getRules/<app_id>`
|
|
|
88 |
|
|
|
89 |
#### URL Parameters
|
|
|
90 |
|
|
|
91 |
Resource Parameter | Description
|
|
|
92 |
------------------ | -----------
|
|
|
93 |
api_version | Identifies the API version that will be used for the request.
|
|
|
94 |
app_id | Identifies the APP.
|
|
|
95 |
|
|
|
96 |
|
|
|
97 |
#### Return Payload
|
|
|
98 |
|
|
|
99 |
The API response will contain a JSON document with the property `success`: **true**, **false** and the `data` with the rules of app (if found).
|
|
|
100 |
|
|
|
101 |
In the following Example it's queried all rules related to specific appID:
|
|
|
102 |
|
|
|
103 |
|
|
|
104 |
```json
|
|
|
105 |
{
|
|
|
106 |
"success": true,
|
|
|
107 |
"data": [
|
|
|
108 |
{
|
61 |
"rulesID": 11,
|
109 |
"rulesID": 1,
|
62 |
"description": "New Rule",
|
110 |
"description": "TR37",
|
63 |
"parameter": "slumptest",
|
111 |
"parameter": "TR37",
|
64 |
"conditionValue": ">",
|
112 |
"conditionValue": ">",
|
65 |
"controlValue": "5",
|
113 |
"controlValue": "37",
|
|
|
114 |
"threshold": "10",
|
|
|
115 |
"notifyType": "Email",
|
|
|
116 |
"emailTo": "miguel.rodrigues@knowledgebiz.pt,miguel.andre.rodrigues@gmail.com,ma.rodrigues@campus.fct.unl.pt",
|
66 |
"notificationType": 5,
|
117 |
"notificationType": 5,
|
67 |
"token": "fgTJAyuX0M4tpn1P2WXAJmRbDH7hwbVhZsL26Ca1Ecm"
|
118 |
"hostname": "null",
|
68 |
}
|
|
|
69 |
]
|
|
|
70 |
}
|
|
|
71 |
```
|
|
|
72 |
|
|
|
73 |
Use this API call whenever is needed to retrieve all rules related to vApp.
|
|
|
74 |
|
|
|
75 |
#### Request
|
|
|
76 |
`GET /api/vf-os-enabler/<api_version>/getRules/<app_id>`
|
|
|
77 |
|
|
|
78 |
#### URL Parameters
|
|
|
79 |
|
|
|
80 |
Resource Parameter | Description
|
|
|
81 |
| -----------
|
|
|
82 |
api_version | Identifies the API version that will be used for the request.
|
|
|
83 |
app_id | Identifies the APP.
|
|
|
84 |
|
|
|
85 |
|
|
|
86 |
#### Return Payload
|
|
|
87 |
|
|
|
88 |
The API response will contain a JSON document with the property `success`: **true**, **false** and the `data` with the rules of app (if found).
|
|
|
89 |
|
|
|
90 |
In the following Example it's queried all rules related to specific appID:
|
|
|
91 |
|
|
|
92 |
|
|
|
93 |
```json
|
|
|
94 |
{
|
|
|
95 |
"success": true,
|
|
|
96 |
"data": [
|
|
|
97 |
{
|
|
|
98 |
"rulesID": 11,
|
119 |
"port": 0,
|
99 |
"description": "New Rule",
|
120 |
"path": "null",
|
100 |
"parameter": "slumptest",
|
121 |
"method": "null",
|
101 |
"conditionValue": ">",
|
122 |
"token": "0ahobLza90bTxNPF9wBYVOtMCoPOD8DMonijqthUila"
|
102 |
"controlValue": "5",
|
|
|
103 |
"notificationType": 5,
|
|
|
104 |
"token": "fgTJAyuX0M4tpn1P2WXAJmRbDH7hwbVhZsL26Ca1Ecm"
|
|
|
105 |
}
|
123 |
}
|
106 |
]
|
124 |
]
|
107 |
}
|
125 |
}
|
108 |
```
|
126 |
```
|
109 |
|
127 |
|
|
... |
|
... |
131 |
|
149 |
|
132 |
{
|
150 |
{
|
133 |
"success": true,
|
151 |
"success": true,
|
134 |
"data": [
|
152 |
"data": [
|
135 |
{
|
153 |
{
|
136 |
"emailTo": "raquel.melo@knowledgebiz.pt",
|
154 |
"notificationID": 1,
|
137 |
"subject": "slumptest>10",
|
155 |
"subject": "Subject = Value of subject",
|
138 |
"date": "2018-04-27 12:06:02",
|
156 |
"date": "2018-06-29T17:03:50.000Z",
|
139 |
"token": "fgTJAyuX0M4tpn1P2WXAJmRbDH7hwbVhZsL26Ca1Ecm"
|
157 |
"token": "0ahobLza90bTxNPF9wBYVOtMCoPOD8DMonijqthUila",
|
|
|
158 |
"rulesID": 2
|
140 |
}
|
159 |
}
|
141 |
]
|
160 |
]
|
142 |
}
|
161 |
}
|
143 |
```
|
162 |
```
|
144 |
Use this API call whenever is needed to retrieve all notifications of vApp.
|
163 |
Use this API call whenever is needed to retrieve all notifications of vApp.
|
|
... |
|
... |
164 |
```json
|
183 |
```json
|
165 |
{
|
184 |
{
|
166 |
"success": true,
|
185 |
"success": true,
|
167 |
"data": [
|
186 |
"data": [
|
168 |
{
|
187 |
{
|
169 |
"emailTo": "miguel.rodrigues@knowledgebiz.pt",
|
188 |
"notificationID": 1,
|
170 |
"subject": "slumptest=40",
|
189 |
"subject": "TR37 = 100",
|
171 |
"date": "2018-04-27 15:39:51",
|
|
|
172 |
"token": "fgTJAyuX0M4tpn1P2WXAJmRbDH7hwbVhZsL26Ca1Ecm"
|
|
|
173 |
},
|
|
|
174 |
{
|
|
|
175 |
"emailTo": "miguel.rodrigues@knowledgebiz.pt",
|
|
|
176 |
"subject": "slumptest=40",
|
|
|
177 |
"date": "2018-04-27 16:06:00",
|
190 |
"date": "2018-06-29T17:03:50.000Z",
|
178 |
"token": "fgTJAyuX0M4tpn1P2WXAJmRbDH7hwbVhZsL26Ca1Ecm"
|
191 |
"token": "0ahobLza90bTxNPF9wBYVOtMCoPOD8DMonijqthUila",
|
179 |
},
|
192 |
"rulesID": 1
|
180 |
{
|
|
|
181 |
"emailTo": "miguel.rodrigues@knowledgebiz.pt",
|
|
|
182 |
"subject": "slumptest=40",
|
|
|
183 |
"date": "2018-04-27 16:06:09",
|
|
|
184 |
"token": "fgTJAyuX0M4tpn1P2WXAJmRbDH7hwbVhZsL26Ca1Ecm"
|
|
|
185 |
},
|
|
|
186 |
{
|
|
|
187 |
"emailTo": "miguel.rodrigues@knowledgebiz.pt",
|
|
|
188 |
"subject": "slumptest=40",
|
|
|
189 |
"date": "2018-04-27 16:08:30",
|
|
|
190 |
"token": "fgTJAyuX0M4tpn1P2WXAJmRbDH7hwbVhZsL26Ca1Ecm"
|
|
|
191 |
},
|
|
|
192 |
{
|
|
|
193 |
"emailTo": "miguel.rodrigues@knowledgebiz.pt",
|
|
|
194 |
"subject": "slumptest=40",
|
|
|
195 |
"date": "2018-04-27 16:09:51",
|
|
|
196 |
"token": "fgTJAyuX0M4tpn1P2WXAJmRbDH7hwbVhZsL26Ca1Ecm"
|
|
|
197 |
}
|
193 |
}
|
198 |
]
|
194 |
]
|
199 |
}
|
195 |
}
|
200 |
```
|
196 |
```
|
201 |
|
197 |
|
|
... |
|
... |
224 |
|
220 |
|
225 |
{
|
221 |
{
|
226 |
"success": true,
|
222 |
"success": true,
|
227 |
"data": [
|
223 |
"data": [
|
228 |
{
|
224 |
{
|
229 |
"token": "Es5zfsco57fieoQcDJZuIZxFZWv4HQbBYgUXRgqodQp",
|
225 |
"token": "token",
|
230 |
"appID": "myawesomeappid",
|
226 |
"appID": "AppID",
|
231 |
"developerID": "david.aleixo@knowledgebiz.pt"
|
227 |
"developerID": "DeveloperID"
|
232 |
}
|
228 |
}
|
233 |
]
|
229 |
]
|
234 |
}
|
230 |
}
|
235 |
```
|
231 |
```
|
236 |
Use this API call whenever is needed to retrieve all apps of developerid.
|
232 |
Use this API call whenever is needed to retrieve all apps of developerid.
|
|
... |
|
... |
256 |
```json
|
252 |
```json
|
257 |
{
|
253 |
{
|
258 |
"success": true,
|
254 |
"success": true,
|
259 |
"data": [
|
255 |
"data": [
|
260 |
{
|
256 |
{
|
261 |
"token": "Es5zfsco57fieoQcDJZuIZxFZWv4HQbBYgUXRgqodQp",
|
257 |
"token": "0ahobLza90bTxNPF9wBYVOtMCoPOD8DMonijqthUila",
|
262 |
"appID": "MiguelID",
|
258 |
"appID": "TR",
|
263 |
"developerID": "painatal_vodka@hotmail.com"
|
259 |
"developerID": "miguel.rodrigues@knowledgebiz.pt"
|
264 |
}
|
260 |
}
|
265 |
]
|
261 |
]
|
266 |
}
|
262 |
}
|
267 |
```
|
263 |
```
|
268 |
|
264 |
|
|
... |
|
... |
382 |
|
378 |
|
383 |
|
379 |
|
384 |
### Enabler 2 - Create Notifications
|
380 |
### Enabler 2 - Create Notifications
|
385 |
|
381 |
|
386 |
```http
|
382 |
```http
|
387 |
POST http://localhost:8000/api/vf-os-enabler/v0/notifications
|
383 |
POST /api/vf-os-enabler/v0/notifications
|
388 |
Accept: */*
|
384 |
Accept: */*
|
389 |
Content-Type: application/json; charset=utf-8
|
385 |
Content-Type: application/json; charset=utf-8
|
390 |
|
386 |
|
391 |
{
|
387 |
{
|
392 |
"emailTo":[
|
|
|
393 |
"my_email1",
|
|
|
394 |
"my_email2"
|
|
|
395 |
],
|
|
|
396 |
"token":"my_token",
|
388 |
"token":"my_token",
|
397 |
"body":[
|
389 |
"body":[
|
398 |
{"subject":"my_Subject_1",
|
390 |
{"subject":"my_Subject_1",
|
399 |
"subjectValue": "my_SubjectValue_1"
|
391 |
"subjectValue": "my_SubjectValue_1"
|
400 |
},
|
392 |
},
|
|
... |
|
... |
448 |
api_version | Identifies the API version that will be used for the request.
|
440 |
api_version | Identifies the API version that will be used for the request.
|
449 |
|
441 |
|
450 |
#### JSON Body Payload
|
442 |
#### JSON Body Payload
|
451 |
|
443 |
|
452 |
Name | Required | Type | Description
|
444 |
Name | Required | Type | Description
|
453 |
------- | ----------- | ------ | -----------
|
445 |
------- | ----------- | ------ | -----------
|
454 |
emailTo | Yes | STRING | String where is the emails.
|
|
|
455 |
token | Yes | STRING | String where is the token.
|
446 |
token | Yes | STRING | String where is the token.
|
456 |
body | Yes | JSON | JSON document where is the subject and subjectValue.
|
447 |
body | Yes | JSON | JSON document where is the subject and subjectValue.
|
457 |
|
448 |
|
458 |
Example of JSON body payload structure:
|
449 |
Example of JSON body payload structure:
|
459 |
` {
|
450 |
` {
|
460 |
"emailTo": [
|
|
|
461 |
"string",
|
|
|
462 |
"string"
|
|
|
463 |
],
|
|
|
464 |
"token": "string",
|
451 |
"token": "string",
|
465 |
"body": [
|
452 |
"body": [
|
466 |
{
|
453 |
{
|
467 |
"subject" : "stirng",
|
454 |
"subject" : "stirng",
|
468 |
"subjectValue" : "string"
|
455 |
"subjectValue" : "string"
|
|
... |
|
... |
511 |
|
498 |
|
512 |
|
499 |
|
513 |
### Enabler 2 - Register vApp
|
500 |
### Enabler 2 - Register vApp
|
514 |
|
501 |
|
515 |
```http
|
502 |
```http
|
516 |
POST http://localhost:8000/api/vf-os-enabler/v0/register
|
503 |
POST /api/vf-os-enabler/v0/register
|
517 |
Accept: */*
|
504 |
Accept: */*
|
518 |
Content-Type: application/json; charset=utf-8
|
505 |
Content-Type: application/json; charset=utf-8
|
519 |
|
506 |
|
520 |
{
|
507 |
{
|
521 |
"appID":[
|
508 |
"appID":[
|
|
... |
|
... |
595 |
500 | Internal Server Error - There was an unexpected error at some point during the processing of the request.
|
582 |
500 | Internal Server Error - There was an unexpected error at some point during the processing of the request.
|
596 |
|
583 |
|
597 |
### Enabler 2 - Create Rules
|
584 |
### Enabler 2 - Create Rules
|
598 |
|
585 |
|
599 |
```http
|
586 |
```http
|
600 |
POST http://localhost:8000/api/vf-os-enabler/v0/notification/rules
|
587 |
POST /api/vf-os-enabler/v0/notification/rules
|
601 |
Accept: */*
|
588 |
Accept: */*
|
602 |
Content-Type: application/json; charset=utf-8
|
589 |
Content-Type: application/json; charset=utf-8
|
603 |
|
590 |
|
604 |
{
|
591 |
[
|
605 |
"appID":"my_appID",
|
592 |
{
|
606 |
"description":"my_description",
|
593 |
appID: "AppID",
|
607 |
"parameter":"my_parameter",
|
594 |
description: "Description",
|
|
|
595 |
parameter: "Parameter",
|
608 |
"conditionValue":"my_conditionValue",
|
596 |
conditionValue: "Condition Value",
|
609 |
"controlValue":"my_controlValue",
|
597 |
controlValue: "Control Value",
|
|
|
598 |
threshold: "Threshold",
|
|
|
599 |
notifyType: "Notify Type",
|
610 |
"notificationType":"my_notificationType"
|
600 |
notificationType: "Notification Type",
|
611 |
}
|
601 |
hostname: "Hostname",
|
|
|
602 |
port: "Port",
|
|
|
603 |
path: "Path",
|
|
|
604 |
method: "Method",
|
|
|
605 |
emailTo:[
|
|
|
606 |
"emailTo_1",
|
|
|
607 |
"emailTo_2"
|
|
|
608 |
]
|
|
|
609 |
}
|
|
|
610 |
]
|
612 |
```
|
611 |
```
|
613 |
|
612 |
|
614 |
```http
|
613 |
```http
|
615 |
HTTP/1.1 200 OK
|
614 |
HTTP/1.1 200 OK
|
616 |
Content-type: application/json
|
615 |
Content-type: application/json
|
|
... |
|
... |
641 |
---------------- | -------- | ------ | -----------
|
640 |
---------------- | -------- | ------ | -----------
|
642 |
appID | Yes | STRING | String where is the vAppID.
|
641 |
appID | Yes | STRING | String where is the vAppID.
|
643 |
description | Yes | STRING | String where is the description.
|
642 |
description | Yes | STRING | String where is the description.
|
644 |
parameter | Yes | STRING | String where is the parameter for the rule.
|
643 |
parameter | Yes | STRING | String where is the parameter for the rule.
|
645 |
conditionValue | Yes | STRING | String where is the conditionValue (>, <, >=, <=).
|
644 |
conditionValue | Yes | STRING | String where is the conditionValue (>, <, >=, <=).
|
646 |
controlValue | Yes | STRING | String where is the controlValue (Threshold).
|
645 |
controlValue | Yes | STRING | String where is the controlValue.
|
|
|
646 |
threshold | Yes | STRING | String where is the Threshold.
|
|
|
647 |
notifyType | Yes | STRING | String where is the notifyType ("Email" or "HTTP Request").
|
647 |
notificationType | Yes | STRING | String where is the Notification Type (1 - Notify End of Month, 2 - Notify End of Two Weeks, 3 - Notify End of Week, 4 - Notify End of Three Days, 5 - Notify Immediately).
|
648 |
notificationType | Yes | STRING | String where is the Notification Type (1 - Notify End of Month, 2 - Notify End of Two Weeks, 3 - Notify End of Week, 4 - Notify End of Three Days, 5 - Notify Immediately).
|
|
|
649 |
hostname | Yes | STRING | String where is the Hostname.
|
|
|
650 |
port | Yes | STRING | String where is the Port.
|
|
|
651 |
path | Yes | STRING | String where is the Path.
|
|
|
652 |
method | Yes | STRING | String where is the Method ("POST", "GET", "PUT" or "DELETE").
|
|
|
653 |
emailTo | Yes | STRING | Array of Strings where is the emails.
|
648 |
|
654 |
|
649 |
Example of JSON body payload structure:
|
655 |
Example of JSON body payload structure:
|
|
|
656 |
`[
|
650 |
` {
|
657 |
{
|
651 |
"appID": "string",
|
658 |
"appID": "TR",
|
652 |
"description": "string",
|
659 |
"description": "TR37",
|
653 |
"parameter": "string",
|
660 |
"parameter": "TR37",
|
654 |
"conditionValue": "string",
|
661 |
"conditionValue": ">",
|
655 |
"controlValue": "string",
|
662 |
"controlValue": "37",
|
|
|
663 |
"threshold": "10",
|
|
|
664 |
"notifyType": "Email",
|
656 |
"notificationType": "string"
|
665 |
"notificationType": 5,
|
|
|
666 |
"hostname": "null",
|
|
|
667 |
"port": 0,
|
|
|
668 |
"path": "null",
|
|
|
669 |
"method": "null",
|
|
|
670 |
"emailTo": [
|
|
|
671 |
"miguel.rodrigues@knowledgebiz.pt",
|
|
|
672 |
"miguel.andre.rodrigues@gmail.com",
|
|
|
673 |
"ma.rodrigues@campus.fct.unl.pt"
|
|
|
674 |
]
|
657 |
}`
|
675 |
}
|
|
|
676 |
]`
|
658 |
|
677 |
|
659 |
#### Return Payload
|
678 |
#### Return Payload
|
660 |
|
679 |
|
661 |
The API response will contain a JSON document with the property `success`: **true**, **false** and the `reason` if the `success` became **false**.
|
680 |
The API response will contain a JSON document with the property `success`: **true**, **false** and the `reason` if the `success` became **false**.
|
662 |
|
681 |
|