@aws-sdk/client-fis 3.131.0 → 3.142.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.
Files changed (41) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/README.md +1 -1
  3. package/dist-cjs/commands/CreateExperimentTemplateCommand.js +2 -2
  4. package/dist-cjs/commands/DeleteExperimentTemplateCommand.js +2 -2
  5. package/dist-cjs/commands/GetActionCommand.js +2 -2
  6. package/dist-cjs/commands/GetExperimentCommand.js +2 -2
  7. package/dist-cjs/commands/GetExperimentTemplateCommand.js +2 -2
  8. package/dist-cjs/commands/GetTargetResourceTypeCommand.js +2 -2
  9. package/dist-cjs/commands/ListActionsCommand.js +2 -2
  10. package/dist-cjs/commands/ListExperimentTemplatesCommand.js +2 -2
  11. package/dist-cjs/commands/ListExperimentsCommand.js +2 -2
  12. package/dist-cjs/commands/ListTagsForResourceCommand.js +2 -2
  13. package/dist-cjs/commands/ListTargetResourceTypesCommand.js +2 -2
  14. package/dist-cjs/commands/StartExperimentCommand.js +2 -2
  15. package/dist-cjs/commands/StopExperimentCommand.js +2 -2
  16. package/dist-cjs/commands/TagResourceCommand.js +2 -2
  17. package/dist-cjs/commands/UntagResourceCommand.js +2 -2
  18. package/dist-cjs/commands/UpdateExperimentTemplateCommand.js +2 -2
  19. package/dist-cjs/models/models_0.js +282 -422
  20. package/dist-cjs/protocols/Aws_restJson1.js +190 -372
  21. package/dist-es/commands/CreateExperimentTemplateCommand.js +3 -3
  22. package/dist-es/commands/DeleteExperimentTemplateCommand.js +3 -3
  23. package/dist-es/commands/GetActionCommand.js +3 -3
  24. package/dist-es/commands/GetExperimentCommand.js +3 -3
  25. package/dist-es/commands/GetExperimentTemplateCommand.js +3 -3
  26. package/dist-es/commands/GetTargetResourceTypeCommand.js +3 -3
  27. package/dist-es/commands/ListActionsCommand.js +3 -3
  28. package/dist-es/commands/ListExperimentTemplatesCommand.js +3 -3
  29. package/dist-es/commands/ListExperimentsCommand.js +3 -3
  30. package/dist-es/commands/ListTagsForResourceCommand.js +3 -3
  31. package/dist-es/commands/ListTargetResourceTypesCommand.js +3 -3
  32. package/dist-es/commands/StartExperimentCommand.js +3 -3
  33. package/dist-es/commands/StopExperimentCommand.js +3 -3
  34. package/dist-es/commands/TagResourceCommand.js +3 -3
  35. package/dist-es/commands/UntagResourceCommand.js +3 -3
  36. package/dist-es/commands/UpdateExperimentTemplateCommand.js +3 -3
  37. package/dist-es/models/models_0.js +70 -280
  38. package/dist-es/protocols/Aws_restJson1.js +243 -369
  39. package/dist-types/models/models_0.d.ts +280 -420
  40. package/dist-types/ts3.4/models/models_0.d.ts +140 -280
  41. package/package.json +6 -6
@@ -47,16 +47,7 @@ const serializeAws_restJson1DeleteExperimentTemplateCommand = async (input, cont
47
47
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
48
48
  const headers = {};
49
49
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/experimentTemplates/{id}";
50
- if (input.id !== undefined) {
51
- const labelValue = input.id;
52
- if (labelValue.length <= 0) {
53
- throw new Error("Empty value provided for input HTTP label: id.");
54
- }
55
- resolvedPath = resolvedPath.replace("{id}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
56
- }
57
- else {
58
- throw new Error("No value provided for input HTTP label: id.");
59
- }
50
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "id", () => input.id, "{id}", false);
60
51
  let body;
61
52
  return new protocol_http_1.HttpRequest({
62
53
  protocol,
@@ -73,16 +64,7 @@ const serializeAws_restJson1GetActionCommand = async (input, context) => {
73
64
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
74
65
  const headers = {};
75
66
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/actions/{id}";
76
- if (input.id !== undefined) {
77
- const labelValue = input.id;
78
- if (labelValue.length <= 0) {
79
- throw new Error("Empty value provided for input HTTP label: id.");
80
- }
81
- resolvedPath = resolvedPath.replace("{id}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
82
- }
83
- else {
84
- throw new Error("No value provided for input HTTP label: id.");
85
- }
67
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "id", () => input.id, "{id}", false);
86
68
  let body;
87
69
  return new protocol_http_1.HttpRequest({
88
70
  protocol,
@@ -99,16 +81,7 @@ const serializeAws_restJson1GetExperimentCommand = async (input, context) => {
99
81
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
100
82
  const headers = {};
101
83
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/experiments/{id}";
102
- if (input.id !== undefined) {
103
- const labelValue = input.id;
104
- if (labelValue.length <= 0) {
105
- throw new Error("Empty value provided for input HTTP label: id.");
106
- }
107
- resolvedPath = resolvedPath.replace("{id}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
108
- }
109
- else {
110
- throw new Error("No value provided for input HTTP label: id.");
111
- }
84
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "id", () => input.id, "{id}", false);
112
85
  let body;
113
86
  return new protocol_http_1.HttpRequest({
114
87
  protocol,
@@ -125,16 +98,7 @@ const serializeAws_restJson1GetExperimentTemplateCommand = async (input, context
125
98
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
126
99
  const headers = {};
127
100
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/experimentTemplates/{id}";
128
- if (input.id !== undefined) {
129
- const labelValue = input.id;
130
- if (labelValue.length <= 0) {
131
- throw new Error("Empty value provided for input HTTP label: id.");
132
- }
133
- resolvedPath = resolvedPath.replace("{id}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
134
- }
135
- else {
136
- throw new Error("No value provided for input HTTP label: id.");
137
- }
101
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "id", () => input.id, "{id}", false);
138
102
  let body;
139
103
  return new protocol_http_1.HttpRequest({
140
104
  protocol,
@@ -151,16 +115,7 @@ const serializeAws_restJson1GetTargetResourceTypeCommand = async (input, context
151
115
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
152
116
  const headers = {};
153
117
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/targetResourceTypes/{resourceType}";
154
- if (input.resourceType !== undefined) {
155
- const labelValue = input.resourceType;
156
- if (labelValue.length <= 0) {
157
- throw new Error("Empty value provided for input HTTP label: resourceType.");
158
- }
159
- resolvedPath = resolvedPath.replace("{resourceType}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
160
- }
161
- else {
162
- throw new Error("No value provided for input HTTP label: resourceType.");
163
- }
118
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceType", () => input.resourceType, "{resourceType}", false);
164
119
  let body;
165
120
  return new protocol_http_1.HttpRequest({
166
121
  protocol,
@@ -177,10 +132,10 @@ const serializeAws_restJson1ListActionsCommand = async (input, context) => {
177
132
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
178
133
  const headers = {};
179
134
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/actions";
180
- const query = {
181
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
182
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
183
- };
135
+ const query = map({
136
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
137
+ nextToken: [, input.nextToken],
138
+ });
184
139
  let body;
185
140
  return new protocol_http_1.HttpRequest({
186
141
  protocol,
@@ -198,10 +153,10 @@ const serializeAws_restJson1ListExperimentsCommand = async (input, context) => {
198
153
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
199
154
  const headers = {};
200
155
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/experiments";
201
- const query = {
202
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
203
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
204
- };
156
+ const query = map({
157
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
158
+ nextToken: [, input.nextToken],
159
+ });
205
160
  let body;
206
161
  return new protocol_http_1.HttpRequest({
207
162
  protocol,
@@ -219,10 +174,10 @@ const serializeAws_restJson1ListExperimentTemplatesCommand = async (input, conte
219
174
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
220
175
  const headers = {};
221
176
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/experimentTemplates";
222
- const query = {
223
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
224
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
225
- };
177
+ const query = map({
178
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
179
+ nextToken: [, input.nextToken],
180
+ });
226
181
  let body;
227
182
  return new protocol_http_1.HttpRequest({
228
183
  protocol,
@@ -240,16 +195,7 @@ const serializeAws_restJson1ListTagsForResourceCommand = async (input, context)
240
195
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
241
196
  const headers = {};
242
197
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
243
- if (input.resourceArn !== undefined) {
244
- const labelValue = input.resourceArn;
245
- if (labelValue.length <= 0) {
246
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
247
- }
248
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
249
- }
250
- else {
251
- throw new Error("No value provided for input HTTP label: resourceArn.");
252
- }
198
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
253
199
  let body;
254
200
  return new protocol_http_1.HttpRequest({
255
201
  protocol,
@@ -266,10 +212,10 @@ const serializeAws_restJson1ListTargetResourceTypesCommand = async (input, conte
266
212
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
267
213
  const headers = {};
268
214
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/targetResourceTypes";
269
- const query = {
270
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
271
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
272
- };
215
+ const query = map({
216
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
217
+ nextToken: [, input.nextToken],
218
+ });
273
219
  let body;
274
220
  return new protocol_http_1.HttpRequest({
275
221
  protocol,
@@ -311,16 +257,7 @@ const serializeAws_restJson1StopExperimentCommand = async (input, context) => {
311
257
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
312
258
  const headers = {};
313
259
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/experiments/{id}";
314
- if (input.id !== undefined) {
315
- const labelValue = input.id;
316
- if (labelValue.length <= 0) {
317
- throw new Error("Empty value provided for input HTTP label: id.");
318
- }
319
- resolvedPath = resolvedPath.replace("{id}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
320
- }
321
- else {
322
- throw new Error("No value provided for input HTTP label: id.");
323
- }
260
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "id", () => input.id, "{id}", false);
324
261
  let body;
325
262
  return new protocol_http_1.HttpRequest({
326
263
  protocol,
@@ -339,16 +276,7 @@ const serializeAws_restJson1TagResourceCommand = async (input, context) => {
339
276
  "content-type": "application/json",
340
277
  };
341
278
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
342
- if (input.resourceArn !== undefined) {
343
- const labelValue = input.resourceArn;
344
- if (labelValue.length <= 0) {
345
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
346
- }
347
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
348
- }
349
- else {
350
- throw new Error("No value provided for input HTTP label: resourceArn.");
351
- }
279
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
352
280
  let body;
353
281
  body = JSON.stringify({
354
282
  ...(input.tags != null && { tags: serializeAws_restJson1TagMap(input.tags, context) }),
@@ -368,19 +296,10 @@ const serializeAws_restJson1UntagResourceCommand = async (input, context) => {
368
296
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
369
297
  const headers = {};
370
298
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
371
- if (input.resourceArn !== undefined) {
372
- const labelValue = input.resourceArn;
373
- if (labelValue.length <= 0) {
374
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
375
- }
376
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
377
- }
378
- else {
379
- throw new Error("No value provided for input HTTP label: resourceArn.");
380
- }
381
- const query = {
382
- ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry) }),
383
- };
299
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
300
+ const query = map({
301
+ tagKeys: [() => input.tagKeys !== void 0, () => (input.tagKeys || []).map((_entry) => _entry)],
302
+ });
384
303
  let body;
385
304
  return new protocol_http_1.HttpRequest({
386
305
  protocol,
@@ -400,16 +319,7 @@ const serializeAws_restJson1UpdateExperimentTemplateCommand = async (input, cont
400
319
  "content-type": "application/json",
401
320
  };
402
321
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/experimentTemplates/{id}";
403
- if (input.id !== undefined) {
404
- const labelValue = input.id;
405
- if (labelValue.length <= 0) {
406
- throw new Error("Empty value provided for input HTTP label: id.");
407
- }
408
- resolvedPath = resolvedPath.replace("{id}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
409
- }
410
- else {
411
- throw new Error("No value provided for input HTTP label: id.");
412
- }
322
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "id", () => input.id, "{id}", false);
413
323
  let body;
414
324
  body = JSON.stringify({
415
325
  ...(input.actions != null && {
@@ -442,15 +352,14 @@ const deserializeAws_restJson1CreateExperimentTemplateCommand = async (output, c
442
352
  if (output.statusCode !== 200 && output.statusCode >= 300) {
443
353
  return deserializeAws_restJson1CreateExperimentTemplateCommandError(output, context);
444
354
  }
445
- const contents = {
355
+ const contents = map({
446
356
  $metadata: deserializeMetadata(output),
447
- experimentTemplate: undefined,
448
- };
357
+ });
449
358
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
450
- if (data.experimentTemplate !== undefined && data.experimentTemplate !== null) {
359
+ if (data.experimentTemplate != null) {
451
360
  contents.experimentTemplate = deserializeAws_restJson1ExperimentTemplate(data.experimentTemplate, context);
452
361
  }
453
- return Promise.resolve(contents);
362
+ return contents;
454
363
  };
455
364
  exports.deserializeAws_restJson1CreateExperimentTemplateCommand = deserializeAws_restJson1CreateExperimentTemplateCommand;
456
365
  const deserializeAws_restJson1CreateExperimentTemplateCommandError = async (output, context) => {
@@ -458,7 +367,6 @@ const deserializeAws_restJson1CreateExperimentTemplateCommandError = async (outp
458
367
  ...output,
459
368
  body: await parseBody(output.body, context),
460
369
  };
461
- let response;
462
370
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
463
371
  switch (errorCode) {
464
372
  case "ConflictException":
@@ -475,29 +383,26 @@ const deserializeAws_restJson1CreateExperimentTemplateCommandError = async (outp
475
383
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
476
384
  default:
477
385
  const parsedBody = parsedOutput.body;
478
- const $metadata = deserializeMetadata(output);
479
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
480
- response = new FisServiceException_1.FisServiceException({
481
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
482
- $fault: "client",
483
- $metadata,
386
+ (0, smithy_client_1.throwDefaultError)({
387
+ output,
388
+ parsedBody,
389
+ exceptionCtor: FisServiceException_1.FisServiceException,
390
+ errorCode,
484
391
  });
485
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
486
392
  }
487
393
  };
488
394
  const deserializeAws_restJson1DeleteExperimentTemplateCommand = async (output, context) => {
489
395
  if (output.statusCode !== 200 && output.statusCode >= 300) {
490
396
  return deserializeAws_restJson1DeleteExperimentTemplateCommandError(output, context);
491
397
  }
492
- const contents = {
398
+ const contents = map({
493
399
  $metadata: deserializeMetadata(output),
494
- experimentTemplate: undefined,
495
- };
400
+ });
496
401
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
497
- if (data.experimentTemplate !== undefined && data.experimentTemplate !== null) {
402
+ if (data.experimentTemplate != null) {
498
403
  contents.experimentTemplate = deserializeAws_restJson1ExperimentTemplate(data.experimentTemplate, context);
499
404
  }
500
- return Promise.resolve(contents);
405
+ return contents;
501
406
  };
502
407
  exports.deserializeAws_restJson1DeleteExperimentTemplateCommand = deserializeAws_restJson1DeleteExperimentTemplateCommand;
503
408
  const deserializeAws_restJson1DeleteExperimentTemplateCommandError = async (output, context) => {
@@ -505,7 +410,6 @@ const deserializeAws_restJson1DeleteExperimentTemplateCommandError = async (outp
505
410
  ...output,
506
411
  body: await parseBody(output.body, context),
507
412
  };
508
- let response;
509
413
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
510
414
  switch (errorCode) {
511
415
  case "ResourceNotFoundException":
@@ -516,29 +420,26 @@ const deserializeAws_restJson1DeleteExperimentTemplateCommandError = async (outp
516
420
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
517
421
  default:
518
422
  const parsedBody = parsedOutput.body;
519
- const $metadata = deserializeMetadata(output);
520
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
521
- response = new FisServiceException_1.FisServiceException({
522
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
523
- $fault: "client",
524
- $metadata,
423
+ (0, smithy_client_1.throwDefaultError)({
424
+ output,
425
+ parsedBody,
426
+ exceptionCtor: FisServiceException_1.FisServiceException,
427
+ errorCode,
525
428
  });
526
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
527
429
  }
528
430
  };
529
431
  const deserializeAws_restJson1GetActionCommand = async (output, context) => {
530
432
  if (output.statusCode !== 200 && output.statusCode >= 300) {
531
433
  return deserializeAws_restJson1GetActionCommandError(output, context);
532
434
  }
533
- const contents = {
435
+ const contents = map({
534
436
  $metadata: deserializeMetadata(output),
535
- action: undefined,
536
- };
437
+ });
537
438
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
538
- if (data.action !== undefined && data.action !== null) {
439
+ if (data.action != null) {
539
440
  contents.action = deserializeAws_restJson1Action(data.action, context);
540
441
  }
541
- return Promise.resolve(contents);
442
+ return contents;
542
443
  };
543
444
  exports.deserializeAws_restJson1GetActionCommand = deserializeAws_restJson1GetActionCommand;
544
445
  const deserializeAws_restJson1GetActionCommandError = async (output, context) => {
@@ -546,7 +447,6 @@ const deserializeAws_restJson1GetActionCommandError = async (output, context) =>
546
447
  ...output,
547
448
  body: await parseBody(output.body, context),
548
449
  };
549
- let response;
550
450
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
551
451
  switch (errorCode) {
552
452
  case "ResourceNotFoundException":
@@ -557,29 +457,26 @@ const deserializeAws_restJson1GetActionCommandError = async (output, context) =>
557
457
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
558
458
  default:
559
459
  const parsedBody = parsedOutput.body;
560
- const $metadata = deserializeMetadata(output);
561
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
562
- response = new FisServiceException_1.FisServiceException({
563
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
564
- $fault: "client",
565
- $metadata,
460
+ (0, smithy_client_1.throwDefaultError)({
461
+ output,
462
+ parsedBody,
463
+ exceptionCtor: FisServiceException_1.FisServiceException,
464
+ errorCode,
566
465
  });
567
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
568
466
  }
569
467
  };
570
468
  const deserializeAws_restJson1GetExperimentCommand = async (output, context) => {
571
469
  if (output.statusCode !== 200 && output.statusCode >= 300) {
572
470
  return deserializeAws_restJson1GetExperimentCommandError(output, context);
573
471
  }
574
- const contents = {
472
+ const contents = map({
575
473
  $metadata: deserializeMetadata(output),
576
- experiment: undefined,
577
- };
474
+ });
578
475
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
579
- if (data.experiment !== undefined && data.experiment !== null) {
476
+ if (data.experiment != null) {
580
477
  contents.experiment = deserializeAws_restJson1Experiment(data.experiment, context);
581
478
  }
582
- return Promise.resolve(contents);
479
+ return contents;
583
480
  };
584
481
  exports.deserializeAws_restJson1GetExperimentCommand = deserializeAws_restJson1GetExperimentCommand;
585
482
  const deserializeAws_restJson1GetExperimentCommandError = async (output, context) => {
@@ -587,7 +484,6 @@ const deserializeAws_restJson1GetExperimentCommandError = async (output, context
587
484
  ...output,
588
485
  body: await parseBody(output.body, context),
589
486
  };
590
- let response;
591
487
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
592
488
  switch (errorCode) {
593
489
  case "ResourceNotFoundException":
@@ -598,29 +494,26 @@ const deserializeAws_restJson1GetExperimentCommandError = async (output, context
598
494
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
599
495
  default:
600
496
  const parsedBody = parsedOutput.body;
601
- const $metadata = deserializeMetadata(output);
602
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
603
- response = new FisServiceException_1.FisServiceException({
604
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
605
- $fault: "client",
606
- $metadata,
497
+ (0, smithy_client_1.throwDefaultError)({
498
+ output,
499
+ parsedBody,
500
+ exceptionCtor: FisServiceException_1.FisServiceException,
501
+ errorCode,
607
502
  });
608
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
609
503
  }
610
504
  };
611
505
  const deserializeAws_restJson1GetExperimentTemplateCommand = async (output, context) => {
612
506
  if (output.statusCode !== 200 && output.statusCode >= 300) {
613
507
  return deserializeAws_restJson1GetExperimentTemplateCommandError(output, context);
614
508
  }
615
- const contents = {
509
+ const contents = map({
616
510
  $metadata: deserializeMetadata(output),
617
- experimentTemplate: undefined,
618
- };
511
+ });
619
512
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
620
- if (data.experimentTemplate !== undefined && data.experimentTemplate !== null) {
513
+ if (data.experimentTemplate != null) {
621
514
  contents.experimentTemplate = deserializeAws_restJson1ExperimentTemplate(data.experimentTemplate, context);
622
515
  }
623
- return Promise.resolve(contents);
516
+ return contents;
624
517
  };
625
518
  exports.deserializeAws_restJson1GetExperimentTemplateCommand = deserializeAws_restJson1GetExperimentTemplateCommand;
626
519
  const deserializeAws_restJson1GetExperimentTemplateCommandError = async (output, context) => {
@@ -628,7 +521,6 @@ const deserializeAws_restJson1GetExperimentTemplateCommandError = async (output,
628
521
  ...output,
629
522
  body: await parseBody(output.body, context),
630
523
  };
631
- let response;
632
524
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
633
525
  switch (errorCode) {
634
526
  case "ResourceNotFoundException":
@@ -639,29 +531,26 @@ const deserializeAws_restJson1GetExperimentTemplateCommandError = async (output,
639
531
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
640
532
  default:
641
533
  const parsedBody = parsedOutput.body;
642
- const $metadata = deserializeMetadata(output);
643
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
644
- response = new FisServiceException_1.FisServiceException({
645
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
646
- $fault: "client",
647
- $metadata,
534
+ (0, smithy_client_1.throwDefaultError)({
535
+ output,
536
+ parsedBody,
537
+ exceptionCtor: FisServiceException_1.FisServiceException,
538
+ errorCode,
648
539
  });
649
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
650
540
  }
651
541
  };
652
542
  const deserializeAws_restJson1GetTargetResourceTypeCommand = async (output, context) => {
653
543
  if (output.statusCode !== 200 && output.statusCode >= 300) {
654
544
  return deserializeAws_restJson1GetTargetResourceTypeCommandError(output, context);
655
545
  }
656
- const contents = {
546
+ const contents = map({
657
547
  $metadata: deserializeMetadata(output),
658
- targetResourceType: undefined,
659
- };
548
+ });
660
549
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
661
- if (data.targetResourceType !== undefined && data.targetResourceType !== null) {
550
+ if (data.targetResourceType != null) {
662
551
  contents.targetResourceType = deserializeAws_restJson1TargetResourceType(data.targetResourceType, context);
663
552
  }
664
- return Promise.resolve(contents);
553
+ return contents;
665
554
  };
666
555
  exports.deserializeAws_restJson1GetTargetResourceTypeCommand = deserializeAws_restJson1GetTargetResourceTypeCommand;
667
556
  const deserializeAws_restJson1GetTargetResourceTypeCommandError = async (output, context) => {
@@ -669,7 +558,6 @@ const deserializeAws_restJson1GetTargetResourceTypeCommandError = async (output,
669
558
  ...output,
670
559
  body: await parseBody(output.body, context),
671
560
  };
672
- let response;
673
561
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
674
562
  switch (errorCode) {
675
563
  case "ResourceNotFoundException":
@@ -680,33 +568,29 @@ const deserializeAws_restJson1GetTargetResourceTypeCommandError = async (output,
680
568
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
681
569
  default:
682
570
  const parsedBody = parsedOutput.body;
683
- const $metadata = deserializeMetadata(output);
684
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
685
- response = new FisServiceException_1.FisServiceException({
686
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
687
- $fault: "client",
688
- $metadata,
571
+ (0, smithy_client_1.throwDefaultError)({
572
+ output,
573
+ parsedBody,
574
+ exceptionCtor: FisServiceException_1.FisServiceException,
575
+ errorCode,
689
576
  });
690
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
691
577
  }
692
578
  };
693
579
  const deserializeAws_restJson1ListActionsCommand = async (output, context) => {
694
580
  if (output.statusCode !== 200 && output.statusCode >= 300) {
695
581
  return deserializeAws_restJson1ListActionsCommandError(output, context);
696
582
  }
697
- const contents = {
583
+ const contents = map({
698
584
  $metadata: deserializeMetadata(output),
699
- actions: undefined,
700
- nextToken: undefined,
701
- };
585
+ });
702
586
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
703
- if (data.actions !== undefined && data.actions !== null) {
587
+ if (data.actions != null) {
704
588
  contents.actions = deserializeAws_restJson1ActionSummaryList(data.actions, context);
705
589
  }
706
- if (data.nextToken !== undefined && data.nextToken !== null) {
590
+ if (data.nextToken != null) {
707
591
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
708
592
  }
709
- return Promise.resolve(contents);
593
+ return contents;
710
594
  };
711
595
  exports.deserializeAws_restJson1ListActionsCommand = deserializeAws_restJson1ListActionsCommand;
712
596
  const deserializeAws_restJson1ListActionsCommandError = async (output, context) => {
@@ -714,7 +598,6 @@ const deserializeAws_restJson1ListActionsCommandError = async (output, context)
714
598
  ...output,
715
599
  body: await parseBody(output.body, context),
716
600
  };
717
- let response;
718
601
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
719
602
  switch (errorCode) {
720
603
  case "ValidationException":
@@ -722,33 +605,29 @@ const deserializeAws_restJson1ListActionsCommandError = async (output, context)
722
605
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
723
606
  default:
724
607
  const parsedBody = parsedOutput.body;
725
- const $metadata = deserializeMetadata(output);
726
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
727
- response = new FisServiceException_1.FisServiceException({
728
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
729
- $fault: "client",
730
- $metadata,
608
+ (0, smithy_client_1.throwDefaultError)({
609
+ output,
610
+ parsedBody,
611
+ exceptionCtor: FisServiceException_1.FisServiceException,
612
+ errorCode,
731
613
  });
732
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
733
614
  }
734
615
  };
735
616
  const deserializeAws_restJson1ListExperimentsCommand = async (output, context) => {
736
617
  if (output.statusCode !== 200 && output.statusCode >= 300) {
737
618
  return deserializeAws_restJson1ListExperimentsCommandError(output, context);
738
619
  }
739
- const contents = {
620
+ const contents = map({
740
621
  $metadata: deserializeMetadata(output),
741
- experiments: undefined,
742
- nextToken: undefined,
743
- };
622
+ });
744
623
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
745
- if (data.experiments !== undefined && data.experiments !== null) {
624
+ if (data.experiments != null) {
746
625
  contents.experiments = deserializeAws_restJson1ExperimentSummaryList(data.experiments, context);
747
626
  }
748
- if (data.nextToken !== undefined && data.nextToken !== null) {
627
+ if (data.nextToken != null) {
749
628
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
750
629
  }
751
- return Promise.resolve(contents);
630
+ return contents;
752
631
  };
753
632
  exports.deserializeAws_restJson1ListExperimentsCommand = deserializeAws_restJson1ListExperimentsCommand;
754
633
  const deserializeAws_restJson1ListExperimentsCommandError = async (output, context) => {
@@ -756,7 +635,6 @@ const deserializeAws_restJson1ListExperimentsCommandError = async (output, conte
756
635
  ...output,
757
636
  body: await parseBody(output.body, context),
758
637
  };
759
- let response;
760
638
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
761
639
  switch (errorCode) {
762
640
  case "ValidationException":
@@ -764,33 +642,29 @@ const deserializeAws_restJson1ListExperimentsCommandError = async (output, conte
764
642
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
765
643
  default:
766
644
  const parsedBody = parsedOutput.body;
767
- const $metadata = deserializeMetadata(output);
768
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
769
- response = new FisServiceException_1.FisServiceException({
770
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
771
- $fault: "client",
772
- $metadata,
645
+ (0, smithy_client_1.throwDefaultError)({
646
+ output,
647
+ parsedBody,
648
+ exceptionCtor: FisServiceException_1.FisServiceException,
649
+ errorCode,
773
650
  });
774
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
775
651
  }
776
652
  };
777
653
  const deserializeAws_restJson1ListExperimentTemplatesCommand = async (output, context) => {
778
654
  if (output.statusCode !== 200 && output.statusCode >= 300) {
779
655
  return deserializeAws_restJson1ListExperimentTemplatesCommandError(output, context);
780
656
  }
781
- const contents = {
657
+ const contents = map({
782
658
  $metadata: deserializeMetadata(output),
783
- experimentTemplates: undefined,
784
- nextToken: undefined,
785
- };
659
+ });
786
660
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
787
- if (data.experimentTemplates !== undefined && data.experimentTemplates !== null) {
661
+ if (data.experimentTemplates != null) {
788
662
  contents.experimentTemplates = deserializeAws_restJson1ExperimentTemplateSummaryList(data.experimentTemplates, context);
789
663
  }
790
- if (data.nextToken !== undefined && data.nextToken !== null) {
664
+ if (data.nextToken != null) {
791
665
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
792
666
  }
793
- return Promise.resolve(contents);
667
+ return contents;
794
668
  };
795
669
  exports.deserializeAws_restJson1ListExperimentTemplatesCommand = deserializeAws_restJson1ListExperimentTemplatesCommand;
796
670
  const deserializeAws_restJson1ListExperimentTemplatesCommandError = async (output, context) => {
@@ -798,7 +672,6 @@ const deserializeAws_restJson1ListExperimentTemplatesCommandError = async (outpu
798
672
  ...output,
799
673
  body: await parseBody(output.body, context),
800
674
  };
801
- let response;
802
675
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
803
676
  switch (errorCode) {
804
677
  case "ValidationException":
@@ -806,29 +679,26 @@ const deserializeAws_restJson1ListExperimentTemplatesCommandError = async (outpu
806
679
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
807
680
  default:
808
681
  const parsedBody = parsedOutput.body;
809
- const $metadata = deserializeMetadata(output);
810
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
811
- response = new FisServiceException_1.FisServiceException({
812
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
813
- $fault: "client",
814
- $metadata,
682
+ (0, smithy_client_1.throwDefaultError)({
683
+ output,
684
+ parsedBody,
685
+ exceptionCtor: FisServiceException_1.FisServiceException,
686
+ errorCode,
815
687
  });
816
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
817
688
  }
818
689
  };
819
690
  const deserializeAws_restJson1ListTagsForResourceCommand = async (output, context) => {
820
691
  if (output.statusCode !== 200 && output.statusCode >= 300) {
821
692
  return deserializeAws_restJson1ListTagsForResourceCommandError(output, context);
822
693
  }
823
- const contents = {
694
+ const contents = map({
824
695
  $metadata: deserializeMetadata(output),
825
- tags: undefined,
826
- };
696
+ });
827
697
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
828
- if (data.tags !== undefined && data.tags !== null) {
698
+ if (data.tags != null) {
829
699
  contents.tags = deserializeAws_restJson1TagMap(data.tags, context);
830
700
  }
831
- return Promise.resolve(contents);
701
+ return contents;
832
702
  };
833
703
  exports.deserializeAws_restJson1ListTagsForResourceCommand = deserializeAws_restJson1ListTagsForResourceCommand;
834
704
  const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, context) => {
@@ -836,38 +706,30 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
836
706
  ...output,
837
707
  body: await parseBody(output.body, context),
838
708
  };
839
- let response;
840
709
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
841
- switch (errorCode) {
842
- default:
843
- const parsedBody = parsedOutput.body;
844
- const $metadata = deserializeMetadata(output);
845
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
846
- response = new FisServiceException_1.FisServiceException({
847
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
848
- $fault: "client",
849
- $metadata,
850
- });
851
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
852
- }
710
+ const parsedBody = parsedOutput.body;
711
+ (0, smithy_client_1.throwDefaultError)({
712
+ output,
713
+ parsedBody,
714
+ exceptionCtor: FisServiceException_1.FisServiceException,
715
+ errorCode,
716
+ });
853
717
  };
854
718
  const deserializeAws_restJson1ListTargetResourceTypesCommand = async (output, context) => {
855
719
  if (output.statusCode !== 200 && output.statusCode >= 300) {
856
720
  return deserializeAws_restJson1ListTargetResourceTypesCommandError(output, context);
857
721
  }
858
- const contents = {
722
+ const contents = map({
859
723
  $metadata: deserializeMetadata(output),
860
- nextToken: undefined,
861
- targetResourceTypes: undefined,
862
- };
724
+ });
863
725
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
864
- if (data.nextToken !== undefined && data.nextToken !== null) {
726
+ if (data.nextToken != null) {
865
727
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
866
728
  }
867
- if (data.targetResourceTypes !== undefined && data.targetResourceTypes !== null) {
729
+ if (data.targetResourceTypes != null) {
868
730
  contents.targetResourceTypes = deserializeAws_restJson1TargetResourceTypeSummaryList(data.targetResourceTypes, context);
869
731
  }
870
- return Promise.resolve(contents);
732
+ return contents;
871
733
  };
872
734
  exports.deserializeAws_restJson1ListTargetResourceTypesCommand = deserializeAws_restJson1ListTargetResourceTypesCommand;
873
735
  const deserializeAws_restJson1ListTargetResourceTypesCommandError = async (output, context) => {
@@ -875,7 +737,6 @@ const deserializeAws_restJson1ListTargetResourceTypesCommandError = async (outpu
875
737
  ...output,
876
738
  body: await parseBody(output.body, context),
877
739
  };
878
- let response;
879
740
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
880
741
  switch (errorCode) {
881
742
  case "ValidationException":
@@ -883,29 +744,26 @@ const deserializeAws_restJson1ListTargetResourceTypesCommandError = async (outpu
883
744
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
884
745
  default:
885
746
  const parsedBody = parsedOutput.body;
886
- const $metadata = deserializeMetadata(output);
887
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
888
- response = new FisServiceException_1.FisServiceException({
889
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
890
- $fault: "client",
891
- $metadata,
747
+ (0, smithy_client_1.throwDefaultError)({
748
+ output,
749
+ parsedBody,
750
+ exceptionCtor: FisServiceException_1.FisServiceException,
751
+ errorCode,
892
752
  });
893
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
894
753
  }
895
754
  };
896
755
  const deserializeAws_restJson1StartExperimentCommand = async (output, context) => {
897
756
  if (output.statusCode !== 200 && output.statusCode >= 300) {
898
757
  return deserializeAws_restJson1StartExperimentCommandError(output, context);
899
758
  }
900
- const contents = {
759
+ const contents = map({
901
760
  $metadata: deserializeMetadata(output),
902
- experiment: undefined,
903
- };
761
+ });
904
762
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
905
- if (data.experiment !== undefined && data.experiment !== null) {
763
+ if (data.experiment != null) {
906
764
  contents.experiment = deserializeAws_restJson1Experiment(data.experiment, context);
907
765
  }
908
- return Promise.resolve(contents);
766
+ return contents;
909
767
  };
910
768
  exports.deserializeAws_restJson1StartExperimentCommand = deserializeAws_restJson1StartExperimentCommand;
911
769
  const deserializeAws_restJson1StartExperimentCommandError = async (output, context) => {
@@ -913,7 +771,6 @@ const deserializeAws_restJson1StartExperimentCommandError = async (output, conte
913
771
  ...output,
914
772
  body: await parseBody(output.body, context),
915
773
  };
916
- let response;
917
774
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
918
775
  switch (errorCode) {
919
776
  case "ConflictException":
@@ -930,29 +787,26 @@ const deserializeAws_restJson1StartExperimentCommandError = async (output, conte
930
787
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
931
788
  default:
932
789
  const parsedBody = parsedOutput.body;
933
- const $metadata = deserializeMetadata(output);
934
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
935
- response = new FisServiceException_1.FisServiceException({
936
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
937
- $fault: "client",
938
- $metadata,
790
+ (0, smithy_client_1.throwDefaultError)({
791
+ output,
792
+ parsedBody,
793
+ exceptionCtor: FisServiceException_1.FisServiceException,
794
+ errorCode,
939
795
  });
940
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
941
796
  }
942
797
  };
943
798
  const deserializeAws_restJson1StopExperimentCommand = async (output, context) => {
944
799
  if (output.statusCode !== 200 && output.statusCode >= 300) {
945
800
  return deserializeAws_restJson1StopExperimentCommandError(output, context);
946
801
  }
947
- const contents = {
802
+ const contents = map({
948
803
  $metadata: deserializeMetadata(output),
949
- experiment: undefined,
950
- };
804
+ });
951
805
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
952
- if (data.experiment !== undefined && data.experiment !== null) {
806
+ if (data.experiment != null) {
953
807
  contents.experiment = deserializeAws_restJson1Experiment(data.experiment, context);
954
808
  }
955
- return Promise.resolve(contents);
809
+ return contents;
956
810
  };
957
811
  exports.deserializeAws_restJson1StopExperimentCommand = deserializeAws_restJson1StopExperimentCommand;
958
812
  const deserializeAws_restJson1StopExperimentCommandError = async (output, context) => {
@@ -960,7 +814,6 @@ const deserializeAws_restJson1StopExperimentCommandError = async (output, contex
960
814
  ...output,
961
815
  body: await parseBody(output.body, context),
962
816
  };
963
- let response;
964
817
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
965
818
  switch (errorCode) {
966
819
  case "ResourceNotFoundException":
@@ -971,25 +824,23 @@ const deserializeAws_restJson1StopExperimentCommandError = async (output, contex
971
824
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
972
825
  default:
973
826
  const parsedBody = parsedOutput.body;
974
- const $metadata = deserializeMetadata(output);
975
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
976
- response = new FisServiceException_1.FisServiceException({
977
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
978
- $fault: "client",
979
- $metadata,
827
+ (0, smithy_client_1.throwDefaultError)({
828
+ output,
829
+ parsedBody,
830
+ exceptionCtor: FisServiceException_1.FisServiceException,
831
+ errorCode,
980
832
  });
981
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
982
833
  }
983
834
  };
984
835
  const deserializeAws_restJson1TagResourceCommand = async (output, context) => {
985
836
  if (output.statusCode !== 200 && output.statusCode >= 300) {
986
837
  return deserializeAws_restJson1TagResourceCommandError(output, context);
987
838
  }
988
- const contents = {
839
+ const contents = map({
989
840
  $metadata: deserializeMetadata(output),
990
- };
841
+ });
991
842
  await collectBody(output.body, context);
992
- return Promise.resolve(contents);
843
+ return contents;
993
844
  };
994
845
  exports.deserializeAws_restJson1TagResourceCommand = deserializeAws_restJson1TagResourceCommand;
995
846
  const deserializeAws_restJson1TagResourceCommandError = async (output, context) => {
@@ -997,30 +848,24 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
997
848
  ...output,
998
849
  body: await parseBody(output.body, context),
999
850
  };
1000
- let response;
1001
851
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1002
- switch (errorCode) {
1003
- default:
1004
- const parsedBody = parsedOutput.body;
1005
- const $metadata = deserializeMetadata(output);
1006
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1007
- response = new FisServiceException_1.FisServiceException({
1008
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1009
- $fault: "client",
1010
- $metadata,
1011
- });
1012
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1013
- }
852
+ const parsedBody = parsedOutput.body;
853
+ (0, smithy_client_1.throwDefaultError)({
854
+ output,
855
+ parsedBody,
856
+ exceptionCtor: FisServiceException_1.FisServiceException,
857
+ errorCode,
858
+ });
1014
859
  };
1015
860
  const deserializeAws_restJson1UntagResourceCommand = async (output, context) => {
1016
861
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1017
862
  return deserializeAws_restJson1UntagResourceCommandError(output, context);
1018
863
  }
1019
- const contents = {
864
+ const contents = map({
1020
865
  $metadata: deserializeMetadata(output),
1021
- };
866
+ });
1022
867
  await collectBody(output.body, context);
1023
- return Promise.resolve(contents);
868
+ return contents;
1024
869
  };
1025
870
  exports.deserializeAws_restJson1UntagResourceCommand = deserializeAws_restJson1UntagResourceCommand;
1026
871
  const deserializeAws_restJson1UntagResourceCommandError = async (output, context) => {
@@ -1028,34 +873,27 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
1028
873
  ...output,
1029
874
  body: await parseBody(output.body, context),
1030
875
  };
1031
- let response;
1032
876
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1033
- switch (errorCode) {
1034
- default:
1035
- const parsedBody = parsedOutput.body;
1036
- const $metadata = deserializeMetadata(output);
1037
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1038
- response = new FisServiceException_1.FisServiceException({
1039
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1040
- $fault: "client",
1041
- $metadata,
1042
- });
1043
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1044
- }
877
+ const parsedBody = parsedOutput.body;
878
+ (0, smithy_client_1.throwDefaultError)({
879
+ output,
880
+ parsedBody,
881
+ exceptionCtor: FisServiceException_1.FisServiceException,
882
+ errorCode,
883
+ });
1045
884
  };
1046
885
  const deserializeAws_restJson1UpdateExperimentTemplateCommand = async (output, context) => {
1047
886
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1048
887
  return deserializeAws_restJson1UpdateExperimentTemplateCommandError(output, context);
1049
888
  }
1050
- const contents = {
889
+ const contents = map({
1051
890
  $metadata: deserializeMetadata(output),
1052
- experimentTemplate: undefined,
1053
- };
891
+ });
1054
892
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1055
- if (data.experimentTemplate !== undefined && data.experimentTemplate !== null) {
893
+ if (data.experimentTemplate != null) {
1056
894
  contents.experimentTemplate = deserializeAws_restJson1ExperimentTemplate(data.experimentTemplate, context);
1057
895
  }
1058
- return Promise.resolve(contents);
896
+ return contents;
1059
897
  };
1060
898
  exports.deserializeAws_restJson1UpdateExperimentTemplateCommand = deserializeAws_restJson1UpdateExperimentTemplateCommand;
1061
899
  const deserializeAws_restJson1UpdateExperimentTemplateCommandError = async (output, context) => {
@@ -1063,7 +901,6 @@ const deserializeAws_restJson1UpdateExperimentTemplateCommandError = async (outp
1063
901
  ...output,
1064
902
  body: await parseBody(output.body, context),
1065
903
  };
1066
- let response;
1067
904
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1068
905
  switch (errorCode) {
1069
906
  case "ResourceNotFoundException":
@@ -1077,20 +914,19 @@ const deserializeAws_restJson1UpdateExperimentTemplateCommandError = async (outp
1077
914
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1078
915
  default:
1079
916
  const parsedBody = parsedOutput.body;
1080
- const $metadata = deserializeMetadata(output);
1081
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1082
- response = new FisServiceException_1.FisServiceException({
1083
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1084
- $fault: "client",
1085
- $metadata,
917
+ (0, smithy_client_1.throwDefaultError)({
918
+ output,
919
+ parsedBody,
920
+ exceptionCtor: FisServiceException_1.FisServiceException,
921
+ errorCode,
1086
922
  });
1087
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1088
923
  }
1089
924
  };
925
+ const map = smithy_client_1.map;
1090
926
  const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, context) => {
1091
- const contents = {};
927
+ const contents = map({});
1092
928
  const data = parsedOutput.body;
1093
- if (data.message !== undefined && data.message !== null) {
929
+ if (data.message != null) {
1094
930
  contents.message = (0, smithy_client_1.expectString)(data.message);
1095
931
  }
1096
932
  const exception = new models_0_1.ConflictException({
@@ -1100,9 +936,9 @@ const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, c
1100
936
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1101
937
  };
1102
938
  const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
1103
- const contents = {};
939
+ const contents = map({});
1104
940
  const data = parsedOutput.body;
1105
- if (data.message !== undefined && data.message !== null) {
941
+ if (data.message != null) {
1106
942
  contents.message = (0, smithy_client_1.expectString)(data.message);
1107
943
  }
1108
944
  const exception = new models_0_1.ResourceNotFoundException({
@@ -1112,9 +948,9 @@ const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedO
1112
948
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1113
949
  };
1114
950
  const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (parsedOutput, context) => {
1115
- const contents = {};
951
+ const contents = map({});
1116
952
  const data = parsedOutput.body;
1117
- if (data.message !== undefined && data.message !== null) {
953
+ if (data.message != null) {
1118
954
  contents.message = (0, smithy_client_1.expectString)(data.message);
1119
955
  }
1120
956
  const exception = new models_0_1.ServiceQuotaExceededException({
@@ -1124,9 +960,9 @@ const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (par
1124
960
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1125
961
  };
1126
962
  const deserializeAws_restJson1ValidationExceptionResponse = async (parsedOutput, context) => {
1127
- const contents = {};
963
+ const contents = map({});
1128
964
  const data = parsedOutput.body;
1129
- if (data.message !== undefined && data.message !== null) {
965
+ if (data.message != null) {
1130
966
  contents.message = (0, smithy_client_1.expectString)(data.message);
1131
967
  }
1132
968
  const exception = new models_0_1.ValidationException({
@@ -1182,9 +1018,6 @@ const serializeAws_restJson1CreateExperimentTemplateStopConditionInputList = (in
1182
1018
  return input
1183
1019
  .filter((e) => e != null)
1184
1020
  .map((entry) => {
1185
- if (entry === null) {
1186
- return null;
1187
- }
1188
1021
  return serializeAws_restJson1CreateExperimentTemplateStopConditionInput(entry, context);
1189
1022
  });
1190
1023
  };
@@ -1230,9 +1063,6 @@ const serializeAws_restJson1ExperimentTemplateActionStartAfterList = (input, con
1230
1063
  return input
1231
1064
  .filter((e) => e != null)
1232
1065
  .map((entry) => {
1233
- if (entry === null) {
1234
- return null;
1235
- }
1236
1066
  return entry;
1237
1067
  });
1238
1068
  };
@@ -1262,9 +1092,6 @@ const serializeAws_restJson1ExperimentTemplateTargetFilterInputList = (input, co
1262
1092
  return input
1263
1093
  .filter((e) => e != null)
1264
1094
  .map((entry) => {
1265
- if (entry === null) {
1266
- return null;
1267
- }
1268
1095
  return serializeAws_restJson1ExperimentTemplateTargetInputFilter(entry, context);
1269
1096
  });
1270
1097
  };
@@ -1272,9 +1099,6 @@ const serializeAws_restJson1ExperimentTemplateTargetFilterValues = (input, conte
1272
1099
  return input
1273
1100
  .filter((e) => e != null)
1274
1101
  .map((entry) => {
1275
- if (entry === null) {
1276
- return null;
1277
- }
1278
1102
  return entry;
1279
1103
  });
1280
1104
  };
@@ -1301,9 +1125,6 @@ const serializeAws_restJson1ResourceArnList = (input, context) => {
1301
1125
  return input
1302
1126
  .filter((e) => e != null)
1303
1127
  .map((entry) => {
1304
- if (entry === null) {
1305
- return null;
1306
- }
1307
1128
  return entry;
1308
1129
  });
1309
1130
  };
@@ -1365,9 +1186,6 @@ const serializeAws_restJson1UpdateExperimentTemplateStopConditionInputList = (in
1365
1186
  return input
1366
1187
  .filter((e) => e != null)
1367
1188
  .map((entry) => {
1368
- if (entry === null) {
1369
- return null;
1370
- }
1371
1189
  return serializeAws_restJson1UpdateExperimentTemplateStopConditionInput(entry, context);
1372
1190
  });
1373
1191
  };