contree-client 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/LICENSE +177 -0
- package/README.md +131 -0
- package/lib/client.d.ts +181 -0
- package/lib/client.js +786 -0
- package/lib/errors.d.ts +30 -0
- package/lib/errors.js +46 -0
- package/lib/index.d.ts +19 -0
- package/lib/index.js +18 -0
- package/lib/models.d.ts +811 -0
- package/lib/models.js +2173 -0
- package/lib/operations.d.ts +193 -0
- package/lib/operations.js +543 -0
- package/lib/profiles.d.ts +31 -0
- package/lib/profiles.js +159 -0
- package/lib/runtime.d.ts +93 -0
- package/lib/runtime.js +415 -0
- package/lib/specInfo.d.ts +4 -0
- package/lib/specInfo.js +8 -0
- package/lib/testing.d.ts +37 -0
- package/lib/testing.js +122 -0
- package/package.json +35 -0
|
@@ -0,0 +1,543 @@
|
|
|
1
|
+
// Generated by codegen from the OpenAPI spec - do not edit.
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
errorForResponse,
|
|
5
|
+
formatTimeParam,
|
|
6
|
+
jsonArray,
|
|
7
|
+
jsonObject,
|
|
8
|
+
quotePath,
|
|
9
|
+
} from "./runtime.js";
|
|
10
|
+
|
|
11
|
+
import {
|
|
12
|
+
DirectoryList,
|
|
13
|
+
File,
|
|
14
|
+
FileResponse,
|
|
15
|
+
FilesListResponse,
|
|
16
|
+
Image,
|
|
17
|
+
ImageImportRequest,
|
|
18
|
+
ImageListResponse,
|
|
19
|
+
InstanceSpawnRequest,
|
|
20
|
+
InstanceSpawnResponse,
|
|
21
|
+
OperationResponse,
|
|
22
|
+
OperationSummary,
|
|
23
|
+
WhoAmIResponse,
|
|
24
|
+
} from "./models.js";
|
|
25
|
+
|
|
26
|
+
/** Build the request for `GET /images`. */
|
|
27
|
+
export function buildListImages({
|
|
28
|
+
limit = null,
|
|
29
|
+
offset = null,
|
|
30
|
+
tagged = false,
|
|
31
|
+
tag = null,
|
|
32
|
+
uuid = null,
|
|
33
|
+
since = null,
|
|
34
|
+
until = null,
|
|
35
|
+
} = {}) {
|
|
36
|
+
const query = {};
|
|
37
|
+
if (limit != null) {
|
|
38
|
+
query["limit"] = String(limit);
|
|
39
|
+
}
|
|
40
|
+
if (offset != null) {
|
|
41
|
+
query["offset"] = String(offset);
|
|
42
|
+
}
|
|
43
|
+
if (tagged) {
|
|
44
|
+
query["tagged"] = "1";
|
|
45
|
+
}
|
|
46
|
+
if (tag != null) {
|
|
47
|
+
query["tag"] = tag;
|
|
48
|
+
}
|
|
49
|
+
if (uuid != null) {
|
|
50
|
+
query["uuid"] = uuid;
|
|
51
|
+
}
|
|
52
|
+
if (since != null) {
|
|
53
|
+
query["since"] = formatTimeParam(since);
|
|
54
|
+
}
|
|
55
|
+
if (until != null) {
|
|
56
|
+
query["until"] = formatTimeParam(until);
|
|
57
|
+
}
|
|
58
|
+
return { method: "GET", path: `/images`, idempotent: true, query };
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** Parse the response of `GET /images`. */
|
|
62
|
+
export function parseListImages(response) {
|
|
63
|
+
if (response.status >= 200 && response.status < 300) {
|
|
64
|
+
return ImageListResponse.fromWire(jsonObject(response));
|
|
65
|
+
}
|
|
66
|
+
throw errorForResponse(response);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** Build the request for `DELETE /images/{imageUUID}/tag`. */
|
|
70
|
+
export function buildDeleteImageTag(imageUuid, { tag = null } = {}) {
|
|
71
|
+
const query = {};
|
|
72
|
+
if (tag != null) {
|
|
73
|
+
query["tag"] = tag;
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
method: "DELETE",
|
|
77
|
+
path: `/images/${quotePath(imageUuid)}/tag`,
|
|
78
|
+
idempotent: true,
|
|
79
|
+
query,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** Parse the response of `DELETE /images/{imageUUID}/tag`. */
|
|
84
|
+
export function parseDeleteImageTag(response) {
|
|
85
|
+
if (response.status >= 200 && response.status < 300) {
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
throw errorForResponse(response);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** Build the request for `PATCH /images/{imageUUID}/tag`. */
|
|
92
|
+
export function buildUpdateImageTag(imageUuid, tag) {
|
|
93
|
+
const payload = {};
|
|
94
|
+
payload["tag"] = tag;
|
|
95
|
+
return {
|
|
96
|
+
method: "PATCH",
|
|
97
|
+
path: `/images/${quotePath(imageUuid)}/tag`,
|
|
98
|
+
idempotent: false,
|
|
99
|
+
body: JSON.stringify(payload),
|
|
100
|
+
contentType: "application/json",
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** Parse the response of `PATCH /images/{imageUUID}/tag`. */
|
|
105
|
+
export function parseUpdateImageTag(response) {
|
|
106
|
+
if (response.status >= 200 && response.status < 300) {
|
|
107
|
+
return Image.fromWire(jsonObject(response));
|
|
108
|
+
}
|
|
109
|
+
throw errorForResponse(response);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/** Build the request for `POST /images/import`. */
|
|
113
|
+
export function buildImportImage(registry, { tag, timeout } = {}) {
|
|
114
|
+
const payload = new ImageImportRequest({
|
|
115
|
+
registry: registry,
|
|
116
|
+
tag,
|
|
117
|
+
timeout,
|
|
118
|
+
}).toWire();
|
|
119
|
+
return {
|
|
120
|
+
method: "POST",
|
|
121
|
+
path: `/images/import`,
|
|
122
|
+
idempotent: false,
|
|
123
|
+
body: JSON.stringify(payload),
|
|
124
|
+
contentType: "application/json",
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/** Parse the response of `POST /images/import`. */
|
|
129
|
+
export function parseImportImage(response) {
|
|
130
|
+
if (response.status >= 200 && response.status < 300) {
|
|
131
|
+
return String(jsonObject(response)["uuid"]);
|
|
132
|
+
}
|
|
133
|
+
throw errorForResponse(response);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/** Build the request for `GET /files`. */
|
|
137
|
+
export function buildListFiles({
|
|
138
|
+
limit = null,
|
|
139
|
+
offset = null,
|
|
140
|
+
since = null,
|
|
141
|
+
until = null,
|
|
142
|
+
} = {}) {
|
|
143
|
+
const query = {};
|
|
144
|
+
if (limit != null) {
|
|
145
|
+
query["limit"] = String(limit);
|
|
146
|
+
}
|
|
147
|
+
if (offset != null) {
|
|
148
|
+
query["offset"] = String(offset);
|
|
149
|
+
}
|
|
150
|
+
if (since != null) {
|
|
151
|
+
query["since"] = formatTimeParam(since);
|
|
152
|
+
}
|
|
153
|
+
if (until != null) {
|
|
154
|
+
query["until"] = formatTimeParam(until);
|
|
155
|
+
}
|
|
156
|
+
return { method: "GET", path: `/files`, idempotent: true, query };
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/** Parse the response of `GET /files`. */
|
|
160
|
+
export function parseListFiles(response) {
|
|
161
|
+
if (response.status >= 200 && response.status < 300) {
|
|
162
|
+
return FilesListResponse.fromWire(jsonObject(response));
|
|
163
|
+
}
|
|
164
|
+
throw errorForResponse(response);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/** Build the request for `POST /files`. */
|
|
168
|
+
export function buildUploadFile(content) {
|
|
169
|
+
return {
|
|
170
|
+
method: "POST",
|
|
171
|
+
path: `/files`,
|
|
172
|
+
idempotent: false,
|
|
173
|
+
body: content,
|
|
174
|
+
contentType: "application/octet-stream",
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/** Parse the response of `POST /files`. */
|
|
179
|
+
export function parseUploadFile(response) {
|
|
180
|
+
if (response.status >= 200 && response.status < 300) {
|
|
181
|
+
return FileResponse.fromWire(jsonObject(response));
|
|
182
|
+
}
|
|
183
|
+
throw errorForResponse(response);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/** Build the request for `GET /files/{sha256}`. */
|
|
187
|
+
export function buildGetFile(sha256) {
|
|
188
|
+
return {
|
|
189
|
+
method: "GET",
|
|
190
|
+
path: `/files/${quotePath(sha256)}`,
|
|
191
|
+
idempotent: true,
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/** Parse the response of `GET /files/{sha256}`. */
|
|
196
|
+
export function parseGetFile(response) {
|
|
197
|
+
if (response.status >= 200 && response.status < 300) {
|
|
198
|
+
return File.fromWire(jsonObject(response));
|
|
199
|
+
}
|
|
200
|
+
throw errorForResponse(response);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/** Build the request for `HEAD /files/{sha256}`. */
|
|
204
|
+
export function buildCheckFileExists(sha256) {
|
|
205
|
+
return {
|
|
206
|
+
method: "HEAD",
|
|
207
|
+
path: `/files/${quotePath(sha256)}`,
|
|
208
|
+
idempotent: true,
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/** Parse the response of `HEAD /files/{sha256}`. */
|
|
213
|
+
export function parseCheckFileExists(response) {
|
|
214
|
+
if (response.status >= 200 && response.status < 300) {
|
|
215
|
+
return true;
|
|
216
|
+
}
|
|
217
|
+
if (response.status === 404) {
|
|
218
|
+
return false;
|
|
219
|
+
}
|
|
220
|
+
throw errorForResponse(response);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/** Build the request for `POST /instances`. */
|
|
224
|
+
export function buildSpawnInstance(
|
|
225
|
+
command,
|
|
226
|
+
image,
|
|
227
|
+
{
|
|
228
|
+
disposable,
|
|
229
|
+
hostname,
|
|
230
|
+
args,
|
|
231
|
+
shell,
|
|
232
|
+
env,
|
|
233
|
+
preserve_env,
|
|
234
|
+
cwd,
|
|
235
|
+
uid,
|
|
236
|
+
gid,
|
|
237
|
+
resources_limits,
|
|
238
|
+
stdin,
|
|
239
|
+
timeout,
|
|
240
|
+
truncate_output_at,
|
|
241
|
+
files,
|
|
242
|
+
} = {},
|
|
243
|
+
) {
|
|
244
|
+
const payload = new InstanceSpawnRequest({
|
|
245
|
+
command: command,
|
|
246
|
+
image: image,
|
|
247
|
+
disposable,
|
|
248
|
+
hostname,
|
|
249
|
+
args,
|
|
250
|
+
shell,
|
|
251
|
+
env,
|
|
252
|
+
preserve_env,
|
|
253
|
+
cwd,
|
|
254
|
+
uid,
|
|
255
|
+
gid,
|
|
256
|
+
resources_limits,
|
|
257
|
+
stdin,
|
|
258
|
+
timeout,
|
|
259
|
+
truncate_output_at,
|
|
260
|
+
files,
|
|
261
|
+
}).toWire();
|
|
262
|
+
return {
|
|
263
|
+
method: "POST",
|
|
264
|
+
path: `/instances`,
|
|
265
|
+
idempotent: false,
|
|
266
|
+
body: JSON.stringify(payload),
|
|
267
|
+
contentType: "application/json",
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/** Parse the response of `POST /instances`. */
|
|
272
|
+
export function parseSpawnInstance(response) {
|
|
273
|
+
if (response.status >= 200 && response.status < 300) {
|
|
274
|
+
return InstanceSpawnResponse.fromWire(jsonObject(response));
|
|
275
|
+
}
|
|
276
|
+
throw errorForResponse(response);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/** Build the request for `GET /operations`. */
|
|
280
|
+
export function buildListOperations({
|
|
281
|
+
limit = null,
|
|
282
|
+
offset = null,
|
|
283
|
+
status = null,
|
|
284
|
+
kind = null,
|
|
285
|
+
since = null,
|
|
286
|
+
until = null,
|
|
287
|
+
} = {}) {
|
|
288
|
+
const query = {};
|
|
289
|
+
if (limit != null) {
|
|
290
|
+
query["limit"] = String(limit);
|
|
291
|
+
}
|
|
292
|
+
if (offset != null) {
|
|
293
|
+
query["offset"] = String(offset);
|
|
294
|
+
}
|
|
295
|
+
if (status != null) {
|
|
296
|
+
query["status"] = String(status);
|
|
297
|
+
}
|
|
298
|
+
if (kind != null) {
|
|
299
|
+
query["kind"] = kind;
|
|
300
|
+
}
|
|
301
|
+
if (since != null) {
|
|
302
|
+
query["since"] = formatTimeParam(since);
|
|
303
|
+
}
|
|
304
|
+
if (until != null) {
|
|
305
|
+
query["until"] = formatTimeParam(until);
|
|
306
|
+
}
|
|
307
|
+
return { method: "GET", path: `/operations`, idempotent: true, query };
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/** Parse the response of `GET /operations`. */
|
|
311
|
+
export function parseListOperations(response) {
|
|
312
|
+
if (response.status >= 200 && response.status < 300) {
|
|
313
|
+
return jsonArray(response).map((item) => OperationSummary.fromWire(item));
|
|
314
|
+
}
|
|
315
|
+
throw errorForResponse(response);
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
/** Build the request for `GET /operations/{operationId}`. */
|
|
319
|
+
export function buildGetOperationStatus(
|
|
320
|
+
operationId,
|
|
321
|
+
{ inflight = false } = {},
|
|
322
|
+
) {
|
|
323
|
+
const query = {};
|
|
324
|
+
if (inflight) {
|
|
325
|
+
query["inflight"] = "1";
|
|
326
|
+
}
|
|
327
|
+
return {
|
|
328
|
+
method: "GET",
|
|
329
|
+
path: `/operations/${quotePath(operationId)}`,
|
|
330
|
+
idempotent: true,
|
|
331
|
+
query,
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/** Parse the response of `GET /operations/{operationId}`. */
|
|
336
|
+
export function parseGetOperationStatus(response) {
|
|
337
|
+
if (response.status >= 200 && response.status < 300) {
|
|
338
|
+
return OperationResponse.fromWire(jsonObject(response));
|
|
339
|
+
}
|
|
340
|
+
throw errorForResponse(response);
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
/** Build the request for `DELETE /operations/{operationId}`. */
|
|
344
|
+
export function buildCancelOperation(operationId) {
|
|
345
|
+
return {
|
|
346
|
+
method: "DELETE",
|
|
347
|
+
path: `/operations/${quotePath(operationId)}`,
|
|
348
|
+
idempotent: true,
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
/** Parse the response of `DELETE /operations/{operationId}`. */
|
|
353
|
+
export function parseCancelOperation(response) {
|
|
354
|
+
if (response.status >= 200 && response.status < 300) {
|
|
355
|
+
return null;
|
|
356
|
+
}
|
|
357
|
+
throw errorForResponse(response);
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
/** Build the request for `GET /operations/{operationId}/events`. */
|
|
361
|
+
export function buildIterOperationEvents(
|
|
362
|
+
operationId,
|
|
363
|
+
{ follow = false, spid = null, since = null, last_event_id = null } = {},
|
|
364
|
+
) {
|
|
365
|
+
const query = {};
|
|
366
|
+
if (follow) {
|
|
367
|
+
query["follow"] = "1";
|
|
368
|
+
}
|
|
369
|
+
if (spid != null) {
|
|
370
|
+
query["spid"] = String(spid);
|
|
371
|
+
}
|
|
372
|
+
if (since != null) {
|
|
373
|
+
query["since"] = String(since);
|
|
374
|
+
}
|
|
375
|
+
const headers = {};
|
|
376
|
+
if (last_event_id != null) {
|
|
377
|
+
headers["Last-Event-Id"] = String(last_event_id);
|
|
378
|
+
}
|
|
379
|
+
return {
|
|
380
|
+
method: "GET",
|
|
381
|
+
path: `/operations/${quotePath(operationId)}/events`,
|
|
382
|
+
idempotent: true,
|
|
383
|
+
query,
|
|
384
|
+
headers,
|
|
385
|
+
accept: "text/event-stream",
|
|
386
|
+
};
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
/** Build the request for `GET /inspect/`. */
|
|
390
|
+
export function buildInspectFindImageByTag(tag) {
|
|
391
|
+
const query = {};
|
|
392
|
+
query["tag"] = tag;
|
|
393
|
+
return {
|
|
394
|
+
method: "GET",
|
|
395
|
+
path: `/inspect/`,
|
|
396
|
+
idempotent: true,
|
|
397
|
+
query,
|
|
398
|
+
redirect: "follow",
|
|
399
|
+
};
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
/** Parse the response of `GET /inspect/`. */
|
|
403
|
+
export function parseInspectFindImageByTag(response) {
|
|
404
|
+
// Node exposes the 302 Location; browsers only expose the
|
|
405
|
+
// followed response, whose final URL ends with the UUID
|
|
406
|
+
if (response.status === 302 && response.headers["location"]) {
|
|
407
|
+
const location = response.headers["location"];
|
|
408
|
+
return location.replace(/\/+$/, "").split("/").pop();
|
|
409
|
+
}
|
|
410
|
+
if (response.status >= 200 && response.status < 300 && response.url) {
|
|
411
|
+
const path = new URL(response.url).pathname;
|
|
412
|
+
return path.replace(/\/+$/, "").split("/").pop();
|
|
413
|
+
}
|
|
414
|
+
throw errorForResponse(response);
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
/** Build the request for `GET /inspect/{image_uuid}/`. */
|
|
418
|
+
export function buildInspectImage(imageUuid) {
|
|
419
|
+
return {
|
|
420
|
+
method: "GET",
|
|
421
|
+
path: `/inspect/${quotePath(imageUuid)}/`,
|
|
422
|
+
idempotent: true,
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
/** Parse the response of `GET /inspect/{image_uuid}/`. */
|
|
427
|
+
export function parseInspectImage(response) {
|
|
428
|
+
if (response.status >= 200 && response.status < 300) {
|
|
429
|
+
return Image.fromWire(jsonObject(response));
|
|
430
|
+
}
|
|
431
|
+
throw errorForResponse(response);
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
/** Build the request for `GET /inspect/{image_uuid}/download`. */
|
|
435
|
+
export function buildInspectImageDownload(imageUuid, path) {
|
|
436
|
+
const query = {};
|
|
437
|
+
query["path"] = path;
|
|
438
|
+
return {
|
|
439
|
+
method: "GET",
|
|
440
|
+
path: `/inspect/${quotePath(imageUuid)}/download`,
|
|
441
|
+
idempotent: true,
|
|
442
|
+
query,
|
|
443
|
+
};
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
/** Parse the response of `GET /inspect/{image_uuid}/download`. */
|
|
447
|
+
export function parseInspectImageDownload(response) {
|
|
448
|
+
if (response.status >= 200 && response.status < 300) {
|
|
449
|
+
return response.body;
|
|
450
|
+
}
|
|
451
|
+
throw errorForResponse(response);
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
/** Build the request for `HEAD /inspect/{image_uuid}/download`. */
|
|
455
|
+
export function buildCheckImageFile(imageUuid, path) {
|
|
456
|
+
const query = {};
|
|
457
|
+
query["path"] = path;
|
|
458
|
+
return {
|
|
459
|
+
method: "HEAD",
|
|
460
|
+
path: `/inspect/${quotePath(imageUuid)}/download`,
|
|
461
|
+
idempotent: true,
|
|
462
|
+
query,
|
|
463
|
+
};
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
/** Parse the response of `HEAD /inspect/{image_uuid}/download`. */
|
|
467
|
+
export function parseCheckImageFile(response) {
|
|
468
|
+
if (response.status >= 200 && response.status < 300) {
|
|
469
|
+
return true;
|
|
470
|
+
}
|
|
471
|
+
if (response.status === 404) {
|
|
472
|
+
return false;
|
|
473
|
+
}
|
|
474
|
+
throw errorForResponse(response);
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
/** Build the request for `GET /inspect/{image_uuid}/archive`. */
|
|
478
|
+
export function buildInspectImageArchive(imageUuid, path) {
|
|
479
|
+
const query = {};
|
|
480
|
+
query["path"] = path;
|
|
481
|
+
return {
|
|
482
|
+
method: "GET",
|
|
483
|
+
path: `/inspect/${quotePath(imageUuid)}/archive`,
|
|
484
|
+
idempotent: true,
|
|
485
|
+
query,
|
|
486
|
+
};
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
/** Build the request for `HEAD /inspect/{image_uuid}/archive`. */
|
|
490
|
+
export function buildCheckImageArchive(imageUuid, path) {
|
|
491
|
+
const query = {};
|
|
492
|
+
query["path"] = path;
|
|
493
|
+
return {
|
|
494
|
+
method: "HEAD",
|
|
495
|
+
path: `/inspect/${quotePath(imageUuid)}/archive`,
|
|
496
|
+
idempotent: true,
|
|
497
|
+
query,
|
|
498
|
+
};
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
/** Parse the response of `HEAD /inspect/{image_uuid}/archive`. */
|
|
502
|
+
export function parseCheckImageArchive(response) {
|
|
503
|
+
if (response.status >= 200 && response.status < 300) {
|
|
504
|
+
return true;
|
|
505
|
+
}
|
|
506
|
+
if (response.status === 404) {
|
|
507
|
+
return false;
|
|
508
|
+
}
|
|
509
|
+
throw errorForResponse(response);
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
/** Build the request for `GET /inspect/{image_uuid}/list`. */
|
|
513
|
+
export function buildInspectImageList(imageUuid, path) {
|
|
514
|
+
const query = {};
|
|
515
|
+
query["path"] = path;
|
|
516
|
+
return {
|
|
517
|
+
method: "GET",
|
|
518
|
+
path: `/inspect/${quotePath(imageUuid)}/list`,
|
|
519
|
+
idempotent: true,
|
|
520
|
+
query,
|
|
521
|
+
};
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
/** Parse the response of `GET /inspect/{image_uuid}/list`. */
|
|
525
|
+
export function parseInspectImageList(response) {
|
|
526
|
+
if (response.status >= 200 && response.status < 300) {
|
|
527
|
+
return DirectoryList.fromWire(jsonObject(response));
|
|
528
|
+
}
|
|
529
|
+
throw errorForResponse(response);
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
/** Build the request for `GET /whoami`. */
|
|
533
|
+
export function buildWhoami() {
|
|
534
|
+
return { method: "GET", path: `/whoami`, idempotent: true };
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
/** Parse the response of `GET /whoami`. */
|
|
538
|
+
export function parseWhoami(response) {
|
|
539
|
+
if (response.status >= 200 && response.status < 300) {
|
|
540
|
+
return WhoAmIResponse.fromWire(jsonObject(response));
|
|
541
|
+
}
|
|
542
|
+
throw errorForResponse(response);
|
|
543
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ContreeError } from "./errors.js";
|
|
2
|
+
|
|
3
|
+
export declare const AUTH_TYPE_IAM: "iam";
|
|
4
|
+
export declare const AUTH_TYPE_JWT: "jwt";
|
|
5
|
+
export declare const PROFILE_PREFIX: "profile:";
|
|
6
|
+
export declare const DEFAULT_PROFILE: "default";
|
|
7
|
+
|
|
8
|
+
export declare class ProfileError extends ContreeError {}
|
|
9
|
+
|
|
10
|
+
export interface Profile {
|
|
11
|
+
name: string;
|
|
12
|
+
url: string;
|
|
13
|
+
token: string | null;
|
|
14
|
+
authType: string;
|
|
15
|
+
project: string | null;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export declare function parseIni(
|
|
19
|
+
text: string,
|
|
20
|
+
): Map<string, Record<string, string>>;
|
|
21
|
+
|
|
22
|
+
export declare function fromEnv(): Profile | null;
|
|
23
|
+
|
|
24
|
+
export declare function loadProfiles(
|
|
25
|
+
path?: string | null,
|
|
26
|
+
): Promise<{ profiles: Record<string, Profile>; active: string }>;
|
|
27
|
+
|
|
28
|
+
export declare function resolveProfile(
|
|
29
|
+
name?: string | null,
|
|
30
|
+
options?: { path?: string | null },
|
|
31
|
+
): Promise<Profile>;
|