@aws-sdk/client-codeguru-reviewer 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 (37) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/README.md +1 -1
  3. package/dist-cjs/commands/AssociateRepositoryCommand.js +2 -2
  4. package/dist-cjs/commands/CreateCodeReviewCommand.js +2 -2
  5. package/dist-cjs/commands/DescribeCodeReviewCommand.js +2 -2
  6. package/dist-cjs/commands/DescribeRecommendationFeedbackCommand.js +2 -2
  7. package/dist-cjs/commands/DescribeRepositoryAssociationCommand.js +2 -2
  8. package/dist-cjs/commands/DisassociateRepositoryCommand.js +2 -2
  9. package/dist-cjs/commands/ListCodeReviewsCommand.js +2 -2
  10. package/dist-cjs/commands/ListRecommendationFeedbackCommand.js +2 -2
  11. package/dist-cjs/commands/ListRecommendationsCommand.js +2 -2
  12. package/dist-cjs/commands/ListRepositoryAssociationsCommand.js +2 -2
  13. package/dist-cjs/commands/ListTagsForResourceCommand.js +2 -2
  14. package/dist-cjs/commands/PutRecommendationFeedbackCommand.js +2 -2
  15. package/dist-cjs/commands/TagResourceCommand.js +2 -2
  16. package/dist-cjs/commands/UntagResourceCommand.js +2 -2
  17. package/dist-cjs/models/models_0.js +218 -326
  18. package/dist-cjs/protocols/Aws_restJson1.js +199 -341
  19. package/dist-es/commands/AssociateRepositoryCommand.js +3 -3
  20. package/dist-es/commands/CreateCodeReviewCommand.js +3 -3
  21. package/dist-es/commands/DescribeCodeReviewCommand.js +3 -3
  22. package/dist-es/commands/DescribeRecommendationFeedbackCommand.js +3 -3
  23. package/dist-es/commands/DescribeRepositoryAssociationCommand.js +3 -3
  24. package/dist-es/commands/DisassociateRepositoryCommand.js +3 -3
  25. package/dist-es/commands/ListCodeReviewsCommand.js +3 -3
  26. package/dist-es/commands/ListRecommendationFeedbackCommand.js +3 -3
  27. package/dist-es/commands/ListRecommendationsCommand.js +3 -3
  28. package/dist-es/commands/ListRepositoryAssociationsCommand.js +3 -3
  29. package/dist-es/commands/ListTagsForResourceCommand.js +3 -3
  30. package/dist-es/commands/PutRecommendationFeedbackCommand.js +3 -3
  31. package/dist-es/commands/TagResourceCommand.js +3 -3
  32. package/dist-es/commands/UntagResourceCommand.js +3 -3
  33. package/dist-es/models/models_0.js +54 -216
  34. package/dist-es/protocols/Aws_restJson1.js +251 -324
  35. package/dist-types/models/models_0.d.ts +216 -324
  36. package/dist-types/ts3.4/models/models_0.d.ts +108 -216
  37. package/package.json +6 -6
@@ -62,16 +62,7 @@ const serializeAws_restJson1DescribeCodeReviewCommand = async (input, context) =
62
62
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
63
63
  const headers = {};
64
64
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/codereviews/{CodeReviewArn}";
65
- if (input.CodeReviewArn !== undefined) {
66
- const labelValue = input.CodeReviewArn;
67
- if (labelValue.length <= 0) {
68
- throw new Error("Empty value provided for input HTTP label: CodeReviewArn.");
69
- }
70
- resolvedPath = resolvedPath.replace("{CodeReviewArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
71
- }
72
- else {
73
- throw new Error("No value provided for input HTTP label: CodeReviewArn.");
74
- }
65
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "CodeReviewArn", () => input.CodeReviewArn, "{CodeReviewArn}", false);
75
66
  let body;
76
67
  return new protocol_http_1.HttpRequest({
77
68
  protocol,
@@ -88,20 +79,11 @@ const serializeAws_restJson1DescribeRecommendationFeedbackCommand = async (input
88
79
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
89
80
  const headers = {};
90
81
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/feedback/{CodeReviewArn}";
91
- if (input.CodeReviewArn !== undefined) {
92
- const labelValue = input.CodeReviewArn;
93
- if (labelValue.length <= 0) {
94
- throw new Error("Empty value provided for input HTTP label: CodeReviewArn.");
95
- }
96
- resolvedPath = resolvedPath.replace("{CodeReviewArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
97
- }
98
- else {
99
- throw new Error("No value provided for input HTTP label: CodeReviewArn.");
100
- }
101
- const query = {
102
- ...(input.RecommendationId !== undefined && { RecommendationId: input.RecommendationId }),
103
- ...(input.UserId !== undefined && { UserId: input.UserId }),
104
- };
82
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "CodeReviewArn", () => input.CodeReviewArn, "{CodeReviewArn}", false);
83
+ const query = map({
84
+ RecommendationId: [, input.RecommendationId],
85
+ UserId: [, input.UserId],
86
+ });
105
87
  let body;
106
88
  return new protocol_http_1.HttpRequest({
107
89
  protocol,
@@ -119,16 +101,7 @@ const serializeAws_restJson1DescribeRepositoryAssociationCommand = async (input,
119
101
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
120
102
  const headers = {};
121
103
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/associations/{AssociationArn}";
122
- if (input.AssociationArn !== undefined) {
123
- const labelValue = input.AssociationArn;
124
- if (labelValue.length <= 0) {
125
- throw new Error("Empty value provided for input HTTP label: AssociationArn.");
126
- }
127
- resolvedPath = resolvedPath.replace("{AssociationArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
128
- }
129
- else {
130
- throw new Error("No value provided for input HTTP label: AssociationArn.");
131
- }
104
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "AssociationArn", () => input.AssociationArn, "{AssociationArn}", false);
132
105
  let body;
133
106
  return new protocol_http_1.HttpRequest({
134
107
  protocol,
@@ -145,16 +118,7 @@ const serializeAws_restJson1DisassociateRepositoryCommand = async (input, contex
145
118
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
146
119
  const headers = {};
147
120
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/associations/{AssociationArn}";
148
- if (input.AssociationArn !== undefined) {
149
- const labelValue = input.AssociationArn;
150
- if (labelValue.length <= 0) {
151
- throw new Error("Empty value provided for input HTTP label: AssociationArn.");
152
- }
153
- resolvedPath = resolvedPath.replace("{AssociationArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
154
- }
155
- else {
156
- throw new Error("No value provided for input HTTP label: AssociationArn.");
157
- }
121
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "AssociationArn", () => input.AssociationArn, "{AssociationArn}", false);
158
122
  let body;
159
123
  return new protocol_http_1.HttpRequest({
160
124
  protocol,
@@ -171,18 +135,20 @@ const serializeAws_restJson1ListCodeReviewsCommand = async (input, context) => {
171
135
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
172
136
  const headers = {};
173
137
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/codereviews";
174
- const query = {
175
- ...(input.ProviderTypes !== undefined && {
176
- ProviderTypes: (input.ProviderTypes || []).map((_entry) => _entry),
177
- }),
178
- ...(input.States !== undefined && { States: (input.States || []).map((_entry) => _entry) }),
179
- ...(input.RepositoryNames !== undefined && {
180
- RepositoryNames: (input.RepositoryNames || []).map((_entry) => _entry),
181
- }),
182
- ...(input.Type !== undefined && { Type: input.Type }),
183
- ...(input.MaxResults !== undefined && { MaxResults: input.MaxResults.toString() }),
184
- ...(input.NextToken !== undefined && { NextToken: input.NextToken }),
185
- };
138
+ const query = map({
139
+ ProviderTypes: [
140
+ () => input.ProviderTypes !== void 0,
141
+ () => (input.ProviderTypes || []).map((_entry) => _entry),
142
+ ],
143
+ States: [() => input.States !== void 0, () => (input.States || []).map((_entry) => _entry)],
144
+ RepositoryNames: [
145
+ () => input.RepositoryNames !== void 0,
146
+ () => (input.RepositoryNames || []).map((_entry) => _entry),
147
+ ],
148
+ Type: [, input.Type],
149
+ MaxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
150
+ NextToken: [, input.NextToken],
151
+ });
186
152
  let body;
187
153
  return new protocol_http_1.HttpRequest({
188
154
  protocol,
@@ -201,24 +167,16 @@ const serializeAws_restJson1ListRecommendationFeedbackCommand = async (input, co
201
167
  const headers = {};
202
168
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
203
169
  "/feedback/{CodeReviewArn}/RecommendationFeedback";
204
- if (input.CodeReviewArn !== undefined) {
205
- const labelValue = input.CodeReviewArn;
206
- if (labelValue.length <= 0) {
207
- throw new Error("Empty value provided for input HTTP label: CodeReviewArn.");
208
- }
209
- resolvedPath = resolvedPath.replace("{CodeReviewArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
210
- }
211
- else {
212
- throw new Error("No value provided for input HTTP label: CodeReviewArn.");
213
- }
214
- const query = {
215
- ...(input.NextToken !== undefined && { NextToken: input.NextToken }),
216
- ...(input.MaxResults !== undefined && { MaxResults: input.MaxResults.toString() }),
217
- ...(input.UserIds !== undefined && { UserIds: (input.UserIds || []).map((_entry) => _entry) }),
218
- ...(input.RecommendationIds !== undefined && {
219
- RecommendationIds: (input.RecommendationIds || []).map((_entry) => _entry),
220
- }),
221
- };
170
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "CodeReviewArn", () => input.CodeReviewArn, "{CodeReviewArn}", false);
171
+ const query = map({
172
+ NextToken: [, input.NextToken],
173
+ MaxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
174
+ UserIds: [() => input.UserIds !== void 0, () => (input.UserIds || []).map((_entry) => _entry)],
175
+ RecommendationIds: [
176
+ () => input.RecommendationIds !== void 0,
177
+ () => (input.RecommendationIds || []).map((_entry) => _entry),
178
+ ],
179
+ });
222
180
  let body;
223
181
  return new protocol_http_1.HttpRequest({
224
182
  protocol,
@@ -237,20 +195,11 @@ const serializeAws_restJson1ListRecommendationsCommand = async (input, context)
237
195
  const headers = {};
238
196
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
239
197
  "/codereviews/{CodeReviewArn}/Recommendations";
240
- if (input.CodeReviewArn !== undefined) {
241
- const labelValue = input.CodeReviewArn;
242
- if (labelValue.length <= 0) {
243
- throw new Error("Empty value provided for input HTTP label: CodeReviewArn.");
244
- }
245
- resolvedPath = resolvedPath.replace("{CodeReviewArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
246
- }
247
- else {
248
- throw new Error("No value provided for input HTTP label: CodeReviewArn.");
249
- }
250
- const query = {
251
- ...(input.NextToken !== undefined && { NextToken: input.NextToken }),
252
- ...(input.MaxResults !== undefined && { MaxResults: input.MaxResults.toString() }),
253
- };
198
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "CodeReviewArn", () => input.CodeReviewArn, "{CodeReviewArn}", false);
199
+ const query = map({
200
+ NextToken: [, input.NextToken],
201
+ MaxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
202
+ });
254
203
  let body;
255
204
  return new protocol_http_1.HttpRequest({
256
205
  protocol,
@@ -268,16 +217,17 @@ const serializeAws_restJson1ListRepositoryAssociationsCommand = async (input, co
268
217
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
269
218
  const headers = {};
270
219
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/associations";
271
- const query = {
272
- ...(input.ProviderTypes !== undefined && {
273
- ProviderType: (input.ProviderTypes || []).map((_entry) => _entry),
274
- }),
275
- ...(input.States !== undefined && { State: (input.States || []).map((_entry) => _entry) }),
276
- ...(input.Names !== undefined && { Name: (input.Names || []).map((_entry) => _entry) }),
277
- ...(input.Owners !== undefined && { Owner: (input.Owners || []).map((_entry) => _entry) }),
278
- ...(input.MaxResults !== undefined && { MaxResults: input.MaxResults.toString() }),
279
- ...(input.NextToken !== undefined && { NextToken: input.NextToken }),
280
- };
220
+ const query = map({
221
+ ProviderType: [
222
+ () => input.ProviderTypes !== void 0,
223
+ () => (input.ProviderTypes || []).map((_entry) => _entry),
224
+ ],
225
+ State: [() => input.States !== void 0, () => (input.States || []).map((_entry) => _entry)],
226
+ Name: [() => input.Names !== void 0, () => (input.Names || []).map((_entry) => _entry)],
227
+ Owner: [() => input.Owners !== void 0, () => (input.Owners || []).map((_entry) => _entry)],
228
+ MaxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
229
+ NextToken: [, input.NextToken],
230
+ });
281
231
  let body;
282
232
  return new protocol_http_1.HttpRequest({
283
233
  protocol,
@@ -295,16 +245,7 @@ const serializeAws_restJson1ListTagsForResourceCommand = async (input, context)
295
245
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
296
246
  const headers = {};
297
247
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
298
- if (input.resourceArn !== undefined) {
299
- const labelValue = input.resourceArn;
300
- if (labelValue.length <= 0) {
301
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
302
- }
303
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
304
- }
305
- else {
306
- throw new Error("No value provided for input HTTP label: resourceArn.");
307
- }
248
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
308
249
  let body;
309
250
  return new protocol_http_1.HttpRequest({
310
251
  protocol,
@@ -346,16 +287,7 @@ const serializeAws_restJson1TagResourceCommand = async (input, context) => {
346
287
  "content-type": "application/json",
347
288
  };
348
289
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
349
- if (input.resourceArn !== undefined) {
350
- const labelValue = input.resourceArn;
351
- if (labelValue.length <= 0) {
352
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
353
- }
354
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
355
- }
356
- else {
357
- throw new Error("No value provided for input HTTP label: resourceArn.");
358
- }
290
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
359
291
  let body;
360
292
  body = JSON.stringify({
361
293
  ...(input.Tags != null && { Tags: serializeAws_restJson1TagMap(input.Tags, context) }),
@@ -375,19 +307,10 @@ const serializeAws_restJson1UntagResourceCommand = async (input, context) => {
375
307
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
376
308
  const headers = {};
377
309
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
378
- if (input.resourceArn !== undefined) {
379
- const labelValue = input.resourceArn;
380
- if (labelValue.length <= 0) {
381
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
382
- }
383
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
384
- }
385
- else {
386
- throw new Error("No value provided for input HTTP label: resourceArn.");
387
- }
388
- const query = {
389
- ...(input.TagKeys !== undefined && { tagKeys: (input.TagKeys || []).map((_entry) => _entry) }),
390
- };
310
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
311
+ const query = map({
312
+ tagKeys: [() => input.TagKeys !== void 0, () => (input.TagKeys || []).map((_entry) => _entry)],
313
+ });
391
314
  let body;
392
315
  return new protocol_http_1.HttpRequest({
393
316
  protocol,
@@ -405,19 +328,17 @@ const deserializeAws_restJson1AssociateRepositoryCommand = async (output, contex
405
328
  if (output.statusCode !== 200 && output.statusCode >= 300) {
406
329
  return deserializeAws_restJson1AssociateRepositoryCommandError(output, context);
407
330
  }
408
- const contents = {
331
+ const contents = map({
409
332
  $metadata: deserializeMetadata(output),
410
- RepositoryAssociation: undefined,
411
- Tags: undefined,
412
- };
333
+ });
413
334
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
414
- if (data.RepositoryAssociation !== undefined && data.RepositoryAssociation !== null) {
335
+ if (data.RepositoryAssociation != null) {
415
336
  contents.RepositoryAssociation = deserializeAws_restJson1RepositoryAssociation(data.RepositoryAssociation, context);
416
337
  }
417
- if (data.Tags !== undefined && data.Tags !== null) {
338
+ if (data.Tags != null) {
418
339
  contents.Tags = deserializeAws_restJson1TagMap(data.Tags, context);
419
340
  }
420
- return Promise.resolve(contents);
341
+ return contents;
421
342
  };
422
343
  exports.deserializeAws_restJson1AssociateRepositoryCommand = deserializeAws_restJson1AssociateRepositoryCommand;
423
344
  const deserializeAws_restJson1AssociateRepositoryCommandError = async (output, context) => {
@@ -425,7 +346,6 @@ const deserializeAws_restJson1AssociateRepositoryCommandError = async (output, c
425
346
  ...output,
426
347
  body: await parseBody(output.body, context),
427
348
  };
428
- let response;
429
349
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
430
350
  switch (errorCode) {
431
351
  case "AccessDeniedException":
@@ -445,29 +365,26 @@ const deserializeAws_restJson1AssociateRepositoryCommandError = async (output, c
445
365
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
446
366
  default:
447
367
  const parsedBody = parsedOutput.body;
448
- const $metadata = deserializeMetadata(output);
449
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
450
- response = new CodeGuruReviewerServiceException_1.CodeGuruReviewerServiceException({
451
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
452
- $fault: "client",
453
- $metadata,
368
+ (0, smithy_client_1.throwDefaultError)({
369
+ output,
370
+ parsedBody,
371
+ exceptionCtor: CodeGuruReviewerServiceException_1.CodeGuruReviewerServiceException,
372
+ errorCode,
454
373
  });
455
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
456
374
  }
457
375
  };
458
376
  const deserializeAws_restJson1CreateCodeReviewCommand = async (output, context) => {
459
377
  if (output.statusCode !== 200 && output.statusCode >= 300) {
460
378
  return deserializeAws_restJson1CreateCodeReviewCommandError(output, context);
461
379
  }
462
- const contents = {
380
+ const contents = map({
463
381
  $metadata: deserializeMetadata(output),
464
- CodeReview: undefined,
465
- };
382
+ });
466
383
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
467
- if (data.CodeReview !== undefined && data.CodeReview !== null) {
384
+ if (data.CodeReview != null) {
468
385
  contents.CodeReview = deserializeAws_restJson1CodeReview(data.CodeReview, context);
469
386
  }
470
- return Promise.resolve(contents);
387
+ return contents;
471
388
  };
472
389
  exports.deserializeAws_restJson1CreateCodeReviewCommand = deserializeAws_restJson1CreateCodeReviewCommand;
473
390
  const deserializeAws_restJson1CreateCodeReviewCommandError = async (output, context) => {
@@ -475,7 +392,6 @@ const deserializeAws_restJson1CreateCodeReviewCommandError = async (output, cont
475
392
  ...output,
476
393
  body: await parseBody(output.body, context),
477
394
  };
478
- let response;
479
395
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
480
396
  switch (errorCode) {
481
397
  case "AccessDeniedException":
@@ -498,29 +414,26 @@ const deserializeAws_restJson1CreateCodeReviewCommandError = async (output, cont
498
414
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
499
415
  default:
500
416
  const parsedBody = parsedOutput.body;
501
- const $metadata = deserializeMetadata(output);
502
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
503
- response = new CodeGuruReviewerServiceException_1.CodeGuruReviewerServiceException({
504
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
505
- $fault: "client",
506
- $metadata,
417
+ (0, smithy_client_1.throwDefaultError)({
418
+ output,
419
+ parsedBody,
420
+ exceptionCtor: CodeGuruReviewerServiceException_1.CodeGuruReviewerServiceException,
421
+ errorCode,
507
422
  });
508
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
509
423
  }
510
424
  };
511
425
  const deserializeAws_restJson1DescribeCodeReviewCommand = async (output, context) => {
512
426
  if (output.statusCode !== 200 && output.statusCode >= 300) {
513
427
  return deserializeAws_restJson1DescribeCodeReviewCommandError(output, context);
514
428
  }
515
- const contents = {
429
+ const contents = map({
516
430
  $metadata: deserializeMetadata(output),
517
- CodeReview: undefined,
518
- };
431
+ });
519
432
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
520
- if (data.CodeReview !== undefined && data.CodeReview !== null) {
433
+ if (data.CodeReview != null) {
521
434
  contents.CodeReview = deserializeAws_restJson1CodeReview(data.CodeReview, context);
522
435
  }
523
- return Promise.resolve(contents);
436
+ return contents;
524
437
  };
525
438
  exports.deserializeAws_restJson1DescribeCodeReviewCommand = deserializeAws_restJson1DescribeCodeReviewCommand;
526
439
  const deserializeAws_restJson1DescribeCodeReviewCommandError = async (output, context) => {
@@ -528,7 +441,6 @@ const deserializeAws_restJson1DescribeCodeReviewCommandError = async (output, co
528
441
  ...output,
529
442
  body: await parseBody(output.body, context),
530
443
  };
531
- let response;
532
444
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
533
445
  switch (errorCode) {
534
446
  case "AccessDeniedException":
@@ -548,29 +460,26 @@ const deserializeAws_restJson1DescribeCodeReviewCommandError = async (output, co
548
460
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
549
461
  default:
550
462
  const parsedBody = parsedOutput.body;
551
- const $metadata = deserializeMetadata(output);
552
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
553
- response = new CodeGuruReviewerServiceException_1.CodeGuruReviewerServiceException({
554
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
555
- $fault: "client",
556
- $metadata,
463
+ (0, smithy_client_1.throwDefaultError)({
464
+ output,
465
+ parsedBody,
466
+ exceptionCtor: CodeGuruReviewerServiceException_1.CodeGuruReviewerServiceException,
467
+ errorCode,
557
468
  });
558
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
559
469
  }
560
470
  };
561
471
  const deserializeAws_restJson1DescribeRecommendationFeedbackCommand = async (output, context) => {
562
472
  if (output.statusCode !== 200 && output.statusCode >= 300) {
563
473
  return deserializeAws_restJson1DescribeRecommendationFeedbackCommandError(output, context);
564
474
  }
565
- const contents = {
475
+ const contents = map({
566
476
  $metadata: deserializeMetadata(output),
567
- RecommendationFeedback: undefined,
568
- };
477
+ });
569
478
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
570
- if (data.RecommendationFeedback !== undefined && data.RecommendationFeedback !== null) {
479
+ if (data.RecommendationFeedback != null) {
571
480
  contents.RecommendationFeedback = deserializeAws_restJson1RecommendationFeedback(data.RecommendationFeedback, context);
572
481
  }
573
- return Promise.resolve(contents);
482
+ return contents;
574
483
  };
575
484
  exports.deserializeAws_restJson1DescribeRecommendationFeedbackCommand = deserializeAws_restJson1DescribeRecommendationFeedbackCommand;
576
485
  const deserializeAws_restJson1DescribeRecommendationFeedbackCommandError = async (output, context) => {
@@ -578,7 +487,6 @@ const deserializeAws_restJson1DescribeRecommendationFeedbackCommandError = async
578
487
  ...output,
579
488
  body: await parseBody(output.body, context),
580
489
  };
581
- let response;
582
490
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
583
491
  switch (errorCode) {
584
492
  case "AccessDeniedException":
@@ -598,33 +506,29 @@ const deserializeAws_restJson1DescribeRecommendationFeedbackCommandError = async
598
506
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
599
507
  default:
600
508
  const parsedBody = parsedOutput.body;
601
- const $metadata = deserializeMetadata(output);
602
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
603
- response = new CodeGuruReviewerServiceException_1.CodeGuruReviewerServiceException({
604
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
605
- $fault: "client",
606
- $metadata,
509
+ (0, smithy_client_1.throwDefaultError)({
510
+ output,
511
+ parsedBody,
512
+ exceptionCtor: CodeGuruReviewerServiceException_1.CodeGuruReviewerServiceException,
513
+ errorCode,
607
514
  });
608
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
609
515
  }
610
516
  };
611
517
  const deserializeAws_restJson1DescribeRepositoryAssociationCommand = async (output, context) => {
612
518
  if (output.statusCode !== 200 && output.statusCode >= 300) {
613
519
  return deserializeAws_restJson1DescribeRepositoryAssociationCommandError(output, context);
614
520
  }
615
- const contents = {
521
+ const contents = map({
616
522
  $metadata: deserializeMetadata(output),
617
- RepositoryAssociation: undefined,
618
- Tags: undefined,
619
- };
523
+ });
620
524
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
621
- if (data.RepositoryAssociation !== undefined && data.RepositoryAssociation !== null) {
525
+ if (data.RepositoryAssociation != null) {
622
526
  contents.RepositoryAssociation = deserializeAws_restJson1RepositoryAssociation(data.RepositoryAssociation, context);
623
527
  }
624
- if (data.Tags !== undefined && data.Tags !== null) {
528
+ if (data.Tags != null) {
625
529
  contents.Tags = deserializeAws_restJson1TagMap(data.Tags, context);
626
530
  }
627
- return Promise.resolve(contents);
531
+ return contents;
628
532
  };
629
533
  exports.deserializeAws_restJson1DescribeRepositoryAssociationCommand = deserializeAws_restJson1DescribeRepositoryAssociationCommand;
630
534
  const deserializeAws_restJson1DescribeRepositoryAssociationCommandError = async (output, context) => {
@@ -632,7 +536,6 @@ const deserializeAws_restJson1DescribeRepositoryAssociationCommandError = async
632
536
  ...output,
633
537
  body: await parseBody(output.body, context),
634
538
  };
635
- let response;
636
539
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
637
540
  switch (errorCode) {
638
541
  case "AccessDeniedException":
@@ -652,33 +555,29 @@ const deserializeAws_restJson1DescribeRepositoryAssociationCommandError = async
652
555
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
653
556
  default:
654
557
  const parsedBody = parsedOutput.body;
655
- const $metadata = deserializeMetadata(output);
656
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
657
- response = new CodeGuruReviewerServiceException_1.CodeGuruReviewerServiceException({
658
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
659
- $fault: "client",
660
- $metadata,
558
+ (0, smithy_client_1.throwDefaultError)({
559
+ output,
560
+ parsedBody,
561
+ exceptionCtor: CodeGuruReviewerServiceException_1.CodeGuruReviewerServiceException,
562
+ errorCode,
661
563
  });
662
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
663
564
  }
664
565
  };
665
566
  const deserializeAws_restJson1DisassociateRepositoryCommand = async (output, context) => {
666
567
  if (output.statusCode !== 200 && output.statusCode >= 300) {
667
568
  return deserializeAws_restJson1DisassociateRepositoryCommandError(output, context);
668
569
  }
669
- const contents = {
570
+ const contents = map({
670
571
  $metadata: deserializeMetadata(output),
671
- RepositoryAssociation: undefined,
672
- Tags: undefined,
673
- };
572
+ });
674
573
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
675
- if (data.RepositoryAssociation !== undefined && data.RepositoryAssociation !== null) {
574
+ if (data.RepositoryAssociation != null) {
676
575
  contents.RepositoryAssociation = deserializeAws_restJson1RepositoryAssociation(data.RepositoryAssociation, context);
677
576
  }
678
- if (data.Tags !== undefined && data.Tags !== null) {
577
+ if (data.Tags != null) {
679
578
  contents.Tags = deserializeAws_restJson1TagMap(data.Tags, context);
680
579
  }
681
- return Promise.resolve(contents);
580
+ return contents;
682
581
  };
683
582
  exports.deserializeAws_restJson1DisassociateRepositoryCommand = deserializeAws_restJson1DisassociateRepositoryCommand;
684
583
  const deserializeAws_restJson1DisassociateRepositoryCommandError = async (output, context) => {
@@ -686,7 +585,6 @@ const deserializeAws_restJson1DisassociateRepositoryCommandError = async (output
686
585
  ...output,
687
586
  body: await parseBody(output.body, context),
688
587
  };
689
- let response;
690
588
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
691
589
  switch (errorCode) {
692
590
  case "AccessDeniedException":
@@ -709,33 +607,29 @@ const deserializeAws_restJson1DisassociateRepositoryCommandError = async (output
709
607
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
710
608
  default:
711
609
  const parsedBody = parsedOutput.body;
712
- const $metadata = deserializeMetadata(output);
713
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
714
- response = new CodeGuruReviewerServiceException_1.CodeGuruReviewerServiceException({
715
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
716
- $fault: "client",
717
- $metadata,
610
+ (0, smithy_client_1.throwDefaultError)({
611
+ output,
612
+ parsedBody,
613
+ exceptionCtor: CodeGuruReviewerServiceException_1.CodeGuruReviewerServiceException,
614
+ errorCode,
718
615
  });
719
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
720
616
  }
721
617
  };
722
618
  const deserializeAws_restJson1ListCodeReviewsCommand = async (output, context) => {
723
619
  if (output.statusCode !== 200 && output.statusCode >= 300) {
724
620
  return deserializeAws_restJson1ListCodeReviewsCommandError(output, context);
725
621
  }
726
- const contents = {
622
+ const contents = map({
727
623
  $metadata: deserializeMetadata(output),
728
- CodeReviewSummaries: undefined,
729
- NextToken: undefined,
730
- };
624
+ });
731
625
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
732
- if (data.CodeReviewSummaries !== undefined && data.CodeReviewSummaries !== null) {
626
+ if (data.CodeReviewSummaries != null) {
733
627
  contents.CodeReviewSummaries = deserializeAws_restJson1CodeReviewSummaries(data.CodeReviewSummaries, context);
734
628
  }
735
- if (data.NextToken !== undefined && data.NextToken !== null) {
629
+ if (data.NextToken != null) {
736
630
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
737
631
  }
738
- return Promise.resolve(contents);
632
+ return contents;
739
633
  };
740
634
  exports.deserializeAws_restJson1ListCodeReviewsCommand = deserializeAws_restJson1ListCodeReviewsCommand;
741
635
  const deserializeAws_restJson1ListCodeReviewsCommandError = async (output, context) => {
@@ -743,7 +637,6 @@ const deserializeAws_restJson1ListCodeReviewsCommandError = async (output, conte
743
637
  ...output,
744
638
  body: await parseBody(output.body, context),
745
639
  };
746
- let response;
747
640
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
748
641
  switch (errorCode) {
749
642
  case "AccessDeniedException":
@@ -760,33 +653,29 @@ const deserializeAws_restJson1ListCodeReviewsCommandError = async (output, conte
760
653
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
761
654
  default:
762
655
  const parsedBody = parsedOutput.body;
763
- const $metadata = deserializeMetadata(output);
764
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
765
- response = new CodeGuruReviewerServiceException_1.CodeGuruReviewerServiceException({
766
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
767
- $fault: "client",
768
- $metadata,
656
+ (0, smithy_client_1.throwDefaultError)({
657
+ output,
658
+ parsedBody,
659
+ exceptionCtor: CodeGuruReviewerServiceException_1.CodeGuruReviewerServiceException,
660
+ errorCode,
769
661
  });
770
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
771
662
  }
772
663
  };
773
664
  const deserializeAws_restJson1ListRecommendationFeedbackCommand = async (output, context) => {
774
665
  if (output.statusCode !== 200 && output.statusCode >= 300) {
775
666
  return deserializeAws_restJson1ListRecommendationFeedbackCommandError(output, context);
776
667
  }
777
- const contents = {
668
+ const contents = map({
778
669
  $metadata: deserializeMetadata(output),
779
- NextToken: undefined,
780
- RecommendationFeedbackSummaries: undefined,
781
- };
670
+ });
782
671
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
783
- if (data.NextToken !== undefined && data.NextToken !== null) {
672
+ if (data.NextToken != null) {
784
673
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
785
674
  }
786
- if (data.RecommendationFeedbackSummaries !== undefined && data.RecommendationFeedbackSummaries !== null) {
675
+ if (data.RecommendationFeedbackSummaries != null) {
787
676
  contents.RecommendationFeedbackSummaries = deserializeAws_restJson1RecommendationFeedbackSummaries(data.RecommendationFeedbackSummaries, context);
788
677
  }
789
- return Promise.resolve(contents);
678
+ return contents;
790
679
  };
791
680
  exports.deserializeAws_restJson1ListRecommendationFeedbackCommand = deserializeAws_restJson1ListRecommendationFeedbackCommand;
792
681
  const deserializeAws_restJson1ListRecommendationFeedbackCommandError = async (output, context) => {
@@ -794,7 +683,6 @@ const deserializeAws_restJson1ListRecommendationFeedbackCommandError = async (ou
794
683
  ...output,
795
684
  body: await parseBody(output.body, context),
796
685
  };
797
- let response;
798
686
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
799
687
  switch (errorCode) {
800
688
  case "AccessDeniedException":
@@ -814,33 +702,29 @@ const deserializeAws_restJson1ListRecommendationFeedbackCommandError = async (ou
814
702
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
815
703
  default:
816
704
  const parsedBody = parsedOutput.body;
817
- const $metadata = deserializeMetadata(output);
818
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
819
- response = new CodeGuruReviewerServiceException_1.CodeGuruReviewerServiceException({
820
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
821
- $fault: "client",
822
- $metadata,
705
+ (0, smithy_client_1.throwDefaultError)({
706
+ output,
707
+ parsedBody,
708
+ exceptionCtor: CodeGuruReviewerServiceException_1.CodeGuruReviewerServiceException,
709
+ errorCode,
823
710
  });
824
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
825
711
  }
826
712
  };
827
713
  const deserializeAws_restJson1ListRecommendationsCommand = async (output, context) => {
828
714
  if (output.statusCode !== 200 && output.statusCode >= 300) {
829
715
  return deserializeAws_restJson1ListRecommendationsCommandError(output, context);
830
716
  }
831
- const contents = {
717
+ const contents = map({
832
718
  $metadata: deserializeMetadata(output),
833
- NextToken: undefined,
834
- RecommendationSummaries: undefined,
835
- };
719
+ });
836
720
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
837
- if (data.NextToken !== undefined && data.NextToken !== null) {
721
+ if (data.NextToken != null) {
838
722
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
839
723
  }
840
- if (data.RecommendationSummaries !== undefined && data.RecommendationSummaries !== null) {
724
+ if (data.RecommendationSummaries != null) {
841
725
  contents.RecommendationSummaries = deserializeAws_restJson1RecommendationSummaries(data.RecommendationSummaries, context);
842
726
  }
843
- return Promise.resolve(contents);
727
+ return contents;
844
728
  };
845
729
  exports.deserializeAws_restJson1ListRecommendationsCommand = deserializeAws_restJson1ListRecommendationsCommand;
846
730
  const deserializeAws_restJson1ListRecommendationsCommandError = async (output, context) => {
@@ -848,7 +732,6 @@ const deserializeAws_restJson1ListRecommendationsCommandError = async (output, c
848
732
  ...output,
849
733
  body: await parseBody(output.body, context),
850
734
  };
851
- let response;
852
735
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
853
736
  switch (errorCode) {
854
737
  case "AccessDeniedException":
@@ -868,33 +751,29 @@ const deserializeAws_restJson1ListRecommendationsCommandError = async (output, c
868
751
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
869
752
  default:
870
753
  const parsedBody = parsedOutput.body;
871
- const $metadata = deserializeMetadata(output);
872
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
873
- response = new CodeGuruReviewerServiceException_1.CodeGuruReviewerServiceException({
874
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
875
- $fault: "client",
876
- $metadata,
754
+ (0, smithy_client_1.throwDefaultError)({
755
+ output,
756
+ parsedBody,
757
+ exceptionCtor: CodeGuruReviewerServiceException_1.CodeGuruReviewerServiceException,
758
+ errorCode,
877
759
  });
878
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
879
760
  }
880
761
  };
881
762
  const deserializeAws_restJson1ListRepositoryAssociationsCommand = async (output, context) => {
882
763
  if (output.statusCode !== 200 && output.statusCode >= 300) {
883
764
  return deserializeAws_restJson1ListRepositoryAssociationsCommandError(output, context);
884
765
  }
885
- const contents = {
766
+ const contents = map({
886
767
  $metadata: deserializeMetadata(output),
887
- NextToken: undefined,
888
- RepositoryAssociationSummaries: undefined,
889
- };
768
+ });
890
769
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
891
- if (data.NextToken !== undefined && data.NextToken !== null) {
770
+ if (data.NextToken != null) {
892
771
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
893
772
  }
894
- if (data.RepositoryAssociationSummaries !== undefined && data.RepositoryAssociationSummaries !== null) {
773
+ if (data.RepositoryAssociationSummaries != null) {
895
774
  contents.RepositoryAssociationSummaries = deserializeAws_restJson1RepositoryAssociationSummaries(data.RepositoryAssociationSummaries, context);
896
775
  }
897
- return Promise.resolve(contents);
776
+ return contents;
898
777
  };
899
778
  exports.deserializeAws_restJson1ListRepositoryAssociationsCommand = deserializeAws_restJson1ListRepositoryAssociationsCommand;
900
779
  const deserializeAws_restJson1ListRepositoryAssociationsCommandError = async (output, context) => {
@@ -902,7 +781,6 @@ const deserializeAws_restJson1ListRepositoryAssociationsCommandError = async (ou
902
781
  ...output,
903
782
  body: await parseBody(output.body, context),
904
783
  };
905
- let response;
906
784
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
907
785
  switch (errorCode) {
908
786
  case "InternalServerException":
@@ -916,29 +794,26 @@ const deserializeAws_restJson1ListRepositoryAssociationsCommandError = async (ou
916
794
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
917
795
  default:
918
796
  const parsedBody = parsedOutput.body;
919
- const $metadata = deserializeMetadata(output);
920
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
921
- response = new CodeGuruReviewerServiceException_1.CodeGuruReviewerServiceException({
922
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
923
- $fault: "client",
924
- $metadata,
797
+ (0, smithy_client_1.throwDefaultError)({
798
+ output,
799
+ parsedBody,
800
+ exceptionCtor: CodeGuruReviewerServiceException_1.CodeGuruReviewerServiceException,
801
+ errorCode,
925
802
  });
926
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
927
803
  }
928
804
  };
929
805
  const deserializeAws_restJson1ListTagsForResourceCommand = async (output, context) => {
930
806
  if (output.statusCode !== 200 && output.statusCode >= 300) {
931
807
  return deserializeAws_restJson1ListTagsForResourceCommandError(output, context);
932
808
  }
933
- const contents = {
809
+ const contents = map({
934
810
  $metadata: deserializeMetadata(output),
935
- Tags: undefined,
936
- };
811
+ });
937
812
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
938
- if (data.Tags !== undefined && data.Tags !== null) {
813
+ if (data.Tags != null) {
939
814
  contents.Tags = deserializeAws_restJson1TagMap(data.Tags, context);
940
815
  }
941
- return Promise.resolve(contents);
816
+ return contents;
942
817
  };
943
818
  exports.deserializeAws_restJson1ListTagsForResourceCommand = deserializeAws_restJson1ListTagsForResourceCommand;
944
819
  const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, context) => {
@@ -946,7 +821,6 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
946
821
  ...output,
947
822
  body: await parseBody(output.body, context),
948
823
  };
949
- let response;
950
824
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
951
825
  switch (errorCode) {
952
826
  case "InternalServerException":
@@ -960,25 +834,23 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
960
834
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
961
835
  default:
962
836
  const parsedBody = parsedOutput.body;
963
- const $metadata = deserializeMetadata(output);
964
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
965
- response = new CodeGuruReviewerServiceException_1.CodeGuruReviewerServiceException({
966
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
967
- $fault: "client",
968
- $metadata,
837
+ (0, smithy_client_1.throwDefaultError)({
838
+ output,
839
+ parsedBody,
840
+ exceptionCtor: CodeGuruReviewerServiceException_1.CodeGuruReviewerServiceException,
841
+ errorCode,
969
842
  });
970
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
971
843
  }
972
844
  };
973
845
  const deserializeAws_restJson1PutRecommendationFeedbackCommand = async (output, context) => {
974
846
  if (output.statusCode !== 200 && output.statusCode >= 300) {
975
847
  return deserializeAws_restJson1PutRecommendationFeedbackCommandError(output, context);
976
848
  }
977
- const contents = {
849
+ const contents = map({
978
850
  $metadata: deserializeMetadata(output),
979
- };
851
+ });
980
852
  await collectBody(output.body, context);
981
- return Promise.resolve(contents);
853
+ return contents;
982
854
  };
983
855
  exports.deserializeAws_restJson1PutRecommendationFeedbackCommand = deserializeAws_restJson1PutRecommendationFeedbackCommand;
984
856
  const deserializeAws_restJson1PutRecommendationFeedbackCommandError = async (output, context) => {
@@ -986,7 +858,6 @@ const deserializeAws_restJson1PutRecommendationFeedbackCommandError = async (out
986
858
  ...output,
987
859
  body: await parseBody(output.body, context),
988
860
  };
989
- let response;
990
861
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
991
862
  switch (errorCode) {
992
863
  case "AccessDeniedException":
@@ -1006,25 +877,23 @@ const deserializeAws_restJson1PutRecommendationFeedbackCommandError = async (out
1006
877
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1007
878
  default:
1008
879
  const parsedBody = parsedOutput.body;
1009
- const $metadata = deserializeMetadata(output);
1010
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1011
- response = new CodeGuruReviewerServiceException_1.CodeGuruReviewerServiceException({
1012
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1013
- $fault: "client",
1014
- $metadata,
880
+ (0, smithy_client_1.throwDefaultError)({
881
+ output,
882
+ parsedBody,
883
+ exceptionCtor: CodeGuruReviewerServiceException_1.CodeGuruReviewerServiceException,
884
+ errorCode,
1015
885
  });
1016
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1017
886
  }
1018
887
  };
1019
888
  const deserializeAws_restJson1TagResourceCommand = async (output, context) => {
1020
889
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1021
890
  return deserializeAws_restJson1TagResourceCommandError(output, context);
1022
891
  }
1023
- const contents = {
892
+ const contents = map({
1024
893
  $metadata: deserializeMetadata(output),
1025
- };
894
+ });
1026
895
  await collectBody(output.body, context);
1027
- return Promise.resolve(contents);
896
+ return contents;
1028
897
  };
1029
898
  exports.deserializeAws_restJson1TagResourceCommand = deserializeAws_restJson1TagResourceCommand;
1030
899
  const deserializeAws_restJson1TagResourceCommandError = async (output, context) => {
@@ -1032,7 +901,6 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
1032
901
  ...output,
1033
902
  body: await parseBody(output.body, context),
1034
903
  };
1035
- let response;
1036
904
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1037
905
  switch (errorCode) {
1038
906
  case "InternalServerException":
@@ -1046,25 +914,23 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
1046
914
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1047
915
  default:
1048
916
  const parsedBody = parsedOutput.body;
1049
- const $metadata = deserializeMetadata(output);
1050
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1051
- response = new CodeGuruReviewerServiceException_1.CodeGuruReviewerServiceException({
1052
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1053
- $fault: "client",
1054
- $metadata,
917
+ (0, smithy_client_1.throwDefaultError)({
918
+ output,
919
+ parsedBody,
920
+ exceptionCtor: CodeGuruReviewerServiceException_1.CodeGuruReviewerServiceException,
921
+ errorCode,
1055
922
  });
1056
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1057
923
  }
1058
924
  };
1059
925
  const deserializeAws_restJson1UntagResourceCommand = async (output, context) => {
1060
926
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1061
927
  return deserializeAws_restJson1UntagResourceCommandError(output, context);
1062
928
  }
1063
- const contents = {
929
+ const contents = map({
1064
930
  $metadata: deserializeMetadata(output),
1065
- };
931
+ });
1066
932
  await collectBody(output.body, context);
1067
- return Promise.resolve(contents);
933
+ return contents;
1068
934
  };
1069
935
  exports.deserializeAws_restJson1UntagResourceCommand = deserializeAws_restJson1UntagResourceCommand;
1070
936
  const deserializeAws_restJson1UntagResourceCommandError = async (output, context) => {
@@ -1072,7 +938,6 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
1072
938
  ...output,
1073
939
  body: await parseBody(output.body, context),
1074
940
  };
1075
- let response;
1076
941
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1077
942
  switch (errorCode) {
1078
943
  case "InternalServerException":
@@ -1086,20 +951,19 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
1086
951
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1087
952
  default:
1088
953
  const parsedBody = parsedOutput.body;
1089
- const $metadata = deserializeMetadata(output);
1090
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1091
- response = new CodeGuruReviewerServiceException_1.CodeGuruReviewerServiceException({
1092
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1093
- $fault: "client",
1094
- $metadata,
954
+ (0, smithy_client_1.throwDefaultError)({
955
+ output,
956
+ parsedBody,
957
+ exceptionCtor: CodeGuruReviewerServiceException_1.CodeGuruReviewerServiceException,
958
+ errorCode,
1095
959
  });
1096
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1097
960
  }
1098
961
  };
962
+ const map = smithy_client_1.map;
1099
963
  const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutput, context) => {
1100
- const contents = {};
964
+ const contents = map({});
1101
965
  const data = parsedOutput.body;
1102
- if (data.Message !== undefined && data.Message !== null) {
966
+ if (data.Message != null) {
1103
967
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
1104
968
  }
1105
969
  const exception = new models_0_1.AccessDeniedException({
@@ -1109,9 +973,9 @@ const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutpu
1109
973
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1110
974
  };
1111
975
  const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, context) => {
1112
- const contents = {};
976
+ const contents = map({});
1113
977
  const data = parsedOutput.body;
1114
- if (data.Message !== undefined && data.Message !== null) {
978
+ if (data.Message != null) {
1115
979
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
1116
980
  }
1117
981
  const exception = new models_0_1.ConflictException({
@@ -1121,9 +985,9 @@ const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, c
1121
985
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1122
986
  };
1123
987
  const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOutput, context) => {
1124
- const contents = {};
988
+ const contents = map({});
1125
989
  const data = parsedOutput.body;
1126
- if (data.Message !== undefined && data.Message !== null) {
990
+ if (data.Message != null) {
1127
991
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
1128
992
  }
1129
993
  const exception = new models_0_1.InternalServerException({
@@ -1133,9 +997,9 @@ const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOut
1133
997
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1134
998
  };
1135
999
  const deserializeAws_restJson1NotFoundExceptionResponse = async (parsedOutput, context) => {
1136
- const contents = {};
1000
+ const contents = map({});
1137
1001
  const data = parsedOutput.body;
1138
- if (data.Message !== undefined && data.Message !== null) {
1002
+ if (data.Message != null) {
1139
1003
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
1140
1004
  }
1141
1005
  const exception = new models_0_1.NotFoundException({
@@ -1145,9 +1009,9 @@ const deserializeAws_restJson1NotFoundExceptionResponse = async (parsedOutput, c
1145
1009
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1146
1010
  };
1147
1011
  const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
1148
- const contents = {};
1012
+ const contents = map({});
1149
1013
  const data = parsedOutput.body;
1150
- if (data.Message !== undefined && data.Message !== null) {
1014
+ if (data.Message != null) {
1151
1015
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
1152
1016
  }
1153
1017
  const exception = new models_0_1.ResourceNotFoundException({
@@ -1157,9 +1021,9 @@ const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedO
1157
1021
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1158
1022
  };
1159
1023
  const deserializeAws_restJson1ThrottlingExceptionResponse = async (parsedOutput, context) => {
1160
- const contents = {};
1024
+ const contents = map({});
1161
1025
  const data = parsedOutput.body;
1162
- if (data.Message !== undefined && data.Message !== null) {
1026
+ if (data.Message != null) {
1163
1027
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
1164
1028
  }
1165
1029
  const exception = new models_0_1.ThrottlingException({
@@ -1169,9 +1033,9 @@ const deserializeAws_restJson1ThrottlingExceptionResponse = async (parsedOutput,
1169
1033
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1170
1034
  };
1171
1035
  const deserializeAws_restJson1ValidationExceptionResponse = async (parsedOutput, context) => {
1172
- const contents = {};
1036
+ const contents = map({});
1173
1037
  const data = parsedOutput.body;
1174
- if (data.Message !== undefined && data.Message !== null) {
1038
+ if (data.Message != null) {
1175
1039
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
1176
1040
  }
1177
1041
  const exception = new models_0_1.ValidationException({
@@ -1184,9 +1048,6 @@ const serializeAws_restJson1AnalysisTypes = (input, context) => {
1184
1048
  return input
1185
1049
  .filter((e) => e != null)
1186
1050
  .map((entry) => {
1187
- if (entry === null) {
1188
- return null;
1189
- }
1190
1051
  return entry;
1191
1052
  });
1192
1053
  };
@@ -1242,9 +1103,6 @@ const serializeAws_restJson1Reactions = (input, context) => {
1242
1103
  return input
1243
1104
  .filter((e) => e != null)
1244
1105
  .map((entry) => {
1245
- if (entry === null) {
1246
- return null;
1247
- }
1248
1106
  return entry;
1249
1107
  });
1250
1108
  };