Add REST API endpoints for manual automation script triggering

This commit is contained in:
Denis Arh
2020-01-18 07:05:34 +01:00
parent 7491936742
commit ebb9b70bfe
49 changed files with 2578 additions and 59 deletions
+115
View File
@@ -111,6 +111,53 @@
# Compose automation scripts
| Method | Endpoint | Purpose |
| ------ | -------- | ------- |
| `GET` | `/automation/` | List all available automation scripts for compose resources |
| `POST` | `/automation/trigger` | Triggers execution of a specific script on a system service level |
## List all available automation scripts for compose resources
#### Method
| URI | Protocol | Method | Authentication |
| --- | -------- | ------ | -------------- |
| `/automation/` | HTTP/S | GET |
Warning: implode(): Invalid arguments passed in /private/tmp/Users/darh/Work.crust/corteza-server/codegen/templates/README.tpl on line 32
|
#### Request parameters
| Parameter | Type | Method | Description | Default | Required? |
| --------- | ---- | ------ | ----------- | ------- | --------- |
| resourceTypes | []string | GET | Filter by resource type | N/A | NO |
| eventTypes | []string | GET | Filter by event type | N/A | NO |
| excludeClientScripts | bool | GET | Do not include client scripts | N/A | NO |
| excludeServerScripts | bool | GET | Do not include server scripts | N/A | NO |
## Triggers execution of a specific script on a system service level
#### Method
| URI | Protocol | Method | Authentication |
| --- | -------- | ------ | -------------- |
| `/automation/trigger` | HTTP/S | POST |
Warning: implode(): Invalid arguments passed in /private/tmp/Users/darh/Work.crust/corteza-server/codegen/templates/README.tpl on line 32
|
#### Request parameters
| Parameter | Type | Method | Description | Default | Required? |
| --------- | ---- | ------ | ----------- | ------- | --------- |
| script | string | POST | Script to execute | N/A | YES |
---
# Charts
| Method | Endpoint | Purpose |
@@ -222,6 +269,7 @@ Compose module definitions
| `GET` | `/namespace/{namespaceID}/module/{moduleID}` | Read module |
| `POST` | `/namespace/{namespaceID}/module/{moduleID}` | Update module |
| `DELETE` | `/namespace/{namespaceID}/module/{moduleID}` | Delete module |
| `POST` | `/namespace/{namespaceID}/module/{moduleID}/trigger` | Fire compose:module trigger |
## List modules
@@ -311,6 +359,22 @@ Compose module definitions
| moduleID | uint64 | PATH | Module ID | N/A | YES |
| namespaceID | uint64 | PATH | Namespace ID | N/A | YES |
## Fire compose:module trigger
#### Method
| URI | Protocol | Method | Authentication |
| --- | -------- | ------ | -------------- |
| `/namespace/{namespaceID}/module/{moduleID}/trigger` | HTTP/S | POST | |
#### Request parameters
| Parameter | Type | Method | Description | Default | Required? |
| --------- | ---- | ------ | ----------- | ------- | --------- |
| moduleID | uint64 | PATH | ID | N/A | YES |
| namespaceID | uint64 | PATH | Namespace ID | N/A | YES |
| script | string | POST | Script to execute | N/A | YES |
---
@@ -325,6 +389,7 @@ Compose module definitions
| `GET` | `/namespace/{namespaceID}` | Read namespace |
| `POST` | `/namespace/{namespaceID}` | Update namespace |
| `DELETE` | `/namespace/{namespaceID}` | Delete namespace |
| `POST` | `/namespace/{namespaceID}/trigger` | Fire compose:namespace trigger |
## List namespaces
@@ -408,6 +473,21 @@ Compose module definitions
| --------- | ---- | ------ | ----------- | ------- | --------- |
| namespaceID | uint64 | PATH | ID | N/A | YES |
## Fire compose:namespace trigger
#### Method
| URI | Protocol | Method | Authentication |
| --- | -------- | ------ | -------------- |
| `/namespace/{namespaceID}/trigger` | HTTP/S | POST | |
#### Request parameters
| Parameter | Type | Method | Description | Default | Required? |
| --------- | ---- | ------ | ----------- | ------- | --------- |
| namespaceID | uint64 | PATH | ID | N/A | YES |
| script | string | POST | Script to execute | N/A | YES |
---
@@ -459,6 +539,7 @@ Compose pages
| `POST` | `/namespace/{namespaceID}/page/{selfID}/reorder` | Reorder pages |
| `Delete` | `/namespace/{namespaceID}/page/{pageID}` | Delete page |
| `POST` | `/namespace/{namespaceID}/page/{pageID}/attachment` | Uploads attachment to page |
| `POST` | `/namespace/{namespaceID}/page/{pageID}/trigger` | Fire compose:page trigger |
## List available pages
@@ -599,6 +680,22 @@ Compose pages
| namespaceID | uint64 | PATH | Namespace ID | N/A | YES |
| upload | *multipart.FileHeader | POST | File to upload | N/A | YES |
## Fire compose:page trigger
#### Method
| URI | Protocol | Method | Authentication |
| --- | -------- | ------ | -------------- |
| `/namespace/{namespaceID}/page/{pageID}/trigger` | HTTP/S | POST | |
#### Request parameters
| Parameter | Type | Method | Description | Default | Required? |
| --------- | ---- | ------ | ----------- | ------- | --------- |
| pageID | uint64 | PATH | Page ID | N/A | YES |
| namespaceID | uint64 | PATH | Namespace ID | N/A | YES |
| script | string | POST | Script to execute | N/A | YES |
---
@@ -707,6 +804,7 @@ Compose records
| `POST` | `/namespace/{namespaceID}/module/{moduleID}/record/{recordID}` | Update records in module section |
| `DELETE` | `/namespace/{namespaceID}/module/{moduleID}/record/{recordID}` | Delete record row from module section |
| `POST` | `/namespace/{namespaceID}/module/{moduleID}/record/attachment` | Uploads attachment and validates it against record field requirements |
| `POST` | `/namespace/{namespaceID}/module/{moduleID}/record/{recordID}/trigger` | Fire compose:record trigger |
## Generates report from module records
@@ -914,6 +1012,23 @@ Compose records
| namespaceID | uint64 | PATH | Namespace ID | N/A | YES |
| moduleID | uint64 | PATH | Module ID | N/A | YES |
## Fire compose:record trigger
#### Method
| URI | Protocol | Method | Authentication |
| --- | -------- | ------ | -------------- |
| `/namespace/{namespaceID}/module/{moduleID}/record/{recordID}/trigger` | HTTP/S | POST | |
#### Request parameters
| Parameter | Type | Method | Description | Default | Required? |
| --------- | ---- | ------ | ----------- | ------- | --------- |
| recordID | uint64 | PATH | ID | N/A | YES |
| namespaceID | uint64 | PATH | Namespace ID | N/A | YES |
| moduleID | uint64 | PATH | Module ID | N/A | YES |
| script | string | POST | Script to execute | N/A | YES |
---
+95
View File
@@ -8,6 +8,7 @@
| `GET` | `/application/{applicationID}` | Read application details |
| `DELETE` | `/application/{applicationID}` | Remove application |
| `POST` | `/application/{applicationID}/undelete` | Undelete application |
| `POST` | `/application/{applicationID}/trigger` | Fire system:application trigger |
## List applications
@@ -105,6 +106,21 @@
| --------- | ---- | ------ | ----------- | ------- | --------- |
| applicationID | uint64 | PATH | Application ID | N/A | YES |
## Fire system:application trigger
#### Method
| URI | Protocol | Method | Authentication |
| --- | -------- | ------ | -------------- |
| `/application/{applicationID}/trigger` | HTTP/S | POST | |
#### Request parameters
| Parameter | Type | Method | Description | Default | Required? |
| --------- | ---- | ------ | ----------- | ------- | --------- |
| applicationID | uint64 | PATH | ID | N/A | YES |
| script | string | POST | Script to execute | N/A | YES |
---
@@ -299,6 +315,53 @@
# System automation scripts
| Method | Endpoint | Purpose |
| ------ | -------- | ------- |
| `GET` | `/automation/` | List all available automation scripts for system resources |
| `POST` | `/automation/trigger` | Triggers execution of a specific script on a system service level |
## List all available automation scripts for system resources
#### Method
| URI | Protocol | Method | Authentication |
| --- | -------- | ------ | -------------- |
| `/automation/` | HTTP/S | GET |
Warning: implode(): Invalid arguments passed in /private/tmp/Users/darh/Work.crust/corteza-server/codegen/templates/README.tpl on line 32
|
#### Request parameters
| Parameter | Type | Method | Description | Default | Required? |
| --------- | ---- | ------ | ----------- | ------- | --------- |
| resourceTypes | []string | GET | Filter by resource type | N/A | NO |
| eventTypes | []string | GET | Filter by event type | N/A | NO |
| excludeClientScripts | bool | GET | Do not include client scripts | N/A | NO |
| excludeServerScripts | bool | GET | Do not include server scripts | N/A | NO |
## Triggers execution of a specific script on a system service level
#### Method
| URI | Protocol | Method | Authentication |
| --- | -------- | ------ | -------------- |
| `/automation/trigger` | HTTP/S | POST |
Warning: implode(): Invalid arguments passed in /private/tmp/Users/darh/Work.crust/corteza-server/codegen/templates/README.tpl on line 32
|
#### Request parameters
| Parameter | Type | Method | Description | Default | Required? |
| --------- | ---- | ------ | ----------- | ------- | --------- |
| script | string | POST | Script to execute | N/A | YES |
---
# Organisations
Organisations represent a top-level grouping entity. There may be many organisations defined in a single deployment.
@@ -638,6 +701,7 @@ An organisation may have many roles. Roles may have many channels available. Acc
| `GET` | `/roles/{roleID}/members` | Returns all role members |
| `POST` | `/roles/{roleID}/member/{userID}` | Add member to a role |
| `DELETE` | `/roles/{roleID}/member/{userID}` | Remove member from a role |
| `POST` | `/roles/{roleID}/trigger` | Fire system:role trigger |
## List roles
@@ -835,6 +899,21 @@ An organisation may have many roles. Roles may have many channels available. Acc
| roleID | uint64 | PATH | Source Role ID | N/A | YES |
| userID | uint64 | PATH | User ID | N/A | YES |
## Fire system:role trigger
#### Method
| URI | Protocol | Method | Authentication |
| --- | -------- | ------ | -------------- |
| `/roles/{roleID}/trigger` | HTTP/S | POST | Client ID, Session ID |
#### Request parameters
| Parameter | Type | Method | Description | Default | Required? |
| --------- | ---- | ------ | ----------- | ------- | --------- |
| roleID | uint64 | PATH | ID | N/A | YES |
| script | string | POST | Script to execute | N/A | YES |
---
@@ -976,6 +1055,7 @@ Warning: implode(): Invalid arguments passed in /private/tmp/Users/darh/Work.cru
| `GET` | `/users/{userID}/membership` | Add member to a role |
| `POST` | `/users/{userID}/membership/{roleID}` | Add role to a user |
| `DELETE` | `/users/{userID}/membership/{roleID}` | Remove role from a user |
| `POST` | `/users/{userID}/trigger` | Fire system:user trigger |
## Search users (Directory)
@@ -1168,4 +1248,19 @@ Warning: implode(): Invalid arguments passed in /private/tmp/Users/darh/Work.cru
| roleID | uint64 | PATH | Role ID | N/A | YES |
| userID | uint64 | PATH | User ID | N/A | YES |
## Fire system:user trigger
#### Method
| URI | Protocol | Method | Authentication |
| --- | -------- | ------ | -------------- |
| `/users/{userID}/trigger` | HTTP/S | POST | Client ID, Session ID |
#### Request parameters
| Parameter | Type | Method | Description | Default | Required? |
| --------- | ---- | ------ | ----------- | ------- | --------- |
| userID | uint64 | PATH | ID | N/A | YES |
| script | string | POST | Script to execute | N/A | YES |
---