@scaleway/sdk 2.0.0-alpha.9 → 2.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/applesilicon/v1alpha1/marshalling.gen.js +12 -12
- package/dist/api/baremetal/v1/marshalling.gen.js +63 -52
- package/dist/api/billing/v2alpha1/api.gen.js +32 -1
- package/dist/api/billing/v2alpha1/marshalling.gen.js +46 -1
- package/dist/api/block/v1alpha1/api.gen.js +23 -19
- package/dist/api/block/v1alpha1/marshalling.gen.js +47 -40
- package/dist/api/block/v1alpha1/validation-rules.gen.js +11 -1
- package/dist/api/cockpit/v1beta1/api.gen.js +143 -48
- package/dist/api/cockpit/v1beta1/marshalling.gen.js +89 -36
- package/dist/api/container/v1beta1/index.gen.js +2 -0
- package/dist/api/container/v1beta1/marshalling.gen.js +63 -35
- package/dist/api/container/v1beta1/validation-rules.gen.js +44 -0
- package/dist/api/document_db/v1beta1/marshalling.gen.js +117 -61
- package/dist/api/domain/v2beta1/api.gen.js +29 -37
- package/dist/api/domain/v2beta1/index.gen.js +0 -2
- package/dist/api/domain/v2beta1/marshalling.gen.js +408 -194
- package/dist/api/flexibleip/v1alpha1/api.gen.js +6 -14
- package/dist/api/flexibleip/v1alpha1/marshalling.gen.js +2 -2
- package/dist/api/function/v1beta1/api.gen.js +36 -0
- package/dist/api/function/v1beta1/index.gen.js +2 -0
- package/dist/api/function/v1beta1/marshalling.gen.js +64 -36
- package/dist/api/function/v1beta1/validation-rules.gen.js +44 -0
- package/dist/api/iam/v1alpha1/api.gen.js +54 -44
- package/dist/api/iam/v1alpha1/marshalling.gen.js +69 -34
- package/dist/api/iam/v1alpha1/validation-rules.gen.js +10 -1
- package/dist/api/instance/v1/api.gen.js +1 -1
- package/dist/api/instance/v1/content.gen.js +4 -1
- package/dist/api/instance/v1/index.js +1 -1
- package/dist/api/instance/v1/marshalling.gen.js +414 -205
- package/dist/api/iot/v1/api.gen.js +24 -32
- package/dist/api/iot/v1/marshalling.gen.js +87 -36
- package/dist/api/ipam/index.js +2 -0
- package/dist/api/ipam/v1/api.gen.js +113 -0
- package/dist/api/ipam/v1/index.gen.js +6 -0
- package/dist/api/ipam/v1/marshalling.gen.js +77 -0
- package/dist/api/ipam/v1/validation-rules.gen.js +11 -0
- package/dist/api/ipfs/v1alpha1/api.gen.js +120 -3
- package/dist/api/ipfs/v1alpha1/content.gen.js +4 -1
- package/dist/api/ipfs/v1alpha1/index.gen.js +2 -2
- package/dist/api/ipfs/v1alpha1/marshalling.gen.js +71 -19
- package/dist/api/jobs/index.js +2 -0
- package/dist/api/jobs/v1alpha1/api.gen.js +111 -0
- package/dist/api/jobs/v1alpha1/content.gen.js +7 -0
- package/dist/api/jobs/v1alpha1/index.gen.js +7 -0
- package/dist/api/jobs/v1alpha1/marshalling.gen.js +84 -0
- package/dist/api/jobs/v1alpha1/validation-rules.gen.js +45 -0
- package/dist/api/k8s/v1/marshalling.gen.js +128 -40
- package/dist/api/lb/v1/api.gen.js +1 -1
- package/dist/api/lb/v1/marshalling.gen.js +268 -152
- package/dist/api/marketplace/v1/marshalling.gen.js +11 -11
- package/dist/api/marketplace/v2/api.gen.js +3 -3
- package/dist/api/mnq/index.js +2 -0
- package/dist/api/mnq/v1alpha1/api.gen.js +12 -20
- package/dist/api/mnq/v1alpha1/marshalling.gen.js +19 -14
- package/dist/api/mnq/v1beta1/api.gen.js +529 -0
- package/dist/api/mnq/v1beta1/index.gen.js +6 -0
- package/dist/api/mnq/v1beta1/marshalling.gen.js +212 -0
- package/dist/api/mnq/v1beta1/validation-rules.gen.js +77 -0
- package/dist/api/rdb/v1/marshalling.gen.js +131 -66
- package/dist/api/redis/v1/marshalling.gen.js +51 -27
- package/dist/api/registry/v1/marshalling.gen.js +6 -4
- package/dist/api/secret/v1alpha1/api.gen.js +2 -2
- package/dist/api/secret/v1alpha1/marshalling.gen.js +17 -5
- package/dist/api/std/index.gen.js +1 -0
- package/dist/api/tem/v1alpha1/api.gen.js +8 -2
- package/dist/api/tem/v1alpha1/marshalling.gen.js +35 -13
- package/dist/api/test/v1/marshalling.gen.js +5 -3
- package/dist/api/vpc/v2/marshalling.gen.js +2 -0
- package/dist/api/vpcgw/v1/marshalling.gen.js +53 -24
- package/dist/api/webhosting/v1alpha1/api.gen.js +2 -54
- package/dist/api/webhosting/v1alpha1/index.gen.js +1 -1
- package/dist/api/webhosting/v1alpha1/marshalling.gen.js +14 -41
- package/dist/api/webhosting/v1alpha1/validation-rules.gen.js +1 -10
- package/dist/index.cjs +4351 -1833
- package/dist/index.d.ts +6778 -2542
- package/dist/index.js +34 -28
- package/dist/scw/constants.js +1 -1
- package/package.json +2 -2
|
@@ -2,8 +2,8 @@ import { waitForResource } from '../../../internal/async/interval-retrier.js';
|
|
|
2
2
|
import { API as API$1 } from '../../../scw/api.js';
|
|
3
3
|
import { validatePathParam, urlParams } from '../../../helpers/marshalling.js';
|
|
4
4
|
import { enrichForPagination } from '../../../scw/fetch/resource-paginator.js';
|
|
5
|
-
import { PIN_TRANSIENT_STATUSES } from './content.gen.js';
|
|
6
|
-
import { marshalCreateVolumeRequest, unmarshalVolume, unmarshalListVolumesResponse, marshalUpdateVolumeRequest, marshalCreatePinByURLRequest, unmarshalPin, marshalCreatePinByCIDRequest, marshalReplacePinRequest, unmarshalReplacePinResponse, unmarshalListPinsResponse } from './marshalling.gen.js';
|
|
5
|
+
import { PIN_TRANSIENT_STATUSES, NAME_TRANSIENT_STATUSES } from './content.gen.js';
|
|
6
|
+
import { marshalCreateVolumeRequest, unmarshalVolume, unmarshalListVolumesResponse, marshalUpdateVolumeRequest, marshalCreatePinByURLRequest, unmarshalPin, marshalCreatePinByCIDRequest, marshalReplacePinRequest, unmarshalReplacePinResponse, unmarshalListPinsResponse, marshalIpnsApiCreateNameRequest, unmarshalName, unmarshalListNamesResponse, marshalIpnsApiUpdateNameRequest, unmarshalExportKeyNameResponse, marshalIpnsApiImportKeyNameRequest } from './marshalling.gen.js';
|
|
7
7
|
|
|
8
8
|
// This file was automatically generated. DO NOT EDIT.
|
|
9
9
|
// If you have any remark or suggestion do not hesitate to open an issue.
|
|
@@ -194,4 +194,121 @@ class API extends API$1 {
|
|
|
194
194
|
});
|
|
195
195
|
}
|
|
196
196
|
|
|
197
|
-
|
|
197
|
+
/** IPFS Naming service API. */
|
|
198
|
+
class IpnsAPI extends API$1 {
|
|
199
|
+
/** Lists the available regions of the API. */
|
|
200
|
+
static LOCALITIES = ['fr-par', 'nl-ams', 'pl-waw'];
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Create a new name. You can use the `ipns key` command to list and generate
|
|
204
|
+
* more names and their respective keys.
|
|
205
|
+
*
|
|
206
|
+
* @param request - The request {@link IpnsApiCreateNameRequest}
|
|
207
|
+
* @returns A Promise of Name
|
|
208
|
+
*/
|
|
209
|
+
createName = request => this.client.fetch({
|
|
210
|
+
body: JSON.stringify(marshalIpnsApiCreateNameRequest(request, this.client.settings)),
|
|
211
|
+
headers: jsonContentHeaders,
|
|
212
|
+
method: 'POST',
|
|
213
|
+
path: `/ipfs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/names`
|
|
214
|
+
}, unmarshalName);
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Get information about a name. Retrieve information about a specific name.
|
|
218
|
+
*
|
|
219
|
+
* @param request - The request {@link IpnsApiGetNameRequest}
|
|
220
|
+
* @returns A Promise of Name
|
|
221
|
+
*/
|
|
222
|
+
getName = request => this.client.fetch({
|
|
223
|
+
method: 'GET',
|
|
224
|
+
path: `/ipfs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/names/${validatePathParam('nameId', request.nameId)}`
|
|
225
|
+
}, unmarshalName);
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Waits for {@link Name} to be in a final state.
|
|
229
|
+
*
|
|
230
|
+
* @param request - The request {@link IpnsApiGetNameRequest}
|
|
231
|
+
* @param options - The waiting options
|
|
232
|
+
* @returns A Promise of Name
|
|
233
|
+
*/
|
|
234
|
+
waitForName = (request, options) => waitForResource(options?.stop ?? (res => Promise.resolve(!NAME_TRANSIENT_STATUSES.includes(res.status))), this.getName, request, options);
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Delete an existing name. Delete a name by its ID.
|
|
238
|
+
*
|
|
239
|
+
* @param request - The request {@link IpnsApiDeleteNameRequest}
|
|
240
|
+
*/
|
|
241
|
+
deleteName = request => this.client.fetch({
|
|
242
|
+
method: 'DELETE',
|
|
243
|
+
path: `/ipfs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/names/${validatePathParam('nameId', request.nameId)}`
|
|
244
|
+
});
|
|
245
|
+
pageOfListNames = (() => {
|
|
246
|
+
var _this3 = this;
|
|
247
|
+
return function (request) {
|
|
248
|
+
if (request === void 0) {
|
|
249
|
+
request = {};
|
|
250
|
+
}
|
|
251
|
+
return _this3.client.fetch({
|
|
252
|
+
method: 'GET',
|
|
253
|
+
path: `/ipfs/v1alpha1/regions/${validatePathParam('region', request.region ?? _this3.client.settings.defaultRegion)}/names`,
|
|
254
|
+
urlParams: urlParams(['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], ['page_size', request.pageSize ?? _this3.client.settings.defaultPageSize], ['project_id', request.projectId])
|
|
255
|
+
}, unmarshalListNamesResponse);
|
|
256
|
+
};
|
|
257
|
+
})();
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* List all names by a Project ID. Retrieve information about all names from a
|
|
261
|
+
* Project ID.
|
|
262
|
+
*
|
|
263
|
+
* @param request - The request {@link IpnsApiListNamesRequest}
|
|
264
|
+
* @returns A Promise of ListNamesResponse
|
|
265
|
+
*/
|
|
266
|
+
listNames = (() => {
|
|
267
|
+
var _this4 = this;
|
|
268
|
+
return function (request) {
|
|
269
|
+
if (request === void 0) {
|
|
270
|
+
request = {};
|
|
271
|
+
}
|
|
272
|
+
return enrichForPagination('names', _this4.pageOfListNames, request);
|
|
273
|
+
};
|
|
274
|
+
})();
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Update name information. Update name information (CID, tag, name...).
|
|
278
|
+
*
|
|
279
|
+
* @param request - The request {@link IpnsApiUpdateNameRequest}
|
|
280
|
+
* @returns A Promise of Name
|
|
281
|
+
*/
|
|
282
|
+
updateName = request => this.client.fetch({
|
|
283
|
+
body: JSON.stringify(marshalIpnsApiUpdateNameRequest(request, this.client.settings)),
|
|
284
|
+
headers: jsonContentHeaders,
|
|
285
|
+
method: 'PATCH',
|
|
286
|
+
path: `/ipfs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/names/${validatePathParam('nameId', request.nameId)}`
|
|
287
|
+
}, unmarshalName);
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* Export your private key. Export a private key by its ID.
|
|
291
|
+
*
|
|
292
|
+
* @param request - The request {@link IpnsApiExportKeyNameRequest}
|
|
293
|
+
* @returns A Promise of ExportKeyNameResponse
|
|
294
|
+
*/
|
|
295
|
+
exportKeyName = request => this.client.fetch({
|
|
296
|
+
method: 'GET',
|
|
297
|
+
path: `/ipfs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/names/${validatePathParam('nameId', request.nameId)}/export-key`
|
|
298
|
+
}, unmarshalExportKeyNameResponse);
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Import your private key. Import a private key.
|
|
302
|
+
*
|
|
303
|
+
* @param request - The request {@link IpnsApiImportKeyNameRequest}
|
|
304
|
+
* @returns A Promise of Name
|
|
305
|
+
*/
|
|
306
|
+
importKeyName = request => this.client.fetch({
|
|
307
|
+
body: JSON.stringify(marshalIpnsApiImportKeyNameRequest(request, this.client.settings)),
|
|
308
|
+
headers: jsonContentHeaders,
|
|
309
|
+
method: 'POST',
|
|
310
|
+
path: `/ipfs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/names/import-key`
|
|
311
|
+
}, unmarshalName);
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
export { API, IpnsAPI };
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
// This file was automatically generated. DO NOT EDIT.
|
|
2
2
|
// If you have any remark or suggestion do not hesitate to open an issue.
|
|
3
3
|
|
|
4
|
+
/** Lists transient statutes of the enum {@link NameStatus}. */
|
|
5
|
+
const NAME_TRANSIENT_STATUSES = ['queued', 'publishing'];
|
|
6
|
+
|
|
4
7
|
/** Lists transient statutes of the enum {@link PinStatus}. */
|
|
5
8
|
const PIN_TRANSIENT_STATUSES = ['queued', 'pinning'];
|
|
6
9
|
|
|
7
|
-
export { PIN_TRANSIENT_STATUSES };
|
|
10
|
+
export { NAME_TRANSIENT_STATUSES, PIN_TRANSIENT_STATUSES };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { API } from './api.gen.js';
|
|
2
|
-
export { PIN_TRANSIENT_STATUSES } from './content.gen.js';
|
|
1
|
+
export { API, IpnsAPI } from './api.gen.js';
|
|
2
|
+
export { NAME_TRANSIENT_STATUSES, PIN_TRANSIENT_STATUSES } from './content.gen.js';
|
|
3
3
|
|
|
4
4
|
// This file was automatically generated. DO NOT EDIT.
|
|
5
5
|
// If you have any remark or suggestion do not hesitate to open an issue.
|
|
@@ -3,16 +3,21 @@ import { unmarshalDate, unmarshalArrayOfObject } from '../../../helpers/marshall
|
|
|
3
3
|
|
|
4
4
|
// This file was automatically generated. DO NOT EDIT.
|
|
5
5
|
// If you have any remark or suggestion do not hesitate to open an issue.
|
|
6
|
-
const
|
|
6
|
+
const unmarshalName = data => {
|
|
7
7
|
if (!isJSONObject(data)) {
|
|
8
|
-
throw new TypeError(`Unmarshalling the type '
|
|
8
|
+
throw new TypeError(`Unmarshalling the type 'Name' failed as data isn't a dictionary.`);
|
|
9
9
|
}
|
|
10
10
|
return {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
createdAt: unmarshalDate(data.created_at),
|
|
12
|
+
key: data.key,
|
|
13
|
+
name: data.name,
|
|
14
|
+
nameId: data.name_id,
|
|
15
|
+
projectId: data.project_id,
|
|
16
|
+
region: data.region,
|
|
17
|
+
status: data.status,
|
|
18
|
+
tags: data.tags,
|
|
19
|
+
updatedAt: unmarshalDate(data.updated_at),
|
|
20
|
+
value: data.value
|
|
16
21
|
};
|
|
17
22
|
};
|
|
18
23
|
const unmarshalPinCIDMeta = data => {
|
|
@@ -20,7 +25,7 @@ const unmarshalPinCIDMeta = data => {
|
|
|
20
25
|
throw new TypeError(`Unmarshalling the type 'PinCIDMeta' failed as data isn't a dictionary.`);
|
|
21
26
|
}
|
|
22
27
|
return {
|
|
23
|
-
id: data.id
|
|
28
|
+
id: data.id
|
|
24
29
|
};
|
|
25
30
|
};
|
|
26
31
|
const unmarshalPinCID = data => {
|
|
@@ -28,21 +33,33 @@ const unmarshalPinCID = data => {
|
|
|
28
33
|
throw new TypeError(`Unmarshalling the type 'PinCID' failed as data isn't a dictionary.`);
|
|
29
34
|
}
|
|
30
35
|
return {
|
|
31
|
-
cid: data.cid
|
|
32
|
-
meta: unmarshalPinCIDMeta(data.meta),
|
|
33
|
-
name: data.name
|
|
36
|
+
cid: data.cid,
|
|
37
|
+
meta: data.meta ? unmarshalPinCIDMeta(data.meta) : undefined,
|
|
38
|
+
name: data.name,
|
|
34
39
|
origins: data.origins
|
|
35
40
|
};
|
|
36
41
|
};
|
|
42
|
+
const unmarshalPinInfo = data => {
|
|
43
|
+
if (!isJSONObject(data)) {
|
|
44
|
+
throw new TypeError(`Unmarshalling the type 'PinInfo' failed as data isn't a dictionary.`);
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
id: data.id,
|
|
48
|
+
progress: data.progress,
|
|
49
|
+
size: data.size,
|
|
50
|
+
statusDetails: data.status_details,
|
|
51
|
+
url: data.url
|
|
52
|
+
};
|
|
53
|
+
};
|
|
37
54
|
const unmarshalPin = data => {
|
|
38
55
|
if (!isJSONObject(data)) {
|
|
39
56
|
throw new TypeError(`Unmarshalling the type 'Pin' failed as data isn't a dictionary.`);
|
|
40
57
|
}
|
|
41
58
|
return {
|
|
42
|
-
cid: unmarshalPinCID(data.cid),
|
|
59
|
+
cid: data.cid ? unmarshalPinCID(data.cid) : undefined,
|
|
43
60
|
createdAt: unmarshalDate(data.created_at),
|
|
44
61
|
delegates: data.delegates,
|
|
45
|
-
info: unmarshalPinInfo(data.info),
|
|
62
|
+
info: data.info ? unmarshalPinInfo(data.info) : undefined,
|
|
46
63
|
pinId: data.pin_id,
|
|
47
64
|
status: data.status
|
|
48
65
|
};
|
|
@@ -58,11 +75,33 @@ const unmarshalVolume = data => {
|
|
|
58
75
|
name: data.name,
|
|
59
76
|
projectId: data.project_id,
|
|
60
77
|
region: data.region,
|
|
61
|
-
size: data.size
|
|
78
|
+
size: data.size,
|
|
62
79
|
tags: data.tags,
|
|
63
80
|
updatedAt: unmarshalDate(data.updated_at)
|
|
64
81
|
};
|
|
65
82
|
};
|
|
83
|
+
const unmarshalExportKeyNameResponse = data => {
|
|
84
|
+
if (!isJSONObject(data)) {
|
|
85
|
+
throw new TypeError(`Unmarshalling the type 'ExportKeyNameResponse' failed as data isn't a dictionary.`);
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
createdAt: unmarshalDate(data.created_at),
|
|
89
|
+
nameId: data.name_id,
|
|
90
|
+
privateKey: data.private_key,
|
|
91
|
+
projectId: data.project_id,
|
|
92
|
+
publicKey: data.public_key,
|
|
93
|
+
updatedAt: unmarshalDate(data.updated_at)
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
const unmarshalListNamesResponse = data => {
|
|
97
|
+
if (!isJSONObject(data)) {
|
|
98
|
+
throw new TypeError(`Unmarshalling the type 'ListNamesResponse' failed as data isn't a dictionary.`);
|
|
99
|
+
}
|
|
100
|
+
return {
|
|
101
|
+
names: unmarshalArrayOfObject(data.names, unmarshalName),
|
|
102
|
+
totalCount: data.total_count
|
|
103
|
+
};
|
|
104
|
+
};
|
|
66
105
|
const unmarshalListPinsResponse = data => {
|
|
67
106
|
if (!isJSONObject(data)) {
|
|
68
107
|
throw new TypeError(`Unmarshalling the type 'ListPinsResponse' failed as data isn't a dictionary.`);
|
|
@@ -86,19 +125,17 @@ const unmarshalReplacePinResponse = data => {
|
|
|
86
125
|
throw new TypeError(`Unmarshalling the type 'ReplacePinResponse' failed as data isn't a dictionary.`);
|
|
87
126
|
}
|
|
88
127
|
return {
|
|
89
|
-
pin: unmarshalPin(data.pin)
|
|
128
|
+
pin: data.pin ? unmarshalPin(data.pin) : undefined
|
|
90
129
|
};
|
|
91
130
|
};
|
|
92
131
|
const marshalCreatePinByCIDRequest = (request, defaults) => ({
|
|
93
132
|
cid: request.cid,
|
|
94
133
|
name: request.name,
|
|
95
134
|
origins: request.origins,
|
|
96
|
-
pin_options: request.pinOptions,
|
|
97
135
|
volume_id: request.volumeId
|
|
98
136
|
});
|
|
99
137
|
const marshalCreatePinByURLRequest = (request, defaults) => ({
|
|
100
138
|
name: request.name,
|
|
101
|
-
pin_options: request.pinOptions,
|
|
102
139
|
url: request.url,
|
|
103
140
|
volume_id: request.volumeId
|
|
104
141
|
});
|
|
@@ -106,11 +143,26 @@ const marshalCreateVolumeRequest = (request, defaults) => ({
|
|
|
106
143
|
name: request.name,
|
|
107
144
|
project_id: request.projectId ?? defaults.defaultProjectId
|
|
108
145
|
});
|
|
146
|
+
const marshalIpnsApiCreateNameRequest = (request, defaults) => ({
|
|
147
|
+
name: request.name,
|
|
148
|
+
project_id: request.projectId ?? defaults.defaultProjectId,
|
|
149
|
+
value: request.value
|
|
150
|
+
});
|
|
151
|
+
const marshalIpnsApiImportKeyNameRequest = (request, defaults) => ({
|
|
152
|
+
name: request.name,
|
|
153
|
+
private_key: request.privateKey,
|
|
154
|
+
project_id: request.projectId ?? defaults.defaultProjectId,
|
|
155
|
+
value: request.value
|
|
156
|
+
});
|
|
157
|
+
const marshalIpnsApiUpdateNameRequest = (request, defaults) => ({
|
|
158
|
+
name: request.name,
|
|
159
|
+
tags: request.tags,
|
|
160
|
+
value: request.value
|
|
161
|
+
});
|
|
109
162
|
const marshalReplacePinRequest = (request, defaults) => ({
|
|
110
163
|
cid: request.cid,
|
|
111
164
|
name: request.name,
|
|
112
165
|
origins: request.origins,
|
|
113
|
-
pin_options: request.pinOptions,
|
|
114
166
|
volume_id: request.volumeId
|
|
115
167
|
});
|
|
116
168
|
const marshalUpdateVolumeRequest = (request, defaults) => ({
|
|
@@ -118,4 +170,4 @@ const marshalUpdateVolumeRequest = (request, defaults) => ({
|
|
|
118
170
|
tags: request.tags
|
|
119
171
|
});
|
|
120
172
|
|
|
121
|
-
export { marshalCreatePinByCIDRequest, marshalCreatePinByURLRequest, marshalCreateVolumeRequest, marshalReplacePinRequest, marshalUpdateVolumeRequest, unmarshalListPinsResponse, unmarshalListVolumesResponse, unmarshalPin, unmarshalReplacePinResponse, unmarshalVolume };
|
|
173
|
+
export { marshalCreatePinByCIDRequest, marshalCreatePinByURLRequest, marshalCreateVolumeRequest, marshalIpnsApiCreateNameRequest, marshalIpnsApiImportKeyNameRequest, marshalIpnsApiUpdateNameRequest, marshalReplacePinRequest, marshalUpdateVolumeRequest, unmarshalExportKeyNameResponse, unmarshalListNamesResponse, unmarshalListPinsResponse, unmarshalListVolumesResponse, unmarshalName, unmarshalPin, unmarshalReplacePinResponse, unmarshalVolume };
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { API as API$1 } from '../../../scw/api.js';
|
|
2
|
+
import { unmarshalServiceInfo } from '../../../scw/custom-marshalling.js';
|
|
3
|
+
import { enrichForPagination } from '../../../scw/fetch/resource-paginator.js';
|
|
4
|
+
import { validatePathParam, urlParams } from '../../../helpers/marshalling.js';
|
|
5
|
+
import { marshalCreateJobDefinitionRequest, unmarshalJobDefinition, unmarshalListJobDefinitionsResponse, marshalUpdateJobDefinitionRequest, unmarshalJobRun, unmarshalListJobRunsResponse } from './marshalling.gen.js';
|
|
6
|
+
|
|
7
|
+
// This file was automatically generated. DO NOT EDIT.
|
|
8
|
+
// If you have any remark or suggestion do not hesitate to open an issue.
|
|
9
|
+
const jsonContentHeaders = {
|
|
10
|
+
'Content-Type': 'application/json; charset=utf-8'
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
/** Serverless Jobs API. */
|
|
14
|
+
class API extends API$1 {
|
|
15
|
+
/** Lists the available regions of the API. */
|
|
16
|
+
static LOCALITIES = ['fr-par', 'nl-ams', 'pl-waw'];
|
|
17
|
+
getServiceInfo = (() => {
|
|
18
|
+
var _this = this;
|
|
19
|
+
return function (request) {
|
|
20
|
+
if (request === void 0) {
|
|
21
|
+
request = {};
|
|
22
|
+
}
|
|
23
|
+
return _this.client.fetch({
|
|
24
|
+
method: 'GET',
|
|
25
|
+
path: `/serverless-jobs/v1alpha1/regions/${validatePathParam('region', request.region ?? _this.client.settings.defaultRegion)}`
|
|
26
|
+
}, unmarshalServiceInfo);
|
|
27
|
+
};
|
|
28
|
+
})();
|
|
29
|
+
createJobDefinition = request => this.client.fetch({
|
|
30
|
+
body: JSON.stringify(marshalCreateJobDefinitionRequest(request, this.client.settings)),
|
|
31
|
+
headers: jsonContentHeaders,
|
|
32
|
+
method: 'POST',
|
|
33
|
+
path: `/serverless-jobs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/job-definitions`
|
|
34
|
+
}, unmarshalJobDefinition);
|
|
35
|
+
getJobDefinition = request => this.client.fetch({
|
|
36
|
+
method: 'GET',
|
|
37
|
+
path: `/serverless-jobs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/job-definitions/${validatePathParam('jobDefinitionId', request.jobDefinitionId)}`
|
|
38
|
+
}, unmarshalJobDefinition);
|
|
39
|
+
pageOfListJobDefinitions = (() => {
|
|
40
|
+
var _this2 = this;
|
|
41
|
+
return function (request) {
|
|
42
|
+
if (request === void 0) {
|
|
43
|
+
request = {};
|
|
44
|
+
}
|
|
45
|
+
return _this2.client.fetch({
|
|
46
|
+
method: 'GET',
|
|
47
|
+
path: `/serverless-jobs/v1alpha1/regions/${validatePathParam('region', request.region ?? _this2.client.settings.defaultRegion)}/job-definitions`,
|
|
48
|
+
urlParams: urlParams(['order_by', request.orderBy], ['page', request.page], ['page_size', request.pageSize ?? _this2.client.settings.defaultPageSize], ['project_id', request.projectId])
|
|
49
|
+
}, unmarshalListJobDefinitionsResponse);
|
|
50
|
+
};
|
|
51
|
+
})();
|
|
52
|
+
listJobDefinitions = (() => {
|
|
53
|
+
var _this3 = this;
|
|
54
|
+
return function (request) {
|
|
55
|
+
if (request === void 0) {
|
|
56
|
+
request = {};
|
|
57
|
+
}
|
|
58
|
+
return enrichForPagination('jobDefinitions', _this3.pageOfListJobDefinitions, request);
|
|
59
|
+
};
|
|
60
|
+
})();
|
|
61
|
+
updateJobDefinition = request => this.client.fetch({
|
|
62
|
+
body: JSON.stringify(marshalUpdateJobDefinitionRequest(request, this.client.settings)),
|
|
63
|
+
headers: jsonContentHeaders,
|
|
64
|
+
method: 'PATCH',
|
|
65
|
+
path: `/serverless-jobs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/job-definitions/${validatePathParam('jobDefinitionId', request.jobDefinitionId)}`
|
|
66
|
+
}, unmarshalJobDefinition);
|
|
67
|
+
deleteJobDefinition = request => this.client.fetch({
|
|
68
|
+
method: 'DELETE',
|
|
69
|
+
path: `/serverless-jobs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/job-definitions/${validatePathParam('jobDefinitionId', request.jobDefinitionId)}`
|
|
70
|
+
});
|
|
71
|
+
startJobDefinition = request => this.client.fetch({
|
|
72
|
+
body: '{}',
|
|
73
|
+
headers: jsonContentHeaders,
|
|
74
|
+
method: 'POST',
|
|
75
|
+
path: `/serverless-jobs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/job-definitions/${validatePathParam('jobDefinitionId', request.jobDefinitionId)}/start`
|
|
76
|
+
}, unmarshalJobRun);
|
|
77
|
+
getJobRun = request => this.client.fetch({
|
|
78
|
+
method: 'GET',
|
|
79
|
+
path: `/serverless-jobs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/job-runs/${validatePathParam('jobRunId', request.jobRunId)}`
|
|
80
|
+
}, unmarshalJobRun);
|
|
81
|
+
stopJobRun = request => this.client.fetch({
|
|
82
|
+
body: '{}',
|
|
83
|
+
headers: jsonContentHeaders,
|
|
84
|
+
method: 'POST',
|
|
85
|
+
path: `/serverless-jobs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/job-runs/${validatePathParam('jobRunId', request.jobRunId)}/stop`
|
|
86
|
+
}, unmarshalJobRun);
|
|
87
|
+
pageOfListJobRuns = (() => {
|
|
88
|
+
var _this4 = this;
|
|
89
|
+
return function (request) {
|
|
90
|
+
if (request === void 0) {
|
|
91
|
+
request = {};
|
|
92
|
+
}
|
|
93
|
+
return _this4.client.fetch({
|
|
94
|
+
method: 'GET',
|
|
95
|
+
path: `/serverless-jobs/v1alpha1/regions/${validatePathParam('region', request.region ?? _this4.client.settings.defaultRegion)}/job-runs`,
|
|
96
|
+
urlParams: urlParams(['job_definition_id', request.jobDefinitionId], ['order_by', request.orderBy], ['page', request.page], ['page_size', request.pageSize ?? _this4.client.settings.defaultPageSize], ['project_id', request.projectId])
|
|
97
|
+
}, unmarshalListJobRunsResponse);
|
|
98
|
+
};
|
|
99
|
+
})();
|
|
100
|
+
listJobRuns = (() => {
|
|
101
|
+
var _this5 = this;
|
|
102
|
+
return function (request) {
|
|
103
|
+
if (request === void 0) {
|
|
104
|
+
request = {};
|
|
105
|
+
}
|
|
106
|
+
return enrichForPagination('jobRuns', _this5.pageOfListJobRuns, request);
|
|
107
|
+
};
|
|
108
|
+
})();
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export { API };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// This file was automatically generated. DO NOT EDIT.
|
|
2
|
+
// If you have any remark or suggestion do not hesitate to open an issue.
|
|
3
|
+
|
|
4
|
+
/** Lists transient statutes of the enum {@link JobRunState}. */
|
|
5
|
+
const JOB_RUN_TRANSIENT_STATUSES = ['queued', 'scheduled', 'running'];
|
|
6
|
+
|
|
7
|
+
export { JOB_RUN_TRANSIENT_STATUSES };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { API } from './api.gen.js';
|
|
2
|
+
export { JOB_RUN_TRANSIENT_STATUSES } from './content.gen.js';
|
|
3
|
+
import * as validationRules_gen from './validation-rules.gen.js';
|
|
4
|
+
export { validationRules_gen as ValidationRules };
|
|
5
|
+
|
|
6
|
+
// This file was automatically generated. DO NOT EDIT.
|
|
7
|
+
// If you have any remark or suggestion do not hesitate to open an issue.
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import randomName from '../../../node_modules/.pnpm/@scaleway_random-name@4.0.2/node_modules/@scaleway/random-name/dist/index.js';
|
|
2
|
+
import { isJSONObject } from '../../../helpers/json.js';
|
|
3
|
+
import { unmarshalDate, unmarshalArrayOfObject } from '../../../helpers/marshalling.js';
|
|
4
|
+
|
|
5
|
+
// This file was automatically generated. DO NOT EDIT.
|
|
6
|
+
// If you have any remark or suggestion do not hesitate to open an issue.
|
|
7
|
+
const unmarshalJobDefinition = data => {
|
|
8
|
+
if (!isJSONObject(data)) {
|
|
9
|
+
throw new TypeError(`Unmarshalling the type 'JobDefinition' failed as data isn't a dictionary.`);
|
|
10
|
+
}
|
|
11
|
+
return {
|
|
12
|
+
command: data.command,
|
|
13
|
+
cpuLimit: data.cpu_limit,
|
|
14
|
+
createdAt: unmarshalDate(data.created_at),
|
|
15
|
+
description: data.description,
|
|
16
|
+
environmentVariables: data.environment_variables,
|
|
17
|
+
imageUri: data.image_uri,
|
|
18
|
+
jobDefinitionId: data.job_definition_id,
|
|
19
|
+
jobTimeout: data.job_timeout,
|
|
20
|
+
memoryLimit: data.memory_limit,
|
|
21
|
+
name: data.name,
|
|
22
|
+
projectId: data.project_id,
|
|
23
|
+
region: data.region,
|
|
24
|
+
updatedAt: unmarshalDate(data.updated_at)
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
const unmarshalJobRun = data => {
|
|
28
|
+
if (!isJSONObject(data)) {
|
|
29
|
+
throw new TypeError(`Unmarshalling the type 'JobRun' failed as data isn't a dictionary.`);
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
createdAt: unmarshalDate(data.created_at),
|
|
33
|
+
errorMessage: data.error_message,
|
|
34
|
+
exitCode: data.exit_code,
|
|
35
|
+
jobDefinitionId: data.job_definition_id,
|
|
36
|
+
jobRunId: data.job_run_id,
|
|
37
|
+
region: data.region,
|
|
38
|
+
runDuration: data.run_duration,
|
|
39
|
+
state: data.state,
|
|
40
|
+
terminatedAt: unmarshalDate(data.terminated_at),
|
|
41
|
+
updatedAt: unmarshalDate(data.updated_at)
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
const unmarshalListJobDefinitionsResponse = data => {
|
|
45
|
+
if (!isJSONObject(data)) {
|
|
46
|
+
throw new TypeError(`Unmarshalling the type 'ListJobDefinitionsResponse' failed as data isn't a dictionary.`);
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
jobDefinitions: unmarshalArrayOfObject(data.job_definitions, unmarshalJobDefinition),
|
|
50
|
+
totalCount: data.total_count
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
const unmarshalListJobRunsResponse = data => {
|
|
54
|
+
if (!isJSONObject(data)) {
|
|
55
|
+
throw new TypeError(`Unmarshalling the type 'ListJobRunsResponse' failed as data isn't a dictionary.`);
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
58
|
+
jobRuns: unmarshalArrayOfObject(data.job_runs, unmarshalJobRun),
|
|
59
|
+
totalCount: data.total_count
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
const marshalCreateJobDefinitionRequest = (request, defaults) => ({
|
|
63
|
+
command: request.command,
|
|
64
|
+
cpu_limit: request.cpuLimit,
|
|
65
|
+
description: request.description,
|
|
66
|
+
environment_variables: request.environmentVariables !== undefined ? request.environmentVariables : undefined,
|
|
67
|
+
image_uri: request.imageUri,
|
|
68
|
+
job_timeout: request.jobTimeout,
|
|
69
|
+
memory_limit: request.memoryLimit,
|
|
70
|
+
name: request.name || randomName('job'),
|
|
71
|
+
project_id: request.projectId ?? defaults.defaultProjectId
|
|
72
|
+
});
|
|
73
|
+
const marshalUpdateJobDefinitionRequest = (request, defaults) => ({
|
|
74
|
+
command: request.command,
|
|
75
|
+
cpu_limit: request.cpuLimit,
|
|
76
|
+
description: request.description,
|
|
77
|
+
environment_variables: request.environmentVariables,
|
|
78
|
+
image_uri: request.imageUri,
|
|
79
|
+
job_timeout: request.jobTimeout,
|
|
80
|
+
memory_limit: request.memoryLimit,
|
|
81
|
+
name: request.name
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
export { marshalCreateJobDefinitionRequest, marshalUpdateJobDefinitionRequest, unmarshalJobDefinition, unmarshalJobRun, unmarshalListJobDefinitionsResponse, unmarshalListJobRunsResponse };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// This file was automatically generated. DO NOT EDIT.
|
|
2
|
+
// If you have any remark or suggestion do not hesitate to open an issue.
|
|
3
|
+
|
|
4
|
+
const CreateJobDefinitionRequest = {
|
|
5
|
+
cpuLimit: {
|
|
6
|
+
greaterThan: 0
|
|
7
|
+
},
|
|
8
|
+
memoryLimit: {
|
|
9
|
+
greaterThan: 0
|
|
10
|
+
},
|
|
11
|
+
name: {
|
|
12
|
+
minLength: 3
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
const ListJobDefinitionsRequest = {
|
|
16
|
+
page: {
|
|
17
|
+
greaterThanOrEqual: 1
|
|
18
|
+
},
|
|
19
|
+
pageSize: {
|
|
20
|
+
greaterThanOrEqual: 1,
|
|
21
|
+
lessThanOrEqual: 1000
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
const ListJobRunsRequest = {
|
|
25
|
+
page: {
|
|
26
|
+
greaterThanOrEqual: 1
|
|
27
|
+
},
|
|
28
|
+
pageSize: {
|
|
29
|
+
greaterThanOrEqual: 1,
|
|
30
|
+
lessThanOrEqual: 1000
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
const UpdateJobDefinitionRequest = {
|
|
34
|
+
cpuLimit: {
|
|
35
|
+
greaterThan: 0
|
|
36
|
+
},
|
|
37
|
+
memoryLimit: {
|
|
38
|
+
greaterThan: 0
|
|
39
|
+
},
|
|
40
|
+
name: {
|
|
41
|
+
minLength: 3
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export { CreateJobDefinitionRequest, ListJobDefinitionsRequest, ListJobRunsRequest, UpdateJobDefinitionRequest };
|