@aws-sdk/client-rbin 3.141.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.
@@ -1,6 +1,6 @@
1
1
  import { __assign, __awaiter, __generator } from "tslib";
2
2
  import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http";
3
- import { decorateServiceException as __decorateServiceException, expectInt32 as __expectInt32, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, extendedEncodeURIComponent as __extendedEncodeURIComponent, } from "@aws-sdk/smithy-client";
3
+ import { decorateServiceException as __decorateServiceException, expectInt32 as __expectInt32, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, map as __map, resolvedPath as __resolvedPath, throwDefaultError, } from "@aws-sdk/smithy-client";
4
4
  import { InternalServerException, ResourceNotFoundException, ServiceQuotaExceededException, ValidationException, } from "../models/models_0";
5
5
  import { RbinServiceException as __BaseException } from "../models/RbinServiceException";
6
6
  export var serializeAws_restJson1CreateRuleCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
@@ -32,7 +32,7 @@ export var serializeAws_restJson1CreateRuleCommand = function (input, context) {
32
32
  });
33
33
  }); };
34
34
  export var serializeAws_restJson1DeleteRuleCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
35
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, body;
35
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
36
36
  return __generator(this, function (_c) {
37
37
  switch (_c.label) {
38
38
  case 0: return [4, context.endpoint()];
@@ -40,16 +40,7 @@ export var serializeAws_restJson1DeleteRuleCommand = function (input, context) {
40
40
  _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
41
41
  headers = {};
42
42
  resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/rules/{Identifier}";
43
- if (input.Identifier !== undefined) {
44
- labelValue = input.Identifier;
45
- if (labelValue.length <= 0) {
46
- throw new Error("Empty value provided for input HTTP label: Identifier.");
47
- }
48
- resolvedPath = resolvedPath.replace("{Identifier}", __extendedEncodeURIComponent(labelValue));
49
- }
50
- else {
51
- throw new Error("No value provided for input HTTP label: Identifier.");
52
- }
43
+ resolvedPath = __resolvedPath(resolvedPath, input, "Identifier", function () { return input.Identifier; }, "{Identifier}", false);
53
44
  return [2, new __HttpRequest({
54
45
  protocol: protocol,
55
46
  hostname: hostname,
@@ -63,7 +54,7 @@ export var serializeAws_restJson1DeleteRuleCommand = function (input, context) {
63
54
  });
64
55
  }); };
65
56
  export var serializeAws_restJson1GetRuleCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
66
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, body;
57
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
67
58
  return __generator(this, function (_c) {
68
59
  switch (_c.label) {
69
60
  case 0: return [4, context.endpoint()];
@@ -71,16 +62,7 @@ export var serializeAws_restJson1GetRuleCommand = function (input, context) { re
71
62
  _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
72
63
  headers = {};
73
64
  resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/rules/{Identifier}";
74
- if (input.Identifier !== undefined) {
75
- labelValue = input.Identifier;
76
- if (labelValue.length <= 0) {
77
- throw new Error("Empty value provided for input HTTP label: Identifier.");
78
- }
79
- resolvedPath = resolvedPath.replace("{Identifier}", __extendedEncodeURIComponent(labelValue));
80
- }
81
- else {
82
- throw new Error("No value provided for input HTTP label: Identifier.");
83
- }
65
+ resolvedPath = __resolvedPath(resolvedPath, input, "Identifier", function () { return input.Identifier; }, "{Identifier}", false);
84
66
  return [2, new __HttpRequest({
85
67
  protocol: protocol,
86
68
  hostname: hostname,
@@ -120,7 +102,7 @@ export var serializeAws_restJson1ListRulesCommand = function (input, context) {
120
102
  });
121
103
  }); };
122
104
  export var serializeAws_restJson1ListTagsForResourceCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
123
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, body;
105
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
124
106
  return __generator(this, function (_c) {
125
107
  switch (_c.label) {
126
108
  case 0: return [4, context.endpoint()];
@@ -128,16 +110,7 @@ export var serializeAws_restJson1ListTagsForResourceCommand = function (input, c
128
110
  _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
129
111
  headers = {};
130
112
  resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/tags/{ResourceArn}";
131
- if (input.ResourceArn !== undefined) {
132
- labelValue = input.ResourceArn;
133
- if (labelValue.length <= 0) {
134
- throw new Error("Empty value provided for input HTTP label: ResourceArn.");
135
- }
136
- resolvedPath = resolvedPath.replace("{ResourceArn}", __extendedEncodeURIComponent(labelValue));
137
- }
138
- else {
139
- throw new Error("No value provided for input HTTP label: ResourceArn.");
140
- }
113
+ resolvedPath = __resolvedPath(resolvedPath, input, "ResourceArn", function () { return input.ResourceArn; }, "{ResourceArn}", false);
141
114
  return [2, new __HttpRequest({
142
115
  protocol: protocol,
143
116
  hostname: hostname,
@@ -151,7 +124,7 @@ export var serializeAws_restJson1ListTagsForResourceCommand = function (input, c
151
124
  });
152
125
  }); };
153
126
  export var serializeAws_restJson1TagResourceCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
154
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, body;
127
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
155
128
  return __generator(this, function (_c) {
156
129
  switch (_c.label) {
157
130
  case 0: return [4, context.endpoint()];
@@ -161,16 +134,7 @@ export var serializeAws_restJson1TagResourceCommand = function (input, context)
161
134
  "content-type": "application/json",
162
135
  };
163
136
  resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/tags/{ResourceArn}";
164
- if (input.ResourceArn !== undefined) {
165
- labelValue = input.ResourceArn;
166
- if (labelValue.length <= 0) {
167
- throw new Error("Empty value provided for input HTTP label: ResourceArn.");
168
- }
169
- resolvedPath = resolvedPath.replace("{ResourceArn}", __extendedEncodeURIComponent(labelValue));
170
- }
171
- else {
172
- throw new Error("No value provided for input HTTP label: ResourceArn.");
173
- }
137
+ resolvedPath = __resolvedPath(resolvedPath, input, "ResourceArn", function () { return input.ResourceArn; }, "{ResourceArn}", false);
174
138
  body = JSON.stringify(__assign({}, (input.Tags != null && { Tags: serializeAws_restJson1TagList(input.Tags, context) })));
175
139
  return [2, new __HttpRequest({
176
140
  protocol: protocol,
@@ -185,7 +149,7 @@ export var serializeAws_restJson1TagResourceCommand = function (input, context)
185
149
  });
186
150
  }); };
187
151
  export var serializeAws_restJson1UntagResourceCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
188
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, query, body;
152
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, query, body;
189
153
  return __generator(this, function (_c) {
190
154
  switch (_c.label) {
191
155
  case 0: return [4, context.endpoint()];
@@ -193,17 +157,10 @@ export var serializeAws_restJson1UntagResourceCommand = function (input, context
193
157
  _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
194
158
  headers = {};
195
159
  resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/tags/{ResourceArn}";
196
- if (input.ResourceArn !== undefined) {
197
- labelValue = input.ResourceArn;
198
- if (labelValue.length <= 0) {
199
- throw new Error("Empty value provided for input HTTP label: ResourceArn.");
200
- }
201
- resolvedPath = resolvedPath.replace("{ResourceArn}", __extendedEncodeURIComponent(labelValue));
202
- }
203
- else {
204
- throw new Error("No value provided for input HTTP label: ResourceArn.");
205
- }
206
- query = __assign({}, (input.TagKeys !== undefined && { tagKeys: (input.TagKeys || []).map(function (_entry) { return _entry; }) }));
160
+ resolvedPath = __resolvedPath(resolvedPath, input, "ResourceArn", function () { return input.ResourceArn; }, "{ResourceArn}", false);
161
+ query = map({
162
+ tagKeys: [function () { return input.TagKeys !== void 0; }, function () { return (input.TagKeys || []).map(function (_entry) { return _entry; }); }],
163
+ });
207
164
  return [2, new __HttpRequest({
208
165
  protocol: protocol,
209
166
  hostname: hostname,
@@ -218,7 +175,7 @@ export var serializeAws_restJson1UntagResourceCommand = function (input, context
218
175
  });
219
176
  }); };
220
177
  export var serializeAws_restJson1UpdateRuleCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
221
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, body;
178
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
222
179
  return __generator(this, function (_c) {
223
180
  switch (_c.label) {
224
181
  case 0: return [4, context.endpoint()];
@@ -228,16 +185,7 @@ export var serializeAws_restJson1UpdateRuleCommand = function (input, context) {
228
185
  "content-type": "application/json",
229
186
  };
230
187
  resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/rules/{Identifier}";
231
- if (input.Identifier !== undefined) {
232
- labelValue = input.Identifier;
233
- if (labelValue.length <= 0) {
234
- throw new Error("Empty value provided for input HTTP label: Identifier.");
235
- }
236
- resolvedPath = resolvedPath.replace("{Identifier}", __extendedEncodeURIComponent(labelValue));
237
- }
238
- else {
239
- throw new Error("No value provided for input HTTP label: Identifier.");
240
- }
188
+ resolvedPath = __resolvedPath(resolvedPath, input, "Identifier", function () { return input.Identifier; }, "{Identifier}", false);
241
189
  body = JSON.stringify(__assign(__assign(__assign(__assign({}, (input.Description != null && { Description: input.Description })), (input.ResourceTags != null && {
242
190
  ResourceTags: serializeAws_restJson1ResourceTags(input.ResourceTags, context),
243
191
  })), (input.ResourceType != null && { ResourceType: input.ResourceType })), (input.RetentionPeriod != null && {
@@ -263,48 +211,41 @@ export var deserializeAws_restJson1CreateRuleCommand = function (output, context
263
211
  if (output.statusCode !== 201 && output.statusCode >= 300) {
264
212
  return [2, deserializeAws_restJson1CreateRuleCommandError(output, context)];
265
213
  }
266
- contents = {
214
+ contents = map({
267
215
  $metadata: deserializeMetadata(output),
268
- Description: undefined,
269
- Identifier: undefined,
270
- ResourceTags: undefined,
271
- ResourceType: undefined,
272
- RetentionPeriod: undefined,
273
- Status: undefined,
274
- Tags: undefined,
275
- };
216
+ });
276
217
  _a = __expectNonNull;
277
218
  _b = __expectObject;
278
219
  return [4, parseBody(output.body, context)];
279
220
  case 1:
280
221
  data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
281
- if (data.Description !== undefined && data.Description !== null) {
222
+ if (data.Description != null) {
282
223
  contents.Description = __expectString(data.Description);
283
224
  }
284
- if (data.Identifier !== undefined && data.Identifier !== null) {
225
+ if (data.Identifier != null) {
285
226
  contents.Identifier = __expectString(data.Identifier);
286
227
  }
287
- if (data.ResourceTags !== undefined && data.ResourceTags !== null) {
228
+ if (data.ResourceTags != null) {
288
229
  contents.ResourceTags = deserializeAws_restJson1ResourceTags(data.ResourceTags, context);
289
230
  }
290
- if (data.ResourceType !== undefined && data.ResourceType !== null) {
231
+ if (data.ResourceType != null) {
291
232
  contents.ResourceType = __expectString(data.ResourceType);
292
233
  }
293
- if (data.RetentionPeriod !== undefined && data.RetentionPeriod !== null) {
234
+ if (data.RetentionPeriod != null) {
294
235
  contents.RetentionPeriod = deserializeAws_restJson1RetentionPeriod(data.RetentionPeriod, context);
295
236
  }
296
- if (data.Status !== undefined && data.Status !== null) {
237
+ if (data.Status != null) {
297
238
  contents.Status = __expectString(data.Status);
298
239
  }
299
- if (data.Tags !== undefined && data.Tags !== null) {
240
+ if (data.Tags != null) {
300
241
  contents.Tags = deserializeAws_restJson1TagList(data.Tags, context);
301
242
  }
302
- return [2, Promise.resolve(contents)];
243
+ return [2, contents];
303
244
  }
304
245
  });
305
246
  }); };
306
247
  var deserializeAws_restJson1CreateRuleCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
307
- var parsedOutput, _a, response, errorCode, _b, parsedBody, $metadata, statusCode;
248
+ var parsedOutput, _a, errorCode, _b, parsedBody;
308
249
  var _c;
309
250
  return __generator(this, function (_d) {
310
251
  switch (_d.label) {
@@ -333,14 +274,14 @@ var deserializeAws_restJson1CreateRuleCommandError = function (output, context)
333
274
  case 7: throw _d.sent();
334
275
  case 8:
335
276
  parsedBody = parsedOutput.body;
336
- $metadata = deserializeMetadata(output);
337
- statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
338
- response = new __BaseException({
339
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
340
- $fault: "client",
341
- $metadata: $metadata,
277
+ throwDefaultError({
278
+ output: output,
279
+ parsedBody: parsedBody,
280
+ exceptionCtor: __BaseException,
281
+ errorCode: errorCode,
342
282
  });
343
- throw __decorateServiceException(response, parsedBody);
283
+ _d.label = 9;
284
+ case 9: return [2];
344
285
  }
345
286
  });
346
287
  }); };
@@ -352,18 +293,18 @@ export var deserializeAws_restJson1DeleteRuleCommand = function (output, context
352
293
  if (output.statusCode !== 204 && output.statusCode >= 300) {
353
294
  return [2, deserializeAws_restJson1DeleteRuleCommandError(output, context)];
354
295
  }
355
- contents = {
296
+ contents = map({
356
297
  $metadata: deserializeMetadata(output),
357
- };
298
+ });
358
299
  return [4, collectBody(output.body, context)];
359
300
  case 1:
360
301
  _a.sent();
361
- return [2, Promise.resolve(contents)];
302
+ return [2, contents];
362
303
  }
363
304
  });
364
305
  }); };
365
306
  var deserializeAws_restJson1DeleteRuleCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
366
- var parsedOutput, _a, response, errorCode, _b, parsedBody, $metadata, statusCode;
307
+ var parsedOutput, _a, errorCode, _b, parsedBody;
367
308
  var _c;
368
309
  return __generator(this, function (_d) {
369
310
  switch (_d.label) {
@@ -392,14 +333,14 @@ var deserializeAws_restJson1DeleteRuleCommandError = function (output, context)
392
333
  case 7: throw _d.sent();
393
334
  case 8:
394
335
  parsedBody = parsedOutput.body;
395
- $metadata = deserializeMetadata(output);
396
- statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
397
- response = new __BaseException({
398
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
399
- $fault: "client",
400
- $metadata: $metadata,
336
+ throwDefaultError({
337
+ output: output,
338
+ parsedBody: parsedBody,
339
+ exceptionCtor: __BaseException,
340
+ errorCode: errorCode,
401
341
  });
402
- throw __decorateServiceException(response, parsedBody);
342
+ _d.label = 9;
343
+ case 9: return [2];
403
344
  }
404
345
  });
405
346
  }); };
@@ -411,44 +352,38 @@ export var deserializeAws_restJson1GetRuleCommand = function (output, context) {
411
352
  if (output.statusCode !== 200 && output.statusCode >= 300) {
412
353
  return [2, deserializeAws_restJson1GetRuleCommandError(output, context)];
413
354
  }
414
- contents = {
355
+ contents = map({
415
356
  $metadata: deserializeMetadata(output),
416
- Description: undefined,
417
- Identifier: undefined,
418
- ResourceTags: undefined,
419
- ResourceType: undefined,
420
- RetentionPeriod: undefined,
421
- Status: undefined,
422
- };
357
+ });
423
358
  _a = __expectNonNull;
424
359
  _b = __expectObject;
425
360
  return [4, parseBody(output.body, context)];
426
361
  case 1:
427
362
  data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
428
- if (data.Description !== undefined && data.Description !== null) {
363
+ if (data.Description != null) {
429
364
  contents.Description = __expectString(data.Description);
430
365
  }
431
- if (data.Identifier !== undefined && data.Identifier !== null) {
366
+ if (data.Identifier != null) {
432
367
  contents.Identifier = __expectString(data.Identifier);
433
368
  }
434
- if (data.ResourceTags !== undefined && data.ResourceTags !== null) {
369
+ if (data.ResourceTags != null) {
435
370
  contents.ResourceTags = deserializeAws_restJson1ResourceTags(data.ResourceTags, context);
436
371
  }
437
- if (data.ResourceType !== undefined && data.ResourceType !== null) {
372
+ if (data.ResourceType != null) {
438
373
  contents.ResourceType = __expectString(data.ResourceType);
439
374
  }
440
- if (data.RetentionPeriod !== undefined && data.RetentionPeriod !== null) {
375
+ if (data.RetentionPeriod != null) {
441
376
  contents.RetentionPeriod = deserializeAws_restJson1RetentionPeriod(data.RetentionPeriod, context);
442
377
  }
443
- if (data.Status !== undefined && data.Status !== null) {
378
+ if (data.Status != null) {
444
379
  contents.Status = __expectString(data.Status);
445
380
  }
446
- return [2, Promise.resolve(contents)];
381
+ return [2, contents];
447
382
  }
448
383
  });
449
384
  }); };
450
385
  var deserializeAws_restJson1GetRuleCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
451
- var parsedOutput, _a, response, errorCode, _b, parsedBody, $metadata, statusCode;
386
+ var parsedOutput, _a, errorCode, _b, parsedBody;
452
387
  var _c;
453
388
  return __generator(this, function (_d) {
454
389
  switch (_d.label) {
@@ -477,14 +412,14 @@ var deserializeAws_restJson1GetRuleCommandError = function (output, context) { r
477
412
  case 7: throw _d.sent();
478
413
  case 8:
479
414
  parsedBody = parsedOutput.body;
480
- $metadata = deserializeMetadata(output);
481
- statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
482
- response = new __BaseException({
483
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
484
- $fault: "client",
485
- $metadata: $metadata,
415
+ throwDefaultError({
416
+ output: output,
417
+ parsedBody: parsedBody,
418
+ exceptionCtor: __BaseException,
419
+ errorCode: errorCode,
486
420
  });
487
- throw __decorateServiceException(response, parsedBody);
421
+ _d.label = 9;
422
+ case 9: return [2];
488
423
  }
489
424
  });
490
425
  }); };
@@ -496,28 +431,26 @@ export var deserializeAws_restJson1ListRulesCommand = function (output, context)
496
431
  if (output.statusCode !== 200 && output.statusCode >= 300) {
497
432
  return [2, deserializeAws_restJson1ListRulesCommandError(output, context)];
498
433
  }
499
- contents = {
434
+ contents = map({
500
435
  $metadata: deserializeMetadata(output),
501
- NextToken: undefined,
502
- Rules: undefined,
503
- };
436
+ });
504
437
  _a = __expectNonNull;
505
438
  _b = __expectObject;
506
439
  return [4, parseBody(output.body, context)];
507
440
  case 1:
508
441
  data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
509
- if (data.NextToken !== undefined && data.NextToken !== null) {
442
+ if (data.NextToken != null) {
510
443
  contents.NextToken = __expectString(data.NextToken);
511
444
  }
512
- if (data.Rules !== undefined && data.Rules !== null) {
445
+ if (data.Rules != null) {
513
446
  contents.Rules = deserializeAws_restJson1RuleSummaryList(data.Rules, context);
514
447
  }
515
- return [2, Promise.resolve(contents)];
448
+ return [2, contents];
516
449
  }
517
450
  });
518
451
  }); };
519
452
  var deserializeAws_restJson1ListRulesCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
520
- var parsedOutput, _a, response, errorCode, _b, parsedBody, $metadata, statusCode;
453
+ var parsedOutput, _a, errorCode, _b, parsedBody;
521
454
  var _c;
522
455
  return __generator(this, function (_d) {
523
456
  switch (_d.label) {
@@ -542,14 +475,14 @@ var deserializeAws_restJson1ListRulesCommandError = function (output, context) {
542
475
  case 5: throw _d.sent();
543
476
  case 6:
544
477
  parsedBody = parsedOutput.body;
545
- $metadata = deserializeMetadata(output);
546
- statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
547
- response = new __BaseException({
548
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
549
- $fault: "client",
550
- $metadata: $metadata,
478
+ throwDefaultError({
479
+ output: output,
480
+ parsedBody: parsedBody,
481
+ exceptionCtor: __BaseException,
482
+ errorCode: errorCode,
551
483
  });
552
- throw __decorateServiceException(response, parsedBody);
484
+ _d.label = 7;
485
+ case 7: return [2];
553
486
  }
554
487
  });
555
488
  }); };
@@ -561,24 +494,23 @@ export var deserializeAws_restJson1ListTagsForResourceCommand = function (output
561
494
  if (output.statusCode !== 200 && output.statusCode >= 300) {
562
495
  return [2, deserializeAws_restJson1ListTagsForResourceCommandError(output, context)];
563
496
  }
564
- contents = {
497
+ contents = map({
565
498
  $metadata: deserializeMetadata(output),
566
- Tags: undefined,
567
- };
499
+ });
568
500
  _a = __expectNonNull;
569
501
  _b = __expectObject;
570
502
  return [4, parseBody(output.body, context)];
571
503
  case 1:
572
504
  data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
573
- if (data.Tags !== undefined && data.Tags !== null) {
505
+ if (data.Tags != null) {
574
506
  contents.Tags = deserializeAws_restJson1TagList(data.Tags, context);
575
507
  }
576
- return [2, Promise.resolve(contents)];
508
+ return [2, contents];
577
509
  }
578
510
  });
579
511
  }); };
580
512
  var deserializeAws_restJson1ListTagsForResourceCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
581
- var parsedOutput, _a, response, errorCode, _b, parsedBody, $metadata, statusCode;
513
+ var parsedOutput, _a, errorCode, _b, parsedBody;
582
514
  var _c;
583
515
  return __generator(this, function (_d) {
584
516
  switch (_d.label) {
@@ -607,14 +539,14 @@ var deserializeAws_restJson1ListTagsForResourceCommandError = function (output,
607
539
  case 7: throw _d.sent();
608
540
  case 8:
609
541
  parsedBody = parsedOutput.body;
610
- $metadata = deserializeMetadata(output);
611
- statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
612
- response = new __BaseException({
613
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
614
- $fault: "client",
615
- $metadata: $metadata,
542
+ throwDefaultError({
543
+ output: output,
544
+ parsedBody: parsedBody,
545
+ exceptionCtor: __BaseException,
546
+ errorCode: errorCode,
616
547
  });
617
- throw __decorateServiceException(response, parsedBody);
548
+ _d.label = 9;
549
+ case 9: return [2];
618
550
  }
619
551
  });
620
552
  }); };
@@ -626,18 +558,18 @@ export var deserializeAws_restJson1TagResourceCommand = function (output, contex
626
558
  if (output.statusCode !== 201 && output.statusCode >= 300) {
627
559
  return [2, deserializeAws_restJson1TagResourceCommandError(output, context)];
628
560
  }
629
- contents = {
561
+ contents = map({
630
562
  $metadata: deserializeMetadata(output),
631
- };
563
+ });
632
564
  return [4, collectBody(output.body, context)];
633
565
  case 1:
634
566
  _a.sent();
635
- return [2, Promise.resolve(contents)];
567
+ return [2, contents];
636
568
  }
637
569
  });
638
570
  }); };
639
571
  var deserializeAws_restJson1TagResourceCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
640
- var parsedOutput, _a, response, errorCode, _b, parsedBody, $metadata, statusCode;
572
+ var parsedOutput, _a, errorCode, _b, parsedBody;
641
573
  var _c;
642
574
  return __generator(this, function (_d) {
643
575
  switch (_d.label) {
@@ -670,14 +602,14 @@ var deserializeAws_restJson1TagResourceCommandError = function (output, context)
670
602
  case 9: throw _d.sent();
671
603
  case 10:
672
604
  parsedBody = parsedOutput.body;
673
- $metadata = deserializeMetadata(output);
674
- statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
675
- response = new __BaseException({
676
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
677
- $fault: "client",
678
- $metadata: $metadata,
605
+ throwDefaultError({
606
+ output: output,
607
+ parsedBody: parsedBody,
608
+ exceptionCtor: __BaseException,
609
+ errorCode: errorCode,
679
610
  });
680
- throw __decorateServiceException(response, parsedBody);
611
+ _d.label = 11;
612
+ case 11: return [2];
681
613
  }
682
614
  });
683
615
  }); };
@@ -689,18 +621,18 @@ export var deserializeAws_restJson1UntagResourceCommand = function (output, cont
689
621
  if (output.statusCode !== 204 && output.statusCode >= 300) {
690
622
  return [2, deserializeAws_restJson1UntagResourceCommandError(output, context)];
691
623
  }
692
- contents = {
624
+ contents = map({
693
625
  $metadata: deserializeMetadata(output),
694
- };
626
+ });
695
627
  return [4, collectBody(output.body, context)];
696
628
  case 1:
697
629
  _a.sent();
698
- return [2, Promise.resolve(contents)];
630
+ return [2, contents];
699
631
  }
700
632
  });
701
633
  }); };
702
634
  var deserializeAws_restJson1UntagResourceCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
703
- var parsedOutput, _a, response, errorCode, _b, parsedBody, $metadata, statusCode;
635
+ var parsedOutput, _a, errorCode, _b, parsedBody;
704
636
  var _c;
705
637
  return __generator(this, function (_d) {
706
638
  switch (_d.label) {
@@ -729,14 +661,14 @@ var deserializeAws_restJson1UntagResourceCommandError = function (output, contex
729
661
  case 7: throw _d.sent();
730
662
  case 8:
731
663
  parsedBody = parsedOutput.body;
732
- $metadata = deserializeMetadata(output);
733
- statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
734
- response = new __BaseException({
735
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
736
- $fault: "client",
737
- $metadata: $metadata,
664
+ throwDefaultError({
665
+ output: output,
666
+ parsedBody: parsedBody,
667
+ exceptionCtor: __BaseException,
668
+ errorCode: errorCode,
738
669
  });
739
- throw __decorateServiceException(response, parsedBody);
670
+ _d.label = 9;
671
+ case 9: return [2];
740
672
  }
741
673
  });
742
674
  }); };
@@ -748,44 +680,38 @@ export var deserializeAws_restJson1UpdateRuleCommand = function (output, context
748
680
  if (output.statusCode !== 200 && output.statusCode >= 300) {
749
681
  return [2, deserializeAws_restJson1UpdateRuleCommandError(output, context)];
750
682
  }
751
- contents = {
683
+ contents = map({
752
684
  $metadata: deserializeMetadata(output),
753
- Description: undefined,
754
- Identifier: undefined,
755
- ResourceTags: undefined,
756
- ResourceType: undefined,
757
- RetentionPeriod: undefined,
758
- Status: undefined,
759
- };
685
+ });
760
686
  _a = __expectNonNull;
761
687
  _b = __expectObject;
762
688
  return [4, parseBody(output.body, context)];
763
689
  case 1:
764
690
  data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
765
- if (data.Description !== undefined && data.Description !== null) {
691
+ if (data.Description != null) {
766
692
  contents.Description = __expectString(data.Description);
767
693
  }
768
- if (data.Identifier !== undefined && data.Identifier !== null) {
694
+ if (data.Identifier != null) {
769
695
  contents.Identifier = __expectString(data.Identifier);
770
696
  }
771
- if (data.ResourceTags !== undefined && data.ResourceTags !== null) {
697
+ if (data.ResourceTags != null) {
772
698
  contents.ResourceTags = deserializeAws_restJson1ResourceTags(data.ResourceTags, context);
773
699
  }
774
- if (data.ResourceType !== undefined && data.ResourceType !== null) {
700
+ if (data.ResourceType != null) {
775
701
  contents.ResourceType = __expectString(data.ResourceType);
776
702
  }
777
- if (data.RetentionPeriod !== undefined && data.RetentionPeriod !== null) {
703
+ if (data.RetentionPeriod != null) {
778
704
  contents.RetentionPeriod = deserializeAws_restJson1RetentionPeriod(data.RetentionPeriod, context);
779
705
  }
780
- if (data.Status !== undefined && data.Status !== null) {
706
+ if (data.Status != null) {
781
707
  contents.Status = __expectString(data.Status);
782
708
  }
783
- return [2, Promise.resolve(contents)];
709
+ return [2, contents];
784
710
  }
785
711
  });
786
712
  }); };
787
713
  var deserializeAws_restJson1UpdateRuleCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
788
- var parsedOutput, _a, response, errorCode, _b, parsedBody, $metadata, statusCode;
714
+ var parsedOutput, _a, errorCode, _b, parsedBody;
789
715
  var _c;
790
716
  return __generator(this, function (_d) {
791
717
  switch (_d.label) {
@@ -814,23 +740,24 @@ var deserializeAws_restJson1UpdateRuleCommandError = function (output, context)
814
740
  case 7: throw _d.sent();
815
741
  case 8:
816
742
  parsedBody = parsedOutput.body;
817
- $metadata = deserializeMetadata(output);
818
- statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
819
- response = new __BaseException({
820
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
821
- $fault: "client",
822
- $metadata: $metadata,
743
+ throwDefaultError({
744
+ output: output,
745
+ parsedBody: parsedBody,
746
+ exceptionCtor: __BaseException,
747
+ errorCode: errorCode,
823
748
  });
824
- throw __decorateServiceException(response, parsedBody);
749
+ _d.label = 9;
750
+ case 9: return [2];
825
751
  }
826
752
  });
827
753
  }); };
754
+ var map = __map;
828
755
  var deserializeAws_restJson1InternalServerExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
829
756
  var contents, data, exception;
830
757
  return __generator(this, function (_a) {
831
- contents = {};
758
+ contents = map({});
832
759
  data = parsedOutput.body;
833
- if (data.Message !== undefined && data.Message !== null) {
760
+ if (data.Message != null) {
834
761
  contents.Message = __expectString(data.Message);
835
762
  }
836
763
  exception = new InternalServerException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
@@ -840,12 +767,12 @@ var deserializeAws_restJson1InternalServerExceptionResponse = function (parsedOu
840
767
  var deserializeAws_restJson1ResourceNotFoundExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
841
768
  var contents, data, exception;
842
769
  return __generator(this, function (_a) {
843
- contents = {};
770
+ contents = map({});
844
771
  data = parsedOutput.body;
845
- if (data.Message !== undefined && data.Message !== null) {
772
+ if (data.Message != null) {
846
773
  contents.Message = __expectString(data.Message);
847
774
  }
848
- if (data.Reason !== undefined && data.Reason !== null) {
775
+ if (data.Reason != null) {
849
776
  contents.Reason = __expectString(data.Reason);
850
777
  }
851
778
  exception = new ResourceNotFoundException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
@@ -855,12 +782,12 @@ var deserializeAws_restJson1ResourceNotFoundExceptionResponse = function (parsed
855
782
  var deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
856
783
  var contents, data, exception;
857
784
  return __generator(this, function (_a) {
858
- contents = {};
785
+ contents = map({});
859
786
  data = parsedOutput.body;
860
- if (data.Message !== undefined && data.Message !== null) {
787
+ if (data.Message != null) {
861
788
  contents.Message = __expectString(data.Message);
862
789
  }
863
- if (data.Reason !== undefined && data.Reason !== null) {
790
+ if (data.Reason != null) {
864
791
  contents.Reason = __expectString(data.Reason);
865
792
  }
866
793
  exception = new ServiceQuotaExceededException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
@@ -870,12 +797,12 @@ var deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = function (pa
870
797
  var deserializeAws_restJson1ValidationExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
871
798
  var contents, data, exception;
872
799
  return __generator(this, function (_a) {
873
- contents = {};
800
+ contents = map({});
874
801
  data = parsedOutput.body;
875
- if (data.Message !== undefined && data.Message !== null) {
802
+ if (data.Message != null) {
876
803
  contents.Message = __expectString(data.Message);
877
804
  }
878
- if (data.Reason !== undefined && data.Reason !== null) {
805
+ if (data.Reason != null) {
879
806
  contents.Reason = __expectString(data.Reason);
880
807
  }
881
808
  exception = new ValidationException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
@@ -889,9 +816,6 @@ var serializeAws_restJson1ResourceTags = function (input, context) {
889
816
  return input
890
817
  .filter(function (e) { return e != null; })
891
818
  .map(function (entry) {
892
- if (entry === null) {
893
- return null;
894
- }
895
819
  return serializeAws_restJson1ResourceTag(entry, context);
896
820
  });
897
821
  };
@@ -905,9 +829,6 @@ var serializeAws_restJson1TagList = function (input, context) {
905
829
  return input
906
830
  .filter(function (e) { return e != null; })
907
831
  .map(function (entry) {
908
- if (entry === null) {
909
- return null;
910
- }
911
832
  return serializeAws_restJson1Tag(entry, context);
912
833
  });
913
834
  };