@aws-sdk/client-fis 3.141.0 → 3.150.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.
@@ -1,6 +1,6 @@
1
1
  import { __assign, __awaiter, __generator, __read } from "tslib";
2
2
  import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http";
3
- import { decorateServiceException as __decorateServiceException, expectBoolean as __expectBoolean, expectInt32 as __expectInt32, expectNonNull as __expectNonNull, expectNumber as __expectNumber, expectObject as __expectObject, expectString as __expectString, extendedEncodeURIComponent as __extendedEncodeURIComponent, parseEpochTimestamp as __parseEpochTimestamp, } from "@aws-sdk/smithy-client";
3
+ import { decorateServiceException as __decorateServiceException, expectBoolean as __expectBoolean, expectInt32 as __expectInt32, expectNonNull as __expectNonNull, expectNumber as __expectNumber, expectObject as __expectObject, expectString as __expectString, map as __map, parseEpochTimestamp as __parseEpochTimestamp, resolvedPath as __resolvedPath, throwDefaultError, } from "@aws-sdk/smithy-client";
4
4
  import { v4 as generateIdempotencyToken } from "uuid";
5
5
  import { FisServiceException as __BaseException } from "../models/FisServiceException";
6
6
  import { ConflictException, ResourceNotFoundException, ServiceQuotaExceededException, ValidationException, } from "../models/models_0";
@@ -38,7 +38,7 @@ export var serializeAws_restJson1CreateExperimentTemplateCommand = function (inp
38
38
  });
39
39
  }); };
40
40
  export var serializeAws_restJson1DeleteExperimentTemplateCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
41
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, body;
41
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
42
42
  return __generator(this, function (_c) {
43
43
  switch (_c.label) {
44
44
  case 0: return [4, context.endpoint()];
@@ -46,16 +46,7 @@ export var serializeAws_restJson1DeleteExperimentTemplateCommand = function (inp
46
46
  _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
47
47
  headers = {};
48
48
  resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/experimentTemplates/{id}";
49
- if (input.id !== undefined) {
50
- labelValue = input.id;
51
- if (labelValue.length <= 0) {
52
- throw new Error("Empty value provided for input HTTP label: id.");
53
- }
54
- resolvedPath = resolvedPath.replace("{id}", __extendedEncodeURIComponent(labelValue));
55
- }
56
- else {
57
- throw new Error("No value provided for input HTTP label: id.");
58
- }
49
+ resolvedPath = __resolvedPath(resolvedPath, input, "id", function () { return input.id; }, "{id}", false);
59
50
  return [2, new __HttpRequest({
60
51
  protocol: protocol,
61
52
  hostname: hostname,
@@ -69,7 +60,7 @@ export var serializeAws_restJson1DeleteExperimentTemplateCommand = function (inp
69
60
  });
70
61
  }); };
71
62
  export var serializeAws_restJson1GetActionCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
72
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, body;
63
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
73
64
  return __generator(this, function (_c) {
74
65
  switch (_c.label) {
75
66
  case 0: return [4, context.endpoint()];
@@ -77,16 +68,7 @@ export var serializeAws_restJson1GetActionCommand = function (input, context) {
77
68
  _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
78
69
  headers = {};
79
70
  resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/actions/{id}";
80
- if (input.id !== undefined) {
81
- labelValue = input.id;
82
- if (labelValue.length <= 0) {
83
- throw new Error("Empty value provided for input HTTP label: id.");
84
- }
85
- resolvedPath = resolvedPath.replace("{id}", __extendedEncodeURIComponent(labelValue));
86
- }
87
- else {
88
- throw new Error("No value provided for input HTTP label: id.");
89
- }
71
+ resolvedPath = __resolvedPath(resolvedPath, input, "id", function () { return input.id; }, "{id}", false);
90
72
  return [2, new __HttpRequest({
91
73
  protocol: protocol,
92
74
  hostname: hostname,
@@ -100,7 +82,7 @@ export var serializeAws_restJson1GetActionCommand = function (input, context) {
100
82
  });
101
83
  }); };
102
84
  export var serializeAws_restJson1GetExperimentCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
103
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, body;
85
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
104
86
  return __generator(this, function (_c) {
105
87
  switch (_c.label) {
106
88
  case 0: return [4, context.endpoint()];
@@ -108,16 +90,7 @@ export var serializeAws_restJson1GetExperimentCommand = function (input, context
108
90
  _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
109
91
  headers = {};
110
92
  resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/experiments/{id}";
111
- if (input.id !== undefined) {
112
- labelValue = input.id;
113
- if (labelValue.length <= 0) {
114
- throw new Error("Empty value provided for input HTTP label: id.");
115
- }
116
- resolvedPath = resolvedPath.replace("{id}", __extendedEncodeURIComponent(labelValue));
117
- }
118
- else {
119
- throw new Error("No value provided for input HTTP label: id.");
120
- }
93
+ resolvedPath = __resolvedPath(resolvedPath, input, "id", function () { return input.id; }, "{id}", false);
121
94
  return [2, new __HttpRequest({
122
95
  protocol: protocol,
123
96
  hostname: hostname,
@@ -131,7 +104,7 @@ export var serializeAws_restJson1GetExperimentCommand = function (input, context
131
104
  });
132
105
  }); };
133
106
  export var serializeAws_restJson1GetExperimentTemplateCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
134
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, body;
107
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
135
108
  return __generator(this, function (_c) {
136
109
  switch (_c.label) {
137
110
  case 0: return [4, context.endpoint()];
@@ -139,16 +112,7 @@ export var serializeAws_restJson1GetExperimentTemplateCommand = function (input,
139
112
  _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
140
113
  headers = {};
141
114
  resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/experimentTemplates/{id}";
142
- if (input.id !== undefined) {
143
- labelValue = input.id;
144
- if (labelValue.length <= 0) {
145
- throw new Error("Empty value provided for input HTTP label: id.");
146
- }
147
- resolvedPath = resolvedPath.replace("{id}", __extendedEncodeURIComponent(labelValue));
148
- }
149
- else {
150
- throw new Error("No value provided for input HTTP label: id.");
151
- }
115
+ resolvedPath = __resolvedPath(resolvedPath, input, "id", function () { return input.id; }, "{id}", false);
152
116
  return [2, new __HttpRequest({
153
117
  protocol: protocol,
154
118
  hostname: hostname,
@@ -162,7 +126,7 @@ export var serializeAws_restJson1GetExperimentTemplateCommand = function (input,
162
126
  });
163
127
  }); };
164
128
  export var serializeAws_restJson1GetTargetResourceTypeCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
165
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, body;
129
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
166
130
  return __generator(this, function (_c) {
167
131
  switch (_c.label) {
168
132
  case 0: return [4, context.endpoint()];
@@ -170,16 +134,7 @@ export var serializeAws_restJson1GetTargetResourceTypeCommand = function (input,
170
134
  _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
171
135
  headers = {};
172
136
  resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/targetResourceTypes/{resourceType}";
173
- if (input.resourceType !== undefined) {
174
- labelValue = input.resourceType;
175
- if (labelValue.length <= 0) {
176
- throw new Error("Empty value provided for input HTTP label: resourceType.");
177
- }
178
- resolvedPath = resolvedPath.replace("{resourceType}", __extendedEncodeURIComponent(labelValue));
179
- }
180
- else {
181
- throw new Error("No value provided for input HTTP label: resourceType.");
182
- }
137
+ resolvedPath = __resolvedPath(resolvedPath, input, "resourceType", function () { return input.resourceType; }, "{resourceType}", false);
183
138
  return [2, new __HttpRequest({
184
139
  protocol: protocol,
185
140
  hostname: hostname,
@@ -201,7 +156,10 @@ export var serializeAws_restJson1ListActionsCommand = function (input, context)
201
156
  _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
202
157
  headers = {};
203
158
  resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/actions";
204
- query = __assign(__assign({}, (input.maxResults !== undefined && { maxResults: input.maxResults.toString() })), (input.nextToken !== undefined && { nextToken: input.nextToken }));
159
+ query = map({
160
+ maxResults: [function () { return input.maxResults !== void 0; }, function () { return input.maxResults.toString(); }],
161
+ nextToken: [, input.nextToken],
162
+ });
205
163
  return [2, new __HttpRequest({
206
164
  protocol: protocol,
207
165
  hostname: hostname,
@@ -224,7 +182,10 @@ export var serializeAws_restJson1ListExperimentsCommand = function (input, conte
224
182
  _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
225
183
  headers = {};
226
184
  resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/experiments";
227
- query = __assign(__assign({}, (input.maxResults !== undefined && { maxResults: input.maxResults.toString() })), (input.nextToken !== undefined && { nextToken: input.nextToken }));
185
+ query = map({
186
+ maxResults: [function () { return input.maxResults !== void 0; }, function () { return input.maxResults.toString(); }],
187
+ nextToken: [, input.nextToken],
188
+ });
228
189
  return [2, new __HttpRequest({
229
190
  protocol: protocol,
230
191
  hostname: hostname,
@@ -247,7 +208,10 @@ export var serializeAws_restJson1ListExperimentTemplatesCommand = function (inpu
247
208
  _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
248
209
  headers = {};
249
210
  resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/experimentTemplates";
250
- query = __assign(__assign({}, (input.maxResults !== undefined && { maxResults: input.maxResults.toString() })), (input.nextToken !== undefined && { nextToken: input.nextToken }));
211
+ query = map({
212
+ maxResults: [function () { return input.maxResults !== void 0; }, function () { return input.maxResults.toString(); }],
213
+ nextToken: [, input.nextToken],
214
+ });
251
215
  return [2, new __HttpRequest({
252
216
  protocol: protocol,
253
217
  hostname: hostname,
@@ -262,7 +226,7 @@ export var serializeAws_restJson1ListExperimentTemplatesCommand = function (inpu
262
226
  });
263
227
  }); };
264
228
  export var serializeAws_restJson1ListTagsForResourceCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
265
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, body;
229
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
266
230
  return __generator(this, function (_c) {
267
231
  switch (_c.label) {
268
232
  case 0: return [4, context.endpoint()];
@@ -270,16 +234,7 @@ export var serializeAws_restJson1ListTagsForResourceCommand = function (input, c
270
234
  _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
271
235
  headers = {};
272
236
  resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/tags/{resourceArn}";
273
- if (input.resourceArn !== undefined) {
274
- labelValue = input.resourceArn;
275
- if (labelValue.length <= 0) {
276
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
277
- }
278
- resolvedPath = resolvedPath.replace("{resourceArn}", __extendedEncodeURIComponent(labelValue));
279
- }
280
- else {
281
- throw new Error("No value provided for input HTTP label: resourceArn.");
282
- }
237
+ resolvedPath = __resolvedPath(resolvedPath, input, "resourceArn", function () { return input.resourceArn; }, "{resourceArn}", false);
283
238
  return [2, new __HttpRequest({
284
239
  protocol: protocol,
285
240
  hostname: hostname,
@@ -301,7 +256,10 @@ export var serializeAws_restJson1ListTargetResourceTypesCommand = function (inpu
301
256
  _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
302
257
  headers = {};
303
258
  resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/targetResourceTypes";
304
- query = __assign(__assign({}, (input.maxResults !== undefined && { maxResults: input.maxResults.toString() })), (input.nextToken !== undefined && { nextToken: input.nextToken }));
259
+ query = map({
260
+ maxResults: [function () { return input.maxResults !== void 0; }, function () { return input.maxResults.toString(); }],
261
+ nextToken: [, input.nextToken],
262
+ });
305
263
  return [2, new __HttpRequest({
306
264
  protocol: protocol,
307
265
  hostname: hostname,
@@ -341,7 +299,7 @@ export var serializeAws_restJson1StartExperimentCommand = function (input, conte
341
299
  });
342
300
  }); };
343
301
  export var serializeAws_restJson1StopExperimentCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
344
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, body;
302
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
345
303
  return __generator(this, function (_c) {
346
304
  switch (_c.label) {
347
305
  case 0: return [4, context.endpoint()];
@@ -349,16 +307,7 @@ export var serializeAws_restJson1StopExperimentCommand = function (input, contex
349
307
  _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
350
308
  headers = {};
351
309
  resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/experiments/{id}";
352
- if (input.id !== undefined) {
353
- labelValue = input.id;
354
- if (labelValue.length <= 0) {
355
- throw new Error("Empty value provided for input HTTP label: id.");
356
- }
357
- resolvedPath = resolvedPath.replace("{id}", __extendedEncodeURIComponent(labelValue));
358
- }
359
- else {
360
- throw new Error("No value provided for input HTTP label: id.");
361
- }
310
+ resolvedPath = __resolvedPath(resolvedPath, input, "id", function () { return input.id; }, "{id}", false);
362
311
  return [2, new __HttpRequest({
363
312
  protocol: protocol,
364
313
  hostname: hostname,
@@ -372,7 +321,7 @@ export var serializeAws_restJson1StopExperimentCommand = function (input, contex
372
321
  });
373
322
  }); };
374
323
  export var serializeAws_restJson1TagResourceCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
375
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, body;
324
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
376
325
  return __generator(this, function (_c) {
377
326
  switch (_c.label) {
378
327
  case 0: return [4, context.endpoint()];
@@ -382,16 +331,7 @@ export var serializeAws_restJson1TagResourceCommand = function (input, context)
382
331
  "content-type": "application/json",
383
332
  };
384
333
  resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/tags/{resourceArn}";
385
- if (input.resourceArn !== undefined) {
386
- labelValue = input.resourceArn;
387
- if (labelValue.length <= 0) {
388
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
389
- }
390
- resolvedPath = resolvedPath.replace("{resourceArn}", __extendedEncodeURIComponent(labelValue));
391
- }
392
- else {
393
- throw new Error("No value provided for input HTTP label: resourceArn.");
394
- }
334
+ resolvedPath = __resolvedPath(resolvedPath, input, "resourceArn", function () { return input.resourceArn; }, "{resourceArn}", false);
395
335
  body = JSON.stringify(__assign({}, (input.tags != null && { tags: serializeAws_restJson1TagMap(input.tags, context) })));
396
336
  return [2, new __HttpRequest({
397
337
  protocol: protocol,
@@ -406,7 +346,7 @@ export var serializeAws_restJson1TagResourceCommand = function (input, context)
406
346
  });
407
347
  }); };
408
348
  export var serializeAws_restJson1UntagResourceCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
409
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, query, body;
349
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, query, body;
410
350
  return __generator(this, function (_c) {
411
351
  switch (_c.label) {
412
352
  case 0: return [4, context.endpoint()];
@@ -414,17 +354,10 @@ export var serializeAws_restJson1UntagResourceCommand = function (input, context
414
354
  _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
415
355
  headers = {};
416
356
  resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/tags/{resourceArn}";
417
- if (input.resourceArn !== undefined) {
418
- labelValue = input.resourceArn;
419
- if (labelValue.length <= 0) {
420
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
421
- }
422
- resolvedPath = resolvedPath.replace("{resourceArn}", __extendedEncodeURIComponent(labelValue));
423
- }
424
- else {
425
- throw new Error("No value provided for input HTTP label: resourceArn.");
426
- }
427
- query = __assign({}, (input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map(function (_entry) { return _entry; }) }));
357
+ resolvedPath = __resolvedPath(resolvedPath, input, "resourceArn", function () { return input.resourceArn; }, "{resourceArn}", false);
358
+ query = map({
359
+ tagKeys: [function () { return input.tagKeys !== void 0; }, function () { return (input.tagKeys || []).map(function (_entry) { return _entry; }); }],
360
+ });
428
361
  return [2, new __HttpRequest({
429
362
  protocol: protocol,
430
363
  hostname: hostname,
@@ -439,7 +372,7 @@ export var serializeAws_restJson1UntagResourceCommand = function (input, context
439
372
  });
440
373
  }); };
441
374
  export var serializeAws_restJson1UpdateExperimentTemplateCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
442
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, body;
375
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
443
376
  return __generator(this, function (_c) {
444
377
  switch (_c.label) {
445
378
  case 0: return [4, context.endpoint()];
@@ -449,16 +382,7 @@ export var serializeAws_restJson1UpdateExperimentTemplateCommand = function (inp
449
382
  "content-type": "application/json",
450
383
  };
451
384
  resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/experimentTemplates/{id}";
452
- if (input.id !== undefined) {
453
- labelValue = input.id;
454
- if (labelValue.length <= 0) {
455
- throw new Error("Empty value provided for input HTTP label: id.");
456
- }
457
- resolvedPath = resolvedPath.replace("{id}", __extendedEncodeURIComponent(labelValue));
458
- }
459
- else {
460
- throw new Error("No value provided for input HTTP label: id.");
461
- }
385
+ resolvedPath = __resolvedPath(resolvedPath, input, "id", function () { return input.id; }, "{id}", false);
462
386
  body = JSON.stringify(__assign(__assign(__assign(__assign(__assign(__assign({}, (input.actions != null && {
463
387
  actions: serializeAws_restJson1UpdateExperimentTemplateActionInputMap(input.actions, context),
464
388
  })), (input.description != null && { description: input.description })), (input.logConfiguration != null && {
@@ -488,24 +412,23 @@ export var deserializeAws_restJson1CreateExperimentTemplateCommand = function (o
488
412
  if (output.statusCode !== 200 && output.statusCode >= 300) {
489
413
  return [2, deserializeAws_restJson1CreateExperimentTemplateCommandError(output, context)];
490
414
  }
491
- contents = {
415
+ contents = map({
492
416
  $metadata: deserializeMetadata(output),
493
- experimentTemplate: undefined,
494
- };
417
+ });
495
418
  _a = __expectNonNull;
496
419
  _b = __expectObject;
497
420
  return [4, parseBody(output.body, context)];
498
421
  case 1:
499
422
  data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
500
- if (data.experimentTemplate !== undefined && data.experimentTemplate !== null) {
423
+ if (data.experimentTemplate != null) {
501
424
  contents.experimentTemplate = deserializeAws_restJson1ExperimentTemplate(data.experimentTemplate, context);
502
425
  }
503
- return [2, Promise.resolve(contents)];
426
+ return [2, contents];
504
427
  }
505
428
  });
506
429
  }); };
507
430
  var deserializeAws_restJson1CreateExperimentTemplateCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
508
- var parsedOutput, _a, response, errorCode, _b, parsedBody, $metadata, statusCode;
431
+ var parsedOutput, _a, errorCode, _b, parsedBody;
509
432
  var _c;
510
433
  return __generator(this, function (_d) {
511
434
  switch (_d.label) {
@@ -538,14 +461,14 @@ var deserializeAws_restJson1CreateExperimentTemplateCommandError = function (out
538
461
  case 9: throw _d.sent();
539
462
  case 10:
540
463
  parsedBody = parsedOutput.body;
541
- $metadata = deserializeMetadata(output);
542
- statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
543
- response = new __BaseException({
544
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
545
- $fault: "client",
546
- $metadata: $metadata,
464
+ throwDefaultError({
465
+ output: output,
466
+ parsedBody: parsedBody,
467
+ exceptionCtor: __BaseException,
468
+ errorCode: errorCode,
547
469
  });
548
- throw __decorateServiceException(response, parsedBody);
470
+ _d.label = 11;
471
+ case 11: return [2];
549
472
  }
550
473
  });
551
474
  }); };
@@ -557,24 +480,23 @@ export var deserializeAws_restJson1DeleteExperimentTemplateCommand = function (o
557
480
  if (output.statusCode !== 200 && output.statusCode >= 300) {
558
481
  return [2, deserializeAws_restJson1DeleteExperimentTemplateCommandError(output, context)];
559
482
  }
560
- contents = {
483
+ contents = map({
561
484
  $metadata: deserializeMetadata(output),
562
- experimentTemplate: undefined,
563
- };
485
+ });
564
486
  _a = __expectNonNull;
565
487
  _b = __expectObject;
566
488
  return [4, parseBody(output.body, context)];
567
489
  case 1:
568
490
  data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
569
- if (data.experimentTemplate !== undefined && data.experimentTemplate !== null) {
491
+ if (data.experimentTemplate != null) {
570
492
  contents.experimentTemplate = deserializeAws_restJson1ExperimentTemplate(data.experimentTemplate, context);
571
493
  }
572
- return [2, Promise.resolve(contents)];
494
+ return [2, contents];
573
495
  }
574
496
  });
575
497
  }); };
576
498
  var deserializeAws_restJson1DeleteExperimentTemplateCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
577
- var parsedOutput, _a, response, errorCode, _b, parsedBody, $metadata, statusCode;
499
+ var parsedOutput, _a, errorCode, _b, parsedBody;
578
500
  var _c;
579
501
  return __generator(this, function (_d) {
580
502
  switch (_d.label) {
@@ -599,14 +521,14 @@ var deserializeAws_restJson1DeleteExperimentTemplateCommandError = function (out
599
521
  case 5: throw _d.sent();
600
522
  case 6:
601
523
  parsedBody = parsedOutput.body;
602
- $metadata = deserializeMetadata(output);
603
- statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
604
- response = new __BaseException({
605
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
606
- $fault: "client",
607
- $metadata: $metadata,
524
+ throwDefaultError({
525
+ output: output,
526
+ parsedBody: parsedBody,
527
+ exceptionCtor: __BaseException,
528
+ errorCode: errorCode,
608
529
  });
609
- throw __decorateServiceException(response, parsedBody);
530
+ _d.label = 7;
531
+ case 7: return [2];
610
532
  }
611
533
  });
612
534
  }); };
@@ -618,24 +540,23 @@ export var deserializeAws_restJson1GetActionCommand = function (output, context)
618
540
  if (output.statusCode !== 200 && output.statusCode >= 300) {
619
541
  return [2, deserializeAws_restJson1GetActionCommandError(output, context)];
620
542
  }
621
- contents = {
543
+ contents = map({
622
544
  $metadata: deserializeMetadata(output),
623
- action: undefined,
624
- };
545
+ });
625
546
  _a = __expectNonNull;
626
547
  _b = __expectObject;
627
548
  return [4, parseBody(output.body, context)];
628
549
  case 1:
629
550
  data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
630
- if (data.action !== undefined && data.action !== null) {
551
+ if (data.action != null) {
631
552
  contents.action = deserializeAws_restJson1Action(data.action, context);
632
553
  }
633
- return [2, Promise.resolve(contents)];
554
+ return [2, contents];
634
555
  }
635
556
  });
636
557
  }); };
637
558
  var deserializeAws_restJson1GetActionCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
638
- var parsedOutput, _a, response, errorCode, _b, parsedBody, $metadata, statusCode;
559
+ var parsedOutput, _a, errorCode, _b, parsedBody;
639
560
  var _c;
640
561
  return __generator(this, function (_d) {
641
562
  switch (_d.label) {
@@ -660,14 +581,14 @@ var deserializeAws_restJson1GetActionCommandError = function (output, context) {
660
581
  case 5: throw _d.sent();
661
582
  case 6:
662
583
  parsedBody = parsedOutput.body;
663
- $metadata = deserializeMetadata(output);
664
- statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
665
- response = new __BaseException({
666
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
667
- $fault: "client",
668
- $metadata: $metadata,
584
+ throwDefaultError({
585
+ output: output,
586
+ parsedBody: parsedBody,
587
+ exceptionCtor: __BaseException,
588
+ errorCode: errorCode,
669
589
  });
670
- throw __decorateServiceException(response, parsedBody);
590
+ _d.label = 7;
591
+ case 7: return [2];
671
592
  }
672
593
  });
673
594
  }); };
@@ -679,24 +600,23 @@ export var deserializeAws_restJson1GetExperimentCommand = function (output, cont
679
600
  if (output.statusCode !== 200 && output.statusCode >= 300) {
680
601
  return [2, deserializeAws_restJson1GetExperimentCommandError(output, context)];
681
602
  }
682
- contents = {
603
+ contents = map({
683
604
  $metadata: deserializeMetadata(output),
684
- experiment: undefined,
685
- };
605
+ });
686
606
  _a = __expectNonNull;
687
607
  _b = __expectObject;
688
608
  return [4, parseBody(output.body, context)];
689
609
  case 1:
690
610
  data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
691
- if (data.experiment !== undefined && data.experiment !== null) {
611
+ if (data.experiment != null) {
692
612
  contents.experiment = deserializeAws_restJson1Experiment(data.experiment, context);
693
613
  }
694
- return [2, Promise.resolve(contents)];
614
+ return [2, contents];
695
615
  }
696
616
  });
697
617
  }); };
698
618
  var deserializeAws_restJson1GetExperimentCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
699
- var parsedOutput, _a, response, errorCode, _b, parsedBody, $metadata, statusCode;
619
+ var parsedOutput, _a, errorCode, _b, parsedBody;
700
620
  var _c;
701
621
  return __generator(this, function (_d) {
702
622
  switch (_d.label) {
@@ -721,14 +641,14 @@ var deserializeAws_restJson1GetExperimentCommandError = function (output, contex
721
641
  case 5: throw _d.sent();
722
642
  case 6:
723
643
  parsedBody = parsedOutput.body;
724
- $metadata = deserializeMetadata(output);
725
- statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
726
- response = new __BaseException({
727
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
728
- $fault: "client",
729
- $metadata: $metadata,
644
+ throwDefaultError({
645
+ output: output,
646
+ parsedBody: parsedBody,
647
+ exceptionCtor: __BaseException,
648
+ errorCode: errorCode,
730
649
  });
731
- throw __decorateServiceException(response, parsedBody);
650
+ _d.label = 7;
651
+ case 7: return [2];
732
652
  }
733
653
  });
734
654
  }); };
@@ -740,24 +660,23 @@ export var deserializeAws_restJson1GetExperimentTemplateCommand = function (outp
740
660
  if (output.statusCode !== 200 && output.statusCode >= 300) {
741
661
  return [2, deserializeAws_restJson1GetExperimentTemplateCommandError(output, context)];
742
662
  }
743
- contents = {
663
+ contents = map({
744
664
  $metadata: deserializeMetadata(output),
745
- experimentTemplate: undefined,
746
- };
665
+ });
747
666
  _a = __expectNonNull;
748
667
  _b = __expectObject;
749
668
  return [4, parseBody(output.body, context)];
750
669
  case 1:
751
670
  data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
752
- if (data.experimentTemplate !== undefined && data.experimentTemplate !== null) {
671
+ if (data.experimentTemplate != null) {
753
672
  contents.experimentTemplate = deserializeAws_restJson1ExperimentTemplate(data.experimentTemplate, context);
754
673
  }
755
- return [2, Promise.resolve(contents)];
674
+ return [2, contents];
756
675
  }
757
676
  });
758
677
  }); };
759
678
  var deserializeAws_restJson1GetExperimentTemplateCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
760
- var parsedOutput, _a, response, errorCode, _b, parsedBody, $metadata, statusCode;
679
+ var parsedOutput, _a, errorCode, _b, parsedBody;
761
680
  var _c;
762
681
  return __generator(this, function (_d) {
763
682
  switch (_d.label) {
@@ -782,14 +701,14 @@ var deserializeAws_restJson1GetExperimentTemplateCommandError = function (output
782
701
  case 5: throw _d.sent();
783
702
  case 6:
784
703
  parsedBody = parsedOutput.body;
785
- $metadata = deserializeMetadata(output);
786
- statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
787
- response = new __BaseException({
788
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
789
- $fault: "client",
790
- $metadata: $metadata,
704
+ throwDefaultError({
705
+ output: output,
706
+ parsedBody: parsedBody,
707
+ exceptionCtor: __BaseException,
708
+ errorCode: errorCode,
791
709
  });
792
- throw __decorateServiceException(response, parsedBody);
710
+ _d.label = 7;
711
+ case 7: return [2];
793
712
  }
794
713
  });
795
714
  }); };
@@ -801,24 +720,23 @@ export var deserializeAws_restJson1GetTargetResourceTypeCommand = function (outp
801
720
  if (output.statusCode !== 200 && output.statusCode >= 300) {
802
721
  return [2, deserializeAws_restJson1GetTargetResourceTypeCommandError(output, context)];
803
722
  }
804
- contents = {
723
+ contents = map({
805
724
  $metadata: deserializeMetadata(output),
806
- targetResourceType: undefined,
807
- };
725
+ });
808
726
  _a = __expectNonNull;
809
727
  _b = __expectObject;
810
728
  return [4, parseBody(output.body, context)];
811
729
  case 1:
812
730
  data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
813
- if (data.targetResourceType !== undefined && data.targetResourceType !== null) {
731
+ if (data.targetResourceType != null) {
814
732
  contents.targetResourceType = deserializeAws_restJson1TargetResourceType(data.targetResourceType, context);
815
733
  }
816
- return [2, Promise.resolve(contents)];
734
+ return [2, contents];
817
735
  }
818
736
  });
819
737
  }); };
820
738
  var deserializeAws_restJson1GetTargetResourceTypeCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
821
- var parsedOutput, _a, response, errorCode, _b, parsedBody, $metadata, statusCode;
739
+ var parsedOutput, _a, errorCode, _b, parsedBody;
822
740
  var _c;
823
741
  return __generator(this, function (_d) {
824
742
  switch (_d.label) {
@@ -843,14 +761,14 @@ var deserializeAws_restJson1GetTargetResourceTypeCommandError = function (output
843
761
  case 5: throw _d.sent();
844
762
  case 6:
845
763
  parsedBody = parsedOutput.body;
846
- $metadata = deserializeMetadata(output);
847
- statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
848
- response = new __BaseException({
849
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
850
- $fault: "client",
851
- $metadata: $metadata,
764
+ throwDefaultError({
765
+ output: output,
766
+ parsedBody: parsedBody,
767
+ exceptionCtor: __BaseException,
768
+ errorCode: errorCode,
852
769
  });
853
- throw __decorateServiceException(response, parsedBody);
770
+ _d.label = 7;
771
+ case 7: return [2];
854
772
  }
855
773
  });
856
774
  }); };
@@ -862,28 +780,26 @@ export var deserializeAws_restJson1ListActionsCommand = function (output, contex
862
780
  if (output.statusCode !== 200 && output.statusCode >= 300) {
863
781
  return [2, deserializeAws_restJson1ListActionsCommandError(output, context)];
864
782
  }
865
- contents = {
783
+ contents = map({
866
784
  $metadata: deserializeMetadata(output),
867
- actions: undefined,
868
- nextToken: undefined,
869
- };
785
+ });
870
786
  _a = __expectNonNull;
871
787
  _b = __expectObject;
872
788
  return [4, parseBody(output.body, context)];
873
789
  case 1:
874
790
  data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
875
- if (data.actions !== undefined && data.actions !== null) {
791
+ if (data.actions != null) {
876
792
  contents.actions = deserializeAws_restJson1ActionSummaryList(data.actions, context);
877
793
  }
878
- if (data.nextToken !== undefined && data.nextToken !== null) {
794
+ if (data.nextToken != null) {
879
795
  contents.nextToken = __expectString(data.nextToken);
880
796
  }
881
- return [2, Promise.resolve(contents)];
797
+ return [2, contents];
882
798
  }
883
799
  });
884
800
  }); };
885
801
  var deserializeAws_restJson1ListActionsCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
886
- var parsedOutput, _a, response, errorCode, _b, parsedBody, $metadata, statusCode;
802
+ var parsedOutput, _a, errorCode, _b, parsedBody;
887
803
  var _c;
888
804
  return __generator(this, function (_d) {
889
805
  switch (_d.label) {
@@ -904,14 +820,14 @@ var deserializeAws_restJson1ListActionsCommandError = function (output, context)
904
820
  case 3: throw _d.sent();
905
821
  case 4:
906
822
  parsedBody = parsedOutput.body;
907
- $metadata = deserializeMetadata(output);
908
- statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
909
- response = new __BaseException({
910
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
911
- $fault: "client",
912
- $metadata: $metadata,
823
+ throwDefaultError({
824
+ output: output,
825
+ parsedBody: parsedBody,
826
+ exceptionCtor: __BaseException,
827
+ errorCode: errorCode,
913
828
  });
914
- throw __decorateServiceException(response, parsedBody);
829
+ _d.label = 5;
830
+ case 5: return [2];
915
831
  }
916
832
  });
917
833
  }); };
@@ -923,28 +839,26 @@ export var deserializeAws_restJson1ListExperimentsCommand = function (output, co
923
839
  if (output.statusCode !== 200 && output.statusCode >= 300) {
924
840
  return [2, deserializeAws_restJson1ListExperimentsCommandError(output, context)];
925
841
  }
926
- contents = {
842
+ contents = map({
927
843
  $metadata: deserializeMetadata(output),
928
- experiments: undefined,
929
- nextToken: undefined,
930
- };
844
+ });
931
845
  _a = __expectNonNull;
932
846
  _b = __expectObject;
933
847
  return [4, parseBody(output.body, context)];
934
848
  case 1:
935
849
  data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
936
- if (data.experiments !== undefined && data.experiments !== null) {
850
+ if (data.experiments != null) {
937
851
  contents.experiments = deserializeAws_restJson1ExperimentSummaryList(data.experiments, context);
938
852
  }
939
- if (data.nextToken !== undefined && data.nextToken !== null) {
853
+ if (data.nextToken != null) {
940
854
  contents.nextToken = __expectString(data.nextToken);
941
855
  }
942
- return [2, Promise.resolve(contents)];
856
+ return [2, contents];
943
857
  }
944
858
  });
945
859
  }); };
946
860
  var deserializeAws_restJson1ListExperimentsCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
947
- var parsedOutput, _a, response, errorCode, _b, parsedBody, $metadata, statusCode;
861
+ var parsedOutput, _a, errorCode, _b, parsedBody;
948
862
  var _c;
949
863
  return __generator(this, function (_d) {
950
864
  switch (_d.label) {
@@ -965,14 +879,14 @@ var deserializeAws_restJson1ListExperimentsCommandError = function (output, cont
965
879
  case 3: throw _d.sent();
966
880
  case 4:
967
881
  parsedBody = parsedOutput.body;
968
- $metadata = deserializeMetadata(output);
969
- statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
970
- response = new __BaseException({
971
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
972
- $fault: "client",
973
- $metadata: $metadata,
882
+ throwDefaultError({
883
+ output: output,
884
+ parsedBody: parsedBody,
885
+ exceptionCtor: __BaseException,
886
+ errorCode: errorCode,
974
887
  });
975
- throw __decorateServiceException(response, parsedBody);
888
+ _d.label = 5;
889
+ case 5: return [2];
976
890
  }
977
891
  });
978
892
  }); };
@@ -984,28 +898,26 @@ export var deserializeAws_restJson1ListExperimentTemplatesCommand = function (ou
984
898
  if (output.statusCode !== 200 && output.statusCode >= 300) {
985
899
  return [2, deserializeAws_restJson1ListExperimentTemplatesCommandError(output, context)];
986
900
  }
987
- contents = {
901
+ contents = map({
988
902
  $metadata: deserializeMetadata(output),
989
- experimentTemplates: undefined,
990
- nextToken: undefined,
991
- };
903
+ });
992
904
  _a = __expectNonNull;
993
905
  _b = __expectObject;
994
906
  return [4, parseBody(output.body, context)];
995
907
  case 1:
996
908
  data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
997
- if (data.experimentTemplates !== undefined && data.experimentTemplates !== null) {
909
+ if (data.experimentTemplates != null) {
998
910
  contents.experimentTemplates = deserializeAws_restJson1ExperimentTemplateSummaryList(data.experimentTemplates, context);
999
911
  }
1000
- if (data.nextToken !== undefined && data.nextToken !== null) {
912
+ if (data.nextToken != null) {
1001
913
  contents.nextToken = __expectString(data.nextToken);
1002
914
  }
1003
- return [2, Promise.resolve(contents)];
915
+ return [2, contents];
1004
916
  }
1005
917
  });
1006
918
  }); };
1007
919
  var deserializeAws_restJson1ListExperimentTemplatesCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1008
- var parsedOutput, _a, response, errorCode, _b, parsedBody, $metadata, statusCode;
920
+ var parsedOutput, _a, errorCode, _b, parsedBody;
1009
921
  var _c;
1010
922
  return __generator(this, function (_d) {
1011
923
  switch (_d.label) {
@@ -1026,14 +938,14 @@ var deserializeAws_restJson1ListExperimentTemplatesCommandError = function (outp
1026
938
  case 3: throw _d.sent();
1027
939
  case 4:
1028
940
  parsedBody = parsedOutput.body;
1029
- $metadata = deserializeMetadata(output);
1030
- statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1031
- response = new __BaseException({
1032
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1033
- $fault: "client",
1034
- $metadata: $metadata,
941
+ throwDefaultError({
942
+ output: output,
943
+ parsedBody: parsedBody,
944
+ exceptionCtor: __BaseException,
945
+ errorCode: errorCode,
1035
946
  });
1036
- throw __decorateServiceException(response, parsedBody);
947
+ _d.label = 5;
948
+ case 5: return [2];
1037
949
  }
1038
950
  });
1039
951
  }); };
@@ -1045,24 +957,23 @@ export var deserializeAws_restJson1ListTagsForResourceCommand = function (output
1045
957
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1046
958
  return [2, deserializeAws_restJson1ListTagsForResourceCommandError(output, context)];
1047
959
  }
1048
- contents = {
960
+ contents = map({
1049
961
  $metadata: deserializeMetadata(output),
1050
- tags: undefined,
1051
- };
962
+ });
1052
963
  _a = __expectNonNull;
1053
964
  _b = __expectObject;
1054
965
  return [4, parseBody(output.body, context)];
1055
966
  case 1:
1056
967
  data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
1057
- if (data.tags !== undefined && data.tags !== null) {
968
+ if (data.tags != null) {
1058
969
  contents.tags = deserializeAws_restJson1TagMap(data.tags, context);
1059
970
  }
1060
- return [2, Promise.resolve(contents)];
971
+ return [2, contents];
1061
972
  }
1062
973
  });
1063
974
  }); };
1064
975
  var deserializeAws_restJson1ListTagsForResourceCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1065
- var parsedOutput, _a, response, errorCode, parsedBody, $metadata, statusCode;
976
+ var parsedOutput, _a, errorCode, parsedBody;
1066
977
  var _b;
1067
978
  return __generator(this, function (_c) {
1068
979
  switch (_c.label) {
@@ -1073,18 +984,13 @@ var deserializeAws_restJson1ListTagsForResourceCommandError = function (output,
1073
984
  case 1:
1074
985
  parsedOutput = __assign.apply(void 0, _a.concat([(_b.body = _c.sent(), _b)]));
1075
986
  errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1076
- switch (errorCode) {
1077
- default:
1078
- parsedBody = parsedOutput.body;
1079
- $metadata = deserializeMetadata(output);
1080
- statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1081
- response = new __BaseException({
1082
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1083
- $fault: "client",
1084
- $metadata: $metadata,
1085
- });
1086
- throw __decorateServiceException(response, parsedBody);
1087
- }
987
+ parsedBody = parsedOutput.body;
988
+ throwDefaultError({
989
+ output: output,
990
+ parsedBody: parsedBody,
991
+ exceptionCtor: __BaseException,
992
+ errorCode: errorCode,
993
+ });
1088
994
  return [2];
1089
995
  }
1090
996
  });
@@ -1097,28 +1003,26 @@ export var deserializeAws_restJson1ListTargetResourceTypesCommand = function (ou
1097
1003
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1098
1004
  return [2, deserializeAws_restJson1ListTargetResourceTypesCommandError(output, context)];
1099
1005
  }
1100
- contents = {
1006
+ contents = map({
1101
1007
  $metadata: deserializeMetadata(output),
1102
- nextToken: undefined,
1103
- targetResourceTypes: undefined,
1104
- };
1008
+ });
1105
1009
  _a = __expectNonNull;
1106
1010
  _b = __expectObject;
1107
1011
  return [4, parseBody(output.body, context)];
1108
1012
  case 1:
1109
1013
  data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
1110
- if (data.nextToken !== undefined && data.nextToken !== null) {
1014
+ if (data.nextToken != null) {
1111
1015
  contents.nextToken = __expectString(data.nextToken);
1112
1016
  }
1113
- if (data.targetResourceTypes !== undefined && data.targetResourceTypes !== null) {
1017
+ if (data.targetResourceTypes != null) {
1114
1018
  contents.targetResourceTypes = deserializeAws_restJson1TargetResourceTypeSummaryList(data.targetResourceTypes, context);
1115
1019
  }
1116
- return [2, Promise.resolve(contents)];
1020
+ return [2, contents];
1117
1021
  }
1118
1022
  });
1119
1023
  }); };
1120
1024
  var deserializeAws_restJson1ListTargetResourceTypesCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1121
- var parsedOutput, _a, response, errorCode, _b, parsedBody, $metadata, statusCode;
1025
+ var parsedOutput, _a, errorCode, _b, parsedBody;
1122
1026
  var _c;
1123
1027
  return __generator(this, function (_d) {
1124
1028
  switch (_d.label) {
@@ -1139,14 +1043,14 @@ var deserializeAws_restJson1ListTargetResourceTypesCommandError = function (outp
1139
1043
  case 3: throw _d.sent();
1140
1044
  case 4:
1141
1045
  parsedBody = parsedOutput.body;
1142
- $metadata = deserializeMetadata(output);
1143
- statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1144
- response = new __BaseException({
1145
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1146
- $fault: "client",
1147
- $metadata: $metadata,
1046
+ throwDefaultError({
1047
+ output: output,
1048
+ parsedBody: parsedBody,
1049
+ exceptionCtor: __BaseException,
1050
+ errorCode: errorCode,
1148
1051
  });
1149
- throw __decorateServiceException(response, parsedBody);
1052
+ _d.label = 5;
1053
+ case 5: return [2];
1150
1054
  }
1151
1055
  });
1152
1056
  }); };
@@ -1158,24 +1062,23 @@ export var deserializeAws_restJson1StartExperimentCommand = function (output, co
1158
1062
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1159
1063
  return [2, deserializeAws_restJson1StartExperimentCommandError(output, context)];
1160
1064
  }
1161
- contents = {
1065
+ contents = map({
1162
1066
  $metadata: deserializeMetadata(output),
1163
- experiment: undefined,
1164
- };
1067
+ });
1165
1068
  _a = __expectNonNull;
1166
1069
  _b = __expectObject;
1167
1070
  return [4, parseBody(output.body, context)];
1168
1071
  case 1:
1169
1072
  data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
1170
- if (data.experiment !== undefined && data.experiment !== null) {
1073
+ if (data.experiment != null) {
1171
1074
  contents.experiment = deserializeAws_restJson1Experiment(data.experiment, context);
1172
1075
  }
1173
- return [2, Promise.resolve(contents)];
1076
+ return [2, contents];
1174
1077
  }
1175
1078
  });
1176
1079
  }); };
1177
1080
  var deserializeAws_restJson1StartExperimentCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1178
- var parsedOutput, _a, response, errorCode, _b, parsedBody, $metadata, statusCode;
1081
+ var parsedOutput, _a, errorCode, _b, parsedBody;
1179
1082
  var _c;
1180
1083
  return __generator(this, function (_d) {
1181
1084
  switch (_d.label) {
@@ -1208,14 +1111,14 @@ var deserializeAws_restJson1StartExperimentCommandError = function (output, cont
1208
1111
  case 9: throw _d.sent();
1209
1112
  case 10:
1210
1113
  parsedBody = parsedOutput.body;
1211
- $metadata = deserializeMetadata(output);
1212
- statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1213
- response = new __BaseException({
1214
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1215
- $fault: "client",
1216
- $metadata: $metadata,
1114
+ throwDefaultError({
1115
+ output: output,
1116
+ parsedBody: parsedBody,
1117
+ exceptionCtor: __BaseException,
1118
+ errorCode: errorCode,
1217
1119
  });
1218
- throw __decorateServiceException(response, parsedBody);
1120
+ _d.label = 11;
1121
+ case 11: return [2];
1219
1122
  }
1220
1123
  });
1221
1124
  }); };
@@ -1227,24 +1130,23 @@ export var deserializeAws_restJson1StopExperimentCommand = function (output, con
1227
1130
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1228
1131
  return [2, deserializeAws_restJson1StopExperimentCommandError(output, context)];
1229
1132
  }
1230
- contents = {
1133
+ contents = map({
1231
1134
  $metadata: deserializeMetadata(output),
1232
- experiment: undefined,
1233
- };
1135
+ });
1234
1136
  _a = __expectNonNull;
1235
1137
  _b = __expectObject;
1236
1138
  return [4, parseBody(output.body, context)];
1237
1139
  case 1:
1238
1140
  data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
1239
- if (data.experiment !== undefined && data.experiment !== null) {
1141
+ if (data.experiment != null) {
1240
1142
  contents.experiment = deserializeAws_restJson1Experiment(data.experiment, context);
1241
1143
  }
1242
- return [2, Promise.resolve(contents)];
1144
+ return [2, contents];
1243
1145
  }
1244
1146
  });
1245
1147
  }); };
1246
1148
  var deserializeAws_restJson1StopExperimentCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1247
- var parsedOutput, _a, response, errorCode, _b, parsedBody, $metadata, statusCode;
1149
+ var parsedOutput, _a, errorCode, _b, parsedBody;
1248
1150
  var _c;
1249
1151
  return __generator(this, function (_d) {
1250
1152
  switch (_d.label) {
@@ -1269,14 +1171,14 @@ var deserializeAws_restJson1StopExperimentCommandError = function (output, conte
1269
1171
  case 5: throw _d.sent();
1270
1172
  case 6:
1271
1173
  parsedBody = parsedOutput.body;
1272
- $metadata = deserializeMetadata(output);
1273
- statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1274
- response = new __BaseException({
1275
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1276
- $fault: "client",
1277
- $metadata: $metadata,
1174
+ throwDefaultError({
1175
+ output: output,
1176
+ parsedBody: parsedBody,
1177
+ exceptionCtor: __BaseException,
1178
+ errorCode: errorCode,
1278
1179
  });
1279
- throw __decorateServiceException(response, parsedBody);
1180
+ _d.label = 7;
1181
+ case 7: return [2];
1280
1182
  }
1281
1183
  });
1282
1184
  }); };
@@ -1288,18 +1190,18 @@ export var deserializeAws_restJson1TagResourceCommand = function (output, contex
1288
1190
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1289
1191
  return [2, deserializeAws_restJson1TagResourceCommandError(output, context)];
1290
1192
  }
1291
- contents = {
1193
+ contents = map({
1292
1194
  $metadata: deserializeMetadata(output),
1293
- };
1195
+ });
1294
1196
  return [4, collectBody(output.body, context)];
1295
1197
  case 1:
1296
1198
  _a.sent();
1297
- return [2, Promise.resolve(contents)];
1199
+ return [2, contents];
1298
1200
  }
1299
1201
  });
1300
1202
  }); };
1301
1203
  var deserializeAws_restJson1TagResourceCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1302
- var parsedOutput, _a, response, errorCode, parsedBody, $metadata, statusCode;
1204
+ var parsedOutput, _a, errorCode, parsedBody;
1303
1205
  var _b;
1304
1206
  return __generator(this, function (_c) {
1305
1207
  switch (_c.label) {
@@ -1310,18 +1212,13 @@ var deserializeAws_restJson1TagResourceCommandError = function (output, context)
1310
1212
  case 1:
1311
1213
  parsedOutput = __assign.apply(void 0, _a.concat([(_b.body = _c.sent(), _b)]));
1312
1214
  errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1313
- switch (errorCode) {
1314
- default:
1315
- parsedBody = parsedOutput.body;
1316
- $metadata = deserializeMetadata(output);
1317
- statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1318
- response = new __BaseException({
1319
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1320
- $fault: "client",
1321
- $metadata: $metadata,
1322
- });
1323
- throw __decorateServiceException(response, parsedBody);
1324
- }
1215
+ parsedBody = parsedOutput.body;
1216
+ throwDefaultError({
1217
+ output: output,
1218
+ parsedBody: parsedBody,
1219
+ exceptionCtor: __BaseException,
1220
+ errorCode: errorCode,
1221
+ });
1325
1222
  return [2];
1326
1223
  }
1327
1224
  });
@@ -1334,18 +1231,18 @@ export var deserializeAws_restJson1UntagResourceCommand = function (output, cont
1334
1231
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1335
1232
  return [2, deserializeAws_restJson1UntagResourceCommandError(output, context)];
1336
1233
  }
1337
- contents = {
1234
+ contents = map({
1338
1235
  $metadata: deserializeMetadata(output),
1339
- };
1236
+ });
1340
1237
  return [4, collectBody(output.body, context)];
1341
1238
  case 1:
1342
1239
  _a.sent();
1343
- return [2, Promise.resolve(contents)];
1240
+ return [2, contents];
1344
1241
  }
1345
1242
  });
1346
1243
  }); };
1347
1244
  var deserializeAws_restJson1UntagResourceCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1348
- var parsedOutput, _a, response, errorCode, parsedBody, $metadata, statusCode;
1245
+ var parsedOutput, _a, errorCode, parsedBody;
1349
1246
  var _b;
1350
1247
  return __generator(this, function (_c) {
1351
1248
  switch (_c.label) {
@@ -1356,18 +1253,13 @@ var deserializeAws_restJson1UntagResourceCommandError = function (output, contex
1356
1253
  case 1:
1357
1254
  parsedOutput = __assign.apply(void 0, _a.concat([(_b.body = _c.sent(), _b)]));
1358
1255
  errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1359
- switch (errorCode) {
1360
- default:
1361
- parsedBody = parsedOutput.body;
1362
- $metadata = deserializeMetadata(output);
1363
- statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1364
- response = new __BaseException({
1365
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1366
- $fault: "client",
1367
- $metadata: $metadata,
1368
- });
1369
- throw __decorateServiceException(response, parsedBody);
1370
- }
1256
+ parsedBody = parsedOutput.body;
1257
+ throwDefaultError({
1258
+ output: output,
1259
+ parsedBody: parsedBody,
1260
+ exceptionCtor: __BaseException,
1261
+ errorCode: errorCode,
1262
+ });
1371
1263
  return [2];
1372
1264
  }
1373
1265
  });
@@ -1380,24 +1272,23 @@ export var deserializeAws_restJson1UpdateExperimentTemplateCommand = function (o
1380
1272
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1381
1273
  return [2, deserializeAws_restJson1UpdateExperimentTemplateCommandError(output, context)];
1382
1274
  }
1383
- contents = {
1275
+ contents = map({
1384
1276
  $metadata: deserializeMetadata(output),
1385
- experimentTemplate: undefined,
1386
- };
1277
+ });
1387
1278
  _a = __expectNonNull;
1388
1279
  _b = __expectObject;
1389
1280
  return [4, parseBody(output.body, context)];
1390
1281
  case 1:
1391
1282
  data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
1392
- if (data.experimentTemplate !== undefined && data.experimentTemplate !== null) {
1283
+ if (data.experimentTemplate != null) {
1393
1284
  contents.experimentTemplate = deserializeAws_restJson1ExperimentTemplate(data.experimentTemplate, context);
1394
1285
  }
1395
- return [2, Promise.resolve(contents)];
1286
+ return [2, contents];
1396
1287
  }
1397
1288
  });
1398
1289
  }); };
1399
1290
  var deserializeAws_restJson1UpdateExperimentTemplateCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1400
- var parsedOutput, _a, response, errorCode, _b, parsedBody, $metadata, statusCode;
1291
+ var parsedOutput, _a, errorCode, _b, parsedBody;
1401
1292
  var _c;
1402
1293
  return __generator(this, function (_d) {
1403
1294
  switch (_d.label) {
@@ -1426,23 +1317,24 @@ var deserializeAws_restJson1UpdateExperimentTemplateCommandError = function (out
1426
1317
  case 7: throw _d.sent();
1427
1318
  case 8:
1428
1319
  parsedBody = parsedOutput.body;
1429
- $metadata = deserializeMetadata(output);
1430
- statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1431
- response = new __BaseException({
1432
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1433
- $fault: "client",
1434
- $metadata: $metadata,
1320
+ throwDefaultError({
1321
+ output: output,
1322
+ parsedBody: parsedBody,
1323
+ exceptionCtor: __BaseException,
1324
+ errorCode: errorCode,
1435
1325
  });
1436
- throw __decorateServiceException(response, parsedBody);
1326
+ _d.label = 9;
1327
+ case 9: return [2];
1437
1328
  }
1438
1329
  });
1439
1330
  }); };
1331
+ var map = __map;
1440
1332
  var deserializeAws_restJson1ConflictExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
1441
1333
  var contents, data, exception;
1442
1334
  return __generator(this, function (_a) {
1443
- contents = {};
1335
+ contents = map({});
1444
1336
  data = parsedOutput.body;
1445
- if (data.message !== undefined && data.message !== null) {
1337
+ if (data.message != null) {
1446
1338
  contents.message = __expectString(data.message);
1447
1339
  }
1448
1340
  exception = new ConflictException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
@@ -1452,9 +1344,9 @@ var deserializeAws_restJson1ConflictExceptionResponse = function (parsedOutput,
1452
1344
  var deserializeAws_restJson1ResourceNotFoundExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
1453
1345
  var contents, data, exception;
1454
1346
  return __generator(this, function (_a) {
1455
- contents = {};
1347
+ contents = map({});
1456
1348
  data = parsedOutput.body;
1457
- if (data.message !== undefined && data.message !== null) {
1349
+ if (data.message != null) {
1458
1350
  contents.message = __expectString(data.message);
1459
1351
  }
1460
1352
  exception = new ResourceNotFoundException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
@@ -1464,9 +1356,9 @@ var deserializeAws_restJson1ResourceNotFoundExceptionResponse = function (parsed
1464
1356
  var deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
1465
1357
  var contents, data, exception;
1466
1358
  return __generator(this, function (_a) {
1467
- contents = {};
1359
+ contents = map({});
1468
1360
  data = parsedOutput.body;
1469
- if (data.message !== undefined && data.message !== null) {
1361
+ if (data.message != null) {
1470
1362
  contents.message = __expectString(data.message);
1471
1363
  }
1472
1364
  exception = new ServiceQuotaExceededException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
@@ -1476,9 +1368,9 @@ var deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = function (pa
1476
1368
  var deserializeAws_restJson1ValidationExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
1477
1369
  var contents, data, exception;
1478
1370
  return __generator(this, function (_a) {
1479
- contents = {};
1371
+ contents = map({});
1480
1372
  data = parsedOutput.body;
1481
- if (data.message !== undefined && data.message !== null) {
1373
+ if (data.message != null) {
1482
1374
  contents.message = __expectString(data.message);
1483
1375
  }
1484
1376
  exception = new ValidationException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
@@ -1518,9 +1410,6 @@ var serializeAws_restJson1CreateExperimentTemplateStopConditionInputList = funct
1518
1410
  return input
1519
1411
  .filter(function (e) { return e != null; })
1520
1412
  .map(function (entry) {
1521
- if (entry === null) {
1522
- return null;
1523
- }
1524
1413
  return serializeAws_restJson1CreateExperimentTemplateStopConditionInput(entry, context);
1525
1414
  });
1526
1415
  };
@@ -1557,9 +1446,6 @@ var serializeAws_restJson1ExperimentTemplateActionStartAfterList = function (inp
1557
1446
  return input
1558
1447
  .filter(function (e) { return e != null; })
1559
1448
  .map(function (entry) {
1560
- if (entry === null) {
1561
- return null;
1562
- }
1563
1449
  return entry;
1564
1450
  });
1565
1451
  };
@@ -1583,9 +1469,6 @@ var serializeAws_restJson1ExperimentTemplateTargetFilterInputList = function (in
1583
1469
  return input
1584
1470
  .filter(function (e) { return e != null; })
1585
1471
  .map(function (entry) {
1586
- if (entry === null) {
1587
- return null;
1588
- }
1589
1472
  return serializeAws_restJson1ExperimentTemplateTargetInputFilter(entry, context);
1590
1473
  });
1591
1474
  };
@@ -1593,9 +1476,6 @@ var serializeAws_restJson1ExperimentTemplateTargetFilterValues = function (input
1593
1476
  return input
1594
1477
  .filter(function (e) { return e != null; })
1595
1478
  .map(function (entry) {
1596
- if (entry === null) {
1597
- return null;
1598
- }
1599
1479
  return entry;
1600
1480
  });
1601
1481
  };
@@ -1618,9 +1498,6 @@ var serializeAws_restJson1ResourceArnList = function (input, context) {
1618
1498
  return input
1619
1499
  .filter(function (e) { return e != null; })
1620
1500
  .map(function (entry) {
1621
- if (entry === null) {
1622
- return null;
1623
- }
1624
1501
  return entry;
1625
1502
  });
1626
1503
  };
@@ -1667,9 +1544,6 @@ var serializeAws_restJson1UpdateExperimentTemplateStopConditionInputList = funct
1667
1544
  return input
1668
1545
  .filter(function (e) { return e != null; })
1669
1546
  .map(function (entry) {
1670
- if (entry === null) {
1671
- return null;
1672
- }
1673
1547
  return serializeAws_restJson1UpdateExperimentTemplateStopConditionInput(entry, context);
1674
1548
  });
1675
1549
  };