@aws-sdk/client-accessanalyzer 3.131.0 → 3.142.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/README.md +1 -1
  3. package/dist-cjs/commands/ApplyArchiveRuleCommand.js +1 -1
  4. package/dist-cjs/commands/CancelPolicyGenerationCommand.js +2 -2
  5. package/dist-cjs/commands/CreateAccessPreviewCommand.js +2 -2
  6. package/dist-cjs/commands/CreateAnalyzerCommand.js +2 -2
  7. package/dist-cjs/commands/CreateArchiveRuleCommand.js +1 -1
  8. package/dist-cjs/commands/DeleteAnalyzerCommand.js +1 -1
  9. package/dist-cjs/commands/DeleteArchiveRuleCommand.js +1 -1
  10. package/dist-cjs/commands/GetAccessPreviewCommand.js +2 -2
  11. package/dist-cjs/commands/GetAnalyzedResourceCommand.js +2 -2
  12. package/dist-cjs/commands/GetAnalyzerCommand.js +2 -2
  13. package/dist-cjs/commands/GetArchiveRuleCommand.js +2 -2
  14. package/dist-cjs/commands/GetFindingCommand.js +2 -2
  15. package/dist-cjs/commands/GetGeneratedPolicyCommand.js +2 -2
  16. package/dist-cjs/commands/ListAccessPreviewFindingsCommand.js +2 -2
  17. package/dist-cjs/commands/ListAccessPreviewsCommand.js +2 -2
  18. package/dist-cjs/commands/ListAnalyzedResourcesCommand.js +2 -2
  19. package/dist-cjs/commands/ListAnalyzersCommand.js +2 -2
  20. package/dist-cjs/commands/ListArchiveRulesCommand.js +2 -2
  21. package/dist-cjs/commands/ListFindingsCommand.js +2 -2
  22. package/dist-cjs/commands/ListPolicyGenerationsCommand.js +2 -2
  23. package/dist-cjs/commands/ListTagsForResourceCommand.js +2 -2
  24. package/dist-cjs/commands/StartPolicyGenerationCommand.js +2 -2
  25. package/dist-cjs/commands/StartResourceScanCommand.js +1 -1
  26. package/dist-cjs/commands/TagResourceCommand.js +2 -2
  27. package/dist-cjs/commands/UntagResourceCommand.js +2 -2
  28. package/dist-cjs/commands/UpdateArchiveRuleCommand.js +1 -1
  29. package/dist-cjs/commands/UpdateFindingsCommand.js +1 -1
  30. package/dist-cjs/commands/ValidatePolicyCommand.js +2 -2
  31. package/dist-cjs/models/models_0.js +451 -635
  32. package/dist-cjs/protocols/Aws_restJson1.js +362 -652
  33. package/dist-es/commands/ApplyArchiveRuleCommand.js +2 -2
  34. package/dist-es/commands/CancelPolicyGenerationCommand.js +3 -3
  35. package/dist-es/commands/CreateAccessPreviewCommand.js +3 -3
  36. package/dist-es/commands/CreateAnalyzerCommand.js +3 -3
  37. package/dist-es/commands/CreateArchiveRuleCommand.js +2 -2
  38. package/dist-es/commands/DeleteAnalyzerCommand.js +2 -2
  39. package/dist-es/commands/DeleteArchiveRuleCommand.js +2 -2
  40. package/dist-es/commands/GetAccessPreviewCommand.js +3 -3
  41. package/dist-es/commands/GetAnalyzedResourceCommand.js +3 -3
  42. package/dist-es/commands/GetAnalyzerCommand.js +3 -3
  43. package/dist-es/commands/GetArchiveRuleCommand.js +3 -3
  44. package/dist-es/commands/GetFindingCommand.js +3 -3
  45. package/dist-es/commands/GetGeneratedPolicyCommand.js +3 -3
  46. package/dist-es/commands/ListAccessPreviewFindingsCommand.js +3 -3
  47. package/dist-es/commands/ListAccessPreviewsCommand.js +3 -3
  48. package/dist-es/commands/ListAnalyzedResourcesCommand.js +3 -3
  49. package/dist-es/commands/ListAnalyzersCommand.js +3 -3
  50. package/dist-es/commands/ListArchiveRulesCommand.js +3 -3
  51. package/dist-es/commands/ListFindingsCommand.js +3 -3
  52. package/dist-es/commands/ListPolicyGenerationsCommand.js +3 -3
  53. package/dist-es/commands/ListTagsForResourceCommand.js +3 -3
  54. package/dist-es/commands/StartPolicyGenerationCommand.js +3 -3
  55. package/dist-es/commands/StartResourceScanCommand.js +2 -2
  56. package/dist-es/commands/TagResourceCommand.js +3 -3
  57. package/dist-es/commands/UntagResourceCommand.js +3 -3
  58. package/dist-es/commands/UpdateArchiveRuleCommand.js +2 -2
  59. package/dist-es/commands/UpdateFindingsCommand.js +2 -2
  60. package/dist-es/commands/ValidatePolicyCommand.js +3 -3
  61. package/dist-es/models/models_0.js +160 -442
  62. package/dist-es/protocols/Aws_restJson1.js +462 -634
  63. package/dist-types/models/models_0.d.ts +392 -580
  64. package/dist-types/ts3.4/models/models_0.d.ts +196 -384
  65. package/package.json +6 -6
@@ -35,16 +35,7 @@ const serializeAws_restJson1CancelPolicyGenerationCommand = async (input, contex
35
35
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
36
36
  const headers = {};
37
37
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/policy/generation/{jobId}";
38
- if (input.jobId !== undefined) {
39
- const labelValue = input.jobId;
40
- if (labelValue.length <= 0) {
41
- throw new Error("Empty value provided for input HTTP label: jobId.");
42
- }
43
- resolvedPath = resolvedPath.replace("{jobId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
44
- }
45
- else {
46
- throw new Error("No value provided for input HTTP label: jobId.");
47
- }
38
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "jobId", () => input.jobId, "{jobId}", false);
48
39
  let body;
49
40
  return new protocol_http_1.HttpRequest({
50
41
  protocol,
@@ -118,16 +109,7 @@ const serializeAws_restJson1CreateArchiveRuleCommand = async (input, context) =>
118
109
  "content-type": "application/json",
119
110
  };
120
111
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/analyzer/{analyzerName}/archive-rule";
121
- if (input.analyzerName !== undefined) {
122
- const labelValue = input.analyzerName;
123
- if (labelValue.length <= 0) {
124
- throw new Error("Empty value provided for input HTTP label: analyzerName.");
125
- }
126
- resolvedPath = resolvedPath.replace("{analyzerName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
127
- }
128
- else {
129
- throw new Error("No value provided for input HTTP label: analyzerName.");
130
- }
112
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "analyzerName", () => input.analyzerName, "{analyzerName}", false);
131
113
  let body;
132
114
  body = JSON.stringify({
133
115
  clientToken: (_a = input.clientToken) !== null && _a !== void 0 ? _a : (0, uuid_1.v4)(),
@@ -149,19 +131,10 @@ const serializeAws_restJson1DeleteAnalyzerCommand = async (input, context) => {
149
131
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
150
132
  const headers = {};
151
133
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/analyzer/{analyzerName}";
152
- if (input.analyzerName !== undefined) {
153
- const labelValue = input.analyzerName;
154
- if (labelValue.length <= 0) {
155
- throw new Error("Empty value provided for input HTTP label: analyzerName.");
156
- }
157
- resolvedPath = resolvedPath.replace("{analyzerName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
158
- }
159
- else {
160
- throw new Error("No value provided for input HTTP label: analyzerName.");
161
- }
162
- const query = {
163
- ...(input.clientToken !== undefined && { clientToken: input.clientToken }),
164
- };
134
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "analyzerName", () => input.analyzerName, "{analyzerName}", false);
135
+ const query = map({
136
+ clientToken: [, input.clientToken],
137
+ });
165
138
  let body;
166
139
  return new protocol_http_1.HttpRequest({
167
140
  protocol,
@@ -180,29 +153,11 @@ const serializeAws_restJson1DeleteArchiveRuleCommand = async (input, context) =>
180
153
  const headers = {};
181
154
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
182
155
  "/analyzer/{analyzerName}/archive-rule/{ruleName}";
183
- if (input.analyzerName !== undefined) {
184
- const labelValue = input.analyzerName;
185
- if (labelValue.length <= 0) {
186
- throw new Error("Empty value provided for input HTTP label: analyzerName.");
187
- }
188
- resolvedPath = resolvedPath.replace("{analyzerName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
189
- }
190
- else {
191
- throw new Error("No value provided for input HTTP label: analyzerName.");
192
- }
193
- if (input.ruleName !== undefined) {
194
- const labelValue = input.ruleName;
195
- if (labelValue.length <= 0) {
196
- throw new Error("Empty value provided for input HTTP label: ruleName.");
197
- }
198
- resolvedPath = resolvedPath.replace("{ruleName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
199
- }
200
- else {
201
- throw new Error("No value provided for input HTTP label: ruleName.");
202
- }
203
- const query = {
204
- ...(input.clientToken !== undefined && { clientToken: input.clientToken }),
205
- };
156
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "analyzerName", () => input.analyzerName, "{analyzerName}", false);
157
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ruleName", () => input.ruleName, "{ruleName}", false);
158
+ const query = map({
159
+ clientToken: [, input.clientToken],
160
+ });
206
161
  let body;
207
162
  return new protocol_http_1.HttpRequest({
208
163
  protocol,
@@ -220,19 +175,10 @@ const serializeAws_restJson1GetAccessPreviewCommand = async (input, context) =>
220
175
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
221
176
  const headers = {};
222
177
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/access-preview/{accessPreviewId}";
223
- if (input.accessPreviewId !== undefined) {
224
- const labelValue = input.accessPreviewId;
225
- if (labelValue.length <= 0) {
226
- throw new Error("Empty value provided for input HTTP label: accessPreviewId.");
227
- }
228
- resolvedPath = resolvedPath.replace("{accessPreviewId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
229
- }
230
- else {
231
- throw new Error("No value provided for input HTTP label: accessPreviewId.");
232
- }
233
- const query = {
234
- ...(input.analyzerArn !== undefined && { analyzerArn: input.analyzerArn }),
235
- };
178
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "accessPreviewId", () => input.accessPreviewId, "{accessPreviewId}", false);
179
+ const query = map({
180
+ analyzerArn: [, input.analyzerArn],
181
+ });
236
182
  let body;
237
183
  return new protocol_http_1.HttpRequest({
238
184
  protocol,
@@ -250,10 +196,10 @@ const serializeAws_restJson1GetAnalyzedResourceCommand = async (input, context)
250
196
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
251
197
  const headers = {};
252
198
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/analyzed-resource";
253
- const query = {
254
- ...(input.analyzerArn !== undefined && { analyzerArn: input.analyzerArn }),
255
- ...(input.resourceArn !== undefined && { resourceArn: input.resourceArn }),
256
- };
199
+ const query = map({
200
+ analyzerArn: [, input.analyzerArn],
201
+ resourceArn: [, input.resourceArn],
202
+ });
257
203
  let body;
258
204
  return new protocol_http_1.HttpRequest({
259
205
  protocol,
@@ -271,16 +217,7 @@ const serializeAws_restJson1GetAnalyzerCommand = async (input, context) => {
271
217
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
272
218
  const headers = {};
273
219
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/analyzer/{analyzerName}";
274
- if (input.analyzerName !== undefined) {
275
- const labelValue = input.analyzerName;
276
- if (labelValue.length <= 0) {
277
- throw new Error("Empty value provided for input HTTP label: analyzerName.");
278
- }
279
- resolvedPath = resolvedPath.replace("{analyzerName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
280
- }
281
- else {
282
- throw new Error("No value provided for input HTTP label: analyzerName.");
283
- }
220
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "analyzerName", () => input.analyzerName, "{analyzerName}", false);
284
221
  let body;
285
222
  return new protocol_http_1.HttpRequest({
286
223
  protocol,
@@ -298,26 +235,8 @@ const serializeAws_restJson1GetArchiveRuleCommand = async (input, context) => {
298
235
  const headers = {};
299
236
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
300
237
  "/analyzer/{analyzerName}/archive-rule/{ruleName}";
301
- if (input.analyzerName !== undefined) {
302
- const labelValue = input.analyzerName;
303
- if (labelValue.length <= 0) {
304
- throw new Error("Empty value provided for input HTTP label: analyzerName.");
305
- }
306
- resolvedPath = resolvedPath.replace("{analyzerName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
307
- }
308
- else {
309
- throw new Error("No value provided for input HTTP label: analyzerName.");
310
- }
311
- if (input.ruleName !== undefined) {
312
- const labelValue = input.ruleName;
313
- if (labelValue.length <= 0) {
314
- throw new Error("Empty value provided for input HTTP label: ruleName.");
315
- }
316
- resolvedPath = resolvedPath.replace("{ruleName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
317
- }
318
- else {
319
- throw new Error("No value provided for input HTTP label: ruleName.");
320
- }
238
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "analyzerName", () => input.analyzerName, "{analyzerName}", false);
239
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ruleName", () => input.ruleName, "{ruleName}", false);
321
240
  let body;
322
241
  return new protocol_http_1.HttpRequest({
323
242
  protocol,
@@ -334,19 +253,10 @@ const serializeAws_restJson1GetFindingCommand = async (input, context) => {
334
253
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
335
254
  const headers = {};
336
255
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/finding/{id}";
337
- if (input.id !== undefined) {
338
- const labelValue = input.id;
339
- if (labelValue.length <= 0) {
340
- throw new Error("Empty value provided for input HTTP label: id.");
341
- }
342
- resolvedPath = resolvedPath.replace("{id}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
343
- }
344
- else {
345
- throw new Error("No value provided for input HTTP label: id.");
346
- }
347
- const query = {
348
- ...(input.analyzerArn !== undefined && { analyzerArn: input.analyzerArn }),
349
- };
256
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "id", () => input.id, "{id}", false);
257
+ const query = map({
258
+ analyzerArn: [, input.analyzerArn],
259
+ });
350
260
  let body;
351
261
  return new protocol_http_1.HttpRequest({
352
262
  protocol,
@@ -364,24 +274,17 @@ const serializeAws_restJson1GetGeneratedPolicyCommand = async (input, context) =
364
274
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
365
275
  const headers = {};
366
276
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/policy/generation/{jobId}";
367
- if (input.jobId !== undefined) {
368
- const labelValue = input.jobId;
369
- if (labelValue.length <= 0) {
370
- throw new Error("Empty value provided for input HTTP label: jobId.");
371
- }
372
- resolvedPath = resolvedPath.replace("{jobId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
373
- }
374
- else {
375
- throw new Error("No value provided for input HTTP label: jobId.");
376
- }
377
- const query = {
378
- ...(input.includeResourcePlaceholders !== undefined && {
379
- includeResourcePlaceholders: input.includeResourcePlaceholders.toString(),
380
- }),
381
- ...(input.includeServiceLevelTemplate !== undefined && {
382
- includeServiceLevelTemplate: input.includeServiceLevelTemplate.toString(),
383
- }),
384
- };
277
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "jobId", () => input.jobId, "{jobId}", false);
278
+ const query = map({
279
+ includeResourcePlaceholders: [
280
+ () => input.includeResourcePlaceholders !== void 0,
281
+ () => input.includeResourcePlaceholders.toString(),
282
+ ],
283
+ includeServiceLevelTemplate: [
284
+ () => input.includeServiceLevelTemplate !== void 0,
285
+ () => input.includeServiceLevelTemplate.toString(),
286
+ ],
287
+ });
385
288
  let body;
386
289
  return new protocol_http_1.HttpRequest({
387
290
  protocol,
@@ -401,16 +304,7 @@ const serializeAws_restJson1ListAccessPreviewFindingsCommand = async (input, con
401
304
  "content-type": "application/json",
402
305
  };
403
306
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/access-preview/{accessPreviewId}";
404
- if (input.accessPreviewId !== undefined) {
405
- const labelValue = input.accessPreviewId;
406
- if (labelValue.length <= 0) {
407
- throw new Error("Empty value provided for input HTTP label: accessPreviewId.");
408
- }
409
- resolvedPath = resolvedPath.replace("{accessPreviewId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
410
- }
411
- else {
412
- throw new Error("No value provided for input HTTP label: accessPreviewId.");
413
- }
307
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "accessPreviewId", () => input.accessPreviewId, "{accessPreviewId}", false);
414
308
  let body;
415
309
  body = JSON.stringify({
416
310
  ...(input.analyzerArn != null && { analyzerArn: input.analyzerArn }),
@@ -433,11 +327,11 @@ const serializeAws_restJson1ListAccessPreviewsCommand = async (input, context) =
433
327
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
434
328
  const headers = {};
435
329
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/access-preview";
436
- const query = {
437
- ...(input.analyzerArn !== undefined && { analyzerArn: input.analyzerArn }),
438
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
439
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
440
- };
330
+ const query = map({
331
+ analyzerArn: [, input.analyzerArn],
332
+ nextToken: [, input.nextToken],
333
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
334
+ });
441
335
  let body;
442
336
  return new protocol_http_1.HttpRequest({
443
337
  protocol,
@@ -479,11 +373,11 @@ const serializeAws_restJson1ListAnalyzersCommand = async (input, context) => {
479
373
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
480
374
  const headers = {};
481
375
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/analyzer";
482
- const query = {
483
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
484
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
485
- ...(input.type !== undefined && { type: input.type }),
486
- };
376
+ const query = map({
377
+ nextToken: [, input.nextToken],
378
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
379
+ type: [, input.type],
380
+ });
487
381
  let body;
488
382
  return new protocol_http_1.HttpRequest({
489
383
  protocol,
@@ -501,20 +395,11 @@ const serializeAws_restJson1ListArchiveRulesCommand = async (input, context) =>
501
395
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
502
396
  const headers = {};
503
397
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/analyzer/{analyzerName}/archive-rule";
504
- if (input.analyzerName !== undefined) {
505
- const labelValue = input.analyzerName;
506
- if (labelValue.length <= 0) {
507
- throw new Error("Empty value provided for input HTTP label: analyzerName.");
508
- }
509
- resolvedPath = resolvedPath.replace("{analyzerName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
510
- }
511
- else {
512
- throw new Error("No value provided for input HTTP label: analyzerName.");
513
- }
514
- const query = {
515
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
516
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
517
- };
398
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "analyzerName", () => input.analyzerName, "{analyzerName}", false);
399
+ const query = map({
400
+ nextToken: [, input.nextToken],
401
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
402
+ });
518
403
  let body;
519
404
  return new protocol_http_1.HttpRequest({
520
405
  protocol,
@@ -557,11 +442,11 @@ const serializeAws_restJson1ListPolicyGenerationsCommand = async (input, context
557
442
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
558
443
  const headers = {};
559
444
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/policy/generation";
560
- const query = {
561
- ...(input.principalArn !== undefined && { principalArn: input.principalArn }),
562
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
563
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
564
- };
445
+ const query = map({
446
+ principalArn: [, input.principalArn],
447
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
448
+ nextToken: [, input.nextToken],
449
+ });
565
450
  let body;
566
451
  return new protocol_http_1.HttpRequest({
567
452
  protocol,
@@ -579,16 +464,7 @@ const serializeAws_restJson1ListTagsForResourceCommand = async (input, context)
579
464
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
580
465
  const headers = {};
581
466
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
582
- if (input.resourceArn !== undefined) {
583
- const labelValue = input.resourceArn;
584
- if (labelValue.length <= 0) {
585
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
586
- }
587
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
588
- }
589
- else {
590
- throw new Error("No value provided for input HTTP label: resourceArn.");
591
- }
467
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
592
468
  let body;
593
469
  return new protocol_http_1.HttpRequest({
594
470
  protocol,
@@ -657,16 +533,7 @@ const serializeAws_restJson1TagResourceCommand = async (input, context) => {
657
533
  "content-type": "application/json",
658
534
  };
659
535
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
660
- if (input.resourceArn !== undefined) {
661
- const labelValue = input.resourceArn;
662
- if (labelValue.length <= 0) {
663
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
664
- }
665
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
666
- }
667
- else {
668
- throw new Error("No value provided for input HTTP label: resourceArn.");
669
- }
536
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
670
537
  let body;
671
538
  body = JSON.stringify({
672
539
  ...(input.tags != null && { tags: serializeAws_restJson1TagsMap(input.tags, context) }),
@@ -686,19 +553,10 @@ const serializeAws_restJson1UntagResourceCommand = async (input, context) => {
686
553
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
687
554
  const headers = {};
688
555
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
689
- if (input.resourceArn !== undefined) {
690
- const labelValue = input.resourceArn;
691
- if (labelValue.length <= 0) {
692
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
693
- }
694
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
695
- }
696
- else {
697
- throw new Error("No value provided for input HTTP label: resourceArn.");
698
- }
699
- const query = {
700
- ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry) }),
701
- };
556
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
557
+ const query = map({
558
+ tagKeys: [() => input.tagKeys !== void 0, () => (input.tagKeys || []).map((_entry) => _entry)],
559
+ });
702
560
  let body;
703
561
  return new protocol_http_1.HttpRequest({
704
562
  protocol,
@@ -720,26 +578,8 @@ const serializeAws_restJson1UpdateArchiveRuleCommand = async (input, context) =>
720
578
  };
721
579
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
722
580
  "/analyzer/{analyzerName}/archive-rule/{ruleName}";
723
- if (input.analyzerName !== undefined) {
724
- const labelValue = input.analyzerName;
725
- if (labelValue.length <= 0) {
726
- throw new Error("Empty value provided for input HTTP label: analyzerName.");
727
- }
728
- resolvedPath = resolvedPath.replace("{analyzerName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
729
- }
730
- else {
731
- throw new Error("No value provided for input HTTP label: analyzerName.");
732
- }
733
- if (input.ruleName !== undefined) {
734
- const labelValue = input.ruleName;
735
- if (labelValue.length <= 0) {
736
- throw new Error("Empty value provided for input HTTP label: ruleName.");
737
- }
738
- resolvedPath = resolvedPath.replace("{ruleName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
739
- }
740
- else {
741
- throw new Error("No value provided for input HTTP label: ruleName.");
742
- }
581
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "analyzerName", () => input.analyzerName, "{analyzerName}", false);
582
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ruleName", () => input.ruleName, "{ruleName}", false);
743
583
  let body;
744
584
  body = JSON.stringify({
745
585
  clientToken: (_a = input.clientToken) !== null && _a !== void 0 ? _a : (0, uuid_1.v4)(),
@@ -788,10 +628,10 @@ const serializeAws_restJson1ValidatePolicyCommand = async (input, context) => {
788
628
  "content-type": "application/json",
789
629
  };
790
630
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/policy/validation";
791
- const query = {
792
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
793
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
794
- };
631
+ const query = map({
632
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
633
+ nextToken: [, input.nextToken],
634
+ });
795
635
  let body;
796
636
  body = JSON.stringify({
797
637
  ...(input.locale != null && { locale: input.locale }),
@@ -815,11 +655,11 @@ const deserializeAws_restJson1ApplyArchiveRuleCommand = async (output, context)
815
655
  if (output.statusCode !== 200 && output.statusCode >= 300) {
816
656
  return deserializeAws_restJson1ApplyArchiveRuleCommandError(output, context);
817
657
  }
818
- const contents = {
658
+ const contents = map({
819
659
  $metadata: deserializeMetadata(output),
820
- };
660
+ });
821
661
  await collectBody(output.body, context);
822
- return Promise.resolve(contents);
662
+ return contents;
823
663
  };
824
664
  exports.deserializeAws_restJson1ApplyArchiveRuleCommand = deserializeAws_restJson1ApplyArchiveRuleCommand;
825
665
  const deserializeAws_restJson1ApplyArchiveRuleCommandError = async (output, context) => {
@@ -827,7 +667,6 @@ const deserializeAws_restJson1ApplyArchiveRuleCommandError = async (output, cont
827
667
  ...output,
828
668
  body: await parseBody(output.body, context),
829
669
  };
830
- let response;
831
670
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
832
671
  switch (errorCode) {
833
672
  case "AccessDeniedException":
@@ -847,25 +686,23 @@ const deserializeAws_restJson1ApplyArchiveRuleCommandError = async (output, cont
847
686
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
848
687
  default:
849
688
  const parsedBody = parsedOutput.body;
850
- const $metadata = deserializeMetadata(output);
851
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
852
- response = new AccessAnalyzerServiceException_1.AccessAnalyzerServiceException({
853
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
854
- $fault: "client",
855
- $metadata,
689
+ (0, smithy_client_1.throwDefaultError)({
690
+ output,
691
+ parsedBody,
692
+ exceptionCtor: AccessAnalyzerServiceException_1.AccessAnalyzerServiceException,
693
+ errorCode,
856
694
  });
857
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
858
695
  }
859
696
  };
860
697
  const deserializeAws_restJson1CancelPolicyGenerationCommand = async (output, context) => {
861
698
  if (output.statusCode !== 200 && output.statusCode >= 300) {
862
699
  return deserializeAws_restJson1CancelPolicyGenerationCommandError(output, context);
863
700
  }
864
- const contents = {
701
+ const contents = map({
865
702
  $metadata: deserializeMetadata(output),
866
- };
703
+ });
867
704
  await collectBody(output.body, context);
868
- return Promise.resolve(contents);
705
+ return contents;
869
706
  };
870
707
  exports.deserializeAws_restJson1CancelPolicyGenerationCommand = deserializeAws_restJson1CancelPolicyGenerationCommand;
871
708
  const deserializeAws_restJson1CancelPolicyGenerationCommandError = async (output, context) => {
@@ -873,7 +710,6 @@ const deserializeAws_restJson1CancelPolicyGenerationCommandError = async (output
873
710
  ...output,
874
711
  body: await parseBody(output.body, context),
875
712
  };
876
- let response;
877
713
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
878
714
  switch (errorCode) {
879
715
  case "AccessDeniedException":
@@ -890,29 +726,26 @@ const deserializeAws_restJson1CancelPolicyGenerationCommandError = async (output
890
726
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
891
727
  default:
892
728
  const parsedBody = parsedOutput.body;
893
- const $metadata = deserializeMetadata(output);
894
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
895
- response = new AccessAnalyzerServiceException_1.AccessAnalyzerServiceException({
896
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
897
- $fault: "client",
898
- $metadata,
729
+ (0, smithy_client_1.throwDefaultError)({
730
+ output,
731
+ parsedBody,
732
+ exceptionCtor: AccessAnalyzerServiceException_1.AccessAnalyzerServiceException,
733
+ errorCode,
899
734
  });
900
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
901
735
  }
902
736
  };
903
737
  const deserializeAws_restJson1CreateAccessPreviewCommand = async (output, context) => {
904
738
  if (output.statusCode !== 200 && output.statusCode >= 300) {
905
739
  return deserializeAws_restJson1CreateAccessPreviewCommandError(output, context);
906
740
  }
907
- const contents = {
741
+ const contents = map({
908
742
  $metadata: deserializeMetadata(output),
909
- id: undefined,
910
- };
743
+ });
911
744
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
912
- if (data.id !== undefined && data.id !== null) {
745
+ if (data.id != null) {
913
746
  contents.id = (0, smithy_client_1.expectString)(data.id);
914
747
  }
915
- return Promise.resolve(contents);
748
+ return contents;
916
749
  };
917
750
  exports.deserializeAws_restJson1CreateAccessPreviewCommand = deserializeAws_restJson1CreateAccessPreviewCommand;
918
751
  const deserializeAws_restJson1CreateAccessPreviewCommandError = async (output, context) => {
@@ -920,7 +753,6 @@ const deserializeAws_restJson1CreateAccessPreviewCommandError = async (output, c
920
753
  ...output,
921
754
  body: await parseBody(output.body, context),
922
755
  };
923
- let response;
924
756
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
925
757
  switch (errorCode) {
926
758
  case "AccessDeniedException":
@@ -946,29 +778,26 @@ const deserializeAws_restJson1CreateAccessPreviewCommandError = async (output, c
946
778
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
947
779
  default:
948
780
  const parsedBody = parsedOutput.body;
949
- const $metadata = deserializeMetadata(output);
950
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
951
- response = new AccessAnalyzerServiceException_1.AccessAnalyzerServiceException({
952
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
953
- $fault: "client",
954
- $metadata,
781
+ (0, smithy_client_1.throwDefaultError)({
782
+ output,
783
+ parsedBody,
784
+ exceptionCtor: AccessAnalyzerServiceException_1.AccessAnalyzerServiceException,
785
+ errorCode,
955
786
  });
956
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
957
787
  }
958
788
  };
959
789
  const deserializeAws_restJson1CreateAnalyzerCommand = async (output, context) => {
960
790
  if (output.statusCode !== 200 && output.statusCode >= 300) {
961
791
  return deserializeAws_restJson1CreateAnalyzerCommandError(output, context);
962
792
  }
963
- const contents = {
793
+ const contents = map({
964
794
  $metadata: deserializeMetadata(output),
965
- arn: undefined,
966
- };
795
+ });
967
796
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
968
- if (data.arn !== undefined && data.arn !== null) {
797
+ if (data.arn != null) {
969
798
  contents.arn = (0, smithy_client_1.expectString)(data.arn);
970
799
  }
971
- return Promise.resolve(contents);
800
+ return contents;
972
801
  };
973
802
  exports.deserializeAws_restJson1CreateAnalyzerCommand = deserializeAws_restJson1CreateAnalyzerCommand;
974
803
  const deserializeAws_restJson1CreateAnalyzerCommandError = async (output, context) => {
@@ -976,7 +805,6 @@ const deserializeAws_restJson1CreateAnalyzerCommandError = async (output, contex
976
805
  ...output,
977
806
  body: await parseBody(output.body, context),
978
807
  };
979
- let response;
980
808
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
981
809
  switch (errorCode) {
982
810
  case "AccessDeniedException":
@@ -999,25 +827,23 @@ const deserializeAws_restJson1CreateAnalyzerCommandError = async (output, contex
999
827
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1000
828
  default:
1001
829
  const parsedBody = parsedOutput.body;
1002
- const $metadata = deserializeMetadata(output);
1003
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1004
- response = new AccessAnalyzerServiceException_1.AccessAnalyzerServiceException({
1005
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1006
- $fault: "client",
1007
- $metadata,
830
+ (0, smithy_client_1.throwDefaultError)({
831
+ output,
832
+ parsedBody,
833
+ exceptionCtor: AccessAnalyzerServiceException_1.AccessAnalyzerServiceException,
834
+ errorCode,
1008
835
  });
1009
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1010
836
  }
1011
837
  };
1012
838
  const deserializeAws_restJson1CreateArchiveRuleCommand = async (output, context) => {
1013
839
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1014
840
  return deserializeAws_restJson1CreateArchiveRuleCommandError(output, context);
1015
841
  }
1016
- const contents = {
842
+ const contents = map({
1017
843
  $metadata: deserializeMetadata(output),
1018
- };
844
+ });
1019
845
  await collectBody(output.body, context);
1020
- return Promise.resolve(contents);
846
+ return contents;
1021
847
  };
1022
848
  exports.deserializeAws_restJson1CreateArchiveRuleCommand = deserializeAws_restJson1CreateArchiveRuleCommand;
1023
849
  const deserializeAws_restJson1CreateArchiveRuleCommandError = async (output, context) => {
@@ -1025,7 +851,6 @@ const deserializeAws_restJson1CreateArchiveRuleCommandError = async (output, con
1025
851
  ...output,
1026
852
  body: await parseBody(output.body, context),
1027
853
  };
1028
- let response;
1029
854
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1030
855
  switch (errorCode) {
1031
856
  case "AccessDeniedException":
@@ -1051,25 +876,23 @@ const deserializeAws_restJson1CreateArchiveRuleCommandError = async (output, con
1051
876
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1052
877
  default:
1053
878
  const parsedBody = parsedOutput.body;
1054
- const $metadata = deserializeMetadata(output);
1055
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1056
- response = new AccessAnalyzerServiceException_1.AccessAnalyzerServiceException({
1057
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1058
- $fault: "client",
1059
- $metadata,
879
+ (0, smithy_client_1.throwDefaultError)({
880
+ output,
881
+ parsedBody,
882
+ exceptionCtor: AccessAnalyzerServiceException_1.AccessAnalyzerServiceException,
883
+ errorCode,
1060
884
  });
1061
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1062
885
  }
1063
886
  };
1064
887
  const deserializeAws_restJson1DeleteAnalyzerCommand = async (output, context) => {
1065
888
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1066
889
  return deserializeAws_restJson1DeleteAnalyzerCommandError(output, context);
1067
890
  }
1068
- const contents = {
891
+ const contents = map({
1069
892
  $metadata: deserializeMetadata(output),
1070
- };
893
+ });
1071
894
  await collectBody(output.body, context);
1072
- return Promise.resolve(contents);
895
+ return contents;
1073
896
  };
1074
897
  exports.deserializeAws_restJson1DeleteAnalyzerCommand = deserializeAws_restJson1DeleteAnalyzerCommand;
1075
898
  const deserializeAws_restJson1DeleteAnalyzerCommandError = async (output, context) => {
@@ -1077,7 +900,6 @@ const deserializeAws_restJson1DeleteAnalyzerCommandError = async (output, contex
1077
900
  ...output,
1078
901
  body: await parseBody(output.body, context),
1079
902
  };
1080
- let response;
1081
903
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1082
904
  switch (errorCode) {
1083
905
  case "AccessDeniedException":
@@ -1097,25 +919,23 @@ const deserializeAws_restJson1DeleteAnalyzerCommandError = async (output, contex
1097
919
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1098
920
  default:
1099
921
  const parsedBody = parsedOutput.body;
1100
- const $metadata = deserializeMetadata(output);
1101
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1102
- response = new AccessAnalyzerServiceException_1.AccessAnalyzerServiceException({
1103
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1104
- $fault: "client",
1105
- $metadata,
922
+ (0, smithy_client_1.throwDefaultError)({
923
+ output,
924
+ parsedBody,
925
+ exceptionCtor: AccessAnalyzerServiceException_1.AccessAnalyzerServiceException,
926
+ errorCode,
1106
927
  });
1107
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1108
928
  }
1109
929
  };
1110
930
  const deserializeAws_restJson1DeleteArchiveRuleCommand = async (output, context) => {
1111
931
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1112
932
  return deserializeAws_restJson1DeleteArchiveRuleCommandError(output, context);
1113
933
  }
1114
- const contents = {
934
+ const contents = map({
1115
935
  $metadata: deserializeMetadata(output),
1116
- };
936
+ });
1117
937
  await collectBody(output.body, context);
1118
- return Promise.resolve(contents);
938
+ return contents;
1119
939
  };
1120
940
  exports.deserializeAws_restJson1DeleteArchiveRuleCommand = deserializeAws_restJson1DeleteArchiveRuleCommand;
1121
941
  const deserializeAws_restJson1DeleteArchiveRuleCommandError = async (output, context) => {
@@ -1123,7 +943,6 @@ const deserializeAws_restJson1DeleteArchiveRuleCommandError = async (output, con
1123
943
  ...output,
1124
944
  body: await parseBody(output.body, context),
1125
945
  };
1126
- let response;
1127
946
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1128
947
  switch (errorCode) {
1129
948
  case "AccessDeniedException":
@@ -1143,29 +962,26 @@ const deserializeAws_restJson1DeleteArchiveRuleCommandError = async (output, con
1143
962
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1144
963
  default:
1145
964
  const parsedBody = parsedOutput.body;
1146
- const $metadata = deserializeMetadata(output);
1147
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1148
- response = new AccessAnalyzerServiceException_1.AccessAnalyzerServiceException({
1149
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1150
- $fault: "client",
1151
- $metadata,
965
+ (0, smithy_client_1.throwDefaultError)({
966
+ output,
967
+ parsedBody,
968
+ exceptionCtor: AccessAnalyzerServiceException_1.AccessAnalyzerServiceException,
969
+ errorCode,
1152
970
  });
1153
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1154
971
  }
1155
972
  };
1156
973
  const deserializeAws_restJson1GetAccessPreviewCommand = async (output, context) => {
1157
974
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1158
975
  return deserializeAws_restJson1GetAccessPreviewCommandError(output, context);
1159
976
  }
1160
- const contents = {
977
+ const contents = map({
1161
978
  $metadata: deserializeMetadata(output),
1162
- accessPreview: undefined,
1163
- };
979
+ });
1164
980
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1165
- if (data.accessPreview !== undefined && data.accessPreview !== null) {
981
+ if (data.accessPreview != null) {
1166
982
  contents.accessPreview = deserializeAws_restJson1AccessPreview(data.accessPreview, context);
1167
983
  }
1168
- return Promise.resolve(contents);
984
+ return contents;
1169
985
  };
1170
986
  exports.deserializeAws_restJson1GetAccessPreviewCommand = deserializeAws_restJson1GetAccessPreviewCommand;
1171
987
  const deserializeAws_restJson1GetAccessPreviewCommandError = async (output, context) => {
@@ -1173,7 +989,6 @@ const deserializeAws_restJson1GetAccessPreviewCommandError = async (output, cont
1173
989
  ...output,
1174
990
  body: await parseBody(output.body, context),
1175
991
  };
1176
- let response;
1177
992
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1178
993
  switch (errorCode) {
1179
994
  case "AccessDeniedException":
@@ -1193,29 +1008,26 @@ const deserializeAws_restJson1GetAccessPreviewCommandError = async (output, cont
1193
1008
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1194
1009
  default:
1195
1010
  const parsedBody = parsedOutput.body;
1196
- const $metadata = deserializeMetadata(output);
1197
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1198
- response = new AccessAnalyzerServiceException_1.AccessAnalyzerServiceException({
1199
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1200
- $fault: "client",
1201
- $metadata,
1011
+ (0, smithy_client_1.throwDefaultError)({
1012
+ output,
1013
+ parsedBody,
1014
+ exceptionCtor: AccessAnalyzerServiceException_1.AccessAnalyzerServiceException,
1015
+ errorCode,
1202
1016
  });
1203
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1204
1017
  }
1205
1018
  };
1206
1019
  const deserializeAws_restJson1GetAnalyzedResourceCommand = async (output, context) => {
1207
1020
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1208
1021
  return deserializeAws_restJson1GetAnalyzedResourceCommandError(output, context);
1209
1022
  }
1210
- const contents = {
1023
+ const contents = map({
1211
1024
  $metadata: deserializeMetadata(output),
1212
- resource: undefined,
1213
- };
1025
+ });
1214
1026
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1215
- if (data.resource !== undefined && data.resource !== null) {
1027
+ if (data.resource != null) {
1216
1028
  contents.resource = deserializeAws_restJson1AnalyzedResource(data.resource, context);
1217
1029
  }
1218
- return Promise.resolve(contents);
1030
+ return contents;
1219
1031
  };
1220
1032
  exports.deserializeAws_restJson1GetAnalyzedResourceCommand = deserializeAws_restJson1GetAnalyzedResourceCommand;
1221
1033
  const deserializeAws_restJson1GetAnalyzedResourceCommandError = async (output, context) => {
@@ -1223,7 +1035,6 @@ const deserializeAws_restJson1GetAnalyzedResourceCommandError = async (output, c
1223
1035
  ...output,
1224
1036
  body: await parseBody(output.body, context),
1225
1037
  };
1226
- let response;
1227
1038
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1228
1039
  switch (errorCode) {
1229
1040
  case "AccessDeniedException":
@@ -1243,29 +1054,26 @@ const deserializeAws_restJson1GetAnalyzedResourceCommandError = async (output, c
1243
1054
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1244
1055
  default:
1245
1056
  const parsedBody = parsedOutput.body;
1246
- const $metadata = deserializeMetadata(output);
1247
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1248
- response = new AccessAnalyzerServiceException_1.AccessAnalyzerServiceException({
1249
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1250
- $fault: "client",
1251
- $metadata,
1057
+ (0, smithy_client_1.throwDefaultError)({
1058
+ output,
1059
+ parsedBody,
1060
+ exceptionCtor: AccessAnalyzerServiceException_1.AccessAnalyzerServiceException,
1061
+ errorCode,
1252
1062
  });
1253
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1254
1063
  }
1255
1064
  };
1256
1065
  const deserializeAws_restJson1GetAnalyzerCommand = async (output, context) => {
1257
1066
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1258
1067
  return deserializeAws_restJson1GetAnalyzerCommandError(output, context);
1259
1068
  }
1260
- const contents = {
1069
+ const contents = map({
1261
1070
  $metadata: deserializeMetadata(output),
1262
- analyzer: undefined,
1263
- };
1071
+ });
1264
1072
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1265
- if (data.analyzer !== undefined && data.analyzer !== null) {
1073
+ if (data.analyzer != null) {
1266
1074
  contents.analyzer = deserializeAws_restJson1AnalyzerSummary(data.analyzer, context);
1267
1075
  }
1268
- return Promise.resolve(contents);
1076
+ return contents;
1269
1077
  };
1270
1078
  exports.deserializeAws_restJson1GetAnalyzerCommand = deserializeAws_restJson1GetAnalyzerCommand;
1271
1079
  const deserializeAws_restJson1GetAnalyzerCommandError = async (output, context) => {
@@ -1273,7 +1081,6 @@ const deserializeAws_restJson1GetAnalyzerCommandError = async (output, context)
1273
1081
  ...output,
1274
1082
  body: await parseBody(output.body, context),
1275
1083
  };
1276
- let response;
1277
1084
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1278
1085
  switch (errorCode) {
1279
1086
  case "AccessDeniedException":
@@ -1293,29 +1100,26 @@ const deserializeAws_restJson1GetAnalyzerCommandError = async (output, context)
1293
1100
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1294
1101
  default:
1295
1102
  const parsedBody = parsedOutput.body;
1296
- const $metadata = deserializeMetadata(output);
1297
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1298
- response = new AccessAnalyzerServiceException_1.AccessAnalyzerServiceException({
1299
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1300
- $fault: "client",
1301
- $metadata,
1103
+ (0, smithy_client_1.throwDefaultError)({
1104
+ output,
1105
+ parsedBody,
1106
+ exceptionCtor: AccessAnalyzerServiceException_1.AccessAnalyzerServiceException,
1107
+ errorCode,
1302
1108
  });
1303
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1304
1109
  }
1305
1110
  };
1306
1111
  const deserializeAws_restJson1GetArchiveRuleCommand = async (output, context) => {
1307
1112
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1308
1113
  return deserializeAws_restJson1GetArchiveRuleCommandError(output, context);
1309
1114
  }
1310
- const contents = {
1115
+ const contents = map({
1311
1116
  $metadata: deserializeMetadata(output),
1312
- archiveRule: undefined,
1313
- };
1117
+ });
1314
1118
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1315
- if (data.archiveRule !== undefined && data.archiveRule !== null) {
1119
+ if (data.archiveRule != null) {
1316
1120
  contents.archiveRule = deserializeAws_restJson1ArchiveRuleSummary(data.archiveRule, context);
1317
1121
  }
1318
- return Promise.resolve(contents);
1122
+ return contents;
1319
1123
  };
1320
1124
  exports.deserializeAws_restJson1GetArchiveRuleCommand = deserializeAws_restJson1GetArchiveRuleCommand;
1321
1125
  const deserializeAws_restJson1GetArchiveRuleCommandError = async (output, context) => {
@@ -1323,7 +1127,6 @@ const deserializeAws_restJson1GetArchiveRuleCommandError = async (output, contex
1323
1127
  ...output,
1324
1128
  body: await parseBody(output.body, context),
1325
1129
  };
1326
- let response;
1327
1130
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1328
1131
  switch (errorCode) {
1329
1132
  case "AccessDeniedException":
@@ -1343,29 +1146,26 @@ const deserializeAws_restJson1GetArchiveRuleCommandError = async (output, contex
1343
1146
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1344
1147
  default:
1345
1148
  const parsedBody = parsedOutput.body;
1346
- const $metadata = deserializeMetadata(output);
1347
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1348
- response = new AccessAnalyzerServiceException_1.AccessAnalyzerServiceException({
1349
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1350
- $fault: "client",
1351
- $metadata,
1149
+ (0, smithy_client_1.throwDefaultError)({
1150
+ output,
1151
+ parsedBody,
1152
+ exceptionCtor: AccessAnalyzerServiceException_1.AccessAnalyzerServiceException,
1153
+ errorCode,
1352
1154
  });
1353
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1354
1155
  }
1355
1156
  };
1356
1157
  const deserializeAws_restJson1GetFindingCommand = async (output, context) => {
1357
1158
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1358
1159
  return deserializeAws_restJson1GetFindingCommandError(output, context);
1359
1160
  }
1360
- const contents = {
1161
+ const contents = map({
1361
1162
  $metadata: deserializeMetadata(output),
1362
- finding: undefined,
1363
- };
1163
+ });
1364
1164
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1365
- if (data.finding !== undefined && data.finding !== null) {
1165
+ if (data.finding != null) {
1366
1166
  contents.finding = deserializeAws_restJson1Finding(data.finding, context);
1367
1167
  }
1368
- return Promise.resolve(contents);
1168
+ return contents;
1369
1169
  };
1370
1170
  exports.deserializeAws_restJson1GetFindingCommand = deserializeAws_restJson1GetFindingCommand;
1371
1171
  const deserializeAws_restJson1GetFindingCommandError = async (output, context) => {
@@ -1373,7 +1173,6 @@ const deserializeAws_restJson1GetFindingCommandError = async (output, context) =
1373
1173
  ...output,
1374
1174
  body: await parseBody(output.body, context),
1375
1175
  };
1376
- let response;
1377
1176
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1378
1177
  switch (errorCode) {
1379
1178
  case "AccessDeniedException":
@@ -1393,33 +1192,29 @@ const deserializeAws_restJson1GetFindingCommandError = async (output, context) =
1393
1192
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1394
1193
  default:
1395
1194
  const parsedBody = parsedOutput.body;
1396
- const $metadata = deserializeMetadata(output);
1397
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1398
- response = new AccessAnalyzerServiceException_1.AccessAnalyzerServiceException({
1399
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1400
- $fault: "client",
1401
- $metadata,
1195
+ (0, smithy_client_1.throwDefaultError)({
1196
+ output,
1197
+ parsedBody,
1198
+ exceptionCtor: AccessAnalyzerServiceException_1.AccessAnalyzerServiceException,
1199
+ errorCode,
1402
1200
  });
1403
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1404
1201
  }
1405
1202
  };
1406
1203
  const deserializeAws_restJson1GetGeneratedPolicyCommand = async (output, context) => {
1407
1204
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1408
1205
  return deserializeAws_restJson1GetGeneratedPolicyCommandError(output, context);
1409
1206
  }
1410
- const contents = {
1207
+ const contents = map({
1411
1208
  $metadata: deserializeMetadata(output),
1412
- generatedPolicyResult: undefined,
1413
- jobDetails: undefined,
1414
- };
1209
+ });
1415
1210
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1416
- if (data.generatedPolicyResult !== undefined && data.generatedPolicyResult !== null) {
1211
+ if (data.generatedPolicyResult != null) {
1417
1212
  contents.generatedPolicyResult = deserializeAws_restJson1GeneratedPolicyResult(data.generatedPolicyResult, context);
1418
1213
  }
1419
- if (data.jobDetails !== undefined && data.jobDetails !== null) {
1214
+ if (data.jobDetails != null) {
1420
1215
  contents.jobDetails = deserializeAws_restJson1JobDetails(data.jobDetails, context);
1421
1216
  }
1422
- return Promise.resolve(contents);
1217
+ return contents;
1423
1218
  };
1424
1219
  exports.deserializeAws_restJson1GetGeneratedPolicyCommand = deserializeAws_restJson1GetGeneratedPolicyCommand;
1425
1220
  const deserializeAws_restJson1GetGeneratedPolicyCommandError = async (output, context) => {
@@ -1427,7 +1222,6 @@ const deserializeAws_restJson1GetGeneratedPolicyCommandError = async (output, co
1427
1222
  ...output,
1428
1223
  body: await parseBody(output.body, context),
1429
1224
  };
1430
- let response;
1431
1225
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1432
1226
  switch (errorCode) {
1433
1227
  case "AccessDeniedException":
@@ -1444,33 +1238,29 @@ const deserializeAws_restJson1GetGeneratedPolicyCommandError = async (output, co
1444
1238
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1445
1239
  default:
1446
1240
  const parsedBody = parsedOutput.body;
1447
- const $metadata = deserializeMetadata(output);
1448
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1449
- response = new AccessAnalyzerServiceException_1.AccessAnalyzerServiceException({
1450
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1451
- $fault: "client",
1452
- $metadata,
1241
+ (0, smithy_client_1.throwDefaultError)({
1242
+ output,
1243
+ parsedBody,
1244
+ exceptionCtor: AccessAnalyzerServiceException_1.AccessAnalyzerServiceException,
1245
+ errorCode,
1453
1246
  });
1454
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1455
1247
  }
1456
1248
  };
1457
1249
  const deserializeAws_restJson1ListAccessPreviewFindingsCommand = async (output, context) => {
1458
1250
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1459
1251
  return deserializeAws_restJson1ListAccessPreviewFindingsCommandError(output, context);
1460
1252
  }
1461
- const contents = {
1253
+ const contents = map({
1462
1254
  $metadata: deserializeMetadata(output),
1463
- findings: undefined,
1464
- nextToken: undefined,
1465
- };
1255
+ });
1466
1256
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1467
- if (data.findings !== undefined && data.findings !== null) {
1257
+ if (data.findings != null) {
1468
1258
  contents.findings = deserializeAws_restJson1AccessPreviewFindingsList(data.findings, context);
1469
1259
  }
1470
- if (data.nextToken !== undefined && data.nextToken !== null) {
1260
+ if (data.nextToken != null) {
1471
1261
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1472
1262
  }
1473
- return Promise.resolve(contents);
1263
+ return contents;
1474
1264
  };
1475
1265
  exports.deserializeAws_restJson1ListAccessPreviewFindingsCommand = deserializeAws_restJson1ListAccessPreviewFindingsCommand;
1476
1266
  const deserializeAws_restJson1ListAccessPreviewFindingsCommandError = async (output, context) => {
@@ -1478,7 +1268,6 @@ const deserializeAws_restJson1ListAccessPreviewFindingsCommandError = async (out
1478
1268
  ...output,
1479
1269
  body: await parseBody(output.body, context),
1480
1270
  };
1481
- let response;
1482
1271
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1483
1272
  switch (errorCode) {
1484
1273
  case "AccessDeniedException":
@@ -1501,33 +1290,29 @@ const deserializeAws_restJson1ListAccessPreviewFindingsCommandError = async (out
1501
1290
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1502
1291
  default:
1503
1292
  const parsedBody = parsedOutput.body;
1504
- const $metadata = deserializeMetadata(output);
1505
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1506
- response = new AccessAnalyzerServiceException_1.AccessAnalyzerServiceException({
1507
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1508
- $fault: "client",
1509
- $metadata,
1293
+ (0, smithy_client_1.throwDefaultError)({
1294
+ output,
1295
+ parsedBody,
1296
+ exceptionCtor: AccessAnalyzerServiceException_1.AccessAnalyzerServiceException,
1297
+ errorCode,
1510
1298
  });
1511
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1512
1299
  }
1513
1300
  };
1514
1301
  const deserializeAws_restJson1ListAccessPreviewsCommand = async (output, context) => {
1515
1302
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1516
1303
  return deserializeAws_restJson1ListAccessPreviewsCommandError(output, context);
1517
1304
  }
1518
- const contents = {
1305
+ const contents = map({
1519
1306
  $metadata: deserializeMetadata(output),
1520
- accessPreviews: undefined,
1521
- nextToken: undefined,
1522
- };
1307
+ });
1523
1308
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1524
- if (data.accessPreviews !== undefined && data.accessPreviews !== null) {
1309
+ if (data.accessPreviews != null) {
1525
1310
  contents.accessPreviews = deserializeAws_restJson1AccessPreviewsList(data.accessPreviews, context);
1526
1311
  }
1527
- if (data.nextToken !== undefined && data.nextToken !== null) {
1312
+ if (data.nextToken != null) {
1528
1313
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1529
1314
  }
1530
- return Promise.resolve(contents);
1315
+ return contents;
1531
1316
  };
1532
1317
  exports.deserializeAws_restJson1ListAccessPreviewsCommand = deserializeAws_restJson1ListAccessPreviewsCommand;
1533
1318
  const deserializeAws_restJson1ListAccessPreviewsCommandError = async (output, context) => {
@@ -1535,7 +1320,6 @@ const deserializeAws_restJson1ListAccessPreviewsCommandError = async (output, co
1535
1320
  ...output,
1536
1321
  body: await parseBody(output.body, context),
1537
1322
  };
1538
- let response;
1539
1323
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1540
1324
  switch (errorCode) {
1541
1325
  case "AccessDeniedException":
@@ -1555,33 +1339,29 @@ const deserializeAws_restJson1ListAccessPreviewsCommandError = async (output, co
1555
1339
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1556
1340
  default:
1557
1341
  const parsedBody = parsedOutput.body;
1558
- const $metadata = deserializeMetadata(output);
1559
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1560
- response = new AccessAnalyzerServiceException_1.AccessAnalyzerServiceException({
1561
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1562
- $fault: "client",
1563
- $metadata,
1342
+ (0, smithy_client_1.throwDefaultError)({
1343
+ output,
1344
+ parsedBody,
1345
+ exceptionCtor: AccessAnalyzerServiceException_1.AccessAnalyzerServiceException,
1346
+ errorCode,
1564
1347
  });
1565
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1566
1348
  }
1567
1349
  };
1568
1350
  const deserializeAws_restJson1ListAnalyzedResourcesCommand = async (output, context) => {
1569
1351
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1570
1352
  return deserializeAws_restJson1ListAnalyzedResourcesCommandError(output, context);
1571
1353
  }
1572
- const contents = {
1354
+ const contents = map({
1573
1355
  $metadata: deserializeMetadata(output),
1574
- analyzedResources: undefined,
1575
- nextToken: undefined,
1576
- };
1356
+ });
1577
1357
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1578
- if (data.analyzedResources !== undefined && data.analyzedResources !== null) {
1358
+ if (data.analyzedResources != null) {
1579
1359
  contents.analyzedResources = deserializeAws_restJson1AnalyzedResourcesList(data.analyzedResources, context);
1580
1360
  }
1581
- if (data.nextToken !== undefined && data.nextToken !== null) {
1361
+ if (data.nextToken != null) {
1582
1362
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1583
1363
  }
1584
- return Promise.resolve(contents);
1364
+ return contents;
1585
1365
  };
1586
1366
  exports.deserializeAws_restJson1ListAnalyzedResourcesCommand = deserializeAws_restJson1ListAnalyzedResourcesCommand;
1587
1367
  const deserializeAws_restJson1ListAnalyzedResourcesCommandError = async (output, context) => {
@@ -1589,7 +1369,6 @@ const deserializeAws_restJson1ListAnalyzedResourcesCommandError = async (output,
1589
1369
  ...output,
1590
1370
  body: await parseBody(output.body, context),
1591
1371
  };
1592
- let response;
1593
1372
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1594
1373
  switch (errorCode) {
1595
1374
  case "AccessDeniedException":
@@ -1609,33 +1388,29 @@ const deserializeAws_restJson1ListAnalyzedResourcesCommandError = async (output,
1609
1388
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1610
1389
  default:
1611
1390
  const parsedBody = parsedOutput.body;
1612
- const $metadata = deserializeMetadata(output);
1613
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1614
- response = new AccessAnalyzerServiceException_1.AccessAnalyzerServiceException({
1615
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1616
- $fault: "client",
1617
- $metadata,
1391
+ (0, smithy_client_1.throwDefaultError)({
1392
+ output,
1393
+ parsedBody,
1394
+ exceptionCtor: AccessAnalyzerServiceException_1.AccessAnalyzerServiceException,
1395
+ errorCode,
1618
1396
  });
1619
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1620
1397
  }
1621
1398
  };
1622
1399
  const deserializeAws_restJson1ListAnalyzersCommand = async (output, context) => {
1623
1400
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1624
1401
  return deserializeAws_restJson1ListAnalyzersCommandError(output, context);
1625
1402
  }
1626
- const contents = {
1403
+ const contents = map({
1627
1404
  $metadata: deserializeMetadata(output),
1628
- analyzers: undefined,
1629
- nextToken: undefined,
1630
- };
1405
+ });
1631
1406
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1632
- if (data.analyzers !== undefined && data.analyzers !== null) {
1407
+ if (data.analyzers != null) {
1633
1408
  contents.analyzers = deserializeAws_restJson1AnalyzersList(data.analyzers, context);
1634
1409
  }
1635
- if (data.nextToken !== undefined && data.nextToken !== null) {
1410
+ if (data.nextToken != null) {
1636
1411
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1637
1412
  }
1638
- return Promise.resolve(contents);
1413
+ return contents;
1639
1414
  };
1640
1415
  exports.deserializeAws_restJson1ListAnalyzersCommand = deserializeAws_restJson1ListAnalyzersCommand;
1641
1416
  const deserializeAws_restJson1ListAnalyzersCommandError = async (output, context) => {
@@ -1643,7 +1418,6 @@ const deserializeAws_restJson1ListAnalyzersCommandError = async (output, context
1643
1418
  ...output,
1644
1419
  body: await parseBody(output.body, context),
1645
1420
  };
1646
- let response;
1647
1421
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1648
1422
  switch (errorCode) {
1649
1423
  case "AccessDeniedException":
@@ -1660,33 +1434,29 @@ const deserializeAws_restJson1ListAnalyzersCommandError = async (output, context
1660
1434
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1661
1435
  default:
1662
1436
  const parsedBody = parsedOutput.body;
1663
- const $metadata = deserializeMetadata(output);
1664
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1665
- response = new AccessAnalyzerServiceException_1.AccessAnalyzerServiceException({
1666
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1667
- $fault: "client",
1668
- $metadata,
1437
+ (0, smithy_client_1.throwDefaultError)({
1438
+ output,
1439
+ parsedBody,
1440
+ exceptionCtor: AccessAnalyzerServiceException_1.AccessAnalyzerServiceException,
1441
+ errorCode,
1669
1442
  });
1670
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1671
1443
  }
1672
1444
  };
1673
1445
  const deserializeAws_restJson1ListArchiveRulesCommand = async (output, context) => {
1674
1446
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1675
1447
  return deserializeAws_restJson1ListArchiveRulesCommandError(output, context);
1676
1448
  }
1677
- const contents = {
1449
+ const contents = map({
1678
1450
  $metadata: deserializeMetadata(output),
1679
- archiveRules: undefined,
1680
- nextToken: undefined,
1681
- };
1451
+ });
1682
1452
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1683
- if (data.archiveRules !== undefined && data.archiveRules !== null) {
1453
+ if (data.archiveRules != null) {
1684
1454
  contents.archiveRules = deserializeAws_restJson1ArchiveRulesList(data.archiveRules, context);
1685
1455
  }
1686
- if (data.nextToken !== undefined && data.nextToken !== null) {
1456
+ if (data.nextToken != null) {
1687
1457
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1688
1458
  }
1689
- return Promise.resolve(contents);
1459
+ return contents;
1690
1460
  };
1691
1461
  exports.deserializeAws_restJson1ListArchiveRulesCommand = deserializeAws_restJson1ListArchiveRulesCommand;
1692
1462
  const deserializeAws_restJson1ListArchiveRulesCommandError = async (output, context) => {
@@ -1694,7 +1464,6 @@ const deserializeAws_restJson1ListArchiveRulesCommandError = async (output, cont
1694
1464
  ...output,
1695
1465
  body: await parseBody(output.body, context),
1696
1466
  };
1697
- let response;
1698
1467
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1699
1468
  switch (errorCode) {
1700
1469
  case "AccessDeniedException":
@@ -1711,33 +1480,29 @@ const deserializeAws_restJson1ListArchiveRulesCommandError = async (output, cont
1711
1480
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1712
1481
  default:
1713
1482
  const parsedBody = parsedOutput.body;
1714
- const $metadata = deserializeMetadata(output);
1715
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1716
- response = new AccessAnalyzerServiceException_1.AccessAnalyzerServiceException({
1717
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1718
- $fault: "client",
1719
- $metadata,
1483
+ (0, smithy_client_1.throwDefaultError)({
1484
+ output,
1485
+ parsedBody,
1486
+ exceptionCtor: AccessAnalyzerServiceException_1.AccessAnalyzerServiceException,
1487
+ errorCode,
1720
1488
  });
1721
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1722
1489
  }
1723
1490
  };
1724
1491
  const deserializeAws_restJson1ListFindingsCommand = async (output, context) => {
1725
1492
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1726
1493
  return deserializeAws_restJson1ListFindingsCommandError(output, context);
1727
1494
  }
1728
- const contents = {
1495
+ const contents = map({
1729
1496
  $metadata: deserializeMetadata(output),
1730
- findings: undefined,
1731
- nextToken: undefined,
1732
- };
1497
+ });
1733
1498
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1734
- if (data.findings !== undefined && data.findings !== null) {
1499
+ if (data.findings != null) {
1735
1500
  contents.findings = deserializeAws_restJson1FindingsList(data.findings, context);
1736
1501
  }
1737
- if (data.nextToken !== undefined && data.nextToken !== null) {
1502
+ if (data.nextToken != null) {
1738
1503
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1739
1504
  }
1740
- return Promise.resolve(contents);
1505
+ return contents;
1741
1506
  };
1742
1507
  exports.deserializeAws_restJson1ListFindingsCommand = deserializeAws_restJson1ListFindingsCommand;
1743
1508
  const deserializeAws_restJson1ListFindingsCommandError = async (output, context) => {
@@ -1745,7 +1510,6 @@ const deserializeAws_restJson1ListFindingsCommandError = async (output, context)
1745
1510
  ...output,
1746
1511
  body: await parseBody(output.body, context),
1747
1512
  };
1748
- let response;
1749
1513
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1750
1514
  switch (errorCode) {
1751
1515
  case "AccessDeniedException":
@@ -1765,33 +1529,29 @@ const deserializeAws_restJson1ListFindingsCommandError = async (output, context)
1765
1529
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1766
1530
  default:
1767
1531
  const parsedBody = parsedOutput.body;
1768
- const $metadata = deserializeMetadata(output);
1769
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1770
- response = new AccessAnalyzerServiceException_1.AccessAnalyzerServiceException({
1771
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1772
- $fault: "client",
1773
- $metadata,
1532
+ (0, smithy_client_1.throwDefaultError)({
1533
+ output,
1534
+ parsedBody,
1535
+ exceptionCtor: AccessAnalyzerServiceException_1.AccessAnalyzerServiceException,
1536
+ errorCode,
1774
1537
  });
1775
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1776
1538
  }
1777
1539
  };
1778
1540
  const deserializeAws_restJson1ListPolicyGenerationsCommand = async (output, context) => {
1779
1541
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1780
1542
  return deserializeAws_restJson1ListPolicyGenerationsCommandError(output, context);
1781
1543
  }
1782
- const contents = {
1544
+ const contents = map({
1783
1545
  $metadata: deserializeMetadata(output),
1784
- nextToken: undefined,
1785
- policyGenerations: undefined,
1786
- };
1546
+ });
1787
1547
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1788
- if (data.nextToken !== undefined && data.nextToken !== null) {
1548
+ if (data.nextToken != null) {
1789
1549
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1790
1550
  }
1791
- if (data.policyGenerations !== undefined && data.policyGenerations !== null) {
1551
+ if (data.policyGenerations != null) {
1792
1552
  contents.policyGenerations = deserializeAws_restJson1PolicyGenerationList(data.policyGenerations, context);
1793
1553
  }
1794
- return Promise.resolve(contents);
1554
+ return contents;
1795
1555
  };
1796
1556
  exports.deserializeAws_restJson1ListPolicyGenerationsCommand = deserializeAws_restJson1ListPolicyGenerationsCommand;
1797
1557
  const deserializeAws_restJson1ListPolicyGenerationsCommandError = async (output, context) => {
@@ -1799,7 +1559,6 @@ const deserializeAws_restJson1ListPolicyGenerationsCommandError = async (output,
1799
1559
  ...output,
1800
1560
  body: await parseBody(output.body, context),
1801
1561
  };
1802
- let response;
1803
1562
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1804
1563
  switch (errorCode) {
1805
1564
  case "AccessDeniedException":
@@ -1816,29 +1575,26 @@ const deserializeAws_restJson1ListPolicyGenerationsCommandError = async (output,
1816
1575
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1817
1576
  default:
1818
1577
  const parsedBody = parsedOutput.body;
1819
- const $metadata = deserializeMetadata(output);
1820
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1821
- response = new AccessAnalyzerServiceException_1.AccessAnalyzerServiceException({
1822
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1823
- $fault: "client",
1824
- $metadata,
1578
+ (0, smithy_client_1.throwDefaultError)({
1579
+ output,
1580
+ parsedBody,
1581
+ exceptionCtor: AccessAnalyzerServiceException_1.AccessAnalyzerServiceException,
1582
+ errorCode,
1825
1583
  });
1826
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1827
1584
  }
1828
1585
  };
1829
1586
  const deserializeAws_restJson1ListTagsForResourceCommand = async (output, context) => {
1830
1587
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1831
1588
  return deserializeAws_restJson1ListTagsForResourceCommandError(output, context);
1832
1589
  }
1833
- const contents = {
1590
+ const contents = map({
1834
1591
  $metadata: deserializeMetadata(output),
1835
- tags: undefined,
1836
- };
1592
+ });
1837
1593
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1838
- if (data.tags !== undefined && data.tags !== null) {
1594
+ if (data.tags != null) {
1839
1595
  contents.tags = deserializeAws_restJson1TagsMap(data.tags, context);
1840
1596
  }
1841
- return Promise.resolve(contents);
1597
+ return contents;
1842
1598
  };
1843
1599
  exports.deserializeAws_restJson1ListTagsForResourceCommand = deserializeAws_restJson1ListTagsForResourceCommand;
1844
1600
  const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, context) => {
@@ -1846,7 +1602,6 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
1846
1602
  ...output,
1847
1603
  body: await parseBody(output.body, context),
1848
1604
  };
1849
- let response;
1850
1605
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1851
1606
  switch (errorCode) {
1852
1607
  case "AccessDeniedException":
@@ -1866,29 +1621,26 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
1866
1621
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1867
1622
  default:
1868
1623
  const parsedBody = parsedOutput.body;
1869
- const $metadata = deserializeMetadata(output);
1870
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1871
- response = new AccessAnalyzerServiceException_1.AccessAnalyzerServiceException({
1872
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1873
- $fault: "client",
1874
- $metadata,
1624
+ (0, smithy_client_1.throwDefaultError)({
1625
+ output,
1626
+ parsedBody,
1627
+ exceptionCtor: AccessAnalyzerServiceException_1.AccessAnalyzerServiceException,
1628
+ errorCode,
1875
1629
  });
1876
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1877
1630
  }
1878
1631
  };
1879
1632
  const deserializeAws_restJson1StartPolicyGenerationCommand = async (output, context) => {
1880
1633
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1881
1634
  return deserializeAws_restJson1StartPolicyGenerationCommandError(output, context);
1882
1635
  }
1883
- const contents = {
1636
+ const contents = map({
1884
1637
  $metadata: deserializeMetadata(output),
1885
- jobId: undefined,
1886
- };
1638
+ });
1887
1639
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1888
- if (data.jobId !== undefined && data.jobId !== null) {
1640
+ if (data.jobId != null) {
1889
1641
  contents.jobId = (0, smithy_client_1.expectString)(data.jobId);
1890
1642
  }
1891
- return Promise.resolve(contents);
1643
+ return contents;
1892
1644
  };
1893
1645
  exports.deserializeAws_restJson1StartPolicyGenerationCommand = deserializeAws_restJson1StartPolicyGenerationCommand;
1894
1646
  const deserializeAws_restJson1StartPolicyGenerationCommandError = async (output, context) => {
@@ -1896,7 +1648,6 @@ const deserializeAws_restJson1StartPolicyGenerationCommandError = async (output,
1896
1648
  ...output,
1897
1649
  body: await parseBody(output.body, context),
1898
1650
  };
1899
- let response;
1900
1651
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1901
1652
  switch (errorCode) {
1902
1653
  case "AccessDeniedException":
@@ -1919,25 +1670,23 @@ const deserializeAws_restJson1StartPolicyGenerationCommandError = async (output,
1919
1670
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1920
1671
  default:
1921
1672
  const parsedBody = parsedOutput.body;
1922
- const $metadata = deserializeMetadata(output);
1923
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1924
- response = new AccessAnalyzerServiceException_1.AccessAnalyzerServiceException({
1925
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1926
- $fault: "client",
1927
- $metadata,
1673
+ (0, smithy_client_1.throwDefaultError)({
1674
+ output,
1675
+ parsedBody,
1676
+ exceptionCtor: AccessAnalyzerServiceException_1.AccessAnalyzerServiceException,
1677
+ errorCode,
1928
1678
  });
1929
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1930
1679
  }
1931
1680
  };
1932
1681
  const deserializeAws_restJson1StartResourceScanCommand = async (output, context) => {
1933
1682
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1934
1683
  return deserializeAws_restJson1StartResourceScanCommandError(output, context);
1935
1684
  }
1936
- const contents = {
1685
+ const contents = map({
1937
1686
  $metadata: deserializeMetadata(output),
1938
- };
1687
+ });
1939
1688
  await collectBody(output.body, context);
1940
- return Promise.resolve(contents);
1689
+ return contents;
1941
1690
  };
1942
1691
  exports.deserializeAws_restJson1StartResourceScanCommand = deserializeAws_restJson1StartResourceScanCommand;
1943
1692
  const deserializeAws_restJson1StartResourceScanCommandError = async (output, context) => {
@@ -1945,7 +1694,6 @@ const deserializeAws_restJson1StartResourceScanCommandError = async (output, con
1945
1694
  ...output,
1946
1695
  body: await parseBody(output.body, context),
1947
1696
  };
1948
- let response;
1949
1697
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1950
1698
  switch (errorCode) {
1951
1699
  case "AccessDeniedException":
@@ -1965,25 +1713,23 @@ const deserializeAws_restJson1StartResourceScanCommandError = async (output, con
1965
1713
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1966
1714
  default:
1967
1715
  const parsedBody = parsedOutput.body;
1968
- const $metadata = deserializeMetadata(output);
1969
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1970
- response = new AccessAnalyzerServiceException_1.AccessAnalyzerServiceException({
1971
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1972
- $fault: "client",
1973
- $metadata,
1716
+ (0, smithy_client_1.throwDefaultError)({
1717
+ output,
1718
+ parsedBody,
1719
+ exceptionCtor: AccessAnalyzerServiceException_1.AccessAnalyzerServiceException,
1720
+ errorCode,
1974
1721
  });
1975
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1976
1722
  }
1977
1723
  };
1978
1724
  const deserializeAws_restJson1TagResourceCommand = async (output, context) => {
1979
1725
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1980
1726
  return deserializeAws_restJson1TagResourceCommandError(output, context);
1981
1727
  }
1982
- const contents = {
1728
+ const contents = map({
1983
1729
  $metadata: deserializeMetadata(output),
1984
- };
1730
+ });
1985
1731
  await collectBody(output.body, context);
1986
- return Promise.resolve(contents);
1732
+ return contents;
1987
1733
  };
1988
1734
  exports.deserializeAws_restJson1TagResourceCommand = deserializeAws_restJson1TagResourceCommand;
1989
1735
  const deserializeAws_restJson1TagResourceCommandError = async (output, context) => {
@@ -1991,7 +1737,6 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
1991
1737
  ...output,
1992
1738
  body: await parseBody(output.body, context),
1993
1739
  };
1994
- let response;
1995
1740
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1996
1741
  switch (errorCode) {
1997
1742
  case "AccessDeniedException":
@@ -2011,25 +1756,23 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
2011
1756
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2012
1757
  default:
2013
1758
  const parsedBody = parsedOutput.body;
2014
- const $metadata = deserializeMetadata(output);
2015
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2016
- response = new AccessAnalyzerServiceException_1.AccessAnalyzerServiceException({
2017
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2018
- $fault: "client",
2019
- $metadata,
1759
+ (0, smithy_client_1.throwDefaultError)({
1760
+ output,
1761
+ parsedBody,
1762
+ exceptionCtor: AccessAnalyzerServiceException_1.AccessAnalyzerServiceException,
1763
+ errorCode,
2020
1764
  });
2021
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2022
1765
  }
2023
1766
  };
2024
1767
  const deserializeAws_restJson1UntagResourceCommand = async (output, context) => {
2025
1768
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2026
1769
  return deserializeAws_restJson1UntagResourceCommandError(output, context);
2027
1770
  }
2028
- const contents = {
1771
+ const contents = map({
2029
1772
  $metadata: deserializeMetadata(output),
2030
- };
1773
+ });
2031
1774
  await collectBody(output.body, context);
2032
- return Promise.resolve(contents);
1775
+ return contents;
2033
1776
  };
2034
1777
  exports.deserializeAws_restJson1UntagResourceCommand = deserializeAws_restJson1UntagResourceCommand;
2035
1778
  const deserializeAws_restJson1UntagResourceCommandError = async (output, context) => {
@@ -2037,7 +1780,6 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
2037
1780
  ...output,
2038
1781
  body: await parseBody(output.body, context),
2039
1782
  };
2040
- let response;
2041
1783
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2042
1784
  switch (errorCode) {
2043
1785
  case "AccessDeniedException":
@@ -2057,25 +1799,23 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
2057
1799
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2058
1800
  default:
2059
1801
  const parsedBody = parsedOutput.body;
2060
- const $metadata = deserializeMetadata(output);
2061
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2062
- response = new AccessAnalyzerServiceException_1.AccessAnalyzerServiceException({
2063
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2064
- $fault: "client",
2065
- $metadata,
1802
+ (0, smithy_client_1.throwDefaultError)({
1803
+ output,
1804
+ parsedBody,
1805
+ exceptionCtor: AccessAnalyzerServiceException_1.AccessAnalyzerServiceException,
1806
+ errorCode,
2066
1807
  });
2067
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2068
1808
  }
2069
1809
  };
2070
1810
  const deserializeAws_restJson1UpdateArchiveRuleCommand = async (output, context) => {
2071
1811
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2072
1812
  return deserializeAws_restJson1UpdateArchiveRuleCommandError(output, context);
2073
1813
  }
2074
- const contents = {
1814
+ const contents = map({
2075
1815
  $metadata: deserializeMetadata(output),
2076
- };
1816
+ });
2077
1817
  await collectBody(output.body, context);
2078
- return Promise.resolve(contents);
1818
+ return contents;
2079
1819
  };
2080
1820
  exports.deserializeAws_restJson1UpdateArchiveRuleCommand = deserializeAws_restJson1UpdateArchiveRuleCommand;
2081
1821
  const deserializeAws_restJson1UpdateArchiveRuleCommandError = async (output, context) => {
@@ -2083,7 +1823,6 @@ const deserializeAws_restJson1UpdateArchiveRuleCommandError = async (output, con
2083
1823
  ...output,
2084
1824
  body: await parseBody(output.body, context),
2085
1825
  };
2086
- let response;
2087
1826
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2088
1827
  switch (errorCode) {
2089
1828
  case "AccessDeniedException":
@@ -2103,25 +1842,23 @@ const deserializeAws_restJson1UpdateArchiveRuleCommandError = async (output, con
2103
1842
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2104
1843
  default:
2105
1844
  const parsedBody = parsedOutput.body;
2106
- const $metadata = deserializeMetadata(output);
2107
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2108
- response = new AccessAnalyzerServiceException_1.AccessAnalyzerServiceException({
2109
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2110
- $fault: "client",
2111
- $metadata,
1845
+ (0, smithy_client_1.throwDefaultError)({
1846
+ output,
1847
+ parsedBody,
1848
+ exceptionCtor: AccessAnalyzerServiceException_1.AccessAnalyzerServiceException,
1849
+ errorCode,
2112
1850
  });
2113
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2114
1851
  }
2115
1852
  };
2116
1853
  const deserializeAws_restJson1UpdateFindingsCommand = async (output, context) => {
2117
1854
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2118
1855
  return deserializeAws_restJson1UpdateFindingsCommandError(output, context);
2119
1856
  }
2120
- const contents = {
1857
+ const contents = map({
2121
1858
  $metadata: deserializeMetadata(output),
2122
- };
1859
+ });
2123
1860
  await collectBody(output.body, context);
2124
- return Promise.resolve(contents);
1861
+ return contents;
2125
1862
  };
2126
1863
  exports.deserializeAws_restJson1UpdateFindingsCommand = deserializeAws_restJson1UpdateFindingsCommand;
2127
1864
  const deserializeAws_restJson1UpdateFindingsCommandError = async (output, context) => {
@@ -2129,7 +1866,6 @@ const deserializeAws_restJson1UpdateFindingsCommandError = async (output, contex
2129
1866
  ...output,
2130
1867
  body: await parseBody(output.body, context),
2131
1868
  };
2132
- let response;
2133
1869
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2134
1870
  switch (errorCode) {
2135
1871
  case "AccessDeniedException":
@@ -2149,33 +1885,29 @@ const deserializeAws_restJson1UpdateFindingsCommandError = async (output, contex
2149
1885
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2150
1886
  default:
2151
1887
  const parsedBody = parsedOutput.body;
2152
- const $metadata = deserializeMetadata(output);
2153
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2154
- response = new AccessAnalyzerServiceException_1.AccessAnalyzerServiceException({
2155
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2156
- $fault: "client",
2157
- $metadata,
1888
+ (0, smithy_client_1.throwDefaultError)({
1889
+ output,
1890
+ parsedBody,
1891
+ exceptionCtor: AccessAnalyzerServiceException_1.AccessAnalyzerServiceException,
1892
+ errorCode,
2158
1893
  });
2159
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2160
1894
  }
2161
1895
  };
2162
1896
  const deserializeAws_restJson1ValidatePolicyCommand = async (output, context) => {
2163
1897
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2164
1898
  return deserializeAws_restJson1ValidatePolicyCommandError(output, context);
2165
1899
  }
2166
- const contents = {
1900
+ const contents = map({
2167
1901
  $metadata: deserializeMetadata(output),
2168
- findings: undefined,
2169
- nextToken: undefined,
2170
- };
1902
+ });
2171
1903
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2172
- if (data.findings !== undefined && data.findings !== null) {
1904
+ if (data.findings != null) {
2173
1905
  contents.findings = deserializeAws_restJson1ValidatePolicyFindingList(data.findings, context);
2174
1906
  }
2175
- if (data.nextToken !== undefined && data.nextToken !== null) {
1907
+ if (data.nextToken != null) {
2176
1908
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
2177
1909
  }
2178
- return Promise.resolve(contents);
1910
+ return contents;
2179
1911
  };
2180
1912
  exports.deserializeAws_restJson1ValidatePolicyCommand = deserializeAws_restJson1ValidatePolicyCommand;
2181
1913
  const deserializeAws_restJson1ValidatePolicyCommandError = async (output, context) => {
@@ -2183,7 +1915,6 @@ const deserializeAws_restJson1ValidatePolicyCommandError = async (output, contex
2183
1915
  ...output,
2184
1916
  body: await parseBody(output.body, context),
2185
1917
  };
2186
- let response;
2187
1918
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2188
1919
  switch (errorCode) {
2189
1920
  case "AccessDeniedException":
@@ -2200,20 +1931,19 @@ const deserializeAws_restJson1ValidatePolicyCommandError = async (output, contex
2200
1931
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2201
1932
  default:
2202
1933
  const parsedBody = parsedOutput.body;
2203
- const $metadata = deserializeMetadata(output);
2204
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2205
- response = new AccessAnalyzerServiceException_1.AccessAnalyzerServiceException({
2206
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2207
- $fault: "client",
2208
- $metadata,
1934
+ (0, smithy_client_1.throwDefaultError)({
1935
+ output,
1936
+ parsedBody,
1937
+ exceptionCtor: AccessAnalyzerServiceException_1.AccessAnalyzerServiceException,
1938
+ errorCode,
2209
1939
  });
2210
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2211
1940
  }
2212
1941
  };
1942
+ const map = smithy_client_1.map;
2213
1943
  const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutput, context) => {
2214
- const contents = {};
1944
+ const contents = map({});
2215
1945
  const data = parsedOutput.body;
2216
- if (data.message !== undefined && data.message !== null) {
1946
+ if (data.message != null) {
2217
1947
  contents.message = (0, smithy_client_1.expectString)(data.message);
2218
1948
  }
2219
1949
  const exception = new models_0_1.AccessDeniedException({
@@ -2223,15 +1953,15 @@ const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutpu
2223
1953
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2224
1954
  };
2225
1955
  const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, context) => {
2226
- const contents = {};
1956
+ const contents = map({});
2227
1957
  const data = parsedOutput.body;
2228
- if (data.message !== undefined && data.message !== null) {
1958
+ if (data.message != null) {
2229
1959
  contents.message = (0, smithy_client_1.expectString)(data.message);
2230
1960
  }
2231
- if (data.resourceId !== undefined && data.resourceId !== null) {
1961
+ if (data.resourceId != null) {
2232
1962
  contents.resourceId = (0, smithy_client_1.expectString)(data.resourceId);
2233
1963
  }
2234
- if (data.resourceType !== undefined && data.resourceType !== null) {
1964
+ if (data.resourceType != null) {
2235
1965
  contents.resourceType = (0, smithy_client_1.expectString)(data.resourceType);
2236
1966
  }
2237
1967
  const exception = new models_0_1.ConflictException({
@@ -2241,12 +1971,14 @@ const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, c
2241
1971
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2242
1972
  };
2243
1973
  const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOutput, context) => {
2244
- const contents = {};
2245
- if (parsedOutput.headers["retry-after"] !== undefined) {
2246
- contents.retryAfterSeconds = (0, smithy_client_1.strictParseInt32)(parsedOutput.headers["retry-after"]);
2247
- }
1974
+ const contents = map({
1975
+ retryAfterSeconds: [
1976
+ () => void 0 !== parsedOutput.headers["retry-after"],
1977
+ () => (0, smithy_client_1.strictParseInt32)(parsedOutput.headers["retry-after"]),
1978
+ ],
1979
+ });
2248
1980
  const data = parsedOutput.body;
2249
- if (data.message !== undefined && data.message !== null) {
1981
+ if (data.message != null) {
2250
1982
  contents.message = (0, smithy_client_1.expectString)(data.message);
2251
1983
  }
2252
1984
  const exception = new models_0_1.InternalServerException({
@@ -2256,15 +1988,15 @@ const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOut
2256
1988
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2257
1989
  };
2258
1990
  const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
2259
- const contents = {};
1991
+ const contents = map({});
2260
1992
  const data = parsedOutput.body;
2261
- if (data.message !== undefined && data.message !== null) {
1993
+ if (data.message != null) {
2262
1994
  contents.message = (0, smithy_client_1.expectString)(data.message);
2263
1995
  }
2264
- if (data.resourceId !== undefined && data.resourceId !== null) {
1996
+ if (data.resourceId != null) {
2265
1997
  contents.resourceId = (0, smithy_client_1.expectString)(data.resourceId);
2266
1998
  }
2267
- if (data.resourceType !== undefined && data.resourceType !== null) {
1999
+ if (data.resourceType != null) {
2268
2000
  contents.resourceType = (0, smithy_client_1.expectString)(data.resourceType);
2269
2001
  }
2270
2002
  const exception = new models_0_1.ResourceNotFoundException({
@@ -2274,15 +2006,15 @@ const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedO
2274
2006
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2275
2007
  };
2276
2008
  const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (parsedOutput, context) => {
2277
- const contents = {};
2009
+ const contents = map({});
2278
2010
  const data = parsedOutput.body;
2279
- if (data.message !== undefined && data.message !== null) {
2011
+ if (data.message != null) {
2280
2012
  contents.message = (0, smithy_client_1.expectString)(data.message);
2281
2013
  }
2282
- if (data.resourceId !== undefined && data.resourceId !== null) {
2014
+ if (data.resourceId != null) {
2283
2015
  contents.resourceId = (0, smithy_client_1.expectString)(data.resourceId);
2284
2016
  }
2285
- if (data.resourceType !== undefined && data.resourceType !== null) {
2017
+ if (data.resourceType != null) {
2286
2018
  contents.resourceType = (0, smithy_client_1.expectString)(data.resourceType);
2287
2019
  }
2288
2020
  const exception = new models_0_1.ServiceQuotaExceededException({
@@ -2292,12 +2024,14 @@ const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (par
2292
2024
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2293
2025
  };
2294
2026
  const deserializeAws_restJson1ThrottlingExceptionResponse = async (parsedOutput, context) => {
2295
- const contents = {};
2296
- if (parsedOutput.headers["retry-after"] !== undefined) {
2297
- contents.retryAfterSeconds = (0, smithy_client_1.strictParseInt32)(parsedOutput.headers["retry-after"]);
2298
- }
2027
+ const contents = map({
2028
+ retryAfterSeconds: [
2029
+ () => void 0 !== parsedOutput.headers["retry-after"],
2030
+ () => (0, smithy_client_1.strictParseInt32)(parsedOutput.headers["retry-after"]),
2031
+ ],
2032
+ });
2299
2033
  const data = parsedOutput.body;
2300
- if (data.message !== undefined && data.message !== null) {
2034
+ if (data.message != null) {
2301
2035
  contents.message = (0, smithy_client_1.expectString)(data.message);
2302
2036
  }
2303
2037
  const exception = new models_0_1.ThrottlingException({
@@ -2307,15 +2041,15 @@ const deserializeAws_restJson1ThrottlingExceptionResponse = async (parsedOutput,
2307
2041
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2308
2042
  };
2309
2043
  const deserializeAws_restJson1ValidationExceptionResponse = async (parsedOutput, context) => {
2310
- const contents = {};
2044
+ const contents = map({});
2311
2045
  const data = parsedOutput.body;
2312
- if (data.fieldList !== undefined && data.fieldList !== null) {
2046
+ if (data.fieldList != null) {
2313
2047
  contents.fieldList = deserializeAws_restJson1ValidationExceptionFieldList(data.fieldList, context);
2314
2048
  }
2315
- if (data.message !== undefined && data.message !== null) {
2049
+ if (data.message != null) {
2316
2050
  contents.message = (0, smithy_client_1.expectString)(data.message);
2317
2051
  }
2318
- if (data.reason !== undefined && data.reason !== null) {
2052
+ if (data.reason != null) {
2319
2053
  contents.reason = (0, smithy_client_1.expectString)(data.reason);
2320
2054
  }
2321
2055
  const exception = new models_0_1.ValidationException({
@@ -2385,9 +2119,6 @@ const serializeAws_restJson1FindingIdList = (input, context) => {
2385
2119
  return input
2386
2120
  .filter((e) => e != null)
2387
2121
  .map((entry) => {
2388
- if (entry === null) {
2389
- return null;
2390
- }
2391
2122
  return entry;
2392
2123
  });
2393
2124
  };
@@ -2406,9 +2137,6 @@ const serializeAws_restJson1InlineArchiveRulesList = (input, context) => {
2406
2137
  return input
2407
2138
  .filter((e) => e != null)
2408
2139
  .map((entry) => {
2409
- if (entry === null) {
2410
- return null;
2411
- }
2412
2140
  return serializeAws_restJson1InlineArchiveRule(entry, context);
2413
2141
  });
2414
2142
  };
@@ -2443,9 +2171,6 @@ const serializeAws_restJson1KmsGrantConfigurationsList = (input, context) => {
2443
2171
  return input
2444
2172
  .filter((e) => e != null)
2445
2173
  .map((entry) => {
2446
- if (entry === null) {
2447
- return null;
2448
- }
2449
2174
  return serializeAws_restJson1KmsGrantConfiguration(entry, context);
2450
2175
  });
2451
2176
  };
@@ -2463,9 +2188,6 @@ const serializeAws_restJson1KmsGrantOperationsList = (input, context) => {
2463
2188
  return input
2464
2189
  .filter((e) => e != null)
2465
2190
  .map((entry) => {
2466
- if (entry === null) {
2467
- return null;
2468
- }
2469
2191
  return entry;
2470
2192
  });
2471
2193
  };
@@ -2506,9 +2228,6 @@ const serializeAws_restJson1RegionList = (input, context) => {
2506
2228
  return input
2507
2229
  .filter((e) => e != null)
2508
2230
  .map((entry) => {
2509
- if (entry === null) {
2510
- return null;
2511
- }
2512
2231
  return entry;
2513
2232
  });
2514
2233
  };
@@ -2544,9 +2263,6 @@ const serializeAws_restJson1S3BucketAclGrantConfigurationsList = (input, context
2544
2263
  return input
2545
2264
  .filter((e) => e != null)
2546
2265
  .map((entry) => {
2547
- if (entry === null) {
2548
- return null;
2549
- }
2550
2266
  return serializeAws_restJson1S3BucketAclGrantConfiguration(entry, context);
2551
2267
  });
2552
2268
  };
@@ -2609,9 +2325,6 @@ const serializeAws_restJson1TrailList = (input, context) => {
2609
2325
  return input
2610
2326
  .filter((e) => e != null)
2611
2327
  .map((entry) => {
2612
- if (entry === null) {
2613
- return null;
2614
- }
2615
2328
  return serializeAws_restJson1Trail(entry, context);
2616
2329
  });
2617
2330
  };
@@ -2619,9 +2332,6 @@ const serializeAws_restJson1ValueList = (input, context) => {
2619
2332
  return input
2620
2333
  .filter((e) => e != null)
2621
2334
  .map((entry) => {
2622
- if (entry === null) {
2623
- return null;
2624
- }
2625
2335
  return entry;
2626
2336
  });
2627
2337
  };
@@ -2820,27 +2530,27 @@ const deserializeAws_restJson1ConditionKeyMap = (output, context) => {
2820
2530
  }, {});
2821
2531
  };
2822
2532
  const deserializeAws_restJson1Configuration = (output, context) => {
2823
- if (output.iamRole !== undefined && output.iamRole !== null) {
2533
+ if (output.iamRole != null) {
2824
2534
  return {
2825
2535
  iamRole: deserializeAws_restJson1IamRoleConfiguration(output.iamRole, context),
2826
2536
  };
2827
2537
  }
2828
- if (output.kmsKey !== undefined && output.kmsKey !== null) {
2538
+ if (output.kmsKey != null) {
2829
2539
  return {
2830
2540
  kmsKey: deserializeAws_restJson1KmsKeyConfiguration(output.kmsKey, context),
2831
2541
  };
2832
2542
  }
2833
- if (output.s3Bucket !== undefined && output.s3Bucket !== null) {
2543
+ if (output.s3Bucket != null) {
2834
2544
  return {
2835
2545
  s3Bucket: deserializeAws_restJson1S3BucketConfiguration(output.s3Bucket, context),
2836
2546
  };
2837
2547
  }
2838
- if (output.secretsManagerSecret !== undefined && output.secretsManagerSecret !== null) {
2548
+ if (output.secretsManagerSecret != null) {
2839
2549
  return {
2840
2550
  secretsManagerSecret: deserializeAws_restJson1SecretsManagerSecretConfiguration(output.secretsManagerSecret, context),
2841
2551
  };
2842
2552
  }
2843
- if (output.sqsQueue !== undefined && output.sqsQueue !== null) {
2553
+ if (output.sqsQueue != null) {
2844
2554
  return {
2845
2555
  sqsQueue: deserializeAws_restJson1SqsQueueConfiguration(output.sqsQueue, context),
2846
2556
  };
@@ -3093,12 +2803,12 @@ const deserializeAws_restJson1LocationList = (output, context) => {
3093
2803
  return retVal;
3094
2804
  };
3095
2805
  const deserializeAws_restJson1NetworkOriginConfiguration = (output, context) => {
3096
- if (output.internetConfiguration !== undefined && output.internetConfiguration !== null) {
2806
+ if (output.internetConfiguration != null) {
3097
2807
  return {
3098
2808
  internetConfiguration: deserializeAws_restJson1InternetConfiguration(output.internetConfiguration, context),
3099
2809
  };
3100
2810
  }
3101
- if (output.vpcConfiguration !== undefined && output.vpcConfiguration !== null) {
2811
+ if (output.vpcConfiguration != null) {
3102
2812
  return {
3103
2813
  vpcConfiguration: deserializeAws_restJson1VpcConfiguration(output.vpcConfiguration, context),
3104
2814
  };
@@ -3112,7 +2822,7 @@ const deserializeAws_restJson1PathElement = (output, context) => {
3112
2822
  if ((0, smithy_client_1.expectString)(output.key) !== undefined) {
3113
2823
  return { key: (0, smithy_client_1.expectString)(output.key) };
3114
2824
  }
3115
- if (output.substring !== undefined && output.substring !== null) {
2825
+ if (output.substring != null) {
3116
2826
  return {
3117
2827
  substring: deserializeAws_restJson1Substring(output.substring, context),
3118
2828
  };