@aws-sdk/client-amp 3.137.0 → 3.145.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.
@@ -14,16 +14,7 @@ const serializeAws_restJson1CreateAlertManagerDefinitionCommand = async (input,
14
14
  };
15
15
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
16
16
  "/workspaces/{workspaceId}/alertmanager/definition";
17
- if (input.workspaceId !== undefined) {
18
- const labelValue = input.workspaceId;
19
- if (labelValue.length <= 0) {
20
- throw new Error("Empty value provided for input HTTP label: workspaceId.");
21
- }
22
- resolvedPath = resolvedPath.replace("{workspaceId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
23
- }
24
- else {
25
- throw new Error("No value provided for input HTTP label: workspaceId.");
26
- }
17
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "workspaceId", () => input.workspaceId, "{workspaceId}", false);
27
18
  let body;
28
19
  body = JSON.stringify({
29
20
  clientToken: (_a = input.clientToken) !== null && _a !== void 0 ? _a : (0, uuid_1.v4)(),
@@ -48,16 +39,7 @@ const serializeAws_restJson1CreateRuleGroupsNamespaceCommand = async (input, con
48
39
  };
49
40
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
50
41
  "/workspaces/{workspaceId}/rulegroupsnamespaces";
51
- if (input.workspaceId !== undefined) {
52
- const labelValue = input.workspaceId;
53
- if (labelValue.length <= 0) {
54
- throw new Error("Empty value provided for input HTTP label: workspaceId.");
55
- }
56
- resolvedPath = resolvedPath.replace("{workspaceId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
57
- }
58
- else {
59
- throw new Error("No value provided for input HTTP label: workspaceId.");
60
- }
42
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "workspaceId", () => input.workspaceId, "{workspaceId}", false);
61
43
  let body;
62
44
  body = JSON.stringify({
63
45
  clientToken: (_a = input.clientToken) !== null && _a !== void 0 ? _a : (0, uuid_1.v4)(),
@@ -105,19 +87,10 @@ const serializeAws_restJson1DeleteAlertManagerDefinitionCommand = async (input,
105
87
  const headers = {};
106
88
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
107
89
  "/workspaces/{workspaceId}/alertmanager/definition";
108
- if (input.workspaceId !== undefined) {
109
- const labelValue = input.workspaceId;
110
- if (labelValue.length <= 0) {
111
- throw new Error("Empty value provided for input HTTP label: workspaceId.");
112
- }
113
- resolvedPath = resolvedPath.replace("{workspaceId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
114
- }
115
- else {
116
- throw new Error("No value provided for input HTTP label: workspaceId.");
117
- }
118
- const query = {
119
- ...(input.clientToken !== undefined && { clientToken: input.clientToken }),
120
- };
90
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "workspaceId", () => input.workspaceId, "{workspaceId}", false);
91
+ const query = map({
92
+ clientToken: [, input.clientToken],
93
+ });
121
94
  let body;
122
95
  return new protocol_http_1.HttpRequest({
123
96
  protocol,
@@ -136,29 +109,11 @@ const serializeAws_restJson1DeleteRuleGroupsNamespaceCommand = async (input, con
136
109
  const headers = {};
137
110
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
138
111
  "/workspaces/{workspaceId}/rulegroupsnamespaces/{name}";
139
- if (input.workspaceId !== undefined) {
140
- const labelValue = input.workspaceId;
141
- if (labelValue.length <= 0) {
142
- throw new Error("Empty value provided for input HTTP label: workspaceId.");
143
- }
144
- resolvedPath = resolvedPath.replace("{workspaceId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
145
- }
146
- else {
147
- throw new Error("No value provided for input HTTP label: workspaceId.");
148
- }
149
- if (input.name !== undefined) {
150
- const labelValue = input.name;
151
- if (labelValue.length <= 0) {
152
- throw new Error("Empty value provided for input HTTP label: name.");
153
- }
154
- resolvedPath = resolvedPath.replace("{name}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
155
- }
156
- else {
157
- throw new Error("No value provided for input HTTP label: name.");
158
- }
159
- const query = {
160
- ...(input.clientToken !== undefined && { clientToken: input.clientToken }),
161
- };
112
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "workspaceId", () => input.workspaceId, "{workspaceId}", false);
113
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "name", () => input.name, "{name}", false);
114
+ const query = map({
115
+ clientToken: [, input.clientToken],
116
+ });
162
117
  let body;
163
118
  return new protocol_http_1.HttpRequest({
164
119
  protocol,
@@ -176,19 +131,10 @@ const serializeAws_restJson1DeleteWorkspaceCommand = async (input, context) => {
176
131
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
177
132
  const headers = {};
178
133
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/workspaces/{workspaceId}";
179
- if (input.workspaceId !== undefined) {
180
- const labelValue = input.workspaceId;
181
- if (labelValue.length <= 0) {
182
- throw new Error("Empty value provided for input HTTP label: workspaceId.");
183
- }
184
- resolvedPath = resolvedPath.replace("{workspaceId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
185
- }
186
- else {
187
- throw new Error("No value provided for input HTTP label: workspaceId.");
188
- }
189
- const query = {
190
- ...(input.clientToken !== undefined && { clientToken: input.clientToken }),
191
- };
134
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "workspaceId", () => input.workspaceId, "{workspaceId}", false);
135
+ const query = map({
136
+ clientToken: [, input.clientToken],
137
+ });
192
138
  let body;
193
139
  return new protocol_http_1.HttpRequest({
194
140
  protocol,
@@ -207,16 +153,7 @@ const serializeAws_restJson1DescribeAlertManagerDefinitionCommand = async (input
207
153
  const headers = {};
208
154
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
209
155
  "/workspaces/{workspaceId}/alertmanager/definition";
210
- if (input.workspaceId !== undefined) {
211
- const labelValue = input.workspaceId;
212
- if (labelValue.length <= 0) {
213
- throw new Error("Empty value provided for input HTTP label: workspaceId.");
214
- }
215
- resolvedPath = resolvedPath.replace("{workspaceId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
216
- }
217
- else {
218
- throw new Error("No value provided for input HTTP label: workspaceId.");
219
- }
156
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "workspaceId", () => input.workspaceId, "{workspaceId}", false);
220
157
  let body;
221
158
  return new protocol_http_1.HttpRequest({
222
159
  protocol,
@@ -234,26 +171,8 @@ const serializeAws_restJson1DescribeRuleGroupsNamespaceCommand = async (input, c
234
171
  const headers = {};
235
172
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
236
173
  "/workspaces/{workspaceId}/rulegroupsnamespaces/{name}";
237
- if (input.workspaceId !== undefined) {
238
- const labelValue = input.workspaceId;
239
- if (labelValue.length <= 0) {
240
- throw new Error("Empty value provided for input HTTP label: workspaceId.");
241
- }
242
- resolvedPath = resolvedPath.replace("{workspaceId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
243
- }
244
- else {
245
- throw new Error("No value provided for input HTTP label: workspaceId.");
246
- }
247
- if (input.name !== undefined) {
248
- const labelValue = input.name;
249
- if (labelValue.length <= 0) {
250
- throw new Error("Empty value provided for input HTTP label: name.");
251
- }
252
- resolvedPath = resolvedPath.replace("{name}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
253
- }
254
- else {
255
- throw new Error("No value provided for input HTTP label: name.");
256
- }
174
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "workspaceId", () => input.workspaceId, "{workspaceId}", false);
175
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "name", () => input.name, "{name}", false);
257
176
  let body;
258
177
  return new protocol_http_1.HttpRequest({
259
178
  protocol,
@@ -270,16 +189,7 @@ const serializeAws_restJson1DescribeWorkspaceCommand = async (input, context) =>
270
189
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
271
190
  const headers = {};
272
191
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/workspaces/{workspaceId}";
273
- if (input.workspaceId !== undefined) {
274
- const labelValue = input.workspaceId;
275
- if (labelValue.length <= 0) {
276
- throw new Error("Empty value provided for input HTTP label: workspaceId.");
277
- }
278
- resolvedPath = resolvedPath.replace("{workspaceId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
279
- }
280
- else {
281
- throw new Error("No value provided for input HTTP label: workspaceId.");
282
- }
192
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "workspaceId", () => input.workspaceId, "{workspaceId}", false);
283
193
  let body;
284
194
  return new protocol_http_1.HttpRequest({
285
195
  protocol,
@@ -297,21 +207,12 @@ const serializeAws_restJson1ListRuleGroupsNamespacesCommand = async (input, cont
297
207
  const headers = {};
298
208
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
299
209
  "/workspaces/{workspaceId}/rulegroupsnamespaces";
300
- if (input.workspaceId !== undefined) {
301
- const labelValue = input.workspaceId;
302
- if (labelValue.length <= 0) {
303
- throw new Error("Empty value provided for input HTTP label: workspaceId.");
304
- }
305
- resolvedPath = resolvedPath.replace("{workspaceId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
306
- }
307
- else {
308
- throw new Error("No value provided for input HTTP label: workspaceId.");
309
- }
310
- const query = {
311
- ...(input.name !== undefined && { name: input.name }),
312
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
313
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
314
- };
210
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "workspaceId", () => input.workspaceId, "{workspaceId}", false);
211
+ const query = map({
212
+ name: [, input.name],
213
+ nextToken: [, input.nextToken],
214
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
215
+ });
315
216
  let body;
316
217
  return new protocol_http_1.HttpRequest({
317
218
  protocol,
@@ -329,16 +230,7 @@ const serializeAws_restJson1ListTagsForResourceCommand = async (input, context)
329
230
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
330
231
  const headers = {};
331
232
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
332
- if (input.resourceArn !== undefined) {
333
- const labelValue = input.resourceArn;
334
- if (labelValue.length <= 0) {
335
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
336
- }
337
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
338
- }
339
- else {
340
- throw new Error("No value provided for input HTTP label: resourceArn.");
341
- }
233
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
342
234
  let body;
343
235
  return new protocol_http_1.HttpRequest({
344
236
  protocol,
@@ -355,11 +247,11 @@ const serializeAws_restJson1ListWorkspacesCommand = async (input, context) => {
355
247
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
356
248
  const headers = {};
357
249
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/workspaces";
358
- const query = {
359
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
360
- ...(input.alias !== undefined && { alias: input.alias }),
361
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
362
- };
250
+ const query = map({
251
+ nextToken: [, input.nextToken],
252
+ alias: [, input.alias],
253
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
254
+ });
363
255
  let body;
364
256
  return new protocol_http_1.HttpRequest({
365
257
  protocol,
@@ -381,16 +273,7 @@ const serializeAws_restJson1PutAlertManagerDefinitionCommand = async (input, con
381
273
  };
382
274
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
383
275
  "/workspaces/{workspaceId}/alertmanager/definition";
384
- if (input.workspaceId !== undefined) {
385
- const labelValue = input.workspaceId;
386
- if (labelValue.length <= 0) {
387
- throw new Error("Empty value provided for input HTTP label: workspaceId.");
388
- }
389
- resolvedPath = resolvedPath.replace("{workspaceId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
390
- }
391
- else {
392
- throw new Error("No value provided for input HTTP label: workspaceId.");
393
- }
276
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "workspaceId", () => input.workspaceId, "{workspaceId}", false);
394
277
  let body;
395
278
  body = JSON.stringify({
396
279
  clientToken: (_a = input.clientToken) !== null && _a !== void 0 ? _a : (0, uuid_1.v4)(),
@@ -415,26 +298,8 @@ const serializeAws_restJson1PutRuleGroupsNamespaceCommand = async (input, contex
415
298
  };
416
299
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
417
300
  "/workspaces/{workspaceId}/rulegroupsnamespaces/{name}";
418
- if (input.workspaceId !== undefined) {
419
- const labelValue = input.workspaceId;
420
- if (labelValue.length <= 0) {
421
- throw new Error("Empty value provided for input HTTP label: workspaceId.");
422
- }
423
- resolvedPath = resolvedPath.replace("{workspaceId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
424
- }
425
- else {
426
- throw new Error("No value provided for input HTTP label: workspaceId.");
427
- }
428
- if (input.name !== undefined) {
429
- const labelValue = input.name;
430
- if (labelValue.length <= 0) {
431
- throw new Error("Empty value provided for input HTTP label: name.");
432
- }
433
- resolvedPath = resolvedPath.replace("{name}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
434
- }
435
- else {
436
- throw new Error("No value provided for input HTTP label: name.");
437
- }
301
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "workspaceId", () => input.workspaceId, "{workspaceId}", false);
302
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "name", () => input.name, "{name}", false);
438
303
  let body;
439
304
  body = JSON.stringify({
440
305
  clientToken: (_a = input.clientToken) !== null && _a !== void 0 ? _a : (0, uuid_1.v4)(),
@@ -457,16 +322,7 @@ const serializeAws_restJson1TagResourceCommand = async (input, context) => {
457
322
  "content-type": "application/json",
458
323
  };
459
324
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
460
- if (input.resourceArn !== undefined) {
461
- const labelValue = input.resourceArn;
462
- if (labelValue.length <= 0) {
463
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
464
- }
465
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
466
- }
467
- else {
468
- throw new Error("No value provided for input HTTP label: resourceArn.");
469
- }
325
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
470
326
  let body;
471
327
  body = JSON.stringify({
472
328
  ...(input.tags != null && { tags: serializeAws_restJson1TagMap(input.tags, context) }),
@@ -486,19 +342,10 @@ const serializeAws_restJson1UntagResourceCommand = async (input, context) => {
486
342
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
487
343
  const headers = {};
488
344
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
489
- if (input.resourceArn !== undefined) {
490
- const labelValue = input.resourceArn;
491
- if (labelValue.length <= 0) {
492
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
493
- }
494
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
495
- }
496
- else {
497
- throw new Error("No value provided for input HTTP label: resourceArn.");
498
- }
499
- const query = {
500
- ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry) }),
501
- };
345
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
346
+ const query = map({
347
+ tagKeys: [() => input.tagKeys !== void 0, () => (input.tagKeys || []).map((_entry) => _entry)],
348
+ });
502
349
  let body;
503
350
  return new protocol_http_1.HttpRequest({
504
351
  protocol,
@@ -519,16 +366,7 @@ const serializeAws_restJson1UpdateWorkspaceAliasCommand = async (input, context)
519
366
  "content-type": "application/json",
520
367
  };
521
368
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/workspaces/{workspaceId}/alias";
522
- if (input.workspaceId !== undefined) {
523
- const labelValue = input.workspaceId;
524
- if (labelValue.length <= 0) {
525
- throw new Error("Empty value provided for input HTTP label: workspaceId.");
526
- }
527
- resolvedPath = resolvedPath.replace("{workspaceId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
528
- }
529
- else {
530
- throw new Error("No value provided for input HTTP label: workspaceId.");
531
- }
369
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "workspaceId", () => input.workspaceId, "{workspaceId}", false);
532
370
  let body;
533
371
  body = JSON.stringify({
534
372
  ...(input.alias != null && { alias: input.alias }),
@@ -549,15 +387,14 @@ const deserializeAws_restJson1CreateAlertManagerDefinitionCommand = async (outpu
549
387
  if (output.statusCode !== 202 && output.statusCode >= 300) {
550
388
  return deserializeAws_restJson1CreateAlertManagerDefinitionCommandError(output, context);
551
389
  }
552
- const contents = {
390
+ const contents = map({
553
391
  $metadata: deserializeMetadata(output),
554
- status: undefined,
555
- };
392
+ });
556
393
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
557
- if (data.status !== undefined && data.status !== null) {
394
+ if (data.status != null) {
558
395
  contents.status = deserializeAws_restJson1AlertManagerDefinitionStatus(data.status, context);
559
396
  }
560
- return Promise.resolve(contents);
397
+ return contents;
561
398
  };
562
399
  exports.deserializeAws_restJson1CreateAlertManagerDefinitionCommand = deserializeAws_restJson1CreateAlertManagerDefinitionCommand;
563
400
  const deserializeAws_restJson1CreateAlertManagerDefinitionCommandError = async (output, context) => {
@@ -565,7 +402,6 @@ const deserializeAws_restJson1CreateAlertManagerDefinitionCommandError = async (
565
402
  ...output,
566
403
  body: await parseBody(output.body, context),
567
404
  };
568
- let response;
569
405
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
570
406
  switch (errorCode) {
571
407
  case "AccessDeniedException":
@@ -591,41 +427,35 @@ const deserializeAws_restJson1CreateAlertManagerDefinitionCommandError = async (
591
427
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
592
428
  default:
593
429
  const parsedBody = parsedOutput.body;
594
- const $metadata = deserializeMetadata(output);
595
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
596
- response = new AmpServiceException_1.AmpServiceException({
597
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
598
- $fault: "client",
599
- $metadata,
430
+ (0, smithy_client_1.throwDefaultError)({
431
+ output,
432
+ parsedBody,
433
+ exceptionCtor: AmpServiceException_1.AmpServiceException,
434
+ errorCode,
600
435
  });
601
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
602
436
  }
603
437
  };
604
438
  const deserializeAws_restJson1CreateRuleGroupsNamespaceCommand = async (output, context) => {
605
439
  if (output.statusCode !== 202 && output.statusCode >= 300) {
606
440
  return deserializeAws_restJson1CreateRuleGroupsNamespaceCommandError(output, context);
607
441
  }
608
- const contents = {
442
+ const contents = map({
609
443
  $metadata: deserializeMetadata(output),
610
- arn: undefined,
611
- name: undefined,
612
- status: undefined,
613
- tags: undefined,
614
- };
444
+ });
615
445
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
616
- if (data.arn !== undefined && data.arn !== null) {
446
+ if (data.arn != null) {
617
447
  contents.arn = (0, smithy_client_1.expectString)(data.arn);
618
448
  }
619
- if (data.name !== undefined && data.name !== null) {
449
+ if (data.name != null) {
620
450
  contents.name = (0, smithy_client_1.expectString)(data.name);
621
451
  }
622
- if (data.status !== undefined && data.status !== null) {
452
+ if (data.status != null) {
623
453
  contents.status = deserializeAws_restJson1RuleGroupsNamespaceStatus(data.status, context);
624
454
  }
625
- if (data.tags !== undefined && data.tags !== null) {
455
+ if (data.tags != null) {
626
456
  contents.tags = deserializeAws_restJson1TagMap(data.tags, context);
627
457
  }
628
- return Promise.resolve(contents);
458
+ return contents;
629
459
  };
630
460
  exports.deserializeAws_restJson1CreateRuleGroupsNamespaceCommand = deserializeAws_restJson1CreateRuleGroupsNamespaceCommand;
631
461
  const deserializeAws_restJson1CreateRuleGroupsNamespaceCommandError = async (output, context) => {
@@ -633,7 +463,6 @@ const deserializeAws_restJson1CreateRuleGroupsNamespaceCommandError = async (out
633
463
  ...output,
634
464
  body: await parseBody(output.body, context),
635
465
  };
636
- let response;
637
466
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
638
467
  switch (errorCode) {
639
468
  case "AccessDeniedException":
@@ -659,41 +488,35 @@ const deserializeAws_restJson1CreateRuleGroupsNamespaceCommandError = async (out
659
488
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
660
489
  default:
661
490
  const parsedBody = parsedOutput.body;
662
- const $metadata = deserializeMetadata(output);
663
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
664
- response = new AmpServiceException_1.AmpServiceException({
665
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
666
- $fault: "client",
667
- $metadata,
491
+ (0, smithy_client_1.throwDefaultError)({
492
+ output,
493
+ parsedBody,
494
+ exceptionCtor: AmpServiceException_1.AmpServiceException,
495
+ errorCode,
668
496
  });
669
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
670
497
  }
671
498
  };
672
499
  const deserializeAws_restJson1CreateWorkspaceCommand = async (output, context) => {
673
500
  if (output.statusCode !== 202 && output.statusCode >= 300) {
674
501
  return deserializeAws_restJson1CreateWorkspaceCommandError(output, context);
675
502
  }
676
- const contents = {
503
+ const contents = map({
677
504
  $metadata: deserializeMetadata(output),
678
- arn: undefined,
679
- status: undefined,
680
- tags: undefined,
681
- workspaceId: undefined,
682
- };
505
+ });
683
506
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
684
- if (data.arn !== undefined && data.arn !== null) {
507
+ if (data.arn != null) {
685
508
  contents.arn = (0, smithy_client_1.expectString)(data.arn);
686
509
  }
687
- if (data.status !== undefined && data.status !== null) {
510
+ if (data.status != null) {
688
511
  contents.status = deserializeAws_restJson1WorkspaceStatus(data.status, context);
689
512
  }
690
- if (data.tags !== undefined && data.tags !== null) {
513
+ if (data.tags != null) {
691
514
  contents.tags = deserializeAws_restJson1TagMap(data.tags, context);
692
515
  }
693
- if (data.workspaceId !== undefined && data.workspaceId !== null) {
516
+ if (data.workspaceId != null) {
694
517
  contents.workspaceId = (0, smithy_client_1.expectString)(data.workspaceId);
695
518
  }
696
- return Promise.resolve(contents);
519
+ return contents;
697
520
  };
698
521
  exports.deserializeAws_restJson1CreateWorkspaceCommand = deserializeAws_restJson1CreateWorkspaceCommand;
699
522
  const deserializeAws_restJson1CreateWorkspaceCommandError = async (output, context) => {
@@ -701,7 +524,6 @@ const deserializeAws_restJson1CreateWorkspaceCommandError = async (output, conte
701
524
  ...output,
702
525
  body: await parseBody(output.body, context),
703
526
  };
704
- let response;
705
527
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
706
528
  switch (errorCode) {
707
529
  case "AccessDeniedException":
@@ -724,25 +546,23 @@ const deserializeAws_restJson1CreateWorkspaceCommandError = async (output, conte
724
546
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
725
547
  default:
726
548
  const parsedBody = parsedOutput.body;
727
- const $metadata = deserializeMetadata(output);
728
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
729
- response = new AmpServiceException_1.AmpServiceException({
730
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
731
- $fault: "client",
732
- $metadata,
549
+ (0, smithy_client_1.throwDefaultError)({
550
+ output,
551
+ parsedBody,
552
+ exceptionCtor: AmpServiceException_1.AmpServiceException,
553
+ errorCode,
733
554
  });
734
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
735
555
  }
736
556
  };
737
557
  const deserializeAws_restJson1DeleteAlertManagerDefinitionCommand = async (output, context) => {
738
558
  if (output.statusCode !== 202 && output.statusCode >= 300) {
739
559
  return deserializeAws_restJson1DeleteAlertManagerDefinitionCommandError(output, context);
740
560
  }
741
- const contents = {
561
+ const contents = map({
742
562
  $metadata: deserializeMetadata(output),
743
- };
563
+ });
744
564
  await collectBody(output.body, context);
745
- return Promise.resolve(contents);
565
+ return contents;
746
566
  };
747
567
  exports.deserializeAws_restJson1DeleteAlertManagerDefinitionCommand = deserializeAws_restJson1DeleteAlertManagerDefinitionCommand;
748
568
  const deserializeAws_restJson1DeleteAlertManagerDefinitionCommandError = async (output, context) => {
@@ -750,7 +570,6 @@ const deserializeAws_restJson1DeleteAlertManagerDefinitionCommandError = async (
750
570
  ...output,
751
571
  body: await parseBody(output.body, context),
752
572
  };
753
- let response;
754
573
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
755
574
  switch (errorCode) {
756
575
  case "AccessDeniedException":
@@ -773,25 +592,23 @@ const deserializeAws_restJson1DeleteAlertManagerDefinitionCommandError = async (
773
592
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
774
593
  default:
775
594
  const parsedBody = parsedOutput.body;
776
- const $metadata = deserializeMetadata(output);
777
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
778
- response = new AmpServiceException_1.AmpServiceException({
779
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
780
- $fault: "client",
781
- $metadata,
595
+ (0, smithy_client_1.throwDefaultError)({
596
+ output,
597
+ parsedBody,
598
+ exceptionCtor: AmpServiceException_1.AmpServiceException,
599
+ errorCode,
782
600
  });
783
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
784
601
  }
785
602
  };
786
603
  const deserializeAws_restJson1DeleteRuleGroupsNamespaceCommand = async (output, context) => {
787
604
  if (output.statusCode !== 202 && output.statusCode >= 300) {
788
605
  return deserializeAws_restJson1DeleteRuleGroupsNamespaceCommandError(output, context);
789
606
  }
790
- const contents = {
607
+ const contents = map({
791
608
  $metadata: deserializeMetadata(output),
792
- };
609
+ });
793
610
  await collectBody(output.body, context);
794
- return Promise.resolve(contents);
611
+ return contents;
795
612
  };
796
613
  exports.deserializeAws_restJson1DeleteRuleGroupsNamespaceCommand = deserializeAws_restJson1DeleteRuleGroupsNamespaceCommand;
797
614
  const deserializeAws_restJson1DeleteRuleGroupsNamespaceCommandError = async (output, context) => {
@@ -799,7 +616,6 @@ const deserializeAws_restJson1DeleteRuleGroupsNamespaceCommandError = async (out
799
616
  ...output,
800
617
  body: await parseBody(output.body, context),
801
618
  };
802
- let response;
803
619
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
804
620
  switch (errorCode) {
805
621
  case "AccessDeniedException":
@@ -822,25 +638,23 @@ const deserializeAws_restJson1DeleteRuleGroupsNamespaceCommandError = async (out
822
638
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
823
639
  default:
824
640
  const parsedBody = parsedOutput.body;
825
- const $metadata = deserializeMetadata(output);
826
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
827
- response = new AmpServiceException_1.AmpServiceException({
828
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
829
- $fault: "client",
830
- $metadata,
641
+ (0, smithy_client_1.throwDefaultError)({
642
+ output,
643
+ parsedBody,
644
+ exceptionCtor: AmpServiceException_1.AmpServiceException,
645
+ errorCode,
831
646
  });
832
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
833
647
  }
834
648
  };
835
649
  const deserializeAws_restJson1DeleteWorkspaceCommand = async (output, context) => {
836
650
  if (output.statusCode !== 202 && output.statusCode >= 300) {
837
651
  return deserializeAws_restJson1DeleteWorkspaceCommandError(output, context);
838
652
  }
839
- const contents = {
653
+ const contents = map({
840
654
  $metadata: deserializeMetadata(output),
841
- };
655
+ });
842
656
  await collectBody(output.body, context);
843
- return Promise.resolve(contents);
657
+ return contents;
844
658
  };
845
659
  exports.deserializeAws_restJson1DeleteWorkspaceCommand = deserializeAws_restJson1DeleteWorkspaceCommand;
846
660
  const deserializeAws_restJson1DeleteWorkspaceCommandError = async (output, context) => {
@@ -848,7 +662,6 @@ const deserializeAws_restJson1DeleteWorkspaceCommandError = async (output, conte
848
662
  ...output,
849
663
  body: await parseBody(output.body, context),
850
664
  };
851
- let response;
852
665
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
853
666
  switch (errorCode) {
854
667
  case "AccessDeniedException":
@@ -871,29 +684,26 @@ const deserializeAws_restJson1DeleteWorkspaceCommandError = async (output, conte
871
684
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
872
685
  default:
873
686
  const parsedBody = parsedOutput.body;
874
- const $metadata = deserializeMetadata(output);
875
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
876
- response = new AmpServiceException_1.AmpServiceException({
877
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
878
- $fault: "client",
879
- $metadata,
687
+ (0, smithy_client_1.throwDefaultError)({
688
+ output,
689
+ parsedBody,
690
+ exceptionCtor: AmpServiceException_1.AmpServiceException,
691
+ errorCode,
880
692
  });
881
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
882
693
  }
883
694
  };
884
695
  const deserializeAws_restJson1DescribeAlertManagerDefinitionCommand = async (output, context) => {
885
696
  if (output.statusCode !== 200 && output.statusCode >= 300) {
886
697
  return deserializeAws_restJson1DescribeAlertManagerDefinitionCommandError(output, context);
887
698
  }
888
- const contents = {
699
+ const contents = map({
889
700
  $metadata: deserializeMetadata(output),
890
- alertManagerDefinition: undefined,
891
- };
701
+ });
892
702
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
893
- if (data.alertManagerDefinition !== undefined && data.alertManagerDefinition !== null) {
703
+ if (data.alertManagerDefinition != null) {
894
704
  contents.alertManagerDefinition = deserializeAws_restJson1AlertManagerDefinitionDescription(data.alertManagerDefinition, context);
895
705
  }
896
- return Promise.resolve(contents);
706
+ return contents;
897
707
  };
898
708
  exports.deserializeAws_restJson1DescribeAlertManagerDefinitionCommand = deserializeAws_restJson1DescribeAlertManagerDefinitionCommand;
899
709
  const deserializeAws_restJson1DescribeAlertManagerDefinitionCommandError = async (output, context) => {
@@ -901,7 +711,6 @@ const deserializeAws_restJson1DescribeAlertManagerDefinitionCommandError = async
901
711
  ...output,
902
712
  body: await parseBody(output.body, context),
903
713
  };
904
- let response;
905
714
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
906
715
  switch (errorCode) {
907
716
  case "AccessDeniedException":
@@ -921,29 +730,26 @@ const deserializeAws_restJson1DescribeAlertManagerDefinitionCommandError = async
921
730
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
922
731
  default:
923
732
  const parsedBody = parsedOutput.body;
924
- const $metadata = deserializeMetadata(output);
925
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
926
- response = new AmpServiceException_1.AmpServiceException({
927
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
928
- $fault: "client",
929
- $metadata,
733
+ (0, smithy_client_1.throwDefaultError)({
734
+ output,
735
+ parsedBody,
736
+ exceptionCtor: AmpServiceException_1.AmpServiceException,
737
+ errorCode,
930
738
  });
931
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
932
739
  }
933
740
  };
934
741
  const deserializeAws_restJson1DescribeRuleGroupsNamespaceCommand = async (output, context) => {
935
742
  if (output.statusCode !== 200 && output.statusCode >= 300) {
936
743
  return deserializeAws_restJson1DescribeRuleGroupsNamespaceCommandError(output, context);
937
744
  }
938
- const contents = {
745
+ const contents = map({
939
746
  $metadata: deserializeMetadata(output),
940
- ruleGroupsNamespace: undefined,
941
- };
747
+ });
942
748
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
943
- if (data.ruleGroupsNamespace !== undefined && data.ruleGroupsNamespace !== null) {
749
+ if (data.ruleGroupsNamespace != null) {
944
750
  contents.ruleGroupsNamespace = deserializeAws_restJson1RuleGroupsNamespaceDescription(data.ruleGroupsNamespace, context);
945
751
  }
946
- return Promise.resolve(contents);
752
+ return contents;
947
753
  };
948
754
  exports.deserializeAws_restJson1DescribeRuleGroupsNamespaceCommand = deserializeAws_restJson1DescribeRuleGroupsNamespaceCommand;
949
755
  const deserializeAws_restJson1DescribeRuleGroupsNamespaceCommandError = async (output, context) => {
@@ -951,7 +757,6 @@ const deserializeAws_restJson1DescribeRuleGroupsNamespaceCommandError = async (o
951
757
  ...output,
952
758
  body: await parseBody(output.body, context),
953
759
  };
954
- let response;
955
760
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
956
761
  switch (errorCode) {
957
762
  case "AccessDeniedException":
@@ -971,29 +776,26 @@ const deserializeAws_restJson1DescribeRuleGroupsNamespaceCommandError = async (o
971
776
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
972
777
  default:
973
778
  const parsedBody = parsedOutput.body;
974
- const $metadata = deserializeMetadata(output);
975
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
976
- response = new AmpServiceException_1.AmpServiceException({
977
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
978
- $fault: "client",
979
- $metadata,
779
+ (0, smithy_client_1.throwDefaultError)({
780
+ output,
781
+ parsedBody,
782
+ exceptionCtor: AmpServiceException_1.AmpServiceException,
783
+ errorCode,
980
784
  });
981
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
982
785
  }
983
786
  };
984
787
  const deserializeAws_restJson1DescribeWorkspaceCommand = async (output, context) => {
985
788
  if (output.statusCode !== 200 && output.statusCode >= 300) {
986
789
  return deserializeAws_restJson1DescribeWorkspaceCommandError(output, context);
987
790
  }
988
- const contents = {
791
+ const contents = map({
989
792
  $metadata: deserializeMetadata(output),
990
- workspace: undefined,
991
- };
793
+ });
992
794
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
993
- if (data.workspace !== undefined && data.workspace !== null) {
795
+ if (data.workspace != null) {
994
796
  contents.workspace = deserializeAws_restJson1WorkspaceDescription(data.workspace, context);
995
797
  }
996
- return Promise.resolve(contents);
798
+ return contents;
997
799
  };
998
800
  exports.deserializeAws_restJson1DescribeWorkspaceCommand = deserializeAws_restJson1DescribeWorkspaceCommand;
999
801
  const deserializeAws_restJson1DescribeWorkspaceCommandError = async (output, context) => {
@@ -1001,7 +803,6 @@ const deserializeAws_restJson1DescribeWorkspaceCommandError = async (output, con
1001
803
  ...output,
1002
804
  body: await parseBody(output.body, context),
1003
805
  };
1004
- let response;
1005
806
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1006
807
  switch (errorCode) {
1007
808
  case "AccessDeniedException":
@@ -1021,33 +822,29 @@ const deserializeAws_restJson1DescribeWorkspaceCommandError = async (output, con
1021
822
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1022
823
  default:
1023
824
  const parsedBody = parsedOutput.body;
1024
- const $metadata = deserializeMetadata(output);
1025
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1026
- response = new AmpServiceException_1.AmpServiceException({
1027
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1028
- $fault: "client",
1029
- $metadata,
825
+ (0, smithy_client_1.throwDefaultError)({
826
+ output,
827
+ parsedBody,
828
+ exceptionCtor: AmpServiceException_1.AmpServiceException,
829
+ errorCode,
1030
830
  });
1031
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1032
831
  }
1033
832
  };
1034
833
  const deserializeAws_restJson1ListRuleGroupsNamespacesCommand = async (output, context) => {
1035
834
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1036
835
  return deserializeAws_restJson1ListRuleGroupsNamespacesCommandError(output, context);
1037
836
  }
1038
- const contents = {
837
+ const contents = map({
1039
838
  $metadata: deserializeMetadata(output),
1040
- nextToken: undefined,
1041
- ruleGroupsNamespaces: undefined,
1042
- };
839
+ });
1043
840
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1044
- if (data.nextToken !== undefined && data.nextToken !== null) {
841
+ if (data.nextToken != null) {
1045
842
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1046
843
  }
1047
- if (data.ruleGroupsNamespaces !== undefined && data.ruleGroupsNamespaces !== null) {
844
+ if (data.ruleGroupsNamespaces != null) {
1048
845
  contents.ruleGroupsNamespaces = deserializeAws_restJson1RuleGroupsNamespaceSummaryList(data.ruleGroupsNamespaces, context);
1049
846
  }
1050
- return Promise.resolve(contents);
847
+ return contents;
1051
848
  };
1052
849
  exports.deserializeAws_restJson1ListRuleGroupsNamespacesCommand = deserializeAws_restJson1ListRuleGroupsNamespacesCommand;
1053
850
  const deserializeAws_restJson1ListRuleGroupsNamespacesCommandError = async (output, context) => {
@@ -1055,7 +852,6 @@ const deserializeAws_restJson1ListRuleGroupsNamespacesCommandError = async (outp
1055
852
  ...output,
1056
853
  body: await parseBody(output.body, context),
1057
854
  };
1058
- let response;
1059
855
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1060
856
  switch (errorCode) {
1061
857
  case "AccessDeniedException":
@@ -1075,29 +871,26 @@ const deserializeAws_restJson1ListRuleGroupsNamespacesCommandError = async (outp
1075
871
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1076
872
  default:
1077
873
  const parsedBody = parsedOutput.body;
1078
- const $metadata = deserializeMetadata(output);
1079
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1080
- response = new AmpServiceException_1.AmpServiceException({
1081
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1082
- $fault: "client",
1083
- $metadata,
874
+ (0, smithy_client_1.throwDefaultError)({
875
+ output,
876
+ parsedBody,
877
+ exceptionCtor: AmpServiceException_1.AmpServiceException,
878
+ errorCode,
1084
879
  });
1085
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1086
880
  }
1087
881
  };
1088
882
  const deserializeAws_restJson1ListTagsForResourceCommand = async (output, context) => {
1089
883
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1090
884
  return deserializeAws_restJson1ListTagsForResourceCommandError(output, context);
1091
885
  }
1092
- const contents = {
886
+ const contents = map({
1093
887
  $metadata: deserializeMetadata(output),
1094
- tags: undefined,
1095
- };
888
+ });
1096
889
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1097
- if (data.tags !== undefined && data.tags !== null) {
890
+ if (data.tags != null) {
1098
891
  contents.tags = deserializeAws_restJson1TagMap(data.tags, context);
1099
892
  }
1100
- return Promise.resolve(contents);
893
+ return contents;
1101
894
  };
1102
895
  exports.deserializeAws_restJson1ListTagsForResourceCommand = deserializeAws_restJson1ListTagsForResourceCommand;
1103
896
  const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, context) => {
@@ -1105,7 +898,6 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
1105
898
  ...output,
1106
899
  body: await parseBody(output.body, context),
1107
900
  };
1108
- let response;
1109
901
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1110
902
  switch (errorCode) {
1111
903
  case "AccessDeniedException":
@@ -1125,33 +917,29 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
1125
917
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1126
918
  default:
1127
919
  const parsedBody = parsedOutput.body;
1128
- const $metadata = deserializeMetadata(output);
1129
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1130
- response = new AmpServiceException_1.AmpServiceException({
1131
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1132
- $fault: "client",
1133
- $metadata,
920
+ (0, smithy_client_1.throwDefaultError)({
921
+ output,
922
+ parsedBody,
923
+ exceptionCtor: AmpServiceException_1.AmpServiceException,
924
+ errorCode,
1134
925
  });
1135
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1136
926
  }
1137
927
  };
1138
928
  const deserializeAws_restJson1ListWorkspacesCommand = async (output, context) => {
1139
929
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1140
930
  return deserializeAws_restJson1ListWorkspacesCommandError(output, context);
1141
931
  }
1142
- const contents = {
932
+ const contents = map({
1143
933
  $metadata: deserializeMetadata(output),
1144
- nextToken: undefined,
1145
- workspaces: undefined,
1146
- };
934
+ });
1147
935
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1148
- if (data.nextToken !== undefined && data.nextToken !== null) {
936
+ if (data.nextToken != null) {
1149
937
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1150
938
  }
1151
- if (data.workspaces !== undefined && data.workspaces !== null) {
939
+ if (data.workspaces != null) {
1152
940
  contents.workspaces = deserializeAws_restJson1WorkspaceSummaryList(data.workspaces, context);
1153
941
  }
1154
- return Promise.resolve(contents);
942
+ return contents;
1155
943
  };
1156
944
  exports.deserializeAws_restJson1ListWorkspacesCommand = deserializeAws_restJson1ListWorkspacesCommand;
1157
945
  const deserializeAws_restJson1ListWorkspacesCommandError = async (output, context) => {
@@ -1159,7 +947,6 @@ const deserializeAws_restJson1ListWorkspacesCommandError = async (output, contex
1159
947
  ...output,
1160
948
  body: await parseBody(output.body, context),
1161
949
  };
1162
- let response;
1163
950
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1164
951
  switch (errorCode) {
1165
952
  case "AccessDeniedException":
@@ -1176,29 +963,26 @@ const deserializeAws_restJson1ListWorkspacesCommandError = async (output, contex
1176
963
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1177
964
  default:
1178
965
  const parsedBody = parsedOutput.body;
1179
- const $metadata = deserializeMetadata(output);
1180
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1181
- response = new AmpServiceException_1.AmpServiceException({
1182
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1183
- $fault: "client",
1184
- $metadata,
966
+ (0, smithy_client_1.throwDefaultError)({
967
+ output,
968
+ parsedBody,
969
+ exceptionCtor: AmpServiceException_1.AmpServiceException,
970
+ errorCode,
1185
971
  });
1186
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1187
972
  }
1188
973
  };
1189
974
  const deserializeAws_restJson1PutAlertManagerDefinitionCommand = async (output, context) => {
1190
975
  if (output.statusCode !== 202 && output.statusCode >= 300) {
1191
976
  return deserializeAws_restJson1PutAlertManagerDefinitionCommandError(output, context);
1192
977
  }
1193
- const contents = {
978
+ const contents = map({
1194
979
  $metadata: deserializeMetadata(output),
1195
- status: undefined,
1196
- };
980
+ });
1197
981
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1198
- if (data.status !== undefined && data.status !== null) {
982
+ if (data.status != null) {
1199
983
  contents.status = deserializeAws_restJson1AlertManagerDefinitionStatus(data.status, context);
1200
984
  }
1201
- return Promise.resolve(contents);
985
+ return contents;
1202
986
  };
1203
987
  exports.deserializeAws_restJson1PutAlertManagerDefinitionCommand = deserializeAws_restJson1PutAlertManagerDefinitionCommand;
1204
988
  const deserializeAws_restJson1PutAlertManagerDefinitionCommandError = async (output, context) => {
@@ -1206,7 +990,6 @@ const deserializeAws_restJson1PutAlertManagerDefinitionCommandError = async (out
1206
990
  ...output,
1207
991
  body: await parseBody(output.body, context),
1208
992
  };
1209
- let response;
1210
993
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1211
994
  switch (errorCode) {
1212
995
  case "AccessDeniedException":
@@ -1232,41 +1015,35 @@ const deserializeAws_restJson1PutAlertManagerDefinitionCommandError = async (out
1232
1015
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1233
1016
  default:
1234
1017
  const parsedBody = parsedOutput.body;
1235
- const $metadata = deserializeMetadata(output);
1236
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1237
- response = new AmpServiceException_1.AmpServiceException({
1238
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1239
- $fault: "client",
1240
- $metadata,
1018
+ (0, smithy_client_1.throwDefaultError)({
1019
+ output,
1020
+ parsedBody,
1021
+ exceptionCtor: AmpServiceException_1.AmpServiceException,
1022
+ errorCode,
1241
1023
  });
1242
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1243
1024
  }
1244
1025
  };
1245
1026
  const deserializeAws_restJson1PutRuleGroupsNamespaceCommand = async (output, context) => {
1246
1027
  if (output.statusCode !== 202 && output.statusCode >= 300) {
1247
1028
  return deserializeAws_restJson1PutRuleGroupsNamespaceCommandError(output, context);
1248
1029
  }
1249
- const contents = {
1030
+ const contents = map({
1250
1031
  $metadata: deserializeMetadata(output),
1251
- arn: undefined,
1252
- name: undefined,
1253
- status: undefined,
1254
- tags: undefined,
1255
- };
1032
+ });
1256
1033
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1257
- if (data.arn !== undefined && data.arn !== null) {
1034
+ if (data.arn != null) {
1258
1035
  contents.arn = (0, smithy_client_1.expectString)(data.arn);
1259
1036
  }
1260
- if (data.name !== undefined && data.name !== null) {
1037
+ if (data.name != null) {
1261
1038
  contents.name = (0, smithy_client_1.expectString)(data.name);
1262
1039
  }
1263
- if (data.status !== undefined && data.status !== null) {
1040
+ if (data.status != null) {
1264
1041
  contents.status = deserializeAws_restJson1RuleGroupsNamespaceStatus(data.status, context);
1265
1042
  }
1266
- if (data.tags !== undefined && data.tags !== null) {
1043
+ if (data.tags != null) {
1267
1044
  contents.tags = deserializeAws_restJson1TagMap(data.tags, context);
1268
1045
  }
1269
- return Promise.resolve(contents);
1046
+ return contents;
1270
1047
  };
1271
1048
  exports.deserializeAws_restJson1PutRuleGroupsNamespaceCommand = deserializeAws_restJson1PutRuleGroupsNamespaceCommand;
1272
1049
  const deserializeAws_restJson1PutRuleGroupsNamespaceCommandError = async (output, context) => {
@@ -1274,7 +1051,6 @@ const deserializeAws_restJson1PutRuleGroupsNamespaceCommandError = async (output
1274
1051
  ...output,
1275
1052
  body: await parseBody(output.body, context),
1276
1053
  };
1277
- let response;
1278
1054
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1279
1055
  switch (errorCode) {
1280
1056
  case "AccessDeniedException":
@@ -1300,25 +1076,23 @@ const deserializeAws_restJson1PutRuleGroupsNamespaceCommandError = async (output
1300
1076
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1301
1077
  default:
1302
1078
  const parsedBody = parsedOutput.body;
1303
- const $metadata = deserializeMetadata(output);
1304
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1305
- response = new AmpServiceException_1.AmpServiceException({
1306
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1307
- $fault: "client",
1308
- $metadata,
1079
+ (0, smithy_client_1.throwDefaultError)({
1080
+ output,
1081
+ parsedBody,
1082
+ exceptionCtor: AmpServiceException_1.AmpServiceException,
1083
+ errorCode,
1309
1084
  });
1310
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1311
1085
  }
1312
1086
  };
1313
1087
  const deserializeAws_restJson1TagResourceCommand = async (output, context) => {
1314
1088
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1315
1089
  return deserializeAws_restJson1TagResourceCommandError(output, context);
1316
1090
  }
1317
- const contents = {
1091
+ const contents = map({
1318
1092
  $metadata: deserializeMetadata(output),
1319
- };
1093
+ });
1320
1094
  await collectBody(output.body, context);
1321
- return Promise.resolve(contents);
1095
+ return contents;
1322
1096
  };
1323
1097
  exports.deserializeAws_restJson1TagResourceCommand = deserializeAws_restJson1TagResourceCommand;
1324
1098
  const deserializeAws_restJson1TagResourceCommandError = async (output, context) => {
@@ -1326,7 +1100,6 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
1326
1100
  ...output,
1327
1101
  body: await parseBody(output.body, context),
1328
1102
  };
1329
- let response;
1330
1103
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1331
1104
  switch (errorCode) {
1332
1105
  case "AccessDeniedException":
@@ -1346,25 +1119,23 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
1346
1119
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1347
1120
  default:
1348
1121
  const parsedBody = parsedOutput.body;
1349
- const $metadata = deserializeMetadata(output);
1350
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1351
- response = new AmpServiceException_1.AmpServiceException({
1352
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1353
- $fault: "client",
1354
- $metadata,
1122
+ (0, smithy_client_1.throwDefaultError)({
1123
+ output,
1124
+ parsedBody,
1125
+ exceptionCtor: AmpServiceException_1.AmpServiceException,
1126
+ errorCode,
1355
1127
  });
1356
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1357
1128
  }
1358
1129
  };
1359
1130
  const deserializeAws_restJson1UntagResourceCommand = async (output, context) => {
1360
1131
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1361
1132
  return deserializeAws_restJson1UntagResourceCommandError(output, context);
1362
1133
  }
1363
- const contents = {
1134
+ const contents = map({
1364
1135
  $metadata: deserializeMetadata(output),
1365
- };
1136
+ });
1366
1137
  await collectBody(output.body, context);
1367
- return Promise.resolve(contents);
1138
+ return contents;
1368
1139
  };
1369
1140
  exports.deserializeAws_restJson1UntagResourceCommand = deserializeAws_restJson1UntagResourceCommand;
1370
1141
  const deserializeAws_restJson1UntagResourceCommandError = async (output, context) => {
@@ -1372,7 +1143,6 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
1372
1143
  ...output,
1373
1144
  body: await parseBody(output.body, context),
1374
1145
  };
1375
- let response;
1376
1146
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1377
1147
  switch (errorCode) {
1378
1148
  case "AccessDeniedException":
@@ -1392,25 +1162,23 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
1392
1162
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1393
1163
  default:
1394
1164
  const parsedBody = parsedOutput.body;
1395
- const $metadata = deserializeMetadata(output);
1396
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1397
- response = new AmpServiceException_1.AmpServiceException({
1398
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1399
- $fault: "client",
1400
- $metadata,
1165
+ (0, smithy_client_1.throwDefaultError)({
1166
+ output,
1167
+ parsedBody,
1168
+ exceptionCtor: AmpServiceException_1.AmpServiceException,
1169
+ errorCode,
1401
1170
  });
1402
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1403
1171
  }
1404
1172
  };
1405
1173
  const deserializeAws_restJson1UpdateWorkspaceAliasCommand = async (output, context) => {
1406
1174
  if (output.statusCode !== 204 && output.statusCode >= 300) {
1407
1175
  return deserializeAws_restJson1UpdateWorkspaceAliasCommandError(output, context);
1408
1176
  }
1409
- const contents = {
1177
+ const contents = map({
1410
1178
  $metadata: deserializeMetadata(output),
1411
- };
1179
+ });
1412
1180
  await collectBody(output.body, context);
1413
- return Promise.resolve(contents);
1181
+ return contents;
1414
1182
  };
1415
1183
  exports.deserializeAws_restJson1UpdateWorkspaceAliasCommand = deserializeAws_restJson1UpdateWorkspaceAliasCommand;
1416
1184
  const deserializeAws_restJson1UpdateWorkspaceAliasCommandError = async (output, context) => {
@@ -1418,7 +1186,6 @@ const deserializeAws_restJson1UpdateWorkspaceAliasCommandError = async (output,
1418
1186
  ...output,
1419
1187
  body: await parseBody(output.body, context),
1420
1188
  };
1421
- let response;
1422
1189
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1423
1190
  switch (errorCode) {
1424
1191
  case "AccessDeniedException":
@@ -1444,20 +1211,19 @@ const deserializeAws_restJson1UpdateWorkspaceAliasCommandError = async (output,
1444
1211
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1445
1212
  default:
1446
1213
  const parsedBody = parsedOutput.body;
1447
- const $metadata = deserializeMetadata(output);
1448
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1449
- response = new AmpServiceException_1.AmpServiceException({
1450
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1451
- $fault: "client",
1452
- $metadata,
1214
+ (0, smithy_client_1.throwDefaultError)({
1215
+ output,
1216
+ parsedBody,
1217
+ exceptionCtor: AmpServiceException_1.AmpServiceException,
1218
+ errorCode,
1453
1219
  });
1454
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1455
1220
  }
1456
1221
  };
1222
+ const map = smithy_client_1.map;
1457
1223
  const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutput, context) => {
1458
- const contents = {};
1224
+ const contents = map({});
1459
1225
  const data = parsedOutput.body;
1460
- if (data.message !== undefined && data.message !== null) {
1226
+ if (data.message != null) {
1461
1227
  contents.message = (0, smithy_client_1.expectString)(data.message);
1462
1228
  }
1463
1229
  const exception = new models_0_1.AccessDeniedException({
@@ -1467,15 +1233,15 @@ const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutpu
1467
1233
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1468
1234
  };
1469
1235
  const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, context) => {
1470
- const contents = {};
1236
+ const contents = map({});
1471
1237
  const data = parsedOutput.body;
1472
- if (data.message !== undefined && data.message !== null) {
1238
+ if (data.message != null) {
1473
1239
  contents.message = (0, smithy_client_1.expectString)(data.message);
1474
1240
  }
1475
- if (data.resourceId !== undefined && data.resourceId !== null) {
1241
+ if (data.resourceId != null) {
1476
1242
  contents.resourceId = (0, smithy_client_1.expectString)(data.resourceId);
1477
1243
  }
1478
- if (data.resourceType !== undefined && data.resourceType !== null) {
1244
+ if (data.resourceType != null) {
1479
1245
  contents.resourceType = (0, smithy_client_1.expectString)(data.resourceType);
1480
1246
  }
1481
1247
  const exception = new models_0_1.ConflictException({
@@ -1485,12 +1251,14 @@ const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, c
1485
1251
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1486
1252
  };
1487
1253
  const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOutput, context) => {
1488
- const contents = {};
1489
- if (parsedOutput.headers["retry-after"] !== undefined) {
1490
- contents.retryAfterSeconds = (0, smithy_client_1.strictParseInt32)(parsedOutput.headers["retry-after"]);
1491
- }
1254
+ const contents = map({
1255
+ retryAfterSeconds: [
1256
+ () => void 0 !== parsedOutput.headers["retry-after"],
1257
+ () => (0, smithy_client_1.strictParseInt32)(parsedOutput.headers["retry-after"]),
1258
+ ],
1259
+ });
1492
1260
  const data = parsedOutput.body;
1493
- if (data.message !== undefined && data.message !== null) {
1261
+ if (data.message != null) {
1494
1262
  contents.message = (0, smithy_client_1.expectString)(data.message);
1495
1263
  }
1496
1264
  const exception = new models_0_1.InternalServerException({
@@ -1500,15 +1268,15 @@ const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOut
1500
1268
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1501
1269
  };
1502
1270
  const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
1503
- const contents = {};
1271
+ const contents = map({});
1504
1272
  const data = parsedOutput.body;
1505
- if (data.message !== undefined && data.message !== null) {
1273
+ if (data.message != null) {
1506
1274
  contents.message = (0, smithy_client_1.expectString)(data.message);
1507
1275
  }
1508
- if (data.resourceId !== undefined && data.resourceId !== null) {
1276
+ if (data.resourceId != null) {
1509
1277
  contents.resourceId = (0, smithy_client_1.expectString)(data.resourceId);
1510
1278
  }
1511
- if (data.resourceType !== undefined && data.resourceType !== null) {
1279
+ if (data.resourceType != null) {
1512
1280
  contents.resourceType = (0, smithy_client_1.expectString)(data.resourceType);
1513
1281
  }
1514
1282
  const exception = new models_0_1.ResourceNotFoundException({
@@ -1518,21 +1286,21 @@ const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedO
1518
1286
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1519
1287
  };
1520
1288
  const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (parsedOutput, context) => {
1521
- const contents = {};
1289
+ const contents = map({});
1522
1290
  const data = parsedOutput.body;
1523
- if (data.message !== undefined && data.message !== null) {
1291
+ if (data.message != null) {
1524
1292
  contents.message = (0, smithy_client_1.expectString)(data.message);
1525
1293
  }
1526
- if (data.quotaCode !== undefined && data.quotaCode !== null) {
1294
+ if (data.quotaCode != null) {
1527
1295
  contents.quotaCode = (0, smithy_client_1.expectString)(data.quotaCode);
1528
1296
  }
1529
- if (data.resourceId !== undefined && data.resourceId !== null) {
1297
+ if (data.resourceId != null) {
1530
1298
  contents.resourceId = (0, smithy_client_1.expectString)(data.resourceId);
1531
1299
  }
1532
- if (data.resourceType !== undefined && data.resourceType !== null) {
1300
+ if (data.resourceType != null) {
1533
1301
  contents.resourceType = (0, smithy_client_1.expectString)(data.resourceType);
1534
1302
  }
1535
- if (data.serviceCode !== undefined && data.serviceCode !== null) {
1303
+ if (data.serviceCode != null) {
1536
1304
  contents.serviceCode = (0, smithy_client_1.expectString)(data.serviceCode);
1537
1305
  }
1538
1306
  const exception = new models_0_1.ServiceQuotaExceededException({
@@ -1542,18 +1310,20 @@ const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (par
1542
1310
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1543
1311
  };
1544
1312
  const deserializeAws_restJson1ThrottlingExceptionResponse = async (parsedOutput, context) => {
1545
- const contents = {};
1546
- if (parsedOutput.headers["retry-after"] !== undefined) {
1547
- contents.retryAfterSeconds = (0, smithy_client_1.strictParseInt32)(parsedOutput.headers["retry-after"]);
1548
- }
1313
+ const contents = map({
1314
+ retryAfterSeconds: [
1315
+ () => void 0 !== parsedOutput.headers["retry-after"],
1316
+ () => (0, smithy_client_1.strictParseInt32)(parsedOutput.headers["retry-after"]),
1317
+ ],
1318
+ });
1549
1319
  const data = parsedOutput.body;
1550
- if (data.message !== undefined && data.message !== null) {
1320
+ if (data.message != null) {
1551
1321
  contents.message = (0, smithy_client_1.expectString)(data.message);
1552
1322
  }
1553
- if (data.quotaCode !== undefined && data.quotaCode !== null) {
1323
+ if (data.quotaCode != null) {
1554
1324
  contents.quotaCode = (0, smithy_client_1.expectString)(data.quotaCode);
1555
1325
  }
1556
- if (data.serviceCode !== undefined && data.serviceCode !== null) {
1326
+ if (data.serviceCode != null) {
1557
1327
  contents.serviceCode = (0, smithy_client_1.expectString)(data.serviceCode);
1558
1328
  }
1559
1329
  const exception = new models_0_1.ThrottlingException({
@@ -1563,15 +1333,15 @@ const deserializeAws_restJson1ThrottlingExceptionResponse = async (parsedOutput,
1563
1333
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1564
1334
  };
1565
1335
  const deserializeAws_restJson1ValidationExceptionResponse = async (parsedOutput, context) => {
1566
- const contents = {};
1336
+ const contents = map({});
1567
1337
  const data = parsedOutput.body;
1568
- if (data.fieldList !== undefined && data.fieldList !== null) {
1338
+ if (data.fieldList != null) {
1569
1339
  contents.fieldList = deserializeAws_restJson1ValidationExceptionFieldList(data.fieldList, context);
1570
1340
  }
1571
- if (data.message !== undefined && data.message !== null) {
1341
+ if (data.message != null) {
1572
1342
  contents.message = (0, smithy_client_1.expectString)(data.message);
1573
1343
  }
1574
- if (data.reason !== undefined && data.reason !== null) {
1344
+ if (data.reason != null) {
1575
1345
  contents.reason = (0, smithy_client_1.expectString)(data.reason);
1576
1346
  }
1577
1347
  const exception = new models_0_1.ValidationException({