@scaleway/sdk-baremetal 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,590 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const sdkClient = require("@scaleway/sdk-client");
4
+ const content_gen = require("./content.gen.cjs");
5
+ const marshalling_gen = require("./marshalling.gen.cjs");
6
+ const jsonContentHeaders = {
7
+ "Content-Type": "application/json; charset=utf-8"
8
+ };
9
+ class API extends sdkClient.API {
10
+ /** Lists the available zones of the API. */
11
+ static LOCALITIES = [
12
+ "fr-par-1",
13
+ "fr-par-2",
14
+ "nl-ams-1",
15
+ "nl-ams-2",
16
+ "pl-waw-2",
17
+ "pl-waw-3"
18
+ ];
19
+ pageOfListServers = (request = {}) => this.client.fetch(
20
+ {
21
+ method: "GET",
22
+ path: `/baremetal/v1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers`,
23
+ urlParams: sdkClient.urlParams(
24
+ ["name", request.name],
25
+ ["option_id", request.optionId],
26
+ ["order_by", request.orderBy],
27
+ ["organization_id", request.organizationId],
28
+ ["page", request.page],
29
+ [
30
+ "page_size",
31
+ request.pageSize ?? this.client.settings.defaultPageSize
32
+ ],
33
+ ["project_id", request.projectId],
34
+ ["status", request.status],
35
+ ["tags", request.tags]
36
+ )
37
+ },
38
+ marshalling_gen.unmarshalListServersResponse
39
+ );
40
+ /**
41
+ * List Elastic Metal servers for an Organization. List Elastic Metal servers for a specific Organization.
42
+ *
43
+ * @param request - The request {@link ListServersRequest}
44
+ * @returns A Promise of ListServersResponse
45
+ */
46
+ listServers = (request = {}) => sdkClient.enrichForPagination("servers", this.pageOfListServers, request);
47
+ /**
48
+ * Get a specific Elastic Metal server. Get full details of an existing Elastic Metal server associated with the ID.
49
+ *
50
+ * @param request - The request {@link GetServerRequest}
51
+ * @returns A Promise of Server
52
+ */
53
+ getServer = (request) => this.client.fetch(
54
+ {
55
+ method: "GET",
56
+ path: `/baremetal/v1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${sdkClient.validatePathParam("serverId", request.serverId)}`
57
+ },
58
+ marshalling_gen.unmarshalServer
59
+ );
60
+ /**
61
+ * Waits for {@link Server} to be in a final state.
62
+ *
63
+ * @param request - The request {@link GetServerRequest}
64
+ * @param options - The waiting options
65
+ * @returns A Promise of Server
66
+ */
67
+ waitForServer = (request, options) => sdkClient.waitForResource(
68
+ options?.stop ?? ((res) => Promise.resolve(
69
+ !content_gen.SERVER_TRANSIENT_STATUSES.includes(res.status)
70
+ )),
71
+ this.getServer,
72
+ request,
73
+ options
74
+ );
75
+ /**
76
+ * Create an Elastic Metal server. Create a new Elastic Metal server. Once the server is created, proceed with the [installation of an OS](#post-3e949e).
77
+ *
78
+ * @param request - The request {@link CreateServerRequest}
79
+ * @returns A Promise of Server
80
+ */
81
+ createServer = (request) => this.client.fetch(
82
+ {
83
+ body: JSON.stringify(
84
+ marshalling_gen.marshalCreateServerRequest(request, this.client.settings)
85
+ ),
86
+ headers: jsonContentHeaders,
87
+ method: "POST",
88
+ path: `/baremetal/v1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers`
89
+ },
90
+ marshalling_gen.unmarshalServer
91
+ );
92
+ /**
93
+ * Update an Elastic Metal server. Update the server associated with the ID. You can update parameters such as the server's name, tags and description. Any parameters left null in the request body are not updated.
94
+ *
95
+ * @param request - The request {@link UpdateServerRequest}
96
+ * @returns A Promise of Server
97
+ */
98
+ updateServer = (request) => this.client.fetch(
99
+ {
100
+ body: JSON.stringify(
101
+ marshalling_gen.marshalUpdateServerRequest(request, this.client.settings)
102
+ ),
103
+ headers: jsonContentHeaders,
104
+ method: "PATCH",
105
+ path: `/baremetal/v1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${sdkClient.validatePathParam("serverId", request.serverId)}`
106
+ },
107
+ marshalling_gen.unmarshalServer
108
+ );
109
+ /**
110
+ * Install an Elastic Metal server. Install an Operating System (OS) on the Elastic Metal server with a specific ID.
111
+ *
112
+ * @param request - The request {@link InstallServerRequest}
113
+ * @returns A Promise of Server
114
+ */
115
+ installServer = (request) => this.client.fetch(
116
+ {
117
+ body: JSON.stringify(
118
+ marshalling_gen.marshalInstallServerRequest(request, this.client.settings)
119
+ ),
120
+ headers: jsonContentHeaders,
121
+ method: "POST",
122
+ path: `/baremetal/v1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${sdkClient.validatePathParam("serverId", request.serverId)}/install`
123
+ },
124
+ marshalling_gen.unmarshalServer
125
+ );
126
+ /**
127
+ * Return server metrics. Get the ping status of the server associated with the ID.
128
+ *
129
+ * @param request - The request {@link GetServerMetricsRequest}
130
+ * @returns A Promise of GetServerMetricsResponse
131
+ */
132
+ getServerMetrics = (request) => this.client.fetch(
133
+ {
134
+ method: "GET",
135
+ path: `/baremetal/v1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${sdkClient.validatePathParam("serverId", request.serverId)}/metrics`
136
+ },
137
+ marshalling_gen.unmarshalGetServerMetricsResponse
138
+ );
139
+ /**
140
+ * Delete an Elastic Metal server. Delete the server associated with the ID.
141
+ *
142
+ * @param request - The request {@link DeleteServerRequest}
143
+ * @returns A Promise of Server
144
+ */
145
+ deleteServer = (request) => this.client.fetch(
146
+ {
147
+ method: "DELETE",
148
+ path: `/baremetal/v1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${sdkClient.validatePathParam("serverId", request.serverId)}`
149
+ },
150
+ marshalling_gen.unmarshalServer
151
+ );
152
+ /**
153
+ * Reboot an Elastic Metal server. Reboot the Elastic Metal server associated with the ID, use the `boot_type` `rescue` to reboot the server in rescue mode.
154
+ *
155
+ * @param request - The request {@link RebootServerRequest}
156
+ * @returns A Promise of Server
157
+ */
158
+ rebootServer = (request) => this.client.fetch(
159
+ {
160
+ body: JSON.stringify(
161
+ marshalling_gen.marshalRebootServerRequest(request, this.client.settings)
162
+ ),
163
+ headers: jsonContentHeaders,
164
+ method: "POST",
165
+ path: `/baremetal/v1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${sdkClient.validatePathParam("serverId", request.serverId)}/reboot`
166
+ },
167
+ marshalling_gen.unmarshalServer
168
+ );
169
+ /**
170
+ * Start an Elastic Metal server. Start the server associated with the ID.
171
+ *
172
+ * @param request - The request {@link StartServerRequest}
173
+ * @returns A Promise of Server
174
+ */
175
+ startServer = (request) => this.client.fetch(
176
+ {
177
+ body: JSON.stringify(
178
+ marshalling_gen.marshalStartServerRequest(request, this.client.settings)
179
+ ),
180
+ headers: jsonContentHeaders,
181
+ method: "POST",
182
+ path: `/baremetal/v1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${sdkClient.validatePathParam("serverId", request.serverId)}/start`
183
+ },
184
+ marshalling_gen.unmarshalServer
185
+ );
186
+ /**
187
+ * Stop an Elastic Metal server. Stop the server associated with the ID. The server remains allocated to your account and all data remains on the local storage of the server.
188
+ *
189
+ * @param request - The request {@link StopServerRequest}
190
+ * @returns A Promise of Server
191
+ */
192
+ stopServer = (request) => this.client.fetch(
193
+ {
194
+ body: "{}",
195
+ headers: jsonContentHeaders,
196
+ method: "POST",
197
+ path: `/baremetal/v1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${sdkClient.validatePathParam("serverId", request.serverId)}/stop`
198
+ },
199
+ marshalling_gen.unmarshalServer
200
+ );
201
+ pageOfListServerEvents = (request) => this.client.fetch(
202
+ {
203
+ method: "GET",
204
+ path: `/baremetal/v1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${sdkClient.validatePathParam("serverId", request.serverId)}/events`,
205
+ urlParams: sdkClient.urlParams(
206
+ ["order_by", request.orderBy],
207
+ ["page", request.page],
208
+ [
209
+ "page_size",
210
+ request.pageSize ?? this.client.settings.defaultPageSize
211
+ ]
212
+ )
213
+ },
214
+ marshalling_gen.unmarshalListServerEventsResponse
215
+ );
216
+ /**
217
+ * List server events. List event (i.e. start/stop/reboot) associated to the server ID.
218
+ *
219
+ * @param request - The request {@link ListServerEventsRequest}
220
+ * @returns A Promise of ListServerEventsResponse
221
+ */
222
+ listServerEvents = (request) => sdkClient.enrichForPagination("events", this.pageOfListServerEvents, request);
223
+ /**
224
+ * Get default partitioning schema. Get the default partitioning schema for the given offer ID and OS ID.
225
+ *
226
+ * @param request - The request {@link GetDefaultPartitioningSchemaRequest}
227
+ * @returns A Promise of Schema
228
+ */
229
+ getDefaultPartitioningSchema = (request) => this.client.fetch(
230
+ {
231
+ method: "GET",
232
+ path: `/baremetal/v1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/partitioning-schemas/default`,
233
+ urlParams: sdkClient.urlParams(
234
+ ["offer_id", request.offerId],
235
+ ["os_id", request.osId]
236
+ )
237
+ },
238
+ marshalling_gen.unmarshalSchema
239
+ );
240
+ /**
241
+ * Validate client partitioning schema. Validate the incoming partitioning schema from a user before installing the server. Return default ErrorCode if invalid.
242
+ *
243
+ * @param request - The request {@link ValidatePartitioningSchemaRequest}
244
+ */
245
+ validatePartitioningSchema = (request) => this.client.fetch({
246
+ body: JSON.stringify(
247
+ marshalling_gen.marshalValidatePartitioningSchemaRequest(request, this.client.settings)
248
+ ),
249
+ headers: jsonContentHeaders,
250
+ method: "POST",
251
+ path: `/baremetal/v1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/partitioning-schemas/validate`
252
+ });
253
+ /**
254
+ * Start BMC access. Start BMC (Baseboard Management Controller) access associated with the ID.
255
+ The BMC (Baseboard Management Controller) access is available one hour after the installation of the server.
256
+ You need first to create an option Remote Access. You will find the ID and the price with a call to listOffers (https://developers.scaleway.com/en/products/baremetal/api/#get-78db92). Then add the option https://developers.scaleway.com/en/products/baremetal/api/#post-b14abd.
257
+ After adding the BMC option, you need to Get Remote Access to get the login/password https://developers.scaleway.com/en/products/baremetal/api/#get-cefc0f. Do not forget to delete the Option after use.
258
+ *
259
+ * @param request - The request {@link StartBMCAccessRequest}
260
+ * @returns A Promise of BMCAccess
261
+ */
262
+ startBMCAccess = (request) => this.client.fetch(
263
+ {
264
+ body: JSON.stringify(
265
+ marshalling_gen.marshalStartBMCAccessRequest(request, this.client.settings)
266
+ ),
267
+ headers: jsonContentHeaders,
268
+ method: "POST",
269
+ path: `/baremetal/v1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${sdkClient.validatePathParam("serverId", request.serverId)}/bmc-access`
270
+ },
271
+ marshalling_gen.unmarshalBMCAccess
272
+ );
273
+ /**
274
+ * Get BMC access. Get the BMC (Baseboard Management Controller) access associated with the ID, including the URL and login information needed to connect.
275
+ *
276
+ * @param request - The request {@link GetBMCAccessRequest}
277
+ * @returns A Promise of BMCAccess
278
+ */
279
+ getBMCAccess = (request) => this.client.fetch(
280
+ {
281
+ method: "GET",
282
+ path: `/baremetal/v1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${sdkClient.validatePathParam("serverId", request.serverId)}/bmc-access`
283
+ },
284
+ marshalling_gen.unmarshalBMCAccess
285
+ );
286
+ /**
287
+ * Stop BMC access. Stop BMC (Baseboard Management Controller) access associated with the ID.
288
+ *
289
+ * @param request - The request {@link StopBMCAccessRequest}
290
+ */
291
+ stopBMCAccess = (request) => this.client.fetch({
292
+ method: "DELETE",
293
+ path: `/baremetal/v1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${sdkClient.validatePathParam("serverId", request.serverId)}/bmc-access`
294
+ });
295
+ /**
296
+ * Update IP. Configure the IP address associated with the server ID and IP ID. You can use this method to set a reverse DNS for an IP address.
297
+ *
298
+ * @param request - The request {@link UpdateIPRequest}
299
+ * @returns A Promise of IP
300
+ */
301
+ updateIP = (request) => this.client.fetch(
302
+ {
303
+ body: JSON.stringify(
304
+ marshalling_gen.marshalUpdateIPRequest(request, this.client.settings)
305
+ ),
306
+ headers: jsonContentHeaders,
307
+ method: "PATCH",
308
+ path: `/baremetal/v1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${sdkClient.validatePathParam("serverId", request.serverId)}/ips/${sdkClient.validatePathParam("ipId", request.ipId)}`
309
+ },
310
+ marshalling_gen.unmarshalIP
311
+ );
312
+ /**
313
+ * Add server option. Add an option, such as Private Networks, to a specific server.
314
+ *
315
+ * @param request - The request {@link AddOptionServerRequest}
316
+ * @returns A Promise of Server
317
+ */
318
+ addOptionServer = (request) => this.client.fetch(
319
+ {
320
+ body: JSON.stringify(
321
+ marshalling_gen.marshalAddOptionServerRequest(request, this.client.settings)
322
+ ),
323
+ headers: jsonContentHeaders,
324
+ method: "POST",
325
+ path: `/baremetal/v1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${sdkClient.validatePathParam("serverId", request.serverId)}/options/${sdkClient.validatePathParam("optionId", request.optionId)}`
326
+ },
327
+ marshalling_gen.unmarshalServer
328
+ );
329
+ /**
330
+ * Delete server option. Delete an option from a specific server.
331
+ *
332
+ * @param request - The request {@link DeleteOptionServerRequest}
333
+ * @returns A Promise of Server
334
+ */
335
+ deleteOptionServer = (request) => this.client.fetch(
336
+ {
337
+ method: "DELETE",
338
+ path: `/baremetal/v1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${sdkClient.validatePathParam("serverId", request.serverId)}/options/${sdkClient.validatePathParam("optionId", request.optionId)}`
339
+ },
340
+ marshalling_gen.unmarshalServer
341
+ );
342
+ /**
343
+ * Migrate server offer. Migrate server with hourly offer to monthly offer.
344
+ *
345
+ * @param request - The request {@link MigrateServerToMonthlyOfferRequest}
346
+ * @returns A Promise of Server
347
+ */
348
+ migrateServerToMonthlyOffer = (request) => this.client.fetch(
349
+ {
350
+ method: "POST",
351
+ path: `/baremetal/v1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${sdkClient.validatePathParam("serverId", request.serverId)}/migrate-offer-monthly`
352
+ },
353
+ marshalling_gen.unmarshalServer
354
+ );
355
+ pageOfListOffers = (request = {}) => this.client.fetch(
356
+ {
357
+ method: "GET",
358
+ path: `/baremetal/v1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/offers`,
359
+ urlParams: sdkClient.urlParams(
360
+ ["name", request.name],
361
+ ["page", request.page],
362
+ [
363
+ "page_size",
364
+ request.pageSize ?? this.client.settings.defaultPageSize
365
+ ],
366
+ ["subscription_period", request.subscriptionPeriod]
367
+ )
368
+ },
369
+ marshalling_gen.unmarshalListOffersResponse
370
+ );
371
+ /**
372
+ * List offers. List all available Elastic Metal server configurations.
373
+ *
374
+ * @param request - The request {@link ListOffersRequest}
375
+ * @returns A Promise of ListOffersResponse
376
+ */
377
+ listOffers = (request = {}) => sdkClient.enrichForPagination("offers", this.pageOfListOffers, request);
378
+ /**
379
+ * Get offer. Get details of an offer identified by its offer ID.
380
+ *
381
+ * @param request - The request {@link GetOfferRequest}
382
+ * @returns A Promise of Offer
383
+ */
384
+ getOffer = (request) => this.client.fetch(
385
+ {
386
+ method: "GET",
387
+ path: `/baremetal/v1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/offers/${sdkClient.validatePathParam("offerId", request.offerId)}`
388
+ },
389
+ marshalling_gen.unmarshalOffer
390
+ );
391
+ /**
392
+ * Get option. Return specific option for the ID.
393
+ *
394
+ * @param request - The request {@link GetOptionRequest}
395
+ * @returns A Promise of Option
396
+ */
397
+ getOption = (request) => this.client.fetch(
398
+ {
399
+ method: "GET",
400
+ path: `/baremetal/v1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/options/${sdkClient.validatePathParam("optionId", request.optionId)}`
401
+ },
402
+ marshalling_gen.unmarshalOption
403
+ );
404
+ pageOfListOptions = (request = {}) => this.client.fetch(
405
+ {
406
+ method: "GET",
407
+ path: `/baremetal/v1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/options`,
408
+ urlParams: sdkClient.urlParams(
409
+ ["name", request.name],
410
+ ["offer_id", request.offerId],
411
+ ["page", request.page],
412
+ [
413
+ "page_size",
414
+ request.pageSize ?? this.client.settings.defaultPageSize
415
+ ]
416
+ )
417
+ },
418
+ marshalling_gen.unmarshalListOptionsResponse
419
+ );
420
+ /**
421
+ * List options. List all options matching with filters.
422
+ *
423
+ * @param request - The request {@link ListOptionsRequest}
424
+ * @returns A Promise of ListOptionsResponse
425
+ */
426
+ listOptions = (request = {}) => sdkClient.enrichForPagination("options", this.pageOfListOptions, request);
427
+ pageOfListSettings = (request = {}) => this.client.fetch(
428
+ {
429
+ method: "GET",
430
+ path: `/baremetal/v1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/settings`,
431
+ urlParams: sdkClient.urlParams(
432
+ ["order_by", request.orderBy],
433
+ ["page", request.page],
434
+ [
435
+ "page_size",
436
+ request.pageSize ?? this.client.settings.defaultPageSize
437
+ ],
438
+ [
439
+ "project_id",
440
+ request.projectId ?? this.client.settings.defaultProjectId
441
+ ]
442
+ )
443
+ },
444
+ marshalling_gen.unmarshalListSettingsResponse
445
+ );
446
+ /**
447
+ * List all settings. Return all settings for a Project ID.
448
+ *
449
+ * @param request - The request {@link ListSettingsRequest}
450
+ * @returns A Promise of ListSettingsResponse
451
+ */
452
+ listSettings = (request = {}) => sdkClient.enrichForPagination("settings", this.pageOfListSettings, request);
453
+ /**
454
+ * Update setting. Update a setting for a Project ID (enable or disable).
455
+ *
456
+ * @param request - The request {@link UpdateSettingRequest}
457
+ * @returns A Promise of Setting
458
+ */
459
+ updateSetting = (request) => this.client.fetch(
460
+ {
461
+ body: JSON.stringify(
462
+ marshalling_gen.marshalUpdateSettingRequest(request, this.client.settings)
463
+ ),
464
+ headers: jsonContentHeaders,
465
+ method: "PATCH",
466
+ path: `/baremetal/v1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/settings/${sdkClient.validatePathParam("settingId", request.settingId)}`
467
+ },
468
+ marshalling_gen.unmarshalSetting
469
+ );
470
+ pageOfListOS = (request = {}) => this.client.fetch(
471
+ {
472
+ method: "GET",
473
+ path: `/baremetal/v1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/os`,
474
+ urlParams: sdkClient.urlParams(
475
+ ["offer_id", request.offerId],
476
+ ["page", request.page],
477
+ [
478
+ "page_size",
479
+ request.pageSize ?? this.client.settings.defaultPageSize
480
+ ]
481
+ )
482
+ },
483
+ marshalling_gen.unmarshalListOSResponse
484
+ );
485
+ /**
486
+ * List available OSes. List all OSes that are available for installation on Elastic Metal servers.
487
+ *
488
+ * @param request - The request {@link ListOSRequest}
489
+ * @returns A Promise of ListOSResponse
490
+ */
491
+ listOS = (request = {}) => sdkClient.enrichForPagination("os", this.pageOfListOS, request);
492
+ /**
493
+ * Get OS with an ID. Return the specific OS for the ID.
494
+ *
495
+ * @param request - The request {@link GetOSRequest}
496
+ * @returns A Promise of OS
497
+ */
498
+ getOS = (request) => this.client.fetch(
499
+ {
500
+ method: "GET",
501
+ path: `/baremetal/v1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/os/${sdkClient.validatePathParam("osId", request.osId)}`
502
+ },
503
+ marshalling_gen.unmarshalOS
504
+ );
505
+ }
506
+ class PrivateNetworkAPI extends sdkClient.API {
507
+ /** Lists the available zones of the API. */
508
+ static LOCALITIES = ["fr-par-2"];
509
+ /**
510
+ * Add a server to a Private Network.
511
+ *
512
+ * @param request - The request {@link PrivateNetworkApiAddServerPrivateNetworkRequest}
513
+ * @returns A Promise of ServerPrivateNetwork
514
+ */
515
+ addServerPrivateNetwork = (request) => this.client.fetch(
516
+ {
517
+ body: JSON.stringify(
518
+ marshalling_gen.marshalPrivateNetworkApiAddServerPrivateNetworkRequest(
519
+ request,
520
+ this.client.settings
521
+ )
522
+ ),
523
+ headers: jsonContentHeaders,
524
+ method: "POST",
525
+ path: `/baremetal/v1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${sdkClient.validatePathParam("serverId", request.serverId)}/private-networks`
526
+ },
527
+ marshalling_gen.unmarshalServerPrivateNetwork
528
+ );
529
+ /**
530
+ * Set multiple Private Networks on a server.
531
+ *
532
+ * @param request - The request {@link PrivateNetworkApiSetServerPrivateNetworksRequest}
533
+ * @returns A Promise of SetServerPrivateNetworksResponse
534
+ */
535
+ setServerPrivateNetworks = (request) => this.client.fetch(
536
+ {
537
+ body: JSON.stringify(
538
+ marshalling_gen.marshalPrivateNetworkApiSetServerPrivateNetworksRequest(
539
+ request,
540
+ this.client.settings
541
+ )
542
+ ),
543
+ headers: jsonContentHeaders,
544
+ method: "PUT",
545
+ path: `/baremetal/v1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${sdkClient.validatePathParam("serverId", request.serverId)}/private-networks`
546
+ },
547
+ marshalling_gen.unmarshalSetServerPrivateNetworksResponse
548
+ );
549
+ pageOfListServerPrivateNetworks = (request = {}) => this.client.fetch(
550
+ {
551
+ method: "GET",
552
+ path: `/baremetal/v1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/server-private-networks`,
553
+ urlParams: sdkClient.urlParams(
554
+ ["order_by", request.orderBy],
555
+ ["organization_id", request.organizationId],
556
+ ["page", request.page],
557
+ [
558
+ "page_size",
559
+ request.pageSize ?? this.client.settings.defaultPageSize
560
+ ],
561
+ ["private_network_id", request.privateNetworkId],
562
+ ["project_id", request.projectId],
563
+ ["server_id", request.serverId]
564
+ )
565
+ },
566
+ marshalling_gen.unmarshalListServerPrivateNetworksResponse
567
+ );
568
+ /**
569
+ * List the Private Networks of a server.
570
+ *
571
+ * @param request - The request {@link PrivateNetworkApiListServerPrivateNetworksRequest}
572
+ * @returns A Promise of ListServerPrivateNetworksResponse
573
+ */
574
+ listServerPrivateNetworks = (request = {}) => sdkClient.enrichForPagination(
575
+ "serverPrivateNetworks",
576
+ this.pageOfListServerPrivateNetworks,
577
+ request
578
+ );
579
+ /**
580
+ * Delete a Private Network.
581
+ *
582
+ * @param request - The request {@link PrivateNetworkApiDeleteServerPrivateNetworkRequest}
583
+ */
584
+ deleteServerPrivateNetwork = (request) => this.client.fetch({
585
+ method: "DELETE",
586
+ path: `/baremetal/v1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${sdkClient.validatePathParam("serverId", request.serverId)}/private-networks/${sdkClient.validatePathParam("privateNetworkId", request.privateNetworkId)}`
587
+ });
588
+ }
589
+ exports.API = API;
590
+ exports.PrivateNetworkAPI = PrivateNetworkAPI;