@aws-sdk/client-braket 3.137.0 → 3.145.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.
@@ -10,16 +10,7 @@ const serializeAws_restJson1CancelJobCommand = async (input, context) => {
10
10
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
11
11
  const headers = {};
12
12
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/job/{jobArn}/cancel";
13
- if (input.jobArn !== undefined) {
14
- const labelValue = input.jobArn;
15
- if (labelValue.length <= 0) {
16
- throw new Error("Empty value provided for input HTTP label: jobArn.");
17
- }
18
- resolvedPath = resolvedPath.replace("{jobArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
19
- }
20
- else {
21
- throw new Error("No value provided for input HTTP label: jobArn.");
22
- }
13
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "jobArn", () => input.jobArn, "{jobArn}", false);
23
14
  let body;
24
15
  return new protocol_http_1.HttpRequest({
25
16
  protocol,
@@ -39,16 +30,7 @@ const serializeAws_restJson1CancelQuantumTaskCommand = async (input, context) =>
39
30
  "content-type": "application/json",
40
31
  };
41
32
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/quantum-task/{quantumTaskArn}/cancel";
42
- if (input.quantumTaskArn !== undefined) {
43
- const labelValue = input.quantumTaskArn;
44
- if (labelValue.length <= 0) {
45
- throw new Error("Empty value provided for input HTTP label: quantumTaskArn.");
46
- }
47
- resolvedPath = resolvedPath.replace("{quantumTaskArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
48
- }
49
- else {
50
- throw new Error("No value provided for input HTTP label: quantumTaskArn.");
51
- }
33
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "quantumTaskArn", () => input.quantumTaskArn, "{quantumTaskArn}", false);
52
34
  let body;
53
35
  body = JSON.stringify({
54
36
  clientToken: (_a = input.clientToken) !== null && _a !== void 0 ? _a : (0, uuid_1.v4)(),
@@ -147,16 +129,7 @@ const serializeAws_restJson1GetDeviceCommand = async (input, context) => {
147
129
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
148
130
  const headers = {};
149
131
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/device/{deviceArn}";
150
- if (input.deviceArn !== undefined) {
151
- const labelValue = input.deviceArn;
152
- if (labelValue.length <= 0) {
153
- throw new Error("Empty value provided for input HTTP label: deviceArn.");
154
- }
155
- resolvedPath = resolvedPath.replace("{deviceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
156
- }
157
- else {
158
- throw new Error("No value provided for input HTTP label: deviceArn.");
159
- }
132
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "deviceArn", () => input.deviceArn, "{deviceArn}", false);
160
133
  let body;
161
134
  return new protocol_http_1.HttpRequest({
162
135
  protocol,
@@ -173,16 +146,7 @@ const serializeAws_restJson1GetJobCommand = async (input, context) => {
173
146
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
174
147
  const headers = {};
175
148
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/job/{jobArn}";
176
- if (input.jobArn !== undefined) {
177
- const labelValue = input.jobArn;
178
- if (labelValue.length <= 0) {
179
- throw new Error("Empty value provided for input HTTP label: jobArn.");
180
- }
181
- resolvedPath = resolvedPath.replace("{jobArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
182
- }
183
- else {
184
- throw new Error("No value provided for input HTTP label: jobArn.");
185
- }
149
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "jobArn", () => input.jobArn, "{jobArn}", false);
186
150
  let body;
187
151
  return new protocol_http_1.HttpRequest({
188
152
  protocol,
@@ -199,16 +163,7 @@ const serializeAws_restJson1GetQuantumTaskCommand = async (input, context) => {
199
163
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
200
164
  const headers = {};
201
165
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/quantum-task/{quantumTaskArn}";
202
- if (input.quantumTaskArn !== undefined) {
203
- const labelValue = input.quantumTaskArn;
204
- if (labelValue.length <= 0) {
205
- throw new Error("Empty value provided for input HTTP label: quantumTaskArn.");
206
- }
207
- resolvedPath = resolvedPath.replace("{quantumTaskArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
208
- }
209
- else {
210
- throw new Error("No value provided for input HTTP label: quantumTaskArn.");
211
- }
166
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "quantumTaskArn", () => input.quantumTaskArn, "{quantumTaskArn}", false);
212
167
  let body;
213
168
  return new protocol_http_1.HttpRequest({
214
169
  protocol,
@@ -225,16 +180,7 @@ const serializeAws_restJson1ListTagsForResourceCommand = async (input, context)
225
180
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
226
181
  const headers = {};
227
182
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
228
- if (input.resourceArn !== undefined) {
229
- const labelValue = input.resourceArn;
230
- if (labelValue.length <= 0) {
231
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
232
- }
233
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
234
- }
235
- else {
236
- throw new Error("No value provided for input HTTP label: resourceArn.");
237
- }
183
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
238
184
  let body;
239
185
  return new protocol_http_1.HttpRequest({
240
186
  protocol,
@@ -324,16 +270,7 @@ const serializeAws_restJson1TagResourceCommand = async (input, context) => {
324
270
  "content-type": "application/json",
325
271
  };
326
272
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
327
- if (input.resourceArn !== undefined) {
328
- const labelValue = input.resourceArn;
329
- if (labelValue.length <= 0) {
330
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
331
- }
332
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
333
- }
334
- else {
335
- throw new Error("No value provided for input HTTP label: resourceArn.");
336
- }
273
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
337
274
  let body;
338
275
  body = JSON.stringify({
339
276
  ...(input.tags != null && { tags: serializeAws_restJson1TagsMap(input.tags, context) }),
@@ -353,19 +290,10 @@ const serializeAws_restJson1UntagResourceCommand = async (input, context) => {
353
290
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
354
291
  const headers = {};
355
292
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
356
- if (input.resourceArn !== undefined) {
357
- const labelValue = input.resourceArn;
358
- if (labelValue.length <= 0) {
359
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
360
- }
361
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
362
- }
363
- else {
364
- throw new Error("No value provided for input HTTP label: resourceArn.");
365
- }
366
- const query = {
367
- ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry) }),
368
- };
293
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
294
+ const query = map({
295
+ tagKeys: [() => input.tagKeys !== void 0, () => (input.tagKeys || []).map((_entry) => _entry)],
296
+ });
369
297
  let body;
370
298
  return new protocol_http_1.HttpRequest({
371
299
  protocol,
@@ -383,19 +311,17 @@ const deserializeAws_restJson1CancelJobCommand = async (output, context) => {
383
311
  if (output.statusCode !== 200 && output.statusCode >= 300) {
384
312
  return deserializeAws_restJson1CancelJobCommandError(output, context);
385
313
  }
386
- const contents = {
314
+ const contents = map({
387
315
  $metadata: deserializeMetadata(output),
388
- cancellationStatus: undefined,
389
- jobArn: undefined,
390
- };
316
+ });
391
317
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
392
- if (data.cancellationStatus !== undefined && data.cancellationStatus !== null) {
318
+ if (data.cancellationStatus != null) {
393
319
  contents.cancellationStatus = (0, smithy_client_1.expectString)(data.cancellationStatus);
394
320
  }
395
- if (data.jobArn !== undefined && data.jobArn !== null) {
321
+ if (data.jobArn != null) {
396
322
  contents.jobArn = (0, smithy_client_1.expectString)(data.jobArn);
397
323
  }
398
- return Promise.resolve(contents);
324
+ return contents;
399
325
  };
400
326
  exports.deserializeAws_restJson1CancelJobCommand = deserializeAws_restJson1CancelJobCommand;
401
327
  const deserializeAws_restJson1CancelJobCommandError = async (output, context) => {
@@ -403,7 +329,6 @@ const deserializeAws_restJson1CancelJobCommandError = async (output, context) =>
403
329
  ...output,
404
330
  body: await parseBody(output.body, context),
405
331
  };
406
- let response;
407
332
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
408
333
  switch (errorCode) {
409
334
  case "AccessDeniedException":
@@ -426,33 +351,29 @@ const deserializeAws_restJson1CancelJobCommandError = async (output, context) =>
426
351
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
427
352
  default:
428
353
  const parsedBody = parsedOutput.body;
429
- const $metadata = deserializeMetadata(output);
430
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
431
- response = new BraketServiceException_1.BraketServiceException({
432
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
433
- $fault: "client",
434
- $metadata,
354
+ (0, smithy_client_1.throwDefaultError)({
355
+ output,
356
+ parsedBody,
357
+ exceptionCtor: BraketServiceException_1.BraketServiceException,
358
+ errorCode,
435
359
  });
436
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
437
360
  }
438
361
  };
439
362
  const deserializeAws_restJson1CancelQuantumTaskCommand = async (output, context) => {
440
363
  if (output.statusCode !== 200 && output.statusCode >= 300) {
441
364
  return deserializeAws_restJson1CancelQuantumTaskCommandError(output, context);
442
365
  }
443
- const contents = {
366
+ const contents = map({
444
367
  $metadata: deserializeMetadata(output),
445
- cancellationStatus: undefined,
446
- quantumTaskArn: undefined,
447
- };
368
+ });
448
369
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
449
- if (data.cancellationStatus !== undefined && data.cancellationStatus !== null) {
370
+ if (data.cancellationStatus != null) {
450
371
  contents.cancellationStatus = (0, smithy_client_1.expectString)(data.cancellationStatus);
451
372
  }
452
- if (data.quantumTaskArn !== undefined && data.quantumTaskArn !== null) {
373
+ if (data.quantumTaskArn != null) {
453
374
  contents.quantumTaskArn = (0, smithy_client_1.expectString)(data.quantumTaskArn);
454
375
  }
455
- return Promise.resolve(contents);
376
+ return contents;
456
377
  };
457
378
  exports.deserializeAws_restJson1CancelQuantumTaskCommand = deserializeAws_restJson1CancelQuantumTaskCommand;
458
379
  const deserializeAws_restJson1CancelQuantumTaskCommandError = async (output, context) => {
@@ -460,7 +381,6 @@ const deserializeAws_restJson1CancelQuantumTaskCommandError = async (output, con
460
381
  ...output,
461
382
  body: await parseBody(output.body, context),
462
383
  };
463
- let response;
464
384
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
465
385
  switch (errorCode) {
466
386
  case "AccessDeniedException":
@@ -483,29 +403,26 @@ const deserializeAws_restJson1CancelQuantumTaskCommandError = async (output, con
483
403
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
484
404
  default:
485
405
  const parsedBody = parsedOutput.body;
486
- const $metadata = deserializeMetadata(output);
487
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
488
- response = new BraketServiceException_1.BraketServiceException({
489
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
490
- $fault: "client",
491
- $metadata,
406
+ (0, smithy_client_1.throwDefaultError)({
407
+ output,
408
+ parsedBody,
409
+ exceptionCtor: BraketServiceException_1.BraketServiceException,
410
+ errorCode,
492
411
  });
493
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
494
412
  }
495
413
  };
496
414
  const deserializeAws_restJson1CreateJobCommand = async (output, context) => {
497
415
  if (output.statusCode !== 201 && output.statusCode >= 300) {
498
416
  return deserializeAws_restJson1CreateJobCommandError(output, context);
499
417
  }
500
- const contents = {
418
+ const contents = map({
501
419
  $metadata: deserializeMetadata(output),
502
- jobArn: undefined,
503
- };
420
+ });
504
421
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
505
- if (data.jobArn !== undefined && data.jobArn !== null) {
422
+ if (data.jobArn != null) {
506
423
  contents.jobArn = (0, smithy_client_1.expectString)(data.jobArn);
507
424
  }
508
- return Promise.resolve(contents);
425
+ return contents;
509
426
  };
510
427
  exports.deserializeAws_restJson1CreateJobCommand = deserializeAws_restJson1CreateJobCommand;
511
428
  const deserializeAws_restJson1CreateJobCommandError = async (output, context) => {
@@ -513,7 +430,6 @@ const deserializeAws_restJson1CreateJobCommandError = async (output, context) =>
513
430
  ...output,
514
431
  body: await parseBody(output.body, context),
515
432
  };
516
- let response;
517
433
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
518
434
  switch (errorCode) {
519
435
  case "AccessDeniedException":
@@ -539,29 +455,26 @@ const deserializeAws_restJson1CreateJobCommandError = async (output, context) =>
539
455
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
540
456
  default:
541
457
  const parsedBody = parsedOutput.body;
542
- const $metadata = deserializeMetadata(output);
543
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
544
- response = new BraketServiceException_1.BraketServiceException({
545
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
546
- $fault: "client",
547
- $metadata,
458
+ (0, smithy_client_1.throwDefaultError)({
459
+ output,
460
+ parsedBody,
461
+ exceptionCtor: BraketServiceException_1.BraketServiceException,
462
+ errorCode,
548
463
  });
549
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
550
464
  }
551
465
  };
552
466
  const deserializeAws_restJson1CreateQuantumTaskCommand = async (output, context) => {
553
467
  if (output.statusCode !== 201 && output.statusCode >= 300) {
554
468
  return deserializeAws_restJson1CreateQuantumTaskCommandError(output, context);
555
469
  }
556
- const contents = {
470
+ const contents = map({
557
471
  $metadata: deserializeMetadata(output),
558
- quantumTaskArn: undefined,
559
- };
472
+ });
560
473
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
561
- if (data.quantumTaskArn !== undefined && data.quantumTaskArn !== null) {
474
+ if (data.quantumTaskArn != null) {
562
475
  contents.quantumTaskArn = (0, smithy_client_1.expectString)(data.quantumTaskArn);
563
476
  }
564
- return Promise.resolve(contents);
477
+ return contents;
565
478
  };
566
479
  exports.deserializeAws_restJson1CreateQuantumTaskCommand = deserializeAws_restJson1CreateQuantumTaskCommand;
567
480
  const deserializeAws_restJson1CreateQuantumTaskCommandError = async (output, context) => {
@@ -569,7 +482,6 @@ const deserializeAws_restJson1CreateQuantumTaskCommandError = async (output, con
569
482
  ...output,
570
483
  body: await parseBody(output.body, context),
571
484
  };
572
- let response;
573
485
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
574
486
  switch (errorCode) {
575
487
  case "AccessDeniedException":
@@ -595,49 +507,41 @@ const deserializeAws_restJson1CreateQuantumTaskCommandError = async (output, con
595
507
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
596
508
  default:
597
509
  const parsedBody = parsedOutput.body;
598
- const $metadata = deserializeMetadata(output);
599
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
600
- response = new BraketServiceException_1.BraketServiceException({
601
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
602
- $fault: "client",
603
- $metadata,
510
+ (0, smithy_client_1.throwDefaultError)({
511
+ output,
512
+ parsedBody,
513
+ exceptionCtor: BraketServiceException_1.BraketServiceException,
514
+ errorCode,
604
515
  });
605
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
606
516
  }
607
517
  };
608
518
  const deserializeAws_restJson1GetDeviceCommand = async (output, context) => {
609
519
  if (output.statusCode !== 200 && output.statusCode >= 300) {
610
520
  return deserializeAws_restJson1GetDeviceCommandError(output, context);
611
521
  }
612
- const contents = {
522
+ const contents = map({
613
523
  $metadata: deserializeMetadata(output),
614
- deviceArn: undefined,
615
- deviceCapabilities: undefined,
616
- deviceName: undefined,
617
- deviceStatus: undefined,
618
- deviceType: undefined,
619
- providerName: undefined,
620
- };
524
+ });
621
525
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
622
- if (data.deviceArn !== undefined && data.deviceArn !== null) {
526
+ if (data.deviceArn != null) {
623
527
  contents.deviceArn = (0, smithy_client_1.expectString)(data.deviceArn);
624
528
  }
625
- if (data.deviceCapabilities !== undefined && data.deviceCapabilities !== null) {
529
+ if (data.deviceCapabilities != null) {
626
530
  contents.deviceCapabilities = new smithy_client_1.LazyJsonString(data.deviceCapabilities);
627
531
  }
628
- if (data.deviceName !== undefined && data.deviceName !== null) {
532
+ if (data.deviceName != null) {
629
533
  contents.deviceName = (0, smithy_client_1.expectString)(data.deviceName);
630
534
  }
631
- if (data.deviceStatus !== undefined && data.deviceStatus !== null) {
535
+ if (data.deviceStatus != null) {
632
536
  contents.deviceStatus = (0, smithy_client_1.expectString)(data.deviceStatus);
633
537
  }
634
- if (data.deviceType !== undefined && data.deviceType !== null) {
538
+ if (data.deviceType != null) {
635
539
  contents.deviceType = (0, smithy_client_1.expectString)(data.deviceType);
636
540
  }
637
- if (data.providerName !== undefined && data.providerName !== null) {
541
+ if (data.providerName != null) {
638
542
  contents.providerName = (0, smithy_client_1.expectString)(data.providerName);
639
543
  }
640
- return Promise.resolve(contents);
544
+ return contents;
641
545
  };
642
546
  exports.deserializeAws_restJson1GetDeviceCommand = deserializeAws_restJson1GetDeviceCommand;
643
547
  const deserializeAws_restJson1GetDeviceCommandError = async (output, context) => {
@@ -645,7 +549,6 @@ const deserializeAws_restJson1GetDeviceCommandError = async (output, context) =>
645
549
  ...output,
646
550
  body: await parseBody(output.body, context),
647
551
  };
648
- let response;
649
552
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
650
553
  switch (errorCode) {
651
554
  case "AccessDeniedException":
@@ -665,101 +568,80 @@ const deserializeAws_restJson1GetDeviceCommandError = async (output, context) =>
665
568
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
666
569
  default:
667
570
  const parsedBody = parsedOutput.body;
668
- const $metadata = deserializeMetadata(output);
669
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
670
- response = new BraketServiceException_1.BraketServiceException({
671
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
672
- $fault: "client",
673
- $metadata,
571
+ (0, smithy_client_1.throwDefaultError)({
572
+ output,
573
+ parsedBody,
574
+ exceptionCtor: BraketServiceException_1.BraketServiceException,
575
+ errorCode,
674
576
  });
675
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
676
577
  }
677
578
  };
678
579
  const deserializeAws_restJson1GetJobCommand = async (output, context) => {
679
580
  if (output.statusCode !== 200 && output.statusCode >= 300) {
680
581
  return deserializeAws_restJson1GetJobCommandError(output, context);
681
582
  }
682
- const contents = {
583
+ const contents = map({
683
584
  $metadata: deserializeMetadata(output),
684
- algorithmSpecification: undefined,
685
- billableDuration: undefined,
686
- checkpointConfig: undefined,
687
- createdAt: undefined,
688
- deviceConfig: undefined,
689
- endedAt: undefined,
690
- events: undefined,
691
- failureReason: undefined,
692
- hyperParameters: undefined,
693
- inputDataConfig: undefined,
694
- instanceConfig: undefined,
695
- jobArn: undefined,
696
- jobName: undefined,
697
- outputDataConfig: undefined,
698
- roleArn: undefined,
699
- startedAt: undefined,
700
- status: undefined,
701
- stoppingCondition: undefined,
702
- tags: undefined,
703
- };
585
+ });
704
586
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
705
- if (data.algorithmSpecification !== undefined && data.algorithmSpecification !== null) {
587
+ if (data.algorithmSpecification != null) {
706
588
  contents.algorithmSpecification = deserializeAws_restJson1AlgorithmSpecification(data.algorithmSpecification, context);
707
589
  }
708
- if (data.billableDuration !== undefined && data.billableDuration !== null) {
590
+ if (data.billableDuration != null) {
709
591
  contents.billableDuration = (0, smithy_client_1.expectInt32)(data.billableDuration);
710
592
  }
711
- if (data.checkpointConfig !== undefined && data.checkpointConfig !== null) {
593
+ if (data.checkpointConfig != null) {
712
594
  contents.checkpointConfig = deserializeAws_restJson1JobCheckpointConfig(data.checkpointConfig, context);
713
595
  }
714
- if (data.createdAt !== undefined && data.createdAt !== null) {
596
+ if (data.createdAt != null) {
715
597
  contents.createdAt = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTime)(data.createdAt));
716
598
  }
717
- if (data.deviceConfig !== undefined && data.deviceConfig !== null) {
599
+ if (data.deviceConfig != null) {
718
600
  contents.deviceConfig = deserializeAws_restJson1DeviceConfig(data.deviceConfig, context);
719
601
  }
720
- if (data.endedAt !== undefined && data.endedAt !== null) {
602
+ if (data.endedAt != null) {
721
603
  contents.endedAt = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTime)(data.endedAt));
722
604
  }
723
- if (data.events !== undefined && data.events !== null) {
605
+ if (data.events != null) {
724
606
  contents.events = deserializeAws_restJson1JobEvents(data.events, context);
725
607
  }
726
- if (data.failureReason !== undefined && data.failureReason !== null) {
608
+ if (data.failureReason != null) {
727
609
  contents.failureReason = (0, smithy_client_1.expectString)(data.failureReason);
728
610
  }
729
- if (data.hyperParameters !== undefined && data.hyperParameters !== null) {
611
+ if (data.hyperParameters != null) {
730
612
  contents.hyperParameters = deserializeAws_restJson1HyperParameters(data.hyperParameters, context);
731
613
  }
732
- if (data.inputDataConfig !== undefined && data.inputDataConfig !== null) {
614
+ if (data.inputDataConfig != null) {
733
615
  contents.inputDataConfig = deserializeAws_restJson1InputConfigList(data.inputDataConfig, context);
734
616
  }
735
- if (data.instanceConfig !== undefined && data.instanceConfig !== null) {
617
+ if (data.instanceConfig != null) {
736
618
  contents.instanceConfig = deserializeAws_restJson1InstanceConfig(data.instanceConfig, context);
737
619
  }
738
- if (data.jobArn !== undefined && data.jobArn !== null) {
620
+ if (data.jobArn != null) {
739
621
  contents.jobArn = (0, smithy_client_1.expectString)(data.jobArn);
740
622
  }
741
- if (data.jobName !== undefined && data.jobName !== null) {
623
+ if (data.jobName != null) {
742
624
  contents.jobName = (0, smithy_client_1.expectString)(data.jobName);
743
625
  }
744
- if (data.outputDataConfig !== undefined && data.outputDataConfig !== null) {
626
+ if (data.outputDataConfig != null) {
745
627
  contents.outputDataConfig = deserializeAws_restJson1JobOutputDataConfig(data.outputDataConfig, context);
746
628
  }
747
- if (data.roleArn !== undefined && data.roleArn !== null) {
629
+ if (data.roleArn != null) {
748
630
  contents.roleArn = (0, smithy_client_1.expectString)(data.roleArn);
749
631
  }
750
- if (data.startedAt !== undefined && data.startedAt !== null) {
632
+ if (data.startedAt != null) {
751
633
  contents.startedAt = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTime)(data.startedAt));
752
634
  }
753
- if (data.status !== undefined && data.status !== null) {
635
+ if (data.status != null) {
754
636
  contents.status = (0, smithy_client_1.expectString)(data.status);
755
637
  }
756
- if (data.stoppingCondition !== undefined && data.stoppingCondition !== null) {
638
+ if (data.stoppingCondition != null) {
757
639
  contents.stoppingCondition = deserializeAws_restJson1JobStoppingCondition(data.stoppingCondition, context);
758
640
  }
759
- if (data.tags !== undefined && data.tags !== null) {
641
+ if (data.tags != null) {
760
642
  contents.tags = deserializeAws_restJson1TagsMap(data.tags, context);
761
643
  }
762
- return Promise.resolve(contents);
644
+ return contents;
763
645
  };
764
646
  exports.deserializeAws_restJson1GetJobCommand = deserializeAws_restJson1GetJobCommand;
765
647
  const deserializeAws_restJson1GetJobCommandError = async (output, context) => {
@@ -767,7 +649,6 @@ const deserializeAws_restJson1GetJobCommandError = async (output, context) => {
767
649
  ...output,
768
650
  body: await parseBody(output.body, context),
769
651
  };
770
- let response;
771
652
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
772
653
  switch (errorCode) {
773
654
  case "AccessDeniedException":
@@ -787,73 +668,59 @@ const deserializeAws_restJson1GetJobCommandError = async (output, context) => {
787
668
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
788
669
  default:
789
670
  const parsedBody = parsedOutput.body;
790
- const $metadata = deserializeMetadata(output);
791
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
792
- response = new BraketServiceException_1.BraketServiceException({
793
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
794
- $fault: "client",
795
- $metadata,
671
+ (0, smithy_client_1.throwDefaultError)({
672
+ output,
673
+ parsedBody,
674
+ exceptionCtor: BraketServiceException_1.BraketServiceException,
675
+ errorCode,
796
676
  });
797
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
798
677
  }
799
678
  };
800
679
  const deserializeAws_restJson1GetQuantumTaskCommand = async (output, context) => {
801
680
  if (output.statusCode !== 200 && output.statusCode >= 300) {
802
681
  return deserializeAws_restJson1GetQuantumTaskCommandError(output, context);
803
682
  }
804
- const contents = {
683
+ const contents = map({
805
684
  $metadata: deserializeMetadata(output),
806
- createdAt: undefined,
807
- deviceArn: undefined,
808
- deviceParameters: undefined,
809
- endedAt: undefined,
810
- failureReason: undefined,
811
- jobArn: undefined,
812
- outputS3Bucket: undefined,
813
- outputS3Directory: undefined,
814
- quantumTaskArn: undefined,
815
- shots: undefined,
816
- status: undefined,
817
- tags: undefined,
818
- };
685
+ });
819
686
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
820
- if (data.createdAt !== undefined && data.createdAt !== null) {
687
+ if (data.createdAt != null) {
821
688
  contents.createdAt = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTime)(data.createdAt));
822
689
  }
823
- if (data.deviceArn !== undefined && data.deviceArn !== null) {
690
+ if (data.deviceArn != null) {
824
691
  contents.deviceArn = (0, smithy_client_1.expectString)(data.deviceArn);
825
692
  }
826
- if (data.deviceParameters !== undefined && data.deviceParameters !== null) {
693
+ if (data.deviceParameters != null) {
827
694
  contents.deviceParameters = new smithy_client_1.LazyJsonString(data.deviceParameters);
828
695
  }
829
- if (data.endedAt !== undefined && data.endedAt !== null) {
696
+ if (data.endedAt != null) {
830
697
  contents.endedAt = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTime)(data.endedAt));
831
698
  }
832
- if (data.failureReason !== undefined && data.failureReason !== null) {
699
+ if (data.failureReason != null) {
833
700
  contents.failureReason = (0, smithy_client_1.expectString)(data.failureReason);
834
701
  }
835
- if (data.jobArn !== undefined && data.jobArn !== null) {
702
+ if (data.jobArn != null) {
836
703
  contents.jobArn = (0, smithy_client_1.expectString)(data.jobArn);
837
704
  }
838
- if (data.outputS3Bucket !== undefined && data.outputS3Bucket !== null) {
705
+ if (data.outputS3Bucket != null) {
839
706
  contents.outputS3Bucket = (0, smithy_client_1.expectString)(data.outputS3Bucket);
840
707
  }
841
- if (data.outputS3Directory !== undefined && data.outputS3Directory !== null) {
708
+ if (data.outputS3Directory != null) {
842
709
  contents.outputS3Directory = (0, smithy_client_1.expectString)(data.outputS3Directory);
843
710
  }
844
- if (data.quantumTaskArn !== undefined && data.quantumTaskArn !== null) {
711
+ if (data.quantumTaskArn != null) {
845
712
  contents.quantumTaskArn = (0, smithy_client_1.expectString)(data.quantumTaskArn);
846
713
  }
847
- if (data.shots !== undefined && data.shots !== null) {
714
+ if (data.shots != null) {
848
715
  contents.shots = (0, smithy_client_1.expectLong)(data.shots);
849
716
  }
850
- if (data.status !== undefined && data.status !== null) {
717
+ if (data.status != null) {
851
718
  contents.status = (0, smithy_client_1.expectString)(data.status);
852
719
  }
853
- if (data.tags !== undefined && data.tags !== null) {
720
+ if (data.tags != null) {
854
721
  contents.tags = deserializeAws_restJson1TagsMap(data.tags, context);
855
722
  }
856
- return Promise.resolve(contents);
723
+ return contents;
857
724
  };
858
725
  exports.deserializeAws_restJson1GetQuantumTaskCommand = deserializeAws_restJson1GetQuantumTaskCommand;
859
726
  const deserializeAws_restJson1GetQuantumTaskCommandError = async (output, context) => {
@@ -861,7 +728,6 @@ const deserializeAws_restJson1GetQuantumTaskCommandError = async (output, contex
861
728
  ...output,
862
729
  body: await parseBody(output.body, context),
863
730
  };
864
- let response;
865
731
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
866
732
  switch (errorCode) {
867
733
  case "AccessDeniedException":
@@ -881,29 +747,26 @@ const deserializeAws_restJson1GetQuantumTaskCommandError = async (output, contex
881
747
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
882
748
  default:
883
749
  const parsedBody = parsedOutput.body;
884
- const $metadata = deserializeMetadata(output);
885
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
886
- response = new BraketServiceException_1.BraketServiceException({
887
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
888
- $fault: "client",
889
- $metadata,
750
+ (0, smithy_client_1.throwDefaultError)({
751
+ output,
752
+ parsedBody,
753
+ exceptionCtor: BraketServiceException_1.BraketServiceException,
754
+ errorCode,
890
755
  });
891
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
892
756
  }
893
757
  };
894
758
  const deserializeAws_restJson1ListTagsForResourceCommand = async (output, context) => {
895
759
  if (output.statusCode !== 200 && output.statusCode >= 300) {
896
760
  return deserializeAws_restJson1ListTagsForResourceCommandError(output, context);
897
761
  }
898
- const contents = {
762
+ const contents = map({
899
763
  $metadata: deserializeMetadata(output),
900
- tags: undefined,
901
- };
764
+ });
902
765
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
903
- if (data.tags !== undefined && data.tags !== null) {
766
+ if (data.tags != null) {
904
767
  contents.tags = deserializeAws_restJson1TagsMap(data.tags, context);
905
768
  }
906
- return Promise.resolve(contents);
769
+ return contents;
907
770
  };
908
771
  exports.deserializeAws_restJson1ListTagsForResourceCommand = deserializeAws_restJson1ListTagsForResourceCommand;
909
772
  const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, context) => {
@@ -911,7 +774,6 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
911
774
  ...output,
912
775
  body: await parseBody(output.body, context),
913
776
  };
914
- let response;
915
777
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
916
778
  switch (errorCode) {
917
779
  case "InternalServiceException":
@@ -925,33 +787,29 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
925
787
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
926
788
  default:
927
789
  const parsedBody = parsedOutput.body;
928
- const $metadata = deserializeMetadata(output);
929
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
930
- response = new BraketServiceException_1.BraketServiceException({
931
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
932
- $fault: "client",
933
- $metadata,
790
+ (0, smithy_client_1.throwDefaultError)({
791
+ output,
792
+ parsedBody,
793
+ exceptionCtor: BraketServiceException_1.BraketServiceException,
794
+ errorCode,
934
795
  });
935
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
936
796
  }
937
797
  };
938
798
  const deserializeAws_restJson1SearchDevicesCommand = async (output, context) => {
939
799
  if (output.statusCode !== 200 && output.statusCode >= 300) {
940
800
  return deserializeAws_restJson1SearchDevicesCommandError(output, context);
941
801
  }
942
- const contents = {
802
+ const contents = map({
943
803
  $metadata: deserializeMetadata(output),
944
- devices: undefined,
945
- nextToken: undefined,
946
- };
804
+ });
947
805
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
948
- if (data.devices !== undefined && data.devices !== null) {
806
+ if (data.devices != null) {
949
807
  contents.devices = deserializeAws_restJson1DeviceSummaryList(data.devices, context);
950
808
  }
951
- if (data.nextToken !== undefined && data.nextToken !== null) {
809
+ if (data.nextToken != null) {
952
810
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
953
811
  }
954
- return Promise.resolve(contents);
812
+ return contents;
955
813
  };
956
814
  exports.deserializeAws_restJson1SearchDevicesCommand = deserializeAws_restJson1SearchDevicesCommand;
957
815
  const deserializeAws_restJson1SearchDevicesCommandError = async (output, context) => {
@@ -959,7 +817,6 @@ const deserializeAws_restJson1SearchDevicesCommandError = async (output, context
959
817
  ...output,
960
818
  body: await parseBody(output.body, context),
961
819
  };
962
- let response;
963
820
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
964
821
  switch (errorCode) {
965
822
  case "AccessDeniedException":
@@ -976,33 +833,29 @@ const deserializeAws_restJson1SearchDevicesCommandError = async (output, context
976
833
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
977
834
  default:
978
835
  const parsedBody = parsedOutput.body;
979
- const $metadata = deserializeMetadata(output);
980
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
981
- response = new BraketServiceException_1.BraketServiceException({
982
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
983
- $fault: "client",
984
- $metadata,
836
+ (0, smithy_client_1.throwDefaultError)({
837
+ output,
838
+ parsedBody,
839
+ exceptionCtor: BraketServiceException_1.BraketServiceException,
840
+ errorCode,
985
841
  });
986
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
987
842
  }
988
843
  };
989
844
  const deserializeAws_restJson1SearchJobsCommand = async (output, context) => {
990
845
  if (output.statusCode !== 200 && output.statusCode >= 300) {
991
846
  return deserializeAws_restJson1SearchJobsCommandError(output, context);
992
847
  }
993
- const contents = {
848
+ const contents = map({
994
849
  $metadata: deserializeMetadata(output),
995
- jobs: undefined,
996
- nextToken: undefined,
997
- };
850
+ });
998
851
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
999
- if (data.jobs !== undefined && data.jobs !== null) {
852
+ if (data.jobs != null) {
1000
853
  contents.jobs = deserializeAws_restJson1JobSummaryList(data.jobs, context);
1001
854
  }
1002
- if (data.nextToken !== undefined && data.nextToken !== null) {
855
+ if (data.nextToken != null) {
1003
856
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1004
857
  }
1005
- return Promise.resolve(contents);
858
+ return contents;
1006
859
  };
1007
860
  exports.deserializeAws_restJson1SearchJobsCommand = deserializeAws_restJson1SearchJobsCommand;
1008
861
  const deserializeAws_restJson1SearchJobsCommandError = async (output, context) => {
@@ -1010,7 +863,6 @@ const deserializeAws_restJson1SearchJobsCommandError = async (output, context) =
1010
863
  ...output,
1011
864
  body: await parseBody(output.body, context),
1012
865
  };
1013
- let response;
1014
866
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1015
867
  switch (errorCode) {
1016
868
  case "AccessDeniedException":
@@ -1027,33 +879,29 @@ const deserializeAws_restJson1SearchJobsCommandError = async (output, context) =
1027
879
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1028
880
  default:
1029
881
  const parsedBody = parsedOutput.body;
1030
- const $metadata = deserializeMetadata(output);
1031
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1032
- response = new BraketServiceException_1.BraketServiceException({
1033
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1034
- $fault: "client",
1035
- $metadata,
882
+ (0, smithy_client_1.throwDefaultError)({
883
+ output,
884
+ parsedBody,
885
+ exceptionCtor: BraketServiceException_1.BraketServiceException,
886
+ errorCode,
1036
887
  });
1037
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1038
888
  }
1039
889
  };
1040
890
  const deserializeAws_restJson1SearchQuantumTasksCommand = async (output, context) => {
1041
891
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1042
892
  return deserializeAws_restJson1SearchQuantumTasksCommandError(output, context);
1043
893
  }
1044
- const contents = {
894
+ const contents = map({
1045
895
  $metadata: deserializeMetadata(output),
1046
- nextToken: undefined,
1047
- quantumTasks: undefined,
1048
- };
896
+ });
1049
897
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1050
- if (data.nextToken !== undefined && data.nextToken !== null) {
898
+ if (data.nextToken != null) {
1051
899
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1052
900
  }
1053
- if (data.quantumTasks !== undefined && data.quantumTasks !== null) {
901
+ if (data.quantumTasks != null) {
1054
902
  contents.quantumTasks = deserializeAws_restJson1QuantumTaskSummaryList(data.quantumTasks, context);
1055
903
  }
1056
- return Promise.resolve(contents);
904
+ return contents;
1057
905
  };
1058
906
  exports.deserializeAws_restJson1SearchQuantumTasksCommand = deserializeAws_restJson1SearchQuantumTasksCommand;
1059
907
  const deserializeAws_restJson1SearchQuantumTasksCommandError = async (output, context) => {
@@ -1061,7 +909,6 @@ const deserializeAws_restJson1SearchQuantumTasksCommandError = async (output, co
1061
909
  ...output,
1062
910
  body: await parseBody(output.body, context),
1063
911
  };
1064
- let response;
1065
912
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1066
913
  switch (errorCode) {
1067
914
  case "AccessDeniedException":
@@ -1078,25 +925,23 @@ const deserializeAws_restJson1SearchQuantumTasksCommandError = async (output, co
1078
925
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1079
926
  default:
1080
927
  const parsedBody = parsedOutput.body;
1081
- const $metadata = deserializeMetadata(output);
1082
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1083
- response = new BraketServiceException_1.BraketServiceException({
1084
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1085
- $fault: "client",
1086
- $metadata,
928
+ (0, smithy_client_1.throwDefaultError)({
929
+ output,
930
+ parsedBody,
931
+ exceptionCtor: BraketServiceException_1.BraketServiceException,
932
+ errorCode,
1087
933
  });
1088
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1089
934
  }
1090
935
  };
1091
936
  const deserializeAws_restJson1TagResourceCommand = async (output, context) => {
1092
937
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1093
938
  return deserializeAws_restJson1TagResourceCommandError(output, context);
1094
939
  }
1095
- const contents = {
940
+ const contents = map({
1096
941
  $metadata: deserializeMetadata(output),
1097
- };
942
+ });
1098
943
  await collectBody(output.body, context);
1099
- return Promise.resolve(contents);
944
+ return contents;
1100
945
  };
1101
946
  exports.deserializeAws_restJson1TagResourceCommand = deserializeAws_restJson1TagResourceCommand;
1102
947
  const deserializeAws_restJson1TagResourceCommandError = async (output, context) => {
@@ -1104,7 +949,6 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
1104
949
  ...output,
1105
950
  body: await parseBody(output.body, context),
1106
951
  };
1107
- let response;
1108
952
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1109
953
  switch (errorCode) {
1110
954
  case "InternalServiceException":
@@ -1118,25 +962,23 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
1118
962
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1119
963
  default:
1120
964
  const parsedBody = parsedOutput.body;
1121
- const $metadata = deserializeMetadata(output);
1122
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1123
- response = new BraketServiceException_1.BraketServiceException({
1124
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1125
- $fault: "client",
1126
- $metadata,
965
+ (0, smithy_client_1.throwDefaultError)({
966
+ output,
967
+ parsedBody,
968
+ exceptionCtor: BraketServiceException_1.BraketServiceException,
969
+ errorCode,
1127
970
  });
1128
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1129
971
  }
1130
972
  };
1131
973
  const deserializeAws_restJson1UntagResourceCommand = async (output, context) => {
1132
974
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1133
975
  return deserializeAws_restJson1UntagResourceCommandError(output, context);
1134
976
  }
1135
- const contents = {
977
+ const contents = map({
1136
978
  $metadata: deserializeMetadata(output),
1137
- };
979
+ });
1138
980
  await collectBody(output.body, context);
1139
- return Promise.resolve(contents);
981
+ return contents;
1140
982
  };
1141
983
  exports.deserializeAws_restJson1UntagResourceCommand = deserializeAws_restJson1UntagResourceCommand;
1142
984
  const deserializeAws_restJson1UntagResourceCommandError = async (output, context) => {
@@ -1144,7 +986,6 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
1144
986
  ...output,
1145
987
  body: await parseBody(output.body, context),
1146
988
  };
1147
- let response;
1148
989
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1149
990
  switch (errorCode) {
1150
991
  case "InternalServiceException":
@@ -1158,20 +999,19 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
1158
999
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1159
1000
  default:
1160
1001
  const parsedBody = parsedOutput.body;
1161
- const $metadata = deserializeMetadata(output);
1162
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1163
- response = new BraketServiceException_1.BraketServiceException({
1164
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1165
- $fault: "client",
1166
- $metadata,
1002
+ (0, smithy_client_1.throwDefaultError)({
1003
+ output,
1004
+ parsedBody,
1005
+ exceptionCtor: BraketServiceException_1.BraketServiceException,
1006
+ errorCode,
1167
1007
  });
1168
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1169
1008
  }
1170
1009
  };
1010
+ const map = smithy_client_1.map;
1171
1011
  const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutput, context) => {
1172
- const contents = {};
1012
+ const contents = map({});
1173
1013
  const data = parsedOutput.body;
1174
- if (data.message !== undefined && data.message !== null) {
1014
+ if (data.message != null) {
1175
1015
  contents.message = (0, smithy_client_1.expectString)(data.message);
1176
1016
  }
1177
1017
  const exception = new models_0_1.AccessDeniedException({
@@ -1181,9 +1021,9 @@ const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutpu
1181
1021
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1182
1022
  };
1183
1023
  const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, context) => {
1184
- const contents = {};
1024
+ const contents = map({});
1185
1025
  const data = parsedOutput.body;
1186
- if (data.message !== undefined && data.message !== null) {
1026
+ if (data.message != null) {
1187
1027
  contents.message = (0, smithy_client_1.expectString)(data.message);
1188
1028
  }
1189
1029
  const exception = new models_0_1.ConflictException({
@@ -1193,9 +1033,9 @@ const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, c
1193
1033
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1194
1034
  };
1195
1035
  const deserializeAws_restJson1DeviceOfflineExceptionResponse = async (parsedOutput, context) => {
1196
- const contents = {};
1036
+ const contents = map({});
1197
1037
  const data = parsedOutput.body;
1198
- if (data.message !== undefined && data.message !== null) {
1038
+ if (data.message != null) {
1199
1039
  contents.message = (0, smithy_client_1.expectString)(data.message);
1200
1040
  }
1201
1041
  const exception = new models_0_1.DeviceOfflineException({
@@ -1205,9 +1045,9 @@ const deserializeAws_restJson1DeviceOfflineExceptionResponse = async (parsedOutp
1205
1045
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1206
1046
  };
1207
1047
  const deserializeAws_restJson1DeviceRetiredExceptionResponse = async (parsedOutput, context) => {
1208
- const contents = {};
1048
+ const contents = map({});
1209
1049
  const data = parsedOutput.body;
1210
- if (data.message !== undefined && data.message !== null) {
1050
+ if (data.message != null) {
1211
1051
  contents.message = (0, smithy_client_1.expectString)(data.message);
1212
1052
  }
1213
1053
  const exception = new models_0_1.DeviceRetiredException({
@@ -1217,9 +1057,9 @@ const deserializeAws_restJson1DeviceRetiredExceptionResponse = async (parsedOutp
1217
1057
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1218
1058
  };
1219
1059
  const deserializeAws_restJson1InternalServiceExceptionResponse = async (parsedOutput, context) => {
1220
- const contents = {};
1060
+ const contents = map({});
1221
1061
  const data = parsedOutput.body;
1222
- if (data.message !== undefined && data.message !== null) {
1062
+ if (data.message != null) {
1223
1063
  contents.message = (0, smithy_client_1.expectString)(data.message);
1224
1064
  }
1225
1065
  const exception = new models_0_1.InternalServiceException({
@@ -1229,9 +1069,9 @@ const deserializeAws_restJson1InternalServiceExceptionResponse = async (parsedOu
1229
1069
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1230
1070
  };
1231
1071
  const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
1232
- const contents = {};
1072
+ const contents = map({});
1233
1073
  const data = parsedOutput.body;
1234
- if (data.message !== undefined && data.message !== null) {
1074
+ if (data.message != null) {
1235
1075
  contents.message = (0, smithy_client_1.expectString)(data.message);
1236
1076
  }
1237
1077
  const exception = new models_0_1.ResourceNotFoundException({
@@ -1241,9 +1081,9 @@ const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedO
1241
1081
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1242
1082
  };
1243
1083
  const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (parsedOutput, context) => {
1244
- const contents = {};
1084
+ const contents = map({});
1245
1085
  const data = parsedOutput.body;
1246
- if (data.message !== undefined && data.message !== null) {
1086
+ if (data.message != null) {
1247
1087
  contents.message = (0, smithy_client_1.expectString)(data.message);
1248
1088
  }
1249
1089
  const exception = new models_0_1.ServiceQuotaExceededException({
@@ -1253,9 +1093,9 @@ const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (par
1253
1093
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1254
1094
  };
1255
1095
  const deserializeAws_restJson1ThrottlingExceptionResponse = async (parsedOutput, context) => {
1256
- const contents = {};
1096
+ const contents = map({});
1257
1097
  const data = parsedOutput.body;
1258
- if (data.message !== undefined && data.message !== null) {
1098
+ if (data.message != null) {
1259
1099
  contents.message = (0, smithy_client_1.expectString)(data.message);
1260
1100
  }
1261
1101
  const exception = new models_0_1.ThrottlingException({
@@ -1265,9 +1105,9 @@ const deserializeAws_restJson1ThrottlingExceptionResponse = async (parsedOutput,
1265
1105
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1266
1106
  };
1267
1107
  const deserializeAws_restJson1ValidationExceptionResponse = async (parsedOutput, context) => {
1268
- const contents = {};
1108
+ const contents = map({});
1269
1109
  const data = parsedOutput.body;
1270
- if (data.message !== undefined && data.message !== null) {
1110
+ if (data.message != null) {
1271
1111
  contents.message = (0, smithy_client_1.expectString)(data.message);
1272
1112
  }
1273
1113
  const exception = new models_0_1.ValidationException({
@@ -1318,9 +1158,6 @@ const serializeAws_restJson1InputConfigList = (input, context) => {
1318
1158
  return input
1319
1159
  .filter((e) => e != null)
1320
1160
  .map((entry) => {
1321
- if (entry === null) {
1322
- return null;
1323
- }
1324
1161
  return serializeAws_restJson1InputFileConfig(entry, context);
1325
1162
  });
1326
1163
  };
@@ -1377,9 +1214,6 @@ const serializeAws_restJson1SearchDevicesFilterList = (input, context) => {
1377
1214
  return input
1378
1215
  .filter((e) => e != null)
1379
1216
  .map((entry) => {
1380
- if (entry === null) {
1381
- return null;
1382
- }
1383
1217
  return serializeAws_restJson1SearchDevicesFilter(entry, context);
1384
1218
  });
1385
1219
  };
@@ -1394,9 +1228,6 @@ const serializeAws_restJson1SearchJobsFilterList = (input, context) => {
1394
1228
  return input
1395
1229
  .filter((e) => e != null)
1396
1230
  .map((entry) => {
1397
- if (entry === null) {
1398
- return null;
1399
- }
1400
1231
  return serializeAws_restJson1SearchJobsFilter(entry, context);
1401
1232
  });
1402
1233
  };
@@ -1411,9 +1242,6 @@ const serializeAws_restJson1SearchQuantumTasksFilterList = (input, context) => {
1411
1242
  return input
1412
1243
  .filter((e) => e != null)
1413
1244
  .map((entry) => {
1414
- if (entry === null) {
1415
- return null;
1416
- }
1417
1245
  return serializeAws_restJson1SearchQuantumTasksFilter(entry, context);
1418
1246
  });
1419
1247
  };
@@ -1421,9 +1249,6 @@ const serializeAws_restJson1String256List = (input, context) => {
1421
1249
  return input
1422
1250
  .filter((e) => e != null)
1423
1251
  .map((entry) => {
1424
- if (entry === null) {
1425
- return null;
1426
- }
1427
1252
  return entry;
1428
1253
  });
1429
1254
  };