@scaleway/sdk-baremetal 1.2.0 → 2.1.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.
- package/README.md +96 -0
- package/dist/v1/api.gen.d.ts +2 -2
- package/dist/v1/api.gen.js +39 -67
- package/dist/v1/content.gen.js +4 -1
- package/dist/v1/index.gen.d.ts +1 -1
- package/dist/v1/marshalling.gen.d.ts +2 -2
- package/dist/v1/marshalling.gen.js +18 -34
- package/dist/v1/types.gen.d.ts +26 -2
- package/dist/v3/api.gen.d.ts +1 -1
- package/dist/v3/api.gen.js +10 -21
- package/dist/v3/content.gen.js +4 -1
- package/dist/v3/index.gen.d.ts +1 -1
- package/dist/v3/marshalling.gen.js +2 -8
- package/package.json +6 -9
- package/dist/index.gen.cjs +0 -6
- package/dist/v1/api.gen.cjs +0 -600
- package/dist/v1/content.gen.cjs +0 -19
- package/dist/v1/index.gen.cjs +0 -43
- package/dist/v1/marshalling.gen.cjs +0 -725
- package/dist/v1/validation-rules.gen.cjs +0 -116
- package/dist/v3/api.gen.cjs +0 -104
- package/dist/v3/content.gen.cjs +0 -4
- package/dist/v3/index.gen.cjs +0 -12
- package/dist/v3/marshalling.gen.cjs +0 -60
package/README.md
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# @scaleway/sdk-baremetal
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@scaleway/sdk-baremetal)
|
|
4
|
+
[](https://www.npmjs.com/package/@scaleway/sdk-baremetal)
|
|
5
|
+
[](https://github.com/scaleway/scaleway-sdk-js/blob/master/LICENSE)
|
|
6
|
+
|
|
7
|
+
Scaleway SDK for Baremetal API.
|
|
8
|
+
|
|
9
|
+
> **Note**
|
|
10
|
+
> This is an automatically generated package that is part of the [Scaleway SDK for JavaScript](https://github.com/scaleway/scaleway-sdk-js).
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install @scaleway/sdk-baremetal @scaleway/sdk-client
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
or with pnpm:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
pnpm add @scaleway/sdk-baremetal @scaleway/sdk-client
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
or with yarn:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
yarn add @scaleway/sdk-baremetal @scaleway/sdk-client
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Getting Started
|
|
31
|
+
|
|
32
|
+
You'll need a pair of access and secret keys to connect to Scaleway API. Please check the [documentation](https://www.scaleway.com/en/docs/identity-and-access-management/iam/how-to/create-api-keys/) on how to retrieve them.
|
|
33
|
+
|
|
34
|
+
### Basic Usage
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
import { createClient } from '@scaleway/sdk-client'
|
|
38
|
+
import { Baremetal } from '@scaleway/sdk-baremetal'
|
|
39
|
+
|
|
40
|
+
const client = createClient({
|
|
41
|
+
accessKey: 'SCWXXXXXXXXXXXXXXXXX',
|
|
42
|
+
secretKey: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
|
|
43
|
+
defaultProjectId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
|
|
44
|
+
defaultRegion: 'fr-par',
|
|
45
|
+
defaultZone: 'fr-par-1',
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
const api = new Baremetal.v1.API(client)
|
|
49
|
+
|
|
50
|
+
// Use the API
|
|
51
|
+
// Example: await api.listServers()
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Using Configuration Loader
|
|
55
|
+
|
|
56
|
+
For a simpler setup, you can load credentials from the configuration file or environment variables:
|
|
57
|
+
|
|
58
|
+
```typescript
|
|
59
|
+
import { createClient } from '@scaleway/sdk-client'
|
|
60
|
+
import { loadProfileFromConfigurationFile } from '@scaleway/configuration-loader'
|
|
61
|
+
import { Baremetal } from '@scaleway/sdk-baremetal'
|
|
62
|
+
|
|
63
|
+
const profile = loadProfileFromConfigurationFile()
|
|
64
|
+
const client = createClient(profile)
|
|
65
|
+
const api = new Baremetal.v1.API(client)
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Documentation
|
|
69
|
+
|
|
70
|
+
- 📚 [Scaleway SDK Reference Documentation](https://scaleway.github.io/scaleway-sdk-js)
|
|
71
|
+
- 🌐 [Scaleway Baremetal API Documentation](https://www.scaleway.com/en/developers/api/baremetal/)
|
|
72
|
+
- 📖 [Main Repository](https://github.com/scaleway/scaleway-sdk-js)
|
|
73
|
+
- 💡 [Example Projects](https://github.com/scaleway/scaleway-sdk-js/tree/master/examples)
|
|
74
|
+
|
|
75
|
+
## Features
|
|
76
|
+
|
|
77
|
+
- ✅ Full TypeScript support with complete type definitions
|
|
78
|
+
- ✅ Promise-based API
|
|
79
|
+
- ✅ Automatic pagination helpers
|
|
80
|
+
- ✅ Built-in error handling
|
|
81
|
+
- ✅ Compatible with Node.js ≥ 20
|
|
82
|
+
|
|
83
|
+
## Support
|
|
84
|
+
|
|
85
|
+
We love feedback! Feel free to reach us on:
|
|
86
|
+
- [Scaleway Slack community](https://slack.scaleway.com/) - Join us on [#opensource](https://scaleway-community.slack.com/app_redirect?channel=opensource)
|
|
87
|
+
- [GitHub Issues](https://github.com/scaleway/scaleway-sdk-js/issues)
|
|
88
|
+
|
|
89
|
+
## Contributing
|
|
90
|
+
|
|
91
|
+
This repository is at its early stage and is still in active development. If you are looking for a way to contribute, please read [CONTRIBUTING.md](https://github.com/scaleway/scaleway-sdk-js/blob/master/CONTRIBUTING.md).
|
|
92
|
+
|
|
93
|
+
## License
|
|
94
|
+
|
|
95
|
+
This project is Apache 2.0 licensed. See the [LICENSE](https://github.com/scaleway/scaleway-sdk-js/blob/master/LICENSE) file for details.
|
|
96
|
+
|
package/dist/v1/api.gen.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { API as ParentAPI } from '@scaleway/sdk-client';
|
|
2
1
|
import type { ApiLocality, WaitForOptions } from '@scaleway/sdk-client';
|
|
3
|
-
import
|
|
2
|
+
import { API as ParentAPI } from '@scaleway/sdk-client';
|
|
3
|
+
import type { AddOptionServerRequest, BMCAccess, CreateServerRequest, DeleteOptionServerRequest, DeleteServerRequest, GetBMCAccessRequest, GetDefaultPartitioningSchemaRequest, GetOfferRequest, GetOptionRequest, GetOSRequest, GetServerMetricsRequest, GetServerMetricsResponse, GetServerRequest, InstallServerRequest, IP, ListOffersRequest, ListOffersResponse, ListOptionsRequest, ListOptionsResponse, ListOSRequest, ListOSResponse, ListServerEventsRequest, ListServerEventsResponse, ListServerPrivateNetworksResponse, ListServersRequest, ListServersResponse, ListSettingsRequest, ListSettingsResponse, MigrateServerToMonthlyOfferRequest, Offer, Option, OS, PrivateNetworkApiAddServerPrivateNetworkRequest, PrivateNetworkApiDeleteServerPrivateNetworkRequest, PrivateNetworkApiListServerPrivateNetworksRequest, PrivateNetworkApiSetServerPrivateNetworksRequest, RebootServerRequest, Schema, Server, ServerPrivateNetwork, SetServerPrivateNetworksResponse, Setting, StartBMCAccessRequest, StartServerRequest, StopBMCAccessRequest, StopServerRequest, UpdateIPRequest, UpdateServerRequest, UpdateSettingRequest, ValidatePartitioningSchemaRequest } from './types.gen.js';
|
|
4
4
|
/**
|
|
5
5
|
* Elastic Metal API.
|
|
6
6
|
|
package/dist/v1/api.gen.js
CHANGED
|
@@ -29,10 +29,7 @@ class API extends API$1 {
|
|
|
29
29
|
["order_by", request.orderBy],
|
|
30
30
|
["organization_id", request.organizationId],
|
|
31
31
|
["page", request.page],
|
|
32
|
-
[
|
|
33
|
-
"page_size",
|
|
34
|
-
request.pageSize ?? this.client.settings.defaultPageSize
|
|
35
|
-
],
|
|
32
|
+
["page_size", request.pageSize ?? this.client.settings.defaultPageSize],
|
|
36
33
|
["project_id", request.projectId],
|
|
37
34
|
["status", request.status],
|
|
38
35
|
["tags", request.tags]
|
|
@@ -68,9 +65,7 @@ class API extends API$1 {
|
|
|
68
65
|
* @returns A Promise of Server
|
|
69
66
|
*/
|
|
70
67
|
waitForServer = (request, options) => waitForResource(
|
|
71
|
-
options?.stop ?? ((res) => Promise.resolve(
|
|
72
|
-
!SERVER_TRANSIENT_STATUSES.includes(res.status)
|
|
73
|
-
)),
|
|
68
|
+
options?.stop ?? ((res) => Promise.resolve(!SERVER_TRANSIENT_STATUSES.includes(res.status))),
|
|
74
69
|
this.getServer,
|
|
75
70
|
request,
|
|
76
71
|
options
|
|
@@ -115,10 +110,10 @@ class API extends API$1 {
|
|
|
115
110
|
* @param request - The request {@link InstallServerRequest}
|
|
116
111
|
* @returns A Promise of Server
|
|
117
112
|
*/
|
|
118
|
-
installServer = (request) => this.client.fetch(
|
|
113
|
+
installServer = async (request) => this.client.fetch(
|
|
119
114
|
{
|
|
120
115
|
body: JSON.stringify(
|
|
121
|
-
marshalInstallServerRequest(request, this.client.settings)
|
|
116
|
+
await marshalInstallServerRequest(request, this.client.settings)
|
|
122
117
|
),
|
|
123
118
|
headers: jsonContentHeaders,
|
|
124
119
|
method: "POST",
|
|
@@ -208,10 +203,7 @@ class API extends API$1 {
|
|
|
208
203
|
urlParams: urlParams(
|
|
209
204
|
["order_by", request.orderBy],
|
|
210
205
|
["page", request.page],
|
|
211
|
-
[
|
|
212
|
-
"page_size",
|
|
213
|
-
request.pageSize ?? this.client.settings.defaultPageSize
|
|
214
|
-
]
|
|
206
|
+
["page_size", request.pageSize ?? this.client.settings.defaultPageSize]
|
|
215
207
|
)
|
|
216
208
|
},
|
|
217
209
|
unmarshalListServerEventsResponse
|
|
@@ -245,14 +237,16 @@ class API extends API$1 {
|
|
|
245
237
|
*
|
|
246
238
|
* @param request - The request {@link ValidatePartitioningSchemaRequest}
|
|
247
239
|
*/
|
|
248
|
-
validatePartitioningSchema = (request) => this.client.fetch(
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
240
|
+
validatePartitioningSchema = (request) => this.client.fetch(
|
|
241
|
+
{
|
|
242
|
+
body: JSON.stringify(
|
|
243
|
+
marshalValidatePartitioningSchemaRequest(request, this.client.settings)
|
|
244
|
+
),
|
|
245
|
+
headers: jsonContentHeaders,
|
|
246
|
+
method: "POST",
|
|
247
|
+
path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/partitioning-schemas/validate`
|
|
248
|
+
}
|
|
249
|
+
);
|
|
256
250
|
/**
|
|
257
251
|
* Start BMC access. Start BMC (Baseboard Management Controller) access associated with the ID.
|
|
258
252
|
The BMC (Baseboard Management Controller) access is available one hour after the installation of the server.
|
|
@@ -291,10 +285,12 @@ class API extends API$1 {
|
|
|
291
285
|
*
|
|
292
286
|
* @param request - The request {@link StopBMCAccessRequest}
|
|
293
287
|
*/
|
|
294
|
-
stopBMCAccess = (request) => this.client.fetch(
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
288
|
+
stopBMCAccess = (request) => this.client.fetch(
|
|
289
|
+
{
|
|
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
|
+
);
|
|
298
294
|
/**
|
|
299
295
|
* 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.
|
|
300
296
|
*
|
|
@@ -362,10 +358,7 @@ class API extends API$1 {
|
|
|
362
358
|
urlParams: urlParams(
|
|
363
359
|
["name", request.name],
|
|
364
360
|
["page", request.page],
|
|
365
|
-
[
|
|
366
|
-
"page_size",
|
|
367
|
-
request.pageSize ?? this.client.settings.defaultPageSize
|
|
368
|
-
],
|
|
361
|
+
["page_size", request.pageSize ?? this.client.settings.defaultPageSize],
|
|
369
362
|
["subscription_period", request.subscriptionPeriod]
|
|
370
363
|
)
|
|
371
364
|
},
|
|
@@ -412,10 +405,7 @@ class API extends API$1 {
|
|
|
412
405
|
["name", request.name],
|
|
413
406
|
["offer_id", request.offerId],
|
|
414
407
|
["page", request.page],
|
|
415
|
-
[
|
|
416
|
-
"page_size",
|
|
417
|
-
request.pageSize ?? this.client.settings.defaultPageSize
|
|
418
|
-
]
|
|
408
|
+
["page_size", request.pageSize ?? this.client.settings.defaultPageSize]
|
|
419
409
|
)
|
|
420
410
|
},
|
|
421
411
|
unmarshalListOptionsResponse
|
|
@@ -434,14 +424,8 @@ class API extends API$1 {
|
|
|
434
424
|
urlParams: urlParams(
|
|
435
425
|
["order_by", request.orderBy],
|
|
436
426
|
["page", request.page],
|
|
437
|
-
[
|
|
438
|
-
|
|
439
|
-
request.pageSize ?? this.client.settings.defaultPageSize
|
|
440
|
-
],
|
|
441
|
-
[
|
|
442
|
-
"project_id",
|
|
443
|
-
request.projectId ?? this.client.settings.defaultProjectId
|
|
444
|
-
]
|
|
427
|
+
["page_size", request.pageSize ?? this.client.settings.defaultPageSize],
|
|
428
|
+
["project_id", request.projectId ?? this.client.settings.defaultProjectId]
|
|
445
429
|
)
|
|
446
430
|
},
|
|
447
431
|
unmarshalListSettingsResponse
|
|
@@ -477,10 +461,7 @@ class API extends API$1 {
|
|
|
477
461
|
urlParams: urlParams(
|
|
478
462
|
["offer_id", request.offerId],
|
|
479
463
|
["page", request.page],
|
|
480
|
-
[
|
|
481
|
-
"page_size",
|
|
482
|
-
request.pageSize ?? this.client.settings.defaultPageSize
|
|
483
|
-
]
|
|
464
|
+
["page_size", request.pageSize ?? this.client.settings.defaultPageSize]
|
|
484
465
|
)
|
|
485
466
|
},
|
|
486
467
|
unmarshalListOSResponse
|
|
@@ -512,7 +493,9 @@ class PrivateNetworkAPI extends API$1 {
|
|
|
512
493
|
* type ∈ {'zone','region','global','unspecified'}
|
|
513
494
|
*/
|
|
514
495
|
static LOCALITY = toApiLocality({
|
|
515
|
-
zones: [
|
|
496
|
+
zones: [
|
|
497
|
+
"fr-par-2"
|
|
498
|
+
]
|
|
516
499
|
});
|
|
517
500
|
/**
|
|
518
501
|
* Add a server to a Private Network.
|
|
@@ -523,10 +506,7 @@ class PrivateNetworkAPI extends API$1 {
|
|
|
523
506
|
addServerPrivateNetwork = (request) => this.client.fetch(
|
|
524
507
|
{
|
|
525
508
|
body: JSON.stringify(
|
|
526
|
-
marshalPrivateNetworkApiAddServerPrivateNetworkRequest(
|
|
527
|
-
request,
|
|
528
|
-
this.client.settings
|
|
529
|
-
)
|
|
509
|
+
marshalPrivateNetworkApiAddServerPrivateNetworkRequest(request, this.client.settings)
|
|
530
510
|
),
|
|
531
511
|
headers: jsonContentHeaders,
|
|
532
512
|
method: "POST",
|
|
@@ -543,10 +523,7 @@ class PrivateNetworkAPI extends API$1 {
|
|
|
543
523
|
setServerPrivateNetworks = (request) => this.client.fetch(
|
|
544
524
|
{
|
|
545
525
|
body: JSON.stringify(
|
|
546
|
-
marshalPrivateNetworkApiSetServerPrivateNetworksRequest(
|
|
547
|
-
request,
|
|
548
|
-
this.client.settings
|
|
549
|
-
)
|
|
526
|
+
marshalPrivateNetworkApiSetServerPrivateNetworksRequest(request, this.client.settings)
|
|
550
527
|
),
|
|
551
528
|
headers: jsonContentHeaders,
|
|
552
529
|
method: "PUT",
|
|
@@ -562,10 +539,7 @@ class PrivateNetworkAPI extends API$1 {
|
|
|
562
539
|
["order_by", request.orderBy],
|
|
563
540
|
["organization_id", request.organizationId],
|
|
564
541
|
["page", request.page],
|
|
565
|
-
[
|
|
566
|
-
"page_size",
|
|
567
|
-
request.pageSize ?? this.client.settings.defaultPageSize
|
|
568
|
-
],
|
|
542
|
+
["page_size", request.pageSize ?? this.client.settings.defaultPageSize],
|
|
569
543
|
["private_network_id", request.privateNetworkId],
|
|
570
544
|
["project_id", request.projectId],
|
|
571
545
|
["server_id", request.serverId]
|
|
@@ -579,20 +553,18 @@ class PrivateNetworkAPI extends API$1 {
|
|
|
579
553
|
* @param request - The request {@link PrivateNetworkApiListServerPrivateNetworksRequest}
|
|
580
554
|
* @returns A Promise of ListServerPrivateNetworksResponse
|
|
581
555
|
*/
|
|
582
|
-
listServerPrivateNetworks = (request = {}) => enrichForPagination(
|
|
583
|
-
"serverPrivateNetworks",
|
|
584
|
-
this.pageOfListServerPrivateNetworks,
|
|
585
|
-
request
|
|
586
|
-
);
|
|
556
|
+
listServerPrivateNetworks = (request = {}) => enrichForPagination("serverPrivateNetworks", this.pageOfListServerPrivateNetworks, request);
|
|
587
557
|
/**
|
|
588
558
|
* Delete a Private Network.
|
|
589
559
|
*
|
|
590
560
|
* @param request - The request {@link PrivateNetworkApiDeleteServerPrivateNetworkRequest}
|
|
591
561
|
*/
|
|
592
|
-
deleteServerPrivateNetwork = (request) => this.client.fetch(
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
562
|
+
deleteServerPrivateNetwork = (request) => this.client.fetch(
|
|
563
|
+
{
|
|
564
|
+
method: "DELETE",
|
|
565
|
+
path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam("serverId", request.serverId)}/private-networks/${validatePathParam("privateNetworkId", request.privateNetworkId)}`
|
|
566
|
+
}
|
|
567
|
+
);
|
|
596
568
|
}
|
|
597
569
|
export {
|
|
598
570
|
API,
|
package/dist/v1/content.gen.js
CHANGED
|
@@ -2,7 +2,10 @@ const SERVER_INSTALL_TRANSIENT_STATUSES = [
|
|
|
2
2
|
"to_install",
|
|
3
3
|
"installing"
|
|
4
4
|
];
|
|
5
|
-
const SERVER_PRIVATE_NETWORK_TRANSIENT_STATUSES = [
|
|
5
|
+
const SERVER_PRIVATE_NETWORK_TRANSIENT_STATUSES = [
|
|
6
|
+
"attaching",
|
|
7
|
+
"detaching"
|
|
8
|
+
];
|
|
6
9
|
const SERVER_TRANSIENT_STATUSES = [
|
|
7
10
|
"delivering",
|
|
8
11
|
"stopping",
|
package/dist/v1/index.gen.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { API, PrivateNetworkAPI, } from './api.gen.js';
|
|
2
2
|
export * from './content.gen.js';
|
|
3
3
|
export * from './marshalling.gen.js';
|
|
4
|
-
export type { AddOptionServerRequest, BMCAccess,
|
|
4
|
+
export type { AddOptionServerRequest, BMCAccess, CertificationOption, CPU, CreateServerRequest, CreateServerRequestInstall, DeleteOptionServerRequest, DeleteServerRequest, Disk, GetBMCAccessRequest, GetDefaultPartitioningSchemaRequest, GetOfferRequest, GetOptionRequest, GetOSRequest, GetServerMetricsRequest, GetServerMetricsResponse, GetServerRequest, GPU, InstallServerRequest, IP, IPReverseStatus, IPVersion, LicenseOption, ListOffersRequest, ListOffersResponse, ListOptionsRequest, ListOptionsResponse, ListOSRequest, ListOSResponse, ListServerEventsRequest, ListServerEventsRequestOrderBy, ListServerEventsResponse, ListServerPrivateNetworksRequestOrderBy, ListServerPrivateNetworksResponse, ListServersRequest, ListServersRequestOrderBy, ListServersResponse, ListSettingsRequest, ListSettingsRequestOrderBy, ListSettingsResponse, Memory, MigrateServerToMonthlyOfferRequest, Offer, OfferOptionOffer, OfferStock, OfferSubscriptionPeriod, Option, OS, OSOSField, PersistentMemory, PrivateNetworkApiAddServerPrivateNetworkRequest, PrivateNetworkApiDeleteServerPrivateNetworkRequest, PrivateNetworkApiListServerPrivateNetworksRequest, PrivateNetworkApiSetServerPrivateNetworksRequest, PrivateNetworkOption, PublicBandwidthOption, RaidController, RebootServerRequest, RemoteAccessOption, Schema, SchemaDisk, SchemaFilesystem, SchemaFilesystemFormat, SchemaPartition, SchemaPartitionLabel, SchemaPool, SchemaPoolType, SchemaRAID, SchemaRAIDLevel, SchemaZFS, Server, ServerBootType, ServerEvent, ServerInstall, ServerInstallStatus, ServerOption, ServerOptionOptionStatus, ServerPingStatus, ServerPrivateNetwork, ServerPrivateNetworkStatus, ServerRescueServer, ServerStatus, SetServerPrivateNetworksResponse, Setting, SettingType, StartBMCAccessRequest, StartServerRequest, StopBMCAccessRequest, StopServerRequest, UpdateIPRequest, UpdateServerRequest, UpdateSettingRequest, ValidatePartitioningSchemaRequest, } from './types.gen.js';
|
|
5
5
|
export * as ValidationRules from './validation-rules.gen.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DefaultValues } from '@scaleway/sdk-client';
|
|
2
|
-
import type { AddOptionServerRequest, BMCAccess, CreateServerRequest, GetServerMetricsResponse,
|
|
2
|
+
import type { AddOptionServerRequest, BMCAccess, CreateServerRequest, GetServerMetricsResponse, InstallServerRequest, IP, ListOffersResponse, ListOptionsResponse, ListOSResponse, ListServerEventsResponse, ListServerPrivateNetworksResponse, ListServersResponse, ListSettingsResponse, Offer, Option, OS, PrivateNetworkApiAddServerPrivateNetworkRequest, PrivateNetworkApiSetServerPrivateNetworksRequest, RebootServerRequest, Schema, Server, ServerPrivateNetwork, SetServerPrivateNetworksResponse, Setting, StartBMCAccessRequest, StartServerRequest, UpdateIPRequest, UpdateServerRequest, UpdateSettingRequest, ValidatePartitioningSchemaRequest } from './types.gen.js';
|
|
3
3
|
export declare const unmarshalSchema: (data: unknown) => Schema;
|
|
4
4
|
export declare const unmarshalIP: (data: unknown) => IP;
|
|
5
5
|
export declare const unmarshalServer: (data: unknown) => Server;
|
|
@@ -21,7 +21,7 @@ export declare const unmarshalSetServerPrivateNetworksResponse: (data: unknown)
|
|
|
21
21
|
export declare const marshalSchema: (request: Schema, defaults: DefaultValues) => Record<string, unknown>;
|
|
22
22
|
export declare const marshalCreateServerRequest: (request: CreateServerRequest, defaults: DefaultValues) => Record<string, unknown>;
|
|
23
23
|
export declare const marshalAddOptionServerRequest: (request: AddOptionServerRequest, defaults: DefaultValues) => Record<string, unknown>;
|
|
24
|
-
export declare const marshalInstallServerRequest: (request: InstallServerRequest, defaults: DefaultValues) => Record<string, unknown
|
|
24
|
+
export declare const marshalInstallServerRequest: (request: InstallServerRequest, defaults: DefaultValues) => Promise<Record<string, unknown>>;
|
|
25
25
|
export declare const marshalPrivateNetworkApiAddServerPrivateNetworkRequest: (request: PrivateNetworkApiAddServerPrivateNetworkRequest, defaults: DefaultValues) => Record<string, unknown>;
|
|
26
26
|
export declare const marshalPrivateNetworkApiSetServerPrivateNetworksRequest: (request: PrivateNetworkApiSetServerPrivateNetworksRequest, defaults: DefaultValues) => Record<string, unknown>;
|
|
27
27
|
export declare const marshalRebootServerRequest: (request: RebootServerRequest, defaults: DefaultValues) => Record<string, unknown>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { resolveOneOf, isJSONObject, unmarshalArrayOfObject, unmarshalDate, unmarshalTimeSeries, unmarshalMoney } from "@scaleway/sdk-client";
|
|
1
|
+
import { resolveOneOf, marshalBlobToScwFile, isJSONObject, unmarshalArrayOfObject, unmarshalDate, unmarshalTimeSeries, unmarshalMoney } from "@scaleway/sdk-client";
|
|
2
2
|
const unmarshalSchemaPartition = (data) => {
|
|
3
3
|
if (!isJSONObject(data)) {
|
|
4
4
|
throw new TypeError(
|
|
@@ -34,10 +34,7 @@ const unmarshalSchemaDisk = (data) => {
|
|
|
34
34
|
}
|
|
35
35
|
return {
|
|
36
36
|
device: data.device,
|
|
37
|
-
partitions: unmarshalArrayOfObject(
|
|
38
|
-
data.partitions,
|
|
39
|
-
unmarshalSchemaPartition
|
|
40
|
-
)
|
|
37
|
+
partitions: unmarshalArrayOfObject(data.partitions, unmarshalSchemaPartition)
|
|
41
38
|
};
|
|
42
39
|
};
|
|
43
40
|
const unmarshalSchemaFilesystem = (data) => {
|
|
@@ -82,10 +79,7 @@ const unmarshalSchema = (data) => {
|
|
|
82
79
|
}
|
|
83
80
|
return {
|
|
84
81
|
disks: unmarshalArrayOfObject(data.disks, unmarshalSchemaDisk),
|
|
85
|
-
filesystems: unmarshalArrayOfObject(
|
|
86
|
-
data.filesystems,
|
|
87
|
-
unmarshalSchemaFilesystem
|
|
88
|
-
),
|
|
82
|
+
filesystems: unmarshalArrayOfObject(data.filesystems, unmarshalSchemaFilesystem),
|
|
89
83
|
raids: unmarshalArrayOfObject(data.raids, unmarshalSchemaRAID),
|
|
90
84
|
zfs: data.zfs ? unmarshalSchemaZFS(data.zfs) : void 0
|
|
91
85
|
};
|
|
@@ -224,6 +218,7 @@ const unmarshalServer = (data) => {
|
|
|
224
218
|
status: data.status,
|
|
225
219
|
tags: data.tags,
|
|
226
220
|
updatedAt: unmarshalDate(data.updated_at),
|
|
221
|
+
userData: data.user_data,
|
|
227
222
|
zone: data.zone
|
|
228
223
|
};
|
|
229
224
|
};
|
|
@@ -247,6 +242,8 @@ const unmarshalOS = (data) => {
|
|
|
247
242
|
}
|
|
248
243
|
return {
|
|
249
244
|
allowed: data.allowed,
|
|
245
|
+
cloudInitSupported: data.cloud_init_supported,
|
|
246
|
+
cloudInitVersion: data.cloud_init_version,
|
|
250
247
|
customPartitioningSupported: data.custom_partitioning_supported,
|
|
251
248
|
enabled: data.enabled,
|
|
252
249
|
id: data.id,
|
|
@@ -377,18 +374,12 @@ const unmarshalOffer = (data) => {
|
|
|
377
374
|
name: data.name,
|
|
378
375
|
operationPath: data.operation_path,
|
|
379
376
|
options: unmarshalArrayOfObject(data.options, unmarshalOfferOptionOffer),
|
|
380
|
-
persistentMemories: unmarshalArrayOfObject(
|
|
381
|
-
data.persistent_memories,
|
|
382
|
-
unmarshalPersistentMemory
|
|
383
|
-
),
|
|
377
|
+
persistentMemories: unmarshalArrayOfObject(data.persistent_memories, unmarshalPersistentMemory),
|
|
384
378
|
pricePerHour: data.price_per_hour ? unmarshalMoney(data.price_per_hour) : void 0,
|
|
385
379
|
pricePerMonth: data.price_per_month ? unmarshalMoney(data.price_per_month) : void 0,
|
|
386
380
|
privateBandwidth: data.private_bandwidth,
|
|
387
381
|
quotaName: data.quota_name,
|
|
388
|
-
raidControllers: unmarshalArrayOfObject(
|
|
389
|
-
data.raid_controllers,
|
|
390
|
-
unmarshalRaidController
|
|
391
|
-
),
|
|
382
|
+
raidControllers: unmarshalArrayOfObject(data.raid_controllers, unmarshalRaidController),
|
|
392
383
|
sharedBandwidth: data.shared_bandwidth,
|
|
393
384
|
stock: data.stock,
|
|
394
385
|
subscriptionPeriod: data.subscription_period,
|
|
@@ -530,10 +521,7 @@ const unmarshalListServerPrivateNetworksResponse = (data) => {
|
|
|
530
521
|
);
|
|
531
522
|
}
|
|
532
523
|
return {
|
|
533
|
-
serverPrivateNetworks: unmarshalArrayOfObject(
|
|
534
|
-
data.server_private_networks,
|
|
535
|
-
unmarshalServerPrivateNetwork
|
|
536
|
-
),
|
|
524
|
+
serverPrivateNetworks: unmarshalArrayOfObject(data.server_private_networks, unmarshalServerPrivateNetwork),
|
|
537
525
|
totalCount: data.total_count
|
|
538
526
|
};
|
|
539
527
|
};
|
|
@@ -566,10 +554,7 @@ const unmarshalSetServerPrivateNetworksResponse = (data) => {
|
|
|
566
554
|
);
|
|
567
555
|
}
|
|
568
556
|
return {
|
|
569
|
-
serverPrivateNetworks: unmarshalArrayOfObject(
|
|
570
|
-
data.server_private_networks,
|
|
571
|
-
unmarshalServerPrivateNetwork
|
|
572
|
-
)
|
|
557
|
+
serverPrivateNetworks: unmarshalArrayOfObject(data.server_private_networks, unmarshalServerPrivateNetwork)
|
|
573
558
|
};
|
|
574
559
|
};
|
|
575
560
|
const marshalSchemaPartition = (request, defaults) => ({
|
|
@@ -587,9 +572,7 @@ const marshalSchemaPool = (request, defaults) => ({
|
|
|
587
572
|
});
|
|
588
573
|
const marshalSchemaDisk = (request, defaults) => ({
|
|
589
574
|
device: request.device,
|
|
590
|
-
partitions: request.partitions.map(
|
|
591
|
-
(elt) => marshalSchemaPartition(elt)
|
|
592
|
-
)
|
|
575
|
+
partitions: request.partitions.map((elt) => marshalSchemaPartition(elt))
|
|
593
576
|
});
|
|
594
577
|
const marshalSchemaFilesystem = (request, defaults) => ({
|
|
595
578
|
device: request.device,
|
|
@@ -606,9 +589,7 @@ const marshalSchemaZFS = (request, defaults) => ({
|
|
|
606
589
|
});
|
|
607
590
|
const marshalSchema = (request, defaults) => ({
|
|
608
591
|
disks: request.disks.map((elt) => marshalSchemaDisk(elt)),
|
|
609
|
-
filesystems: request.filesystems.map(
|
|
610
|
-
(elt) => marshalSchemaFilesystem(elt)
|
|
611
|
-
),
|
|
592
|
+
filesystems: request.filesystems.map((elt) => marshalSchemaFilesystem(elt)),
|
|
612
593
|
raids: request.raids.map((elt) => marshalSchemaRAID(elt)),
|
|
613
594
|
zfs: request.zfs !== void 0 ? marshalSchemaZFS(request.zfs) : void 0
|
|
614
595
|
});
|
|
@@ -630,6 +611,7 @@ const marshalCreateServerRequest = (request, defaults) => ({
|
|
|
630
611
|
option_ids: request.optionIds,
|
|
631
612
|
protected: request.protected,
|
|
632
613
|
tags: request.tags,
|
|
614
|
+
user_data: request.userData,
|
|
633
615
|
...resolveOneOf([
|
|
634
616
|
{
|
|
635
617
|
default: defaults.defaultProjectId,
|
|
@@ -646,7 +628,7 @@ const marshalCreateServerRequest = (request, defaults) => ({
|
|
|
646
628
|
const marshalAddOptionServerRequest = (request, defaults) => ({
|
|
647
629
|
expires_at: request.expiresAt
|
|
648
630
|
});
|
|
649
|
-
const marshalInstallServerRequest = (request, defaults) => ({
|
|
631
|
+
const marshalInstallServerRequest = async (request, defaults) => ({
|
|
650
632
|
hostname: request.hostname,
|
|
651
633
|
os_id: request.osId,
|
|
652
634
|
partitioning_schema: request.partitioningSchema !== void 0 ? marshalSchema(request.partitioningSchema) : void 0,
|
|
@@ -654,7 +636,8 @@ const marshalInstallServerRequest = (request, defaults) => ({
|
|
|
654
636
|
service_password: request.servicePassword,
|
|
655
637
|
service_user: request.serviceUser,
|
|
656
638
|
ssh_key_ids: request.sshKeyIds,
|
|
657
|
-
user: request.user
|
|
639
|
+
user: request.user,
|
|
640
|
+
user_data: request.userData !== void 0 ? await marshalBlobToScwFile(request.userData) : void 0
|
|
658
641
|
});
|
|
659
642
|
const marshalPrivateNetworkApiAddServerPrivateNetworkRequest = (request, defaults) => ({
|
|
660
643
|
private_network_id: request.privateNetworkId
|
|
@@ -680,7 +663,8 @@ const marshalUpdateServerRequest = (request, defaults) => ({
|
|
|
680
663
|
description: request.description,
|
|
681
664
|
name: request.name,
|
|
682
665
|
protected: request.protected,
|
|
683
|
-
tags: request.tags
|
|
666
|
+
tags: request.tags,
|
|
667
|
+
user_data: request.userData
|
|
684
668
|
});
|
|
685
669
|
const marshalUpdateSettingRequest = (request, defaults) => ({
|
|
686
670
|
enabled: request.enabled
|
package/dist/v1/types.gen.d.ts
CHANGED
|
@@ -412,6 +412,10 @@ export type CreateServerRequest = {
|
|
|
412
412
|
* If enabled, the server can not be deleted.
|
|
413
413
|
*/
|
|
414
414
|
protected: boolean;
|
|
415
|
+
/**
|
|
416
|
+
* Configuration data to pass to cloud-init such as a YAML cloud config data or a user-data script.
|
|
417
|
+
*/
|
|
418
|
+
userData?: string;
|
|
415
419
|
};
|
|
416
420
|
export interface Server {
|
|
417
421
|
/**
|
|
@@ -494,6 +498,10 @@ export interface Server {
|
|
|
494
498
|
* If enabled, the server can not be deleted.
|
|
495
499
|
*/
|
|
496
500
|
protected: boolean;
|
|
501
|
+
/**
|
|
502
|
+
* Optional configuration data passed to cloud-init.
|
|
503
|
+
*/
|
|
504
|
+
userData?: string;
|
|
497
505
|
}
|
|
498
506
|
export interface OS {
|
|
499
507
|
/**
|
|
@@ -548,6 +556,14 @@ export interface OS {
|
|
|
548
556
|
* Defines if custom partitioning is supported by this OS.
|
|
549
557
|
*/
|
|
550
558
|
customPartitioningSupported: boolean;
|
|
559
|
+
/**
|
|
560
|
+
* Defines if cloud-init is supported by this OS.
|
|
561
|
+
*/
|
|
562
|
+
cloudInitSupported: boolean;
|
|
563
|
+
/**
|
|
564
|
+
* Defines the cloud-init API version used by this OS.
|
|
565
|
+
*/
|
|
566
|
+
cloudInitVersion?: string;
|
|
551
567
|
/**
|
|
552
568
|
* Zone in which is the OS is available.
|
|
553
569
|
*/
|
|
@@ -797,11 +813,11 @@ export interface BMCAccess {
|
|
|
797
813
|
*/
|
|
798
814
|
url: string;
|
|
799
815
|
/**
|
|
800
|
-
* The login to use for the BMC (Baseboard Management Controller) access
|
|
816
|
+
* The login to use for the BMC (Baseboard Management Controller) access authentication.
|
|
801
817
|
*/
|
|
802
818
|
login: string;
|
|
803
819
|
/**
|
|
804
|
-
* The password to use for the BMC (Baseboard Management Controller) access
|
|
820
|
+
* The password to use for the BMC (Baseboard Management Controller) access authentication.
|
|
805
821
|
*/
|
|
806
822
|
password: string;
|
|
807
823
|
/**
|
|
@@ -954,6 +970,10 @@ export type InstallServerRequest = {
|
|
|
954
970
|
* Partitioning schema.
|
|
955
971
|
*/
|
|
956
972
|
partitioningSchema?: Schema;
|
|
973
|
+
/**
|
|
974
|
+
* @deprecated Configuration data to pass to cloud-init such as a YAML cloud config data or a user-data script.
|
|
975
|
+
*/
|
|
976
|
+
userData?: Blob;
|
|
957
977
|
};
|
|
958
978
|
export type ListOSRequest = {
|
|
959
979
|
/**
|
|
@@ -1369,6 +1389,10 @@ export type UpdateServerRequest = {
|
|
|
1369
1389
|
* If enabled, the server can not be deleted.
|
|
1370
1390
|
*/
|
|
1371
1391
|
protected?: boolean;
|
|
1392
|
+
/**
|
|
1393
|
+
* Configuration data to pass to cloud-init such as a YAML cloud config data or a user-data script.
|
|
1394
|
+
*/
|
|
1395
|
+
userData?: string;
|
|
1372
1396
|
};
|
|
1373
1397
|
export type UpdateSettingRequest = {
|
|
1374
1398
|
/**
|
package/dist/v3/api.gen.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { API as ParentAPI } from '@scaleway/sdk-client';
|
|
2
1
|
import type { ApiLocality } from '@scaleway/sdk-client';
|
|
2
|
+
import { API as ParentAPI } from '@scaleway/sdk-client';
|
|
3
3
|
import type { ListServerPrivateNetworksResponse, PrivateNetworkApiAddServerPrivateNetworkRequest, PrivateNetworkApiDeleteServerPrivateNetworkRequest, PrivateNetworkApiListServerPrivateNetworksRequest, PrivateNetworkApiSetServerPrivateNetworksRequest, ServerPrivateNetwork, SetServerPrivateNetworksResponse } from './types.gen.js';
|
|
4
4
|
/**
|
|
5
5
|
* Elastic Metal - Private Networks API.
|
package/dist/v3/api.gen.js
CHANGED
|
@@ -27,10 +27,7 @@ class PrivateNetworkAPI extends API$1 {
|
|
|
27
27
|
addServerPrivateNetwork = (request) => this.client.fetch(
|
|
28
28
|
{
|
|
29
29
|
body: JSON.stringify(
|
|
30
|
-
marshalPrivateNetworkApiAddServerPrivateNetworkRequest(
|
|
31
|
-
request,
|
|
32
|
-
this.client.settings
|
|
33
|
-
)
|
|
30
|
+
marshalPrivateNetworkApiAddServerPrivateNetworkRequest(request, this.client.settings)
|
|
34
31
|
),
|
|
35
32
|
headers: jsonContentHeaders,
|
|
36
33
|
method: "POST",
|
|
@@ -47,10 +44,7 @@ class PrivateNetworkAPI extends API$1 {
|
|
|
47
44
|
setServerPrivateNetworks = (request) => this.client.fetch(
|
|
48
45
|
{
|
|
49
46
|
body: JSON.stringify(
|
|
50
|
-
marshalPrivateNetworkApiSetServerPrivateNetworksRequest(
|
|
51
|
-
request,
|
|
52
|
-
this.client.settings
|
|
53
|
-
)
|
|
47
|
+
marshalPrivateNetworkApiSetServerPrivateNetworksRequest(request, this.client.settings)
|
|
54
48
|
),
|
|
55
49
|
headers: jsonContentHeaders,
|
|
56
50
|
method: "PUT",
|
|
@@ -67,10 +61,7 @@ class PrivateNetworkAPI extends API$1 {
|
|
|
67
61
|
["order_by", request.orderBy],
|
|
68
62
|
["organization_id", request.organizationId],
|
|
69
63
|
["page", request.page],
|
|
70
|
-
[
|
|
71
|
-
"page_size",
|
|
72
|
-
request.pageSize ?? this.client.settings.defaultPageSize
|
|
73
|
-
],
|
|
64
|
+
["page_size", request.pageSize ?? this.client.settings.defaultPageSize],
|
|
74
65
|
["private_network_id", request.privateNetworkId],
|
|
75
66
|
["project_id", request.projectId],
|
|
76
67
|
["server_id", request.serverId]
|
|
@@ -84,20 +75,18 @@ class PrivateNetworkAPI extends API$1 {
|
|
|
84
75
|
* @param request - The request {@link PrivateNetworkApiListServerPrivateNetworksRequest}
|
|
85
76
|
* @returns A Promise of ListServerPrivateNetworksResponse
|
|
86
77
|
*/
|
|
87
|
-
listServerPrivateNetworks = (request = {}) => enrichForPagination(
|
|
88
|
-
"serverPrivateNetworks",
|
|
89
|
-
this.pageOfListServerPrivateNetworks,
|
|
90
|
-
request
|
|
91
|
-
);
|
|
78
|
+
listServerPrivateNetworks = (request = {}) => enrichForPagination("serverPrivateNetworks", this.pageOfListServerPrivateNetworks, request);
|
|
92
79
|
/**
|
|
93
80
|
* Delete a Private Network.
|
|
94
81
|
*
|
|
95
82
|
* @param request - The request {@link PrivateNetworkApiDeleteServerPrivateNetworkRequest}
|
|
96
83
|
*/
|
|
97
|
-
deleteServerPrivateNetwork = (request) => this.client.fetch(
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
84
|
+
deleteServerPrivateNetwork = (request) => this.client.fetch(
|
|
85
|
+
{
|
|
86
|
+
method: "DELETE",
|
|
87
|
+
path: `/baremetal/v3/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam("serverId", request.serverId)}/private-networks/${validatePathParam("privateNetworkId", request.privateNetworkId)}`
|
|
88
|
+
}
|
|
89
|
+
);
|
|
101
90
|
}
|
|
102
91
|
export {
|
|
103
92
|
PrivateNetworkAPI
|