|
1 | 1 | FORMAT: 1A |
2 | 2 |
|
3 | 3 | # cluster-orchestrator |
4 | | -Notes API is a *short texts saving* service similar to its physical paper presence on your table. |
5 | | - |
6 | | -# Group Notes |
7 | | -Notes related resources of the **Notes API** |
8 | | - |
9 | | -## Notes Collection [/notes] |
10 | | -### List all Notes [GET] |
11 | | -+ Response 200 (application/json) |
12 | | - |
13 | | - [{ |
14 | | - "id": 1, "title": "Jogging in park" |
15 | | - }, { |
16 | | - "id": 2, "title": "Pick-up posters from post-office" |
17 | | - }] |
18 | | - |
19 | | -### Create a Note [POST] |
20 | | -+ Request (application/json) |
21 | | - |
22 | | - { "title": "Buy cheese and bread for breakfast." } |
23 | | - |
24 | | -+ Response 201 (application/json) |
25 | | - |
26 | | - { "id": 3, "title": "Buy cheese and bread for breakfast." } |
| 4 | +API for orchestrator used in totem v2. All public facing api use /external as route path prefix. |
| 5 | + |
| 6 | +## Generic Internal Hook [POST /hooks/generic] |
| 7 | +API for posting custom callback hook to internal orchestrator api. |
| 8 | + |
| 9 | +*Note: Orchestrator does not clone the repository and simply use git information |
| 10 | +as meta-information for locating totem.yml. This file need not be present in git repository and can be stored in other config providers like s3, etcd.* |
| 11 | + |
| 12 | ++ Request |
| 13 | + |
| 14 | + + Headers |
| 15 | + |
| 16 | + Content-Type: application/vnd.orch.generic.hook.v1+json |
| 17 | + Accept: application/vnd.orch.task.v1+json, application/json |
| 18 | + |
| 19 | + + Schema |
| 20 | + |
| 21 | + { |
| 22 | + "$schema": "http://json-schema.org/draft-04/hyper-schema#", |
| 23 | + "type": "object", |
| 24 | + "title": "Schema for Generic Hook payload", |
| 25 | + "id": "#generic-hook-v1", |
| 26 | + "properties": { |
| 27 | + "git": { |
| 28 | + "description": "Git meta-information used for locating totem.yml." |
| 29 | + "$ref": "#/definitions/git" |
| 30 | + }, |
| 31 | + "name": { |
| 32 | + "description": "Name of the hook (e.g. image-factory)", |
| 33 | + "type": "string", |
| 34 | + "maxLength": 100 |
| 35 | + }, |
| 36 | + "type": { |
| 37 | + "description": "Type of the hook (e.g. builder, ci)", |
| 38 | + "enum": ["builder", "ci", "scm-create", "scm-push"] |
| 39 | + }, |
| 40 | + "status": { |
| 41 | + "description": "Status for the hook (failed, success)", |
| 42 | + "enum": ["success", "failed"] |
| 43 | + }, |
| 44 | + "result": { |
| 45 | + "description": "Result object", |
| 46 | + "type": "object" |
| 47 | + }, |
| 48 | + "force-deploy": { |
| 49 | + "description": "Force deploy the image on receiving this hook (ignore status)", |
| 50 | + "type": "boolean" |
| 51 | + } |
| 52 | + }, |
| 53 | + "additionalProperties": false, |
| 54 | + "required": ["name", "type", "git"], |
| 55 | + "definitions": { |
| 56 | + "git": { |
| 57 | + "properties": { |
| 58 | + "owner": { |
| 59 | + "title": "Owner/Organization of the SCM repository (e.g. totem)", |
| 60 | + "type": "string", |
| 61 | + "maxLength": 100 |
| 62 | + }, |
| 63 | + "repo": { |
| 64 | + "title": "SCM repository name (e.g.: spec-python)", |
| 65 | + "type": "string", |
| 66 | + "maxLength": 100 |
| 67 | + }, |
| 68 | + "ref": { |
| 69 | + "title": "Branch or tag name", |
| 70 | + "type": "string", |
| 71 | + "maxLength": 100 |
| 72 | + }, |
| 73 | + "commit": { |
| 74 | + "title": "Git SHA Commit ID", |
| 75 | + "type": ["string", "null"], |
| 76 | + "maxLength": 100 |
| 77 | + } |
| 78 | + }, |
| 79 | + "additionalProperties": false, |
| 80 | + "required": ["owner", "repo", "ref"] |
| 81 | + } |
| 82 | + } |
| 83 | + } |
| 84 | + |
| 85 | + + Body |
| 86 | + |
| 87 | + { |
| 88 | + "git":{ |
| 89 | + "owner": "totem", |
| 90 | + "repo": "totem-demo", |
| 91 | + "ref": "master", |
| 92 | + "commit": "75863c8b181c00a6e0f70ed3a876edc1b3a6a662" |
| 93 | + }, |
| 94 | + "type": "builder", |
| 95 | + "name": "mybuilder", |
| 96 | + "status": "success", |
| 97 | + "force-deploy": true, |
| 98 | + "result": { |
| 99 | + "image": "totem/totem-demo:latest" |
| 100 | + } |
| 101 | + } |
| 102 | + |
| 103 | + |
| 104 | ++ Response 202 (application/vnd.orch.task.v1+json) |
| 105 | + |
| 106 | + + Headers |
| 107 | + |
| 108 | + Location: /tasks/94ddd430-5e66-48d9-a1b4-f996b6bd2489 |
| 109 | + |
| 110 | + + Body |
| 111 | + |
| 112 | + { |
| 113 | + "task_id": "81b5de1c-a7af-4bc2-9593-644645f655bc" |
| 114 | + } |
| 115 | + |
| 116 | + |
| 117 | +## Get Asynchronous Task Status [GET /tasks/{task_id}] |
27 | 118 |
|
28 | | -## Note [/notes/{id}] |
29 | | -A single Note object with all its details |
| 119 | +Gets status for asynchronous job created as a result of posting a new callback hook to orchestrator. |
| 120 | +*Note: The job status can also be obtained from elasticsearch if totem is setup to sync mongo with ES.* |
30 | 121 |
|
31 | 122 | + Parameters |
32 | | - + id (required, number, `1`) ... Numeric `id` of the Note to perform action with. Has example value. |
| 123 | + + task_id (required, string, `c47d3c50-2877-4119-850e-71aaae3d53ba`) ... Task ID (`task_id`) |
33 | 124 |
|
34 | | -### Retrieve a Note [GET] |
35 | | -+ Response 200 (application/json) |
| 125 | ++ Request |
36 | 126 |
|
37 | | - + Header |
| 127 | + + Headers |
| 128 | + |
| 129 | + Accept: application/json |
38 | 130 |
|
39 | | - X-My-Header: The Value |
| 131 | ++ Response 200 |
40 | 132 |
|
41 | 133 | + Body |
| 134 | + |
| 135 | + { |
| 136 | + "output": { |
| 137 | + "config": { |
| 138 | + "deployers": {}, |
| 139 | + "enabled": true, |
| 140 | + "hooks": { |
| 141 | + "builder": { |
| 142 | + "image-factory": { |
| 143 | + "enabled": true |
| 144 | + } |
| 145 | + }, |
| 146 | + "ci": { |
| 147 | + "travis": { |
| 148 | + "enabled": false |
| 149 | + } |
| 150 | + }, |
| 151 | + "scm-create": { |
| 152 | + "github-create": { |
| 153 | + "enabled": true |
| 154 | + } |
| 155 | + }, |
| 156 | + "scm-push": { |
| 157 | + "github-push": { |
| 158 | + "enabled": true |
| 159 | + } |
| 160 | + } |
| 161 | + }, |
| 162 | + "notifications": {}, |
| 163 | + "scm": { |
| 164 | + "auth": { |
| 165 | + "token": "" |
| 166 | + }, |
| 167 | + "type": "github" |
| 168 | + }, |
| 169 | + "security": { |
| 170 | + "profile": "default" |
| 171 | + } |
| 172 | + }, |
| 173 | + "force-deploy": false, |
| 174 | + "hooks": { |
| 175 | + "builder": { |
| 176 | + "image-factory": { |
| 177 | + "status": "pending" |
| 178 | + } |
| 179 | + }, |
| 180 | + "ci": {}, |
| 181 | + "scm-create": { |
| 182 | + "github-create": { |
| 183 | + "status": "pending" |
| 184 | + } |
| 185 | + }, |
| 186 | + "scm-push": { |
| 187 | + "github-push": { |
| 188 | + "status": "pending" |
| 189 | + } |
| 190 | + } |
| 191 | + }, |
| 192 | + "meta-info": { |
| 193 | + "git": { |
| 194 | + "commit": "c4084c20ba721be7c9d5d625c7749659cc4fd702", |
| 195 | + "commit-set": [ |
| 196 | + "c4084c20ba721be7c9d5d625c7749659cc4fd702" |
| 197 | + ], |
| 198 | + "owner": "totem", |
| 199 | + "ref": "develop", |
| 200 | + "repo": "cluster-orchestrator" |
| 201 | + }, |
| 202 | + "job-id": "ac572a97-f285-4917-8ff4-4ecb8a142488" |
| 203 | + }, |
| 204 | + "state": "NOOP" |
| 205 | + }, |
| 206 | + "status": "READY" |
| 207 | + } |
| 208 | + |
42 | 209 |
|
43 | | - { "id": 2, "title": "Pick-up posters from post-office" } |
44 | 210 |
|
45 | | -### Remove a Note [DELETE] |
46 | | -+ Response 204 |
|
0 commit comments