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