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