@scaleway/sdk 2.0.0-alpha.9 → 2.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/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 +6783 -2543
- package/dist/index.js +34 -28
- package/dist/scw/constants.js +1 -1
- package/package.json +2 -2
|
@@ -58,20 +58,12 @@ class API extends API$1 {
|
|
|
58
58
|
* @param request - The request {@link CreateHubRequest}
|
|
59
59
|
* @returns A Promise of Hub
|
|
60
60
|
*/
|
|
61
|
-
createHub =
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
return _this3.client.fetch({
|
|
68
|
-
body: JSON.stringify(marshalCreateHubRequest(request, _this3.client.settings)),
|
|
69
|
-
headers: jsonContentHeaders,
|
|
70
|
-
method: 'POST',
|
|
71
|
-
path: `/iot/v1/regions/${validatePathParam('region', request.region ?? _this3.client.settings.defaultRegion)}/hubs`
|
|
72
|
-
}, unmarshalHub);
|
|
73
|
-
};
|
|
74
|
-
})();
|
|
61
|
+
createHub = request => this.client.fetch({
|
|
62
|
+
body: JSON.stringify(marshalCreateHubRequest(request, this.client.settings)),
|
|
63
|
+
headers: jsonContentHeaders,
|
|
64
|
+
method: 'POST',
|
|
65
|
+
path: `/iot/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/hubs`
|
|
66
|
+
}, unmarshalHub);
|
|
75
67
|
|
|
76
68
|
/**
|
|
77
69
|
* Get a hub. Retrieve information about an existing IoT Hub, specified by its
|
|
@@ -187,15 +179,15 @@ class API extends API$1 {
|
|
|
187
179
|
path: `/iot/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/hubs/${validatePathParam('hubId', request.hubId)}/ca`
|
|
188
180
|
}, unmarshalGetHubCAResponse);
|
|
189
181
|
pageOfListDevices = (() => {
|
|
190
|
-
var
|
|
182
|
+
var _this3 = this;
|
|
191
183
|
return function (request) {
|
|
192
184
|
if (request === void 0) {
|
|
193
185
|
request = {};
|
|
194
186
|
}
|
|
195
|
-
return
|
|
187
|
+
return _this3.client.fetch({
|
|
196
188
|
method: 'GET',
|
|
197
|
-
path: `/iot/v1/regions/${validatePathParam('region', request.region ??
|
|
198
|
-
urlParams: urlParams(['allow_insecure', request.allowInsecure], ['hub_id', request.hubId], ['name', request.name], ['order_by', request.orderBy], ['page', request.page], ['page_size', request.pageSize ??
|
|
189
|
+
path: `/iot/v1/regions/${validatePathParam('region', request.region ?? _this3.client.settings.defaultRegion)}/devices`,
|
|
190
|
+
urlParams: urlParams(['allow_insecure', request.allowInsecure], ['hub_id', request.hubId], ['name', request.name], ['order_by', request.orderBy], ['page', request.page], ['page_size', request.pageSize ?? _this3.client.settings.defaultPageSize], ['status', request.status])
|
|
199
191
|
}, unmarshalListDevicesResponse);
|
|
200
192
|
};
|
|
201
193
|
})();
|
|
@@ -209,12 +201,12 @@ class API extends API$1 {
|
|
|
209
201
|
* @returns A Promise of ListDevicesResponse
|
|
210
202
|
*/
|
|
211
203
|
listDevices = (() => {
|
|
212
|
-
var
|
|
204
|
+
var _this4 = this;
|
|
213
205
|
return function (request) {
|
|
214
206
|
if (request === void 0) {
|
|
215
207
|
request = {};
|
|
216
208
|
}
|
|
217
|
-
return enrichForPagination('devices',
|
|
209
|
+
return enrichForPagination('devices', _this4.pageOfListDevices, request);
|
|
218
210
|
};
|
|
219
211
|
})();
|
|
220
212
|
|
|
@@ -350,15 +342,15 @@ class API extends API$1 {
|
|
|
350
342
|
urlParams: urlParams(['start_date', request.startDate])
|
|
351
343
|
}, unmarshalGetDeviceMetricsResponse);
|
|
352
344
|
pageOfListRoutes = (() => {
|
|
353
|
-
var
|
|
345
|
+
var _this5 = this;
|
|
354
346
|
return function (request) {
|
|
355
347
|
if (request === void 0) {
|
|
356
348
|
request = {};
|
|
357
349
|
}
|
|
358
|
-
return
|
|
350
|
+
return _this5.client.fetch({
|
|
359
351
|
method: 'GET',
|
|
360
|
-
path: `/iot/v1/regions/${validatePathParam('region', request.region ??
|
|
361
|
-
urlParams: urlParams(['hub_id', request.hubId], ['name', request.name], ['order_by', request.orderBy], ['page', request.page], ['page_size', request.pageSize ??
|
|
352
|
+
path: `/iot/v1/regions/${validatePathParam('region', request.region ?? _this5.client.settings.defaultRegion)}/routes`,
|
|
353
|
+
urlParams: urlParams(['hub_id', request.hubId], ['name', request.name], ['order_by', request.orderBy], ['page', request.page], ['page_size', request.pageSize ?? _this5.client.settings.defaultPageSize])
|
|
362
354
|
}, unmarshalListRoutesResponse);
|
|
363
355
|
};
|
|
364
356
|
})();
|
|
@@ -372,12 +364,12 @@ class API extends API$1 {
|
|
|
372
364
|
* @returns A Promise of ListRoutesResponse
|
|
373
365
|
*/
|
|
374
366
|
listRoutes = (() => {
|
|
375
|
-
var
|
|
367
|
+
var _this6 = this;
|
|
376
368
|
return function (request) {
|
|
377
369
|
if (request === void 0) {
|
|
378
370
|
request = {};
|
|
379
371
|
}
|
|
380
|
-
return enrichForPagination('routes',
|
|
372
|
+
return enrichForPagination('routes', _this6.pageOfListRoutes, request);
|
|
381
373
|
};
|
|
382
374
|
})();
|
|
383
375
|
|
|
@@ -441,15 +433,15 @@ class API extends API$1 {
|
|
|
441
433
|
path: `/iot/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/routes/${validatePathParam('routeId', request.routeId)}`
|
|
442
434
|
});
|
|
443
435
|
pageOfListNetworks = (() => {
|
|
444
|
-
var
|
|
436
|
+
var _this7 = this;
|
|
445
437
|
return function (request) {
|
|
446
438
|
if (request === void 0) {
|
|
447
439
|
request = {};
|
|
448
440
|
}
|
|
449
|
-
return
|
|
441
|
+
return _this7.client.fetch({
|
|
450
442
|
method: 'GET',
|
|
451
|
-
path: `/iot/v1/regions/${validatePathParam('region', request.region ??
|
|
452
|
-
urlParams: urlParams(['hub_id', request.hubId], ['name', request.name], ['order_by', request.orderBy], ['page', request.page], ['page_size', request.pageSize ??
|
|
443
|
+
path: `/iot/v1/regions/${validatePathParam('region', request.region ?? _this7.client.settings.defaultRegion)}/networks`,
|
|
444
|
+
urlParams: urlParams(['hub_id', request.hubId], ['name', request.name], ['order_by', request.orderBy], ['page', request.page], ['page_size', request.pageSize ?? _this7.client.settings.defaultPageSize], ['topic_prefix', request.topicPrefix])
|
|
453
445
|
}, unmarshalListNetworksResponse);
|
|
454
446
|
};
|
|
455
447
|
})();
|
|
@@ -461,12 +453,12 @@ class API extends API$1 {
|
|
|
461
453
|
* @returns A Promise of ListNetworksResponse
|
|
462
454
|
*/
|
|
463
455
|
listNetworks = (() => {
|
|
464
|
-
var
|
|
456
|
+
var _this8 = this;
|
|
465
457
|
return function (request) {
|
|
466
458
|
if (request === void 0) {
|
|
467
459
|
request = {};
|
|
468
460
|
}
|
|
469
|
-
return enrichForPagination('networks',
|
|
461
|
+
return enrichForPagination('networks', _this8.pageOfListNetworks, request);
|
|
470
462
|
};
|
|
471
463
|
})();
|
|
472
464
|
|
|
@@ -11,7 +11,7 @@ const unmarshalDeviceMessageFiltersRule = data => {
|
|
|
11
11
|
}
|
|
12
12
|
return {
|
|
13
13
|
policy: data.policy,
|
|
14
|
-
topics: data.topics
|
|
14
|
+
topics: data.topics
|
|
15
15
|
};
|
|
16
16
|
};
|
|
17
17
|
const unmarshalDeviceMessageFilters = data => {
|
|
@@ -19,8 +19,8 @@ const unmarshalDeviceMessageFilters = data => {
|
|
|
19
19
|
throw new TypeError(`Unmarshalling the type 'DeviceMessageFilters' failed as data isn't a dictionary.`);
|
|
20
20
|
}
|
|
21
21
|
return {
|
|
22
|
-
publish: unmarshalDeviceMessageFiltersRule(data.publish),
|
|
23
|
-
subscribe: unmarshalDeviceMessageFiltersRule(data.subscribe)
|
|
22
|
+
publish: data.publish ? unmarshalDeviceMessageFiltersRule(data.publish) : undefined,
|
|
23
|
+
subscribe: data.subscribe ? unmarshalDeviceMessageFiltersRule(data.subscribe) : undefined
|
|
24
24
|
};
|
|
25
25
|
};
|
|
26
26
|
const unmarshalDevice = data => {
|
|
@@ -37,7 +37,7 @@ const unmarshalDevice = data => {
|
|
|
37
37
|
id: data.id,
|
|
38
38
|
isConnected: data.is_connected,
|
|
39
39
|
lastActivityAt: unmarshalDate(data.last_activity_at),
|
|
40
|
-
messageFilters: unmarshalDeviceMessageFilters(data.message_filters),
|
|
40
|
+
messageFilters: data.message_filters ? unmarshalDeviceMessageFilters(data.message_filters) : undefined,
|
|
41
41
|
name: data.name,
|
|
42
42
|
status: data.status,
|
|
43
43
|
updatedAt: unmarshalDate(data.updated_at)
|
|
@@ -104,8 +104,8 @@ const unmarshalCreateDeviceResponse = data => {
|
|
|
104
104
|
throw new TypeError(`Unmarshalling the type 'CreateDeviceResponse' failed as data isn't a dictionary.`);
|
|
105
105
|
}
|
|
106
106
|
return {
|
|
107
|
-
certificate: unmarshalCertificate(data.certificate),
|
|
108
|
-
device: unmarshalDevice(data.device)
|
|
107
|
+
certificate: data.certificate ? unmarshalCertificate(data.certificate) : undefined,
|
|
108
|
+
device: data.device ? unmarshalDevice(data.device) : undefined
|
|
109
109
|
};
|
|
110
110
|
};
|
|
111
111
|
const unmarshalCreateNetworkResponse = data => {
|
|
@@ -113,7 +113,7 @@ const unmarshalCreateNetworkResponse = data => {
|
|
|
113
113
|
throw new TypeError(`Unmarshalling the type 'CreateNetworkResponse' failed as data isn't a dictionary.`);
|
|
114
114
|
}
|
|
115
115
|
return {
|
|
116
|
-
network: unmarshalNetwork(data.network),
|
|
116
|
+
network: data.network ? unmarshalNetwork(data.network) : undefined,
|
|
117
117
|
secret: data.secret
|
|
118
118
|
};
|
|
119
119
|
};
|
|
@@ -123,7 +123,7 @@ const unmarshalGetDeviceCertificateResponse = data => {
|
|
|
123
123
|
}
|
|
124
124
|
return {
|
|
125
125
|
certificatePem: data.certificate_pem,
|
|
126
|
-
device: unmarshalDevice(data.device)
|
|
126
|
+
device: data.device ? unmarshalDevice(data.device) : undefined
|
|
127
127
|
};
|
|
128
128
|
};
|
|
129
129
|
const unmarshalGetDeviceMetricsResponse = data => {
|
|
@@ -221,18 +221,8 @@ const unmarshalRenewDeviceCertificateResponse = data => {
|
|
|
221
221
|
throw new TypeError(`Unmarshalling the type 'RenewDeviceCertificateResponse' failed as data isn't a dictionary.`);
|
|
222
222
|
}
|
|
223
223
|
return {
|
|
224
|
-
certificate: unmarshalCertificate(data.certificate),
|
|
225
|
-
device: unmarshalDevice(data.device)
|
|
226
|
-
};
|
|
227
|
-
};
|
|
228
|
-
const unmarshalRouteRestConfig = data => {
|
|
229
|
-
if (!isJSONObject(data)) {
|
|
230
|
-
throw new TypeError(`Unmarshalling the type 'RouteRestConfig' failed as data isn't a dictionary.`);
|
|
231
|
-
}
|
|
232
|
-
return {
|
|
233
|
-
headers: data.headers,
|
|
234
|
-
uri: data.uri,
|
|
235
|
-
verb: data.verb
|
|
224
|
+
certificate: data.certificate ? unmarshalCertificate(data.certificate) : undefined,
|
|
225
|
+
device: data.device ? unmarshalDevice(data.device) : undefined
|
|
236
226
|
};
|
|
237
227
|
};
|
|
238
228
|
const unmarshalRouteDatabaseConfig = data => {
|
|
@@ -249,6 +239,16 @@ const unmarshalRouteDatabaseConfig = data => {
|
|
|
249
239
|
username: data.username
|
|
250
240
|
};
|
|
251
241
|
};
|
|
242
|
+
const unmarshalRouteRestConfig = data => {
|
|
243
|
+
if (!isJSONObject(data)) {
|
|
244
|
+
throw new TypeError(`Unmarshalling the type 'RouteRestConfig' failed as data isn't a dictionary.`);
|
|
245
|
+
}
|
|
246
|
+
return {
|
|
247
|
+
headers: data.headers,
|
|
248
|
+
uri: data.uri,
|
|
249
|
+
verb: data.verb
|
|
250
|
+
};
|
|
251
|
+
};
|
|
252
252
|
const unmarshalRouteS3Config = data => {
|
|
253
253
|
if (!isJSONObject(data)) {
|
|
254
254
|
throw new TypeError(`Unmarshalling the type 'RouteS3Config' failed as data isn't a dictionary.`);
|
|
@@ -283,7 +283,7 @@ const unmarshalSetDeviceCertificateResponse = data => {
|
|
|
283
283
|
}
|
|
284
284
|
return {
|
|
285
285
|
certificatePem: data.certificate_pem,
|
|
286
|
-
device: unmarshalDevice(data.device)
|
|
286
|
+
device: data.device ? unmarshalDevice(data.device) : undefined
|
|
287
287
|
};
|
|
288
288
|
};
|
|
289
289
|
const unmarshalTwinDocument = data => {
|
|
@@ -291,20 +291,31 @@ const unmarshalTwinDocument = data => {
|
|
|
291
291
|
throw new TypeError(`Unmarshalling the type 'TwinDocument' failed as data isn't a dictionary.`);
|
|
292
292
|
}
|
|
293
293
|
return {
|
|
294
|
-
data: data.data
|
|
294
|
+
data: data.data,
|
|
295
295
|
documentName: data.document_name,
|
|
296
296
|
twinId: data.twin_id,
|
|
297
297
|
version: data.version
|
|
298
298
|
};
|
|
299
299
|
};
|
|
300
|
+
const marshalDeviceMessageFiltersRule = (request, defaults) => ({
|
|
301
|
+
policy: request.policy,
|
|
302
|
+
topics: request.topics
|
|
303
|
+
});
|
|
304
|
+
const marshalDeviceMessageFilters = (request, defaults) => ({
|
|
305
|
+
publish: request.publish !== undefined ? marshalDeviceMessageFiltersRule(request.publish) : undefined,
|
|
306
|
+
subscribe: request.subscribe !== undefined ? marshalDeviceMessageFiltersRule(request.subscribe) : undefined
|
|
307
|
+
});
|
|
300
308
|
const marshalCreateDeviceRequest = (request, defaults) => ({
|
|
301
309
|
allow_insecure: request.allowInsecure,
|
|
302
310
|
allow_multiple_connections: request.allowMultipleConnections,
|
|
303
311
|
description: request.description,
|
|
304
312
|
hub_id: request.hubId,
|
|
305
|
-
message_filters: request.messageFilters,
|
|
313
|
+
message_filters: request.messageFilters !== undefined ? marshalDeviceMessageFilters(request.messageFilters) : undefined,
|
|
306
314
|
name: request.name || randomName('device')
|
|
307
315
|
});
|
|
316
|
+
const marshalHubTwinsGraphiteConfig = (request, defaults) => ({
|
|
317
|
+
push_uri: request.pushUri
|
|
318
|
+
});
|
|
308
319
|
const marshalCreateHubRequest = (request, defaults) => ({
|
|
309
320
|
disable_events: request.disableEvents,
|
|
310
321
|
events_topic_prefix: request.eventsTopicPrefix,
|
|
@@ -313,7 +324,7 @@ const marshalCreateHubRequest = (request, defaults) => ({
|
|
|
313
324
|
project_id: request.projectId ?? defaults.defaultProjectId,
|
|
314
325
|
...resolveOneOf([{
|
|
315
326
|
param: 'twins_graphite_config',
|
|
316
|
-
value: request.twinsGraphiteConfig
|
|
327
|
+
value: request.twinsGraphiteConfig !== undefined ? marshalHubTwinsGraphiteConfig(request.twinsGraphiteConfig) : undefined
|
|
317
328
|
}])
|
|
318
329
|
});
|
|
319
330
|
const marshalCreateNetworkRequest = (request, defaults) => ({
|
|
@@ -322,19 +333,39 @@ const marshalCreateNetworkRequest = (request, defaults) => ({
|
|
|
322
333
|
topic_prefix: request.topicPrefix,
|
|
323
334
|
type: request.type
|
|
324
335
|
});
|
|
336
|
+
const marshalCreateRouteRequestDatabaseConfig = (request, defaults) => ({
|
|
337
|
+
dbname: request.dbname,
|
|
338
|
+
engine: request.engine,
|
|
339
|
+
host: request.host,
|
|
340
|
+
password: request.password,
|
|
341
|
+
port: request.port,
|
|
342
|
+
query: request.query,
|
|
343
|
+
username: request.username
|
|
344
|
+
});
|
|
345
|
+
const marshalCreateRouteRequestRestConfig = (request, defaults) => ({
|
|
346
|
+
headers: request.headers,
|
|
347
|
+
uri: request.uri,
|
|
348
|
+
verb: request.verb
|
|
349
|
+
});
|
|
350
|
+
const marshalCreateRouteRequestS3Config = (request, defaults) => ({
|
|
351
|
+
bucket_name: request.bucketName,
|
|
352
|
+
bucket_region: request.bucketRegion,
|
|
353
|
+
object_prefix: request.objectPrefix,
|
|
354
|
+
strategy: request.strategy
|
|
355
|
+
});
|
|
325
356
|
const marshalCreateRouteRequest = (request, defaults) => ({
|
|
326
357
|
hub_id: request.hubId,
|
|
327
358
|
name: request.name || randomName('route'),
|
|
328
359
|
topic: request.topic,
|
|
329
360
|
...resolveOneOf([{
|
|
361
|
+
param: 's3_config',
|
|
362
|
+
value: request.s3Config !== undefined ? marshalCreateRouteRequestS3Config(request.s3Config) : undefined
|
|
363
|
+
}, {
|
|
330
364
|
param: 'db_config',
|
|
331
|
-
value: request.dbConfig
|
|
365
|
+
value: request.dbConfig !== undefined ? marshalCreateRouteRequestDatabaseConfig(request.dbConfig) : undefined
|
|
332
366
|
}, {
|
|
333
367
|
param: 'rest_config',
|
|
334
|
-
value: request.restConfig
|
|
335
|
-
}, {
|
|
336
|
-
param: 's3_config',
|
|
337
|
-
value: request.s3Config
|
|
368
|
+
value: request.restConfig !== undefined ? marshalCreateRouteRequestRestConfig(request.restConfig) : undefined
|
|
338
369
|
}])
|
|
339
370
|
});
|
|
340
371
|
const marshalPatchTwinDocumentRequest = (request, defaults) => ({
|
|
@@ -357,7 +388,7 @@ const marshalUpdateDeviceRequest = (request, defaults) => ({
|
|
|
357
388
|
allow_multiple_connections: request.allowMultipleConnections,
|
|
358
389
|
description: request.description,
|
|
359
390
|
hub_id: request.hubId,
|
|
360
|
-
message_filters: request.messageFilters
|
|
391
|
+
message_filters: request.messageFilters !== undefined ? marshalDeviceMessageFilters(request.messageFilters) : undefined
|
|
361
392
|
});
|
|
362
393
|
const marshalUpdateHubRequest = (request, defaults) => ({
|
|
363
394
|
disable_events: request.disableEvents,
|
|
@@ -367,21 +398,41 @@ const marshalUpdateHubRequest = (request, defaults) => ({
|
|
|
367
398
|
product_plan: request.productPlan,
|
|
368
399
|
...resolveOneOf([{
|
|
369
400
|
param: 'twins_graphite_config',
|
|
370
|
-
value: request.twinsGraphiteConfig
|
|
401
|
+
value: request.twinsGraphiteConfig !== undefined ? marshalHubTwinsGraphiteConfig(request.twinsGraphiteConfig) : undefined
|
|
371
402
|
}])
|
|
372
403
|
});
|
|
404
|
+
const marshalUpdateRouteRequestDatabaseConfig = (request, defaults) => ({
|
|
405
|
+
dbname: request.dbname,
|
|
406
|
+
engine: request.engine,
|
|
407
|
+
host: request.host,
|
|
408
|
+
password: request.password,
|
|
409
|
+
port: request.port,
|
|
410
|
+
query: request.query,
|
|
411
|
+
username: request.username
|
|
412
|
+
});
|
|
413
|
+
const marshalUpdateRouteRequestRestConfig = (request, defaults) => ({
|
|
414
|
+
headers: request.headers,
|
|
415
|
+
uri: request.uri,
|
|
416
|
+
verb: request.verb
|
|
417
|
+
});
|
|
418
|
+
const marshalUpdateRouteRequestS3Config = (request, defaults) => ({
|
|
419
|
+
bucket_name: request.bucketName,
|
|
420
|
+
bucket_region: request.bucketRegion,
|
|
421
|
+
object_prefix: request.objectPrefix,
|
|
422
|
+
strategy: request.strategy
|
|
423
|
+
});
|
|
373
424
|
const marshalUpdateRouteRequest = (request, defaults) => ({
|
|
374
425
|
name: request.name,
|
|
375
426
|
topic: request.topic,
|
|
376
427
|
...resolveOneOf([{
|
|
428
|
+
param: 's3_config',
|
|
429
|
+
value: request.s3Config !== undefined ? marshalUpdateRouteRequestS3Config(request.s3Config) : undefined
|
|
430
|
+
}, {
|
|
377
431
|
param: 'db_config',
|
|
378
|
-
value: request.dbConfig
|
|
432
|
+
value: request.dbConfig !== undefined ? marshalUpdateRouteRequestDatabaseConfig(request.dbConfig) : undefined
|
|
379
433
|
}, {
|
|
380
434
|
param: 'rest_config',
|
|
381
|
-
value: request.restConfig
|
|
382
|
-
}, {
|
|
383
|
-
param: 's3_config',
|
|
384
|
-
value: request.s3Config
|
|
435
|
+
value: request.restConfig !== undefined ? marshalUpdateRouteRequestRestConfig(request.restConfig) : undefined
|
|
385
436
|
}])
|
|
386
437
|
});
|
|
387
438
|
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { API as API$1 } from '../../../scw/api.js';
|
|
2
|
+
import { validatePathParam, urlParams, resolveOneOf } from '../../../helpers/marshalling.js';
|
|
3
|
+
import { enrichForPagination } from '../../../scw/fetch/resource-paginator.js';
|
|
4
|
+
import { marshalBookIPRequest, unmarshalIP, marshalUpdateIPRequest, unmarshalListIPsResponse } from './marshalling.gen.js';
|
|
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.
|
|
8
|
+
const jsonContentHeaders = {
|
|
9
|
+
'Content-Type': 'application/json; charset=utf-8'
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* IPAM API.
|
|
14
|
+
*
|
|
15
|
+
* This API allows you to manage IP addresses with Scaleway's IP Address
|
|
16
|
+
* Management tool.
|
|
17
|
+
*/
|
|
18
|
+
class API extends API$1 {
|
|
19
|
+
/** Lists the available regions of the API. */
|
|
20
|
+
static LOCALITIES = ['fr-par', 'nl-ams', 'pl-waw'];
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Book a new IP. Book a new IP from the specified source. Currently IPs can
|
|
24
|
+
* only be booked from a Private Network.
|
|
25
|
+
*
|
|
26
|
+
* @param request - The request {@link BookIPRequest}
|
|
27
|
+
* @returns A Promise of IP
|
|
28
|
+
*/
|
|
29
|
+
bookIP = request => this.client.fetch({
|
|
30
|
+
body: JSON.stringify(marshalBookIPRequest(request, this.client.settings)),
|
|
31
|
+
headers: jsonContentHeaders,
|
|
32
|
+
method: 'POST',
|
|
33
|
+
path: `/ipam/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/ips`
|
|
34
|
+
}, unmarshalIP);
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Release an IP. Release an IP not currently attached to a resource, and
|
|
38
|
+
* returns it to the available IP pool.
|
|
39
|
+
*
|
|
40
|
+
* @param request - The request {@link ReleaseIPRequest}
|
|
41
|
+
*/
|
|
42
|
+
releaseIP = request => this.client.fetch({
|
|
43
|
+
body: '{}',
|
|
44
|
+
headers: jsonContentHeaders,
|
|
45
|
+
method: 'DELETE',
|
|
46
|
+
path: `/ipam/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/ips/${validatePathParam('ipId', request.ipId)}`
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Get an IP. Retrieve details of an existing IP, specified by its IP ID.
|
|
51
|
+
*
|
|
52
|
+
* @param request - The request {@link GetIPRequest}
|
|
53
|
+
* @returns A Promise of IP
|
|
54
|
+
*/
|
|
55
|
+
getIP = request => this.client.fetch({
|
|
56
|
+
method: 'GET',
|
|
57
|
+
path: `/ipam/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/ips/${validatePathParam('ipId', request.ipId)}`
|
|
58
|
+
}, unmarshalIP);
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Update an IP. Update parameters including tags of the specified IP.
|
|
62
|
+
*
|
|
63
|
+
* @param request - The request {@link UpdateIPRequest}
|
|
64
|
+
* @returns A Promise of IP
|
|
65
|
+
*/
|
|
66
|
+
updateIP = request => this.client.fetch({
|
|
67
|
+
body: JSON.stringify(marshalUpdateIPRequest(request, this.client.settings)),
|
|
68
|
+
headers: jsonContentHeaders,
|
|
69
|
+
method: 'PATCH',
|
|
70
|
+
path: `/ipam/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/ips/${validatePathParam('ipId', request.ipId)}`
|
|
71
|
+
}, unmarshalIP);
|
|
72
|
+
pageOfListIPs = (() => {
|
|
73
|
+
var _this = this;
|
|
74
|
+
return function (request) {
|
|
75
|
+
if (request === void 0) {
|
|
76
|
+
request = {};
|
|
77
|
+
}
|
|
78
|
+
return _this.client.fetch({
|
|
79
|
+
method: 'GET',
|
|
80
|
+
path: `/ipam/v1/regions/${validatePathParam('region', request.region ?? _this.client.settings.defaultRegion)}/ips`,
|
|
81
|
+
urlParams: urlParams(['attached', request.attached], ['is_ipv6', request.isIpv6], ['mac_address', request.macAddress], ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize], ['project_id', request.projectId], ['resource_id', request.resourceId], ['resource_name', request.resourceName], ['resource_type', request.resourceType], ['tags', request.tags], ...Object.entries(resolveOneOf([{
|
|
82
|
+
param: 'zonal',
|
|
83
|
+
value: request.zonal
|
|
84
|
+
}, {
|
|
85
|
+
param: 'private_network_id',
|
|
86
|
+
value: request.privateNetworkId
|
|
87
|
+
}])))
|
|
88
|
+
}, unmarshalListIPsResponse);
|
|
89
|
+
};
|
|
90
|
+
})();
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* List existing IPs. List existing IPs in the specified region using various
|
|
94
|
+
* filters. For example, you can filter for IPs within a specified Private
|
|
95
|
+
* Network, or for public IPs within a specified Project. By default, the IPs
|
|
96
|
+
* returned in the list are ordered by creation date in ascending order,
|
|
97
|
+
* though this can be modified via the order_by field.
|
|
98
|
+
*
|
|
99
|
+
* @param request - The request {@link ListIPsRequest}
|
|
100
|
+
* @returns A Promise of ListIPsResponse
|
|
101
|
+
*/
|
|
102
|
+
listIPs = (() => {
|
|
103
|
+
var _this2 = this;
|
|
104
|
+
return function (request) {
|
|
105
|
+
if (request === void 0) {
|
|
106
|
+
request = {};
|
|
107
|
+
}
|
|
108
|
+
return enrichForPagination('ips', _this2.pageOfListIPs, request);
|
|
109
|
+
};
|
|
110
|
+
})();
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export { API };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { API } from './api.gen.js';
|
|
2
|
+
import * as validationRules_gen from './validation-rules.gen.js';
|
|
3
|
+
export { validationRules_gen as ValidationRules };
|
|
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.
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { isJSONObject } from '../../../helpers/json.js';
|
|
2
|
+
import { unmarshalDate, unmarshalArrayOfObject, resolveOneOf } from '../../../helpers/marshalling.js';
|
|
3
|
+
|
|
4
|
+
// This file was automatically generated. DO NOT EDIT.
|
|
5
|
+
// If you have any remark or suggestion do not hesitate to open an issue.
|
|
6
|
+
const unmarshalResource = data => {
|
|
7
|
+
if (!isJSONObject(data)) {
|
|
8
|
+
throw new TypeError(`Unmarshalling the type 'Resource' failed as data isn't a dictionary.`);
|
|
9
|
+
}
|
|
10
|
+
return {
|
|
11
|
+
id: data.id,
|
|
12
|
+
macAddress: data.mac_address,
|
|
13
|
+
name: data.name,
|
|
14
|
+
type: data.type
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
const unmarshalSource = data => {
|
|
18
|
+
if (!isJSONObject(data)) {
|
|
19
|
+
throw new TypeError(`Unmarshalling the type 'Source' failed as data isn't a dictionary.`);
|
|
20
|
+
}
|
|
21
|
+
return {
|
|
22
|
+
privateNetworkId: data.private_network_id,
|
|
23
|
+
subnetId: data.subnet_id,
|
|
24
|
+
zonal: data.zonal
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
const unmarshalIP = data => {
|
|
28
|
+
if (!isJSONObject(data)) {
|
|
29
|
+
throw new TypeError(`Unmarshalling the type 'IP' failed as data isn't a dictionary.`);
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
address: data.address,
|
|
33
|
+
createdAt: unmarshalDate(data.created_at),
|
|
34
|
+
id: data.id,
|
|
35
|
+
isIpv6: data.is_ipv6,
|
|
36
|
+
projectId: data.project_id,
|
|
37
|
+
region: data.region,
|
|
38
|
+
resource: data.resource ? unmarshalResource(data.resource) : undefined,
|
|
39
|
+
source: unmarshalSource(data.source),
|
|
40
|
+
tags: data.tags,
|
|
41
|
+
updatedAt: unmarshalDate(data.updated_at),
|
|
42
|
+
zone: data.zone
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
const unmarshalListIPsResponse = data => {
|
|
46
|
+
if (!isJSONObject(data)) {
|
|
47
|
+
throw new TypeError(`Unmarshalling the type 'ListIPsResponse' failed as data isn't a dictionary.`);
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
ips: unmarshalArrayOfObject(data.ips, unmarshalIP),
|
|
51
|
+
totalCount: data.total_count
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
const marshalSource = (request, defaults) => ({
|
|
55
|
+
...resolveOneOf([{
|
|
56
|
+
param: 'zonal',
|
|
57
|
+
value: request.zonal
|
|
58
|
+
}, {
|
|
59
|
+
param: 'private_network_id',
|
|
60
|
+
value: request.privateNetworkId
|
|
61
|
+
}, {
|
|
62
|
+
param: 'subnet_id',
|
|
63
|
+
value: request.subnetId
|
|
64
|
+
}])
|
|
65
|
+
});
|
|
66
|
+
const marshalBookIPRequest = (request, defaults) => ({
|
|
67
|
+
address: request.address,
|
|
68
|
+
is_ipv6: request.isIpv6,
|
|
69
|
+
project_id: request.projectId ?? defaults.defaultProjectId,
|
|
70
|
+
source: marshalSource(request.source),
|
|
71
|
+
tags: request.tags
|
|
72
|
+
});
|
|
73
|
+
const marshalUpdateIPRequest = (request, defaults) => ({
|
|
74
|
+
tags: request.tags
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
export { marshalBookIPRequest, marshalUpdateIPRequest, unmarshalIP, unmarshalListIPsResponse };
|