@scaleway/sdk-qaas 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +510 -0
- package/dist/v1alpha1/api.gen.d.ts +239 -0
- package/dist/v1alpha1/api.gen.js +510 -0
- package/dist/v1alpha1/content.gen.cjs +19 -0
- package/dist/v1alpha1/content.gen.d.ts +7 -0
- package/dist/v1alpha1/content.gen.js +19 -0
- package/dist/v1alpha1/index.gen.cjs +31 -0
- package/dist/v1alpha1/index.gen.d.ts +5 -0
- package/dist/v1alpha1/index.gen.js +31 -0
- package/dist/v1alpha1/marshalling.gen.cjs +322 -0
- package/dist/v1alpha1/marshalling.gen.d.ts +22 -0
- package/dist/v1alpha1/marshalling.gen.js +322 -0
- package/dist/v1alpha1/types.gen.d.ts +814 -0
- package/dist/v1alpha1/validation-rules.gen.cjs +14 -0
- package/dist/v1alpha1/validation-rules.gen.d.ts +10 -0
- package/dist/v1alpha1/validation-rules.gen.js +14 -0
- package/package.json +51 -0
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const sdkClient = require("@scaleway/sdk-client");
|
|
4
|
+
const unmarshalJobCircuit = (data) => {
|
|
5
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
6
|
+
throw new TypeError(
|
|
7
|
+
`Unmarshalling the type 'JobCircuit' failed as data isn't a dictionary.`
|
|
8
|
+
);
|
|
9
|
+
}
|
|
10
|
+
return {
|
|
11
|
+
percevalCircuit: data.perceval_circuit,
|
|
12
|
+
qiskitCircuit: data.qiskit_circuit
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
const unmarshalApplication = (data) => {
|
|
16
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
17
|
+
throw new TypeError(
|
|
18
|
+
`Unmarshalling the type 'Application' failed as data isn't a dictionary.`
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
return {
|
|
22
|
+
compatiblePlatformIds: data.compatible_platform_ids,
|
|
23
|
+
id: data.id,
|
|
24
|
+
inputTemplate: data.input_template,
|
|
25
|
+
name: data.name,
|
|
26
|
+
type: data.type
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
const unmarshalJob = (data) => {
|
|
30
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
31
|
+
throw new TypeError(
|
|
32
|
+
`Unmarshalling the type 'Job' failed as data isn't a dictionary.`
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
createdAt: sdkClient.unmarshalDate(data.created_at),
|
|
37
|
+
id: data.id,
|
|
38
|
+
jobDuration: data.job_duration,
|
|
39
|
+
name: data.name,
|
|
40
|
+
progressMessage: data.progress_message,
|
|
41
|
+
resultDistribution: data.result_distribution,
|
|
42
|
+
sessionId: data.session_id,
|
|
43
|
+
startedAt: sdkClient.unmarshalDate(data.started_at),
|
|
44
|
+
status: data.status,
|
|
45
|
+
tags: data.tags,
|
|
46
|
+
updatedAt: sdkClient.unmarshalDate(data.updated_at)
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
const unmarshalPlatformHardware = (data) => {
|
|
50
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
51
|
+
throw new TypeError(
|
|
52
|
+
`Unmarshalling the type 'PlatformHardware' failed as data isn't a dictionary.`
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
gpus: data.gpus,
|
|
57
|
+
gpusNetwork: data.gpus_network,
|
|
58
|
+
name: data.name,
|
|
59
|
+
ram: data.ram,
|
|
60
|
+
vcpus: data.vcpus,
|
|
61
|
+
vram: data.vram
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
const unmarshalPlatform = (data) => {
|
|
65
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
66
|
+
throw new TypeError(
|
|
67
|
+
`Unmarshalling the type 'Platform' failed as data isn't a dictionary.`
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
return {
|
|
71
|
+
availability: data.availability,
|
|
72
|
+
backendName: data.backend_name,
|
|
73
|
+
hardware: data.hardware ? unmarshalPlatformHardware(data.hardware) : void 0,
|
|
74
|
+
id: data.id,
|
|
75
|
+
maxCircuitCount: data.max_circuit_count,
|
|
76
|
+
maxQubitCount: data.max_qubit_count,
|
|
77
|
+
maxShotCount: data.max_shot_count,
|
|
78
|
+
metadata: data.metadata,
|
|
79
|
+
name: data.name,
|
|
80
|
+
pricePerCircuit: data.price_per_circuit ? sdkClient.unmarshalMoney(data.price_per_circuit) : void 0,
|
|
81
|
+
pricePerHour: data.price_per_hour ? sdkClient.unmarshalMoney(data.price_per_hour) : void 0,
|
|
82
|
+
pricePerShot: data.price_per_shot ? sdkClient.unmarshalMoney(data.price_per_shot) : void 0,
|
|
83
|
+
providerName: data.provider_name,
|
|
84
|
+
technology: data.technology,
|
|
85
|
+
type: data.type,
|
|
86
|
+
version: data.version
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
const unmarshalProcess = (data) => {
|
|
90
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
91
|
+
throw new TypeError(
|
|
92
|
+
`Unmarshalling the type 'Process' failed as data isn't a dictionary.`
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
return {
|
|
96
|
+
applicationId: data.application_id,
|
|
97
|
+
attachedSessionIds: data.attached_session_ids,
|
|
98
|
+
createdAt: sdkClient.unmarshalDate(data.created_at),
|
|
99
|
+
finishedAt: sdkClient.unmarshalDate(data.finished_at),
|
|
100
|
+
id: data.id,
|
|
101
|
+
input: data.input,
|
|
102
|
+
name: data.name,
|
|
103
|
+
platformId: data.platform_id,
|
|
104
|
+
progress: data.progress,
|
|
105
|
+
progressMessage: data.progress_message,
|
|
106
|
+
projectId: data.project_id,
|
|
107
|
+
startedAt: sdkClient.unmarshalDate(data.started_at),
|
|
108
|
+
status: data.status,
|
|
109
|
+
tags: data.tags,
|
|
110
|
+
updatedAt: sdkClient.unmarshalDate(data.updated_at)
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
const unmarshalSession = (data) => {
|
|
114
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
115
|
+
throw new TypeError(
|
|
116
|
+
`Unmarshalling the type 'Session' failed as data isn't a dictionary.`
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
return {
|
|
120
|
+
createdAt: sdkClient.unmarshalDate(data.created_at),
|
|
121
|
+
deduplicationId: data.deduplication_id,
|
|
122
|
+
finishedJobCount: data.finished_job_count,
|
|
123
|
+
id: data.id,
|
|
124
|
+
maxDuration: data.max_duration,
|
|
125
|
+
maxIdleDuration: data.max_idle_duration,
|
|
126
|
+
name: data.name,
|
|
127
|
+
originId: data.origin_id,
|
|
128
|
+
originType: data.origin_type,
|
|
129
|
+
platformId: data.platform_id,
|
|
130
|
+
progressMessage: data.progress_message,
|
|
131
|
+
projectId: data.project_id,
|
|
132
|
+
startedAt: sdkClient.unmarshalDate(data.started_at),
|
|
133
|
+
status: data.status,
|
|
134
|
+
tags: data.tags,
|
|
135
|
+
terminatedAt: sdkClient.unmarshalDate(data.terminated_at),
|
|
136
|
+
updatedAt: sdkClient.unmarshalDate(data.updated_at),
|
|
137
|
+
waitingJobCount: data.waiting_job_count
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
const unmarshalListApplicationsResponse = (data) => {
|
|
141
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
142
|
+
throw new TypeError(
|
|
143
|
+
`Unmarshalling the type 'ListApplicationsResponse' failed as data isn't a dictionary.`
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
return {
|
|
147
|
+
applications: sdkClient.unmarshalArrayOfObject(
|
|
148
|
+
data.applications,
|
|
149
|
+
unmarshalApplication
|
|
150
|
+
),
|
|
151
|
+
totalCount: data.total_count
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
const unmarshalJobResult = (data) => {
|
|
155
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
156
|
+
throw new TypeError(
|
|
157
|
+
`Unmarshalling the type 'JobResult' failed as data isn't a dictionary.`
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
return {
|
|
161
|
+
createdAt: sdkClient.unmarshalDate(data.created_at),
|
|
162
|
+
jobId: data.job_id,
|
|
163
|
+
result: data.result,
|
|
164
|
+
url: data.url
|
|
165
|
+
};
|
|
166
|
+
};
|
|
167
|
+
const unmarshalListJobResultsResponse = (data) => {
|
|
168
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
169
|
+
throw new TypeError(
|
|
170
|
+
`Unmarshalling the type 'ListJobResultsResponse' failed as data isn't a dictionary.`
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
return {
|
|
174
|
+
jobResults: sdkClient.unmarshalArrayOfObject(data.job_results, unmarshalJobResult),
|
|
175
|
+
totalCount: data.total_count
|
|
176
|
+
};
|
|
177
|
+
};
|
|
178
|
+
const unmarshalListJobsResponse = (data) => {
|
|
179
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
180
|
+
throw new TypeError(
|
|
181
|
+
`Unmarshalling the type 'ListJobsResponse' failed as data isn't a dictionary.`
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
return {
|
|
185
|
+
jobs: sdkClient.unmarshalArrayOfObject(data.jobs, unmarshalJob),
|
|
186
|
+
totalCount: data.total_count
|
|
187
|
+
};
|
|
188
|
+
};
|
|
189
|
+
const unmarshalListPlatformsResponse = (data) => {
|
|
190
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
191
|
+
throw new TypeError(
|
|
192
|
+
`Unmarshalling the type 'ListPlatformsResponse' failed as data isn't a dictionary.`
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
return {
|
|
196
|
+
platforms: sdkClient.unmarshalArrayOfObject(data.platforms, unmarshalPlatform),
|
|
197
|
+
totalCount: data.total_count
|
|
198
|
+
};
|
|
199
|
+
};
|
|
200
|
+
const unmarshalProcessResult = (data) => {
|
|
201
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
202
|
+
throw new TypeError(
|
|
203
|
+
`Unmarshalling the type 'ProcessResult' failed as data isn't a dictionary.`
|
|
204
|
+
);
|
|
205
|
+
}
|
|
206
|
+
return {
|
|
207
|
+
createdAt: sdkClient.unmarshalDate(data.created_at),
|
|
208
|
+
processId: data.process_id,
|
|
209
|
+
result: data.result
|
|
210
|
+
};
|
|
211
|
+
};
|
|
212
|
+
const unmarshalListProcessResultsResponse = (data) => {
|
|
213
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
214
|
+
throw new TypeError(
|
|
215
|
+
`Unmarshalling the type 'ListProcessResultsResponse' failed as data isn't a dictionary.`
|
|
216
|
+
);
|
|
217
|
+
}
|
|
218
|
+
return {
|
|
219
|
+
processResults: sdkClient.unmarshalArrayOfObject(
|
|
220
|
+
data.process_results,
|
|
221
|
+
unmarshalProcessResult
|
|
222
|
+
),
|
|
223
|
+
totalCount: data.total_count
|
|
224
|
+
};
|
|
225
|
+
};
|
|
226
|
+
const unmarshalListProcessesResponse = (data) => {
|
|
227
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
228
|
+
throw new TypeError(
|
|
229
|
+
`Unmarshalling the type 'ListProcessesResponse' failed as data isn't a dictionary.`
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
return {
|
|
233
|
+
processes: sdkClient.unmarshalArrayOfObject(data.processes, unmarshalProcess),
|
|
234
|
+
totalCount: data.total_count
|
|
235
|
+
};
|
|
236
|
+
};
|
|
237
|
+
const unmarshalListSessionACLsResponse = (data) => {
|
|
238
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
239
|
+
throw new TypeError(
|
|
240
|
+
`Unmarshalling the type 'ListSessionACLsResponse' failed as data isn't a dictionary.`
|
|
241
|
+
);
|
|
242
|
+
}
|
|
243
|
+
return {
|
|
244
|
+
acls: data.acls,
|
|
245
|
+
totalCount: data.total_count
|
|
246
|
+
};
|
|
247
|
+
};
|
|
248
|
+
const unmarshalListSessionsResponse = (data) => {
|
|
249
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
250
|
+
throw new TypeError(
|
|
251
|
+
`Unmarshalling the type 'ListSessionsResponse' failed as data isn't a dictionary.`
|
|
252
|
+
);
|
|
253
|
+
}
|
|
254
|
+
return {
|
|
255
|
+
sessions: sdkClient.unmarshalArrayOfObject(data.sessions, unmarshalSession),
|
|
256
|
+
totalCount: data.total_count
|
|
257
|
+
};
|
|
258
|
+
};
|
|
259
|
+
const marshalJobCircuit = (request, defaults) => ({
|
|
260
|
+
...sdkClient.resolveOneOf([
|
|
261
|
+
{ param: "perceval_circuit", value: request.percevalCircuit },
|
|
262
|
+
{ param: "qiskit_circuit", value: request.qiskitCircuit }
|
|
263
|
+
])
|
|
264
|
+
});
|
|
265
|
+
const marshalCreateJobRequest = (request, defaults) => ({
|
|
266
|
+
circuit: marshalJobCircuit(request.circuit),
|
|
267
|
+
max_duration: request.maxDuration,
|
|
268
|
+
name: request.name,
|
|
269
|
+
session_id: request.sessionId,
|
|
270
|
+
tags: request.tags
|
|
271
|
+
});
|
|
272
|
+
const marshalCreateProcessRequest = (request, defaults) => ({
|
|
273
|
+
application_id: request.applicationId,
|
|
274
|
+
input: request.input,
|
|
275
|
+
name: request.name,
|
|
276
|
+
platform_id: request.platformId,
|
|
277
|
+
project_id: request.projectId ?? defaults.defaultProjectId,
|
|
278
|
+
tags: request.tags
|
|
279
|
+
});
|
|
280
|
+
const marshalCreateSessionRequest = (request, defaults) => ({
|
|
281
|
+
deduplication_id: request.deduplicationId,
|
|
282
|
+
max_duration: request.maxDuration,
|
|
283
|
+
max_idle_duration: request.maxIdleDuration,
|
|
284
|
+
name: request.name,
|
|
285
|
+
platform_id: request.platformId,
|
|
286
|
+
project_id: request.projectId ?? defaults.defaultProjectId,
|
|
287
|
+
tags: request.tags
|
|
288
|
+
});
|
|
289
|
+
const marshalUpdateJobRequest = (request, defaults) => ({
|
|
290
|
+
name: request.name,
|
|
291
|
+
tags: request.tags
|
|
292
|
+
});
|
|
293
|
+
const marshalUpdateProcessRequest = (request, defaults) => ({
|
|
294
|
+
name: request.name,
|
|
295
|
+
tags: request.tags
|
|
296
|
+
});
|
|
297
|
+
const marshalUpdateSessionRequest = (request, defaults) => ({
|
|
298
|
+
max_duration: request.maxDuration,
|
|
299
|
+
max_idle_duration: request.maxIdleDuration,
|
|
300
|
+
name: request.name,
|
|
301
|
+
tags: request.tags
|
|
302
|
+
});
|
|
303
|
+
exports.marshalCreateJobRequest = marshalCreateJobRequest;
|
|
304
|
+
exports.marshalCreateProcessRequest = marshalCreateProcessRequest;
|
|
305
|
+
exports.marshalCreateSessionRequest = marshalCreateSessionRequest;
|
|
306
|
+
exports.marshalUpdateJobRequest = marshalUpdateJobRequest;
|
|
307
|
+
exports.marshalUpdateProcessRequest = marshalUpdateProcessRequest;
|
|
308
|
+
exports.marshalUpdateSessionRequest = marshalUpdateSessionRequest;
|
|
309
|
+
exports.unmarshalApplication = unmarshalApplication;
|
|
310
|
+
exports.unmarshalJob = unmarshalJob;
|
|
311
|
+
exports.unmarshalJobCircuit = unmarshalJobCircuit;
|
|
312
|
+
exports.unmarshalListApplicationsResponse = unmarshalListApplicationsResponse;
|
|
313
|
+
exports.unmarshalListJobResultsResponse = unmarshalListJobResultsResponse;
|
|
314
|
+
exports.unmarshalListJobsResponse = unmarshalListJobsResponse;
|
|
315
|
+
exports.unmarshalListPlatformsResponse = unmarshalListPlatformsResponse;
|
|
316
|
+
exports.unmarshalListProcessResultsResponse = unmarshalListProcessResultsResponse;
|
|
317
|
+
exports.unmarshalListProcessesResponse = unmarshalListProcessesResponse;
|
|
318
|
+
exports.unmarshalListSessionACLsResponse = unmarshalListSessionACLsResponse;
|
|
319
|
+
exports.unmarshalListSessionsResponse = unmarshalListSessionsResponse;
|
|
320
|
+
exports.unmarshalPlatform = unmarshalPlatform;
|
|
321
|
+
exports.unmarshalProcess = unmarshalProcess;
|
|
322
|
+
exports.unmarshalSession = unmarshalSession;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { DefaultValues } from '@scaleway/sdk-client';
|
|
2
|
+
import type { Application, CreateJobRequest, CreateProcessRequest, CreateSessionRequest, Job, JobCircuit, ListApplicationsResponse, ListJobResultsResponse, ListJobsResponse, ListPlatformsResponse, ListProcessResultsResponse, ListProcessesResponse, ListSessionACLsResponse, ListSessionsResponse, Platform, Process, Session, UpdateJobRequest, UpdateProcessRequest, UpdateSessionRequest } from './types.gen';
|
|
3
|
+
export declare const unmarshalJobCircuit: (data: unknown) => JobCircuit;
|
|
4
|
+
export declare const unmarshalApplication: (data: unknown) => Application;
|
|
5
|
+
export declare const unmarshalJob: (data: unknown) => Job;
|
|
6
|
+
export declare const unmarshalPlatform: (data: unknown) => Platform;
|
|
7
|
+
export declare const unmarshalProcess: (data: unknown) => Process;
|
|
8
|
+
export declare const unmarshalSession: (data: unknown) => Session;
|
|
9
|
+
export declare const unmarshalListApplicationsResponse: (data: unknown) => ListApplicationsResponse;
|
|
10
|
+
export declare const unmarshalListJobResultsResponse: (data: unknown) => ListJobResultsResponse;
|
|
11
|
+
export declare const unmarshalListJobsResponse: (data: unknown) => ListJobsResponse;
|
|
12
|
+
export declare const unmarshalListPlatformsResponse: (data: unknown) => ListPlatformsResponse;
|
|
13
|
+
export declare const unmarshalListProcessResultsResponse: (data: unknown) => ListProcessResultsResponse;
|
|
14
|
+
export declare const unmarshalListProcessesResponse: (data: unknown) => ListProcessesResponse;
|
|
15
|
+
export declare const unmarshalListSessionACLsResponse: (data: unknown) => ListSessionACLsResponse;
|
|
16
|
+
export declare const unmarshalListSessionsResponse: (data: unknown) => ListSessionsResponse;
|
|
17
|
+
export declare const marshalCreateJobRequest: (request: CreateJobRequest, defaults: DefaultValues) => Record<string, unknown>;
|
|
18
|
+
export declare const marshalCreateProcessRequest: (request: CreateProcessRequest, defaults: DefaultValues) => Record<string, unknown>;
|
|
19
|
+
export declare const marshalCreateSessionRequest: (request: CreateSessionRequest, defaults: DefaultValues) => Record<string, unknown>;
|
|
20
|
+
export declare const marshalUpdateJobRequest: (request: UpdateJobRequest, defaults: DefaultValues) => Record<string, unknown>;
|
|
21
|
+
export declare const marshalUpdateProcessRequest: (request: UpdateProcessRequest, defaults: DefaultValues) => Record<string, unknown>;
|
|
22
|
+
export declare const marshalUpdateSessionRequest: (request: UpdateSessionRequest, defaults: DefaultValues) => Record<string, unknown>;
|
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
import { resolveOneOf, isJSONObject, unmarshalDate, unmarshalMoney, unmarshalArrayOfObject } from "@scaleway/sdk-client";
|
|
2
|
+
const unmarshalJobCircuit = (data) => {
|
|
3
|
+
if (!isJSONObject(data)) {
|
|
4
|
+
throw new TypeError(
|
|
5
|
+
`Unmarshalling the type 'JobCircuit' failed as data isn't a dictionary.`
|
|
6
|
+
);
|
|
7
|
+
}
|
|
8
|
+
return {
|
|
9
|
+
percevalCircuit: data.perceval_circuit,
|
|
10
|
+
qiskitCircuit: data.qiskit_circuit
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
const unmarshalApplication = (data) => {
|
|
14
|
+
if (!isJSONObject(data)) {
|
|
15
|
+
throw new TypeError(
|
|
16
|
+
`Unmarshalling the type 'Application' failed as data isn't a dictionary.`
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
return {
|
|
20
|
+
compatiblePlatformIds: data.compatible_platform_ids,
|
|
21
|
+
id: data.id,
|
|
22
|
+
inputTemplate: data.input_template,
|
|
23
|
+
name: data.name,
|
|
24
|
+
type: data.type
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
const unmarshalJob = (data) => {
|
|
28
|
+
if (!isJSONObject(data)) {
|
|
29
|
+
throw new TypeError(
|
|
30
|
+
`Unmarshalling the type 'Job' failed as data isn't a dictionary.`
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
createdAt: unmarshalDate(data.created_at),
|
|
35
|
+
id: data.id,
|
|
36
|
+
jobDuration: data.job_duration,
|
|
37
|
+
name: data.name,
|
|
38
|
+
progressMessage: data.progress_message,
|
|
39
|
+
resultDistribution: data.result_distribution,
|
|
40
|
+
sessionId: data.session_id,
|
|
41
|
+
startedAt: unmarshalDate(data.started_at),
|
|
42
|
+
status: data.status,
|
|
43
|
+
tags: data.tags,
|
|
44
|
+
updatedAt: unmarshalDate(data.updated_at)
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
const unmarshalPlatformHardware = (data) => {
|
|
48
|
+
if (!isJSONObject(data)) {
|
|
49
|
+
throw new TypeError(
|
|
50
|
+
`Unmarshalling the type 'PlatformHardware' failed as data isn't a dictionary.`
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
return {
|
|
54
|
+
gpus: data.gpus,
|
|
55
|
+
gpusNetwork: data.gpus_network,
|
|
56
|
+
name: data.name,
|
|
57
|
+
ram: data.ram,
|
|
58
|
+
vcpus: data.vcpus,
|
|
59
|
+
vram: data.vram
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
const unmarshalPlatform = (data) => {
|
|
63
|
+
if (!isJSONObject(data)) {
|
|
64
|
+
throw new TypeError(
|
|
65
|
+
`Unmarshalling the type 'Platform' failed as data isn't a dictionary.`
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
return {
|
|
69
|
+
availability: data.availability,
|
|
70
|
+
backendName: data.backend_name,
|
|
71
|
+
hardware: data.hardware ? unmarshalPlatformHardware(data.hardware) : void 0,
|
|
72
|
+
id: data.id,
|
|
73
|
+
maxCircuitCount: data.max_circuit_count,
|
|
74
|
+
maxQubitCount: data.max_qubit_count,
|
|
75
|
+
maxShotCount: data.max_shot_count,
|
|
76
|
+
metadata: data.metadata,
|
|
77
|
+
name: data.name,
|
|
78
|
+
pricePerCircuit: data.price_per_circuit ? unmarshalMoney(data.price_per_circuit) : void 0,
|
|
79
|
+
pricePerHour: data.price_per_hour ? unmarshalMoney(data.price_per_hour) : void 0,
|
|
80
|
+
pricePerShot: data.price_per_shot ? unmarshalMoney(data.price_per_shot) : void 0,
|
|
81
|
+
providerName: data.provider_name,
|
|
82
|
+
technology: data.technology,
|
|
83
|
+
type: data.type,
|
|
84
|
+
version: data.version
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
const unmarshalProcess = (data) => {
|
|
88
|
+
if (!isJSONObject(data)) {
|
|
89
|
+
throw new TypeError(
|
|
90
|
+
`Unmarshalling the type 'Process' failed as data isn't a dictionary.`
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
return {
|
|
94
|
+
applicationId: data.application_id,
|
|
95
|
+
attachedSessionIds: data.attached_session_ids,
|
|
96
|
+
createdAt: unmarshalDate(data.created_at),
|
|
97
|
+
finishedAt: unmarshalDate(data.finished_at),
|
|
98
|
+
id: data.id,
|
|
99
|
+
input: data.input,
|
|
100
|
+
name: data.name,
|
|
101
|
+
platformId: data.platform_id,
|
|
102
|
+
progress: data.progress,
|
|
103
|
+
progressMessage: data.progress_message,
|
|
104
|
+
projectId: data.project_id,
|
|
105
|
+
startedAt: unmarshalDate(data.started_at),
|
|
106
|
+
status: data.status,
|
|
107
|
+
tags: data.tags,
|
|
108
|
+
updatedAt: unmarshalDate(data.updated_at)
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
const unmarshalSession = (data) => {
|
|
112
|
+
if (!isJSONObject(data)) {
|
|
113
|
+
throw new TypeError(
|
|
114
|
+
`Unmarshalling the type 'Session' failed as data isn't a dictionary.`
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
return {
|
|
118
|
+
createdAt: unmarshalDate(data.created_at),
|
|
119
|
+
deduplicationId: data.deduplication_id,
|
|
120
|
+
finishedJobCount: data.finished_job_count,
|
|
121
|
+
id: data.id,
|
|
122
|
+
maxDuration: data.max_duration,
|
|
123
|
+
maxIdleDuration: data.max_idle_duration,
|
|
124
|
+
name: data.name,
|
|
125
|
+
originId: data.origin_id,
|
|
126
|
+
originType: data.origin_type,
|
|
127
|
+
platformId: data.platform_id,
|
|
128
|
+
progressMessage: data.progress_message,
|
|
129
|
+
projectId: data.project_id,
|
|
130
|
+
startedAt: unmarshalDate(data.started_at),
|
|
131
|
+
status: data.status,
|
|
132
|
+
tags: data.tags,
|
|
133
|
+
terminatedAt: unmarshalDate(data.terminated_at),
|
|
134
|
+
updatedAt: unmarshalDate(data.updated_at),
|
|
135
|
+
waitingJobCount: data.waiting_job_count
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
const unmarshalListApplicationsResponse = (data) => {
|
|
139
|
+
if (!isJSONObject(data)) {
|
|
140
|
+
throw new TypeError(
|
|
141
|
+
`Unmarshalling the type 'ListApplicationsResponse' failed as data isn't a dictionary.`
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
return {
|
|
145
|
+
applications: unmarshalArrayOfObject(
|
|
146
|
+
data.applications,
|
|
147
|
+
unmarshalApplication
|
|
148
|
+
),
|
|
149
|
+
totalCount: data.total_count
|
|
150
|
+
};
|
|
151
|
+
};
|
|
152
|
+
const unmarshalJobResult = (data) => {
|
|
153
|
+
if (!isJSONObject(data)) {
|
|
154
|
+
throw new TypeError(
|
|
155
|
+
`Unmarshalling the type 'JobResult' failed as data isn't a dictionary.`
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
return {
|
|
159
|
+
createdAt: unmarshalDate(data.created_at),
|
|
160
|
+
jobId: data.job_id,
|
|
161
|
+
result: data.result,
|
|
162
|
+
url: data.url
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
const unmarshalListJobResultsResponse = (data) => {
|
|
166
|
+
if (!isJSONObject(data)) {
|
|
167
|
+
throw new TypeError(
|
|
168
|
+
`Unmarshalling the type 'ListJobResultsResponse' failed as data isn't a dictionary.`
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
return {
|
|
172
|
+
jobResults: unmarshalArrayOfObject(data.job_results, unmarshalJobResult),
|
|
173
|
+
totalCount: data.total_count
|
|
174
|
+
};
|
|
175
|
+
};
|
|
176
|
+
const unmarshalListJobsResponse = (data) => {
|
|
177
|
+
if (!isJSONObject(data)) {
|
|
178
|
+
throw new TypeError(
|
|
179
|
+
`Unmarshalling the type 'ListJobsResponse' failed as data isn't a dictionary.`
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
return {
|
|
183
|
+
jobs: unmarshalArrayOfObject(data.jobs, unmarshalJob),
|
|
184
|
+
totalCount: data.total_count
|
|
185
|
+
};
|
|
186
|
+
};
|
|
187
|
+
const unmarshalListPlatformsResponse = (data) => {
|
|
188
|
+
if (!isJSONObject(data)) {
|
|
189
|
+
throw new TypeError(
|
|
190
|
+
`Unmarshalling the type 'ListPlatformsResponse' failed as data isn't a dictionary.`
|
|
191
|
+
);
|
|
192
|
+
}
|
|
193
|
+
return {
|
|
194
|
+
platforms: unmarshalArrayOfObject(data.platforms, unmarshalPlatform),
|
|
195
|
+
totalCount: data.total_count
|
|
196
|
+
};
|
|
197
|
+
};
|
|
198
|
+
const unmarshalProcessResult = (data) => {
|
|
199
|
+
if (!isJSONObject(data)) {
|
|
200
|
+
throw new TypeError(
|
|
201
|
+
`Unmarshalling the type 'ProcessResult' failed as data isn't a dictionary.`
|
|
202
|
+
);
|
|
203
|
+
}
|
|
204
|
+
return {
|
|
205
|
+
createdAt: unmarshalDate(data.created_at),
|
|
206
|
+
processId: data.process_id,
|
|
207
|
+
result: data.result
|
|
208
|
+
};
|
|
209
|
+
};
|
|
210
|
+
const unmarshalListProcessResultsResponse = (data) => {
|
|
211
|
+
if (!isJSONObject(data)) {
|
|
212
|
+
throw new TypeError(
|
|
213
|
+
`Unmarshalling the type 'ListProcessResultsResponse' failed as data isn't a dictionary.`
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
return {
|
|
217
|
+
processResults: unmarshalArrayOfObject(
|
|
218
|
+
data.process_results,
|
|
219
|
+
unmarshalProcessResult
|
|
220
|
+
),
|
|
221
|
+
totalCount: data.total_count
|
|
222
|
+
};
|
|
223
|
+
};
|
|
224
|
+
const unmarshalListProcessesResponse = (data) => {
|
|
225
|
+
if (!isJSONObject(data)) {
|
|
226
|
+
throw new TypeError(
|
|
227
|
+
`Unmarshalling the type 'ListProcessesResponse' failed as data isn't a dictionary.`
|
|
228
|
+
);
|
|
229
|
+
}
|
|
230
|
+
return {
|
|
231
|
+
processes: unmarshalArrayOfObject(data.processes, unmarshalProcess),
|
|
232
|
+
totalCount: data.total_count
|
|
233
|
+
};
|
|
234
|
+
};
|
|
235
|
+
const unmarshalListSessionACLsResponse = (data) => {
|
|
236
|
+
if (!isJSONObject(data)) {
|
|
237
|
+
throw new TypeError(
|
|
238
|
+
`Unmarshalling the type 'ListSessionACLsResponse' failed as data isn't a dictionary.`
|
|
239
|
+
);
|
|
240
|
+
}
|
|
241
|
+
return {
|
|
242
|
+
acls: data.acls,
|
|
243
|
+
totalCount: data.total_count
|
|
244
|
+
};
|
|
245
|
+
};
|
|
246
|
+
const unmarshalListSessionsResponse = (data) => {
|
|
247
|
+
if (!isJSONObject(data)) {
|
|
248
|
+
throw new TypeError(
|
|
249
|
+
`Unmarshalling the type 'ListSessionsResponse' failed as data isn't a dictionary.`
|
|
250
|
+
);
|
|
251
|
+
}
|
|
252
|
+
return {
|
|
253
|
+
sessions: unmarshalArrayOfObject(data.sessions, unmarshalSession),
|
|
254
|
+
totalCount: data.total_count
|
|
255
|
+
};
|
|
256
|
+
};
|
|
257
|
+
const marshalJobCircuit = (request, defaults) => ({
|
|
258
|
+
...resolveOneOf([
|
|
259
|
+
{ param: "perceval_circuit", value: request.percevalCircuit },
|
|
260
|
+
{ param: "qiskit_circuit", value: request.qiskitCircuit }
|
|
261
|
+
])
|
|
262
|
+
});
|
|
263
|
+
const marshalCreateJobRequest = (request, defaults) => ({
|
|
264
|
+
circuit: marshalJobCircuit(request.circuit),
|
|
265
|
+
max_duration: request.maxDuration,
|
|
266
|
+
name: request.name,
|
|
267
|
+
session_id: request.sessionId,
|
|
268
|
+
tags: request.tags
|
|
269
|
+
});
|
|
270
|
+
const marshalCreateProcessRequest = (request, defaults) => ({
|
|
271
|
+
application_id: request.applicationId,
|
|
272
|
+
input: request.input,
|
|
273
|
+
name: request.name,
|
|
274
|
+
platform_id: request.platformId,
|
|
275
|
+
project_id: request.projectId ?? defaults.defaultProjectId,
|
|
276
|
+
tags: request.tags
|
|
277
|
+
});
|
|
278
|
+
const marshalCreateSessionRequest = (request, defaults) => ({
|
|
279
|
+
deduplication_id: request.deduplicationId,
|
|
280
|
+
max_duration: request.maxDuration,
|
|
281
|
+
max_idle_duration: request.maxIdleDuration,
|
|
282
|
+
name: request.name,
|
|
283
|
+
platform_id: request.platformId,
|
|
284
|
+
project_id: request.projectId ?? defaults.defaultProjectId,
|
|
285
|
+
tags: request.tags
|
|
286
|
+
});
|
|
287
|
+
const marshalUpdateJobRequest = (request, defaults) => ({
|
|
288
|
+
name: request.name,
|
|
289
|
+
tags: request.tags
|
|
290
|
+
});
|
|
291
|
+
const marshalUpdateProcessRequest = (request, defaults) => ({
|
|
292
|
+
name: request.name,
|
|
293
|
+
tags: request.tags
|
|
294
|
+
});
|
|
295
|
+
const marshalUpdateSessionRequest = (request, defaults) => ({
|
|
296
|
+
max_duration: request.maxDuration,
|
|
297
|
+
max_idle_duration: request.maxIdleDuration,
|
|
298
|
+
name: request.name,
|
|
299
|
+
tags: request.tags
|
|
300
|
+
});
|
|
301
|
+
export {
|
|
302
|
+
marshalCreateJobRequest,
|
|
303
|
+
marshalCreateProcessRequest,
|
|
304
|
+
marshalCreateSessionRequest,
|
|
305
|
+
marshalUpdateJobRequest,
|
|
306
|
+
marshalUpdateProcessRequest,
|
|
307
|
+
marshalUpdateSessionRequest,
|
|
308
|
+
unmarshalApplication,
|
|
309
|
+
unmarshalJob,
|
|
310
|
+
unmarshalJobCircuit,
|
|
311
|
+
unmarshalListApplicationsResponse,
|
|
312
|
+
unmarshalListJobResultsResponse,
|
|
313
|
+
unmarshalListJobsResponse,
|
|
314
|
+
unmarshalListPlatformsResponse,
|
|
315
|
+
unmarshalListProcessResultsResponse,
|
|
316
|
+
unmarshalListProcessesResponse,
|
|
317
|
+
unmarshalListSessionACLsResponse,
|
|
318
|
+
unmarshalListSessionsResponse,
|
|
319
|
+
unmarshalPlatform,
|
|
320
|
+
unmarshalProcess,
|
|
321
|
+
unmarshalSession
|
|
322
|
+
};
|