@aurtic/cli 1.0.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/dist/api.d.ts +14 -0
- package/dist/api.js +148 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +272 -0
- package/dist/entities/Project.d.ts +39 -0
- package/dist/entities/Project.js +124 -0
- package/dist/entities/ProjectContainer.d.ts +227 -0
- package/dist/entities/ProjectContainer.js +465 -0
- package/dist/entities/Server.d.ts +45 -0
- package/dist/entities/Server.js +114 -0
- package/dist/entities/Team.d.ts +49 -0
- package/dist/entities/Team.js +149 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +33 -0
- package/src/api.ts +69 -0
- package/src/cli.ts +158 -0
- package/src/entities/Account.ts +92 -0
- package/src/entities/ContainerDaemon.ts +112 -0
- package/src/entities/Project.ts +68 -0
- package/src/entities/ProjectArchive.ts +168 -0
- package/src/entities/ProjectContainer.ts +353 -0
- package/src/entities/ProjectContentDeliveryNetwork.ts +88 -0
- package/src/entities/Referral.ts +68 -0
- package/src/entities/Server.ts +68 -0
- package/src/entities/StorageDaemon.ts +42 -0
- package/src/entities/Team.ts +85 -0
- package/tsconfig.json +24 -0
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import { IProject } from "./Project";
|
|
2
|
+
import { IServer } from "./Server";
|
|
3
|
+
export declare enum ProjectContainerType {
|
|
4
|
+
m256_c1 = "m256_c1",
|
|
5
|
+
m512_c1 = "m512_c1",
|
|
6
|
+
m1024_c1 = "m1024_c1",
|
|
7
|
+
m1536_c1 = "m1536_c1",
|
|
8
|
+
m2048_c1 = "m2048_c1",
|
|
9
|
+
m2560_c1 = "m2560_c1",
|
|
10
|
+
m3072_c1 = "m3072_c1",
|
|
11
|
+
m3584_c1 = "m3584_c1",
|
|
12
|
+
m4095_c1 = "m4095_c1",
|
|
13
|
+
m5120_c1 = "m5120_c1",
|
|
14
|
+
m6144_c1 = "m6144_c1",
|
|
15
|
+
m7168_c1 = "m7168_c1",
|
|
16
|
+
m8192_c1 = "m8192_c1",
|
|
17
|
+
m256_c2 = "m256_c2",
|
|
18
|
+
m512_c2 = "m512_c2",
|
|
19
|
+
m1024_c2 = "m1024_c2",
|
|
20
|
+
m1536_c2 = "m1536_c2",
|
|
21
|
+
m2048_c2 = "m2048_c2",
|
|
22
|
+
m2560_c2 = "m2560_c2",
|
|
23
|
+
m3072_c2 = "m3072_c2",
|
|
24
|
+
m3584_c2 = "m3584_c2",
|
|
25
|
+
m4095_c2 = "m4095_c2",
|
|
26
|
+
m5120_c2 = "m5120_c2",
|
|
27
|
+
m6144_c2 = "m6144_c2",
|
|
28
|
+
m7168_c2 = "m7168_c2",
|
|
29
|
+
m8192_c2 = "m8192_c2",
|
|
30
|
+
m256_c3 = "m256_c3",
|
|
31
|
+
m512_c3 = "m512_c3",
|
|
32
|
+
m1024_c3 = "m1024_c3",
|
|
33
|
+
m1536_c3 = "m1536_c3",
|
|
34
|
+
m2048_c3 = "m2048_c3",
|
|
35
|
+
m2560_c3 = "m2560_c3",
|
|
36
|
+
m3072_c3 = "m3072_c3",
|
|
37
|
+
m3584_c3 = "m3584_c3",
|
|
38
|
+
m4095_c3 = "m4095_c3",
|
|
39
|
+
m5120_c3 = "m5120_c3",
|
|
40
|
+
m6144_c3 = "m6144_c3",
|
|
41
|
+
m7168_c3 = "m7168_c3",
|
|
42
|
+
m8192_c3 = "m8192_c3",
|
|
43
|
+
m256_c4 = "m256_c4",
|
|
44
|
+
m512_c4 = "m512_c4",
|
|
45
|
+
m1024_c4 = "m1024_c4",
|
|
46
|
+
m1536_c4 = "m1536_c4",
|
|
47
|
+
m2048_c4 = "m2048_c4",
|
|
48
|
+
m2560_c4 = "m2560_c4",
|
|
49
|
+
m3072_c4 = "m3072_c4",
|
|
50
|
+
m3584_c4 = "m3584_c4",
|
|
51
|
+
m4095_c4 = "m4095_c4",
|
|
52
|
+
m5120_c4 = "m5120_c4",
|
|
53
|
+
m6144_c4 = "m6144_c4",
|
|
54
|
+
m7168_c4 = "m7168_c4",
|
|
55
|
+
m8192_c4 = "m8192_c4"
|
|
56
|
+
}
|
|
57
|
+
export declare enum ProjectContainerFlavour {
|
|
58
|
+
PROTOTYPE = "PROTOTYPE",
|
|
59
|
+
PRODUCTION = "PRODUCTION",
|
|
60
|
+
ENTERPRISE = "ENTERPRISE"
|
|
61
|
+
}
|
|
62
|
+
export declare enum ProjectContainerRegion {
|
|
63
|
+
EUROPE = "EUROPE",
|
|
64
|
+
ASIA = "ASIA",
|
|
65
|
+
OCEANIA = "OCEANIA",
|
|
66
|
+
NORTH_AMERICA = "NORTH_AMERICA",
|
|
67
|
+
SOUTH_AMERICA = "SOUTH_AMERICA"
|
|
68
|
+
}
|
|
69
|
+
export interface IProjectContainer {
|
|
70
|
+
readonly id: string;
|
|
71
|
+
name: string;
|
|
72
|
+
regions: ProjectContainerRegion[];
|
|
73
|
+
type: ProjectContainerType;
|
|
74
|
+
env: {
|
|
75
|
+
[index: string]: string;
|
|
76
|
+
};
|
|
77
|
+
flavour: ProjectContainerFlavour;
|
|
78
|
+
amount: number;
|
|
79
|
+
readonly _links: {
|
|
80
|
+
[index: string]: {
|
|
81
|
+
href: string;
|
|
82
|
+
type: string;
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
export interface IProjectContainerFilesystem {
|
|
87
|
+
readonly id: string;
|
|
88
|
+
path: string;
|
|
89
|
+
readonly daemon?: {
|
|
90
|
+
username: string;
|
|
91
|
+
password: string;
|
|
92
|
+
server: IServer;
|
|
93
|
+
};
|
|
94
|
+
readonly _links: {
|
|
95
|
+
[index: string]: {
|
|
96
|
+
href: string;
|
|
97
|
+
type: string;
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
export interface IProjectContainerUsage {
|
|
102
|
+
date: Date;
|
|
103
|
+
containers: number;
|
|
104
|
+
type: ProjectContainerType;
|
|
105
|
+
flavour: ProjectContainerFlavour;
|
|
106
|
+
}
|
|
107
|
+
export interface IProjectContainerProxy {
|
|
108
|
+
readonly id: string;
|
|
109
|
+
domain: string;
|
|
110
|
+
type: 'INTERNAL' | 'EXTERNAL';
|
|
111
|
+
certificate?: {
|
|
112
|
+
public: string;
|
|
113
|
+
private?: String;
|
|
114
|
+
};
|
|
115
|
+
readonly _links: {
|
|
116
|
+
[index: string]: {
|
|
117
|
+
href: string;
|
|
118
|
+
type: string;
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
export interface IProjectContainerDeployment {
|
|
123
|
+
readonly id: string;
|
|
124
|
+
active: boolean;
|
|
125
|
+
readonly time: number;
|
|
126
|
+
build: boolean;
|
|
127
|
+
result?: {
|
|
128
|
+
result: boolean;
|
|
129
|
+
logs: string[];
|
|
130
|
+
errors: string[];
|
|
131
|
+
};
|
|
132
|
+
readonly created: Date;
|
|
133
|
+
readonly _links: {
|
|
134
|
+
[index: string]: {
|
|
135
|
+
href: string;
|
|
136
|
+
type: string;
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
export interface IProjectContainerLog {
|
|
141
|
+
readonly date: Date;
|
|
142
|
+
uuid: string;
|
|
143
|
+
type: 'LOG' | 'ERROR';
|
|
144
|
+
data: string[];
|
|
145
|
+
readonly created: Date;
|
|
146
|
+
}
|
|
147
|
+
export declare const create: (project: IProject, { name, flavour, regions, type, amount }: Pick<IProjectContainer, 'name' | 'flavour' | 'regions' | 'type' | 'amount'>) => Promise<IProjectContainer>;
|
|
148
|
+
export declare const createProxy: (container: IProjectContainer, { domain, }: Pick<IProjectContainerProxy, 'domain'>) => Promise<IProjectContainer>;
|
|
149
|
+
export declare const get: (project: IProject, id: string) => Promise<IProjectContainer>;
|
|
150
|
+
export declare const put: (container: IProjectContainer, data: {
|
|
151
|
+
name?: string | undefined;
|
|
152
|
+
amount?: number | undefined;
|
|
153
|
+
env?: {
|
|
154
|
+
[index: string]: string;
|
|
155
|
+
} | undefined;
|
|
156
|
+
type?: ProjectContainerType | undefined;
|
|
157
|
+
flavour?: ProjectContainerFlavour | undefined;
|
|
158
|
+
regions?: ProjectContainerRegion[] | undefined;
|
|
159
|
+
}) => Promise<IProjectContainer>;
|
|
160
|
+
export declare const all: (project: IProject) => Promise<IProjectContainer[]>;
|
|
161
|
+
export declare const getProxies: (container: IProjectContainer) => Promise<IProjectContainerProxy[]>;
|
|
162
|
+
export declare const getUsage: (container: IProjectContainer) => Promise<IProjectContainerUsage[]>;
|
|
163
|
+
export declare const getProxy: (container: IProjectContainer, id: string) => Promise<IProjectContainerProxy>;
|
|
164
|
+
export declare const getDeployments: (container: IProjectContainer) => Promise<IProjectContainerDeployment[]>;
|
|
165
|
+
export declare const getLogs: (container: IProjectContainer) => Promise<IProjectContainerLog[]>;
|
|
166
|
+
export declare const getDeployment: (container: IProjectContainer, id: string) => Promise<IProjectContainerDeployment>;
|
|
167
|
+
export declare const createDeployment: (container: IProjectContainer, { data }: {
|
|
168
|
+
data: string;
|
|
169
|
+
}) => Promise<IProjectContainerDeployment>;
|
|
170
|
+
export declare const buildDeployment: (deployment: IProjectContainerDeployment) => Promise<{
|
|
171
|
+
result: boolean;
|
|
172
|
+
}>;
|
|
173
|
+
export declare const getDeploymentBuildStatus: (deployment: IProjectContainerDeployment) => Promise<{
|
|
174
|
+
finished: boolean;
|
|
175
|
+
result: boolean;
|
|
176
|
+
data: {
|
|
177
|
+
errors: string[];
|
|
178
|
+
logs: string[];
|
|
179
|
+
};
|
|
180
|
+
}>;
|
|
181
|
+
export declare const createFilesystem: (container: IProjectContainer, { path }: {
|
|
182
|
+
path: string;
|
|
183
|
+
}) => Promise<IProjectContainerFilesystem>;
|
|
184
|
+
export declare const getFilesystems: (container: IProjectContainer) => Promise<IProjectContainerFilesystem[]>;
|
|
185
|
+
export declare const getFilesystem: (container: IProjectContainer, id: string) => Promise<IProjectContainerFilesystem>;
|
|
186
|
+
declare const ProjectContainer: {
|
|
187
|
+
all: (project: IProject) => Promise<IProjectContainer[]>;
|
|
188
|
+
get: (project: IProject, id: string) => Promise<IProjectContainer>;
|
|
189
|
+
put: (container: IProjectContainer, data: {
|
|
190
|
+
name?: string | undefined;
|
|
191
|
+
amount?: number | undefined;
|
|
192
|
+
env?: {
|
|
193
|
+
[index: string]: string;
|
|
194
|
+
} | undefined;
|
|
195
|
+
type?: ProjectContainerType | undefined;
|
|
196
|
+
flavour?: ProjectContainerFlavour | undefined;
|
|
197
|
+
regions?: ProjectContainerRegion[] | undefined;
|
|
198
|
+
}) => Promise<IProjectContainer>;
|
|
199
|
+
create: (project: IProject, { name, flavour, regions, type, amount }: Pick<IProjectContainer, 'name' | 'flavour' | 'regions' | 'type' | 'amount'>) => Promise<IProjectContainer>;
|
|
200
|
+
getLogs: (container: IProjectContainer) => Promise<IProjectContainerLog[]>;
|
|
201
|
+
getProxies: (container: IProjectContainer) => Promise<IProjectContainerProxy[]>;
|
|
202
|
+
getProxy: (container: IProjectContainer, id: string) => Promise<IProjectContainerProxy>;
|
|
203
|
+
createProxy: (container: IProjectContainer, { domain, }: Pick<IProjectContainerProxy, 'domain'>) => Promise<IProjectContainer>;
|
|
204
|
+
getDeployments: (container: IProjectContainer) => Promise<IProjectContainerDeployment[]>;
|
|
205
|
+
getDeployment: (container: IProjectContainer, id: string) => Promise<IProjectContainerDeployment>;
|
|
206
|
+
createDeployment: (container: IProjectContainer, { data }: {
|
|
207
|
+
data: string;
|
|
208
|
+
}) => Promise<IProjectContainerDeployment>;
|
|
209
|
+
buildDeployment: (deployment: IProjectContainerDeployment) => Promise<{
|
|
210
|
+
result: boolean;
|
|
211
|
+
}>;
|
|
212
|
+
getDeploymentBuildStatus: (deployment: IProjectContainerDeployment) => Promise<{
|
|
213
|
+
finished: boolean;
|
|
214
|
+
result: boolean;
|
|
215
|
+
data: {
|
|
216
|
+
errors: string[];
|
|
217
|
+
logs: string[];
|
|
218
|
+
};
|
|
219
|
+
}>;
|
|
220
|
+
createFilesystem: (container: IProjectContainer, { path }: {
|
|
221
|
+
path: string;
|
|
222
|
+
}) => Promise<IProjectContainerFilesystem>;
|
|
223
|
+
getFilesystem: (container: IProjectContainer, id: string) => Promise<IProjectContainerFilesystem>;
|
|
224
|
+
getFilesystems: (container: IProjectContainer) => Promise<IProjectContainerFilesystem[]>;
|
|
225
|
+
getUsage: (container: IProjectContainer) => Promise<IProjectContainerUsage[]>;
|
|
226
|
+
};
|
|
227
|
+
export default ProjectContainer;
|
|
@@ -0,0 +1,465 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.getFilesystem = exports.getFilesystems = exports.createFilesystem = exports.getDeploymentBuildStatus = exports.buildDeployment = exports.createDeployment = exports.getDeployment = exports.getLogs = exports.getDeployments = exports.getProxy = exports.getUsage = exports.getProxies = exports.all = exports.put = exports.get = exports.createProxy = exports.create = exports.ProjectContainerRegion = exports.ProjectContainerFlavour = exports.ProjectContainerType = void 0;
|
|
40
|
+
var api_1 = require("../api");
|
|
41
|
+
var ProjectContainerType;
|
|
42
|
+
(function (ProjectContainerType) {
|
|
43
|
+
ProjectContainerType["m256_c1"] = "m256_c1";
|
|
44
|
+
ProjectContainerType["m512_c1"] = "m512_c1";
|
|
45
|
+
ProjectContainerType["m1024_c1"] = "m1024_c1";
|
|
46
|
+
ProjectContainerType["m1536_c1"] = "m1536_c1";
|
|
47
|
+
ProjectContainerType["m2048_c1"] = "m2048_c1";
|
|
48
|
+
ProjectContainerType["m2560_c1"] = "m2560_c1";
|
|
49
|
+
ProjectContainerType["m3072_c1"] = "m3072_c1";
|
|
50
|
+
ProjectContainerType["m3584_c1"] = "m3584_c1";
|
|
51
|
+
ProjectContainerType["m4095_c1"] = "m4095_c1";
|
|
52
|
+
ProjectContainerType["m5120_c1"] = "m5120_c1";
|
|
53
|
+
ProjectContainerType["m6144_c1"] = "m6144_c1";
|
|
54
|
+
ProjectContainerType["m7168_c1"] = "m7168_c1";
|
|
55
|
+
ProjectContainerType["m8192_c1"] = "m8192_c1";
|
|
56
|
+
ProjectContainerType["m256_c2"] = "m256_c2";
|
|
57
|
+
ProjectContainerType["m512_c2"] = "m512_c2";
|
|
58
|
+
ProjectContainerType["m1024_c2"] = "m1024_c2";
|
|
59
|
+
ProjectContainerType["m1536_c2"] = "m1536_c2";
|
|
60
|
+
ProjectContainerType["m2048_c2"] = "m2048_c2";
|
|
61
|
+
ProjectContainerType["m2560_c2"] = "m2560_c2";
|
|
62
|
+
ProjectContainerType["m3072_c2"] = "m3072_c2";
|
|
63
|
+
ProjectContainerType["m3584_c2"] = "m3584_c2";
|
|
64
|
+
ProjectContainerType["m4095_c2"] = "m4095_c2";
|
|
65
|
+
ProjectContainerType["m5120_c2"] = "m5120_c2";
|
|
66
|
+
ProjectContainerType["m6144_c2"] = "m6144_c2";
|
|
67
|
+
ProjectContainerType["m7168_c2"] = "m7168_c2";
|
|
68
|
+
ProjectContainerType["m8192_c2"] = "m8192_c2";
|
|
69
|
+
ProjectContainerType["m256_c3"] = "m256_c3";
|
|
70
|
+
ProjectContainerType["m512_c3"] = "m512_c3";
|
|
71
|
+
ProjectContainerType["m1024_c3"] = "m1024_c3";
|
|
72
|
+
ProjectContainerType["m1536_c3"] = "m1536_c3";
|
|
73
|
+
ProjectContainerType["m2048_c3"] = "m2048_c3";
|
|
74
|
+
ProjectContainerType["m2560_c3"] = "m2560_c3";
|
|
75
|
+
ProjectContainerType["m3072_c3"] = "m3072_c3";
|
|
76
|
+
ProjectContainerType["m3584_c3"] = "m3584_c3";
|
|
77
|
+
ProjectContainerType["m4095_c3"] = "m4095_c3";
|
|
78
|
+
ProjectContainerType["m5120_c3"] = "m5120_c3";
|
|
79
|
+
ProjectContainerType["m6144_c3"] = "m6144_c3";
|
|
80
|
+
ProjectContainerType["m7168_c3"] = "m7168_c3";
|
|
81
|
+
ProjectContainerType["m8192_c3"] = "m8192_c3";
|
|
82
|
+
ProjectContainerType["m256_c4"] = "m256_c4";
|
|
83
|
+
ProjectContainerType["m512_c4"] = "m512_c4";
|
|
84
|
+
ProjectContainerType["m1024_c4"] = "m1024_c4";
|
|
85
|
+
ProjectContainerType["m1536_c4"] = "m1536_c4";
|
|
86
|
+
ProjectContainerType["m2048_c4"] = "m2048_c4";
|
|
87
|
+
ProjectContainerType["m2560_c4"] = "m2560_c4";
|
|
88
|
+
ProjectContainerType["m3072_c4"] = "m3072_c4";
|
|
89
|
+
ProjectContainerType["m3584_c4"] = "m3584_c4";
|
|
90
|
+
ProjectContainerType["m4095_c4"] = "m4095_c4";
|
|
91
|
+
ProjectContainerType["m5120_c4"] = "m5120_c4";
|
|
92
|
+
ProjectContainerType["m6144_c4"] = "m6144_c4";
|
|
93
|
+
ProjectContainerType["m7168_c4"] = "m7168_c4";
|
|
94
|
+
ProjectContainerType["m8192_c4"] = "m8192_c4";
|
|
95
|
+
})(ProjectContainerType = exports.ProjectContainerType || (exports.ProjectContainerType = {}));
|
|
96
|
+
var ProjectContainerFlavour;
|
|
97
|
+
(function (ProjectContainerFlavour) {
|
|
98
|
+
ProjectContainerFlavour["PROTOTYPE"] = "PROTOTYPE";
|
|
99
|
+
ProjectContainerFlavour["PRODUCTION"] = "PRODUCTION";
|
|
100
|
+
ProjectContainerFlavour["ENTERPRISE"] = "ENTERPRISE";
|
|
101
|
+
})(ProjectContainerFlavour = exports.ProjectContainerFlavour || (exports.ProjectContainerFlavour = {}));
|
|
102
|
+
var ProjectContainerRegion;
|
|
103
|
+
(function (ProjectContainerRegion) {
|
|
104
|
+
ProjectContainerRegion["EUROPE"] = "EUROPE";
|
|
105
|
+
ProjectContainerRegion["ASIA"] = "ASIA";
|
|
106
|
+
ProjectContainerRegion["OCEANIA"] = "OCEANIA";
|
|
107
|
+
ProjectContainerRegion["NORTH_AMERICA"] = "NORTH_AMERICA";
|
|
108
|
+
ProjectContainerRegion["SOUTH_AMERICA"] = "SOUTH_AMERICA";
|
|
109
|
+
})(ProjectContainerRegion = exports.ProjectContainerRegion || (exports.ProjectContainerRegion = {}));
|
|
110
|
+
var create = function (project, _a) {
|
|
111
|
+
var name = _a.name, flavour = _a.flavour, regions = _a.regions, type = _a.type, amount = _a.amount;
|
|
112
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
113
|
+
var res, result;
|
|
114
|
+
return __generator(this, function (_b) {
|
|
115
|
+
switch (_b.label) {
|
|
116
|
+
case 0: return [4 /*yield*/, (0, api_1.authRequest)(project._links.containers.href, {
|
|
117
|
+
method: 'POST',
|
|
118
|
+
body: {
|
|
119
|
+
name: name,
|
|
120
|
+
flavour: flavour,
|
|
121
|
+
regions: regions,
|
|
122
|
+
type: type,
|
|
123
|
+
amount: amount
|
|
124
|
+
}
|
|
125
|
+
})];
|
|
126
|
+
case 1:
|
|
127
|
+
res = _b.sent();
|
|
128
|
+
return [4 /*yield*/, res.json()];
|
|
129
|
+
case 2:
|
|
130
|
+
result = _b.sent();
|
|
131
|
+
if (result['error']) {
|
|
132
|
+
if (result['error'] === 'min_balance') {
|
|
133
|
+
throw result;
|
|
134
|
+
}
|
|
135
|
+
throw result['error'];
|
|
136
|
+
}
|
|
137
|
+
return [2 /*return*/, result];
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
};
|
|
142
|
+
exports.create = create;
|
|
143
|
+
var createProxy = function (container, _a) {
|
|
144
|
+
var domain = _a.domain;
|
|
145
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
146
|
+
var res, result;
|
|
147
|
+
return __generator(this, function (_b) {
|
|
148
|
+
switch (_b.label) {
|
|
149
|
+
case 0: return [4 /*yield*/, (0, api_1.authRequest)(container._links.proxies.href, {
|
|
150
|
+
method: 'POST',
|
|
151
|
+
body: {
|
|
152
|
+
domain: domain,
|
|
153
|
+
}
|
|
154
|
+
})];
|
|
155
|
+
case 1:
|
|
156
|
+
res = _b.sent();
|
|
157
|
+
return [4 /*yield*/, res.json()];
|
|
158
|
+
case 2:
|
|
159
|
+
result = _b.sent();
|
|
160
|
+
if (result['error'])
|
|
161
|
+
throw result['error'];
|
|
162
|
+
return [2 /*return*/, result];
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
};
|
|
167
|
+
exports.createProxy = createProxy;
|
|
168
|
+
var get = function (project, id) { return __awaiter(void 0, void 0, void 0, function () {
|
|
169
|
+
var res, result;
|
|
170
|
+
return __generator(this, function (_a) {
|
|
171
|
+
switch (_a.label) {
|
|
172
|
+
case 0: return [4 /*yield*/, (0, api_1.authRequest)(project._links.containers.href + '/' + encodeURIComponent(id))];
|
|
173
|
+
case 1:
|
|
174
|
+
res = _a.sent();
|
|
175
|
+
return [4 /*yield*/, res.json()];
|
|
176
|
+
case 2:
|
|
177
|
+
result = _a.sent();
|
|
178
|
+
if (result['error'])
|
|
179
|
+
throw result['error'];
|
|
180
|
+
return [2 /*return*/, result];
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
}); };
|
|
184
|
+
exports.get = get;
|
|
185
|
+
var put = function (container, data) { return __awaiter(void 0, void 0, void 0, function () {
|
|
186
|
+
var res, result;
|
|
187
|
+
return __generator(this, function (_a) {
|
|
188
|
+
switch (_a.label) {
|
|
189
|
+
case 0: return [4 /*yield*/, (0, api_1.authRequest)(container._links.self.href, {
|
|
190
|
+
method: 'PUT',
|
|
191
|
+
body: data,
|
|
192
|
+
})];
|
|
193
|
+
case 1:
|
|
194
|
+
res = _a.sent();
|
|
195
|
+
return [4 /*yield*/, res.json()];
|
|
196
|
+
case 2:
|
|
197
|
+
result = _a.sent();
|
|
198
|
+
if (result['error'])
|
|
199
|
+
throw result['error'];
|
|
200
|
+
return [2 /*return*/, result];
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
}); };
|
|
204
|
+
exports.put = put;
|
|
205
|
+
var all = function (project) { return __awaiter(void 0, void 0, void 0, function () {
|
|
206
|
+
var res, result;
|
|
207
|
+
return __generator(this, function (_a) {
|
|
208
|
+
switch (_a.label) {
|
|
209
|
+
case 0: return [4 /*yield*/, (0, api_1.authRequest)(project._links.containers.href)];
|
|
210
|
+
case 1:
|
|
211
|
+
res = _a.sent();
|
|
212
|
+
return [4 /*yield*/, res.json()];
|
|
213
|
+
case 2:
|
|
214
|
+
result = _a.sent();
|
|
215
|
+
if (result['error'])
|
|
216
|
+
throw result['error'];
|
|
217
|
+
return [2 /*return*/, result];
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
}); };
|
|
221
|
+
exports.all = all;
|
|
222
|
+
var getProxies = function (container) { return __awaiter(void 0, void 0, void 0, function () {
|
|
223
|
+
var res, result;
|
|
224
|
+
return __generator(this, function (_a) {
|
|
225
|
+
switch (_a.label) {
|
|
226
|
+
case 0: return [4 /*yield*/, (0, api_1.authRequest)(container._links.proxies.href)];
|
|
227
|
+
case 1:
|
|
228
|
+
res = _a.sent();
|
|
229
|
+
return [4 /*yield*/, res.json()];
|
|
230
|
+
case 2:
|
|
231
|
+
result = _a.sent();
|
|
232
|
+
if (result['error'])
|
|
233
|
+
throw result['error'];
|
|
234
|
+
return [2 /*return*/, result];
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
}); };
|
|
238
|
+
exports.getProxies = getProxies;
|
|
239
|
+
var getUsage = function (container) { return __awaiter(void 0, void 0, void 0, function () {
|
|
240
|
+
var res, result;
|
|
241
|
+
return __generator(this, function (_a) {
|
|
242
|
+
switch (_a.label) {
|
|
243
|
+
case 0: return [4 /*yield*/, (0, api_1.authRequest)(container._links.usage.href)];
|
|
244
|
+
case 1:
|
|
245
|
+
res = _a.sent();
|
|
246
|
+
return [4 /*yield*/, res.json()];
|
|
247
|
+
case 2:
|
|
248
|
+
result = _a.sent();
|
|
249
|
+
if (result['error'])
|
|
250
|
+
throw result['error'];
|
|
251
|
+
return [2 /*return*/, result];
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
}); };
|
|
255
|
+
exports.getUsage = getUsage;
|
|
256
|
+
var getProxy = function (container, id) { return __awaiter(void 0, void 0, void 0, function () {
|
|
257
|
+
var res, result;
|
|
258
|
+
return __generator(this, function (_a) {
|
|
259
|
+
switch (_a.label) {
|
|
260
|
+
case 0: return [4 /*yield*/, (0, api_1.authRequest)(container._links.proxies.href + '/' + encodeURIComponent(id))];
|
|
261
|
+
case 1:
|
|
262
|
+
res = _a.sent();
|
|
263
|
+
return [4 /*yield*/, res.json()];
|
|
264
|
+
case 2:
|
|
265
|
+
result = _a.sent();
|
|
266
|
+
if (result['error'])
|
|
267
|
+
throw result['error'];
|
|
268
|
+
return [2 /*return*/, result];
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
}); };
|
|
272
|
+
exports.getProxy = getProxy;
|
|
273
|
+
var getDeployments = function (container) { return __awaiter(void 0, void 0, void 0, function () {
|
|
274
|
+
var res, result;
|
|
275
|
+
return __generator(this, function (_a) {
|
|
276
|
+
switch (_a.label) {
|
|
277
|
+
case 0: return [4 /*yield*/, (0, api_1.authRequest)(container._links.deployments.href)];
|
|
278
|
+
case 1:
|
|
279
|
+
res = _a.sent();
|
|
280
|
+
return [4 /*yield*/, res.json()];
|
|
281
|
+
case 2:
|
|
282
|
+
result = _a.sent();
|
|
283
|
+
if (result['error'])
|
|
284
|
+
throw result['error'];
|
|
285
|
+
return [2 /*return*/, result];
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
}); };
|
|
289
|
+
exports.getDeployments = getDeployments;
|
|
290
|
+
var getLogs = function (container) { return __awaiter(void 0, void 0, void 0, function () {
|
|
291
|
+
var res, result;
|
|
292
|
+
return __generator(this, function (_a) {
|
|
293
|
+
switch (_a.label) {
|
|
294
|
+
case 0: return [4 /*yield*/, (0, api_1.authRequest)(container._links.logs.href)];
|
|
295
|
+
case 1:
|
|
296
|
+
res = _a.sent();
|
|
297
|
+
return [4 /*yield*/, res.json()];
|
|
298
|
+
case 2:
|
|
299
|
+
result = _a.sent();
|
|
300
|
+
if (result['error'])
|
|
301
|
+
throw result['error'];
|
|
302
|
+
return [2 /*return*/, result];
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
}); };
|
|
306
|
+
exports.getLogs = getLogs;
|
|
307
|
+
var getDeployment = function (container, id) { return __awaiter(void 0, void 0, void 0, function () {
|
|
308
|
+
var res, result;
|
|
309
|
+
return __generator(this, function (_a) {
|
|
310
|
+
switch (_a.label) {
|
|
311
|
+
case 0: return [4 /*yield*/, (0, api_1.authRequest)(container._links.deployments.href + '/' + encodeURIComponent(id))];
|
|
312
|
+
case 1:
|
|
313
|
+
res = _a.sent();
|
|
314
|
+
return [4 /*yield*/, res.json()];
|
|
315
|
+
case 2:
|
|
316
|
+
result = _a.sent();
|
|
317
|
+
if (result['error'])
|
|
318
|
+
throw result['error'];
|
|
319
|
+
return [2 /*return*/, result];
|
|
320
|
+
}
|
|
321
|
+
});
|
|
322
|
+
}); };
|
|
323
|
+
exports.getDeployment = getDeployment;
|
|
324
|
+
var createDeployment = function (container, _a) {
|
|
325
|
+
var data = _a.data;
|
|
326
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
327
|
+
var res, result;
|
|
328
|
+
return __generator(this, function (_b) {
|
|
329
|
+
switch (_b.label) {
|
|
330
|
+
case 0: return [4 /*yield*/, (0, api_1.authRequest)(container._links.deployments.href, {
|
|
331
|
+
method: 'POST',
|
|
332
|
+
body: {
|
|
333
|
+
data: data,
|
|
334
|
+
}
|
|
335
|
+
})];
|
|
336
|
+
case 1:
|
|
337
|
+
res = _b.sent();
|
|
338
|
+
return [4 /*yield*/, res.json()];
|
|
339
|
+
case 2:
|
|
340
|
+
result = _b.sent();
|
|
341
|
+
if (result['error'])
|
|
342
|
+
throw result['error'];
|
|
343
|
+
return [2 /*return*/, result];
|
|
344
|
+
}
|
|
345
|
+
});
|
|
346
|
+
});
|
|
347
|
+
};
|
|
348
|
+
exports.createDeployment = createDeployment;
|
|
349
|
+
var buildDeployment = function (deployment) { return __awaiter(void 0, void 0, void 0, function () {
|
|
350
|
+
var res, result;
|
|
351
|
+
return __generator(this, function (_a) {
|
|
352
|
+
switch (_a.label) {
|
|
353
|
+
case 0: return [4 /*yield*/, (0, api_1.authRequest)(deployment._links.build.href, {
|
|
354
|
+
method: 'POST',
|
|
355
|
+
})];
|
|
356
|
+
case 1:
|
|
357
|
+
res = _a.sent();
|
|
358
|
+
return [4 /*yield*/, res.json()];
|
|
359
|
+
case 2:
|
|
360
|
+
result = _a.sent();
|
|
361
|
+
if (result['error'])
|
|
362
|
+
throw result['error'];
|
|
363
|
+
return [2 /*return*/, result];
|
|
364
|
+
}
|
|
365
|
+
});
|
|
366
|
+
}); };
|
|
367
|
+
exports.buildDeployment = buildDeployment;
|
|
368
|
+
var getDeploymentBuildStatus = function (deployment) { return __awaiter(void 0, void 0, void 0, function () {
|
|
369
|
+
var res, result;
|
|
370
|
+
return __generator(this, function (_a) {
|
|
371
|
+
switch (_a.label) {
|
|
372
|
+
case 0: return [4 /*yield*/, (0, api_1.authRequest)(deployment._links.build.href, {
|
|
373
|
+
method: 'GET',
|
|
374
|
+
})];
|
|
375
|
+
case 1:
|
|
376
|
+
res = _a.sent();
|
|
377
|
+
return [4 /*yield*/, res.json()];
|
|
378
|
+
case 2:
|
|
379
|
+
result = _a.sent();
|
|
380
|
+
if (result['error'])
|
|
381
|
+
throw result['error'];
|
|
382
|
+
return [2 /*return*/, result];
|
|
383
|
+
}
|
|
384
|
+
});
|
|
385
|
+
}); };
|
|
386
|
+
exports.getDeploymentBuildStatus = getDeploymentBuildStatus;
|
|
387
|
+
var createFilesystem = function (container, _a) {
|
|
388
|
+
var path = _a.path;
|
|
389
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
390
|
+
var res, result;
|
|
391
|
+
return __generator(this, function (_b) {
|
|
392
|
+
switch (_b.label) {
|
|
393
|
+
case 0: return [4 /*yield*/, (0, api_1.authRequest)(container._links.filesystems.href, {
|
|
394
|
+
method: 'POST',
|
|
395
|
+
body: {
|
|
396
|
+
path: path,
|
|
397
|
+
}
|
|
398
|
+
})];
|
|
399
|
+
case 1:
|
|
400
|
+
res = _b.sent();
|
|
401
|
+
return [4 /*yield*/, res.json()];
|
|
402
|
+
case 2:
|
|
403
|
+
result = _b.sent();
|
|
404
|
+
if (result['error'])
|
|
405
|
+
throw result['error'];
|
|
406
|
+
return [2 /*return*/, result];
|
|
407
|
+
}
|
|
408
|
+
});
|
|
409
|
+
});
|
|
410
|
+
};
|
|
411
|
+
exports.createFilesystem = createFilesystem;
|
|
412
|
+
var getFilesystems = function (container) { return __awaiter(void 0, void 0, void 0, function () {
|
|
413
|
+
var res, result;
|
|
414
|
+
return __generator(this, function (_a) {
|
|
415
|
+
switch (_a.label) {
|
|
416
|
+
case 0: return [4 /*yield*/, (0, api_1.authRequest)(container._links.filesystems.href)];
|
|
417
|
+
case 1:
|
|
418
|
+
res = _a.sent();
|
|
419
|
+
return [4 /*yield*/, res.json()];
|
|
420
|
+
case 2:
|
|
421
|
+
result = _a.sent();
|
|
422
|
+
if (result['error'])
|
|
423
|
+
throw result['error'];
|
|
424
|
+
return [2 /*return*/, result];
|
|
425
|
+
}
|
|
426
|
+
});
|
|
427
|
+
}); };
|
|
428
|
+
exports.getFilesystems = getFilesystems;
|
|
429
|
+
var getFilesystem = function (container, id) { return __awaiter(void 0, void 0, void 0, function () {
|
|
430
|
+
var res, result;
|
|
431
|
+
return __generator(this, function (_a) {
|
|
432
|
+
switch (_a.label) {
|
|
433
|
+
case 0: return [4 /*yield*/, (0, api_1.authRequest)(container._links.filesystems.href + '/' + encodeURIComponent(id))];
|
|
434
|
+
case 1:
|
|
435
|
+
res = _a.sent();
|
|
436
|
+
return [4 /*yield*/, res.json()];
|
|
437
|
+
case 2:
|
|
438
|
+
result = _a.sent();
|
|
439
|
+
if (result['error'])
|
|
440
|
+
throw result['error'];
|
|
441
|
+
return [2 /*return*/, result];
|
|
442
|
+
}
|
|
443
|
+
});
|
|
444
|
+
}); };
|
|
445
|
+
exports.getFilesystem = getFilesystem;
|
|
446
|
+
var ProjectContainer = {
|
|
447
|
+
all: exports.all,
|
|
448
|
+
get: exports.get,
|
|
449
|
+
put: exports.put,
|
|
450
|
+
create: exports.create,
|
|
451
|
+
getLogs: exports.getLogs,
|
|
452
|
+
getProxies: exports.getProxies,
|
|
453
|
+
getProxy: exports.getProxy,
|
|
454
|
+
createProxy: exports.createProxy,
|
|
455
|
+
getDeployments: exports.getDeployments,
|
|
456
|
+
getDeployment: exports.getDeployment,
|
|
457
|
+
createDeployment: exports.createDeployment,
|
|
458
|
+
buildDeployment: exports.buildDeployment,
|
|
459
|
+
getDeploymentBuildStatus: exports.getDeploymentBuildStatus,
|
|
460
|
+
createFilesystem: exports.createFilesystem,
|
|
461
|
+
getFilesystem: exports.getFilesystem,
|
|
462
|
+
getFilesystems: exports.getFilesystems,
|
|
463
|
+
getUsage: exports.getUsage,
|
|
464
|
+
};
|
|
465
|
+
exports.default = ProjectContainer;
|