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