3
0

Basic system autuomation, mail processing

This commit is contained in:
Denis Arh
2019-09-03 09:09:44 +02:00
parent 78660c47ec
commit 6b5ef8aaae
19 changed files with 2807 additions and 122 deletions
+223
View File
@@ -278,6 +278,229 @@
# Automation scripts
| Method | Endpoint | Purpose |
| ------ | -------- | ------- |
| `GET` | `/automation/script/` | List/read automation script |
| `POST` | `/automation/script/` | Add new automation script |
| `GET` | `/automation/script/{scriptID}` | Read automation script by ID |
| `POST` | `/automation/script/{scriptID}` | Update automation script |
| `DELETE` | `/automation/script/{scriptID}` | Delete script |
| `POST` | `/automation/script/test` | Run source code in corredor. Used for testing |
## List/read automation script
#### Method
| URI | Protocol | Method | Authentication |
| --- | -------- | ------ | -------------- |
| `/automation/script/` | HTTP/S | GET | Client ID, Session ID |
#### Request parameters
| Parameter | Type | Method | Description | Default | Required? |
| --------- | ---- | ------ | ----------- | ------- | --------- |
| query | string | GET | Search query to match against automation script | N/A | NO |
| resource | string | GET | Limit by resource (via trigger) | N/A | NO |
| incDeleted | bool | GET | Include deleted scripts | N/A | NO |
| page | uint | GET | Page number (0 based) | N/A | NO |
| perPage | uint | GET | Returned items per page (default 50) | N/A | NO |
## Add new automation script
#### Method
| URI | Protocol | Method | Authentication |
| --- | -------- | ------ | -------------- |
| `/automation/script/` | HTTP/S | POST | Client ID, Session ID |
#### Request parameters
| Parameter | Type | Method | Description | Default | Required? |
| --------- | ---- | ------ | ----------- | ------- | --------- |
| name | string | POST | automation name | N/A | NO |
| sourceRef | string | POST | Source URL | N/A | NO |
| source | string | POST | Source code | N/A | NO |
| runAs | uint64 | POST | Run as specific user | N/A | NO |
| timeout | uint | POST | Script timeout (in milliseconds) | N/A | NO |
| critical | bool | POST | Is it critical to run this script successfully | N/A | NO |
| async | bool | POST | Will this script be ran asynchronously | N/A | NO |
| enabled | bool | POST | | N/A | NO |
| triggers | automation.TriggerSet | POST | | N/A | NO |
## Read automation script by ID
#### Method
| URI | Protocol | Method | Authentication |
| --- | -------- | ------ | -------------- |
| `/automation/script/{scriptID}` | HTTP/S | GET | Client ID, Session ID |
#### Request parameters
| Parameter | Type | Method | Description | Default | Required? |
| --------- | ---- | ------ | ----------- | ------- | --------- |
| scriptID | uint64 | PATH | automation script ID | N/A | YES |
## Update automation script
#### Method
| URI | Protocol | Method | Authentication |
| --- | -------- | ------ | -------------- |
| `/automation/script/{scriptID}` | HTTP/S | POST | Client ID, Session ID |
#### Request parameters
| Parameter | Type | Method | Description | Default | Required? |
| --------- | ---- | ------ | ----------- | ------- | --------- |
| scriptID | uint64 | PATH | Automation script ID | N/A | YES |
| name | string | POST | Script name | N/A | NO |
| sourceRef | string | POST | Source URL | N/A | NO |
| source | string | POST | Source code | N/A | NO |
| runAs | uint64 | POST | Run script as specific user | N/A | NO |
| timeout | uint | POST | Run script in user-agent (browser) | N/A | NO |
| critical | bool | POST | Is it critical to run this script successfully | N/A | NO |
| async | bool | POST | Will this script be ran asynchronously | N/A | NO |
| enabled | bool | POST | | N/A | NO |
| triggers | automation.TriggerSet | POST | | N/A | NO |
## Delete script
#### Method
| URI | Protocol | Method | Authentication |
| --- | -------- | ------ | -------------- |
| `/automation/script/{scriptID}` | HTTP/S | DELETE | Client ID, Session ID |
#### Request parameters
| Parameter | Type | Method | Description | Default | Required? |
| --------- | ---- | ------ | ----------- | ------- | --------- |
| scriptID | uint64 | PATH | Script ID | N/A | YES |
## Run source code in corredor. Used for testing
#### Method
| URI | Protocol | Method | Authentication |
| --- | -------- | ------ | -------------- |
| `/automation/script/test` | HTTP/S | POST | Client ID, Session ID |
#### Request parameters
| Parameter | Type | Method | Description | Default | Required? |
| --------- | ---- | ------ | ----------- | ------- | --------- |
| source | string | POST | Script's source code | N/A | NO |
| payload | json.RawMessage | POST | Payload to be used | N/A | NO |
---
# Automation script triggers
| Method | Endpoint | Purpose |
| ------ | -------- | ------- |
| `GET` | `/automation/script/{scriptID}/trigger/` | List/read automation script triggers |
| `POST` | `/automation/script/{scriptID}/trigger/` | Add new automation script trigger |
| `GET` | `/automation/script/{scriptID}/trigger/{triggerID}` | Read automation script trigger by ID |
| `POST` | `/automation/script/{scriptID}/trigger/{triggerID}` | Update automation script trigger |
| `DELETE` | `/automation/script/{scriptID}/trigger/{triggerID}` | Delete script |
## List/read automation script triggers
#### Method
| URI | Protocol | Method | Authentication |
| --- | -------- | ------ | -------------- |
| `/automation/script/{scriptID}/trigger/` | HTTP/S | GET | Client ID, Session ID |
#### Request parameters
| Parameter | Type | Method | Description | Default | Required? |
| --------- | ---- | ------ | ----------- | ------- | --------- |
| resource | string | GET | Only triggers of a specific resource | N/A | NO |
| event | string | GET | Only triggers of a specific event | N/A | NO |
| incDeleted | bool | GET | Include deleted scripts | N/A | NO |
| page | uint | GET | Page number (0 based) | N/A | NO |
| perPage | uint | GET | Returned items per page (default 50) | N/A | NO |
| scriptID | uint64 | PATH | Script ID | N/A | YES |
## Add new automation script trigger
#### Method
| URI | Protocol | Method | Authentication |
| --- | -------- | ------ | -------------- |
| `/automation/script/{scriptID}/trigger/` | HTTP/S | POST | Client ID, Session ID |
#### Request parameters
| Parameter | Type | Method | Description | Default | Required? |
| --------- | ---- | ------ | ----------- | ------- | --------- |
| resource | string | POST | Resource | N/A | YES |
| event | string | POST | Event | N/A | YES |
| condition | string | POST | Event | N/A | NO |
| enabled | bool | POST | | N/A | NO |
| scriptID | uint64 | PATH | Script ID | N/A | YES |
## Read automation script trigger by ID
#### Method
| URI | Protocol | Method | Authentication |
| --- | -------- | ------ | -------------- |
| `/automation/script/{scriptID}/trigger/{triggerID}` | HTTP/S | GET | Client ID, Session ID |
#### Request parameters
| Parameter | Type | Method | Description | Default | Required? |
| --------- | ---- | ------ | ----------- | ------- | --------- |
| triggerID | uint64 | PATH | Automation script trigger ID | N/A | YES |
| scriptID | uint64 | PATH | Script ID | N/A | YES |
## Update automation script trigger
#### Method
| URI | Protocol | Method | Authentication |
| --- | -------- | ------ | -------------- |
| `/automation/script/{scriptID}/trigger/{triggerID}` | HTTP/S | POST | Client ID, Session ID |
#### Request parameters
| Parameter | Type | Method | Description | Default | Required? |
| --------- | ---- | ------ | ----------- | ------- | --------- |
| triggerID | uint64 | PATH | Automation script trigger ID | N/A | YES |
| scriptID | uint64 | PATH | Script ID | N/A | YES |
| resource | string | POST | Resource | N/A | YES |
| event | string | POST | Event | N/A | YES |
| condition | string | POST | Event | N/A | NO |
| enabled | bool | POST | | N/A | NO |
## Delete script
#### Method
| URI | Protocol | Method | Authentication |
| --- | -------- | ------ | -------------- |
| `/automation/script/{scriptID}/trigger/{triggerID}` | HTTP/S | DELETE | Client ID, Session ID |
#### Request parameters
| Parameter | Type | Method | Description | Default | Required? |
| --------- | ---- | ------ | ----------- | ------- | --------- |
| triggerID | uint64 | PATH | Automation script trigger ID | N/A | YES |
| scriptID | uint64 | PATH | Script ID | N/A | YES |
---
# Organisations
Organisations represent a top-level grouping entity. There may be many organisations defined in a single deployment.