@antelopejs/cloud-sdk 0.1.1 → 0.1.2
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/dist/api.d.ts +4 -8
- package/dist/api.js +7 -14
- package/dist/deployments.d.ts +21 -0
- package/dist/deployments.js +17 -0
- package/dist/generated/cloud-api.d.ts +122 -13
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/result.d.ts +2 -1
- package/dist/result.js +10 -3
- package/openapi/cloud.openapi.yaml +6 -35
- package/openapi/deployments.yaml +150 -0
- package/package.json +1 -1
package/dist/api.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ProjectDeploymentsApi } from "./deployments.js";
|
|
1
2
|
import { EnvironmentsApi, ProjectRepositoryApi } from "./environments.js";
|
|
2
3
|
import type { components } from "./generated/cloud-api.js";
|
|
3
4
|
import { type SseEvent } from "./sse.js";
|
|
@@ -47,6 +48,8 @@ export declare class CloudApi {
|
|
|
47
48
|
readonly environments: EnvironmentsApi;
|
|
48
49
|
/** The GitHub repository a project builds from. */
|
|
49
50
|
readonly projectRepository: ProjectRepositoryApi;
|
|
51
|
+
/** Every deployment of a project, newest first, one page at a time. */
|
|
52
|
+
readonly projectDeployments: ProjectDeploymentsApi;
|
|
50
53
|
constructor(options: CloudApiOptions);
|
|
51
54
|
listProjects(): Promise<{
|
|
52
55
|
projects: {
|
|
@@ -156,14 +159,7 @@ export declare class CloudApi {
|
|
|
156
159
|
deploymentHistory(serviceId: string): Promise<{
|
|
157
160
|
activeBuilds?: components["schemas"]["ActiveBuild"][];
|
|
158
161
|
desiredRevisionId: string | null;
|
|
159
|
-
revisions:
|
|
160
|
-
id: string;
|
|
161
|
-
number: number;
|
|
162
|
-
isDesired: boolean;
|
|
163
|
-
canRollback: boolean;
|
|
164
|
-
state?: "preparing" | "pending" | "succeeded" | "failed";
|
|
165
|
-
deploymentId?: string | null;
|
|
166
|
-
}[];
|
|
162
|
+
revisions: components["schemas"]["RevisionSummary"][];
|
|
167
163
|
}>;
|
|
168
164
|
rollback(serviceId: string, revisionId: string): Promise<{
|
|
169
165
|
[key: string]: unknown;
|
package/dist/api.js
CHANGED
|
@@ -1,26 +1,20 @@
|
|
|
1
1
|
import createClient from "openapi-fetch";
|
|
2
|
-
import {
|
|
2
|
+
import { InvalidApiResponseError } from "./api-error.js";
|
|
3
|
+
import { ProjectDeploymentsApi } from "./deployments.js";
|
|
3
4
|
import { EnvironmentsApi, ProjectRepositoryApi } from "./environments.js";
|
|
4
5
|
import { isRecord, isString } from "./guards.js";
|
|
5
|
-
import { acceptedOf, dataOf,
|
|
6
|
+
import { acceptedOf, dataOf, isApiErrorBody, refusal } from "./result.js";
|
|
6
7
|
import { parseSse } from "./sse.js";
|
|
7
8
|
/** The production Cloud API, used when no `baseUrl` is given. */
|
|
8
9
|
export const DEFAULT_API_URL = "https://api.antelopejs.cloud";
|
|
9
10
|
const SOURCE_MIME_TYPE = "application/x-tar";
|
|
10
11
|
const SOURCE_FILENAME = "source.tar";
|
|
11
|
-
const HTTP_TOO_MANY_REQUESTS = 429;
|
|
12
12
|
function isDeploymentReceipt(value) {
|
|
13
13
|
return (isRecord(value) &&
|
|
14
14
|
isString(value.deploymentId) &&
|
|
15
15
|
isString(value.buildId) &&
|
|
16
16
|
value.status === "queued");
|
|
17
17
|
}
|
|
18
|
-
/** `Retry-After` as delta-seconds; the HTTP-date form, or nothing usable, is no hint. */
|
|
19
|
-
function retryAfterSeconds(header) {
|
|
20
|
-
if (!header || !/^\d+$/.test(header.trim()))
|
|
21
|
-
return undefined;
|
|
22
|
-
return Number(header.trim());
|
|
23
|
-
}
|
|
24
18
|
function endpointClient(options = {}) {
|
|
25
19
|
return createClient({
|
|
26
20
|
baseUrl: options.baseUrl ?? DEFAULT_API_URL,
|
|
@@ -37,6 +31,8 @@ export class CloudApi {
|
|
|
37
31
|
environments;
|
|
38
32
|
/** The GitHub repository a project builds from. */
|
|
39
33
|
projectRepository;
|
|
34
|
+
/** Every deployment of a project, newest first, one page at a time. */
|
|
35
|
+
projectDeployments;
|
|
40
36
|
constructor(options) {
|
|
41
37
|
this.options = options;
|
|
42
38
|
this.baseUrl = (options.baseUrl ?? DEFAULT_API_URL).replace(/\/+$/, "");
|
|
@@ -48,6 +44,7 @@ export class CloudApi {
|
|
|
48
44
|
});
|
|
49
45
|
this.environments = new EnvironmentsApi(this.client);
|
|
50
46
|
this.projectRepository = new ProjectRepositoryApi(this.client);
|
|
47
|
+
this.projectDeployments = new ProjectDeploymentsApi(this.client);
|
|
51
48
|
}
|
|
52
49
|
async listProjects() {
|
|
53
50
|
const result = await this.client.GET("/api/cloud/projects/");
|
|
@@ -187,7 +184,7 @@ export class CloudApi {
|
|
|
187
184
|
catch {
|
|
188
185
|
/** The response is already useful as plain text. */
|
|
189
186
|
}
|
|
190
|
-
throw refusal(response
|
|
187
|
+
throw refusal(response, isApiErrorBody(body) ? body : undefined, text);
|
|
191
188
|
}
|
|
192
189
|
async *stream(path, headers, signal, onOpen) {
|
|
193
190
|
const response = await this.raw(path, { headers, signal });
|
|
@@ -205,10 +202,6 @@ export async function createDevice(deviceName, options) {
|
|
|
205
202
|
const result = await endpointClient(options).POST("/api/cloud/cli/device", {
|
|
206
203
|
body: { device_name: deviceName },
|
|
207
204
|
});
|
|
208
|
-
if (result.response.status === HTTP_TOO_MANY_REQUESTS) {
|
|
209
|
-
const body = isApiErrorBody(result.error) ? result.error : undefined;
|
|
210
|
-
throw new CloudApiError(result.response.status, errorCode(body), undefined, errorParams(body), retryAfterSeconds(result.response.headers.get("retry-after")));
|
|
211
|
-
}
|
|
212
205
|
return dataOf(result);
|
|
213
206
|
}
|
|
214
207
|
/**
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Client } from "openapi-fetch";
|
|
2
|
+
import type { components, operations, paths } from "./generated/cloud-api.js";
|
|
3
|
+
export type DeploymentHistory = components["schemas"]["DeploymentHistory"];
|
|
4
|
+
export type RevisionSummary = components["schemas"]["RevisionSummary"];
|
|
5
|
+
export type RevisionBuild = components["schemas"]["RevisionBuild"];
|
|
6
|
+
export type ActiveBuild = components["schemas"]["ActiveBuild"];
|
|
7
|
+
export type DeploymentStatus = components["schemas"]["DeploymentStatus"];
|
|
8
|
+
export type ProjectDeployment = components["schemas"]["ProjectDeployment"];
|
|
9
|
+
export type ProjectDeploymentPage = components["schemas"]["ProjectDeploymentPage"];
|
|
10
|
+
/** Which deployments a page holds, and where it starts. */
|
|
11
|
+
export type ProjectDeploymentQuery = NonNullable<operations["listProjectDeployments"]["parameters"]["query"]>;
|
|
12
|
+
/** Every deployment of a project, across its environments. */
|
|
13
|
+
export declare class ProjectDeploymentsApi {
|
|
14
|
+
private readonly client;
|
|
15
|
+
constructor(client: Client<paths>);
|
|
16
|
+
/**
|
|
17
|
+
* One page of the project's deployments, newest first. Pass the page's
|
|
18
|
+
* `nextCursor` as `cursor` to read the next, older one.
|
|
19
|
+
*/
|
|
20
|
+
list(projectId: string, query?: ProjectDeploymentQuery): Promise<ProjectDeploymentPage>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { dataOf } from "./result.js";
|
|
2
|
+
/** Every deployment of a project, across its environments. */
|
|
3
|
+
export class ProjectDeploymentsApi {
|
|
4
|
+
client;
|
|
5
|
+
constructor(client) {
|
|
6
|
+
this.client = client;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* One page of the project's deployments, newest first. Pass the page's
|
|
10
|
+
* `nextCursor` as `cursor` to read the next, older one.
|
|
11
|
+
*/
|
|
12
|
+
async list(projectId, query = {}) {
|
|
13
|
+
const result = await this.client.GET("/api/cloud/projects/{projectId}/deployments", { params: { path: { projectId }, query } });
|
|
14
|
+
return dataOf(result);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=deployments.js.map
|
|
@@ -99,6 +99,23 @@ export interface paths {
|
|
|
99
99
|
patch?: never;
|
|
100
100
|
trace?: never;
|
|
101
101
|
};
|
|
102
|
+
"/api/cloud/projects/{projectId}/deployments": {
|
|
103
|
+
parameters: {
|
|
104
|
+
query?: never;
|
|
105
|
+
header?: never;
|
|
106
|
+
path?: never;
|
|
107
|
+
cookie?: never;
|
|
108
|
+
};
|
|
109
|
+
/** @description The project's deployments across its environments, newest first, one page at a time. */
|
|
110
|
+
get: operations["listProjectDeployments"];
|
|
111
|
+
put?: never;
|
|
112
|
+
post?: never;
|
|
113
|
+
delete?: never;
|
|
114
|
+
options?: never;
|
|
115
|
+
head?: never;
|
|
116
|
+
patch?: never;
|
|
117
|
+
trace?: never;
|
|
118
|
+
};
|
|
102
119
|
"/api/cloud/projects/{projectId}/repository": {
|
|
103
120
|
parameters: {
|
|
104
121
|
query?: never;
|
|
@@ -527,19 +544,8 @@ export interface components {
|
|
|
527
544
|
DeploymentHistory: {
|
|
528
545
|
activeBuilds?: components["schemas"]["ActiveBuild"][];
|
|
529
546
|
desiredRevisionId: string | null;
|
|
530
|
-
revisions
|
|
531
|
-
|
|
532
|
-
number: number;
|
|
533
|
-
isDesired: boolean;
|
|
534
|
-
canRollback: boolean;
|
|
535
|
-
/**
|
|
536
|
-
* @description Where the revision is; preparing and pending ones are still rolling out.
|
|
537
|
-
* @enum {string}
|
|
538
|
-
*/
|
|
539
|
-
state?: "preparing" | "pending" | "succeeded" | "failed";
|
|
540
|
-
/** @description The deployment that rolls the revision out; null when none of the recent ones links to it. */
|
|
541
|
-
deploymentId?: string | null;
|
|
542
|
-
}[];
|
|
547
|
+
/** @description The service's revisions, newest first. */
|
|
548
|
+
revisions: components["schemas"]["RevisionSummary"][];
|
|
543
549
|
};
|
|
544
550
|
DeploymentDetail: {
|
|
545
551
|
id: string;
|
|
@@ -584,6 +590,10 @@ export interface components {
|
|
|
584
590
|
NewProject: {
|
|
585
591
|
slug: string;
|
|
586
592
|
region?: string;
|
|
593
|
+
/** @description `owner/name` the first service builds */
|
|
594
|
+
repository?: string;
|
|
595
|
+
/** @description Branch the environment tracks */
|
|
596
|
+
branch?: string;
|
|
587
597
|
};
|
|
588
598
|
CreatedProject: {
|
|
589
599
|
projectId: string;
|
|
@@ -635,6 +645,43 @@ export interface components {
|
|
|
635
645
|
removedRetentionDays: number;
|
|
636
646
|
};
|
|
637
647
|
};
|
|
648
|
+
/**
|
|
649
|
+
* @description Sources build, the new revision is health-checked, then traffic switches to it.
|
|
650
|
+
* @enum {string}
|
|
651
|
+
*/
|
|
652
|
+
DeploymentStatus: "queued" | "building" | "checking" | "switching" | "succeeded" | "failed" | "cancelled";
|
|
653
|
+
/** @description One deployment of a project to one of its environments, and the revisions it rolled out. */
|
|
654
|
+
ProjectDeployment: {
|
|
655
|
+
id: string;
|
|
656
|
+
/** @description Counts up within its environment, so two environments of a project can share a number; order by createdAt and key by id. */
|
|
657
|
+
number: number;
|
|
658
|
+
environmentId: string;
|
|
659
|
+
status: components["schemas"]["DeploymentStatus"];
|
|
660
|
+
/** @description The commit deployed; null when the trigger carries none, such as a CLI upload. */
|
|
661
|
+
commit: string | null;
|
|
662
|
+
/** @description The branch the commit came from; null for a CLI upload or a rollback. */
|
|
663
|
+
branch: string | null;
|
|
664
|
+
/** Format: date-time */
|
|
665
|
+
createdAt: string;
|
|
666
|
+
/**
|
|
667
|
+
* Format: date-time
|
|
668
|
+
* @description When it succeeded, failed or was cancelled; null while it runs.
|
|
669
|
+
*/
|
|
670
|
+
finishedAt: string | null;
|
|
671
|
+
/**
|
|
672
|
+
* @description What started it. push is a push to the environment's branch, or an update to the pull request a preview environment mirrors. promotion is a commit, branch tip or image someone chose to deploy to the environment. rollback is a return to an earlier revision. upload is a source the CLI uploaded. restart is a redeploy of what the environment already runs, such as after a settings change.
|
|
673
|
+
* @enum {string}
|
|
674
|
+
*/
|
|
675
|
+
trigger: "push" | "promotion" | "rollback" | "upload" | "restart";
|
|
676
|
+
/** @description The service revisions it rolled out; empty until its builds produce them. */
|
|
677
|
+
revisionIds: string[];
|
|
678
|
+
};
|
|
679
|
+
/** @description One page of a project's deployments, newest first. */
|
|
680
|
+
ProjectDeploymentPage: {
|
|
681
|
+
deployments: components["schemas"]["ProjectDeployment"][];
|
|
682
|
+
/** @description Pass it as cursor to read the next, older page; null on the last page. */
|
|
683
|
+
nextCursor: string | null;
|
|
684
|
+
};
|
|
638
685
|
ProjectRepository: {
|
|
639
686
|
/** @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. */
|
|
640
687
|
repository: string | null;
|
|
@@ -890,6 +937,37 @@ export interface components {
|
|
|
890
937
|
/** @description The plan that remains once the databases are created. */
|
|
891
938
|
plan: components["schemas"]["ResourcePlan"];
|
|
892
939
|
};
|
|
940
|
+
/** @description What a built revision was built from. */
|
|
941
|
+
RevisionBuild: {
|
|
942
|
+
/** @description The branch built; null for a source the CLI uploaded. */
|
|
943
|
+
branch: string | null;
|
|
944
|
+
commit: string | null;
|
|
945
|
+
commitMessage: string | null;
|
|
946
|
+
/** @description Null until the build has both started and finished. */
|
|
947
|
+
durationSeconds: number | null;
|
|
948
|
+
};
|
|
949
|
+
RevisionSummary: {
|
|
950
|
+
id: string;
|
|
951
|
+
number: number;
|
|
952
|
+
isDesired: boolean;
|
|
953
|
+
canRollback: boolean;
|
|
954
|
+
/** Format: date-time */
|
|
955
|
+
createdAt: string;
|
|
956
|
+
/**
|
|
957
|
+
* @description build when Cloud built the revision from source; image when it pulled an image by reference.
|
|
958
|
+
* @enum {string}
|
|
959
|
+
*/
|
|
960
|
+
origin: "build" | "image";
|
|
961
|
+
/** @description The build that produced the revision; null for an image pulled by reference. */
|
|
962
|
+
build: components["schemas"]["RevisionBuild"] | null;
|
|
963
|
+
/**
|
|
964
|
+
* @description Where the revision is; preparing and pending ones are still rolling out.
|
|
965
|
+
* @enum {string}
|
|
966
|
+
*/
|
|
967
|
+
state?: "preparing" | "pending" | "succeeded" | "failed";
|
|
968
|
+
/** @description The deployment that rolls the revision out; null when none of the recent ones links to it. */
|
|
969
|
+
deploymentId?: string | null;
|
|
970
|
+
};
|
|
893
971
|
};
|
|
894
972
|
responses: {
|
|
895
973
|
/** @description Stable API error */
|
|
@@ -1067,6 +1145,37 @@ export interface operations {
|
|
|
1067
1145
|
default: components["responses"]["Error"];
|
|
1068
1146
|
};
|
|
1069
1147
|
};
|
|
1148
|
+
listProjectDeployments: {
|
|
1149
|
+
parameters: {
|
|
1150
|
+
query?: {
|
|
1151
|
+
/** @description Only the deployments to this environment. */
|
|
1152
|
+
environmentId?: string;
|
|
1153
|
+
/** @description Only the deployments in one of these statuses. */
|
|
1154
|
+
status?: components["schemas"]["DeploymentStatus"][];
|
|
1155
|
+
/** @description The nextCursor of the previous page, sent with the same filters; absent for the first page. A cursor the API cannot read is refused. */
|
|
1156
|
+
cursor?: string;
|
|
1157
|
+
/** @description Deployments per page; a value outside 1 to 100 is refused. */
|
|
1158
|
+
limit?: number;
|
|
1159
|
+
};
|
|
1160
|
+
header?: never;
|
|
1161
|
+
path: {
|
|
1162
|
+
projectId: string;
|
|
1163
|
+
};
|
|
1164
|
+
cookie?: never;
|
|
1165
|
+
};
|
|
1166
|
+
requestBody?: never;
|
|
1167
|
+
responses: {
|
|
1168
|
+
200: {
|
|
1169
|
+
headers: {
|
|
1170
|
+
[name: string]: unknown;
|
|
1171
|
+
};
|
|
1172
|
+
content: {
|
|
1173
|
+
"application/json": components["schemas"]["ProjectDeploymentPage"];
|
|
1174
|
+
};
|
|
1175
|
+
};
|
|
1176
|
+
default: components["responses"]["Error"];
|
|
1177
|
+
};
|
|
1178
|
+
};
|
|
1070
1179
|
readProjectRepository: {
|
|
1071
1180
|
parameters: {
|
|
1072
1181
|
query?: never;
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/result.d.ts
CHANGED
|
@@ -17,7 +17,8 @@ export declare function isApiErrorBody(value: unknown): value is ApiErrorBody;
|
|
|
17
17
|
export declare function errorCode(body: ApiErrorBody | undefined): string;
|
|
18
18
|
/** The string values a `{ message, params }` refusal interpolates. */
|
|
19
19
|
export declare function errorParams(body: ApiErrorBody | undefined): ApiErrorParams;
|
|
20
|
-
|
|
20
|
+
/** The refusal a response carries, with the wait its `Retry-After` asks for. */
|
|
21
|
+
export declare function refusal(response: Response, body: ApiErrorBody | undefined, text?: string): CloudApiError;
|
|
21
22
|
/** The answer's body, or the refusal it carries. */
|
|
22
23
|
export declare function dataOf<T>(result: ApiResult<T>): T;
|
|
23
24
|
/** For an answer that has no body: it only has to be accepted. */
|
package/dist/result.js
CHANGED
|
@@ -15,11 +15,18 @@ export function errorParams(body) {
|
|
|
15
15
|
return {};
|
|
16
16
|
return Object.fromEntries(Object.entries(params).filter((entry) => typeof entry[1] === "string"));
|
|
17
17
|
}
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
/** `Retry-After` as delta-seconds; the HTTP-date form, or nothing usable, is no hint. */
|
|
19
|
+
function retryAfterSeconds(header) {
|
|
20
|
+
if (!header || !/^\d+$/.test(header.trim()))
|
|
21
|
+
return undefined;
|
|
22
|
+
return Number(header.trim());
|
|
23
|
+
}
|
|
24
|
+
/** The refusal a response carries, with the wait its `Retry-After` asks for. */
|
|
25
|
+
export function refusal(response, body, text) {
|
|
26
|
+
return new CloudApiError(response.status, errorCode(body), text, errorParams(body), retryAfterSeconds(response.headers.get("retry-after")));
|
|
20
27
|
}
|
|
21
28
|
function refusalOf(result) {
|
|
22
|
-
return refusal(result.response
|
|
29
|
+
return refusal(result.response, isApiErrorBody(result.error) ? result.error : undefined);
|
|
23
30
|
}
|
|
24
31
|
/** The answer's body, or the refusal it carries. */
|
|
25
32
|
export function dataOf(result) {
|
|
@@ -117,41 +117,8 @@ components:
|
|
|
117
117
|
deploymentId: { type: string }
|
|
118
118
|
buildId: { type: string }
|
|
119
119
|
status: { type: string, const: queued }
|
|
120
|
-
ActiveBuild:
|
|
121
|
-
|
|
122
|
-
type: object
|
|
123
|
-
required: [id, deploymentId, status, queuePosition, createdAt]
|
|
124
|
-
properties:
|
|
125
|
-
id: { type: string }
|
|
126
|
-
deploymentId: { type: string }
|
|
127
|
-
status: { type: string, enum: [queued, starting, running] }
|
|
128
|
-
queuePosition: { type: [integer, "null"] }
|
|
129
|
-
createdAt: { type: string, format: date-time }
|
|
130
|
-
DeploymentHistory:
|
|
131
|
-
type: object
|
|
132
|
-
required: [revisions, desiredRevisionId]
|
|
133
|
-
properties:
|
|
134
|
-
activeBuilds:
|
|
135
|
-
type: array
|
|
136
|
-
items: { $ref: '#/components/schemas/ActiveBuild' }
|
|
137
|
-
desiredRevisionId: { type: [string, "null"] }
|
|
138
|
-
revisions:
|
|
139
|
-
type: array
|
|
140
|
-
items:
|
|
141
|
-
type: object
|
|
142
|
-
required: [id, number, isDesired, canRollback]
|
|
143
|
-
properties:
|
|
144
|
-
id: { type: string }
|
|
145
|
-
number: { type: integer }
|
|
146
|
-
isDesired: { type: boolean }
|
|
147
|
-
canRollback: { type: boolean }
|
|
148
|
-
state:
|
|
149
|
-
description: Where the revision is; preparing and pending ones are still rolling out.
|
|
150
|
-
type: string
|
|
151
|
-
enum: [preparing, pending, succeeded, failed]
|
|
152
|
-
deploymentId:
|
|
153
|
-
description: The deployment that rolls the revision out; null when none of the recent ones links to it.
|
|
154
|
-
type: [string, "null"]
|
|
120
|
+
ActiveBuild: { $ref: 'deployments.yaml#/components/schemas/ActiveBuild' }
|
|
121
|
+
DeploymentHistory: { $ref: 'deployments.yaml#/components/schemas/DeploymentHistory' }
|
|
155
122
|
DeploymentDetail:
|
|
156
123
|
type: object
|
|
157
124
|
required: [id, status, failure]
|
|
@@ -212,9 +179,12 @@ components:
|
|
|
212
179
|
NewProject:
|
|
213
180
|
type: object
|
|
214
181
|
required: [slug]
|
|
182
|
+
dependentRequired: { repository: [branch], branch: [repository] }
|
|
215
183
|
properties:
|
|
216
184
|
slug: { type: string }
|
|
217
185
|
region: { type: string }
|
|
186
|
+
repository: { type: string, description: "`owner/name` the first service builds" }
|
|
187
|
+
branch: { type: string, description: Branch the environment tracks }
|
|
218
188
|
CreatedProject:
|
|
219
189
|
type: object
|
|
220
190
|
required: [projectId, slug, region, environmentId]
|
|
@@ -382,6 +352,7 @@ paths:
|
|
|
382
352
|
application/json:
|
|
383
353
|
schema: { $ref: '#/components/schemas/Project' }
|
|
384
354
|
default: { $ref: '#/components/responses/Error' }
|
|
355
|
+
/api/cloud/projects/{projectId}/deployments: { $ref: 'deployments.yaml#/paths/projectDeployments' }
|
|
385
356
|
/api/cloud/projects/{projectId}/repository: { $ref: 'environments.yaml#/paths/repository' }
|
|
386
357
|
/api/cloud/projects/{projectId}/environments: { $ref: 'environments.yaml#/paths/environments' }
|
|
387
358
|
/api/cloud/projects/{projectId}/environments/{environmentId}: { $ref: 'environments.yaml#/paths/environment' }
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
components:
|
|
2
|
+
schemas:
|
|
3
|
+
ActiveBuild:
|
|
4
|
+
description: A build of the service still queued or running, and the deployment it belongs to.
|
|
5
|
+
type: object
|
|
6
|
+
required: [id, deploymentId, status, queuePosition, createdAt]
|
|
7
|
+
properties:
|
|
8
|
+
id: { type: string }
|
|
9
|
+
deploymentId: { type: string }
|
|
10
|
+
status: { type: string, enum: [queued, starting, running] }
|
|
11
|
+
queuePosition: { type: [integer, "null"] }
|
|
12
|
+
createdAt: { type: string, format: date-time }
|
|
13
|
+
DeploymentHistory:
|
|
14
|
+
type: object
|
|
15
|
+
required: [revisions, desiredRevisionId]
|
|
16
|
+
properties:
|
|
17
|
+
activeBuilds:
|
|
18
|
+
type: array
|
|
19
|
+
items: { $ref: '#/components/schemas/ActiveBuild' }
|
|
20
|
+
desiredRevisionId: { type: [string, "null"] }
|
|
21
|
+
revisions:
|
|
22
|
+
description: The service's revisions, newest first.
|
|
23
|
+
type: array
|
|
24
|
+
items: { $ref: '#/components/schemas/RevisionSummary' }
|
|
25
|
+
RevisionSummary:
|
|
26
|
+
type: object
|
|
27
|
+
required: [id, number, isDesired, canRollback, createdAt, origin, build]
|
|
28
|
+
properties:
|
|
29
|
+
id: { type: string }
|
|
30
|
+
number: { type: integer }
|
|
31
|
+
isDesired: { type: boolean }
|
|
32
|
+
canRollback: { type: boolean }
|
|
33
|
+
createdAt: { type: string, format: date-time }
|
|
34
|
+
origin:
|
|
35
|
+
description: build when Cloud built the revision from source; image when it pulled an image by reference.
|
|
36
|
+
type: string
|
|
37
|
+
enum: [build, image]
|
|
38
|
+
build:
|
|
39
|
+
description: The build that produced the revision; null for an image pulled by reference.
|
|
40
|
+
oneOf:
|
|
41
|
+
- $ref: '#/components/schemas/RevisionBuild'
|
|
42
|
+
- type: "null"
|
|
43
|
+
state:
|
|
44
|
+
description: Where the revision is; preparing and pending ones are still rolling out.
|
|
45
|
+
type: string
|
|
46
|
+
enum: [preparing, pending, succeeded, failed]
|
|
47
|
+
deploymentId:
|
|
48
|
+
description: The deployment that rolls the revision out; null when none of the recent ones links to it.
|
|
49
|
+
type: [string, "null"]
|
|
50
|
+
RevisionBuild:
|
|
51
|
+
description: What a built revision was built from.
|
|
52
|
+
type: object
|
|
53
|
+
required: [branch, commit, commitMessage, durationSeconds]
|
|
54
|
+
properties:
|
|
55
|
+
branch:
|
|
56
|
+
description: The branch built; null for a source the CLI uploaded.
|
|
57
|
+
type: [string, "null"]
|
|
58
|
+
commit: { type: [string, "null"] }
|
|
59
|
+
commitMessage: { type: [string, "null"] }
|
|
60
|
+
durationSeconds:
|
|
61
|
+
description: Null until the build has both started and finished.
|
|
62
|
+
type: [integer, "null"]
|
|
63
|
+
ProjectDeploymentPage:
|
|
64
|
+
description: One page of a project's deployments, newest first.
|
|
65
|
+
type: object
|
|
66
|
+
required: [deployments, nextCursor]
|
|
67
|
+
properties:
|
|
68
|
+
deployments:
|
|
69
|
+
type: array
|
|
70
|
+
items: { $ref: '#/components/schemas/ProjectDeployment' }
|
|
71
|
+
nextCursor:
|
|
72
|
+
description: Pass it as cursor to read the next, older page; null on the last page.
|
|
73
|
+
type: [string, "null"]
|
|
74
|
+
ProjectDeployment:
|
|
75
|
+
description: One deployment of a project to one of its environments, and the revisions it rolled out.
|
|
76
|
+
type: object
|
|
77
|
+
required: [id, number, environmentId, status, commit, branch, createdAt, finishedAt, trigger, revisionIds]
|
|
78
|
+
properties:
|
|
79
|
+
id: { type: string }
|
|
80
|
+
number:
|
|
81
|
+
description: Counts up within its environment, so two environments of a project can share a number; order by createdAt and key by id.
|
|
82
|
+
type: integer
|
|
83
|
+
environmentId: { type: string }
|
|
84
|
+
status: { $ref: '#/components/schemas/DeploymentStatus' }
|
|
85
|
+
commit:
|
|
86
|
+
description: The commit deployed; null when the trigger carries none, such as a CLI upload.
|
|
87
|
+
type: [string, "null"]
|
|
88
|
+
branch:
|
|
89
|
+
description: The branch the commit came from; null for a CLI upload or a rollback.
|
|
90
|
+
type: [string, "null"]
|
|
91
|
+
createdAt: { type: string, format: date-time }
|
|
92
|
+
finishedAt:
|
|
93
|
+
description: When it succeeded, failed or was cancelled; null while it runs.
|
|
94
|
+
type: [string, "null"]
|
|
95
|
+
format: date-time
|
|
96
|
+
trigger:
|
|
97
|
+
description: >-
|
|
98
|
+
What started it.
|
|
99
|
+
push is a push to the environment's branch, or an update to the pull request a preview environment mirrors.
|
|
100
|
+
promotion is a commit, branch tip or image someone chose to deploy to the environment.
|
|
101
|
+
rollback is a return to an earlier revision.
|
|
102
|
+
upload is a source the CLI uploaded.
|
|
103
|
+
restart is a redeploy of what the environment already runs, such as after a settings change.
|
|
104
|
+
type: string
|
|
105
|
+
enum: [push, promotion, rollback, upload, restart]
|
|
106
|
+
revisionIds:
|
|
107
|
+
description: The service revisions it rolled out; empty until its builds produce them.
|
|
108
|
+
type: array
|
|
109
|
+
items: { type: string }
|
|
110
|
+
DeploymentStatus:
|
|
111
|
+
description: Sources build, the new revision is health-checked, then traffic switches to it.
|
|
112
|
+
type: string
|
|
113
|
+
enum: [queued, building, checking, switching, succeeded, failed, cancelled]
|
|
114
|
+
paths:
|
|
115
|
+
projectDeployments:
|
|
116
|
+
get:
|
|
117
|
+
operationId: listProjectDeployments
|
|
118
|
+
description: The project's deployments across its environments, newest first, one page at a time.
|
|
119
|
+
security: [{ bearerAuth: [] }]
|
|
120
|
+
parameters:
|
|
121
|
+
- in: path
|
|
122
|
+
name: projectId
|
|
123
|
+
required: true
|
|
124
|
+
schema: { type: string }
|
|
125
|
+
- in: query
|
|
126
|
+
name: environmentId
|
|
127
|
+
description: Only the deployments to this environment.
|
|
128
|
+
schema: { type: string }
|
|
129
|
+
- in: query
|
|
130
|
+
name: status
|
|
131
|
+
description: Only the deployments in one of these statuses.
|
|
132
|
+
style: form
|
|
133
|
+
explode: true
|
|
134
|
+
schema:
|
|
135
|
+
type: array
|
|
136
|
+
items: { $ref: '#/components/schemas/DeploymentStatus' }
|
|
137
|
+
- in: query
|
|
138
|
+
name: cursor
|
|
139
|
+
description: The nextCursor of the previous page, sent with the same filters; absent for the first page. A cursor the API cannot read is refused.
|
|
140
|
+
schema: { type: string }
|
|
141
|
+
- in: query
|
|
142
|
+
name: limit
|
|
143
|
+
description: Deployments per page; a value outside 1 to 100 is refused.
|
|
144
|
+
schema: { type: integer, minimum: 1, maximum: 100, default: 20 }
|
|
145
|
+
responses:
|
|
146
|
+
'200':
|
|
147
|
+
content:
|
|
148
|
+
application/json:
|
|
149
|
+
schema: { $ref: '#/components/schemas/ProjectDeploymentPage' }
|
|
150
|
+
default: { $ref: './cloud.openapi.yaml#/components/responses/Error' }
|