@aws-sdk/client-iotdeviceadvisor 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.
@@ -33,16 +33,7 @@ const serializeAws_restJson1DeleteSuiteDefinitionCommand = async (input, context
33
33
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
34
34
  const headers = {};
35
35
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/suiteDefinitions/{suiteDefinitionId}";
36
- if (input.suiteDefinitionId !== undefined) {
37
- const labelValue = input.suiteDefinitionId;
38
- if (labelValue.length <= 0) {
39
- throw new Error("Empty value provided for input HTTP label: suiteDefinitionId.");
40
- }
41
- resolvedPath = resolvedPath.replace("{suiteDefinitionId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
42
- }
43
- else {
44
- throw new Error("No value provided for input HTTP label: suiteDefinitionId.");
45
- }
36
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "suiteDefinitionId", () => input.suiteDefinitionId, "{suiteDefinitionId}", false);
46
37
  let body;
47
38
  return new protocol_http_1.HttpRequest({
48
39
  protocol,
@@ -59,10 +50,10 @@ const serializeAws_restJson1GetEndpointCommand = async (input, context) => {
59
50
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
60
51
  const headers = {};
61
52
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/endpoint";
62
- const query = {
63
- ...(input.thingArn !== undefined && { thingArn: input.thingArn }),
64
- ...(input.certificateArn !== undefined && { certificateArn: input.certificateArn }),
65
- };
53
+ const query = map({
54
+ thingArn: [, input.thingArn],
55
+ certificateArn: [, input.certificateArn],
56
+ });
66
57
  let body;
67
58
  return new protocol_http_1.HttpRequest({
68
59
  protocol,
@@ -80,19 +71,10 @@ const serializeAws_restJson1GetSuiteDefinitionCommand = async (input, context) =
80
71
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
81
72
  const headers = {};
82
73
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/suiteDefinitions/{suiteDefinitionId}";
83
- if (input.suiteDefinitionId !== undefined) {
84
- const labelValue = input.suiteDefinitionId;
85
- if (labelValue.length <= 0) {
86
- throw new Error("Empty value provided for input HTTP label: suiteDefinitionId.");
87
- }
88
- resolvedPath = resolvedPath.replace("{suiteDefinitionId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
89
- }
90
- else {
91
- throw new Error("No value provided for input HTTP label: suiteDefinitionId.");
92
- }
93
- const query = {
94
- ...(input.suiteDefinitionVersion !== undefined && { suiteDefinitionVersion: input.suiteDefinitionVersion }),
95
- };
74
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "suiteDefinitionId", () => input.suiteDefinitionId, "{suiteDefinitionId}", false);
75
+ const query = map({
76
+ suiteDefinitionVersion: [, input.suiteDefinitionVersion],
77
+ });
96
78
  let body;
97
79
  return new protocol_http_1.HttpRequest({
98
80
  protocol,
@@ -111,26 +93,8 @@ const serializeAws_restJson1GetSuiteRunCommand = async (input, context) => {
111
93
  const headers = {};
112
94
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
113
95
  "/suiteDefinitions/{suiteDefinitionId}/suiteRuns/{suiteRunId}";
114
- if (input.suiteDefinitionId !== undefined) {
115
- const labelValue = input.suiteDefinitionId;
116
- if (labelValue.length <= 0) {
117
- throw new Error("Empty value provided for input HTTP label: suiteDefinitionId.");
118
- }
119
- resolvedPath = resolvedPath.replace("{suiteDefinitionId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
120
- }
121
- else {
122
- throw new Error("No value provided for input HTTP label: suiteDefinitionId.");
123
- }
124
- if (input.suiteRunId !== undefined) {
125
- const labelValue = input.suiteRunId;
126
- if (labelValue.length <= 0) {
127
- throw new Error("Empty value provided for input HTTP label: suiteRunId.");
128
- }
129
- resolvedPath = resolvedPath.replace("{suiteRunId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
130
- }
131
- else {
132
- throw new Error("No value provided for input HTTP label: suiteRunId.");
133
- }
96
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "suiteDefinitionId", () => input.suiteDefinitionId, "{suiteDefinitionId}", false);
97
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "suiteRunId", () => input.suiteRunId, "{suiteRunId}", false);
134
98
  let body;
135
99
  return new protocol_http_1.HttpRequest({
136
100
  protocol,
@@ -148,26 +112,8 @@ const serializeAws_restJson1GetSuiteRunReportCommand = async (input, context) =>
148
112
  const headers = {};
149
113
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
150
114
  "/suiteDefinitions/{suiteDefinitionId}/suiteRuns/{suiteRunId}/report";
151
- if (input.suiteDefinitionId !== undefined) {
152
- const labelValue = input.suiteDefinitionId;
153
- if (labelValue.length <= 0) {
154
- throw new Error("Empty value provided for input HTTP label: suiteDefinitionId.");
155
- }
156
- resolvedPath = resolvedPath.replace("{suiteDefinitionId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
157
- }
158
- else {
159
- throw new Error("No value provided for input HTTP label: suiteDefinitionId.");
160
- }
161
- if (input.suiteRunId !== undefined) {
162
- const labelValue = input.suiteRunId;
163
- if (labelValue.length <= 0) {
164
- throw new Error("Empty value provided for input HTTP label: suiteRunId.");
165
- }
166
- resolvedPath = resolvedPath.replace("{suiteRunId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
167
- }
168
- else {
169
- throw new Error("No value provided for input HTTP label: suiteRunId.");
170
- }
115
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "suiteDefinitionId", () => input.suiteDefinitionId, "{suiteDefinitionId}", false);
116
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "suiteRunId", () => input.suiteRunId, "{suiteRunId}", false);
171
117
  let body;
172
118
  return new protocol_http_1.HttpRequest({
173
119
  protocol,
@@ -184,10 +130,10 @@ const serializeAws_restJson1ListSuiteDefinitionsCommand = async (input, context)
184
130
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
185
131
  const headers = {};
186
132
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/suiteDefinitions";
187
- const query = {
188
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
189
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
190
- };
133
+ const query = map({
134
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
135
+ nextToken: [, input.nextToken],
136
+ });
191
137
  let body;
192
138
  return new protocol_http_1.HttpRequest({
193
139
  protocol,
@@ -205,12 +151,12 @@ const serializeAws_restJson1ListSuiteRunsCommand = async (input, context) => {
205
151
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
206
152
  const headers = {};
207
153
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/suiteRuns";
208
- const query = {
209
- ...(input.suiteDefinitionId !== undefined && { suiteDefinitionId: input.suiteDefinitionId }),
210
- ...(input.suiteDefinitionVersion !== undefined && { suiteDefinitionVersion: input.suiteDefinitionVersion }),
211
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
212
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
213
- };
154
+ const query = map({
155
+ suiteDefinitionId: [, input.suiteDefinitionId],
156
+ suiteDefinitionVersion: [, input.suiteDefinitionVersion],
157
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
158
+ nextToken: [, input.nextToken],
159
+ });
214
160
  let body;
215
161
  return new protocol_http_1.HttpRequest({
216
162
  protocol,
@@ -228,16 +174,7 @@ const serializeAws_restJson1ListTagsForResourceCommand = async (input, context)
228
174
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
229
175
  const headers = {};
230
176
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
231
- if (input.resourceArn !== undefined) {
232
- const labelValue = input.resourceArn;
233
- if (labelValue.length <= 0) {
234
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
235
- }
236
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
237
- }
238
- else {
239
- throw new Error("No value provided for input HTTP label: resourceArn.");
240
- }
177
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
241
178
  let body;
242
179
  return new protocol_http_1.HttpRequest({
243
180
  protocol,
@@ -257,16 +194,7 @@ const serializeAws_restJson1StartSuiteRunCommand = async (input, context) => {
257
194
  };
258
195
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
259
196
  "/suiteDefinitions/{suiteDefinitionId}/suiteRuns";
260
- if (input.suiteDefinitionId !== undefined) {
261
- const labelValue = input.suiteDefinitionId;
262
- if (labelValue.length <= 0) {
263
- throw new Error("Empty value provided for input HTTP label: suiteDefinitionId.");
264
- }
265
- resolvedPath = resolvedPath.replace("{suiteDefinitionId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
266
- }
267
- else {
268
- throw new Error("No value provided for input HTTP label: suiteDefinitionId.");
269
- }
197
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "suiteDefinitionId", () => input.suiteDefinitionId, "{suiteDefinitionId}", false);
270
198
  let body;
271
199
  body = JSON.stringify({
272
200
  ...(input.suiteDefinitionVersion != null && { suiteDefinitionVersion: input.suiteDefinitionVersion }),
@@ -291,26 +219,8 @@ const serializeAws_restJson1StopSuiteRunCommand = async (input, context) => {
291
219
  const headers = {};
292
220
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
293
221
  "/suiteDefinitions/{suiteDefinitionId}/suiteRuns/{suiteRunId}/stop";
294
- if (input.suiteDefinitionId !== undefined) {
295
- const labelValue = input.suiteDefinitionId;
296
- if (labelValue.length <= 0) {
297
- throw new Error("Empty value provided for input HTTP label: suiteDefinitionId.");
298
- }
299
- resolvedPath = resolvedPath.replace("{suiteDefinitionId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
300
- }
301
- else {
302
- throw new Error("No value provided for input HTTP label: suiteDefinitionId.");
303
- }
304
- if (input.suiteRunId !== undefined) {
305
- const labelValue = input.suiteRunId;
306
- if (labelValue.length <= 0) {
307
- throw new Error("Empty value provided for input HTTP label: suiteRunId.");
308
- }
309
- resolvedPath = resolvedPath.replace("{suiteRunId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
310
- }
311
- else {
312
- throw new Error("No value provided for input HTTP label: suiteRunId.");
313
- }
222
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "suiteDefinitionId", () => input.suiteDefinitionId, "{suiteDefinitionId}", false);
223
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "suiteRunId", () => input.suiteRunId, "{suiteRunId}", false);
314
224
  let body;
315
225
  return new protocol_http_1.HttpRequest({
316
226
  protocol,
@@ -329,16 +239,7 @@ const serializeAws_restJson1TagResourceCommand = async (input, context) => {
329
239
  "content-type": "application/json",
330
240
  };
331
241
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
332
- if (input.resourceArn !== undefined) {
333
- const labelValue = input.resourceArn;
334
- if (labelValue.length <= 0) {
335
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
336
- }
337
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
338
- }
339
- else {
340
- throw new Error("No value provided for input HTTP label: resourceArn.");
341
- }
242
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
342
243
  let body;
343
244
  body = JSON.stringify({
344
245
  ...(input.tags != null && { tags: serializeAws_restJson1TagMap(input.tags, context) }),
@@ -358,19 +259,10 @@ const serializeAws_restJson1UntagResourceCommand = async (input, context) => {
358
259
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
359
260
  const headers = {};
360
261
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
361
- if (input.resourceArn !== undefined) {
362
- const labelValue = input.resourceArn;
363
- if (labelValue.length <= 0) {
364
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
365
- }
366
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
367
- }
368
- else {
369
- throw new Error("No value provided for input HTTP label: resourceArn.");
370
- }
371
- const query = {
372
- ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry) }),
373
- };
262
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
263
+ const query = map({
264
+ tagKeys: [() => input.tagKeys !== void 0, () => (input.tagKeys || []).map((_entry) => _entry)],
265
+ });
374
266
  let body;
375
267
  return new protocol_http_1.HttpRequest({
376
268
  protocol,
@@ -390,16 +282,7 @@ const serializeAws_restJson1UpdateSuiteDefinitionCommand = async (input, context
390
282
  "content-type": "application/json",
391
283
  };
392
284
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/suiteDefinitions/{suiteDefinitionId}";
393
- if (input.suiteDefinitionId !== undefined) {
394
- const labelValue = input.suiteDefinitionId;
395
- if (labelValue.length <= 0) {
396
- throw new Error("Empty value provided for input HTTP label: suiteDefinitionId.");
397
- }
398
- resolvedPath = resolvedPath.replace("{suiteDefinitionId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
399
- }
400
- else {
401
- throw new Error("No value provided for input HTTP label: suiteDefinitionId.");
402
- }
285
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "suiteDefinitionId", () => input.suiteDefinitionId, "{suiteDefinitionId}", false);
403
286
  let body;
404
287
  body = JSON.stringify({
405
288
  ...(input.suiteDefinitionConfiguration != null && {
@@ -421,27 +304,23 @@ const deserializeAws_restJson1CreateSuiteDefinitionCommand = async (output, cont
421
304
  if (output.statusCode !== 200 && output.statusCode >= 300) {
422
305
  return deserializeAws_restJson1CreateSuiteDefinitionCommandError(output, context);
423
306
  }
424
- const contents = {
307
+ const contents = map({
425
308
  $metadata: deserializeMetadata(output),
426
- createdAt: undefined,
427
- suiteDefinitionArn: undefined,
428
- suiteDefinitionId: undefined,
429
- suiteDefinitionName: undefined,
430
- };
309
+ });
431
310
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
432
- if (data.createdAt !== undefined && data.createdAt !== null) {
311
+ if (data.createdAt != null) {
433
312
  contents.createdAt = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(data.createdAt)));
434
313
  }
435
- if (data.suiteDefinitionArn !== undefined && data.suiteDefinitionArn !== null) {
314
+ if (data.suiteDefinitionArn != null) {
436
315
  contents.suiteDefinitionArn = (0, smithy_client_1.expectString)(data.suiteDefinitionArn);
437
316
  }
438
- if (data.suiteDefinitionId !== undefined && data.suiteDefinitionId !== null) {
317
+ if (data.suiteDefinitionId != null) {
439
318
  contents.suiteDefinitionId = (0, smithy_client_1.expectString)(data.suiteDefinitionId);
440
319
  }
441
- if (data.suiteDefinitionName !== undefined && data.suiteDefinitionName !== null) {
320
+ if (data.suiteDefinitionName != null) {
442
321
  contents.suiteDefinitionName = (0, smithy_client_1.expectString)(data.suiteDefinitionName);
443
322
  }
444
- return Promise.resolve(contents);
323
+ return contents;
445
324
  };
446
325
  exports.deserializeAws_restJson1CreateSuiteDefinitionCommand = deserializeAws_restJson1CreateSuiteDefinitionCommand;
447
326
  const deserializeAws_restJson1CreateSuiteDefinitionCommandError = async (output, context) => {
@@ -449,7 +328,6 @@ const deserializeAws_restJson1CreateSuiteDefinitionCommandError = async (output,
449
328
  ...output,
450
329
  body: await parseBody(output.body, context),
451
330
  };
452
- let response;
453
331
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
454
332
  switch (errorCode) {
455
333
  case "InternalServerException":
@@ -460,25 +338,23 @@ const deserializeAws_restJson1CreateSuiteDefinitionCommandError = async (output,
460
338
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
461
339
  default:
462
340
  const parsedBody = parsedOutput.body;
463
- const $metadata = deserializeMetadata(output);
464
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
465
- response = new IotDeviceAdvisorServiceException_1.IotDeviceAdvisorServiceException({
466
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
467
- $fault: "client",
468
- $metadata,
341
+ (0, smithy_client_1.throwDefaultError)({
342
+ output,
343
+ parsedBody,
344
+ exceptionCtor: IotDeviceAdvisorServiceException_1.IotDeviceAdvisorServiceException,
345
+ errorCode,
469
346
  });
470
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
471
347
  }
472
348
  };
473
349
  const deserializeAws_restJson1DeleteSuiteDefinitionCommand = async (output, context) => {
474
350
  if (output.statusCode !== 200 && output.statusCode >= 300) {
475
351
  return deserializeAws_restJson1DeleteSuiteDefinitionCommandError(output, context);
476
352
  }
477
- const contents = {
353
+ const contents = map({
478
354
  $metadata: deserializeMetadata(output),
479
- };
355
+ });
480
356
  await collectBody(output.body, context);
481
- return Promise.resolve(contents);
357
+ return contents;
482
358
  };
483
359
  exports.deserializeAws_restJson1DeleteSuiteDefinitionCommand = deserializeAws_restJson1DeleteSuiteDefinitionCommand;
484
360
  const deserializeAws_restJson1DeleteSuiteDefinitionCommandError = async (output, context) => {
@@ -486,7 +362,6 @@ const deserializeAws_restJson1DeleteSuiteDefinitionCommandError = async (output,
486
362
  ...output,
487
363
  body: await parseBody(output.body, context),
488
364
  };
489
- let response;
490
365
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
491
366
  switch (errorCode) {
492
367
  case "InternalServerException":
@@ -497,29 +372,26 @@ const deserializeAws_restJson1DeleteSuiteDefinitionCommandError = async (output,
497
372
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
498
373
  default:
499
374
  const parsedBody = parsedOutput.body;
500
- const $metadata = deserializeMetadata(output);
501
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
502
- response = new IotDeviceAdvisorServiceException_1.IotDeviceAdvisorServiceException({
503
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
504
- $fault: "client",
505
- $metadata,
375
+ (0, smithy_client_1.throwDefaultError)({
376
+ output,
377
+ parsedBody,
378
+ exceptionCtor: IotDeviceAdvisorServiceException_1.IotDeviceAdvisorServiceException,
379
+ errorCode,
506
380
  });
507
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
508
381
  }
509
382
  };
510
383
  const deserializeAws_restJson1GetEndpointCommand = async (output, context) => {
511
384
  if (output.statusCode !== 200 && output.statusCode >= 300) {
512
385
  return deserializeAws_restJson1GetEndpointCommandError(output, context);
513
386
  }
514
- const contents = {
387
+ const contents = map({
515
388
  $metadata: deserializeMetadata(output),
516
- endpoint: undefined,
517
- };
389
+ });
518
390
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
519
- if (data.endpoint !== undefined && data.endpoint !== null) {
391
+ if (data.endpoint != null) {
520
392
  contents.endpoint = (0, smithy_client_1.expectString)(data.endpoint);
521
393
  }
522
- return Promise.resolve(contents);
394
+ return contents;
523
395
  };
524
396
  exports.deserializeAws_restJson1GetEndpointCommand = deserializeAws_restJson1GetEndpointCommand;
525
397
  const deserializeAws_restJson1GetEndpointCommandError = async (output, context) => {
@@ -527,7 +399,6 @@ const deserializeAws_restJson1GetEndpointCommandError = async (output, context)
527
399
  ...output,
528
400
  body: await parseBody(output.body, context),
529
401
  };
530
- let response;
531
402
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
532
403
  switch (errorCode) {
533
404
  case "InternalServerException":
@@ -541,57 +412,47 @@ const deserializeAws_restJson1GetEndpointCommandError = async (output, context)
541
412
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
542
413
  default:
543
414
  const parsedBody = parsedOutput.body;
544
- const $metadata = deserializeMetadata(output);
545
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
546
- response = new IotDeviceAdvisorServiceException_1.IotDeviceAdvisorServiceException({
547
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
548
- $fault: "client",
549
- $metadata,
415
+ (0, smithy_client_1.throwDefaultError)({
416
+ output,
417
+ parsedBody,
418
+ exceptionCtor: IotDeviceAdvisorServiceException_1.IotDeviceAdvisorServiceException,
419
+ errorCode,
550
420
  });
551
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
552
421
  }
553
422
  };
554
423
  const deserializeAws_restJson1GetSuiteDefinitionCommand = async (output, context) => {
555
424
  if (output.statusCode !== 200 && output.statusCode >= 300) {
556
425
  return deserializeAws_restJson1GetSuiteDefinitionCommandError(output, context);
557
426
  }
558
- const contents = {
427
+ const contents = map({
559
428
  $metadata: deserializeMetadata(output),
560
- createdAt: undefined,
561
- lastModifiedAt: undefined,
562
- latestVersion: undefined,
563
- suiteDefinitionArn: undefined,
564
- suiteDefinitionConfiguration: undefined,
565
- suiteDefinitionId: undefined,
566
- suiteDefinitionVersion: undefined,
567
- tags: undefined,
568
- };
429
+ });
569
430
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
570
- if (data.createdAt !== undefined && data.createdAt !== null) {
431
+ if (data.createdAt != null) {
571
432
  contents.createdAt = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(data.createdAt)));
572
433
  }
573
- if (data.lastModifiedAt !== undefined && data.lastModifiedAt !== null) {
434
+ if (data.lastModifiedAt != null) {
574
435
  contents.lastModifiedAt = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(data.lastModifiedAt)));
575
436
  }
576
- if (data.latestVersion !== undefined && data.latestVersion !== null) {
437
+ if (data.latestVersion != null) {
577
438
  contents.latestVersion = (0, smithy_client_1.expectString)(data.latestVersion);
578
439
  }
579
- if (data.suiteDefinitionArn !== undefined && data.suiteDefinitionArn !== null) {
440
+ if (data.suiteDefinitionArn != null) {
580
441
  contents.suiteDefinitionArn = (0, smithy_client_1.expectString)(data.suiteDefinitionArn);
581
442
  }
582
- if (data.suiteDefinitionConfiguration !== undefined && data.suiteDefinitionConfiguration !== null) {
443
+ if (data.suiteDefinitionConfiguration != null) {
583
444
  contents.suiteDefinitionConfiguration = deserializeAws_restJson1SuiteDefinitionConfiguration(data.suiteDefinitionConfiguration, context);
584
445
  }
585
- if (data.suiteDefinitionId !== undefined && data.suiteDefinitionId !== null) {
446
+ if (data.suiteDefinitionId != null) {
586
447
  contents.suiteDefinitionId = (0, smithy_client_1.expectString)(data.suiteDefinitionId);
587
448
  }
588
- if (data.suiteDefinitionVersion !== undefined && data.suiteDefinitionVersion !== null) {
449
+ if (data.suiteDefinitionVersion != null) {
589
450
  contents.suiteDefinitionVersion = (0, smithy_client_1.expectString)(data.suiteDefinitionVersion);
590
451
  }
591
- if (data.tags !== undefined && data.tags !== null) {
452
+ if (data.tags != null) {
592
453
  contents.tags = deserializeAws_restJson1TagMap(data.tags, context);
593
454
  }
594
- return Promise.resolve(contents);
455
+ return contents;
595
456
  };
596
457
  exports.deserializeAws_restJson1GetSuiteDefinitionCommand = deserializeAws_restJson1GetSuiteDefinitionCommand;
597
458
  const deserializeAws_restJson1GetSuiteDefinitionCommandError = async (output, context) => {
@@ -599,7 +460,6 @@ const deserializeAws_restJson1GetSuiteDefinitionCommandError = async (output, co
599
460
  ...output,
600
461
  body: await parseBody(output.body, context),
601
462
  };
602
- let response;
603
463
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
604
464
  switch (errorCode) {
605
465
  case "InternalServerException":
@@ -613,69 +473,56 @@ const deserializeAws_restJson1GetSuiteDefinitionCommandError = async (output, co
613
473
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
614
474
  default:
615
475
  const parsedBody = parsedOutput.body;
616
- const $metadata = deserializeMetadata(output);
617
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
618
- response = new IotDeviceAdvisorServiceException_1.IotDeviceAdvisorServiceException({
619
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
620
- $fault: "client",
621
- $metadata,
476
+ (0, smithy_client_1.throwDefaultError)({
477
+ output,
478
+ parsedBody,
479
+ exceptionCtor: IotDeviceAdvisorServiceException_1.IotDeviceAdvisorServiceException,
480
+ errorCode,
622
481
  });
623
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
624
482
  }
625
483
  };
626
484
  const deserializeAws_restJson1GetSuiteRunCommand = async (output, context) => {
627
485
  if (output.statusCode !== 200 && output.statusCode >= 300) {
628
486
  return deserializeAws_restJson1GetSuiteRunCommandError(output, context);
629
487
  }
630
- const contents = {
488
+ const contents = map({
631
489
  $metadata: deserializeMetadata(output),
632
- endTime: undefined,
633
- errorReason: undefined,
634
- startTime: undefined,
635
- status: undefined,
636
- suiteDefinitionId: undefined,
637
- suiteDefinitionVersion: undefined,
638
- suiteRunArn: undefined,
639
- suiteRunConfiguration: undefined,
640
- suiteRunId: undefined,
641
- tags: undefined,
642
- testResult: undefined,
643
- };
490
+ });
644
491
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
645
- if (data.endTime !== undefined && data.endTime !== null) {
492
+ if (data.endTime != null) {
646
493
  contents.endTime = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(data.endTime)));
647
494
  }
648
- if (data.errorReason !== undefined && data.errorReason !== null) {
495
+ if (data.errorReason != null) {
649
496
  contents.errorReason = (0, smithy_client_1.expectString)(data.errorReason);
650
497
  }
651
- if (data.startTime !== undefined && data.startTime !== null) {
498
+ if (data.startTime != null) {
652
499
  contents.startTime = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(data.startTime)));
653
500
  }
654
- if (data.status !== undefined && data.status !== null) {
501
+ if (data.status != null) {
655
502
  contents.status = (0, smithy_client_1.expectString)(data.status);
656
503
  }
657
- if (data.suiteDefinitionId !== undefined && data.suiteDefinitionId !== null) {
504
+ if (data.suiteDefinitionId != null) {
658
505
  contents.suiteDefinitionId = (0, smithy_client_1.expectString)(data.suiteDefinitionId);
659
506
  }
660
- if (data.suiteDefinitionVersion !== undefined && data.suiteDefinitionVersion !== null) {
507
+ if (data.suiteDefinitionVersion != null) {
661
508
  contents.suiteDefinitionVersion = (0, smithy_client_1.expectString)(data.suiteDefinitionVersion);
662
509
  }
663
- if (data.suiteRunArn !== undefined && data.suiteRunArn !== null) {
510
+ if (data.suiteRunArn != null) {
664
511
  contents.suiteRunArn = (0, smithy_client_1.expectString)(data.suiteRunArn);
665
512
  }
666
- if (data.suiteRunConfiguration !== undefined && data.suiteRunConfiguration !== null) {
513
+ if (data.suiteRunConfiguration != null) {
667
514
  contents.suiteRunConfiguration = deserializeAws_restJson1SuiteRunConfiguration(data.suiteRunConfiguration, context);
668
515
  }
669
- if (data.suiteRunId !== undefined && data.suiteRunId !== null) {
516
+ if (data.suiteRunId != null) {
670
517
  contents.suiteRunId = (0, smithy_client_1.expectString)(data.suiteRunId);
671
518
  }
672
- if (data.tags !== undefined && data.tags !== null) {
519
+ if (data.tags != null) {
673
520
  contents.tags = deserializeAws_restJson1TagMap(data.tags, context);
674
521
  }
675
- if (data.testResult !== undefined && data.testResult !== null) {
522
+ if (data.testResult != null) {
676
523
  contents.testResult = deserializeAws_restJson1TestResult(data.testResult, context);
677
524
  }
678
- return Promise.resolve(contents);
525
+ return contents;
679
526
  };
680
527
  exports.deserializeAws_restJson1GetSuiteRunCommand = deserializeAws_restJson1GetSuiteRunCommand;
681
528
  const deserializeAws_restJson1GetSuiteRunCommandError = async (output, context) => {
@@ -683,7 +530,6 @@ const deserializeAws_restJson1GetSuiteRunCommandError = async (output, context)
683
530
  ...output,
684
531
  body: await parseBody(output.body, context),
685
532
  };
686
- let response;
687
533
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
688
534
  switch (errorCode) {
689
535
  case "InternalServerException":
@@ -697,29 +543,26 @@ const deserializeAws_restJson1GetSuiteRunCommandError = async (output, context)
697
543
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
698
544
  default:
699
545
  const parsedBody = parsedOutput.body;
700
- const $metadata = deserializeMetadata(output);
701
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
702
- response = new IotDeviceAdvisorServiceException_1.IotDeviceAdvisorServiceException({
703
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
704
- $fault: "client",
705
- $metadata,
546
+ (0, smithy_client_1.throwDefaultError)({
547
+ output,
548
+ parsedBody,
549
+ exceptionCtor: IotDeviceAdvisorServiceException_1.IotDeviceAdvisorServiceException,
550
+ errorCode,
706
551
  });
707
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
708
552
  }
709
553
  };
710
554
  const deserializeAws_restJson1GetSuiteRunReportCommand = async (output, context) => {
711
555
  if (output.statusCode !== 200 && output.statusCode >= 300) {
712
556
  return deserializeAws_restJson1GetSuiteRunReportCommandError(output, context);
713
557
  }
714
- const contents = {
558
+ const contents = map({
715
559
  $metadata: deserializeMetadata(output),
716
- qualificationReportDownloadUrl: undefined,
717
- };
560
+ });
718
561
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
719
- if (data.qualificationReportDownloadUrl !== undefined && data.qualificationReportDownloadUrl !== null) {
562
+ if (data.qualificationReportDownloadUrl != null) {
720
563
  contents.qualificationReportDownloadUrl = (0, smithy_client_1.expectString)(data.qualificationReportDownloadUrl);
721
564
  }
722
- return Promise.resolve(contents);
565
+ return contents;
723
566
  };
724
567
  exports.deserializeAws_restJson1GetSuiteRunReportCommand = deserializeAws_restJson1GetSuiteRunReportCommand;
725
568
  const deserializeAws_restJson1GetSuiteRunReportCommandError = async (output, context) => {
@@ -727,7 +570,6 @@ const deserializeAws_restJson1GetSuiteRunReportCommandError = async (output, con
727
570
  ...output,
728
571
  body: await parseBody(output.body, context),
729
572
  };
730
- let response;
731
573
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
732
574
  switch (errorCode) {
733
575
  case "InternalServerException":
@@ -741,33 +583,29 @@ const deserializeAws_restJson1GetSuiteRunReportCommandError = async (output, con
741
583
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
742
584
  default:
743
585
  const parsedBody = parsedOutput.body;
744
- const $metadata = deserializeMetadata(output);
745
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
746
- response = new IotDeviceAdvisorServiceException_1.IotDeviceAdvisorServiceException({
747
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
748
- $fault: "client",
749
- $metadata,
586
+ (0, smithy_client_1.throwDefaultError)({
587
+ output,
588
+ parsedBody,
589
+ exceptionCtor: IotDeviceAdvisorServiceException_1.IotDeviceAdvisorServiceException,
590
+ errorCode,
750
591
  });
751
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
752
592
  }
753
593
  };
754
594
  const deserializeAws_restJson1ListSuiteDefinitionsCommand = async (output, context) => {
755
595
  if (output.statusCode !== 200 && output.statusCode >= 300) {
756
596
  return deserializeAws_restJson1ListSuiteDefinitionsCommandError(output, context);
757
597
  }
758
- const contents = {
598
+ const contents = map({
759
599
  $metadata: deserializeMetadata(output),
760
- nextToken: undefined,
761
- suiteDefinitionInformationList: undefined,
762
- };
600
+ });
763
601
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
764
- if (data.nextToken !== undefined && data.nextToken !== null) {
602
+ if (data.nextToken != null) {
765
603
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
766
604
  }
767
- if (data.suiteDefinitionInformationList !== undefined && data.suiteDefinitionInformationList !== null) {
605
+ if (data.suiteDefinitionInformationList != null) {
768
606
  contents.suiteDefinitionInformationList = deserializeAws_restJson1SuiteDefinitionInformationList(data.suiteDefinitionInformationList, context);
769
607
  }
770
- return Promise.resolve(contents);
608
+ return contents;
771
609
  };
772
610
  exports.deserializeAws_restJson1ListSuiteDefinitionsCommand = deserializeAws_restJson1ListSuiteDefinitionsCommand;
773
611
  const deserializeAws_restJson1ListSuiteDefinitionsCommandError = async (output, context) => {
@@ -775,7 +613,6 @@ const deserializeAws_restJson1ListSuiteDefinitionsCommandError = async (output,
775
613
  ...output,
776
614
  body: await parseBody(output.body, context),
777
615
  };
778
- let response;
779
616
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
780
617
  switch (errorCode) {
781
618
  case "InternalServerException":
@@ -786,33 +623,29 @@ const deserializeAws_restJson1ListSuiteDefinitionsCommandError = async (output,
786
623
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
787
624
  default:
788
625
  const parsedBody = parsedOutput.body;
789
- const $metadata = deserializeMetadata(output);
790
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
791
- response = new IotDeviceAdvisorServiceException_1.IotDeviceAdvisorServiceException({
792
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
793
- $fault: "client",
794
- $metadata,
626
+ (0, smithy_client_1.throwDefaultError)({
627
+ output,
628
+ parsedBody,
629
+ exceptionCtor: IotDeviceAdvisorServiceException_1.IotDeviceAdvisorServiceException,
630
+ errorCode,
795
631
  });
796
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
797
632
  }
798
633
  };
799
634
  const deserializeAws_restJson1ListSuiteRunsCommand = async (output, context) => {
800
635
  if (output.statusCode !== 200 && output.statusCode >= 300) {
801
636
  return deserializeAws_restJson1ListSuiteRunsCommandError(output, context);
802
637
  }
803
- const contents = {
638
+ const contents = map({
804
639
  $metadata: deserializeMetadata(output),
805
- nextToken: undefined,
806
- suiteRunsList: undefined,
807
- };
640
+ });
808
641
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
809
- if (data.nextToken !== undefined && data.nextToken !== null) {
642
+ if (data.nextToken != null) {
810
643
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
811
644
  }
812
- if (data.suiteRunsList !== undefined && data.suiteRunsList !== null) {
645
+ if (data.suiteRunsList != null) {
813
646
  contents.suiteRunsList = deserializeAws_restJson1SuiteRunsList(data.suiteRunsList, context);
814
647
  }
815
- return Promise.resolve(contents);
648
+ return contents;
816
649
  };
817
650
  exports.deserializeAws_restJson1ListSuiteRunsCommand = deserializeAws_restJson1ListSuiteRunsCommand;
818
651
  const deserializeAws_restJson1ListSuiteRunsCommandError = async (output, context) => {
@@ -820,7 +653,6 @@ const deserializeAws_restJson1ListSuiteRunsCommandError = async (output, context
820
653
  ...output,
821
654
  body: await parseBody(output.body, context),
822
655
  };
823
- let response;
824
656
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
825
657
  switch (errorCode) {
826
658
  case "InternalServerException":
@@ -831,29 +663,26 @@ const deserializeAws_restJson1ListSuiteRunsCommandError = async (output, context
831
663
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
832
664
  default:
833
665
  const parsedBody = parsedOutput.body;
834
- const $metadata = deserializeMetadata(output);
835
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
836
- response = new IotDeviceAdvisorServiceException_1.IotDeviceAdvisorServiceException({
837
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
838
- $fault: "client",
839
- $metadata,
666
+ (0, smithy_client_1.throwDefaultError)({
667
+ output,
668
+ parsedBody,
669
+ exceptionCtor: IotDeviceAdvisorServiceException_1.IotDeviceAdvisorServiceException,
670
+ errorCode,
840
671
  });
841
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
842
672
  }
843
673
  };
844
674
  const deserializeAws_restJson1ListTagsForResourceCommand = async (output, context) => {
845
675
  if (output.statusCode !== 200 && output.statusCode >= 300) {
846
676
  return deserializeAws_restJson1ListTagsForResourceCommandError(output, context);
847
677
  }
848
- const contents = {
678
+ const contents = map({
849
679
  $metadata: deserializeMetadata(output),
850
- tags: undefined,
851
- };
680
+ });
852
681
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
853
- if (data.tags !== undefined && data.tags !== null) {
682
+ if (data.tags != null) {
854
683
  contents.tags = deserializeAws_restJson1TagMap(data.tags, context);
855
684
  }
856
- return Promise.resolve(contents);
685
+ return contents;
857
686
  };
858
687
  exports.deserializeAws_restJson1ListTagsForResourceCommand = deserializeAws_restJson1ListTagsForResourceCommand;
859
688
  const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, context) => {
@@ -861,7 +690,6 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
861
690
  ...output,
862
691
  body: await parseBody(output.body, context),
863
692
  };
864
- let response;
865
693
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
866
694
  switch (errorCode) {
867
695
  case "InternalServerException":
@@ -875,37 +703,32 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
875
703
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
876
704
  default:
877
705
  const parsedBody = parsedOutput.body;
878
- const $metadata = deserializeMetadata(output);
879
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
880
- response = new IotDeviceAdvisorServiceException_1.IotDeviceAdvisorServiceException({
881
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
882
- $fault: "client",
883
- $metadata,
706
+ (0, smithy_client_1.throwDefaultError)({
707
+ output,
708
+ parsedBody,
709
+ exceptionCtor: IotDeviceAdvisorServiceException_1.IotDeviceAdvisorServiceException,
710
+ errorCode,
884
711
  });
885
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
886
712
  }
887
713
  };
888
714
  const deserializeAws_restJson1StartSuiteRunCommand = async (output, context) => {
889
715
  if (output.statusCode !== 200 && output.statusCode >= 300) {
890
716
  return deserializeAws_restJson1StartSuiteRunCommandError(output, context);
891
717
  }
892
- const contents = {
718
+ const contents = map({
893
719
  $metadata: deserializeMetadata(output),
894
- createdAt: undefined,
895
- suiteRunArn: undefined,
896
- suiteRunId: undefined,
897
- };
720
+ });
898
721
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
899
- if (data.createdAt !== undefined && data.createdAt !== null) {
722
+ if (data.createdAt != null) {
900
723
  contents.createdAt = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(data.createdAt)));
901
724
  }
902
- if (data.suiteRunArn !== undefined && data.suiteRunArn !== null) {
725
+ if (data.suiteRunArn != null) {
903
726
  contents.suiteRunArn = (0, smithy_client_1.expectString)(data.suiteRunArn);
904
727
  }
905
- if (data.suiteRunId !== undefined && data.suiteRunId !== null) {
728
+ if (data.suiteRunId != null) {
906
729
  contents.suiteRunId = (0, smithy_client_1.expectString)(data.suiteRunId);
907
730
  }
908
- return Promise.resolve(contents);
731
+ return contents;
909
732
  };
910
733
  exports.deserializeAws_restJson1StartSuiteRunCommand = deserializeAws_restJson1StartSuiteRunCommand;
911
734
  const deserializeAws_restJson1StartSuiteRunCommandError = async (output, context) => {
@@ -913,7 +736,6 @@ const deserializeAws_restJson1StartSuiteRunCommandError = async (output, context
913
736
  ...output,
914
737
  body: await parseBody(output.body, context),
915
738
  };
916
- let response;
917
739
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
918
740
  switch (errorCode) {
919
741
  case "ConflictException":
@@ -927,25 +749,23 @@ const deserializeAws_restJson1StartSuiteRunCommandError = async (output, context
927
749
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
928
750
  default:
929
751
  const parsedBody = parsedOutput.body;
930
- const $metadata = deserializeMetadata(output);
931
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
932
- response = new IotDeviceAdvisorServiceException_1.IotDeviceAdvisorServiceException({
933
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
934
- $fault: "client",
935
- $metadata,
752
+ (0, smithy_client_1.throwDefaultError)({
753
+ output,
754
+ parsedBody,
755
+ exceptionCtor: IotDeviceAdvisorServiceException_1.IotDeviceAdvisorServiceException,
756
+ errorCode,
936
757
  });
937
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
938
758
  }
939
759
  };
940
760
  const deserializeAws_restJson1StopSuiteRunCommand = async (output, context) => {
941
761
  if (output.statusCode !== 200 && output.statusCode >= 300) {
942
762
  return deserializeAws_restJson1StopSuiteRunCommandError(output, context);
943
763
  }
944
- const contents = {
764
+ const contents = map({
945
765
  $metadata: deserializeMetadata(output),
946
- };
766
+ });
947
767
  await collectBody(output.body, context);
948
- return Promise.resolve(contents);
768
+ return contents;
949
769
  };
950
770
  exports.deserializeAws_restJson1StopSuiteRunCommand = deserializeAws_restJson1StopSuiteRunCommand;
951
771
  const deserializeAws_restJson1StopSuiteRunCommandError = async (output, context) => {
@@ -953,7 +773,6 @@ const deserializeAws_restJson1StopSuiteRunCommandError = async (output, context)
953
773
  ...output,
954
774
  body: await parseBody(output.body, context),
955
775
  };
956
- let response;
957
776
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
958
777
  switch (errorCode) {
959
778
  case "InternalServerException":
@@ -967,25 +786,23 @@ const deserializeAws_restJson1StopSuiteRunCommandError = async (output, context)
967
786
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
968
787
  default:
969
788
  const parsedBody = parsedOutput.body;
970
- const $metadata = deserializeMetadata(output);
971
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
972
- response = new IotDeviceAdvisorServiceException_1.IotDeviceAdvisorServiceException({
973
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
974
- $fault: "client",
975
- $metadata,
789
+ (0, smithy_client_1.throwDefaultError)({
790
+ output,
791
+ parsedBody,
792
+ exceptionCtor: IotDeviceAdvisorServiceException_1.IotDeviceAdvisorServiceException,
793
+ errorCode,
976
794
  });
977
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
978
795
  }
979
796
  };
980
797
  const deserializeAws_restJson1TagResourceCommand = async (output, context) => {
981
798
  if (output.statusCode !== 200 && output.statusCode >= 300) {
982
799
  return deserializeAws_restJson1TagResourceCommandError(output, context);
983
800
  }
984
- const contents = {
801
+ const contents = map({
985
802
  $metadata: deserializeMetadata(output),
986
- };
803
+ });
987
804
  await collectBody(output.body, context);
988
- return Promise.resolve(contents);
805
+ return contents;
989
806
  };
990
807
  exports.deserializeAws_restJson1TagResourceCommand = deserializeAws_restJson1TagResourceCommand;
991
808
  const deserializeAws_restJson1TagResourceCommandError = async (output, context) => {
@@ -993,7 +810,6 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
993
810
  ...output,
994
811
  body: await parseBody(output.body, context),
995
812
  };
996
- let response;
997
813
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
998
814
  switch (errorCode) {
999
815
  case "InternalServerException":
@@ -1007,25 +823,23 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
1007
823
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1008
824
  default:
1009
825
  const parsedBody = parsedOutput.body;
1010
- const $metadata = deserializeMetadata(output);
1011
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1012
- response = new IotDeviceAdvisorServiceException_1.IotDeviceAdvisorServiceException({
1013
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1014
- $fault: "client",
1015
- $metadata,
826
+ (0, smithy_client_1.throwDefaultError)({
827
+ output,
828
+ parsedBody,
829
+ exceptionCtor: IotDeviceAdvisorServiceException_1.IotDeviceAdvisorServiceException,
830
+ errorCode,
1016
831
  });
1017
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1018
832
  }
1019
833
  };
1020
834
  const deserializeAws_restJson1UntagResourceCommand = async (output, context) => {
1021
835
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1022
836
  return deserializeAws_restJson1UntagResourceCommandError(output, context);
1023
837
  }
1024
- const contents = {
838
+ const contents = map({
1025
839
  $metadata: deserializeMetadata(output),
1026
- };
840
+ });
1027
841
  await collectBody(output.body, context);
1028
- return Promise.resolve(contents);
842
+ return contents;
1029
843
  };
1030
844
  exports.deserializeAws_restJson1UntagResourceCommand = deserializeAws_restJson1UntagResourceCommand;
1031
845
  const deserializeAws_restJson1UntagResourceCommandError = async (output, context) => {
@@ -1033,7 +847,6 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
1033
847
  ...output,
1034
848
  body: await parseBody(output.body, context),
1035
849
  };
1036
- let response;
1037
850
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1038
851
  switch (errorCode) {
1039
852
  case "InternalServerException":
@@ -1047,49 +860,41 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
1047
860
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1048
861
  default:
1049
862
  const parsedBody = parsedOutput.body;
1050
- const $metadata = deserializeMetadata(output);
1051
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1052
- response = new IotDeviceAdvisorServiceException_1.IotDeviceAdvisorServiceException({
1053
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1054
- $fault: "client",
1055
- $metadata,
863
+ (0, smithy_client_1.throwDefaultError)({
864
+ output,
865
+ parsedBody,
866
+ exceptionCtor: IotDeviceAdvisorServiceException_1.IotDeviceAdvisorServiceException,
867
+ errorCode,
1056
868
  });
1057
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1058
869
  }
1059
870
  };
1060
871
  const deserializeAws_restJson1UpdateSuiteDefinitionCommand = async (output, context) => {
1061
872
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1062
873
  return deserializeAws_restJson1UpdateSuiteDefinitionCommandError(output, context);
1063
874
  }
1064
- const contents = {
875
+ const contents = map({
1065
876
  $metadata: deserializeMetadata(output),
1066
- createdAt: undefined,
1067
- lastUpdatedAt: undefined,
1068
- suiteDefinitionArn: undefined,
1069
- suiteDefinitionId: undefined,
1070
- suiteDefinitionName: undefined,
1071
- suiteDefinitionVersion: undefined,
1072
- };
877
+ });
1073
878
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1074
- if (data.createdAt !== undefined && data.createdAt !== null) {
879
+ if (data.createdAt != null) {
1075
880
  contents.createdAt = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(data.createdAt)));
1076
881
  }
1077
- if (data.lastUpdatedAt !== undefined && data.lastUpdatedAt !== null) {
882
+ if (data.lastUpdatedAt != null) {
1078
883
  contents.lastUpdatedAt = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(data.lastUpdatedAt)));
1079
884
  }
1080
- if (data.suiteDefinitionArn !== undefined && data.suiteDefinitionArn !== null) {
885
+ if (data.suiteDefinitionArn != null) {
1081
886
  contents.suiteDefinitionArn = (0, smithy_client_1.expectString)(data.suiteDefinitionArn);
1082
887
  }
1083
- if (data.suiteDefinitionId !== undefined && data.suiteDefinitionId !== null) {
888
+ if (data.suiteDefinitionId != null) {
1084
889
  contents.suiteDefinitionId = (0, smithy_client_1.expectString)(data.suiteDefinitionId);
1085
890
  }
1086
- if (data.suiteDefinitionName !== undefined && data.suiteDefinitionName !== null) {
891
+ if (data.suiteDefinitionName != null) {
1087
892
  contents.suiteDefinitionName = (0, smithy_client_1.expectString)(data.suiteDefinitionName);
1088
893
  }
1089
- if (data.suiteDefinitionVersion !== undefined && data.suiteDefinitionVersion !== null) {
894
+ if (data.suiteDefinitionVersion != null) {
1090
895
  contents.suiteDefinitionVersion = (0, smithy_client_1.expectString)(data.suiteDefinitionVersion);
1091
896
  }
1092
- return Promise.resolve(contents);
897
+ return contents;
1093
898
  };
1094
899
  exports.deserializeAws_restJson1UpdateSuiteDefinitionCommand = deserializeAws_restJson1UpdateSuiteDefinitionCommand;
1095
900
  const deserializeAws_restJson1UpdateSuiteDefinitionCommandError = async (output, context) => {
@@ -1097,7 +902,6 @@ const deserializeAws_restJson1UpdateSuiteDefinitionCommandError = async (output,
1097
902
  ...output,
1098
903
  body: await parseBody(output.body, context),
1099
904
  };
1100
- let response;
1101
905
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1102
906
  switch (errorCode) {
1103
907
  case "InternalServerException":
@@ -1108,20 +912,19 @@ const deserializeAws_restJson1UpdateSuiteDefinitionCommandError = async (output,
1108
912
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1109
913
  default:
1110
914
  const parsedBody = parsedOutput.body;
1111
- const $metadata = deserializeMetadata(output);
1112
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1113
- response = new IotDeviceAdvisorServiceException_1.IotDeviceAdvisorServiceException({
1114
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1115
- $fault: "client",
1116
- $metadata,
915
+ (0, smithy_client_1.throwDefaultError)({
916
+ output,
917
+ parsedBody,
918
+ exceptionCtor: IotDeviceAdvisorServiceException_1.IotDeviceAdvisorServiceException,
919
+ errorCode,
1117
920
  });
1118
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1119
921
  }
1120
922
  };
923
+ const map = smithy_client_1.map;
1121
924
  const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, context) => {
1122
- const contents = {};
925
+ const contents = map({});
1123
926
  const data = parsedOutput.body;
1124
- if (data.message !== undefined && data.message !== null) {
927
+ if (data.message != null) {
1125
928
  contents.message = (0, smithy_client_1.expectString)(data.message);
1126
929
  }
1127
930
  const exception = new models_0_1.ConflictException({
@@ -1131,9 +934,9 @@ const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, c
1131
934
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1132
935
  };
1133
936
  const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOutput, context) => {
1134
- const contents = {};
937
+ const contents = map({});
1135
938
  const data = parsedOutput.body;
1136
- if (data.message !== undefined && data.message !== null) {
939
+ if (data.message != null) {
1137
940
  contents.message = (0, smithy_client_1.expectString)(data.message);
1138
941
  }
1139
942
  const exception = new models_0_1.InternalServerException({
@@ -1143,9 +946,9 @@ const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOut
1143
946
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1144
947
  };
1145
948
  const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
1146
- const contents = {};
949
+ const contents = map({});
1147
950
  const data = parsedOutput.body;
1148
- if (data.message !== undefined && data.message !== null) {
951
+ if (data.message != null) {
1149
952
  contents.message = (0, smithy_client_1.expectString)(data.message);
1150
953
  }
1151
954
  const exception = new models_0_1.ResourceNotFoundException({
@@ -1155,9 +958,9 @@ const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedO
1155
958
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1156
959
  };
1157
960
  const deserializeAws_restJson1ValidationExceptionResponse = async (parsedOutput, context) => {
1158
- const contents = {};
961
+ const contents = map({});
1159
962
  const data = parsedOutput.body;
1160
- if (data.message !== undefined && data.message !== null) {
963
+ if (data.message != null) {
1161
964
  contents.message = (0, smithy_client_1.expectString)(data.message);
1162
965
  }
1163
966
  const exception = new models_0_1.ValidationException({
@@ -1176,9 +979,6 @@ const serializeAws_restJson1DeviceUnderTestList = (input, context) => {
1176
979
  return input
1177
980
  .filter((e) => e != null)
1178
981
  .map((entry) => {
1179
- if (entry === null) {
1180
- return null;
1181
- }
1182
982
  return serializeAws_restJson1DeviceUnderTest(entry, context);
1183
983
  });
1184
984
  };
@@ -1186,9 +986,6 @@ const serializeAws_restJson1SelectedTestList = (input, context) => {
1186
986
  return input
1187
987
  .filter((e) => e != null)
1188
988
  .map((entry) => {
1189
- if (entry === null) {
1190
- return null;
1191
- }
1192
989
  return entry;
1193
990
  });
1194
991
  };