@scaleway/sdk-instance 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1170 @@
1
+ import { API as API$1, urlParams, validatePathParam, enrichForPagination } from "@scaleway/sdk-client";
2
+ import { unmarshalGetServerTypesAvailabilityResponse, unmarshalListServersTypesResponse, unmarshalListVolumesTypesResponse, unmarshalListServersResponse, marshalCreateServerRequest, unmarshalCreateServerResponse, unmarshalGetServerResponse, marshalSetServerRequest, unmarshalSetServerResponse, marshalUpdateServerRequest, unmarshalUpdateServerResponse, unmarshalListServerActionsResponse, marshalServerActionRequest, unmarshalServerActionResponse, unmarshalListServerUserDataResponse, unmarshalServerCompatibleTypes, marshalAttachServerVolumeRequest, unmarshalAttachServerVolumeResponse, marshalDetachServerVolumeRequest, unmarshalDetachServerVolumeResponse, marshalAttachServerFileSystemRequest, unmarshalAttachServerFileSystemResponse, marshalDetachServerFileSystemRequest, unmarshalDetachServerFileSystemResponse, unmarshalListImagesResponse, unmarshalGetImageResponse, marshalCreateImageRequest, unmarshalCreateImageResponse, marshalSetImageRequest, unmarshalSetImageResponse, marshalUpdateImageRequest, unmarshalUpdateImageResponse, unmarshalListSnapshotsResponse, marshalCreateSnapshotRequest, unmarshalCreateSnapshotResponse, unmarshalGetSnapshotResponse, marshalSetSnapshotRequest, unmarshalSetSnapshotResponse, marshalUpdateSnapshotRequest, unmarshalUpdateSnapshotResponse, marshalExportSnapshotRequest, unmarshalExportSnapshotResponse, unmarshalListVolumesResponse, marshalCreateVolumeRequest, unmarshalCreateVolumeResponse, unmarshalGetVolumeResponse, marshalUpdateVolumeRequest, unmarshalUpdateVolumeResponse, unmarshalListSecurityGroupsResponse, marshalCreateSecurityGroupRequest, unmarshalCreateSecurityGroupResponse, unmarshalGetSecurityGroupResponse, marshalSetSecurityGroupRequest, unmarshalSetSecurityGroupResponse, marshalUpdateSecurityGroupRequest, unmarshalUpdateSecurityGroupResponse, unmarshalListSecurityGroupRulesResponse, marshalCreateSecurityGroupRuleRequest, unmarshalCreateSecurityGroupRuleResponse, marshalSetSecurityGroupRulesRequest, unmarshalSetSecurityGroupRulesResponse, unmarshalGetSecurityGroupRuleResponse, marshalSetSecurityGroupRuleRequest, unmarshalSetSecurityGroupRuleResponse, marshalUpdateSecurityGroupRuleRequest, unmarshalUpdateSecurityGroupRuleResponse, unmarshalListPlacementGroupsResponse, marshalCreatePlacementGroupRequest, unmarshalCreatePlacementGroupResponse, unmarshalGetPlacementGroupResponse, marshalSetPlacementGroupRequest, unmarshalSetPlacementGroupResponse, marshalUpdatePlacementGroupRequest, unmarshalUpdatePlacementGroupResponse, unmarshalGetPlacementGroupServersResponse, marshalSetPlacementGroupServersRequest, unmarshalSetPlacementGroupServersResponse, marshalUpdatePlacementGroupServersRequest, unmarshalUpdatePlacementGroupServersResponse, unmarshalListIpsResponse, marshalCreateIpRequest, unmarshalCreateIpResponse, unmarshalGetIpResponse, marshalUpdateIpRequest, unmarshalUpdateIpResponse, unmarshalListPrivateNICsResponse, marshalCreatePrivateNICRequest, unmarshalCreatePrivateNICResponse, unmarshalGetPrivateNICResponse, marshalUpdatePrivateNICRequest, unmarshalPrivateNIC, unmarshalGetDashboardResponse, marshalPlanBlockMigrationRequest, unmarshalMigrationPlan, marshalApplyBlockMigrationRequest, marshalCheckBlockMigrationOrganizationQuotasRequest } from "./marshalling.gen.js";
3
+ const jsonContentHeaders = {
4
+ "Content-Type": "application/json; charset=utf-8"
5
+ };
6
+ class API extends API$1 {
7
+ /** Lists the available zones of the API. */
8
+ static LOCALITIES = [
9
+ "fr-par-1",
10
+ "fr-par-2",
11
+ "fr-par-3",
12
+ "nl-ams-1",
13
+ "nl-ams-2",
14
+ "nl-ams-3",
15
+ "pl-waw-1",
16
+ "pl-waw-2",
17
+ "pl-waw-3"
18
+ ];
19
+ /**
20
+ * Get availability. Get availability for all Instance types.
21
+ *
22
+ * @param request - The request {@link GetServerTypesAvailabilityRequest}
23
+ * @returns A Promise of GetServerTypesAvailabilityResponse
24
+ */
25
+ getServerTypesAvailability = (request = {}) => this.client.fetch(
26
+ {
27
+ method: "GET",
28
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/products/servers/availability`,
29
+ urlParams: urlParams(
30
+ ["page", request.page],
31
+ ["per_page", request.perPage ?? this.client.settings.defaultPageSize]
32
+ )
33
+ },
34
+ unmarshalGetServerTypesAvailabilityResponse
35
+ );
36
+ /**
37
+ * List Instance types. List available Instance types and their technical details.
38
+ *
39
+ * @param request - The request {@link ListServersTypesRequest}
40
+ * @returns A Promise of ListServersTypesResponse
41
+ */
42
+ listServersTypes = (request = {}) => this.client.fetch(
43
+ {
44
+ method: "GET",
45
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/products/servers`,
46
+ urlParams: urlParams(
47
+ ["page", request.page],
48
+ ["per_page", request.perPage ?? this.client.settings.defaultPageSize]
49
+ )
50
+ },
51
+ unmarshalListServersTypesResponse
52
+ );
53
+ /**
54
+ * List volume types. List all volume types and their technical details.
55
+ *
56
+ * @param request - The request {@link ListVolumesTypesRequest}
57
+ * @returns A Promise of ListVolumesTypesResponse
58
+ */
59
+ listVolumesTypes = (request = {}) => this.client.fetch(
60
+ {
61
+ method: "GET",
62
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/products/volumes`,
63
+ urlParams: urlParams(
64
+ ["page", request.page],
65
+ ["per_page", request.perPage ?? this.client.settings.defaultPageSize]
66
+ )
67
+ },
68
+ unmarshalListVolumesTypesResponse
69
+ );
70
+ pageOfListServers = (request = {}) => this.client.fetch(
71
+ {
72
+ method: "GET",
73
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers`,
74
+ urlParams: urlParams(
75
+ ["commercial_type", request.commercialType],
76
+ ["name", request.name],
77
+ ["order", request.order],
78
+ ["organization", request.organization],
79
+ ["page", request.page],
80
+ ["per_page", request.perPage ?? this.client.settings.defaultPageSize],
81
+ ["private_ip", request.privateIp],
82
+ ["private_network", request.privateNetwork],
83
+ [
84
+ "private_networks",
85
+ request.privateNetworks && request.privateNetworks.length > 0 ? request.privateNetworks.join(",") : void 0
86
+ ],
87
+ ["private_nic_mac_address", request.privateNicMacAddress],
88
+ ["project", request.project],
89
+ [
90
+ "servers",
91
+ request.servers && request.servers.length > 0 ? request.servers.join(",") : void 0
92
+ ],
93
+ ["state", request.state],
94
+ [
95
+ "tags",
96
+ request.tags && request.tags.length > 0 ? request.tags.join(",") : void 0
97
+ ],
98
+ ["with_ip", request.withIp],
99
+ ["without_ip", request.withoutIp]
100
+ )
101
+ },
102
+ unmarshalListServersResponse
103
+ );
104
+ /**
105
+ * List all Instances. List all Instances in a specified Availability Zone, e.g. `fr-par-1`.
106
+ *
107
+ * @param request - The request {@link ListServersRequest}
108
+ * @returns A Promise of ListServersResponse
109
+ */
110
+ listServers = (request = {}) => enrichForPagination("servers", this.pageOfListServers, request);
111
+ _createServer = (request) => this.client.fetch(
112
+ {
113
+ body: JSON.stringify(
114
+ marshalCreateServerRequest(request, this.client.settings)
115
+ ),
116
+ headers: jsonContentHeaders,
117
+ method: "POST",
118
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers`
119
+ },
120
+ unmarshalCreateServerResponse
121
+ );
122
+ /**
123
+ * Delete an Instance. Delete the Instance with the specified ID.
124
+ *
125
+ * @param request - The request {@link DeleteServerRequest}
126
+ */
127
+ deleteServer = (request) => this.client.fetch({
128
+ method: "DELETE",
129
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam("serverId", request.serverId)}`
130
+ });
131
+ /**
132
+ * Get an Instance. Get the details of a specified Instance.
133
+ *
134
+ * @param request - The request {@link GetServerRequest}
135
+ * @returns A Promise of GetServerResponse
136
+ */
137
+ getServer = (request) => this.client.fetch(
138
+ {
139
+ method: "GET",
140
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam("serverId", request.serverId)}`
141
+ },
142
+ unmarshalGetServerResponse
143
+ );
144
+ _setServer = (request) => this.client.fetch(
145
+ {
146
+ body: JSON.stringify(
147
+ marshalSetServerRequest(request, this.client.settings)
148
+ ),
149
+ headers: jsonContentHeaders,
150
+ method: "PUT",
151
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam("id", request.id)}`
152
+ },
153
+ unmarshalSetServerResponse
154
+ );
155
+ _updateServer = (request) => this.client.fetch(
156
+ {
157
+ body: JSON.stringify(
158
+ marshalUpdateServerRequest(request, this.client.settings)
159
+ ),
160
+ headers: jsonContentHeaders,
161
+ method: "PATCH",
162
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam("serverId", request.serverId)}`
163
+ },
164
+ unmarshalUpdateServerResponse
165
+ );
166
+ /**
167
+ * List Instance actions. List all actions (e.g. power on, power off, reboot) that can currently be performed on an Instance.
168
+ *
169
+ * @param request - The request {@link ListServerActionsRequest}
170
+ * @returns A Promise of ListServerActionsResponse
171
+ */
172
+ listServerActions = (request) => this.client.fetch(
173
+ {
174
+ method: "GET",
175
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam("serverId", request.serverId)}/action`
176
+ },
177
+ unmarshalListServerActionsResponse
178
+ );
179
+ /**
180
+ * Perform action. Perform an action on an Instance.
181
+ Available actions are:
182
+ * `poweron`: Start a stopped Instance.
183
+ * `poweroff`: Fully stop the Instance and release the hypervisor slot.
184
+ * `stop_in_place`: Stop the Instance, but keep the slot on the hypervisor.
185
+ * `reboot`: Stop the instance and restart it.
186
+ * `backup`: Create an image with all the volumes of an Instance.
187
+ * `terminate`: Delete the Instance along with its attached volumes, except for SBS volumes.
188
+ * `enable_routed_ip`: Migrate the Instance to the new network stack.
189
+
190
+ The `terminate` action will result in the deletion of `l_ssd`, `b_ssd` and `scratch` volumes types, `sbs_volume` volumes type will only be detached.
191
+ If you want to preserve your volumes, you should detach them before the Instance deletion or `terminate` action.
192
+
193
+ The `backup` action can be done with:
194
+ * No `volumes` key in the body: an image is created with snapshots of all the server volumes, except for the `scratch` volumes types.
195
+ * `volumes` key in the body with a dictionary as value, in this dictionary volumes UUID as keys and empty dictionaries as values : an image is created with the snapshots of the volumes in `volumes` key. `scratch` volumes types can't be shapshotted.
196
+ *
197
+ * @param request - The request {@link ServerActionRequest}
198
+ * @returns A Promise of ServerActionResponse
199
+ */
200
+ serverAction = (request) => this.client.fetch(
201
+ {
202
+ body: JSON.stringify(
203
+ marshalServerActionRequest(request, this.client.settings)
204
+ ),
205
+ headers: jsonContentHeaders,
206
+ method: "POST",
207
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam("serverId", request.serverId)}/action`
208
+ },
209
+ unmarshalServerActionResponse
210
+ );
211
+ /**
212
+ * List user data. List all user data keys registered on a specified Instance.
213
+ *
214
+ * @param request - The request {@link ListServerUserDataRequest}
215
+ * @returns A Promise of ListServerUserDataResponse
216
+ */
217
+ listServerUserData = (request) => this.client.fetch(
218
+ {
219
+ method: "GET",
220
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam("serverId", request.serverId)}/user_data`
221
+ },
222
+ unmarshalListServerUserDataResponse
223
+ );
224
+ /**
225
+ * Delete user data. Delete the specified key from an Instance's user data.
226
+ *
227
+ * @param request - The request {@link DeleteServerUserDataRequest}
228
+ */
229
+ deleteServerUserData = (request) => this.client.fetch({
230
+ method: "DELETE",
231
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam("serverId", request.serverId)}/user_data/${validatePathParam("key", request.key)}`
232
+ });
233
+ /**
234
+ * Get Instance compatible types. Get compatible commercial types that can be used to update the Instance. The compatibility of an Instance offer is based on:
235
+ * the CPU architecture
236
+ * the OS type
237
+ * the required l_ssd storage size
238
+ * the required scratch storage size
239
+ If the specified Instance offer is flagged as end of service, the best compatible offer is the first returned.
240
+ *
241
+ * @param request - The request {@link GetServerCompatibleTypesRequest}
242
+ * @returns A Promise of ServerCompatibleTypes
243
+ */
244
+ getServerCompatibleTypes = (request) => this.client.fetch(
245
+ {
246
+ method: "GET",
247
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam("serverId", request.serverId)}/compatible-types`
248
+ },
249
+ unmarshalServerCompatibleTypes
250
+ );
251
+ attachServerVolume = (request) => this.client.fetch(
252
+ {
253
+ body: JSON.stringify(
254
+ marshalAttachServerVolumeRequest(request, this.client.settings)
255
+ ),
256
+ headers: jsonContentHeaders,
257
+ method: "POST",
258
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam("serverId", request.serverId)}/attach-volume`
259
+ },
260
+ unmarshalAttachServerVolumeResponse
261
+ );
262
+ detachServerVolume = (request) => this.client.fetch(
263
+ {
264
+ body: JSON.stringify(
265
+ marshalDetachServerVolumeRequest(request, this.client.settings)
266
+ ),
267
+ headers: jsonContentHeaders,
268
+ method: "POST",
269
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam("serverId", request.serverId)}/detach-volume`
270
+ },
271
+ unmarshalDetachServerVolumeResponse
272
+ );
273
+ /**
274
+ * Attach a filesystem volume to an Instance.
275
+ *
276
+ * @param request - The request {@link AttachServerFileSystemRequest}
277
+ * @returns A Promise of AttachServerFileSystemResponse
278
+ */
279
+ attachServerFileSystem = (request) => this.client.fetch(
280
+ {
281
+ body: JSON.stringify(
282
+ marshalAttachServerFileSystemRequest(request, this.client.settings)
283
+ ),
284
+ headers: jsonContentHeaders,
285
+ method: "POST",
286
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam("serverId", request.serverId)}/attach-filesystem`
287
+ },
288
+ unmarshalAttachServerFileSystemResponse
289
+ );
290
+ /**
291
+ * Detach a filesystem volume to an Instance.
292
+ *
293
+ * @param request - The request {@link DetachServerFileSystemRequest}
294
+ * @returns A Promise of DetachServerFileSystemResponse
295
+ */
296
+ detachServerFileSystem = (request) => this.client.fetch(
297
+ {
298
+ body: JSON.stringify(
299
+ marshalDetachServerFileSystemRequest(request, this.client.settings)
300
+ ),
301
+ headers: jsonContentHeaders,
302
+ method: "POST",
303
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam("serverId", request.serverId)}/detach-filesystem`
304
+ },
305
+ unmarshalDetachServerFileSystemResponse
306
+ );
307
+ pageOfListImages = (request = {}) => this.client.fetch(
308
+ {
309
+ method: "GET",
310
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/images`,
311
+ urlParams: urlParams(
312
+ ["arch", request.arch],
313
+ ["name", request.name],
314
+ ["organization", request.organization],
315
+ ["page", request.page],
316
+ ["per_page", request.perPage ?? this.client.settings.defaultPageSize],
317
+ ["project", request.project],
318
+ ["public", request.public],
319
+ ["tags", request.tags]
320
+ )
321
+ },
322
+ unmarshalListImagesResponse
323
+ );
324
+ /**
325
+ * List Instance images. List all existing Instance images.
326
+ *
327
+ * @param request - The request {@link ListImagesRequest}
328
+ * @returns A Promise of ListImagesResponse
329
+ */
330
+ listImages = (request = {}) => enrichForPagination("images", this.pageOfListImages, request);
331
+ /**
332
+ * Get an Instance image. Get details of an image with the specified ID.
333
+ *
334
+ * @param request - The request {@link GetImageRequest}
335
+ * @returns A Promise of GetImageResponse
336
+ */
337
+ getImage = (request) => this.client.fetch(
338
+ {
339
+ method: "GET",
340
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/images/${validatePathParam("imageId", request.imageId)}`
341
+ },
342
+ unmarshalGetImageResponse
343
+ );
344
+ /**
345
+ * Create an Instance image. Create an Instance image from the specified snapshot ID.
346
+ *
347
+ * @param request - The request {@link CreateImageRequest}
348
+ * @returns A Promise of CreateImageResponse
349
+ */
350
+ createImage = (request) => this.client.fetch(
351
+ {
352
+ body: JSON.stringify(
353
+ marshalCreateImageRequest(request, this.client.settings)
354
+ ),
355
+ headers: jsonContentHeaders,
356
+ method: "POST",
357
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/images`
358
+ },
359
+ unmarshalCreateImageResponse
360
+ );
361
+ _setImage = (request) => this.client.fetch(
362
+ {
363
+ body: JSON.stringify(
364
+ marshalSetImageRequest(request, this.client.settings)
365
+ ),
366
+ headers: jsonContentHeaders,
367
+ method: "PUT",
368
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/images/${validatePathParam("id", request.id)}`
369
+ },
370
+ unmarshalSetImageResponse
371
+ );
372
+ /**
373
+ * Update image. Update the properties of an image.
374
+ *
375
+ * @param request - The request {@link UpdateImageRequest}
376
+ * @returns A Promise of UpdateImageResponse
377
+ */
378
+ updateImage = (request) => this.client.fetch(
379
+ {
380
+ body: JSON.stringify(
381
+ marshalUpdateImageRequest(request, this.client.settings)
382
+ ),
383
+ headers: jsonContentHeaders,
384
+ method: "PATCH",
385
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/images/${validatePathParam("imageId", request.imageId)}`
386
+ },
387
+ unmarshalUpdateImageResponse
388
+ );
389
+ /**
390
+ * Delete an Instance image. Delete the image with the specified ID.
391
+ *
392
+ * @param request - The request {@link DeleteImageRequest}
393
+ */
394
+ deleteImage = (request) => this.client.fetch({
395
+ method: "DELETE",
396
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/images/${validatePathParam("imageId", request.imageId)}`
397
+ });
398
+ pageOfListSnapshots = (request = {}) => this.client.fetch(
399
+ {
400
+ method: "GET",
401
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/snapshots`,
402
+ urlParams: urlParams(
403
+ ["base_volume_id", request.baseVolumeId],
404
+ ["name", request.name],
405
+ ["organization", request.organization],
406
+ ["page", request.page],
407
+ ["per_page", request.perPage ?? this.client.settings.defaultPageSize],
408
+ ["project", request.project],
409
+ ["tags", request.tags]
410
+ )
411
+ },
412
+ unmarshalListSnapshotsResponse
413
+ );
414
+ /**
415
+ * List snapshots. List all snapshots of an Organization in a specified Availability Zone.
416
+ *
417
+ * @param request - The request {@link ListSnapshotsRequest}
418
+ * @returns A Promise of ListSnapshotsResponse
419
+ */
420
+ listSnapshots = (request = {}) => enrichForPagination("snapshots", this.pageOfListSnapshots, request);
421
+ /**
422
+ * Create a snapshot from a specified volume or from a QCOW2 file. Create a snapshot from a specified volume or from a QCOW2 file in a specified Availability Zone.
423
+ *
424
+ * @param request - The request {@link CreateSnapshotRequest}
425
+ * @returns A Promise of CreateSnapshotResponse
426
+ */
427
+ createSnapshot = (request = {}) => this.client.fetch(
428
+ {
429
+ body: JSON.stringify(
430
+ marshalCreateSnapshotRequest(request, this.client.settings)
431
+ ),
432
+ headers: jsonContentHeaders,
433
+ method: "POST",
434
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/snapshots`
435
+ },
436
+ unmarshalCreateSnapshotResponse
437
+ );
438
+ /**
439
+ * Get a snapshot. Get details of a snapshot with the specified ID.
440
+ *
441
+ * @param request - The request {@link GetSnapshotRequest}
442
+ * @returns A Promise of GetSnapshotResponse
443
+ */
444
+ getSnapshot = (request) => this.client.fetch(
445
+ {
446
+ method: "GET",
447
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/snapshots/${validatePathParam("snapshotId", request.snapshotId)}`
448
+ },
449
+ unmarshalGetSnapshotResponse
450
+ );
451
+ _setSnapshot = (request) => this.client.fetch(
452
+ {
453
+ body: JSON.stringify(
454
+ marshalSetSnapshotRequest(request, this.client.settings)
455
+ ),
456
+ headers: jsonContentHeaders,
457
+ method: "PUT",
458
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/snapshots/${validatePathParam("snapshotId", request.snapshotId)}`
459
+ },
460
+ unmarshalSetSnapshotResponse
461
+ );
462
+ /**
463
+ * Update a snapshot. Update the properties of a snapshot.
464
+ *
465
+ * @param request - The request {@link UpdateSnapshotRequest}
466
+ * @returns A Promise of UpdateSnapshotResponse
467
+ */
468
+ updateSnapshot = (request) => this.client.fetch(
469
+ {
470
+ body: JSON.stringify(
471
+ marshalUpdateSnapshotRequest(request, this.client.settings)
472
+ ),
473
+ headers: jsonContentHeaders,
474
+ method: "PATCH",
475
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/snapshots/${validatePathParam("snapshotId", request.snapshotId)}`
476
+ },
477
+ unmarshalUpdateSnapshotResponse
478
+ );
479
+ /**
480
+ * Delete a snapshot. Delete the snapshot with the specified ID.
481
+ *
482
+ * @param request - The request {@link DeleteSnapshotRequest}
483
+ */
484
+ deleteSnapshot = (request) => this.client.fetch({
485
+ method: "DELETE",
486
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/snapshots/${validatePathParam("snapshotId", request.snapshotId)}`
487
+ });
488
+ /**
489
+ * Export a snapshot. Export a snapshot to a specified Object Storage bucket in the same region.
490
+ *
491
+ * @param request - The request {@link ExportSnapshotRequest}
492
+ * @returns A Promise of ExportSnapshotResponse
493
+ */
494
+ exportSnapshot = (request) => this.client.fetch(
495
+ {
496
+ body: JSON.stringify(
497
+ marshalExportSnapshotRequest(request, this.client.settings)
498
+ ),
499
+ headers: jsonContentHeaders,
500
+ method: "POST",
501
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/snapshots/${validatePathParam("snapshotId", request.snapshotId)}/export`
502
+ },
503
+ unmarshalExportSnapshotResponse
504
+ );
505
+ pageOfListVolumes = (request = {}) => this.client.fetch(
506
+ {
507
+ method: "GET",
508
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/volumes`,
509
+ urlParams: urlParams(
510
+ ["name", request.name],
511
+ ["organization", request.organization],
512
+ ["page", request.page],
513
+ ["per_page", request.perPage ?? this.client.settings.defaultPageSize],
514
+ ["project", request.project],
515
+ [
516
+ "tags",
517
+ request.tags && request.tags.length > 0 ? request.tags.join(",") : void 0
518
+ ],
519
+ ["volume_type", request.volumeType]
520
+ )
521
+ },
522
+ unmarshalListVolumesResponse
523
+ );
524
+ /**
525
+ * List volumes. List volumes in the specified Availability Zone. You can filter the output by volume type.
526
+ *
527
+ * @param request - The request {@link ListVolumesRequest}
528
+ * @returns A Promise of ListVolumesResponse
529
+ */
530
+ listVolumes = (request = {}) => enrichForPagination("volumes", this.pageOfListVolumes, request);
531
+ /**
532
+ * Create a volume. Create a volume of a specified type in an Availability Zone.
533
+ *
534
+ * @param request - The request {@link CreateVolumeRequest}
535
+ * @returns A Promise of CreateVolumeResponse
536
+ */
537
+ createVolume = (request = {}) => this.client.fetch(
538
+ {
539
+ body: JSON.stringify(
540
+ marshalCreateVolumeRequest(request, this.client.settings)
541
+ ),
542
+ headers: jsonContentHeaders,
543
+ method: "POST",
544
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/volumes`
545
+ },
546
+ unmarshalCreateVolumeResponse
547
+ );
548
+ /**
549
+ * Get a volume. Get details of a volume with the specified ID.
550
+ *
551
+ * @param request - The request {@link GetVolumeRequest}
552
+ * @returns A Promise of GetVolumeResponse
553
+ */
554
+ getVolume = (request) => this.client.fetch(
555
+ {
556
+ method: "GET",
557
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/volumes/${validatePathParam("volumeId", request.volumeId)}`
558
+ },
559
+ unmarshalGetVolumeResponse
560
+ );
561
+ /**
562
+ * Update a volume. Replace the name and/or size properties of a volume specified by its ID, with the specified value(s). Any volume name can be changed, however only `b_ssd` volumes can currently be increased in size.
563
+ *
564
+ * @param request - The request {@link UpdateVolumeRequest}
565
+ * @returns A Promise of UpdateVolumeResponse
566
+ */
567
+ updateVolume = (request) => this.client.fetch(
568
+ {
569
+ body: JSON.stringify(
570
+ marshalUpdateVolumeRequest(request, this.client.settings)
571
+ ),
572
+ headers: jsonContentHeaders,
573
+ method: "PATCH",
574
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/volumes/${validatePathParam("volumeId", request.volumeId)}`
575
+ },
576
+ unmarshalUpdateVolumeResponse
577
+ );
578
+ /**
579
+ * Delete a volume. Delete the volume with the specified ID.
580
+ *
581
+ * @param request - The request {@link DeleteVolumeRequest}
582
+ */
583
+ deleteVolume = (request) => this.client.fetch({
584
+ method: "DELETE",
585
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/volumes/${validatePathParam("volumeId", request.volumeId)}`
586
+ });
587
+ pageOfListSecurityGroups = (request = {}) => this.client.fetch(
588
+ {
589
+ method: "GET",
590
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/security_groups`,
591
+ urlParams: urlParams(
592
+ ["name", request.name],
593
+ ["organization", request.organization],
594
+ ["page", request.page],
595
+ ["per_page", request.perPage ?? this.client.settings.defaultPageSize],
596
+ ["project", request.project],
597
+ ["project_default", request.projectDefault],
598
+ [
599
+ "tags",
600
+ request.tags && request.tags.length > 0 ? request.tags.join(",") : void 0
601
+ ]
602
+ )
603
+ },
604
+ unmarshalListSecurityGroupsResponse
605
+ );
606
+ /**
607
+ * List security groups. List all existing security groups.
608
+ *
609
+ * @param request - The request {@link ListSecurityGroupsRequest}
610
+ * @returns A Promise of ListSecurityGroupsResponse
611
+ */
612
+ listSecurityGroups = (request = {}) => enrichForPagination(
613
+ "securityGroups",
614
+ this.pageOfListSecurityGroups,
615
+ request
616
+ );
617
+ /**
618
+ * Create a security group. Create a security group with a specified name and description.
619
+ *
620
+ * @param request - The request {@link CreateSecurityGroupRequest}
621
+ * @returns A Promise of CreateSecurityGroupResponse
622
+ */
623
+ createSecurityGroup = (request) => this.client.fetch(
624
+ {
625
+ body: JSON.stringify(
626
+ marshalCreateSecurityGroupRequest(request, this.client.settings)
627
+ ),
628
+ headers: jsonContentHeaders,
629
+ method: "POST",
630
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/security_groups`
631
+ },
632
+ unmarshalCreateSecurityGroupResponse
633
+ );
634
+ /**
635
+ * Get a security group. Get the details of a security group with the specified ID.
636
+ *
637
+ * @param request - The request {@link GetSecurityGroupRequest}
638
+ * @returns A Promise of GetSecurityGroupResponse
639
+ */
640
+ getSecurityGroup = (request) => this.client.fetch(
641
+ {
642
+ method: "GET",
643
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/security_groups/${validatePathParam("securityGroupId", request.securityGroupId)}`
644
+ },
645
+ unmarshalGetSecurityGroupResponse
646
+ );
647
+ /**
648
+ * Delete a security group. Delete a security group with the specified ID.
649
+ *
650
+ * @param request - The request {@link DeleteSecurityGroupRequest}
651
+ */
652
+ deleteSecurityGroup = (request) => this.client.fetch({
653
+ method: "DELETE",
654
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/security_groups/${validatePathParam("securityGroupId", request.securityGroupId)}`
655
+ });
656
+ _setSecurityGroup = (request) => this.client.fetch(
657
+ {
658
+ body: JSON.stringify(
659
+ marshalSetSecurityGroupRequest(request, this.client.settings)
660
+ ),
661
+ headers: jsonContentHeaders,
662
+ method: "PUT",
663
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/security_groups/${validatePathParam("id", request.id)}`
664
+ },
665
+ unmarshalSetSecurityGroupResponse
666
+ );
667
+ /**
668
+ * Update a security group. Update the properties of security group.
669
+ *
670
+ * @param request - The request {@link UpdateSecurityGroupRequest}
671
+ * @returns A Promise of UpdateSecurityGroupResponse
672
+ */
673
+ updateSecurityGroup = (request) => this.client.fetch(
674
+ {
675
+ body: JSON.stringify(
676
+ marshalUpdateSecurityGroupRequest(request, this.client.settings)
677
+ ),
678
+ headers: jsonContentHeaders,
679
+ method: "PATCH",
680
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/security_groups/${validatePathParam("securityGroupId", request.securityGroupId)}`
681
+ },
682
+ unmarshalUpdateSecurityGroupResponse
683
+ );
684
+ /**
685
+ * Get default rules. Lists the default rules applied to all the security groups.
686
+ *
687
+ * @param request - The request {@link ListDefaultSecurityGroupRulesRequest}
688
+ * @returns A Promise of ListSecurityGroupRulesResponse
689
+ */
690
+ listDefaultSecurityGroupRules = (request = {}) => this.client.fetch(
691
+ {
692
+ method: "GET",
693
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/security_groups/default/rules`
694
+ },
695
+ unmarshalListSecurityGroupRulesResponse
696
+ );
697
+ pageOfListSecurityGroupRules = (request) => this.client.fetch(
698
+ {
699
+ method: "GET",
700
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/security_groups/${validatePathParam("securityGroupId", request.securityGroupId)}/rules`,
701
+ urlParams: urlParams(
702
+ ["page", request.page],
703
+ ["per_page", request.perPage ?? this.client.settings.defaultPageSize]
704
+ )
705
+ },
706
+ unmarshalListSecurityGroupRulesResponse
707
+ );
708
+ /**
709
+ * List rules. List the rules of the a specified security group ID.
710
+ *
711
+ * @param request - The request {@link ListSecurityGroupRulesRequest}
712
+ * @returns A Promise of ListSecurityGroupRulesResponse
713
+ */
714
+ listSecurityGroupRules = (request) => enrichForPagination("rules", this.pageOfListSecurityGroupRules, request);
715
+ /**
716
+ * Create rule. Create a rule in the specified security group ID.
717
+ *
718
+ * @param request - The request {@link CreateSecurityGroupRuleRequest}
719
+ * @returns A Promise of CreateSecurityGroupRuleResponse
720
+ */
721
+ createSecurityGroupRule = (request) => this.client.fetch(
722
+ {
723
+ body: JSON.stringify(
724
+ marshalCreateSecurityGroupRuleRequest(request, this.client.settings)
725
+ ),
726
+ headers: jsonContentHeaders,
727
+ method: "POST",
728
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/security_groups/${validatePathParam("securityGroupId", request.securityGroupId)}/rules`
729
+ },
730
+ unmarshalCreateSecurityGroupRuleResponse
731
+ );
732
+ /**
733
+ * Update all the rules of a security group. Replaces the existing rules of the security group with the rules provided. This endpoint supports the update of existing rules, creation of new rules and deletion of existing rules when they are not passed in the request.
734
+ *
735
+ * @param request - The request {@link SetSecurityGroupRulesRequest}
736
+ * @returns A Promise of SetSecurityGroupRulesResponse
737
+ */
738
+ setSecurityGroupRules = (request) => this.client.fetch(
739
+ {
740
+ body: JSON.stringify(
741
+ marshalSetSecurityGroupRulesRequest(request, this.client.settings)
742
+ ),
743
+ headers: jsonContentHeaders,
744
+ method: "PUT",
745
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/security_groups/${validatePathParam("securityGroupId", request.securityGroupId)}/rules`
746
+ },
747
+ unmarshalSetSecurityGroupRulesResponse
748
+ );
749
+ /**
750
+ * Delete rule. Delete a security group rule with the specified ID.
751
+ *
752
+ * @param request - The request {@link DeleteSecurityGroupRuleRequest}
753
+ */
754
+ deleteSecurityGroupRule = (request) => this.client.fetch({
755
+ method: "DELETE",
756
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/security_groups/${validatePathParam("securityGroupId", request.securityGroupId)}/rules/${validatePathParam("securityGroupRuleId", request.securityGroupRuleId)}`
757
+ });
758
+ /**
759
+ * Get rule. Get details of a security group rule with the specified ID.
760
+ *
761
+ * @param request - The request {@link GetSecurityGroupRuleRequest}
762
+ * @returns A Promise of GetSecurityGroupRuleResponse
763
+ */
764
+ getSecurityGroupRule = (request) => this.client.fetch(
765
+ {
766
+ method: "GET",
767
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/security_groups/${validatePathParam("securityGroupId", request.securityGroupId)}/rules/${validatePathParam("securityGroupRuleId", request.securityGroupRuleId)}`
768
+ },
769
+ unmarshalGetSecurityGroupRuleResponse
770
+ );
771
+ _setSecurityGroupRule = (request) => this.client.fetch(
772
+ {
773
+ body: JSON.stringify(
774
+ marshalSetSecurityGroupRuleRequest(request, this.client.settings)
775
+ ),
776
+ headers: jsonContentHeaders,
777
+ method: "PUT",
778
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/security_groups/${validatePathParam("securityGroupId", request.securityGroupId)}/rules/${validatePathParam("securityGroupRuleId", request.securityGroupRuleId)}`
779
+ },
780
+ unmarshalSetSecurityGroupRuleResponse
781
+ );
782
+ /**
783
+ * Update security group rule. Update the properties of a rule from a specified security group.
784
+ *
785
+ * @param request - The request {@link UpdateSecurityGroupRuleRequest}
786
+ * @returns A Promise of UpdateSecurityGroupRuleResponse
787
+ */
788
+ updateSecurityGroupRule = (request) => this.client.fetch(
789
+ {
790
+ body: JSON.stringify(
791
+ marshalUpdateSecurityGroupRuleRequest(request, this.client.settings)
792
+ ),
793
+ headers: jsonContentHeaders,
794
+ method: "PATCH",
795
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/security_groups/${validatePathParam("securityGroupId", request.securityGroupId)}/rules/${validatePathParam("securityGroupRuleId", request.securityGroupRuleId)}`
796
+ },
797
+ unmarshalUpdateSecurityGroupRuleResponse
798
+ );
799
+ pageOfListPlacementGroups = (request = {}) => this.client.fetch(
800
+ {
801
+ method: "GET",
802
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/placement_groups`,
803
+ urlParams: urlParams(
804
+ ["name", request.name],
805
+ ["organization", request.organization],
806
+ ["page", request.page],
807
+ ["per_page", request.perPage ?? this.client.settings.defaultPageSize],
808
+ ["project", request.project],
809
+ [
810
+ "tags",
811
+ request.tags && request.tags.length > 0 ? request.tags.join(",") : void 0
812
+ ]
813
+ )
814
+ },
815
+ unmarshalListPlacementGroupsResponse
816
+ );
817
+ /**
818
+ * List placement groups. List all placement groups in a specified Availability Zone.
819
+ *
820
+ * @param request - The request {@link ListPlacementGroupsRequest}
821
+ * @returns A Promise of ListPlacementGroupsResponse
822
+ */
823
+ listPlacementGroups = (request = {}) => enrichForPagination(
824
+ "placementGroups",
825
+ this.pageOfListPlacementGroups,
826
+ request
827
+ );
828
+ /**
829
+ * Create a placement group. Create a new placement group in a specified Availability Zone.
830
+ *
831
+ * @param request - The request {@link CreatePlacementGroupRequest}
832
+ * @returns A Promise of CreatePlacementGroupResponse
833
+ */
834
+ createPlacementGroup = (request = {}) => this.client.fetch(
835
+ {
836
+ body: JSON.stringify(
837
+ marshalCreatePlacementGroupRequest(request, this.client.settings)
838
+ ),
839
+ headers: jsonContentHeaders,
840
+ method: "POST",
841
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/placement_groups`
842
+ },
843
+ unmarshalCreatePlacementGroupResponse
844
+ );
845
+ /**
846
+ * Get a placement group. Get the specified placement group.
847
+ *
848
+ * @param request - The request {@link GetPlacementGroupRequest}
849
+ * @returns A Promise of GetPlacementGroupResponse
850
+ */
851
+ getPlacementGroup = (request) => this.client.fetch(
852
+ {
853
+ method: "GET",
854
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/placement_groups/${validatePathParam("placementGroupId", request.placementGroupId)}`
855
+ },
856
+ unmarshalGetPlacementGroupResponse
857
+ );
858
+ /**
859
+ * Set placement group. Set all parameters of the specified placement group.
860
+ *
861
+ * @param request - The request {@link SetPlacementGroupRequest}
862
+ * @returns A Promise of SetPlacementGroupResponse
863
+ */
864
+ setPlacementGroup = (request) => this.client.fetch(
865
+ {
866
+ body: JSON.stringify(
867
+ marshalSetPlacementGroupRequest(request, this.client.settings)
868
+ ),
869
+ headers: jsonContentHeaders,
870
+ method: "PUT",
871
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/placement_groups/${validatePathParam("placementGroupId", request.placementGroupId)}`
872
+ },
873
+ unmarshalSetPlacementGroupResponse
874
+ );
875
+ /**
876
+ * Update a placement group. Update one or more parameter of the specified placement group.
877
+ *
878
+ * @param request - The request {@link UpdatePlacementGroupRequest}
879
+ * @returns A Promise of UpdatePlacementGroupResponse
880
+ */
881
+ updatePlacementGroup = (request) => this.client.fetch(
882
+ {
883
+ body: JSON.stringify(
884
+ marshalUpdatePlacementGroupRequest(request, this.client.settings)
885
+ ),
886
+ headers: jsonContentHeaders,
887
+ method: "PATCH",
888
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/placement_groups/${validatePathParam("placementGroupId", request.placementGroupId)}`
889
+ },
890
+ unmarshalUpdatePlacementGroupResponse
891
+ );
892
+ /**
893
+ * Delete the specified placement group.
894
+ *
895
+ * @param request - The request {@link DeletePlacementGroupRequest}
896
+ */
897
+ deletePlacementGroup = (request) => this.client.fetch({
898
+ method: "DELETE",
899
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/placement_groups/${validatePathParam("placementGroupId", request.placementGroupId)}`
900
+ });
901
+ /**
902
+ * Get placement group servers. Get all Instances belonging to the specified placement group.
903
+ *
904
+ * @param request - The request {@link GetPlacementGroupServersRequest}
905
+ * @returns A Promise of GetPlacementGroupServersResponse
906
+ */
907
+ getPlacementGroupServers = (request) => this.client.fetch(
908
+ {
909
+ method: "GET",
910
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/placement_groups/${validatePathParam("placementGroupId", request.placementGroupId)}/servers`
911
+ },
912
+ unmarshalGetPlacementGroupServersResponse
913
+ );
914
+ /**
915
+ * Set placement group servers. Set all Instances belonging to the specified placement group.
916
+ *
917
+ * @param request - The request {@link SetPlacementGroupServersRequest}
918
+ * @returns A Promise of SetPlacementGroupServersResponse
919
+ */
920
+ setPlacementGroupServers = (request) => this.client.fetch(
921
+ {
922
+ body: JSON.stringify(
923
+ marshalSetPlacementGroupServersRequest(request, this.client.settings)
924
+ ),
925
+ headers: jsonContentHeaders,
926
+ method: "PUT",
927
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/placement_groups/${validatePathParam("placementGroupId", request.placementGroupId)}/servers`
928
+ },
929
+ unmarshalSetPlacementGroupServersResponse
930
+ );
931
+ /**
932
+ * Update placement group servers. Update all Instances belonging to the specified placement group.
933
+ *
934
+ * @param request - The request {@link UpdatePlacementGroupServersRequest}
935
+ * @returns A Promise of UpdatePlacementGroupServersResponse
936
+ */
937
+ updatePlacementGroupServers = (request) => this.client.fetch(
938
+ {
939
+ body: JSON.stringify(
940
+ marshalUpdatePlacementGroupServersRequest(
941
+ request,
942
+ this.client.settings
943
+ )
944
+ ),
945
+ headers: jsonContentHeaders,
946
+ method: "PATCH",
947
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/placement_groups/${validatePathParam("placementGroupId", request.placementGroupId)}/servers`
948
+ },
949
+ unmarshalUpdatePlacementGroupServersResponse
950
+ );
951
+ pageOfListIps = (request = {}) => this.client.fetch(
952
+ {
953
+ method: "GET",
954
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/ips`,
955
+ urlParams: urlParams(
956
+ ["name", request.name],
957
+ ["organization", request.organization],
958
+ ["page", request.page],
959
+ ["per_page", request.perPage ?? this.client.settings.defaultPageSize],
960
+ ["project", request.project],
961
+ [
962
+ "tags",
963
+ request.tags && request.tags.length > 0 ? request.tags.join(",") : void 0
964
+ ],
965
+ ["type", request.type]
966
+ )
967
+ },
968
+ unmarshalListIpsResponse
969
+ );
970
+ /**
971
+ * List all flexible IPs. List all flexible IPs in a specified zone.
972
+ *
973
+ * @param request - The request {@link ListIpsRequest}
974
+ * @returns A Promise of ListIpsResponse
975
+ */
976
+ listIps = (request = {}) => enrichForPagination("ips", this.pageOfListIps, request);
977
+ /**
978
+ * Reserve a flexible IP. Reserve a flexible IP and attach it to the specified Instance.
979
+ *
980
+ * @param request - The request {@link CreateIpRequest}
981
+ * @returns A Promise of CreateIpResponse
982
+ */
983
+ createIp = (request = {}) => this.client.fetch(
984
+ {
985
+ body: JSON.stringify(
986
+ marshalCreateIpRequest(request, this.client.settings)
987
+ ),
988
+ headers: jsonContentHeaders,
989
+ method: "POST",
990
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/ips`
991
+ },
992
+ unmarshalCreateIpResponse
993
+ );
994
+ /**
995
+ * Get a flexible IP. Get details of an IP with the specified ID or address.
996
+ *
997
+ * @param request - The request {@link GetIpRequest}
998
+ * @returns A Promise of GetIpResponse
999
+ */
1000
+ getIp = (request) => this.client.fetch(
1001
+ {
1002
+ method: "GET",
1003
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/ips/${validatePathParam("ip", request.ip)}`
1004
+ },
1005
+ unmarshalGetIpResponse
1006
+ );
1007
+ /**
1008
+ * Update a flexible IP. Update a flexible IP in the specified zone with the specified ID.
1009
+ *
1010
+ * @param request - The request {@link UpdateIpRequest}
1011
+ * @returns A Promise of UpdateIpResponse
1012
+ */
1013
+ updateIp = (request) => this.client.fetch(
1014
+ {
1015
+ body: JSON.stringify(
1016
+ marshalUpdateIpRequest(request, this.client.settings)
1017
+ ),
1018
+ headers: jsonContentHeaders,
1019
+ method: "PATCH",
1020
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/ips/${validatePathParam("ip", request.ip)}`
1021
+ },
1022
+ unmarshalUpdateIpResponse
1023
+ );
1024
+ /**
1025
+ * Delete a flexible IP. Delete the IP with the specified ID.
1026
+ *
1027
+ * @param request - The request {@link DeleteIpRequest}
1028
+ */
1029
+ deleteIp = (request) => this.client.fetch({
1030
+ method: "DELETE",
1031
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/ips/${validatePathParam("ip", request.ip)}`
1032
+ });
1033
+ pageOfListPrivateNICs = (request) => this.client.fetch(
1034
+ {
1035
+ method: "GET",
1036
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam("serverId", request.serverId)}/private_nics`,
1037
+ urlParams: urlParams(
1038
+ ["page", request.page],
1039
+ ["per_page", request.perPage ?? this.client.settings.defaultPageSize],
1040
+ [
1041
+ "tags",
1042
+ request.tags && request.tags.length > 0 ? request.tags.join(",") : void 0
1043
+ ]
1044
+ )
1045
+ },
1046
+ unmarshalListPrivateNICsResponse
1047
+ );
1048
+ /**
1049
+ * List all private NICs. List all private NICs of a specified Instance.
1050
+ *
1051
+ * @param request - The request {@link ListPrivateNICsRequest}
1052
+ * @returns A Promise of ListPrivateNICsResponse
1053
+ */
1054
+ listPrivateNICs = (request) => enrichForPagination("privateNics", this.pageOfListPrivateNICs, request);
1055
+ /**
1056
+ * Create a private NIC connecting an Instance to a Private Network.
1057
+ *
1058
+ * @param request - The request {@link CreatePrivateNICRequest}
1059
+ * @returns A Promise of CreatePrivateNICResponse
1060
+ */
1061
+ createPrivateNIC = (request) => this.client.fetch(
1062
+ {
1063
+ body: JSON.stringify(
1064
+ marshalCreatePrivateNICRequest(request, this.client.settings)
1065
+ ),
1066
+ headers: jsonContentHeaders,
1067
+ method: "POST",
1068
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam("serverId", request.serverId)}/private_nics`
1069
+ },
1070
+ unmarshalCreatePrivateNICResponse
1071
+ );
1072
+ /**
1073
+ * Get a private NIC. Get private NIC properties.
1074
+ *
1075
+ * @param request - The request {@link GetPrivateNICRequest}
1076
+ * @returns A Promise of GetPrivateNICResponse
1077
+ */
1078
+ getPrivateNIC = (request) => this.client.fetch(
1079
+ {
1080
+ method: "GET",
1081
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam("serverId", request.serverId)}/private_nics/${validatePathParam("privateNicId", request.privateNicId)}`
1082
+ },
1083
+ unmarshalGetPrivateNICResponse
1084
+ );
1085
+ /**
1086
+ * Update a private NIC. Update one or more parameter(s) of a specified private NIC.
1087
+ *
1088
+ * @param request - The request {@link UpdatePrivateNICRequest}
1089
+ * @returns A Promise of PrivateNIC
1090
+ */
1091
+ updatePrivateNIC = (request) => this.client.fetch(
1092
+ {
1093
+ body: JSON.stringify(
1094
+ marshalUpdatePrivateNICRequest(request, this.client.settings)
1095
+ ),
1096
+ headers: jsonContentHeaders,
1097
+ method: "PATCH",
1098
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam("serverId", request.serverId)}/private_nics/${validatePathParam("privateNicId", request.privateNicId)}`
1099
+ },
1100
+ unmarshalPrivateNIC
1101
+ );
1102
+ /**
1103
+ * Delete a private NIC.
1104
+ *
1105
+ * @param request - The request {@link DeletePrivateNICRequest}
1106
+ */
1107
+ deletePrivateNIC = (request) => this.client.fetch({
1108
+ method: "DELETE",
1109
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam("serverId", request.serverId)}/private_nics/${validatePathParam("privateNicId", request.privateNicId)}`
1110
+ });
1111
+ getDashboard = (request = {}) => this.client.fetch(
1112
+ {
1113
+ method: "GET",
1114
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/dashboard`,
1115
+ urlParams: urlParams(
1116
+ ["organization", request.organization],
1117
+ ["project", request.project]
1118
+ )
1119
+ },
1120
+ unmarshalGetDashboardResponse
1121
+ );
1122
+ /**
1123
+ * Get a volume or snapshot's migration plan. Given a volume or snapshot, returns the migration plan but does not perform the actual migration. To perform the migration, you have to call the [Migrate a volume and/or snapshots to SBS](#path-volumes-migrate-a-volume-andor-snapshots-to-sbs-scaleway-block-storage) endpoint afterward.
1124
+ The endpoint returns the resources that should be migrated together:
1125
+ - the volume and any snapshots created from the volume, if the call was made to plan a volume migration.
1126
+ - the base volume of the snapshot (if the volume is not deleted) and its related snapshots, if the call was made to plan a snapshot migration.
1127
+ The endpoint also returns the validation_key, which must be provided to the [Migrate a volume and/or snapshots to SBS](#path-volumes-migrate-a-volume-andor-snapshots-to-sbs-scaleway-block-storage) endpoint to confirm that all resources listed in the plan should be migrated.
1128
+ *
1129
+ * @param request - The request {@link PlanBlockMigrationRequest}
1130
+ * @returns A Promise of MigrationPlan
1131
+ */
1132
+ planBlockMigration = (request = {}) => this.client.fetch(
1133
+ {
1134
+ body: JSON.stringify(
1135
+ marshalPlanBlockMigrationRequest(request, this.client.settings)
1136
+ ),
1137
+ headers: jsonContentHeaders,
1138
+ method: "POST",
1139
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/block-migration/plan`
1140
+ },
1141
+ unmarshalMigrationPlan
1142
+ );
1143
+ /**
1144
+ * Migrate a volume and/or snapshots to SBS (Scaleway Block Storage). To be used, the call to this endpoint must be preceded by a call to the [Get a volume or snapshot's migration plan](#path-volumes-get-a-volume-or-snapshots-migration-plan) endpoint. To migrate all resources mentioned in the migration plan, the validation_key returned in the plan must be provided.
1145
+ *
1146
+ * @param request - The request {@link ApplyBlockMigrationRequest}
1147
+ */
1148
+ applyBlockMigration = (request) => this.client.fetch({
1149
+ body: JSON.stringify(
1150
+ marshalApplyBlockMigrationRequest(request, this.client.settings)
1151
+ ),
1152
+ headers: jsonContentHeaders,
1153
+ method: "POST",
1154
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/block-migration/apply`
1155
+ });
1156
+ checkBlockMigrationOrganizationQuotas = (request = {}) => this.client.fetch({
1157
+ body: JSON.stringify(
1158
+ marshalCheckBlockMigrationOrganizationQuotasRequest(
1159
+ request,
1160
+ this.client.settings
1161
+ )
1162
+ ),
1163
+ headers: jsonContentHeaders,
1164
+ method: "POST",
1165
+ path: `/instance/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/block-migration/check-organization-quotas`
1166
+ });
1167
+ }
1168
+ export {
1169
+ API
1170
+ };