@scaleway/sdk-baremetal 2.8.0 → 2.10.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.
- package/dist/.vite/license.md +3 -0
- package/dist/_virtual/_rolldown/runtime.js +13 -0
- package/dist/index.gen.d.ts +6 -0
- package/dist/index.gen.js +3 -0
- package/dist/metadata.gen.d.ts +12 -0
- package/dist/metadata.gen.js +13 -0
- package/dist/v1/api.gen.d.ts +292 -0
- package/dist/v1/api.gen.js +214 -0
- package/dist/v1/content.gen.d.ts +7 -0
- package/dist/v1/content.gen.js +17 -0
- package/dist/v1/index.gen.d.ts +5 -0
- package/dist/v1/index.gen.js +49 -0
- package/dist/v1/marshalling.gen.d.ts +35 -0
- package/dist/v1/marshalling.gen.js +500 -0
- package/dist/v1/metadata.gen.d.ts +175 -0
- package/dist/v1/metadata.gen.js +191 -0
- package/dist/v1/types.gen.d.ts +1455 -0
- package/dist/v1/types.gen.js +0 -0
- package/dist/v1/validation-rules.gen.d.ts +112 -0
- package/dist/v1/validation-rules.gen.js +85 -0
- package/dist/v3/api.gen.d.ts +44 -0
- package/dist/v3/api.gen.js +46 -0
- package/dist/v3/content.gen.d.ts +3 -0
- package/dist/v3/content.gen.js +5 -0
- package/dist/v3/index.gen.d.ts +4 -0
- package/dist/v3/index.gen.js +16 -0
- package/dist/v3/marshalling.gen.d.ts +7 -0
- package/dist/v3/marshalling.gen.js +34 -0
- package/dist/v3/metadata.gen.d.ts +23 -0
- package/dist/v3/metadata.gen.js +25 -0
- package/dist/v3/types.gen.d.ts +132 -0
- package/dist/v3/types.gen.js +0 -0
- package/package.json +4 -4
- package/LICENSE +0 -191
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { __exportAll } from "../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { SERVER_INSTALL_TRANSIENT_STATUSES, SERVER_PRIVATE_NETWORK_TRANSIENT_STATUSES, SERVER_TRANSIENT_STATUSES } from "./content.gen.js";
|
|
3
|
+
import { marshalAddOptionServerRequest, marshalBatchCreateServersRequest, marshalCreateServerRequest, marshalInstallServerRequest, marshalPrivateNetworkApiAddServerPrivateNetworkRequest, marshalPrivateNetworkApiSetServerPrivateNetworksRequest, marshalRebootServerRequest, marshalSchema, marshalStartBMCAccessRequest, marshalStartServerRequest, marshalUpdateIPRequest, marshalUpdateServerRequest, marshalUpdateSettingRequest, marshalValidatePartitioningSchemaRequest, unmarshalBMCAccess, unmarshalBatchCreateServersResponse, unmarshalGetServerMetricsResponse, unmarshalIP, unmarshalListOSResponse, unmarshalListOffersResponse, unmarshalListOptionsResponse, unmarshalListServerEventsResponse, unmarshalListServerPrivateNetworksResponse, unmarshalListServersResponse, unmarshalListSettingsResponse, unmarshalOS, unmarshalOffer, unmarshalOption, unmarshalSchema, unmarshalServer, unmarshalServerPrivateNetwork, unmarshalSetServerPrivateNetworksResponse, unmarshalSetting } from "./marshalling.gen.js";
|
|
4
|
+
import { API, PrivateNetworkAPI } from "./api.gen.js";
|
|
5
|
+
import { validation_rules_gen_exports } from "./validation-rules.gen.js";
|
|
6
|
+
//#region src/v1/index.gen.ts
|
|
7
|
+
var index_gen_exports = /* @__PURE__ */ __exportAll({
|
|
8
|
+
API: () => API,
|
|
9
|
+
PrivateNetworkAPI: () => PrivateNetworkAPI,
|
|
10
|
+
SERVER_INSTALL_TRANSIENT_STATUSES: () => SERVER_INSTALL_TRANSIENT_STATUSES,
|
|
11
|
+
SERVER_PRIVATE_NETWORK_TRANSIENT_STATUSES: () => SERVER_PRIVATE_NETWORK_TRANSIENT_STATUSES,
|
|
12
|
+
SERVER_TRANSIENT_STATUSES: () => SERVER_TRANSIENT_STATUSES,
|
|
13
|
+
ValidationRules: () => validation_rules_gen_exports,
|
|
14
|
+
marshalAddOptionServerRequest: () => marshalAddOptionServerRequest,
|
|
15
|
+
marshalBatchCreateServersRequest: () => marshalBatchCreateServersRequest,
|
|
16
|
+
marshalCreateServerRequest: () => marshalCreateServerRequest,
|
|
17
|
+
marshalInstallServerRequest: () => marshalInstallServerRequest,
|
|
18
|
+
marshalPrivateNetworkApiAddServerPrivateNetworkRequest: () => marshalPrivateNetworkApiAddServerPrivateNetworkRequest,
|
|
19
|
+
marshalPrivateNetworkApiSetServerPrivateNetworksRequest: () => marshalPrivateNetworkApiSetServerPrivateNetworksRequest,
|
|
20
|
+
marshalRebootServerRequest: () => marshalRebootServerRequest,
|
|
21
|
+
marshalSchema: () => marshalSchema,
|
|
22
|
+
marshalStartBMCAccessRequest: () => marshalStartBMCAccessRequest,
|
|
23
|
+
marshalStartServerRequest: () => marshalStartServerRequest,
|
|
24
|
+
marshalUpdateIPRequest: () => marshalUpdateIPRequest,
|
|
25
|
+
marshalUpdateServerRequest: () => marshalUpdateServerRequest,
|
|
26
|
+
marshalUpdateSettingRequest: () => marshalUpdateSettingRequest,
|
|
27
|
+
marshalValidatePartitioningSchemaRequest: () => marshalValidatePartitioningSchemaRequest,
|
|
28
|
+
unmarshalBMCAccess: () => unmarshalBMCAccess,
|
|
29
|
+
unmarshalBatchCreateServersResponse: () => unmarshalBatchCreateServersResponse,
|
|
30
|
+
unmarshalGetServerMetricsResponse: () => unmarshalGetServerMetricsResponse,
|
|
31
|
+
unmarshalIP: () => unmarshalIP,
|
|
32
|
+
unmarshalListOSResponse: () => unmarshalListOSResponse,
|
|
33
|
+
unmarshalListOffersResponse: () => unmarshalListOffersResponse,
|
|
34
|
+
unmarshalListOptionsResponse: () => unmarshalListOptionsResponse,
|
|
35
|
+
unmarshalListServerEventsResponse: () => unmarshalListServerEventsResponse,
|
|
36
|
+
unmarshalListServerPrivateNetworksResponse: () => unmarshalListServerPrivateNetworksResponse,
|
|
37
|
+
unmarshalListServersResponse: () => unmarshalListServersResponse,
|
|
38
|
+
unmarshalListSettingsResponse: () => unmarshalListSettingsResponse,
|
|
39
|
+
unmarshalOS: () => unmarshalOS,
|
|
40
|
+
unmarshalOffer: () => unmarshalOffer,
|
|
41
|
+
unmarshalOption: () => unmarshalOption,
|
|
42
|
+
unmarshalSchema: () => unmarshalSchema,
|
|
43
|
+
unmarshalServer: () => unmarshalServer,
|
|
44
|
+
unmarshalServerPrivateNetwork: () => unmarshalServerPrivateNetwork,
|
|
45
|
+
unmarshalSetServerPrivateNetworksResponse: () => unmarshalSetServerPrivateNetworksResponse,
|
|
46
|
+
unmarshalSetting: () => unmarshalSetting
|
|
47
|
+
});
|
|
48
|
+
//#endregion
|
|
49
|
+
export { API, PrivateNetworkAPI, SERVER_INSTALL_TRANSIENT_STATUSES, SERVER_PRIVATE_NETWORK_TRANSIENT_STATUSES, SERVER_TRANSIENT_STATUSES, validation_rules_gen_exports as ValidationRules, index_gen_exports, marshalAddOptionServerRequest, marshalBatchCreateServersRequest, marshalCreateServerRequest, marshalInstallServerRequest, marshalPrivateNetworkApiAddServerPrivateNetworkRequest, marshalPrivateNetworkApiSetServerPrivateNetworksRequest, marshalRebootServerRequest, marshalSchema, marshalStartBMCAccessRequest, marshalStartServerRequest, marshalUpdateIPRequest, marshalUpdateServerRequest, marshalUpdateSettingRequest, marshalValidatePartitioningSchemaRequest, unmarshalBMCAccess, unmarshalBatchCreateServersResponse, unmarshalGetServerMetricsResponse, unmarshalIP, unmarshalListOSResponse, unmarshalListOffersResponse, unmarshalListOptionsResponse, unmarshalListServerEventsResponse, unmarshalListServerPrivateNetworksResponse, unmarshalListServersResponse, unmarshalListSettingsResponse, unmarshalOS, unmarshalOffer, unmarshalOption, unmarshalSchema, unmarshalServer, unmarshalServerPrivateNetwork, unmarshalSetServerPrivateNetworksResponse, unmarshalSetting };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { DefaultValues } from '@scaleway/sdk-client';
|
|
2
|
+
import type { Schema, IP, Server, OS, Offer, Option, ServerPrivateNetwork, Setting, BMCAccess, BatchCreateServersResponse, GetServerMetricsResponse, ListOSResponse, ListOffersResponse, ListOptionsResponse, ListServerEventsResponse, ListServerPrivateNetworksResponse, ListServersResponse, ListSettingsResponse, SetServerPrivateNetworksResponse, CreateServerRequest, AddOptionServerRequest, BatchCreateServersRequest, InstallServerRequest, PrivateNetworkApiAddServerPrivateNetworkRequest, PrivateNetworkApiSetServerPrivateNetworksRequest, RebootServerRequest, StartBMCAccessRequest, StartServerRequest, UpdateIPRequest, UpdateServerRequest, UpdateSettingRequest, ValidatePartitioningSchemaRequest } from './types.gen.js';
|
|
3
|
+
export declare const unmarshalSchema: (data: unknown) => Schema;
|
|
4
|
+
export declare const unmarshalIP: (data: unknown) => IP;
|
|
5
|
+
export declare const unmarshalServer: (data: unknown) => Server;
|
|
6
|
+
export declare const unmarshalOS: (data: unknown) => OS;
|
|
7
|
+
export declare const unmarshalOffer: (data: unknown) => Offer;
|
|
8
|
+
export declare const unmarshalOption: (data: unknown) => Option;
|
|
9
|
+
export declare const unmarshalServerPrivateNetwork: (data: unknown) => ServerPrivateNetwork;
|
|
10
|
+
export declare const unmarshalSetting: (data: unknown) => Setting;
|
|
11
|
+
export declare const unmarshalBMCAccess: (data: unknown) => BMCAccess;
|
|
12
|
+
export declare const unmarshalBatchCreateServersResponse: (data: unknown) => BatchCreateServersResponse;
|
|
13
|
+
export declare const unmarshalGetServerMetricsResponse: (data: unknown) => GetServerMetricsResponse;
|
|
14
|
+
export declare const unmarshalListOSResponse: (data: unknown) => ListOSResponse;
|
|
15
|
+
export declare const unmarshalListOffersResponse: (data: unknown) => ListOffersResponse;
|
|
16
|
+
export declare const unmarshalListOptionsResponse: (data: unknown) => ListOptionsResponse;
|
|
17
|
+
export declare const unmarshalListServerEventsResponse: (data: unknown) => ListServerEventsResponse;
|
|
18
|
+
export declare const unmarshalListServerPrivateNetworksResponse: (data: unknown) => ListServerPrivateNetworksResponse;
|
|
19
|
+
export declare const unmarshalListServersResponse: (data: unknown) => ListServersResponse;
|
|
20
|
+
export declare const unmarshalListSettingsResponse: (data: unknown) => ListSettingsResponse;
|
|
21
|
+
export declare const unmarshalSetServerPrivateNetworksResponse: (data: unknown) => SetServerPrivateNetworksResponse;
|
|
22
|
+
export declare const marshalSchema: (request: Schema, defaults: DefaultValues) => Record<string, unknown>;
|
|
23
|
+
export declare const marshalCreateServerRequest: (request: CreateServerRequest, defaults: DefaultValues) => Record<string, unknown>;
|
|
24
|
+
export declare const marshalAddOptionServerRequest: (request: AddOptionServerRequest, defaults: DefaultValues) => Record<string, unknown>;
|
|
25
|
+
export declare const marshalBatchCreateServersRequest: (request: BatchCreateServersRequest, defaults: DefaultValues) => Record<string, unknown>;
|
|
26
|
+
export declare const marshalInstallServerRequest: (request: InstallServerRequest, defaults: DefaultValues) => Promise<Record<string, unknown>>;
|
|
27
|
+
export declare const marshalPrivateNetworkApiAddServerPrivateNetworkRequest: (request: PrivateNetworkApiAddServerPrivateNetworkRequest, defaults: DefaultValues) => Record<string, unknown>;
|
|
28
|
+
export declare const marshalPrivateNetworkApiSetServerPrivateNetworksRequest: (request: PrivateNetworkApiSetServerPrivateNetworksRequest, defaults: DefaultValues) => Record<string, unknown>;
|
|
29
|
+
export declare const marshalRebootServerRequest: (request: RebootServerRequest, defaults: DefaultValues) => Record<string, unknown>;
|
|
30
|
+
export declare const marshalStartBMCAccessRequest: (request: StartBMCAccessRequest, defaults: DefaultValues) => Record<string, unknown>;
|
|
31
|
+
export declare const marshalStartServerRequest: (request: StartServerRequest, defaults: DefaultValues) => Record<string, unknown>;
|
|
32
|
+
export declare const marshalUpdateIPRequest: (request: UpdateIPRequest, defaults: DefaultValues) => Record<string, unknown>;
|
|
33
|
+
export declare const marshalUpdateServerRequest: (request: UpdateServerRequest, defaults: DefaultValues) => Record<string, unknown>;
|
|
34
|
+
export declare const marshalUpdateSettingRequest: (request: UpdateSettingRequest, defaults: DefaultValues) => Record<string, unknown>;
|
|
35
|
+
export declare const marshalValidatePartitioningSchemaRequest: (request: ValidatePartitioningSchemaRequest, defaults: DefaultValues) => Record<string, unknown>;
|
|
@@ -0,0 +1,500 @@
|
|
|
1
|
+
import { isJSONObject, marshalBlobToScwFile, resolveOneOf, unmarshalArrayOfObject, unmarshalDate, unmarshalMoney, unmarshalTimeSeries } from "@scaleway/sdk-client";
|
|
2
|
+
//#region src/v1/marshalling.gen.ts
|
|
3
|
+
const unmarshalSchemaPartition = (data) => {
|
|
4
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'SchemaPartition' failed as data isn't a dictionary.`);
|
|
5
|
+
return {
|
|
6
|
+
label: data.label,
|
|
7
|
+
number: data.number,
|
|
8
|
+
size: data.size,
|
|
9
|
+
useAllAvailableSpace: data.use_all_available_space
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
const unmarshalSchemaPool = (data) => {
|
|
13
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'SchemaPool' failed as data isn't a dictionary.`);
|
|
14
|
+
return {
|
|
15
|
+
devices: data.devices,
|
|
16
|
+
filesystemOptions: data.filesystem_options,
|
|
17
|
+
name: data.name,
|
|
18
|
+
options: data.options,
|
|
19
|
+
type: data.type
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
const unmarshalSchemaDisk = (data) => {
|
|
23
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'SchemaDisk' failed as data isn't a dictionary.`);
|
|
24
|
+
return {
|
|
25
|
+
device: data.device,
|
|
26
|
+
partitions: unmarshalArrayOfObject(data.partitions, unmarshalSchemaPartition)
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
const unmarshalSchemaFilesystem = (data) => {
|
|
30
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'SchemaFilesystem' failed as data isn't a dictionary.`);
|
|
31
|
+
return {
|
|
32
|
+
device: data.device,
|
|
33
|
+
format: data.format,
|
|
34
|
+
mountpoint: data.mountpoint
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
const unmarshalSchemaRAID = (data) => {
|
|
38
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'SchemaRAID' failed as data isn't a dictionary.`);
|
|
39
|
+
return {
|
|
40
|
+
devices: data.devices,
|
|
41
|
+
level: data.level,
|
|
42
|
+
name: data.name
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
const unmarshalSchemaZFS = (data) => {
|
|
46
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'SchemaZFS' failed as data isn't a dictionary.`);
|
|
47
|
+
return { pools: unmarshalArrayOfObject(data.pools, unmarshalSchemaPool) };
|
|
48
|
+
};
|
|
49
|
+
const unmarshalSchema = (data) => {
|
|
50
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Schema' failed as data isn't a dictionary.`);
|
|
51
|
+
return {
|
|
52
|
+
disks: unmarshalArrayOfObject(data.disks, unmarshalSchemaDisk),
|
|
53
|
+
filesystems: unmarshalArrayOfObject(data.filesystems, unmarshalSchemaFilesystem),
|
|
54
|
+
raids: unmarshalArrayOfObject(data.raids, unmarshalSchemaRAID),
|
|
55
|
+
zfs: data.zfs ? unmarshalSchemaZFS(data.zfs) : void 0
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
const unmarshalIP = (data) => {
|
|
59
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'IP' failed as data isn't a dictionary.`);
|
|
60
|
+
return {
|
|
61
|
+
address: data.address,
|
|
62
|
+
id: data.id,
|
|
63
|
+
reverse: data.reverse,
|
|
64
|
+
reverseStatus: data.reverse_status,
|
|
65
|
+
reverseStatusMessage: data.reverse_status_message,
|
|
66
|
+
version: data.version
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
const unmarshalCertificationOption = (data) => {
|
|
70
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'CertificationOption' failed as data isn't a dictionary.`);
|
|
71
|
+
return {};
|
|
72
|
+
};
|
|
73
|
+
const unmarshalLicenseOption = (data) => {
|
|
74
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'LicenseOption' failed as data isn't a dictionary.`);
|
|
75
|
+
return { osId: data.os_id };
|
|
76
|
+
};
|
|
77
|
+
const unmarshalPrivateNetworkOption = (data) => {
|
|
78
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'PrivateNetworkOption' failed as data isn't a dictionary.`);
|
|
79
|
+
return { bandwidthInBps: data.bandwidth_in_bps };
|
|
80
|
+
};
|
|
81
|
+
const unmarshalPublicBandwidthOption = (data) => {
|
|
82
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'PublicBandwidthOption' failed as data isn't a dictionary.`);
|
|
83
|
+
return { bandwidthInBps: data.bandwidth_in_bps };
|
|
84
|
+
};
|
|
85
|
+
const unmarshalRemoteAccessOption = (data) => {
|
|
86
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'RemoteAccessOption' failed as data isn't a dictionary.`);
|
|
87
|
+
return {};
|
|
88
|
+
};
|
|
89
|
+
const unmarshalServerInstall = (data) => {
|
|
90
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ServerInstall' failed as data isn't a dictionary.`);
|
|
91
|
+
return {
|
|
92
|
+
hostname: data.hostname,
|
|
93
|
+
osId: data.os_id,
|
|
94
|
+
partitioningSchema: data.partitioning_schema ? unmarshalSchema(data.partitioning_schema) : void 0,
|
|
95
|
+
serviceUrl: data.service_url,
|
|
96
|
+
serviceUser: data.service_user,
|
|
97
|
+
sshKeyIds: data.ssh_key_ids,
|
|
98
|
+
status: data.status,
|
|
99
|
+
user: data.user
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
const unmarshalServerOption = (data) => {
|
|
103
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ServerOption' failed as data isn't a dictionary.`);
|
|
104
|
+
return {
|
|
105
|
+
certification: data.certification ? unmarshalCertificationOption(data.certification) : void 0,
|
|
106
|
+
expiresAt: unmarshalDate(data.expires_at),
|
|
107
|
+
id: data.id,
|
|
108
|
+
license: data.license ? unmarshalLicenseOption(data.license) : void 0,
|
|
109
|
+
manageable: data.manageable,
|
|
110
|
+
name: data.name,
|
|
111
|
+
privateNetwork: data.private_network ? unmarshalPrivateNetworkOption(data.private_network) : void 0,
|
|
112
|
+
publicBandwidth: data.public_bandwidth ? unmarshalPublicBandwidthOption(data.public_bandwidth) : void 0,
|
|
113
|
+
remoteAccess: data.remote_access ? unmarshalRemoteAccessOption(data.remote_access) : void 0,
|
|
114
|
+
status: data.status
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
const unmarshalServerRescueServer = (data) => {
|
|
118
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ServerRescueServer' failed as data isn't a dictionary.`);
|
|
119
|
+
return {
|
|
120
|
+
password: data.password,
|
|
121
|
+
user: data.user
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
const unmarshalServer = (data) => {
|
|
125
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Server' failed as data isn't a dictionary.`);
|
|
126
|
+
return {
|
|
127
|
+
bootType: data.boot_type,
|
|
128
|
+
createdAt: unmarshalDate(data.created_at),
|
|
129
|
+
description: data.description,
|
|
130
|
+
domain: data.domain,
|
|
131
|
+
id: data.id,
|
|
132
|
+
install: data.install ? unmarshalServerInstall(data.install) : void 0,
|
|
133
|
+
ips: unmarshalArrayOfObject(data.ips, unmarshalIP),
|
|
134
|
+
name: data.name,
|
|
135
|
+
offerId: data.offer_id,
|
|
136
|
+
offerName: data.offer_name,
|
|
137
|
+
options: unmarshalArrayOfObject(data.options, unmarshalServerOption),
|
|
138
|
+
organizationId: data.organization_id,
|
|
139
|
+
pingStatus: data.ping_status,
|
|
140
|
+
projectId: data.project_id,
|
|
141
|
+
protected: data.protected,
|
|
142
|
+
rescueServer: data.rescue_server ? unmarshalServerRescueServer(data.rescue_server) : void 0,
|
|
143
|
+
status: data.status,
|
|
144
|
+
tags: data.tags,
|
|
145
|
+
updatedAt: unmarshalDate(data.updated_at),
|
|
146
|
+
userData: data.user_data,
|
|
147
|
+
zone: data.zone
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
const unmarshalOSOSField = (data) => {
|
|
151
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'OSOSField' failed as data isn't a dictionary.`);
|
|
152
|
+
return {
|
|
153
|
+
defaultValue: data.default_value,
|
|
154
|
+
editable: data.editable,
|
|
155
|
+
required: data.required
|
|
156
|
+
};
|
|
157
|
+
};
|
|
158
|
+
const unmarshalOS = (data) => {
|
|
159
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'OS' failed as data isn't a dictionary.`);
|
|
160
|
+
return {
|
|
161
|
+
allowed: data.allowed,
|
|
162
|
+
cloudInitSupported: data.cloud_init_supported,
|
|
163
|
+
cloudInitVersion: data.cloud_init_version,
|
|
164
|
+
customPartitioningSupported: data.custom_partitioning_supported,
|
|
165
|
+
enabled: data.enabled,
|
|
166
|
+
id: data.id,
|
|
167
|
+
licenseRequired: data.license_required,
|
|
168
|
+
logoUrl: data.logo_url,
|
|
169
|
+
name: data.name,
|
|
170
|
+
password: data.password ? unmarshalOSOSField(data.password) : void 0,
|
|
171
|
+
servicePassword: data.service_password ? unmarshalOSOSField(data.service_password) : void 0,
|
|
172
|
+
serviceUser: data.service_user ? unmarshalOSOSField(data.service_user) : void 0,
|
|
173
|
+
ssh: data.ssh ? unmarshalOSOSField(data.ssh) : void 0,
|
|
174
|
+
user: data.user ? unmarshalOSOSField(data.user) : void 0,
|
|
175
|
+
version: data.version,
|
|
176
|
+
zone: data.zone
|
|
177
|
+
};
|
|
178
|
+
};
|
|
179
|
+
const unmarshalCPU = (data) => {
|
|
180
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'CPU' failed as data isn't a dictionary.`);
|
|
181
|
+
return {
|
|
182
|
+
benchmark: data.benchmark,
|
|
183
|
+
coreCount: data.core_count,
|
|
184
|
+
frequency: data.frequency,
|
|
185
|
+
name: data.name,
|
|
186
|
+
threadCount: data.thread_count
|
|
187
|
+
};
|
|
188
|
+
};
|
|
189
|
+
const unmarshalDisk = (data) => {
|
|
190
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Disk' failed as data isn't a dictionary.`);
|
|
191
|
+
return {
|
|
192
|
+
capacity: data.capacity,
|
|
193
|
+
type: data.type
|
|
194
|
+
};
|
|
195
|
+
};
|
|
196
|
+
const unmarshalGPU = (data) => {
|
|
197
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'GPU' failed as data isn't a dictionary.`);
|
|
198
|
+
return {
|
|
199
|
+
name: data.name,
|
|
200
|
+
vram: data.vram
|
|
201
|
+
};
|
|
202
|
+
};
|
|
203
|
+
const unmarshalMemory = (data) => {
|
|
204
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Memory' failed as data isn't a dictionary.`);
|
|
205
|
+
return {
|
|
206
|
+
capacity: data.capacity,
|
|
207
|
+
eccType: data.ecc_type,
|
|
208
|
+
frequency: data.frequency,
|
|
209
|
+
isEcc: data.is_ecc,
|
|
210
|
+
type: data.type
|
|
211
|
+
};
|
|
212
|
+
};
|
|
213
|
+
const unmarshalOfferOptionOffer = (data) => {
|
|
214
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'OfferOptionOffer' failed as data isn't a dictionary.`);
|
|
215
|
+
return {
|
|
216
|
+
certification: data.certification ? unmarshalCertificationOption(data.certification) : void 0,
|
|
217
|
+
enabled: data.enabled,
|
|
218
|
+
id: data.id,
|
|
219
|
+
license: data.license ? unmarshalLicenseOption(data.license) : void 0,
|
|
220
|
+
manageable: data.manageable,
|
|
221
|
+
name: data.name,
|
|
222
|
+
osId: data.os_id,
|
|
223
|
+
price: data.price ? unmarshalMoney(data.price) : void 0,
|
|
224
|
+
privateNetwork: data.private_network ? unmarshalPrivateNetworkOption(data.private_network) : void 0,
|
|
225
|
+
publicBandwidth: data.public_bandwidth ? unmarshalPublicBandwidthOption(data.public_bandwidth) : void 0,
|
|
226
|
+
remoteAccess: data.remote_access ? unmarshalRemoteAccessOption(data.remote_access) : void 0,
|
|
227
|
+
subscriptionPeriod: data.subscription_period
|
|
228
|
+
};
|
|
229
|
+
};
|
|
230
|
+
const unmarshalPersistentMemory = (data) => {
|
|
231
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'PersistentMemory' failed as data isn't a dictionary.`);
|
|
232
|
+
return {
|
|
233
|
+
capacity: data.capacity,
|
|
234
|
+
frequency: data.frequency,
|
|
235
|
+
type: data.type
|
|
236
|
+
};
|
|
237
|
+
};
|
|
238
|
+
const unmarshalRaidController = (data) => {
|
|
239
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'RaidController' failed as data isn't a dictionary.`);
|
|
240
|
+
return {
|
|
241
|
+
model: data.model,
|
|
242
|
+
raidLevel: data.raid_level
|
|
243
|
+
};
|
|
244
|
+
};
|
|
245
|
+
const unmarshalOffer = (data) => {
|
|
246
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Offer' failed as data isn't a dictionary.`);
|
|
247
|
+
return {
|
|
248
|
+
bandwidth: data.bandwidth,
|
|
249
|
+
commercialRange: data.commercial_range,
|
|
250
|
+
cpus: unmarshalArrayOfObject(data.cpus, unmarshalCPU),
|
|
251
|
+
disks: unmarshalArrayOfObject(data.disks, unmarshalDisk),
|
|
252
|
+
enable: data.enable,
|
|
253
|
+
fee: data.fee ? unmarshalMoney(data.fee) : void 0,
|
|
254
|
+
gpus: unmarshalArrayOfObject(data.gpus, unmarshalGPU),
|
|
255
|
+
id: data.id,
|
|
256
|
+
incompatibleOsIds: data.incompatible_os_ids,
|
|
257
|
+
maxBandwidth: data.max_bandwidth,
|
|
258
|
+
memories: unmarshalArrayOfObject(data.memories, unmarshalMemory),
|
|
259
|
+
monthlyOfferId: data.monthly_offer_id,
|
|
260
|
+
name: data.name,
|
|
261
|
+
operationPath: data.operation_path,
|
|
262
|
+
options: unmarshalArrayOfObject(data.options, unmarshalOfferOptionOffer),
|
|
263
|
+
persistentMemories: unmarshalArrayOfObject(data.persistent_memories, unmarshalPersistentMemory),
|
|
264
|
+
pricePerHour: data.price_per_hour ? unmarshalMoney(data.price_per_hour) : void 0,
|
|
265
|
+
pricePerMonth: data.price_per_month ? unmarshalMoney(data.price_per_month) : void 0,
|
|
266
|
+
privateBandwidth: data.private_bandwidth,
|
|
267
|
+
quotaName: data.quota_name,
|
|
268
|
+
raidControllers: unmarshalArrayOfObject(data.raid_controllers, unmarshalRaidController),
|
|
269
|
+
sharedBandwidth: data.shared_bandwidth,
|
|
270
|
+
stock: data.stock,
|
|
271
|
+
subscriptionPeriod: data.subscription_period,
|
|
272
|
+
tags: data.tags,
|
|
273
|
+
zone: data.zone
|
|
274
|
+
};
|
|
275
|
+
};
|
|
276
|
+
const unmarshalOption = (data) => {
|
|
277
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Option' failed as data isn't a dictionary.`);
|
|
278
|
+
return {
|
|
279
|
+
certification: data.certification ? unmarshalCertificationOption(data.certification) : void 0,
|
|
280
|
+
id: data.id,
|
|
281
|
+
license: data.license ? unmarshalLicenseOption(data.license) : void 0,
|
|
282
|
+
manageable: data.manageable,
|
|
283
|
+
name: data.name,
|
|
284
|
+
privateNetwork: data.private_network ? unmarshalPrivateNetworkOption(data.private_network) : void 0,
|
|
285
|
+
publicBandwidth: data.public_bandwidth ? unmarshalPublicBandwidthOption(data.public_bandwidth) : void 0,
|
|
286
|
+
remoteAccess: data.remote_access ? unmarshalRemoteAccessOption(data.remote_access) : void 0
|
|
287
|
+
};
|
|
288
|
+
};
|
|
289
|
+
const unmarshalServerPrivateNetwork = (data) => {
|
|
290
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ServerPrivateNetwork' failed as data isn't a dictionary.`);
|
|
291
|
+
return {
|
|
292
|
+
createdAt: unmarshalDate(data.created_at),
|
|
293
|
+
id: data.id,
|
|
294
|
+
privateNetworkId: data.private_network_id,
|
|
295
|
+
projectId: data.project_id,
|
|
296
|
+
serverId: data.server_id,
|
|
297
|
+
status: data.status,
|
|
298
|
+
updatedAt: unmarshalDate(data.updated_at),
|
|
299
|
+
vlan: data.vlan
|
|
300
|
+
};
|
|
301
|
+
};
|
|
302
|
+
const unmarshalSetting = (data) => {
|
|
303
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Setting' failed as data isn't a dictionary.`);
|
|
304
|
+
return {
|
|
305
|
+
enabled: data.enabled,
|
|
306
|
+
id: data.id,
|
|
307
|
+
projectId: data.project_id,
|
|
308
|
+
type: data.type
|
|
309
|
+
};
|
|
310
|
+
};
|
|
311
|
+
const unmarshalBMCAccess = (data) => {
|
|
312
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'BMCAccess' failed as data isn't a dictionary.`);
|
|
313
|
+
return {
|
|
314
|
+
expiresAt: unmarshalDate(data.expires_at),
|
|
315
|
+
login: data.login,
|
|
316
|
+
password: data.password,
|
|
317
|
+
url: data.url
|
|
318
|
+
};
|
|
319
|
+
};
|
|
320
|
+
const unmarshalBatchCreateServersResponse = (data) => {
|
|
321
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'BatchCreateServersResponse' failed as data isn't a dictionary.`);
|
|
322
|
+
return { servers: unmarshalArrayOfObject(data.servers, unmarshalServer) };
|
|
323
|
+
};
|
|
324
|
+
const unmarshalGetServerMetricsResponse = (data) => {
|
|
325
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'GetServerMetricsResponse' failed as data isn't a dictionary.`);
|
|
326
|
+
return { pings: data.pings ? unmarshalTimeSeries(data.pings) : void 0 };
|
|
327
|
+
};
|
|
328
|
+
const unmarshalListOSResponse = (data) => {
|
|
329
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListOSResponse' failed as data isn't a dictionary.`);
|
|
330
|
+
return {
|
|
331
|
+
os: unmarshalArrayOfObject(data.os, unmarshalOS),
|
|
332
|
+
totalCount: data.total_count
|
|
333
|
+
};
|
|
334
|
+
};
|
|
335
|
+
const unmarshalListOffersResponse = (data) => {
|
|
336
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListOffersResponse' failed as data isn't a dictionary.`);
|
|
337
|
+
return {
|
|
338
|
+
offers: unmarshalArrayOfObject(data.offers, unmarshalOffer),
|
|
339
|
+
totalCount: data.total_count
|
|
340
|
+
};
|
|
341
|
+
};
|
|
342
|
+
const unmarshalListOptionsResponse = (data) => {
|
|
343
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListOptionsResponse' failed as data isn't a dictionary.`);
|
|
344
|
+
return {
|
|
345
|
+
options: unmarshalArrayOfObject(data.options, unmarshalOption),
|
|
346
|
+
totalCount: data.total_count
|
|
347
|
+
};
|
|
348
|
+
};
|
|
349
|
+
const unmarshalServerEvent = (data) => {
|
|
350
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ServerEvent' failed as data isn't a dictionary.`);
|
|
351
|
+
return {
|
|
352
|
+
action: data.action,
|
|
353
|
+
createdAt: unmarshalDate(data.created_at),
|
|
354
|
+
id: data.id,
|
|
355
|
+
updatedAt: unmarshalDate(data.updated_at)
|
|
356
|
+
};
|
|
357
|
+
};
|
|
358
|
+
const unmarshalListServerEventsResponse = (data) => {
|
|
359
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListServerEventsResponse' failed as data isn't a dictionary.`);
|
|
360
|
+
return {
|
|
361
|
+
events: unmarshalArrayOfObject(data.events, unmarshalServerEvent),
|
|
362
|
+
totalCount: data.total_count
|
|
363
|
+
};
|
|
364
|
+
};
|
|
365
|
+
const unmarshalListServerPrivateNetworksResponse = (data) => {
|
|
366
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListServerPrivateNetworksResponse' failed as data isn't a dictionary.`);
|
|
367
|
+
return {
|
|
368
|
+
serverPrivateNetworks: unmarshalArrayOfObject(data.server_private_networks, unmarshalServerPrivateNetwork),
|
|
369
|
+
totalCount: data.total_count
|
|
370
|
+
};
|
|
371
|
+
};
|
|
372
|
+
const unmarshalListServersResponse = (data) => {
|
|
373
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListServersResponse' failed as data isn't a dictionary.`);
|
|
374
|
+
return {
|
|
375
|
+
servers: unmarshalArrayOfObject(data.servers, unmarshalServer),
|
|
376
|
+
totalCount: data.total_count
|
|
377
|
+
};
|
|
378
|
+
};
|
|
379
|
+
const unmarshalListSettingsResponse = (data) => {
|
|
380
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListSettingsResponse' failed as data isn't a dictionary.`);
|
|
381
|
+
return {
|
|
382
|
+
settings: unmarshalArrayOfObject(data.settings, unmarshalSetting),
|
|
383
|
+
totalCount: data.total_count
|
|
384
|
+
};
|
|
385
|
+
};
|
|
386
|
+
const unmarshalSetServerPrivateNetworksResponse = (data) => {
|
|
387
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'SetServerPrivateNetworksResponse' failed as data isn't a dictionary.`);
|
|
388
|
+
return { serverPrivateNetworks: unmarshalArrayOfObject(data.server_private_networks, unmarshalServerPrivateNetwork) };
|
|
389
|
+
};
|
|
390
|
+
const marshalSchemaPartition = (request, defaults) => ({
|
|
391
|
+
label: request.label,
|
|
392
|
+
number: request.number,
|
|
393
|
+
size: request.size,
|
|
394
|
+
use_all_available_space: request.useAllAvailableSpace
|
|
395
|
+
});
|
|
396
|
+
const marshalSchemaPool = (request, defaults) => ({
|
|
397
|
+
devices: request.devices,
|
|
398
|
+
filesystem_options: request.filesystemOptions,
|
|
399
|
+
name: request.name,
|
|
400
|
+
options: request.options,
|
|
401
|
+
type: request.type
|
|
402
|
+
});
|
|
403
|
+
const marshalSchemaDisk = (request, defaults) => ({
|
|
404
|
+
device: request.device,
|
|
405
|
+
partitions: request.partitions.map((elt) => marshalSchemaPartition(elt, defaults))
|
|
406
|
+
});
|
|
407
|
+
const marshalSchemaFilesystem = (request, defaults) => ({
|
|
408
|
+
device: request.device,
|
|
409
|
+
format: request.format,
|
|
410
|
+
mountpoint: request.mountpoint
|
|
411
|
+
});
|
|
412
|
+
const marshalSchemaRAID = (request, defaults) => ({
|
|
413
|
+
devices: request.devices,
|
|
414
|
+
level: request.level,
|
|
415
|
+
name: request.name
|
|
416
|
+
});
|
|
417
|
+
const marshalSchemaZFS = (request, defaults) => ({ pools: request.pools.map((elt) => marshalSchemaPool(elt, defaults)) });
|
|
418
|
+
const marshalSchema = (request, defaults) => ({
|
|
419
|
+
disks: request.disks.map((elt) => marshalSchemaDisk(elt, defaults)),
|
|
420
|
+
filesystems: request.filesystems.map((elt) => marshalSchemaFilesystem(elt, defaults)),
|
|
421
|
+
raids: request.raids.map((elt) => marshalSchemaRAID(elt, defaults)),
|
|
422
|
+
zfs: request.zfs !== void 0 ? marshalSchemaZFS(request.zfs, defaults) : void 0
|
|
423
|
+
});
|
|
424
|
+
const marshalCreateServerRequestInstall = (request, defaults) => ({
|
|
425
|
+
hostname: request.hostname,
|
|
426
|
+
os_id: request.osId,
|
|
427
|
+
partitioning_schema: request.partitioningSchema !== void 0 ? marshalSchema(request.partitioningSchema, defaults) : void 0,
|
|
428
|
+
password: request.password,
|
|
429
|
+
service_password: request.servicePassword,
|
|
430
|
+
service_user: request.serviceUser,
|
|
431
|
+
ssh_key_ids: request.sshKeyIds,
|
|
432
|
+
user: request.user
|
|
433
|
+
});
|
|
434
|
+
const marshalCreateServerRequest = (request, defaults) => ({
|
|
435
|
+
description: request.description,
|
|
436
|
+
install: request.install !== void 0 ? marshalCreateServerRequestInstall(request.install, defaults) : void 0,
|
|
437
|
+
name: request.name,
|
|
438
|
+
offer_id: request.offerId,
|
|
439
|
+
option_ids: request.optionIds,
|
|
440
|
+
protected: request.protected,
|
|
441
|
+
tags: request.tags,
|
|
442
|
+
user_data: request.userData,
|
|
443
|
+
...resolveOneOf([{
|
|
444
|
+
default: defaults.defaultProjectId,
|
|
445
|
+
param: "project_id",
|
|
446
|
+
value: request.projectId
|
|
447
|
+
}, {
|
|
448
|
+
default: defaults.defaultOrganizationId,
|
|
449
|
+
param: "organization_id",
|
|
450
|
+
value: request.organizationId
|
|
451
|
+
}])
|
|
452
|
+
});
|
|
453
|
+
const marshalAddOptionServerRequest = (request, defaults) => ({ expires_at: request.expiresAt });
|
|
454
|
+
const marshalBatchCreateServersRequestServerConfig = (request, defaults) => ({
|
|
455
|
+
description: request.description,
|
|
456
|
+
hostname: request.hostname,
|
|
457
|
+
tags: request.tags
|
|
458
|
+
});
|
|
459
|
+
const marshalBatchCreateServersRequest = (request, defaults) => ({
|
|
460
|
+
common_configuration: request.commonConfiguration !== void 0 ? marshalCreateServerRequest(request.commonConfiguration, defaults) : void 0,
|
|
461
|
+
servers: request.servers !== void 0 ? request.servers.map((elt) => marshalBatchCreateServersRequestServerConfig(elt, defaults)) : void 0
|
|
462
|
+
});
|
|
463
|
+
const marshalInstallServerRequest = async (request, defaults) => ({
|
|
464
|
+
hostname: request.hostname,
|
|
465
|
+
os_id: request.osId,
|
|
466
|
+
partitioning_schema: request.partitioningSchema !== void 0 ? marshalSchema(request.partitioningSchema, defaults) : void 0,
|
|
467
|
+
password: request.password,
|
|
468
|
+
service_password: request.servicePassword,
|
|
469
|
+
service_user: request.serviceUser,
|
|
470
|
+
ssh_key_ids: request.sshKeyIds,
|
|
471
|
+
user: request.user,
|
|
472
|
+
user_data: request.userData !== void 0 ? await marshalBlobToScwFile(request.userData) : void 0
|
|
473
|
+
});
|
|
474
|
+
const marshalPrivateNetworkApiAddServerPrivateNetworkRequest = (request, defaults) => ({ private_network_id: request.privateNetworkId });
|
|
475
|
+
const marshalPrivateNetworkApiSetServerPrivateNetworksRequest = (request, defaults) => ({ private_network_ids: request.privateNetworkIds });
|
|
476
|
+
const marshalRebootServerRequest = (request, defaults) => ({
|
|
477
|
+
boot_type: request.bootType,
|
|
478
|
+
ssh_key_ids: request.sshKeyIds
|
|
479
|
+
});
|
|
480
|
+
const marshalStartBMCAccessRequest = (request, defaults) => ({ ip: request.ip });
|
|
481
|
+
const marshalStartServerRequest = (request, defaults) => ({
|
|
482
|
+
boot_type: request.bootType,
|
|
483
|
+
ssh_key_ids: request.sshKeyIds
|
|
484
|
+
});
|
|
485
|
+
const marshalUpdateIPRequest = (request, defaults) => ({ reverse: request.reverse });
|
|
486
|
+
const marshalUpdateServerRequest = (request, defaults) => ({
|
|
487
|
+
description: request.description,
|
|
488
|
+
name: request.name,
|
|
489
|
+
protected: request.protected,
|
|
490
|
+
tags: request.tags,
|
|
491
|
+
user_data: request.userData
|
|
492
|
+
});
|
|
493
|
+
const marshalUpdateSettingRequest = (request, defaults) => ({ enabled: request.enabled });
|
|
494
|
+
const marshalValidatePartitioningSchemaRequest = (request, defaults) => ({
|
|
495
|
+
offer_id: request.offerId,
|
|
496
|
+
os_id: request.osId,
|
|
497
|
+
partitioning_schema: request.partitioningSchema !== void 0 ? marshalSchema(request.partitioningSchema, defaults) : void 0
|
|
498
|
+
});
|
|
499
|
+
//#endregion
|
|
500
|
+
export { marshalAddOptionServerRequest, marshalBatchCreateServersRequest, marshalCreateServerRequest, marshalInstallServerRequest, marshalPrivateNetworkApiAddServerPrivateNetworkRequest, marshalPrivateNetworkApiSetServerPrivateNetworksRequest, marshalRebootServerRequest, marshalSchema, marshalStartBMCAccessRequest, marshalStartServerRequest, marshalUpdateIPRequest, marshalUpdateServerRequest, marshalUpdateSettingRequest, marshalValidatePartitioningSchemaRequest, unmarshalBMCAccess, unmarshalBatchCreateServersResponse, unmarshalGetServerMetricsResponse, unmarshalIP, unmarshalListOSResponse, unmarshalListOffersResponse, unmarshalListOptionsResponse, unmarshalListServerEventsResponse, unmarshalListServerPrivateNetworksResponse, unmarshalListServersResponse, unmarshalListSettingsResponse, unmarshalOS, unmarshalOffer, unmarshalOption, unmarshalSchema, unmarshalServer, unmarshalServerPrivateNetwork, unmarshalSetServerPrivateNetworksResponse, unmarshalSetting };
|