@antelopejs/cloud-sdk 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +63 -2
- package/dist/api-error.d.ts +21 -0
- package/dist/api-error.js +27 -0
- package/dist/api.d.ts +193 -0
- package/dist/api.js +224 -0
- package/dist/environments.d.ts +48 -0
- package/dist/environments.js +81 -0
- package/dist/generated/cloud-api.d.ts +1612 -0
- package/dist/generated/cloud-api.js +6 -0
- package/dist/guards.d.ts +9 -0
- package/dist/guards.js +16 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +5 -0
- package/dist/resources.d.ts +43 -0
- package/dist/resources.js +2 -0
- package/dist/result.d.ts +25 -0
- package/dist/result.js +36 -0
- package/dist/sse.d.ts +6 -0
- package/dist/sse.js +45 -0
- package/openapi/cloud.openapi.yaml +556 -0
- package/openapi/environments.yaml +341 -0
- package/openapi/resources.openapi.yaml +274 -0
- package/openapi/variables.parts.yaml +127 -0
- package/package.json +68 -4
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
components:
|
|
2
|
+
schemas:
|
|
3
|
+
EnvironmentList:
|
|
4
|
+
type: object
|
|
5
|
+
required: [environments]
|
|
6
|
+
properties:
|
|
7
|
+
environments:
|
|
8
|
+
type: array
|
|
9
|
+
items: { $ref: '#/components/schemas/EnvironmentDetail' }
|
|
10
|
+
EnvironmentDetail:
|
|
11
|
+
description: An environment of a project, the git branch it builds and what it serves.
|
|
12
|
+
type: object
|
|
13
|
+
required: [id, name, branch, state, url, isProtected, preview, serving, target, services]
|
|
14
|
+
properties:
|
|
15
|
+
id: { type: string }
|
|
16
|
+
name: { type: string }
|
|
17
|
+
branch:
|
|
18
|
+
description: The branch the environment builds. A push to it deploys a durable environment; a preview follows its pull request's head branch, which pull request updates deploy. Null for an environment the CLI deploys.
|
|
19
|
+
type: [string, "null"]
|
|
20
|
+
state:
|
|
21
|
+
description: The status of its services together.
|
|
22
|
+
type: string
|
|
23
|
+
enum: [live, build, waiting, sleep, failed, unknown]
|
|
24
|
+
url:
|
|
25
|
+
description: The address of its first public service; null when none answers on one.
|
|
26
|
+
type: [string, "null"]
|
|
27
|
+
format: uri
|
|
28
|
+
isProtected:
|
|
29
|
+
description: A protected environment refuses deletion.
|
|
30
|
+
type: boolean
|
|
31
|
+
preview:
|
|
32
|
+
description: The pull request a preview environment mirrors; null for a durable environment.
|
|
33
|
+
oneOf:
|
|
34
|
+
- $ref: '#/components/schemas/EnvironmentPreview'
|
|
35
|
+
- type: "null"
|
|
36
|
+
serving:
|
|
37
|
+
description: The last deployment that went live; null before the first one.
|
|
38
|
+
oneOf:
|
|
39
|
+
- $ref: '#/components/schemas/EnvironmentDeployment'
|
|
40
|
+
- type: "null"
|
|
41
|
+
target:
|
|
42
|
+
description: The latest deployment asked of the environment. It differs from serving while it rolls out, or after it failed and serving kept the traffic.
|
|
43
|
+
oneOf:
|
|
44
|
+
- $ref: '#/components/schemas/EnvironmentDeployment'
|
|
45
|
+
- type: "null"
|
|
46
|
+
services:
|
|
47
|
+
type: array
|
|
48
|
+
items: { $ref: '#/components/schemas/EnvironmentService' }
|
|
49
|
+
EnvironmentPreview:
|
|
50
|
+
type: object
|
|
51
|
+
required: [sourceEnvironmentId, repository, pullRequestNumber, headBranch]
|
|
52
|
+
properties:
|
|
53
|
+
sourceEnvironmentId: { type: string }
|
|
54
|
+
repository: { type: string }
|
|
55
|
+
pullRequestNumber: { type: integer }
|
|
56
|
+
headBranch: { type: string }
|
|
57
|
+
EnvironmentDeployment:
|
|
58
|
+
type: object
|
|
59
|
+
required: [id, number, status, commit, branch, createdAt]
|
|
60
|
+
properties:
|
|
61
|
+
id: { type: string }
|
|
62
|
+
number: { type: integer }
|
|
63
|
+
status: { type: string, enum: [queued, building, checking, switching, succeeded, failed, cancelled] }
|
|
64
|
+
commit:
|
|
65
|
+
description: The commit it built; null for a CLI upload or a rollback.
|
|
66
|
+
type: [string, "null"]
|
|
67
|
+
branch: { type: [string, "null"] }
|
|
68
|
+
createdAt: { type: string, format: date-time }
|
|
69
|
+
EnvironmentService:
|
|
70
|
+
type: object
|
|
71
|
+
required: [id, name, servingRevisionId, targetRevisionId]
|
|
72
|
+
properties:
|
|
73
|
+
id: { type: string }
|
|
74
|
+
name: { type: string }
|
|
75
|
+
servingRevisionId:
|
|
76
|
+
description: The revision serving traffic; null before the first one goes live.
|
|
77
|
+
type: [string, "null"]
|
|
78
|
+
targetRevisionId:
|
|
79
|
+
description: The revision last submitted; it equals servingRevisionId once live.
|
|
80
|
+
type: [string, "null"]
|
|
81
|
+
NewEnvironment:
|
|
82
|
+
type: object
|
|
83
|
+
required: [name]
|
|
84
|
+
properties:
|
|
85
|
+
name:
|
|
86
|
+
description: Stored as a slug.
|
|
87
|
+
type: string
|
|
88
|
+
branch:
|
|
89
|
+
description: The branch the environment builds; absent for one the CLI deploys.
|
|
90
|
+
type: [string, "null"]
|
|
91
|
+
cloneFrom:
|
|
92
|
+
description: An environment of the same project whose services the new one copies.
|
|
93
|
+
type: [string, "null"]
|
|
94
|
+
autoSleep: { type: boolean }
|
|
95
|
+
CreatedEnvironment:
|
|
96
|
+
type: object
|
|
97
|
+
required: [environmentId, name]
|
|
98
|
+
properties:
|
|
99
|
+
environmentId: { type: string }
|
|
100
|
+
name: { type: string }
|
|
101
|
+
Promotion:
|
|
102
|
+
description: What to put the environment on, a commit of the project's repository or the tip of one of its branches.
|
|
103
|
+
oneOf:
|
|
104
|
+
- type: object
|
|
105
|
+
additionalProperties: false
|
|
106
|
+
required: [commit]
|
|
107
|
+
properties:
|
|
108
|
+
commit: { type: string, pattern: '^[0-9a-f]{40}$' }
|
|
109
|
+
- type: object
|
|
110
|
+
additionalProperties: false
|
|
111
|
+
required: [branch]
|
|
112
|
+
properties:
|
|
113
|
+
branch:
|
|
114
|
+
description: A valid git branch name; the server refuses any other with 400.
|
|
115
|
+
type: string
|
|
116
|
+
PromotionReceipt:
|
|
117
|
+
type: object
|
|
118
|
+
required: [deploymentId, commit]
|
|
119
|
+
properties:
|
|
120
|
+
deploymentId: { type: string }
|
|
121
|
+
commit:
|
|
122
|
+
description: The commit the deployment builds, the branch tip read when the promotion named a branch.
|
|
123
|
+
type: string
|
|
124
|
+
ProjectRepository:
|
|
125
|
+
type: object
|
|
126
|
+
required: [repository]
|
|
127
|
+
properties:
|
|
128
|
+
repository:
|
|
129
|
+
description: The GitHub repository the project builds from, as owner/name. It is the linked one, else the one most of its services build from; null when neither exists.
|
|
130
|
+
type: [string, "null"]
|
|
131
|
+
EnvironmentHealth:
|
|
132
|
+
type: object
|
|
133
|
+
required: [environmentId, services]
|
|
134
|
+
properties:
|
|
135
|
+
environmentId: { type: string }
|
|
136
|
+
services:
|
|
137
|
+
type: array
|
|
138
|
+
items: { $ref: '#/components/schemas/ServiceHealth' }
|
|
139
|
+
ServiceHealth:
|
|
140
|
+
type: object
|
|
141
|
+
required: [serviceId, name, readinessPath, livenessPath, check, runtime]
|
|
142
|
+
properties:
|
|
143
|
+
serviceId: { type: string }
|
|
144
|
+
name: { type: string }
|
|
145
|
+
readinessPath:
|
|
146
|
+
description: The path the service is set to probe for readiness over HTTP; null for a TCP connect. A revision keeps the path it was deployed with, so a change applies at the next deployment.
|
|
147
|
+
type: [string, "null"]
|
|
148
|
+
livenessPath:
|
|
149
|
+
description: The path the service is set to probe for liveness over HTTP, the readiness path when it sets none; null for a TCP connect. A change applies at the next deployment.
|
|
150
|
+
type: [string, "null"]
|
|
151
|
+
check:
|
|
152
|
+
description: The start-up check of the target revision, which gates the traffic switch; null before the first revision.
|
|
153
|
+
oneOf:
|
|
154
|
+
- $ref: '#/components/schemas/RevisionCheck'
|
|
155
|
+
- type: "null"
|
|
156
|
+
runtime:
|
|
157
|
+
description: What the platform last reported of the running workload; null when it reported nothing.
|
|
158
|
+
oneOf:
|
|
159
|
+
- $ref: '#/components/schemas/RuntimeHealth'
|
|
160
|
+
- type: "null"
|
|
161
|
+
RevisionCheck:
|
|
162
|
+
type: object
|
|
163
|
+
required: [revisionId, number, state, startedAt, failure]
|
|
164
|
+
properties:
|
|
165
|
+
revisionId: { type: string }
|
|
166
|
+
number: { type: integer }
|
|
167
|
+
state:
|
|
168
|
+
description: Preparing and pending revisions are still being checked.
|
|
169
|
+
type: string
|
|
170
|
+
enum: [preparing, pending, succeeded, failed]
|
|
171
|
+
startedAt:
|
|
172
|
+
description: When the check started; null before it did.
|
|
173
|
+
type: [string, "null"]
|
|
174
|
+
format: date-time
|
|
175
|
+
failure:
|
|
176
|
+
description: Why the revision never went live; null unless it failed.
|
|
177
|
+
oneOf:
|
|
178
|
+
- type: object
|
|
179
|
+
required: [reason, detail]
|
|
180
|
+
properties:
|
|
181
|
+
reason: { type: string, enum: [image_pull, crash_loop, runtime, scheduling, health_check, no_pod, refused] }
|
|
182
|
+
detail: { type: [string, "null"] }
|
|
183
|
+
- type: "null"
|
|
184
|
+
RuntimeHealth:
|
|
185
|
+
type: object
|
|
186
|
+
required: [phase, message, observedAt]
|
|
187
|
+
properties:
|
|
188
|
+
phase: { type: string, enum: [running, starting, pending, sleeping, failed, unknown, unschedulable, image-pull-failed, stalled] }
|
|
189
|
+
message: { type: [string, "null"] }
|
|
190
|
+
observedAt: { type: string, format: date-time }
|
|
191
|
+
paths:
|
|
192
|
+
repository:
|
|
193
|
+
get:
|
|
194
|
+
operationId: readProjectRepository
|
|
195
|
+
security: [{ bearerAuth: [] }]
|
|
196
|
+
parameters:
|
|
197
|
+
- in: path
|
|
198
|
+
name: projectId
|
|
199
|
+
required: true
|
|
200
|
+
schema: { type: string }
|
|
201
|
+
responses:
|
|
202
|
+
'200':
|
|
203
|
+
content:
|
|
204
|
+
application/json:
|
|
205
|
+
schema: { $ref: '#/components/schemas/ProjectRepository' }
|
|
206
|
+
default: { $ref: './cloud.openapi.yaml#/components/responses/Error' }
|
|
207
|
+
put:
|
|
208
|
+
operationId: linkProjectRepository
|
|
209
|
+
description: Links the project to a repository a GitHub installation of the workspace grants; null unlinks it, and the answer falls back to the repository most of its services build from.
|
|
210
|
+
security: [{ bearerAuth: [] }]
|
|
211
|
+
parameters:
|
|
212
|
+
- in: path
|
|
213
|
+
name: projectId
|
|
214
|
+
required: true
|
|
215
|
+
schema: { type: string }
|
|
216
|
+
requestBody:
|
|
217
|
+
required: true
|
|
218
|
+
content:
|
|
219
|
+
application/json:
|
|
220
|
+
schema: { $ref: '#/components/schemas/ProjectRepository' }
|
|
221
|
+
responses:
|
|
222
|
+
'200':
|
|
223
|
+
content:
|
|
224
|
+
application/json:
|
|
225
|
+
schema: { $ref: '#/components/schemas/ProjectRepository' }
|
|
226
|
+
default: { $ref: './cloud.openapi.yaml#/components/responses/Error' }
|
|
227
|
+
environments:
|
|
228
|
+
get:
|
|
229
|
+
operationId: listEnvironments
|
|
230
|
+
security: [{ bearerAuth: [] }]
|
|
231
|
+
parameters:
|
|
232
|
+
- in: path
|
|
233
|
+
name: projectId
|
|
234
|
+
required: true
|
|
235
|
+
schema: { type: string }
|
|
236
|
+
responses:
|
|
237
|
+
'200':
|
|
238
|
+
content:
|
|
239
|
+
application/json:
|
|
240
|
+
schema: { $ref: '#/components/schemas/EnvironmentList' }
|
|
241
|
+
default: { $ref: './cloud.openapi.yaml#/components/responses/Error' }
|
|
242
|
+
post:
|
|
243
|
+
operationId: createEnvironment
|
|
244
|
+
security: [{ bearerAuth: [] }]
|
|
245
|
+
parameters:
|
|
246
|
+
- in: path
|
|
247
|
+
name: projectId
|
|
248
|
+
required: true
|
|
249
|
+
schema: { type: string }
|
|
250
|
+
requestBody:
|
|
251
|
+
required: true
|
|
252
|
+
content:
|
|
253
|
+
application/json:
|
|
254
|
+
schema: { $ref: '#/components/schemas/NewEnvironment' }
|
|
255
|
+
responses:
|
|
256
|
+
'200':
|
|
257
|
+
content:
|
|
258
|
+
application/json:
|
|
259
|
+
schema: { $ref: '#/components/schemas/CreatedEnvironment' }
|
|
260
|
+
default: { $ref: './cloud.openapi.yaml#/components/responses/Error' }
|
|
261
|
+
environment:
|
|
262
|
+
get:
|
|
263
|
+
operationId: readEnvironment
|
|
264
|
+
security: [{ bearerAuth: [] }]
|
|
265
|
+
parameters:
|
|
266
|
+
- in: path
|
|
267
|
+
name: projectId
|
|
268
|
+
required: true
|
|
269
|
+
schema: { type: string }
|
|
270
|
+
- in: path
|
|
271
|
+
name: environmentId
|
|
272
|
+
required: true
|
|
273
|
+
schema: { type: string }
|
|
274
|
+
responses:
|
|
275
|
+
'200':
|
|
276
|
+
content:
|
|
277
|
+
application/json:
|
|
278
|
+
schema: { $ref: '#/components/schemas/EnvironmentDetail' }
|
|
279
|
+
default: { $ref: './cloud.openapi.yaml#/components/responses/Error' }
|
|
280
|
+
deletion:
|
|
281
|
+
post:
|
|
282
|
+
operationId: deleteEnvironment
|
|
283
|
+
description: Deletes the environment, its services and its previews. A protected environment refuses.
|
|
284
|
+
security: [{ bearerAuth: [] }]
|
|
285
|
+
parameters:
|
|
286
|
+
- in: path
|
|
287
|
+
name: projectId
|
|
288
|
+
required: true
|
|
289
|
+
schema: { type: string }
|
|
290
|
+
- in: path
|
|
291
|
+
name: environmentId
|
|
292
|
+
required: true
|
|
293
|
+
schema: { type: string }
|
|
294
|
+
responses:
|
|
295
|
+
'200':
|
|
296
|
+
description: Done
|
|
297
|
+
default: { $ref: './cloud.openapi.yaml#/components/responses/Error' }
|
|
298
|
+
promotion:
|
|
299
|
+
post:
|
|
300
|
+
operationId: promoteEnvironment
|
|
301
|
+
description: Builds and deploys a commit of the project's repository, or a branch tip, to the environment's services that build from it. The serving revision keeps the traffic until the new one passes its health check.
|
|
302
|
+
security: [{ bearerAuth: [] }]
|
|
303
|
+
parameters:
|
|
304
|
+
- in: path
|
|
305
|
+
name: projectId
|
|
306
|
+
required: true
|
|
307
|
+
schema: { type: string }
|
|
308
|
+
- in: path
|
|
309
|
+
name: environmentId
|
|
310
|
+
required: true
|
|
311
|
+
schema: { type: string }
|
|
312
|
+
requestBody:
|
|
313
|
+
required: true
|
|
314
|
+
content:
|
|
315
|
+
application/json:
|
|
316
|
+
schema: { $ref: '#/components/schemas/Promotion' }
|
|
317
|
+
responses:
|
|
318
|
+
'200':
|
|
319
|
+
content:
|
|
320
|
+
application/json:
|
|
321
|
+
schema: { $ref: '#/components/schemas/PromotionReceipt' }
|
|
322
|
+
default: { $ref: './cloud.openapi.yaml#/components/responses/Error' }
|
|
323
|
+
health:
|
|
324
|
+
get:
|
|
325
|
+
operationId: readEnvironmentHealth
|
|
326
|
+
security: [{ bearerAuth: [] }]
|
|
327
|
+
parameters:
|
|
328
|
+
- in: path
|
|
329
|
+
name: projectId
|
|
330
|
+
required: true
|
|
331
|
+
schema: { type: string }
|
|
332
|
+
- in: path
|
|
333
|
+
name: environmentId
|
|
334
|
+
required: true
|
|
335
|
+
schema: { type: string }
|
|
336
|
+
responses:
|
|
337
|
+
'200':
|
|
338
|
+
content:
|
|
339
|
+
application/json:
|
|
340
|
+
schema: { $ref: '#/components/schemas/EnvironmentHealth' }
|
|
341
|
+
default: { $ref: './cloud.openapi.yaml#/components/responses/Error' }
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
openapi: 3.1.0
|
|
2
|
+
info:
|
|
3
|
+
title: AntelopeJS Cloud resources API
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
servers:
|
|
6
|
+
- url: https://api.antelopejs.cloud
|
|
7
|
+
components:
|
|
8
|
+
schemas:
|
|
9
|
+
DatabaseEngine:
|
|
10
|
+
type: string
|
|
11
|
+
enum: [mongodb, postgres, mysql, redis, valkey]
|
|
12
|
+
DatabaseMode:
|
|
13
|
+
description: One instance on one volume, or a replicated cluster.
|
|
14
|
+
type: string
|
|
15
|
+
enum: [single, ha]
|
|
16
|
+
AppTier:
|
|
17
|
+
type: string
|
|
18
|
+
enum: [free, hobby, pro]
|
|
19
|
+
MonthlyCost:
|
|
20
|
+
description: A monthly amount in the plan's currency. A plan that rates nothing a database holds includes it, with no amount to show.
|
|
21
|
+
oneOf:
|
|
22
|
+
- type: object
|
|
23
|
+
required: [included, currency]
|
|
24
|
+
properties:
|
|
25
|
+
included: { const: true }
|
|
26
|
+
currency: { type: string }
|
|
27
|
+
- type: object
|
|
28
|
+
required: [included, currency, floor, ceiling]
|
|
29
|
+
properties:
|
|
30
|
+
included: { const: false }
|
|
31
|
+
currency: { type: string }
|
|
32
|
+
floor:
|
|
33
|
+
description: The reserved allocation of every instance held around the clock, plus the volumes.
|
|
34
|
+
type: number
|
|
35
|
+
ceiling:
|
|
36
|
+
description: The limits of every instance held around the clock, plus the volumes.
|
|
37
|
+
type: number
|
|
38
|
+
DatabaseFigures:
|
|
39
|
+
type: object
|
|
40
|
+
required: [label, version, volumeGb, instances, backups, connectionVariable, monthlyCost]
|
|
41
|
+
properties:
|
|
42
|
+
label: { type: string }
|
|
43
|
+
version: { type: string }
|
|
44
|
+
volumeGb:
|
|
45
|
+
description: Size of each instance's volume.
|
|
46
|
+
type: number
|
|
47
|
+
instances: { type: integer }
|
|
48
|
+
backups:
|
|
49
|
+
description: Whether its volume is backed up off the cluster.
|
|
50
|
+
type: boolean
|
|
51
|
+
connectionVariable:
|
|
52
|
+
description: The variable that carries its connection string into the project.
|
|
53
|
+
type: string
|
|
54
|
+
monthlyCost:
|
|
55
|
+
description: Null when no rates can be read.
|
|
56
|
+
oneOf:
|
|
57
|
+
- $ref: '#/components/schemas/MonthlyCost'
|
|
58
|
+
- type: "null"
|
|
59
|
+
EnvironmentResource:
|
|
60
|
+
description: A database the environment runs.
|
|
61
|
+
allOf:
|
|
62
|
+
- $ref: '#/components/schemas/DatabaseFigures'
|
|
63
|
+
- type: object
|
|
64
|
+
required: [serviceId, name, appName, engine, mode, module]
|
|
65
|
+
properties:
|
|
66
|
+
serviceId: { type: string }
|
|
67
|
+
name: { type: string }
|
|
68
|
+
appName: { type: string }
|
|
69
|
+
engine: { $ref: '#/components/schemas/DatabaseEngine' }
|
|
70
|
+
mode: { $ref: '#/components/schemas/DatabaseMode' }
|
|
71
|
+
module:
|
|
72
|
+
description: The npm package of the module it serves; null when it serves none.
|
|
73
|
+
type: [string, "null"]
|
|
74
|
+
EnvironmentResources:
|
|
75
|
+
type: object
|
|
76
|
+
required: [environmentId, resources]
|
|
77
|
+
properties:
|
|
78
|
+
environmentId: { type: string }
|
|
79
|
+
resources:
|
|
80
|
+
type: array
|
|
81
|
+
items: { $ref: '#/components/schemas/EnvironmentResource' }
|
|
82
|
+
ResourceModules:
|
|
83
|
+
type: object
|
|
84
|
+
required: [modules]
|
|
85
|
+
properties:
|
|
86
|
+
modules:
|
|
87
|
+
description: The npm package names of the project's modules, as `antelope.config.ts` lists them.
|
|
88
|
+
type: array
|
|
89
|
+
maxItems: 500
|
|
90
|
+
items: { type: string, minLength: 1, maxLength: 214 }
|
|
91
|
+
PlannedResource:
|
|
92
|
+
description: A database Cloud would create for a module.
|
|
93
|
+
allOf:
|
|
94
|
+
- $ref: '#/components/schemas/DatabaseFigures'
|
|
95
|
+
- type: object
|
|
96
|
+
required: [module, engine, mode, name]
|
|
97
|
+
properties:
|
|
98
|
+
module: { type: string }
|
|
99
|
+
engine: { $ref: '#/components/schemas/DatabaseEngine' }
|
|
100
|
+
mode: { $ref: '#/components/schemas/DatabaseMode' }
|
|
101
|
+
name:
|
|
102
|
+
description: The service name the apply creates it under. The engine's name, or `<engine>-2`, `<engine>-3` when a service of the environment, a retired database included, already holds it.
|
|
103
|
+
type: string
|
|
104
|
+
ExistingResource:
|
|
105
|
+
description: A database of the environment that already satisfies a module.
|
|
106
|
+
type: object
|
|
107
|
+
required: [module, serviceId, name, engine]
|
|
108
|
+
properties:
|
|
109
|
+
module: { type: string }
|
|
110
|
+
serviceId: { type: string }
|
|
111
|
+
name: { type: string }
|
|
112
|
+
engine: { $ref: '#/components/schemas/DatabaseEngine' }
|
|
113
|
+
UnprovidedResource:
|
|
114
|
+
description: A module whose need Cloud cannot provide.
|
|
115
|
+
oneOf:
|
|
116
|
+
- type: object
|
|
117
|
+
required: [module, resource, reason]
|
|
118
|
+
properties:
|
|
119
|
+
module: { type: string }
|
|
120
|
+
resource: { type: string }
|
|
121
|
+
reason:
|
|
122
|
+
description: Cloud does not run it.
|
|
123
|
+
const: not_offered
|
|
124
|
+
- type: object
|
|
125
|
+
required: [module, resource, reason, requiredTier]
|
|
126
|
+
properties:
|
|
127
|
+
module: { type: string }
|
|
128
|
+
resource: { type: string }
|
|
129
|
+
reason:
|
|
130
|
+
description: Cloud runs it, but no mode of it is on the workspace's plan.
|
|
131
|
+
const: not_on_plan
|
|
132
|
+
requiredTier:
|
|
133
|
+
description: The cheapest tier that runs it.
|
|
134
|
+
$ref: '#/components/schemas/AppTier'
|
|
135
|
+
CeilingUse:
|
|
136
|
+
description: A count held against a ceiling, before and after the plan is applied.
|
|
137
|
+
type: object
|
|
138
|
+
required: [used, ceiling, afterApply]
|
|
139
|
+
properties:
|
|
140
|
+
used: { type: integer }
|
|
141
|
+
ceiling: { type: integer }
|
|
142
|
+
afterApply:
|
|
143
|
+
description: '`used` plus what the plan creates.'
|
|
144
|
+
type: integer
|
|
145
|
+
ResourcePlanLimits:
|
|
146
|
+
type: object
|
|
147
|
+
required: [tier, planName, servicesPerEnvironment, databasesPerEnvironment]
|
|
148
|
+
properties:
|
|
149
|
+
tier: { $ref: '#/components/schemas/AppTier' }
|
|
150
|
+
planName: { type: [string, "null"] }
|
|
151
|
+
servicesPerEnvironment: { $ref: '#/components/schemas/CeilingUse' }
|
|
152
|
+
databasesPerEnvironment:
|
|
153
|
+
description: The databases the environment may hold, where the tier's topology caps them (Free); null where it does not.
|
|
154
|
+
oneOf:
|
|
155
|
+
- $ref: '#/components/schemas/CeilingUse'
|
|
156
|
+
- type: "null"
|
|
157
|
+
ResourcePlanRefusal:
|
|
158
|
+
description: |
|
|
159
|
+
Why an apply of the plan's databases is refused. Each has a stable error key:
|
|
160
|
+
`preview_environment` is `cloud.errors.resources.preview_environment`,
|
|
161
|
+
`services_per_environment` is `cloud.errors.resources.over_service_limit` and
|
|
162
|
+
`databases_per_environment` is `cloud.errors.resources.over_database_limit`.
|
|
163
|
+
type: string
|
|
164
|
+
enum: [preview_environment, services_per_environment, databases_per_environment]
|
|
165
|
+
ResourcePlan:
|
|
166
|
+
description: What applying a project's modules to an environment would do.
|
|
167
|
+
type: object
|
|
168
|
+
required: [create, existing, unprovided, cost, limits, refusals, canApply]
|
|
169
|
+
properties:
|
|
170
|
+
create:
|
|
171
|
+
type: array
|
|
172
|
+
items: { $ref: '#/components/schemas/PlannedResource' }
|
|
173
|
+
existing:
|
|
174
|
+
type: array
|
|
175
|
+
items: { $ref: '#/components/schemas/ExistingResource' }
|
|
176
|
+
unprovided:
|
|
177
|
+
type: array
|
|
178
|
+
items: { $ref: '#/components/schemas/UnprovidedResource' }
|
|
179
|
+
cost:
|
|
180
|
+
description: Summed over `create`; null when no rates can be read.
|
|
181
|
+
oneOf:
|
|
182
|
+
- $ref: '#/components/schemas/MonthlyCost'
|
|
183
|
+
- type: "null"
|
|
184
|
+
limits: { $ref: '#/components/schemas/ResourcePlanLimits' }
|
|
185
|
+
refusals:
|
|
186
|
+
description: Every reason the apply is refused, in the order creation would meet them. Empty when there is nothing to create.
|
|
187
|
+
type: array
|
|
188
|
+
items: { $ref: '#/components/schemas/ResourcePlanRefusal' }
|
|
189
|
+
canApply:
|
|
190
|
+
description: False when `refusals` is not empty. The apply then answers 409 before any write.
|
|
191
|
+
type: boolean
|
|
192
|
+
AppliedResources:
|
|
193
|
+
type: object
|
|
194
|
+
required: [created, plan]
|
|
195
|
+
properties:
|
|
196
|
+
created:
|
|
197
|
+
type: array
|
|
198
|
+
items: { $ref: '#/components/schemas/EnvironmentResource' }
|
|
199
|
+
plan:
|
|
200
|
+
description: The plan that remains once the databases are created.
|
|
201
|
+
$ref: '#/components/schemas/ResourcePlan'
|
|
202
|
+
paths:
|
|
203
|
+
/api/cloud/projects/{projectId}/environments/{environmentId}/resources:
|
|
204
|
+
get:
|
|
205
|
+
operationId: readEnvironmentResources
|
|
206
|
+
security: [{ bearerAuth: [] }]
|
|
207
|
+
parameters:
|
|
208
|
+
- in: path
|
|
209
|
+
name: projectId
|
|
210
|
+
required: true
|
|
211
|
+
schema: { type: string }
|
|
212
|
+
- in: path
|
|
213
|
+
name: environmentId
|
|
214
|
+
required: true
|
|
215
|
+
schema: { type: string }
|
|
216
|
+
responses:
|
|
217
|
+
'200':
|
|
218
|
+
content:
|
|
219
|
+
application/json:
|
|
220
|
+
schema: { $ref: '#/components/schemas/EnvironmentResources' }
|
|
221
|
+
default: { $ref: 'cloud.openapi.yaml#/components/responses/Error' }
|
|
222
|
+
/api/cloud/projects/{projectId}/environments/{environmentId}/resource-plan:
|
|
223
|
+
post:
|
|
224
|
+
operationId: planResources
|
|
225
|
+
security: [{ bearerAuth: [] }]
|
|
226
|
+
parameters:
|
|
227
|
+
- in: path
|
|
228
|
+
name: projectId
|
|
229
|
+
required: true
|
|
230
|
+
schema: { type: string }
|
|
231
|
+
- in: path
|
|
232
|
+
name: environmentId
|
|
233
|
+
required: true
|
|
234
|
+
schema: { type: string }
|
|
235
|
+
requestBody:
|
|
236
|
+
required: true
|
|
237
|
+
content:
|
|
238
|
+
application/json:
|
|
239
|
+
schema: { $ref: '#/components/schemas/ResourceModules' }
|
|
240
|
+
responses:
|
|
241
|
+
'200':
|
|
242
|
+
content:
|
|
243
|
+
application/json:
|
|
244
|
+
schema: { $ref: '#/components/schemas/ResourcePlan' }
|
|
245
|
+
default: { $ref: 'cloud.openapi.yaml#/components/responses/Error' }
|
|
246
|
+
/api/cloud/projects/{projectId}/environments/{environmentId}/resource-plan/apply:
|
|
247
|
+
post:
|
|
248
|
+
operationId: applyResources
|
|
249
|
+
description: |
|
|
250
|
+
Creates the databases the modules need, from a plan the server recomputes
|
|
251
|
+
under the environment's apply lock. A plan with `refusals` is refused with
|
|
252
|
+
409 and the error key of its first refusal, before any write. Another
|
|
253
|
+
worker holding the lock is answered 503 with `Retry-After`.
|
|
254
|
+
security: [{ bearerAuth: [] }]
|
|
255
|
+
parameters:
|
|
256
|
+
- in: path
|
|
257
|
+
name: projectId
|
|
258
|
+
required: true
|
|
259
|
+
schema: { type: string }
|
|
260
|
+
- in: path
|
|
261
|
+
name: environmentId
|
|
262
|
+
required: true
|
|
263
|
+
schema: { type: string }
|
|
264
|
+
requestBody:
|
|
265
|
+
required: true
|
|
266
|
+
content:
|
|
267
|
+
application/json:
|
|
268
|
+
schema: { $ref: '#/components/schemas/ResourceModules' }
|
|
269
|
+
responses:
|
|
270
|
+
'200':
|
|
271
|
+
content:
|
|
272
|
+
application/json:
|
|
273
|
+
schema: { $ref: '#/components/schemas/AppliedResources' }
|
|
274
|
+
default: { $ref: 'cloud.openapi.yaml#/components/responses/Error' }
|