@scaleway/sdk 2.47.0 → 2.49.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.
Files changed (44) hide show
  1. package/dist/api/baremetal/v1/api.gen.cjs +33 -0
  2. package/dist/api/baremetal/v1/api.gen.d.ts +17 -1
  3. package/dist/api/baremetal/v1/api.gen.js +34 -1
  4. package/dist/api/baremetal/v1/index.gen.d.ts +1 -1
  5. package/dist/api/baremetal/v1/marshalling.gen.cjs +140 -0
  6. package/dist/api/baremetal/v1/marshalling.gen.d.ts +4 -1
  7. package/dist/api/baremetal/v1/marshalling.gen.js +140 -0
  8. package/dist/api/baremetal/v1/types.gen.d.ts +63 -0
  9. package/dist/api/billing/v2alpha1/marshalling.gen.cjs +1 -0
  10. package/dist/api/billing/v2alpha1/marshalling.gen.js +1 -0
  11. package/dist/api/billing/v2alpha1/types.gen.d.ts +2 -0
  12. package/dist/api/billing/v2beta1/marshalling.gen.cjs +1 -0
  13. package/dist/api/billing/v2beta1/marshalling.gen.js +1 -0
  14. package/dist/api/billing/v2beta1/types.gen.d.ts +2 -0
  15. package/dist/api/edge_services/v1alpha1/api.gen.cjs +29 -0
  16. package/dist/api/edge_services/v1alpha1/api.gen.d.ts +5 -1
  17. package/dist/api/edge_services/v1alpha1/api.gen.js +30 -1
  18. package/dist/api/edge_services/v1alpha1/index.gen.d.ts +1 -1
  19. package/dist/api/edge_services/v1alpha1/marshalling.gen.cjs +56 -16
  20. package/dist/api/edge_services/v1alpha1/marshalling.gen.d.ts +5 -2
  21. package/dist/api/edge_services/v1alpha1/marshalling.gen.js +56 -16
  22. package/dist/api/edge_services/v1alpha1/types.gen.d.ts +51 -28
  23. package/dist/api/iam/v1alpha1/validation-rules.gen.cjs +3 -0
  24. package/dist/api/iam/v1alpha1/validation-rules.gen.d.ts +3 -0
  25. package/dist/api/iam/v1alpha1/validation-rules.gen.js +3 -0
  26. package/dist/api/instance/v1/api.gen.cjs +7 -8
  27. package/dist/api/instance/v1/api.gen.d.ts +8 -9
  28. package/dist/api/instance/v1/api.gen.js +7 -8
  29. package/dist/api/k8s/v1/marshalling.gen.cjs +1 -0
  30. package/dist/api/k8s/v1/marshalling.gen.js +1 -0
  31. package/dist/api/k8s/v1/types.gen.d.ts +2 -0
  32. package/dist/api/k8s/v1/validation-rules.gen.cjs +2 -4
  33. package/dist/api/k8s/v1/validation-rules.gen.d.ts +0 -2
  34. package/dist/api/k8s/v1/validation-rules.gen.js +2 -4
  35. package/dist/scw/constants.cjs +1 -1
  36. package/dist/scw/constants.d.ts +2 -2
  37. package/dist/scw/constants.js +1 -1
  38. package/dist/scw/custom-marshalling.cjs +19 -4
  39. package/dist/scw/custom-marshalling.d.ts +4 -2
  40. package/dist/scw/custom-marshalling.js +19 -4
  41. package/dist/scw/custom-types.cjs +1 -0
  42. package/dist/scw/custom-types.d.ts +1 -0
  43. package/dist/scw/custom-types.js +1 -0
  44. package/package.json +2 -2
@@ -234,6 +234,39 @@ class API extends api.API {
234
234
  * @returns A Promise of ListServerEventsResponse
235
235
  */
236
236
  listServerEvents = (request) => resourcePaginator.enrichForPagination("events", this.pageOfListServerEvents, request);
237
+ /**
238
+ * Get default partitioning schema. Get the default partitioning schema for
239
+ * the given offer ID and OS ID.
240
+ *
241
+ * @param request - The request {@link GetDefaultPartitioningSchemaRequest}
242
+ * @returns A Promise of Schema
243
+ */
244
+ getDefaultPartitioningSchema = (request) => this.client.fetch(
245
+ {
246
+ method: "GET",
247
+ path: `/baremetal/v1/zones/${marshalling.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/partitioning-schemas/default`,
248
+ urlParams: marshalling.urlParams(
249
+ ["offer_id", request.offerId],
250
+ ["os_id", request.osId]
251
+ )
252
+ },
253
+ marshalling_gen.unmarshalSchema
254
+ );
255
+ /**
256
+ * Validate client partitioning schema. Validate the incoming partitioning
257
+ * schema from a user before installing the server. Return default ErrorCode
258
+ * if invalid.
259
+ *
260
+ * @param request - The request {@link ValidatePartitioningSchemaRequest}
261
+ */
262
+ validatePartitioningSchema = (request) => this.client.fetch({
263
+ body: JSON.stringify(
264
+ marshalling_gen.marshalValidatePartitioningSchemaRequest(request, this.client.settings)
265
+ ),
266
+ headers: jsonContentHeaders,
267
+ method: "POST",
268
+ path: `/baremetal/v1/zones/${marshalling.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/partitioning-schemas/validate`
269
+ });
237
270
  /**
238
271
  * Start BMC access. Start BMC (Baseboard Management Controller) access
239
272
  * associated with the ID. The BMC (Baseboard Management Controller) access is
@@ -1,6 +1,6 @@
1
1
  import { API as ParentAPI } from '../../../bridge';
2
2
  import type { WaitForOptions, Zone } from '../../../bridge';
3
- import type { AddOptionServerRequest, BMCAccess, CreateServerRequest, DeleteOptionServerRequest, DeleteServerRequest, GetBMCAccessRequest, GetOSRequest, GetOfferRequest, GetOptionRequest, GetServerMetricsRequest, GetServerMetricsResponse, GetServerRequest, IP, InstallServerRequest, ListOSRequest, ListOSResponse, ListOffersRequest, ListOffersResponse, ListOptionsRequest, ListOptionsResponse, ListServerEventsRequest, ListServerEventsResponse, ListServerPrivateNetworksResponse, ListServersRequest, ListServersResponse, ListSettingsRequest, ListSettingsResponse, OS, Offer, Option, PrivateNetworkApiAddServerPrivateNetworkRequest, PrivateNetworkApiDeleteServerPrivateNetworkRequest, PrivateNetworkApiListServerPrivateNetworksRequest, PrivateNetworkApiSetServerPrivateNetworksRequest, RebootServerRequest, Server, ServerPrivateNetwork, SetServerPrivateNetworksResponse, Setting, StartBMCAccessRequest, StartServerRequest, StopBMCAccessRequest, StopServerRequest, UpdateIPRequest, UpdateServerRequest, UpdateSettingRequest } from './types.gen';
3
+ import type { AddOptionServerRequest, BMCAccess, CreateServerRequest, DeleteOptionServerRequest, DeleteServerRequest, GetBMCAccessRequest, GetDefaultPartitioningSchemaRequest, GetOSRequest, GetOfferRequest, GetOptionRequest, GetServerMetricsRequest, GetServerMetricsResponse, GetServerRequest, IP, InstallServerRequest, ListOSRequest, ListOSResponse, ListOffersRequest, ListOffersResponse, ListOptionsRequest, ListOptionsResponse, ListServerEventsRequest, ListServerEventsResponse, ListServerPrivateNetworksResponse, ListServersRequest, ListServersResponse, ListSettingsRequest, ListSettingsResponse, OS, Offer, Option, PrivateNetworkApiAddServerPrivateNetworkRequest, PrivateNetworkApiDeleteServerPrivateNetworkRequest, PrivateNetworkApiListServerPrivateNetworksRequest, PrivateNetworkApiSetServerPrivateNetworksRequest, RebootServerRequest, Schema, Server, ServerPrivateNetwork, SetServerPrivateNetworksResponse, Setting, StartBMCAccessRequest, StartServerRequest, StopBMCAccessRequest, StopServerRequest, UpdateIPRequest, UpdateServerRequest, UpdateSettingRequest, ValidatePartitioningSchemaRequest } from './types.gen';
4
4
  /**
5
5
  * Elastic Metal API.
6
6
  *
@@ -114,6 +114,22 @@ export declare class API extends ParentAPI {
114
114
  all: () => Promise<import("./types.gen").ServerEvent[]>;
115
115
  [Symbol.asyncIterator]: () => AsyncGenerator<import("./types.gen").ServerEvent[], void, void>;
116
116
  };
117
+ /**
118
+ * Get default partitioning schema. Get the default partitioning schema for
119
+ * the given offer ID and OS ID.
120
+ *
121
+ * @param request - The request {@link GetDefaultPartitioningSchemaRequest}
122
+ * @returns A Promise of Schema
123
+ */
124
+ getDefaultPartitioningSchema: (request: Readonly<GetDefaultPartitioningSchemaRequest>) => Promise<Schema>;
125
+ /**
126
+ * Validate client partitioning schema. Validate the incoming partitioning
127
+ * schema from a user before installing the server. Return default ErrorCode
128
+ * if invalid.
129
+ *
130
+ * @param request - The request {@link ValidatePartitioningSchemaRequest}
131
+ */
132
+ validatePartitioningSchema: (request: Readonly<ValidatePartitioningSchemaRequest>) => Promise<void>;
117
133
  /**
118
134
  * Start BMC access. Start BMC (Baseboard Management Controller) access
119
135
  * associated with the ID. The BMC (Baseboard Management Controller) access is
@@ -4,7 +4,7 @@ import { validatePathParam, urlParams } from "../../../helpers/marshalling.js";
4
4
  import "../../../vendor/base64/index.js";
5
5
  import { enrichForPagination } from "../../../scw/fetch/resource-paginator.js";
6
6
  import { SERVER_TRANSIENT_STATUSES } from "./content.gen.js";
7
- import { marshalPrivateNetworkApiAddServerPrivateNetworkRequest, unmarshalServerPrivateNetwork, marshalPrivateNetworkApiSetServerPrivateNetworksRequest, unmarshalSetServerPrivateNetworksResponse, unmarshalListServerPrivateNetworksResponse, unmarshalListServersResponse, unmarshalServer, marshalCreateServerRequest, marshalUpdateServerRequest, marshalInstallServerRequest, unmarshalGetServerMetricsResponse, marshalRebootServerRequest, marshalStartServerRequest, unmarshalListServerEventsResponse, marshalStartBMCAccessRequest, unmarshalBMCAccess, marshalUpdateIPRequest, unmarshalIP, marshalAddOptionServerRequest, unmarshalListOffersResponse, unmarshalOffer, unmarshalOption, unmarshalListOptionsResponse, unmarshalListSettingsResponse, marshalUpdateSettingRequest, unmarshalSetting, unmarshalListOSResponse, unmarshalOS } from "./marshalling.gen.js";
7
+ import { marshalPrivateNetworkApiAddServerPrivateNetworkRequest, unmarshalServerPrivateNetwork, marshalPrivateNetworkApiSetServerPrivateNetworksRequest, unmarshalSetServerPrivateNetworksResponse, unmarshalListServerPrivateNetworksResponse, 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 } from "./marshalling.gen.js";
8
8
  const jsonContentHeaders = {
9
9
  "Content-Type": "application/json; charset=utf-8"
10
10
  };
@@ -232,6 +232,39 @@ class API extends API$1 {
232
232
  * @returns A Promise of ListServerEventsResponse
233
233
  */
234
234
  listServerEvents = (request) => enrichForPagination("events", this.pageOfListServerEvents, request);
235
+ /**
236
+ * Get default partitioning schema. Get the default partitioning schema for
237
+ * the given offer ID and OS ID.
238
+ *
239
+ * @param request - The request {@link GetDefaultPartitioningSchemaRequest}
240
+ * @returns A Promise of Schema
241
+ */
242
+ getDefaultPartitioningSchema = (request) => this.client.fetch(
243
+ {
244
+ method: "GET",
245
+ path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/partitioning-schemas/default`,
246
+ urlParams: urlParams(
247
+ ["offer_id", request.offerId],
248
+ ["os_id", request.osId]
249
+ )
250
+ },
251
+ unmarshalSchema
252
+ );
253
+ /**
254
+ * Validate client partitioning schema. Validate the incoming partitioning
255
+ * schema from a user before installing the server. Return default ErrorCode
256
+ * if invalid.
257
+ *
258
+ * @param request - The request {@link ValidatePartitioningSchemaRequest}
259
+ */
260
+ validatePartitioningSchema = (request) => this.client.fetch({
261
+ body: JSON.stringify(
262
+ marshalValidatePartitioningSchemaRequest(request, this.client.settings)
263
+ ),
264
+ headers: jsonContentHeaders,
265
+ method: "POST",
266
+ path: `/baremetal/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/partitioning-schemas/validate`
267
+ });
235
268
  /**
236
269
  * Start BMC access. Start BMC (Baseboard Management Controller) access
237
270
  * associated with the ID. The BMC (Baseboard Management Controller) access is
@@ -1,4 +1,4 @@
1
1
  export { API, PrivateNetworkAPI } from './api.gen';
2
2
  export * from './content.gen';
3
- export type { AddOptionServerRequest, BMCAccess, CPU, CertificationOption, CreateServerRequest, CreateServerRequestInstall, DeleteOptionServerRequest, DeleteServerRequest, Disk, GetBMCAccessRequest, GetOSRequest, GetOfferRequest, GetOptionRequest, GetServerMetricsRequest, GetServerMetricsResponse, GetServerRequest, IP, IPReverseStatus, IPVersion, InstallServerRequest, LicenseOption, ListOSRequest, ListOSResponse, ListOffersRequest, ListOffersResponse, ListOptionsRequest, ListOptionsResponse, ListServerEventsRequest, ListServerEventsRequestOrderBy, ListServerEventsResponse, ListServerPrivateNetworksRequestOrderBy, ListServerPrivateNetworksResponse, ListServersRequest, ListServersRequestOrderBy, ListServersResponse, ListSettingsRequest, ListSettingsRequestOrderBy, ListSettingsResponse, Memory, OS, OSOSField, Offer, OfferOptionOffer, OfferStock, OfferSubscriptionPeriod, Option, PersistentMemory, PrivateNetworkApiAddServerPrivateNetworkRequest, PrivateNetworkApiDeleteServerPrivateNetworkRequest, PrivateNetworkApiListServerPrivateNetworksRequest, PrivateNetworkApiSetServerPrivateNetworksRequest, PrivateNetworkOption, PublicBandwidthOption, RaidController, RebootServerRequest, RemoteAccessOption, Server, ServerBootType, ServerEvent, ServerInstall, ServerInstallStatus, ServerOption, ServerOptionOptionStatus, ServerPingStatus, ServerPrivateNetwork, ServerPrivateNetworkStatus, ServerRescueServer, ServerStatus, SetServerPrivateNetworksResponse, Setting, SettingType, StartBMCAccessRequest, StartServerRequest, StopBMCAccessRequest, StopServerRequest, UpdateIPRequest, UpdateServerRequest, UpdateSettingRequest, } from './types.gen';
3
+ export type { AddOptionServerRequest, BMCAccess, CPU, CertificationOption, CreateServerRequest, CreateServerRequestInstall, DeleteOptionServerRequest, DeleteServerRequest, Disk, GetBMCAccessRequest, GetDefaultPartitioningSchemaRequest, GetOSRequest, GetOfferRequest, GetOptionRequest, GetServerMetricsRequest, GetServerMetricsResponse, GetServerRequest, IP, IPReverseStatus, IPVersion, InstallServerRequest, LicenseOption, ListOSRequest, ListOSResponse, ListOffersRequest, ListOffersResponse, ListOptionsRequest, ListOptionsResponse, ListServerEventsRequest, ListServerEventsRequestOrderBy, ListServerEventsResponse, ListServerPrivateNetworksRequestOrderBy, ListServerPrivateNetworksResponse, ListServersRequest, ListServersRequestOrderBy, ListServersResponse, ListSettingsRequest, ListSettingsRequestOrderBy, ListSettingsResponse, Memory, OS, OSOSField, Offer, OfferOptionOffer, OfferStock, OfferSubscriptionPeriod, Option, 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';
4
4
  export * as ValidationRules from './validation-rules.gen';
@@ -3,6 +3,96 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const json = require("../../../helpers/json.cjs");
4
4
  const customMarshalling = require("../../../scw/custom-marshalling.cjs");
5
5
  const marshalling = require("../../../helpers/marshalling.cjs");
6
+ const unmarshalSchemaPartition = (data) => {
7
+ if (!json.isJSONObject(data)) {
8
+ throw new TypeError(
9
+ `Unmarshalling the type 'SchemaPartition' failed as data isn't a dictionary.`
10
+ );
11
+ }
12
+ return {
13
+ label: data.label,
14
+ number: data.number,
15
+ size: data.size
16
+ };
17
+ };
18
+ const unmarshalSchemaPool = (data) => {
19
+ if (!json.isJSONObject(data)) {
20
+ throw new TypeError(
21
+ `Unmarshalling the type 'SchemaPool' failed as data isn't a dictionary.`
22
+ );
23
+ }
24
+ return {
25
+ devices: data.devices,
26
+ filesystemOptions: data.filesystem_options,
27
+ name: data.name,
28
+ options: data.options,
29
+ type: data.type
30
+ };
31
+ };
32
+ const unmarshalSchemaDisk = (data) => {
33
+ if (!json.isJSONObject(data)) {
34
+ throw new TypeError(
35
+ `Unmarshalling the type 'SchemaDisk' failed as data isn't a dictionary.`
36
+ );
37
+ }
38
+ return {
39
+ device: data.device,
40
+ partitions: marshalling.unmarshalArrayOfObject(
41
+ data.partitions,
42
+ unmarshalSchemaPartition
43
+ )
44
+ };
45
+ };
46
+ const unmarshalSchemaFilesystem = (data) => {
47
+ if (!json.isJSONObject(data)) {
48
+ throw new TypeError(
49
+ `Unmarshalling the type 'SchemaFilesystem' failed as data isn't a dictionary.`
50
+ );
51
+ }
52
+ return {
53
+ device: data.device,
54
+ format: data.format,
55
+ mountpoint: data.mountpoint
56
+ };
57
+ };
58
+ const unmarshalSchemaRAID = (data) => {
59
+ if (!json.isJSONObject(data)) {
60
+ throw new TypeError(
61
+ `Unmarshalling the type 'SchemaRAID' failed as data isn't a dictionary.`
62
+ );
63
+ }
64
+ return {
65
+ devices: data.devices,
66
+ level: data.level,
67
+ name: data.name
68
+ };
69
+ };
70
+ const unmarshalSchemaZFS = (data) => {
71
+ if (!json.isJSONObject(data)) {
72
+ throw new TypeError(
73
+ `Unmarshalling the type 'SchemaZFS' failed as data isn't a dictionary.`
74
+ );
75
+ }
76
+ return {
77
+ pools: marshalling.unmarshalArrayOfObject(data.pools, unmarshalSchemaPool)
78
+ };
79
+ };
80
+ const unmarshalSchema = (data) => {
81
+ if (!json.isJSONObject(data)) {
82
+ throw new TypeError(
83
+ `Unmarshalling the type 'Schema' failed as data isn't a dictionary.`
84
+ );
85
+ }
86
+ return {
87
+ disks: marshalling.unmarshalArrayOfObject(data.disks, unmarshalSchemaDisk),
88
+ filesystems: marshalling.unmarshalArrayOfObject(
89
+ data.filesystems,
90
+ unmarshalSchemaFilesystem
91
+ ),
92
+ raids: marshalling.unmarshalArrayOfObject(data.raids, unmarshalSchemaRAID),
93
+ zfs: data.zfs ? unmarshalSchemaZFS(data.zfs) : void 0
94
+ };
95
+ };
6
96
  const unmarshalIP = (data) => {
7
97
  if (!json.isJSONObject(data)) {
8
98
  throw new TypeError(
@@ -259,6 +349,7 @@ const unmarshalServerInstall = (data) => {
259
349
  return {
260
350
  hostname: data.hostname,
261
351
  osId: data.os_id,
352
+ partitioningSchema: data.partitioning_schema ? unmarshalSchema(data.partitioning_schema) : void 0,
262
353
  serviceUrl: data.service_url,
263
354
  serviceUser: data.service_user,
264
355
  sshKeyIds: data.ssh_key_ids,
@@ -469,9 +560,49 @@ const unmarshalSetServerPrivateNetworksResponse = (data) => {
469
560
  const marshalAddOptionServerRequest = (request, defaults) => ({
470
561
  expires_at: request.expiresAt
471
562
  });
563
+ const marshalSchemaPartition = (request, defaults) => ({
564
+ label: request.label,
565
+ number: request.number,
566
+ size: request.size
567
+ });
568
+ const marshalSchemaPool = (request, defaults) => ({
569
+ devices: request.devices,
570
+ filesystem_options: request.filesystemOptions,
571
+ name: request.name,
572
+ options: request.options,
573
+ type: request.type
574
+ });
575
+ const marshalSchemaDisk = (request, defaults) => ({
576
+ device: request.device,
577
+ partitions: request.partitions.map(
578
+ (elt) => marshalSchemaPartition(elt)
579
+ )
580
+ });
581
+ const marshalSchemaFilesystem = (request, defaults) => ({
582
+ device: request.device,
583
+ format: request.format,
584
+ mountpoint: request.mountpoint
585
+ });
586
+ const marshalSchemaRAID = (request, defaults) => ({
587
+ devices: request.devices,
588
+ level: request.level,
589
+ name: request.name
590
+ });
591
+ const marshalSchemaZFS = (request, defaults) => ({
592
+ pools: request.pools.map((elt) => marshalSchemaPool(elt))
593
+ });
594
+ const marshalSchema = (request, defaults) => ({
595
+ disks: request.disks.map((elt) => marshalSchemaDisk(elt)),
596
+ filesystems: request.filesystems.map(
597
+ (elt) => marshalSchemaFilesystem(elt)
598
+ ),
599
+ raids: request.raids.map((elt) => marshalSchemaRAID(elt)),
600
+ zfs: request.zfs !== void 0 ? marshalSchemaZFS(request.zfs) : void 0
601
+ });
472
602
  const marshalCreateServerRequestInstall = (request, defaults) => ({
473
603
  hostname: request.hostname,
474
604
  os_id: request.osId,
605
+ partitioning_schema: request.partitioningSchema !== void 0 ? marshalSchema(request.partitioningSchema) : void 0,
475
606
  password: request.password,
476
607
  service_password: request.servicePassword,
477
608
  service_user: request.serviceUser,
@@ -501,6 +632,7 @@ const marshalCreateServerRequest = (request, defaults) => ({
501
632
  const marshalInstallServerRequest = (request, defaults) => ({
502
633
  hostname: request.hostname,
503
634
  os_id: request.osId,
635
+ partitioning_schema: request.partitioningSchema !== void 0 ? marshalSchema(request.partitioningSchema) : void 0,
504
636
  password: request.password,
505
637
  service_password: request.servicePassword,
506
638
  service_user: request.serviceUser,
@@ -533,17 +665,24 @@ const marshalUpdateServerRequest = (request, defaults) => ({
533
665
  const marshalUpdateSettingRequest = (request, defaults) => ({
534
666
  enabled: request.enabled
535
667
  });
668
+ const marshalValidatePartitioningSchemaRequest = (request, defaults) => ({
669
+ offer_id: request.offerId,
670
+ os_id: request.osId,
671
+ partitioning_schema: request.partitioningSchema !== void 0 ? marshalSchema(request.partitioningSchema) : void 0
672
+ });
536
673
  exports.marshalAddOptionServerRequest = marshalAddOptionServerRequest;
537
674
  exports.marshalCreateServerRequest = marshalCreateServerRequest;
538
675
  exports.marshalInstallServerRequest = marshalInstallServerRequest;
539
676
  exports.marshalPrivateNetworkApiAddServerPrivateNetworkRequest = marshalPrivateNetworkApiAddServerPrivateNetworkRequest;
540
677
  exports.marshalPrivateNetworkApiSetServerPrivateNetworksRequest = marshalPrivateNetworkApiSetServerPrivateNetworksRequest;
541
678
  exports.marshalRebootServerRequest = marshalRebootServerRequest;
679
+ exports.marshalSchema = marshalSchema;
542
680
  exports.marshalStartBMCAccessRequest = marshalStartBMCAccessRequest;
543
681
  exports.marshalStartServerRequest = marshalStartServerRequest;
544
682
  exports.marshalUpdateIPRequest = marshalUpdateIPRequest;
545
683
  exports.marshalUpdateServerRequest = marshalUpdateServerRequest;
546
684
  exports.marshalUpdateSettingRequest = marshalUpdateSettingRequest;
685
+ exports.marshalValidatePartitioningSchemaRequest = marshalValidatePartitioningSchemaRequest;
547
686
  exports.unmarshalBMCAccess = unmarshalBMCAccess;
548
687
  exports.unmarshalGetServerMetricsResponse = unmarshalGetServerMetricsResponse;
549
688
  exports.unmarshalIP = unmarshalIP;
@@ -557,6 +696,7 @@ exports.unmarshalListSettingsResponse = unmarshalListSettingsResponse;
557
696
  exports.unmarshalOS = unmarshalOS;
558
697
  exports.unmarshalOffer = unmarshalOffer;
559
698
  exports.unmarshalOption = unmarshalOption;
699
+ exports.unmarshalSchema = unmarshalSchema;
560
700
  exports.unmarshalServer = unmarshalServer;
561
701
  exports.unmarshalServerPrivateNetwork = unmarshalServerPrivateNetwork;
562
702
  exports.unmarshalSetServerPrivateNetworksResponse = unmarshalSetServerPrivateNetworksResponse;
@@ -1,5 +1,6 @@
1
1
  import type { DefaultValues } from '../../../bridge';
2
- import type { AddOptionServerRequest, BMCAccess, CreateServerRequest, GetServerMetricsResponse, IP, InstallServerRequest, ListOSResponse, ListOffersResponse, ListOptionsResponse, ListServerEventsResponse, ListServerPrivateNetworksResponse, ListServersResponse, ListSettingsResponse, OS, Offer, Option, PrivateNetworkApiAddServerPrivateNetworkRequest, PrivateNetworkApiSetServerPrivateNetworksRequest, RebootServerRequest, Server, ServerPrivateNetwork, SetServerPrivateNetworksResponse, Setting, StartBMCAccessRequest, StartServerRequest, UpdateIPRequest, UpdateServerRequest, UpdateSettingRequest } from './types.gen';
2
+ import type { AddOptionServerRequest, BMCAccess, CreateServerRequest, GetServerMetricsResponse, IP, InstallServerRequest, ListOSResponse, ListOffersResponse, ListOptionsResponse, ListServerEventsResponse, ListServerPrivateNetworksResponse, ListServersResponse, ListSettingsResponse, OS, Offer, Option, PrivateNetworkApiAddServerPrivateNetworkRequest, PrivateNetworkApiSetServerPrivateNetworksRequest, RebootServerRequest, Schema, Server, ServerPrivateNetwork, SetServerPrivateNetworksResponse, Setting, StartBMCAccessRequest, StartServerRequest, UpdateIPRequest, UpdateServerRequest, UpdateSettingRequest, ValidatePartitioningSchemaRequest } from './types.gen';
3
+ export declare const unmarshalSchema: (data: unknown) => Schema;
3
4
  export declare const unmarshalIP: (data: unknown) => IP;
4
5
  export declare const unmarshalOS: (data: unknown) => OS;
5
6
  export declare const unmarshalOffer: (data: unknown) => Offer;
@@ -18,6 +19,7 @@ export declare const unmarshalListServersResponse: (data: unknown) => ListServer
18
19
  export declare const unmarshalListSettingsResponse: (data: unknown) => ListSettingsResponse;
19
20
  export declare const unmarshalSetServerPrivateNetworksResponse: (data: unknown) => SetServerPrivateNetworksResponse;
20
21
  export declare const marshalAddOptionServerRequest: (request: AddOptionServerRequest, defaults: DefaultValues) => Record<string, unknown>;
22
+ export declare const marshalSchema: (request: Schema, defaults: DefaultValues) => Record<string, unknown>;
21
23
  export declare const marshalCreateServerRequest: (request: CreateServerRequest, defaults: DefaultValues) => Record<string, unknown>;
22
24
  export declare const marshalInstallServerRequest: (request: InstallServerRequest, defaults: DefaultValues) => Record<string, unknown>;
23
25
  export declare const marshalPrivateNetworkApiAddServerPrivateNetworkRequest: (request: PrivateNetworkApiAddServerPrivateNetworkRequest, defaults: DefaultValues) => Record<string, unknown>;
@@ -28,3 +30,4 @@ export declare const marshalStartServerRequest: (request: StartServerRequest, de
28
30
  export declare const marshalUpdateIPRequest: (request: UpdateIPRequest, defaults: DefaultValues) => Record<string, unknown>;
29
31
  export declare const marshalUpdateServerRequest: (request: UpdateServerRequest, defaults: DefaultValues) => Record<string, unknown>;
30
32
  export declare const marshalUpdateSettingRequest: (request: UpdateSettingRequest, defaults: DefaultValues) => Record<string, unknown>;
33
+ export declare const marshalValidatePartitioningSchemaRequest: (request: ValidatePartitioningSchemaRequest, defaults: DefaultValues) => Record<string, unknown>;
@@ -1,6 +1,96 @@
1
1
  import { isJSONObject } from "../../../helpers/json.js";
2
2
  import { unmarshalMoney, unmarshalTimeSeries } from "../../../scw/custom-marshalling.js";
3
3
  import { unmarshalDate, unmarshalArrayOfObject, resolveOneOf } from "../../../helpers/marshalling.js";
4
+ const unmarshalSchemaPartition = (data) => {
5
+ if (!isJSONObject(data)) {
6
+ throw new TypeError(
7
+ `Unmarshalling the type 'SchemaPartition' failed as data isn't a dictionary.`
8
+ );
9
+ }
10
+ return {
11
+ label: data.label,
12
+ number: data.number,
13
+ size: data.size
14
+ };
15
+ };
16
+ const unmarshalSchemaPool = (data) => {
17
+ if (!isJSONObject(data)) {
18
+ throw new TypeError(
19
+ `Unmarshalling the type 'SchemaPool' failed as data isn't a dictionary.`
20
+ );
21
+ }
22
+ return {
23
+ devices: data.devices,
24
+ filesystemOptions: data.filesystem_options,
25
+ name: data.name,
26
+ options: data.options,
27
+ type: data.type
28
+ };
29
+ };
30
+ const unmarshalSchemaDisk = (data) => {
31
+ if (!isJSONObject(data)) {
32
+ throw new TypeError(
33
+ `Unmarshalling the type 'SchemaDisk' failed as data isn't a dictionary.`
34
+ );
35
+ }
36
+ return {
37
+ device: data.device,
38
+ partitions: unmarshalArrayOfObject(
39
+ data.partitions,
40
+ unmarshalSchemaPartition
41
+ )
42
+ };
43
+ };
44
+ const unmarshalSchemaFilesystem = (data) => {
45
+ if (!isJSONObject(data)) {
46
+ throw new TypeError(
47
+ `Unmarshalling the type 'SchemaFilesystem' failed as data isn't a dictionary.`
48
+ );
49
+ }
50
+ return {
51
+ device: data.device,
52
+ format: data.format,
53
+ mountpoint: data.mountpoint
54
+ };
55
+ };
56
+ const unmarshalSchemaRAID = (data) => {
57
+ if (!isJSONObject(data)) {
58
+ throw new TypeError(
59
+ `Unmarshalling the type 'SchemaRAID' failed as data isn't a dictionary.`
60
+ );
61
+ }
62
+ return {
63
+ devices: data.devices,
64
+ level: data.level,
65
+ name: data.name
66
+ };
67
+ };
68
+ const unmarshalSchemaZFS = (data) => {
69
+ if (!isJSONObject(data)) {
70
+ throw new TypeError(
71
+ `Unmarshalling the type 'SchemaZFS' failed as data isn't a dictionary.`
72
+ );
73
+ }
74
+ return {
75
+ pools: unmarshalArrayOfObject(data.pools, unmarshalSchemaPool)
76
+ };
77
+ };
78
+ const unmarshalSchema = (data) => {
79
+ if (!isJSONObject(data)) {
80
+ throw new TypeError(
81
+ `Unmarshalling the type 'Schema' failed as data isn't a dictionary.`
82
+ );
83
+ }
84
+ return {
85
+ disks: unmarshalArrayOfObject(data.disks, unmarshalSchemaDisk),
86
+ filesystems: unmarshalArrayOfObject(
87
+ data.filesystems,
88
+ unmarshalSchemaFilesystem
89
+ ),
90
+ raids: unmarshalArrayOfObject(data.raids, unmarshalSchemaRAID),
91
+ zfs: data.zfs ? unmarshalSchemaZFS(data.zfs) : void 0
92
+ };
93
+ };
4
94
  const unmarshalIP = (data) => {
5
95
  if (!isJSONObject(data)) {
6
96
  throw new TypeError(
@@ -257,6 +347,7 @@ const unmarshalServerInstall = (data) => {
257
347
  return {
258
348
  hostname: data.hostname,
259
349
  osId: data.os_id,
350
+ partitioningSchema: data.partitioning_schema ? unmarshalSchema(data.partitioning_schema) : void 0,
260
351
  serviceUrl: data.service_url,
261
352
  serviceUser: data.service_user,
262
353
  sshKeyIds: data.ssh_key_ids,
@@ -467,9 +558,49 @@ const unmarshalSetServerPrivateNetworksResponse = (data) => {
467
558
  const marshalAddOptionServerRequest = (request, defaults) => ({
468
559
  expires_at: request.expiresAt
469
560
  });
561
+ const marshalSchemaPartition = (request, defaults) => ({
562
+ label: request.label,
563
+ number: request.number,
564
+ size: request.size
565
+ });
566
+ const marshalSchemaPool = (request, defaults) => ({
567
+ devices: request.devices,
568
+ filesystem_options: request.filesystemOptions,
569
+ name: request.name,
570
+ options: request.options,
571
+ type: request.type
572
+ });
573
+ const marshalSchemaDisk = (request, defaults) => ({
574
+ device: request.device,
575
+ partitions: request.partitions.map(
576
+ (elt) => marshalSchemaPartition(elt)
577
+ )
578
+ });
579
+ const marshalSchemaFilesystem = (request, defaults) => ({
580
+ device: request.device,
581
+ format: request.format,
582
+ mountpoint: request.mountpoint
583
+ });
584
+ const marshalSchemaRAID = (request, defaults) => ({
585
+ devices: request.devices,
586
+ level: request.level,
587
+ name: request.name
588
+ });
589
+ const marshalSchemaZFS = (request, defaults) => ({
590
+ pools: request.pools.map((elt) => marshalSchemaPool(elt))
591
+ });
592
+ const marshalSchema = (request, defaults) => ({
593
+ disks: request.disks.map((elt) => marshalSchemaDisk(elt)),
594
+ filesystems: request.filesystems.map(
595
+ (elt) => marshalSchemaFilesystem(elt)
596
+ ),
597
+ raids: request.raids.map((elt) => marshalSchemaRAID(elt)),
598
+ zfs: request.zfs !== void 0 ? marshalSchemaZFS(request.zfs) : void 0
599
+ });
470
600
  const marshalCreateServerRequestInstall = (request, defaults) => ({
471
601
  hostname: request.hostname,
472
602
  os_id: request.osId,
603
+ partitioning_schema: request.partitioningSchema !== void 0 ? marshalSchema(request.partitioningSchema) : void 0,
473
604
  password: request.password,
474
605
  service_password: request.servicePassword,
475
606
  service_user: request.serviceUser,
@@ -499,6 +630,7 @@ const marshalCreateServerRequest = (request, defaults) => ({
499
630
  const marshalInstallServerRequest = (request, defaults) => ({
500
631
  hostname: request.hostname,
501
632
  os_id: request.osId,
633
+ partitioning_schema: request.partitioningSchema !== void 0 ? marshalSchema(request.partitioningSchema) : void 0,
502
634
  password: request.password,
503
635
  service_password: request.servicePassword,
504
636
  service_user: request.serviceUser,
@@ -531,6 +663,11 @@ const marshalUpdateServerRequest = (request, defaults) => ({
531
663
  const marshalUpdateSettingRequest = (request, defaults) => ({
532
664
  enabled: request.enabled
533
665
  });
666
+ const marshalValidatePartitioningSchemaRequest = (request, defaults) => ({
667
+ offer_id: request.offerId,
668
+ os_id: request.osId,
669
+ partitioning_schema: request.partitioningSchema !== void 0 ? marshalSchema(request.partitioningSchema) : void 0
670
+ });
534
671
  export {
535
672
  marshalAddOptionServerRequest,
536
673
  marshalCreateServerRequest,
@@ -538,11 +675,13 @@ export {
538
675
  marshalPrivateNetworkApiAddServerPrivateNetworkRequest,
539
676
  marshalPrivateNetworkApiSetServerPrivateNetworksRequest,
540
677
  marshalRebootServerRequest,
678
+ marshalSchema,
541
679
  marshalStartBMCAccessRequest,
542
680
  marshalStartServerRequest,
543
681
  marshalUpdateIPRequest,
544
682
  marshalUpdateServerRequest,
545
683
  marshalUpdateSettingRequest,
684
+ marshalValidatePartitioningSchemaRequest,
546
685
  unmarshalBMCAccess,
547
686
  unmarshalGetServerMetricsResponse,
548
687
  unmarshalIP,
@@ -556,6 +695,7 @@ export {
556
695
  unmarshalOS,
557
696
  unmarshalOffer,
558
697
  unmarshalOption,
698
+ unmarshalSchema,
559
699
  unmarshalServer,
560
700
  unmarshalServerPrivateNetwork,
561
701
  unmarshalSetServerPrivateNetworksResponse,
@@ -7,6 +7,10 @@ export type ListServersRequestOrderBy = 'created_at_asc' | 'created_at_desc';
7
7
  export type ListSettingsRequestOrderBy = 'created_at_asc' | 'created_at_desc';
8
8
  export type OfferStock = 'empty' | 'low' | 'available';
9
9
  export type OfferSubscriptionPeriod = 'unknown_subscription_period' | 'hourly' | 'monthly';
10
+ export type SchemaFilesystemFormat = 'unknown_format' | 'fat32' | 'ext4' | 'swap' | 'zfs' | 'xfs';
11
+ export type SchemaPartitionLabel = 'unknown_partition_label' | 'uefi' | 'legacy' | 'root' | 'boot' | 'swap' | 'data' | 'home' | 'raid' | 'zfs';
12
+ export type SchemaPoolType = 'unknown_type' | 'no_raid' | 'mirror' | 'raidz1' | 'raidz2';
13
+ export type SchemaRAIDLevel = 'unknown_raid_level' | 'raid_level_0' | 'raid_level_1' | 'raid_level_5' | 'raid_level_6' | 'raid_level_10';
10
14
  export type ServerBootType = 'unknown_boot_type' | 'normal' | 'rescue';
11
15
  export type ServerInstallStatus = 'unknown' | 'to_install' | 'installing' | 'completed' | 'error';
12
16
  export type ServerOptionOptionStatus = 'option_status_unknown' | 'option_status_enable' | 'option_status_enabling' | 'option_status_disabling' | 'option_status_error';
@@ -14,6 +18,35 @@ export type ServerPingStatus = 'ping_status_unknown' | 'ping_status_up' | 'ping_
14
18
  export type ServerPrivateNetworkStatus = 'unknown' | 'attaching' | 'attached' | 'error' | 'detaching' | 'locked';
15
19
  export type ServerStatus = 'unknown' | 'delivering' | 'ready' | 'stopping' | 'stopped' | 'starting' | 'error' | 'deleting' | 'locked' | 'out_of_stock' | 'ordered' | 'resetting';
16
20
  export type SettingType = 'unknown' | 'smtp';
21
+ export interface SchemaPartition {
22
+ label: SchemaPartitionLabel;
23
+ number: number;
24
+ size: number;
25
+ }
26
+ export interface SchemaPool {
27
+ name: string;
28
+ type: SchemaPoolType;
29
+ devices: string[];
30
+ options: string[];
31
+ filesystemOptions: string[];
32
+ }
33
+ export interface SchemaDisk {
34
+ device: string;
35
+ partitions: SchemaPartition[];
36
+ }
37
+ export interface SchemaFilesystem {
38
+ device: string;
39
+ format: SchemaFilesystemFormat;
40
+ mountpoint: string;
41
+ }
42
+ export interface SchemaRAID {
43
+ name: string;
44
+ level: SchemaRAIDLevel;
45
+ devices: string[];
46
+ }
47
+ export interface SchemaZFS {
48
+ pools: SchemaPool[];
49
+ }
17
50
  export interface CertificationOption {
18
51
  }
19
52
  export interface LicenseOption {
@@ -26,6 +59,12 @@ export interface PublicBandwidthOption {
26
59
  }
27
60
  export interface RemoteAccessOption {
28
61
  }
62
+ export interface Schema {
63
+ disks: SchemaDisk[];
64
+ raids: SchemaRAID[];
65
+ filesystems: SchemaFilesystem[];
66
+ zfs?: SchemaZFS;
67
+ }
29
68
  export interface OSOSField {
30
69
  editable: boolean;
31
70
  required: boolean;
@@ -160,6 +199,8 @@ export interface ServerInstall {
160
199
  serviceUser: string;
161
200
  /** Address of the installed service. */
162
201
  serviceUrl: string;
202
+ /** Partitioning schema. */
203
+ partitioningSchema?: Schema;
163
204
  }
164
205
  export interface ServerOption {
165
206
  /** ID of the option. */
@@ -229,6 +270,8 @@ export interface CreateServerRequestInstall {
229
270
  serviceUser?: string;
230
271
  /** Password used for the service to install. */
231
272
  servicePassword?: string;
273
+ /** Partitioning schema. */
274
+ partitioningSchema?: Schema;
232
275
  }
233
276
  export interface OS {
234
277
  /** ID of the OS. */
@@ -518,6 +561,14 @@ export type GetBMCAccessRequest = {
518
561
  /** ID of the server. */
519
562
  serverId: string;
520
563
  };
564
+ export type GetDefaultPartitioningSchemaRequest = {
565
+ /** Zone to target. If none is passed will use default zone from the config. */
566
+ zone?: Zone;
567
+ /** ID of the offer. */
568
+ offerId: string;
569
+ /** ID of the OS. */
570
+ osId: string;
571
+ };
521
572
  export type GetOSRequest = {
522
573
  /** Zone to target. If none is passed will use default zone from the config. */
523
574
  zone?: Zone;
@@ -571,6 +622,8 @@ export type InstallServerRequest = {
571
622
  serviceUser?: string;
572
623
  /** Password used for the service to install. */
573
624
  servicePassword?: string;
625
+ /** Partitioning schema. */
626
+ partitioningSchema?: Schema;
574
627
  };
575
628
  export type ListOSRequest = {
576
629
  /** Zone to target. If none is passed will use default zone from the config. */
@@ -806,3 +859,13 @@ export type UpdateSettingRequest = {
806
859
  /** Defines whether the setting is enabled. */
807
860
  enabled?: boolean;
808
861
  };
862
+ export type ValidatePartitioningSchemaRequest = {
863
+ /** Zone to target. If none is passed will use default zone from the config. */
864
+ zone?: Zone;
865
+ /** Partitioning schema. */
866
+ partitioningSchema?: Schema;
867
+ /** Offer ID of the server. */
868
+ offerId: string;
869
+ /** OS ID. */
870
+ osId: string;
871
+ };
@@ -48,6 +48,7 @@ const unmarshalDiscountFilter = (data) => {
48
48
  );
49
49
  }
50
50
  return {
51
+ exclude: data.exclude,
51
52
  type: data.type,
52
53
  value: data.value
53
54
  };