@scaleway/sdk-applesilicon 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +191 -0
- package/dist/index.gen.cjs +4 -0
- package/dist/index.gen.d.ts +5 -0
- package/dist/index.gen.js +4 -0
- package/dist/v1alpha1/api.gen.cjs +332 -0
- package/dist/v1alpha1/api.gen.d.ts +153 -0
- package/dist/v1alpha1/api.gen.js +332 -0
- package/dist/v1alpha1/content.gen.cjs +16 -0
- package/dist/v1alpha1/content.gen.d.ts +7 -0
- package/dist/v1alpha1/content.gen.js +16 -0
- package/dist/v1alpha1/index.gen.cjs +27 -0
- package/dist/v1alpha1/index.gen.d.ts +4 -0
- package/dist/v1alpha1/index.gen.js +27 -0
- package/dist/v1alpha1/marshalling.gen.cjs +298 -0
- package/dist/v1alpha1/marshalling.gen.d.ts +19 -0
- package/dist/v1alpha1/marshalling.gen.js +298 -0
- package/dist/v1alpha1/types.gen.d.ts +564 -0
- package/package.json +51 -0
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const randomName = require("@scaleway/random-name");
|
|
4
|
+
const sdkClient = require("@scaleway/sdk-client");
|
|
5
|
+
const unmarshalOS = (data) => {
|
|
6
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
7
|
+
throw new TypeError(
|
|
8
|
+
`Unmarshalling the type 'OS' failed as data isn't a dictionary.`
|
|
9
|
+
);
|
|
10
|
+
}
|
|
11
|
+
return {
|
|
12
|
+
compatibleServerTypes: data.compatible_server_types,
|
|
13
|
+
family: data.family,
|
|
14
|
+
id: data.id,
|
|
15
|
+
imageUrl: data.image_url,
|
|
16
|
+
isBeta: data.is_beta,
|
|
17
|
+
label: data.label,
|
|
18
|
+
name: data.name,
|
|
19
|
+
version: data.version,
|
|
20
|
+
xcodeVersion: data.xcode_version
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
const unmarshalServerPrivateNetwork = (data) => {
|
|
24
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
25
|
+
throw new TypeError(
|
|
26
|
+
`Unmarshalling the type 'ServerPrivateNetwork' failed as data isn't a dictionary.`
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
createdAt: sdkClient.unmarshalDate(data.created_at),
|
|
31
|
+
id: data.id,
|
|
32
|
+
ipamIpIds: data.ipam_ip_ids,
|
|
33
|
+
privateNetworkId: data.private_network_id,
|
|
34
|
+
projectId: data.project_id,
|
|
35
|
+
serverId: data.server_id,
|
|
36
|
+
status: data.status,
|
|
37
|
+
updatedAt: sdkClient.unmarshalDate(data.updated_at),
|
|
38
|
+
vlan: data.vlan
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
const unmarshalServerTypeCPU = (data) => {
|
|
42
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
43
|
+
throw new TypeError(
|
|
44
|
+
`Unmarshalling the type 'ServerTypeCPU' failed as data isn't a dictionary.`
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
coreCount: data.core_count,
|
|
49
|
+
frequency: data.frequency,
|
|
50
|
+
name: data.name
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
const unmarshalServerTypeDisk = (data) => {
|
|
54
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
55
|
+
throw new TypeError(
|
|
56
|
+
`Unmarshalling the type 'ServerTypeDisk' failed as data isn't a dictionary.`
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
capacity: data.capacity,
|
|
61
|
+
type: data.type
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
const unmarshalServerTypeGPU = (data) => {
|
|
65
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
66
|
+
throw new TypeError(
|
|
67
|
+
`Unmarshalling the type 'ServerTypeGPU' failed as data isn't a dictionary.`
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
return {
|
|
71
|
+
count: data.count
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
const unmarshalServerTypeMemory = (data) => {
|
|
75
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
76
|
+
throw new TypeError(
|
|
77
|
+
`Unmarshalling the type 'ServerTypeMemory' failed as data isn't a dictionary.`
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
return {
|
|
81
|
+
capacity: data.capacity,
|
|
82
|
+
type: data.type
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
const unmarshalServerTypeNetwork = (data) => {
|
|
86
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
87
|
+
throw new TypeError(
|
|
88
|
+
`Unmarshalling the type 'ServerTypeNetwork' failed as data isn't a dictionary.`
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
return {
|
|
92
|
+
publicBandwidthBps: data.public_bandwidth_bps
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
const unmarshalServerType = (data) => {
|
|
96
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
97
|
+
throw new TypeError(
|
|
98
|
+
`Unmarshalling the type 'ServerType' failed as data isn't a dictionary.`
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
return {
|
|
102
|
+
cpu: data.cpu ? unmarshalServerTypeCPU(data.cpu) : void 0,
|
|
103
|
+
defaultOs: data.default_os ? unmarshalOS(data.default_os) : void 0,
|
|
104
|
+
disk: data.disk ? unmarshalServerTypeDisk(data.disk) : void 0,
|
|
105
|
+
gpu: data.gpu ? unmarshalServerTypeGPU(data.gpu) : void 0,
|
|
106
|
+
memory: data.memory ? unmarshalServerTypeMemory(data.memory) : void 0,
|
|
107
|
+
minimumLeaseDuration: data.minimum_lease_duration,
|
|
108
|
+
name: data.name,
|
|
109
|
+
network: data.network ? unmarshalServerTypeNetwork(data.network) : void 0,
|
|
110
|
+
stock: data.stock
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
const unmarshalCommitment = (data) => {
|
|
114
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
115
|
+
throw new TypeError(
|
|
116
|
+
`Unmarshalling the type 'Commitment' failed as data isn't a dictionary.`
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
return {
|
|
120
|
+
cancelled: data.cancelled,
|
|
121
|
+
type: data.type
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
const unmarshalServer = (data) => {
|
|
125
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
126
|
+
throw new TypeError(
|
|
127
|
+
`Unmarshalling the type 'Server' failed as data isn't a dictionary.`
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
return {
|
|
131
|
+
commitment: data.commitment ? unmarshalCommitment(data.commitment) : void 0,
|
|
132
|
+
createdAt: sdkClient.unmarshalDate(data.created_at),
|
|
133
|
+
deletableAt: sdkClient.unmarshalDate(data.deletable_at),
|
|
134
|
+
deletionScheduled: data.deletion_scheduled,
|
|
135
|
+
delivered: data.delivered,
|
|
136
|
+
id: data.id,
|
|
137
|
+
ip: data.ip,
|
|
138
|
+
name: data.name,
|
|
139
|
+
organizationId: data.organization_id,
|
|
140
|
+
os: data.os ? unmarshalOS(data.os) : void 0,
|
|
141
|
+
projectId: data.project_id,
|
|
142
|
+
sshUsername: data.ssh_username,
|
|
143
|
+
status: data.status,
|
|
144
|
+
sudoPassword: data.sudo_password,
|
|
145
|
+
type: data.type,
|
|
146
|
+
updatedAt: sdkClient.unmarshalDate(data.updated_at),
|
|
147
|
+
vncPort: data.vnc_port,
|
|
148
|
+
vncUrl: data.vnc_url,
|
|
149
|
+
vpcStatus: data.vpc_status,
|
|
150
|
+
zone: data.zone
|
|
151
|
+
};
|
|
152
|
+
};
|
|
153
|
+
const unmarshalConnectivityDiagnosticServerHealth = (data) => {
|
|
154
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
155
|
+
throw new TypeError(
|
|
156
|
+
`Unmarshalling the type 'ConnectivityDiagnosticServerHealth' failed as data isn't a dictionary.`
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
return {
|
|
160
|
+
isAgentAlive: data.is_agent_alive,
|
|
161
|
+
isMdmAlive: data.is_mdm_alive,
|
|
162
|
+
isServerAlive: data.is_server_alive,
|
|
163
|
+
isSshPortUp: data.is_ssh_port_up,
|
|
164
|
+
isVncPortUp: data.is_vnc_port_up,
|
|
165
|
+
lastCheckinDate: sdkClient.unmarshalDate(data.last_checkin_date)
|
|
166
|
+
};
|
|
167
|
+
};
|
|
168
|
+
const unmarshalConnectivityDiagnostic = (data) => {
|
|
169
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
170
|
+
throw new TypeError(
|
|
171
|
+
`Unmarshalling the type 'ConnectivityDiagnostic' failed as data isn't a dictionary.`
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
return {
|
|
175
|
+
errorMessage: data.error_message,
|
|
176
|
+
healthDetails: data.health_details ? unmarshalConnectivityDiagnosticServerHealth(data.health_details) : void 0,
|
|
177
|
+
id: data.id,
|
|
178
|
+
isHealthy: data.is_healthy,
|
|
179
|
+
status: data.status,
|
|
180
|
+
supportedActions: data.supported_actions
|
|
181
|
+
};
|
|
182
|
+
};
|
|
183
|
+
const unmarshalListOSResponse = (data) => {
|
|
184
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
185
|
+
throw new TypeError(
|
|
186
|
+
`Unmarshalling the type 'ListOSResponse' failed as data isn't a dictionary.`
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
return {
|
|
190
|
+
os: sdkClient.unmarshalArrayOfObject(data.os, unmarshalOS),
|
|
191
|
+
totalCount: data.total_count
|
|
192
|
+
};
|
|
193
|
+
};
|
|
194
|
+
const unmarshalListServerPrivateNetworksResponse = (data) => {
|
|
195
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
196
|
+
throw new TypeError(
|
|
197
|
+
`Unmarshalling the type 'ListServerPrivateNetworksResponse' failed as data isn't a dictionary.`
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
return {
|
|
201
|
+
serverPrivateNetworks: sdkClient.unmarshalArrayOfObject(
|
|
202
|
+
data.server_private_networks,
|
|
203
|
+
unmarshalServerPrivateNetwork
|
|
204
|
+
),
|
|
205
|
+
totalCount: data.total_count
|
|
206
|
+
};
|
|
207
|
+
};
|
|
208
|
+
const unmarshalListServerTypesResponse = (data) => {
|
|
209
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
210
|
+
throw new TypeError(
|
|
211
|
+
`Unmarshalling the type 'ListServerTypesResponse' failed as data isn't a dictionary.`
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
return {
|
|
215
|
+
serverTypes: sdkClient.unmarshalArrayOfObject(data.server_types, unmarshalServerType)
|
|
216
|
+
};
|
|
217
|
+
};
|
|
218
|
+
const unmarshalListServersResponse = (data) => {
|
|
219
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
220
|
+
throw new TypeError(
|
|
221
|
+
`Unmarshalling the type 'ListServersResponse' failed as data isn't a dictionary.`
|
|
222
|
+
);
|
|
223
|
+
}
|
|
224
|
+
return {
|
|
225
|
+
servers: sdkClient.unmarshalArrayOfObject(data.servers, unmarshalServer),
|
|
226
|
+
totalCount: data.total_count
|
|
227
|
+
};
|
|
228
|
+
};
|
|
229
|
+
const unmarshalSetServerPrivateNetworksResponse = (data) => {
|
|
230
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
231
|
+
throw new TypeError(
|
|
232
|
+
`Unmarshalling the type 'SetServerPrivateNetworksResponse' failed as data isn't a dictionary.`
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
return {
|
|
236
|
+
serverPrivateNetworks: sdkClient.unmarshalArrayOfObject(
|
|
237
|
+
data.server_private_networks,
|
|
238
|
+
unmarshalServerPrivateNetwork
|
|
239
|
+
)
|
|
240
|
+
};
|
|
241
|
+
};
|
|
242
|
+
const unmarshalStartConnectivityDiagnosticResponse = (data) => {
|
|
243
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
244
|
+
throw new TypeError(
|
|
245
|
+
`Unmarshalling the type 'StartConnectivityDiagnosticResponse' failed as data isn't a dictionary.`
|
|
246
|
+
);
|
|
247
|
+
}
|
|
248
|
+
return {
|
|
249
|
+
diagnosticId: data.diagnostic_id
|
|
250
|
+
};
|
|
251
|
+
};
|
|
252
|
+
const marshalCreateServerRequest = (request, defaults) => ({
|
|
253
|
+
commitment_type: request.commitmentType,
|
|
254
|
+
enable_vpc: request.enableVpc,
|
|
255
|
+
name: request.name || randomName("as"),
|
|
256
|
+
os_id: request.osId,
|
|
257
|
+
project_id: request.projectId ?? defaults.defaultProjectId,
|
|
258
|
+
type: request.type
|
|
259
|
+
});
|
|
260
|
+
const marshalPrivateNetworkApiAddServerPrivateNetworkRequest = (request, defaults) => ({
|
|
261
|
+
ipam_ip_ids: request.ipamIpIds,
|
|
262
|
+
private_network_id: request.privateNetworkId
|
|
263
|
+
});
|
|
264
|
+
const marshalPrivateNetworkApiSetServerPrivateNetworksRequest = (request, defaults) => ({
|
|
265
|
+
per_private_network_ipam_ip_ids: request.perPrivateNetworkIpamIpIds
|
|
266
|
+
});
|
|
267
|
+
const marshalReinstallServerRequest = (request, defaults) => ({
|
|
268
|
+
os_id: request.osId
|
|
269
|
+
});
|
|
270
|
+
const marshalStartConnectivityDiagnosticRequest = (request, defaults) => ({
|
|
271
|
+
server_id: request.serverId
|
|
272
|
+
});
|
|
273
|
+
const marshalCommitmentTypeValue = (request, defaults) => ({
|
|
274
|
+
commitment_type: request.commitmentType
|
|
275
|
+
});
|
|
276
|
+
const marshalUpdateServerRequest = (request, defaults) => ({
|
|
277
|
+
commitment_type: request.commitmentType !== void 0 ? marshalCommitmentTypeValue(request.commitmentType) : void 0,
|
|
278
|
+
enable_vpc: request.enableVpc,
|
|
279
|
+
name: request.name,
|
|
280
|
+
schedule_deletion: request.scheduleDeletion
|
|
281
|
+
});
|
|
282
|
+
exports.marshalCreateServerRequest = marshalCreateServerRequest;
|
|
283
|
+
exports.marshalPrivateNetworkApiAddServerPrivateNetworkRequest = marshalPrivateNetworkApiAddServerPrivateNetworkRequest;
|
|
284
|
+
exports.marshalPrivateNetworkApiSetServerPrivateNetworksRequest = marshalPrivateNetworkApiSetServerPrivateNetworksRequest;
|
|
285
|
+
exports.marshalReinstallServerRequest = marshalReinstallServerRequest;
|
|
286
|
+
exports.marshalStartConnectivityDiagnosticRequest = marshalStartConnectivityDiagnosticRequest;
|
|
287
|
+
exports.marshalUpdateServerRequest = marshalUpdateServerRequest;
|
|
288
|
+
exports.unmarshalConnectivityDiagnostic = unmarshalConnectivityDiagnostic;
|
|
289
|
+
exports.unmarshalListOSResponse = unmarshalListOSResponse;
|
|
290
|
+
exports.unmarshalListServerPrivateNetworksResponse = unmarshalListServerPrivateNetworksResponse;
|
|
291
|
+
exports.unmarshalListServerTypesResponse = unmarshalListServerTypesResponse;
|
|
292
|
+
exports.unmarshalListServersResponse = unmarshalListServersResponse;
|
|
293
|
+
exports.unmarshalOS = unmarshalOS;
|
|
294
|
+
exports.unmarshalServer = unmarshalServer;
|
|
295
|
+
exports.unmarshalServerPrivateNetwork = unmarshalServerPrivateNetwork;
|
|
296
|
+
exports.unmarshalServerType = unmarshalServerType;
|
|
297
|
+
exports.unmarshalSetServerPrivateNetworksResponse = unmarshalSetServerPrivateNetworksResponse;
|
|
298
|
+
exports.unmarshalStartConnectivityDiagnosticResponse = unmarshalStartConnectivityDiagnosticResponse;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { DefaultValues } from '@scaleway/sdk-client';
|
|
2
|
+
import type { ConnectivityDiagnostic, CreateServerRequest, ListOSResponse, ListServerPrivateNetworksResponse, ListServerTypesResponse, ListServersResponse, OS, PrivateNetworkApiAddServerPrivateNetworkRequest, PrivateNetworkApiSetServerPrivateNetworksRequest, ReinstallServerRequest, Server, ServerPrivateNetwork, ServerType, SetServerPrivateNetworksResponse, StartConnectivityDiagnosticRequest, StartConnectivityDiagnosticResponse, UpdateServerRequest } from './types.gen';
|
|
3
|
+
export declare const unmarshalOS: (data: unknown) => OS;
|
|
4
|
+
export declare const unmarshalServerPrivateNetwork: (data: unknown) => ServerPrivateNetwork;
|
|
5
|
+
export declare const unmarshalServerType: (data: unknown) => ServerType;
|
|
6
|
+
export declare const unmarshalServer: (data: unknown) => Server;
|
|
7
|
+
export declare const unmarshalConnectivityDiagnostic: (data: unknown) => ConnectivityDiagnostic;
|
|
8
|
+
export declare const unmarshalListOSResponse: (data: unknown) => ListOSResponse;
|
|
9
|
+
export declare const unmarshalListServerPrivateNetworksResponse: (data: unknown) => ListServerPrivateNetworksResponse;
|
|
10
|
+
export declare const unmarshalListServerTypesResponse: (data: unknown) => ListServerTypesResponse;
|
|
11
|
+
export declare const unmarshalListServersResponse: (data: unknown) => ListServersResponse;
|
|
12
|
+
export declare const unmarshalSetServerPrivateNetworksResponse: (data: unknown) => SetServerPrivateNetworksResponse;
|
|
13
|
+
export declare const unmarshalStartConnectivityDiagnosticResponse: (data: unknown) => StartConnectivityDiagnosticResponse;
|
|
14
|
+
export declare const marshalCreateServerRequest: (request: CreateServerRequest, defaults: DefaultValues) => Record<string, unknown>;
|
|
15
|
+
export declare const marshalPrivateNetworkApiAddServerPrivateNetworkRequest: (request: PrivateNetworkApiAddServerPrivateNetworkRequest, defaults: DefaultValues) => Record<string, unknown>;
|
|
16
|
+
export declare const marshalPrivateNetworkApiSetServerPrivateNetworksRequest: (request: PrivateNetworkApiSetServerPrivateNetworksRequest, defaults: DefaultValues) => Record<string, unknown>;
|
|
17
|
+
export declare const marshalReinstallServerRequest: (request: ReinstallServerRequest, defaults: DefaultValues) => Record<string, unknown>;
|
|
18
|
+
export declare const marshalStartConnectivityDiagnosticRequest: (request: StartConnectivityDiagnosticRequest, defaults: DefaultValues) => Record<string, unknown>;
|
|
19
|
+
export declare const marshalUpdateServerRequest: (request: UpdateServerRequest, defaults: DefaultValues) => Record<string, unknown>;
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
import randomName from "@scaleway/random-name";
|
|
2
|
+
import { isJSONObject, unmarshalDate, unmarshalArrayOfObject } from "@scaleway/sdk-client";
|
|
3
|
+
const unmarshalOS = (data) => {
|
|
4
|
+
if (!isJSONObject(data)) {
|
|
5
|
+
throw new TypeError(
|
|
6
|
+
`Unmarshalling the type 'OS' failed as data isn't a dictionary.`
|
|
7
|
+
);
|
|
8
|
+
}
|
|
9
|
+
return {
|
|
10
|
+
compatibleServerTypes: data.compatible_server_types,
|
|
11
|
+
family: data.family,
|
|
12
|
+
id: data.id,
|
|
13
|
+
imageUrl: data.image_url,
|
|
14
|
+
isBeta: data.is_beta,
|
|
15
|
+
label: data.label,
|
|
16
|
+
name: data.name,
|
|
17
|
+
version: data.version,
|
|
18
|
+
xcodeVersion: data.xcode_version
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
const unmarshalServerPrivateNetwork = (data) => {
|
|
22
|
+
if (!isJSONObject(data)) {
|
|
23
|
+
throw new TypeError(
|
|
24
|
+
`Unmarshalling the type 'ServerPrivateNetwork' failed as data isn't a dictionary.`
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
createdAt: unmarshalDate(data.created_at),
|
|
29
|
+
id: data.id,
|
|
30
|
+
ipamIpIds: data.ipam_ip_ids,
|
|
31
|
+
privateNetworkId: data.private_network_id,
|
|
32
|
+
projectId: data.project_id,
|
|
33
|
+
serverId: data.server_id,
|
|
34
|
+
status: data.status,
|
|
35
|
+
updatedAt: unmarshalDate(data.updated_at),
|
|
36
|
+
vlan: data.vlan
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
const unmarshalServerTypeCPU = (data) => {
|
|
40
|
+
if (!isJSONObject(data)) {
|
|
41
|
+
throw new TypeError(
|
|
42
|
+
`Unmarshalling the type 'ServerTypeCPU' failed as data isn't a dictionary.`
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
return {
|
|
46
|
+
coreCount: data.core_count,
|
|
47
|
+
frequency: data.frequency,
|
|
48
|
+
name: data.name
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
const unmarshalServerTypeDisk = (data) => {
|
|
52
|
+
if (!isJSONObject(data)) {
|
|
53
|
+
throw new TypeError(
|
|
54
|
+
`Unmarshalling the type 'ServerTypeDisk' failed as data isn't a dictionary.`
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
58
|
+
capacity: data.capacity,
|
|
59
|
+
type: data.type
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
const unmarshalServerTypeGPU = (data) => {
|
|
63
|
+
if (!isJSONObject(data)) {
|
|
64
|
+
throw new TypeError(
|
|
65
|
+
`Unmarshalling the type 'ServerTypeGPU' failed as data isn't a dictionary.`
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
return {
|
|
69
|
+
count: data.count
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
const unmarshalServerTypeMemory = (data) => {
|
|
73
|
+
if (!isJSONObject(data)) {
|
|
74
|
+
throw new TypeError(
|
|
75
|
+
`Unmarshalling the type 'ServerTypeMemory' failed as data isn't a dictionary.`
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
capacity: data.capacity,
|
|
80
|
+
type: data.type
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
const unmarshalServerTypeNetwork = (data) => {
|
|
84
|
+
if (!isJSONObject(data)) {
|
|
85
|
+
throw new TypeError(
|
|
86
|
+
`Unmarshalling the type 'ServerTypeNetwork' failed as data isn't a dictionary.`
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
return {
|
|
90
|
+
publicBandwidthBps: data.public_bandwidth_bps
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
const unmarshalServerType = (data) => {
|
|
94
|
+
if (!isJSONObject(data)) {
|
|
95
|
+
throw new TypeError(
|
|
96
|
+
`Unmarshalling the type 'ServerType' failed as data isn't a dictionary.`
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
return {
|
|
100
|
+
cpu: data.cpu ? unmarshalServerTypeCPU(data.cpu) : void 0,
|
|
101
|
+
defaultOs: data.default_os ? unmarshalOS(data.default_os) : void 0,
|
|
102
|
+
disk: data.disk ? unmarshalServerTypeDisk(data.disk) : void 0,
|
|
103
|
+
gpu: data.gpu ? unmarshalServerTypeGPU(data.gpu) : void 0,
|
|
104
|
+
memory: data.memory ? unmarshalServerTypeMemory(data.memory) : void 0,
|
|
105
|
+
minimumLeaseDuration: data.minimum_lease_duration,
|
|
106
|
+
name: data.name,
|
|
107
|
+
network: data.network ? unmarshalServerTypeNetwork(data.network) : void 0,
|
|
108
|
+
stock: data.stock
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
const unmarshalCommitment = (data) => {
|
|
112
|
+
if (!isJSONObject(data)) {
|
|
113
|
+
throw new TypeError(
|
|
114
|
+
`Unmarshalling the type 'Commitment' failed as data isn't a dictionary.`
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
return {
|
|
118
|
+
cancelled: data.cancelled,
|
|
119
|
+
type: data.type
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
const unmarshalServer = (data) => {
|
|
123
|
+
if (!isJSONObject(data)) {
|
|
124
|
+
throw new TypeError(
|
|
125
|
+
`Unmarshalling the type 'Server' failed as data isn't a dictionary.`
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
return {
|
|
129
|
+
commitment: data.commitment ? unmarshalCommitment(data.commitment) : void 0,
|
|
130
|
+
createdAt: unmarshalDate(data.created_at),
|
|
131
|
+
deletableAt: unmarshalDate(data.deletable_at),
|
|
132
|
+
deletionScheduled: data.deletion_scheduled,
|
|
133
|
+
delivered: data.delivered,
|
|
134
|
+
id: data.id,
|
|
135
|
+
ip: data.ip,
|
|
136
|
+
name: data.name,
|
|
137
|
+
organizationId: data.organization_id,
|
|
138
|
+
os: data.os ? unmarshalOS(data.os) : void 0,
|
|
139
|
+
projectId: data.project_id,
|
|
140
|
+
sshUsername: data.ssh_username,
|
|
141
|
+
status: data.status,
|
|
142
|
+
sudoPassword: data.sudo_password,
|
|
143
|
+
type: data.type,
|
|
144
|
+
updatedAt: unmarshalDate(data.updated_at),
|
|
145
|
+
vncPort: data.vnc_port,
|
|
146
|
+
vncUrl: data.vnc_url,
|
|
147
|
+
vpcStatus: data.vpc_status,
|
|
148
|
+
zone: data.zone
|
|
149
|
+
};
|
|
150
|
+
};
|
|
151
|
+
const unmarshalConnectivityDiagnosticServerHealth = (data) => {
|
|
152
|
+
if (!isJSONObject(data)) {
|
|
153
|
+
throw new TypeError(
|
|
154
|
+
`Unmarshalling the type 'ConnectivityDiagnosticServerHealth' failed as data isn't a dictionary.`
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
return {
|
|
158
|
+
isAgentAlive: data.is_agent_alive,
|
|
159
|
+
isMdmAlive: data.is_mdm_alive,
|
|
160
|
+
isServerAlive: data.is_server_alive,
|
|
161
|
+
isSshPortUp: data.is_ssh_port_up,
|
|
162
|
+
isVncPortUp: data.is_vnc_port_up,
|
|
163
|
+
lastCheckinDate: unmarshalDate(data.last_checkin_date)
|
|
164
|
+
};
|
|
165
|
+
};
|
|
166
|
+
const unmarshalConnectivityDiagnostic = (data) => {
|
|
167
|
+
if (!isJSONObject(data)) {
|
|
168
|
+
throw new TypeError(
|
|
169
|
+
`Unmarshalling the type 'ConnectivityDiagnostic' failed as data isn't a dictionary.`
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
return {
|
|
173
|
+
errorMessage: data.error_message,
|
|
174
|
+
healthDetails: data.health_details ? unmarshalConnectivityDiagnosticServerHealth(data.health_details) : void 0,
|
|
175
|
+
id: data.id,
|
|
176
|
+
isHealthy: data.is_healthy,
|
|
177
|
+
status: data.status,
|
|
178
|
+
supportedActions: data.supported_actions
|
|
179
|
+
};
|
|
180
|
+
};
|
|
181
|
+
const unmarshalListOSResponse = (data) => {
|
|
182
|
+
if (!isJSONObject(data)) {
|
|
183
|
+
throw new TypeError(
|
|
184
|
+
`Unmarshalling the type 'ListOSResponse' failed as data isn't a dictionary.`
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
return {
|
|
188
|
+
os: unmarshalArrayOfObject(data.os, unmarshalOS),
|
|
189
|
+
totalCount: data.total_count
|
|
190
|
+
};
|
|
191
|
+
};
|
|
192
|
+
const unmarshalListServerPrivateNetworksResponse = (data) => {
|
|
193
|
+
if (!isJSONObject(data)) {
|
|
194
|
+
throw new TypeError(
|
|
195
|
+
`Unmarshalling the type 'ListServerPrivateNetworksResponse' failed as data isn't a dictionary.`
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
return {
|
|
199
|
+
serverPrivateNetworks: unmarshalArrayOfObject(
|
|
200
|
+
data.server_private_networks,
|
|
201
|
+
unmarshalServerPrivateNetwork
|
|
202
|
+
),
|
|
203
|
+
totalCount: data.total_count
|
|
204
|
+
};
|
|
205
|
+
};
|
|
206
|
+
const unmarshalListServerTypesResponse = (data) => {
|
|
207
|
+
if (!isJSONObject(data)) {
|
|
208
|
+
throw new TypeError(
|
|
209
|
+
`Unmarshalling the type 'ListServerTypesResponse' failed as data isn't a dictionary.`
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
return {
|
|
213
|
+
serverTypes: unmarshalArrayOfObject(data.server_types, unmarshalServerType)
|
|
214
|
+
};
|
|
215
|
+
};
|
|
216
|
+
const unmarshalListServersResponse = (data) => {
|
|
217
|
+
if (!isJSONObject(data)) {
|
|
218
|
+
throw new TypeError(
|
|
219
|
+
`Unmarshalling the type 'ListServersResponse' failed as data isn't a dictionary.`
|
|
220
|
+
);
|
|
221
|
+
}
|
|
222
|
+
return {
|
|
223
|
+
servers: unmarshalArrayOfObject(data.servers, unmarshalServer),
|
|
224
|
+
totalCount: data.total_count
|
|
225
|
+
};
|
|
226
|
+
};
|
|
227
|
+
const unmarshalSetServerPrivateNetworksResponse = (data) => {
|
|
228
|
+
if (!isJSONObject(data)) {
|
|
229
|
+
throw new TypeError(
|
|
230
|
+
`Unmarshalling the type 'SetServerPrivateNetworksResponse' failed as data isn't a dictionary.`
|
|
231
|
+
);
|
|
232
|
+
}
|
|
233
|
+
return {
|
|
234
|
+
serverPrivateNetworks: unmarshalArrayOfObject(
|
|
235
|
+
data.server_private_networks,
|
|
236
|
+
unmarshalServerPrivateNetwork
|
|
237
|
+
)
|
|
238
|
+
};
|
|
239
|
+
};
|
|
240
|
+
const unmarshalStartConnectivityDiagnosticResponse = (data) => {
|
|
241
|
+
if (!isJSONObject(data)) {
|
|
242
|
+
throw new TypeError(
|
|
243
|
+
`Unmarshalling the type 'StartConnectivityDiagnosticResponse' failed as data isn't a dictionary.`
|
|
244
|
+
);
|
|
245
|
+
}
|
|
246
|
+
return {
|
|
247
|
+
diagnosticId: data.diagnostic_id
|
|
248
|
+
};
|
|
249
|
+
};
|
|
250
|
+
const marshalCreateServerRequest = (request, defaults) => ({
|
|
251
|
+
commitment_type: request.commitmentType,
|
|
252
|
+
enable_vpc: request.enableVpc,
|
|
253
|
+
name: request.name || randomName("as"),
|
|
254
|
+
os_id: request.osId,
|
|
255
|
+
project_id: request.projectId ?? defaults.defaultProjectId,
|
|
256
|
+
type: request.type
|
|
257
|
+
});
|
|
258
|
+
const marshalPrivateNetworkApiAddServerPrivateNetworkRequest = (request, defaults) => ({
|
|
259
|
+
ipam_ip_ids: request.ipamIpIds,
|
|
260
|
+
private_network_id: request.privateNetworkId
|
|
261
|
+
});
|
|
262
|
+
const marshalPrivateNetworkApiSetServerPrivateNetworksRequest = (request, defaults) => ({
|
|
263
|
+
per_private_network_ipam_ip_ids: request.perPrivateNetworkIpamIpIds
|
|
264
|
+
});
|
|
265
|
+
const marshalReinstallServerRequest = (request, defaults) => ({
|
|
266
|
+
os_id: request.osId
|
|
267
|
+
});
|
|
268
|
+
const marshalStartConnectivityDiagnosticRequest = (request, defaults) => ({
|
|
269
|
+
server_id: request.serverId
|
|
270
|
+
});
|
|
271
|
+
const marshalCommitmentTypeValue = (request, defaults) => ({
|
|
272
|
+
commitment_type: request.commitmentType
|
|
273
|
+
});
|
|
274
|
+
const marshalUpdateServerRequest = (request, defaults) => ({
|
|
275
|
+
commitment_type: request.commitmentType !== void 0 ? marshalCommitmentTypeValue(request.commitmentType) : void 0,
|
|
276
|
+
enable_vpc: request.enableVpc,
|
|
277
|
+
name: request.name,
|
|
278
|
+
schedule_deletion: request.scheduleDeletion
|
|
279
|
+
});
|
|
280
|
+
export {
|
|
281
|
+
marshalCreateServerRequest,
|
|
282
|
+
marshalPrivateNetworkApiAddServerPrivateNetworkRequest,
|
|
283
|
+
marshalPrivateNetworkApiSetServerPrivateNetworksRequest,
|
|
284
|
+
marshalReinstallServerRequest,
|
|
285
|
+
marshalStartConnectivityDiagnosticRequest,
|
|
286
|
+
marshalUpdateServerRequest,
|
|
287
|
+
unmarshalConnectivityDiagnostic,
|
|
288
|
+
unmarshalListOSResponse,
|
|
289
|
+
unmarshalListServerPrivateNetworksResponse,
|
|
290
|
+
unmarshalListServerTypesResponse,
|
|
291
|
+
unmarshalListServersResponse,
|
|
292
|
+
unmarshalOS,
|
|
293
|
+
unmarshalServer,
|
|
294
|
+
unmarshalServerPrivateNetwork,
|
|
295
|
+
unmarshalServerType,
|
|
296
|
+
unmarshalSetServerPrivateNetworksResponse,
|
|
297
|
+
unmarshalStartConnectivityDiagnosticResponse
|
|
298
|
+
};
|