@aws-sdk/client-pinpoint-email 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.
@@ -47,16 +47,7 @@ const serializeAws_restJson1CreateConfigurationSetEventDestinationCommand = asyn
47
47
  };
48
48
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
49
49
  "/v1/email/configuration-sets/{ConfigurationSetName}/event-destinations";
50
- if (input.ConfigurationSetName !== undefined) {
51
- const labelValue = input.ConfigurationSetName;
52
- if (labelValue.length <= 0) {
53
- throw new Error("Empty value provided for input HTTP label: ConfigurationSetName.");
54
- }
55
- resolvedPath = resolvedPath.replace("{ConfigurationSetName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
56
- }
57
- else {
58
- throw new Error("No value provided for input HTTP label: ConfigurationSetName.");
59
- }
50
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ConfigurationSetName", () => input.ConfigurationSetName, "{ConfigurationSetName}", false);
60
51
  let body;
61
52
  body = JSON.stringify({
62
53
  ...(input.EventDestination != null && {
@@ -148,16 +139,7 @@ const serializeAws_restJson1DeleteConfigurationSetCommand = async (input, contex
148
139
  const headers = {};
149
140
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
150
141
  "/v1/email/configuration-sets/{ConfigurationSetName}";
151
- if (input.ConfigurationSetName !== undefined) {
152
- const labelValue = input.ConfigurationSetName;
153
- if (labelValue.length <= 0) {
154
- throw new Error("Empty value provided for input HTTP label: ConfigurationSetName.");
155
- }
156
- resolvedPath = resolvedPath.replace("{ConfigurationSetName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
157
- }
158
- else {
159
- throw new Error("No value provided for input HTTP label: ConfigurationSetName.");
160
- }
142
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ConfigurationSetName", () => input.ConfigurationSetName, "{ConfigurationSetName}", false);
161
143
  let body;
162
144
  return new protocol_http_1.HttpRequest({
163
145
  protocol,
@@ -175,26 +157,8 @@ const serializeAws_restJson1DeleteConfigurationSetEventDestinationCommand = asyn
175
157
  const headers = {};
176
158
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
177
159
  "/v1/email/configuration-sets/{ConfigurationSetName}/event-destinations/{EventDestinationName}";
178
- if (input.ConfigurationSetName !== undefined) {
179
- const labelValue = input.ConfigurationSetName;
180
- if (labelValue.length <= 0) {
181
- throw new Error("Empty value provided for input HTTP label: ConfigurationSetName.");
182
- }
183
- resolvedPath = resolvedPath.replace("{ConfigurationSetName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
184
- }
185
- else {
186
- throw new Error("No value provided for input HTTP label: ConfigurationSetName.");
187
- }
188
- if (input.EventDestinationName !== undefined) {
189
- const labelValue = input.EventDestinationName;
190
- if (labelValue.length <= 0) {
191
- throw new Error("Empty value provided for input HTTP label: EventDestinationName.");
192
- }
193
- resolvedPath = resolvedPath.replace("{EventDestinationName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
194
- }
195
- else {
196
- throw new Error("No value provided for input HTTP label: EventDestinationName.");
197
- }
160
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ConfigurationSetName", () => input.ConfigurationSetName, "{ConfigurationSetName}", false);
161
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "EventDestinationName", () => input.EventDestinationName, "{EventDestinationName}", false);
198
162
  let body;
199
163
  return new protocol_http_1.HttpRequest({
200
164
  protocol,
@@ -211,16 +175,7 @@ const serializeAws_restJson1DeleteDedicatedIpPoolCommand = async (input, context
211
175
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
212
176
  const headers = {};
213
177
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/email/dedicated-ip-pools/{PoolName}";
214
- if (input.PoolName !== undefined) {
215
- const labelValue = input.PoolName;
216
- if (labelValue.length <= 0) {
217
- throw new Error("Empty value provided for input HTTP label: PoolName.");
218
- }
219
- resolvedPath = resolvedPath.replace("{PoolName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
220
- }
221
- else {
222
- throw new Error("No value provided for input HTTP label: PoolName.");
223
- }
178
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "PoolName", () => input.PoolName, "{PoolName}", false);
224
179
  let body;
225
180
  return new protocol_http_1.HttpRequest({
226
181
  protocol,
@@ -237,16 +192,7 @@ const serializeAws_restJson1DeleteEmailIdentityCommand = async (input, context)
237
192
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
238
193
  const headers = {};
239
194
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/email/identities/{EmailIdentity}";
240
- if (input.EmailIdentity !== undefined) {
241
- const labelValue = input.EmailIdentity;
242
- if (labelValue.length <= 0) {
243
- throw new Error("Empty value provided for input HTTP label: EmailIdentity.");
244
- }
245
- resolvedPath = resolvedPath.replace("{EmailIdentity}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
246
- }
247
- else {
248
- throw new Error("No value provided for input HTTP label: EmailIdentity.");
249
- }
195
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "EmailIdentity", () => input.EmailIdentity, "{EmailIdentity}", false);
250
196
  let body;
251
197
  return new protocol_http_1.HttpRequest({
252
198
  protocol,
@@ -283,11 +229,12 @@ const serializeAws_restJson1GetBlacklistReportsCommand = async (input, context)
283
229
  const headers = {};
284
230
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
285
231
  "/v1/email/deliverability-dashboard/blacklist-report";
286
- const query = {
287
- ...(input.BlacklistItemNames !== undefined && {
288
- BlacklistItemNames: (input.BlacklistItemNames || []).map((_entry) => _entry),
289
- }),
290
- };
232
+ const query = map({
233
+ BlacklistItemNames: [
234
+ () => input.BlacklistItemNames !== void 0,
235
+ () => (input.BlacklistItemNames || []).map((_entry) => _entry),
236
+ ],
237
+ });
291
238
  let body;
292
239
  return new protocol_http_1.HttpRequest({
293
240
  protocol,
@@ -306,16 +253,7 @@ const serializeAws_restJson1GetConfigurationSetCommand = async (input, context)
306
253
  const headers = {};
307
254
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
308
255
  "/v1/email/configuration-sets/{ConfigurationSetName}";
309
- if (input.ConfigurationSetName !== undefined) {
310
- const labelValue = input.ConfigurationSetName;
311
- if (labelValue.length <= 0) {
312
- throw new Error("Empty value provided for input HTTP label: ConfigurationSetName.");
313
- }
314
- resolvedPath = resolvedPath.replace("{ConfigurationSetName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
315
- }
316
- else {
317
- throw new Error("No value provided for input HTTP label: ConfigurationSetName.");
318
- }
256
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ConfigurationSetName", () => input.ConfigurationSetName, "{ConfigurationSetName}", false);
319
257
  let body;
320
258
  return new protocol_http_1.HttpRequest({
321
259
  protocol,
@@ -333,16 +271,7 @@ const serializeAws_restJson1GetConfigurationSetEventDestinationsCommand = async
333
271
  const headers = {};
334
272
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
335
273
  "/v1/email/configuration-sets/{ConfigurationSetName}/event-destinations";
336
- if (input.ConfigurationSetName !== undefined) {
337
- const labelValue = input.ConfigurationSetName;
338
- if (labelValue.length <= 0) {
339
- throw new Error("Empty value provided for input HTTP label: ConfigurationSetName.");
340
- }
341
- resolvedPath = resolvedPath.replace("{ConfigurationSetName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
342
- }
343
- else {
344
- throw new Error("No value provided for input HTTP label: ConfigurationSetName.");
345
- }
274
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ConfigurationSetName", () => input.ConfigurationSetName, "{ConfigurationSetName}", false);
346
275
  let body;
347
276
  return new protocol_http_1.HttpRequest({
348
277
  protocol,
@@ -359,16 +288,7 @@ const serializeAws_restJson1GetDedicatedIpCommand = async (input, context) => {
359
288
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
360
289
  const headers = {};
361
290
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/email/dedicated-ips/{Ip}";
362
- if (input.Ip !== undefined) {
363
- const labelValue = input.Ip;
364
- if (labelValue.length <= 0) {
365
- throw new Error("Empty value provided for input HTTP label: Ip.");
366
- }
367
- resolvedPath = resolvedPath.replace("{Ip}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
368
- }
369
- else {
370
- throw new Error("No value provided for input HTTP label: Ip.");
371
- }
291
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "Ip", () => input.Ip, "{Ip}", false);
372
292
  let body;
373
293
  return new protocol_http_1.HttpRequest({
374
294
  protocol,
@@ -385,11 +305,11 @@ const serializeAws_restJson1GetDedicatedIpsCommand = async (input, context) => {
385
305
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
386
306
  const headers = {};
387
307
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/email/dedicated-ips";
388
- const query = {
389
- ...(input.PoolName !== undefined && { PoolName: input.PoolName }),
390
- ...(input.NextToken !== undefined && { NextToken: input.NextToken }),
391
- ...(input.PageSize !== undefined && { PageSize: input.PageSize.toString() }),
392
- };
308
+ const query = map({
309
+ PoolName: [, input.PoolName],
310
+ NextToken: [, input.NextToken],
311
+ PageSize: [() => input.PageSize !== void 0, () => input.PageSize.toString()],
312
+ });
393
313
  let body;
394
314
  return new protocol_http_1.HttpRequest({
395
315
  protocol,
@@ -427,16 +347,7 @@ const serializeAws_restJson1GetDeliverabilityTestReportCommand = async (input, c
427
347
  const headers = {};
428
348
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
429
349
  "/v1/email/deliverability-dashboard/test-reports/{ReportId}";
430
- if (input.ReportId !== undefined) {
431
- const labelValue = input.ReportId;
432
- if (labelValue.length <= 0) {
433
- throw new Error("Empty value provided for input HTTP label: ReportId.");
434
- }
435
- resolvedPath = resolvedPath.replace("{ReportId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
436
- }
437
- else {
438
- throw new Error("No value provided for input HTTP label: ReportId.");
439
- }
350
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ReportId", () => input.ReportId, "{ReportId}", false);
440
351
  let body;
441
352
  return new protocol_http_1.HttpRequest({
442
353
  protocol,
@@ -454,16 +365,7 @@ const serializeAws_restJson1GetDomainDeliverabilityCampaignCommand = async (inpu
454
365
  const headers = {};
455
366
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
456
367
  "/v1/email/deliverability-dashboard/campaigns/{CampaignId}";
457
- if (input.CampaignId !== undefined) {
458
- const labelValue = input.CampaignId;
459
- if (labelValue.length <= 0) {
460
- throw new Error("Empty value provided for input HTTP label: CampaignId.");
461
- }
462
- resolvedPath = resolvedPath.replace("{CampaignId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
463
- }
464
- else {
465
- throw new Error("No value provided for input HTTP label: CampaignId.");
466
- }
368
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "CampaignId", () => input.CampaignId, "{CampaignId}", false);
467
369
  let body;
468
370
  return new protocol_http_1.HttpRequest({
469
371
  protocol,
@@ -481,20 +383,14 @@ const serializeAws_restJson1GetDomainStatisticsReportCommand = async (input, con
481
383
  const headers = {};
482
384
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
483
385
  "/v1/email/deliverability-dashboard/statistics-report/{Domain}";
484
- if (input.Domain !== undefined) {
485
- const labelValue = input.Domain;
486
- if (labelValue.length <= 0) {
487
- throw new Error("Empty value provided for input HTTP label: Domain.");
488
- }
489
- resolvedPath = resolvedPath.replace("{Domain}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
490
- }
491
- else {
492
- throw new Error("No value provided for input HTTP label: Domain.");
493
- }
494
- const query = {
495
- ...(input.StartDate !== undefined && { StartDate: (input.StartDate.toISOString().split(".")[0] + "Z").toString() }),
496
- ...(input.EndDate !== undefined && { EndDate: (input.EndDate.toISOString().split(".")[0] + "Z").toString() }),
497
- };
386
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "Domain", () => input.Domain, "{Domain}", false);
387
+ const query = map({
388
+ StartDate: [
389
+ () => input.StartDate !== void 0,
390
+ () => (input.StartDate.toISOString().split(".")[0] + "Z").toString(),
391
+ ],
392
+ EndDate: [() => input.EndDate !== void 0, () => (input.EndDate.toISOString().split(".")[0] + "Z").toString()],
393
+ });
498
394
  let body;
499
395
  return new protocol_http_1.HttpRequest({
500
396
  protocol,
@@ -512,16 +408,7 @@ const serializeAws_restJson1GetEmailIdentityCommand = async (input, context) =>
512
408
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
513
409
  const headers = {};
514
410
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/email/identities/{EmailIdentity}";
515
- if (input.EmailIdentity !== undefined) {
516
- const labelValue = input.EmailIdentity;
517
- if (labelValue.length <= 0) {
518
- throw new Error("Empty value provided for input HTTP label: EmailIdentity.");
519
- }
520
- resolvedPath = resolvedPath.replace("{EmailIdentity}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
521
- }
522
- else {
523
- throw new Error("No value provided for input HTTP label: EmailIdentity.");
524
- }
411
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "EmailIdentity", () => input.EmailIdentity, "{EmailIdentity}", false);
525
412
  let body;
526
413
  return new protocol_http_1.HttpRequest({
527
414
  protocol,
@@ -538,10 +425,10 @@ const serializeAws_restJson1ListConfigurationSetsCommand = async (input, context
538
425
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
539
426
  const headers = {};
540
427
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/email/configuration-sets";
541
- const query = {
542
- ...(input.NextToken !== undefined && { NextToken: input.NextToken }),
543
- ...(input.PageSize !== undefined && { PageSize: input.PageSize.toString() }),
544
- };
428
+ const query = map({
429
+ NextToken: [, input.NextToken],
430
+ PageSize: [() => input.PageSize !== void 0, () => input.PageSize.toString()],
431
+ });
545
432
  let body;
546
433
  return new protocol_http_1.HttpRequest({
547
434
  protocol,
@@ -559,10 +446,10 @@ const serializeAws_restJson1ListDedicatedIpPoolsCommand = async (input, context)
559
446
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
560
447
  const headers = {};
561
448
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/email/dedicated-ip-pools";
562
- const query = {
563
- ...(input.NextToken !== undefined && { NextToken: input.NextToken }),
564
- ...(input.PageSize !== undefined && { PageSize: input.PageSize.toString() }),
565
- };
449
+ const query = map({
450
+ NextToken: [, input.NextToken],
451
+ PageSize: [() => input.PageSize !== void 0, () => input.PageSize.toString()],
452
+ });
566
453
  let body;
567
454
  return new protocol_http_1.HttpRequest({
568
455
  protocol,
@@ -581,10 +468,10 @@ const serializeAws_restJson1ListDeliverabilityTestReportsCommand = async (input,
581
468
  const headers = {};
582
469
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
583
470
  "/v1/email/deliverability-dashboard/test-reports";
584
- const query = {
585
- ...(input.NextToken !== undefined && { NextToken: input.NextToken }),
586
- ...(input.PageSize !== undefined && { PageSize: input.PageSize.toString() }),
587
- };
471
+ const query = map({
472
+ NextToken: [, input.NextToken],
473
+ PageSize: [() => input.PageSize !== void 0, () => input.PageSize.toString()],
474
+ });
588
475
  let body;
589
476
  return new protocol_http_1.HttpRequest({
590
477
  protocol,
@@ -603,22 +490,16 @@ const serializeAws_restJson1ListDomainDeliverabilityCampaignsCommand = async (in
603
490
  const headers = {};
604
491
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
605
492
  "/v1/email/deliverability-dashboard/domains/{SubscribedDomain}/campaigns";
606
- if (input.SubscribedDomain !== undefined) {
607
- const labelValue = input.SubscribedDomain;
608
- if (labelValue.length <= 0) {
609
- throw new Error("Empty value provided for input HTTP label: SubscribedDomain.");
610
- }
611
- resolvedPath = resolvedPath.replace("{SubscribedDomain}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
612
- }
613
- else {
614
- throw new Error("No value provided for input HTTP label: SubscribedDomain.");
615
- }
616
- const query = {
617
- ...(input.StartDate !== undefined && { StartDate: (input.StartDate.toISOString().split(".")[0] + "Z").toString() }),
618
- ...(input.EndDate !== undefined && { EndDate: (input.EndDate.toISOString().split(".")[0] + "Z").toString() }),
619
- ...(input.NextToken !== undefined && { NextToken: input.NextToken }),
620
- ...(input.PageSize !== undefined && { PageSize: input.PageSize.toString() }),
621
- };
493
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "SubscribedDomain", () => input.SubscribedDomain, "{SubscribedDomain}", false);
494
+ const query = map({
495
+ StartDate: [
496
+ () => input.StartDate !== void 0,
497
+ () => (input.StartDate.toISOString().split(".")[0] + "Z").toString(),
498
+ ],
499
+ EndDate: [() => input.EndDate !== void 0, () => (input.EndDate.toISOString().split(".")[0] + "Z").toString()],
500
+ NextToken: [, input.NextToken],
501
+ PageSize: [() => input.PageSize !== void 0, () => input.PageSize.toString()],
502
+ });
622
503
  let body;
623
504
  return new protocol_http_1.HttpRequest({
624
505
  protocol,
@@ -636,10 +517,10 @@ const serializeAws_restJson1ListEmailIdentitiesCommand = async (input, context)
636
517
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
637
518
  const headers = {};
638
519
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/email/identities";
639
- const query = {
640
- ...(input.NextToken !== undefined && { NextToken: input.NextToken }),
641
- ...(input.PageSize !== undefined && { PageSize: input.PageSize.toString() }),
642
- };
520
+ const query = map({
521
+ NextToken: [, input.NextToken],
522
+ PageSize: [() => input.PageSize !== void 0, () => input.PageSize.toString()],
523
+ });
643
524
  let body;
644
525
  return new protocol_http_1.HttpRequest({
645
526
  protocol,
@@ -657,9 +538,9 @@ const serializeAws_restJson1ListTagsForResourceCommand = async (input, context)
657
538
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
658
539
  const headers = {};
659
540
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/email/tags";
660
- const query = {
661
- ...(input.ResourceArn !== undefined && { ResourceArn: input.ResourceArn }),
662
- };
541
+ const query = map({
542
+ ResourceArn: [, input.ResourceArn],
543
+ });
663
544
  let body;
664
545
  return new protocol_http_1.HttpRequest({
665
546
  protocol,
@@ -722,16 +603,7 @@ const serializeAws_restJson1PutConfigurationSetDeliveryOptionsCommand = async (i
722
603
  };
723
604
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
724
605
  "/v1/email/configuration-sets/{ConfigurationSetName}/delivery-options";
725
- if (input.ConfigurationSetName !== undefined) {
726
- const labelValue = input.ConfigurationSetName;
727
- if (labelValue.length <= 0) {
728
- throw new Error("Empty value provided for input HTTP label: ConfigurationSetName.");
729
- }
730
- resolvedPath = resolvedPath.replace("{ConfigurationSetName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
731
- }
732
- else {
733
- throw new Error("No value provided for input HTTP label: ConfigurationSetName.");
734
- }
606
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ConfigurationSetName", () => input.ConfigurationSetName, "{ConfigurationSetName}", false);
735
607
  let body;
736
608
  body = JSON.stringify({
737
609
  ...(input.SendingPoolName != null && { SendingPoolName: input.SendingPoolName }),
@@ -755,16 +627,7 @@ const serializeAws_restJson1PutConfigurationSetReputationOptionsCommand = async
755
627
  };
756
628
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
757
629
  "/v1/email/configuration-sets/{ConfigurationSetName}/reputation-options";
758
- if (input.ConfigurationSetName !== undefined) {
759
- const labelValue = input.ConfigurationSetName;
760
- if (labelValue.length <= 0) {
761
- throw new Error("Empty value provided for input HTTP label: ConfigurationSetName.");
762
- }
763
- resolvedPath = resolvedPath.replace("{ConfigurationSetName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
764
- }
765
- else {
766
- throw new Error("No value provided for input HTTP label: ConfigurationSetName.");
767
- }
630
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ConfigurationSetName", () => input.ConfigurationSetName, "{ConfigurationSetName}", false);
768
631
  let body;
769
632
  body = JSON.stringify({
770
633
  ...(input.ReputationMetricsEnabled != null && { ReputationMetricsEnabled: input.ReputationMetricsEnabled }),
@@ -787,16 +650,7 @@ const serializeAws_restJson1PutConfigurationSetSendingOptionsCommand = async (in
787
650
  };
788
651
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
789
652
  "/v1/email/configuration-sets/{ConfigurationSetName}/sending";
790
- if (input.ConfigurationSetName !== undefined) {
791
- const labelValue = input.ConfigurationSetName;
792
- if (labelValue.length <= 0) {
793
- throw new Error("Empty value provided for input HTTP label: ConfigurationSetName.");
794
- }
795
- resolvedPath = resolvedPath.replace("{ConfigurationSetName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
796
- }
797
- else {
798
- throw new Error("No value provided for input HTTP label: ConfigurationSetName.");
799
- }
653
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ConfigurationSetName", () => input.ConfigurationSetName, "{ConfigurationSetName}", false);
800
654
  let body;
801
655
  body = JSON.stringify({
802
656
  ...(input.SendingEnabled != null && { SendingEnabled: input.SendingEnabled }),
@@ -819,16 +673,7 @@ const serializeAws_restJson1PutConfigurationSetTrackingOptionsCommand = async (i
819
673
  };
820
674
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
821
675
  "/v1/email/configuration-sets/{ConfigurationSetName}/tracking-options";
822
- if (input.ConfigurationSetName !== undefined) {
823
- const labelValue = input.ConfigurationSetName;
824
- if (labelValue.length <= 0) {
825
- throw new Error("Empty value provided for input HTTP label: ConfigurationSetName.");
826
- }
827
- resolvedPath = resolvedPath.replace("{ConfigurationSetName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
828
- }
829
- else {
830
- throw new Error("No value provided for input HTTP label: ConfigurationSetName.");
831
- }
676
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ConfigurationSetName", () => input.ConfigurationSetName, "{ConfigurationSetName}", false);
832
677
  let body;
833
678
  body = JSON.stringify({
834
679
  ...(input.CustomRedirectDomain != null && { CustomRedirectDomain: input.CustomRedirectDomain }),
@@ -850,16 +695,7 @@ const serializeAws_restJson1PutDedicatedIpInPoolCommand = async (input, context)
850
695
  "content-type": "application/json",
851
696
  };
852
697
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/email/dedicated-ips/{Ip}/pool";
853
- if (input.Ip !== undefined) {
854
- const labelValue = input.Ip;
855
- if (labelValue.length <= 0) {
856
- throw new Error("Empty value provided for input HTTP label: Ip.");
857
- }
858
- resolvedPath = resolvedPath.replace("{Ip}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
859
- }
860
- else {
861
- throw new Error("No value provided for input HTTP label: Ip.");
862
- }
698
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "Ip", () => input.Ip, "{Ip}", false);
863
699
  let body;
864
700
  body = JSON.stringify({
865
701
  ...(input.DestinationPoolName != null && { DestinationPoolName: input.DestinationPoolName }),
@@ -881,16 +717,7 @@ const serializeAws_restJson1PutDedicatedIpWarmupAttributesCommand = async (input
881
717
  "content-type": "application/json",
882
718
  };
883
719
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/email/dedicated-ips/{Ip}/warmup";
884
- if (input.Ip !== undefined) {
885
- const labelValue = input.Ip;
886
- if (labelValue.length <= 0) {
887
- throw new Error("Empty value provided for input HTTP label: Ip.");
888
- }
889
- resolvedPath = resolvedPath.replace("{Ip}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
890
- }
891
- else {
892
- throw new Error("No value provided for input HTTP label: Ip.");
893
- }
720
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "Ip", () => input.Ip, "{Ip}", false);
894
721
  let body;
895
722
  body = JSON.stringify({
896
723
  ...(input.WarmupPercentage != null && { WarmupPercentage: input.WarmupPercentage }),
@@ -936,16 +763,7 @@ const serializeAws_restJson1PutEmailIdentityDkimAttributesCommand = async (input
936
763
  "content-type": "application/json",
937
764
  };
938
765
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/email/identities/{EmailIdentity}/dkim";
939
- if (input.EmailIdentity !== undefined) {
940
- const labelValue = input.EmailIdentity;
941
- if (labelValue.length <= 0) {
942
- throw new Error("Empty value provided for input HTTP label: EmailIdentity.");
943
- }
944
- resolvedPath = resolvedPath.replace("{EmailIdentity}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
945
- }
946
- else {
947
- throw new Error("No value provided for input HTTP label: EmailIdentity.");
948
- }
766
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "EmailIdentity", () => input.EmailIdentity, "{EmailIdentity}", false);
949
767
  let body;
950
768
  body = JSON.stringify({
951
769
  ...(input.SigningEnabled != null && { SigningEnabled: input.SigningEnabled }),
@@ -968,16 +786,7 @@ const serializeAws_restJson1PutEmailIdentityFeedbackAttributesCommand = async (i
968
786
  };
969
787
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
970
788
  "/v1/email/identities/{EmailIdentity}/feedback";
971
- if (input.EmailIdentity !== undefined) {
972
- const labelValue = input.EmailIdentity;
973
- if (labelValue.length <= 0) {
974
- throw new Error("Empty value provided for input HTTP label: EmailIdentity.");
975
- }
976
- resolvedPath = resolvedPath.replace("{EmailIdentity}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
977
- }
978
- else {
979
- throw new Error("No value provided for input HTTP label: EmailIdentity.");
980
- }
789
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "EmailIdentity", () => input.EmailIdentity, "{EmailIdentity}", false);
981
790
  let body;
982
791
  body = JSON.stringify({
983
792
  ...(input.EmailForwardingEnabled != null && { EmailForwardingEnabled: input.EmailForwardingEnabled }),
@@ -1000,16 +809,7 @@ const serializeAws_restJson1PutEmailIdentityMailFromAttributesCommand = async (i
1000
809
  };
1001
810
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
1002
811
  "/v1/email/identities/{EmailIdentity}/mail-from";
1003
- if (input.EmailIdentity !== undefined) {
1004
- const labelValue = input.EmailIdentity;
1005
- if (labelValue.length <= 0) {
1006
- throw new Error("Empty value provided for input HTTP label: EmailIdentity.");
1007
- }
1008
- resolvedPath = resolvedPath.replace("{EmailIdentity}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1009
- }
1010
- else {
1011
- throw new Error("No value provided for input HTTP label: EmailIdentity.");
1012
- }
812
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "EmailIdentity", () => input.EmailIdentity, "{EmailIdentity}", false);
1013
813
  let body;
1014
814
  body = JSON.stringify({
1015
815
  ...(input.BehaviorOnMxFailure != null && { BehaviorOnMxFailure: input.BehaviorOnMxFailure }),
@@ -1083,10 +883,10 @@ const serializeAws_restJson1UntagResourceCommand = async (input, context) => {
1083
883
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1084
884
  const headers = {};
1085
885
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/email/tags";
1086
- const query = {
1087
- ...(input.ResourceArn !== undefined && { ResourceArn: input.ResourceArn }),
1088
- ...(input.TagKeys !== undefined && { TagKeys: (input.TagKeys || []).map((_entry) => _entry) }),
1089
- };
886
+ const query = map({
887
+ ResourceArn: [, input.ResourceArn],
888
+ TagKeys: [() => input.TagKeys !== void 0, () => (input.TagKeys || []).map((_entry) => _entry)],
889
+ });
1090
890
  let body;
1091
891
  return new protocol_http_1.HttpRequest({
1092
892
  protocol,
@@ -1107,26 +907,8 @@ const serializeAws_restJson1UpdateConfigurationSetEventDestinationCommand = asyn
1107
907
  };
1108
908
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
1109
909
  "/v1/email/configuration-sets/{ConfigurationSetName}/event-destinations/{EventDestinationName}";
1110
- if (input.ConfigurationSetName !== undefined) {
1111
- const labelValue = input.ConfigurationSetName;
1112
- if (labelValue.length <= 0) {
1113
- throw new Error("Empty value provided for input HTTP label: ConfigurationSetName.");
1114
- }
1115
- resolvedPath = resolvedPath.replace("{ConfigurationSetName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1116
- }
1117
- else {
1118
- throw new Error("No value provided for input HTTP label: ConfigurationSetName.");
1119
- }
1120
- if (input.EventDestinationName !== undefined) {
1121
- const labelValue = input.EventDestinationName;
1122
- if (labelValue.length <= 0) {
1123
- throw new Error("Empty value provided for input HTTP label: EventDestinationName.");
1124
- }
1125
- resolvedPath = resolvedPath.replace("{EventDestinationName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1126
- }
1127
- else {
1128
- throw new Error("No value provided for input HTTP label: EventDestinationName.");
1129
- }
910
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ConfigurationSetName", () => input.ConfigurationSetName, "{ConfigurationSetName}", false);
911
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "EventDestinationName", () => input.EventDestinationName, "{EventDestinationName}", false);
1130
912
  let body;
1131
913
  body = JSON.stringify({
1132
914
  ...(input.EventDestination != null && {
@@ -1148,11 +930,11 @@ const deserializeAws_restJson1CreateConfigurationSetCommand = async (output, con
1148
930
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1149
931
  return deserializeAws_restJson1CreateConfigurationSetCommandError(output, context);
1150
932
  }
1151
- const contents = {
933
+ const contents = map({
1152
934
  $metadata: deserializeMetadata(output),
1153
- };
935
+ });
1154
936
  await collectBody(output.body, context);
1155
- return Promise.resolve(contents);
937
+ return contents;
1156
938
  };
1157
939
  exports.deserializeAws_restJson1CreateConfigurationSetCommand = deserializeAws_restJson1CreateConfigurationSetCommand;
1158
940
  const deserializeAws_restJson1CreateConfigurationSetCommandError = async (output, context) => {
@@ -1160,7 +942,6 @@ const deserializeAws_restJson1CreateConfigurationSetCommandError = async (output
1160
942
  ...output,
1161
943
  body: await parseBody(output.body, context),
1162
944
  };
1163
- let response;
1164
945
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1165
946
  switch (errorCode) {
1166
947
  case "AlreadyExistsException":
@@ -1183,25 +964,23 @@ const deserializeAws_restJson1CreateConfigurationSetCommandError = async (output
1183
964
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1184
965
  default:
1185
966
  const parsedBody = parsedOutput.body;
1186
- const $metadata = deserializeMetadata(output);
1187
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1188
- response = new PinpointEmailServiceException_1.PinpointEmailServiceException({
1189
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1190
- $fault: "client",
1191
- $metadata,
967
+ (0, smithy_client_1.throwDefaultError)({
968
+ output,
969
+ parsedBody,
970
+ exceptionCtor: PinpointEmailServiceException_1.PinpointEmailServiceException,
971
+ errorCode,
1192
972
  });
1193
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1194
973
  }
1195
974
  };
1196
975
  const deserializeAws_restJson1CreateConfigurationSetEventDestinationCommand = async (output, context) => {
1197
976
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1198
977
  return deserializeAws_restJson1CreateConfigurationSetEventDestinationCommandError(output, context);
1199
978
  }
1200
- const contents = {
979
+ const contents = map({
1201
980
  $metadata: deserializeMetadata(output),
1202
- };
981
+ });
1203
982
  await collectBody(output.body, context);
1204
- return Promise.resolve(contents);
983
+ return contents;
1205
984
  };
1206
985
  exports.deserializeAws_restJson1CreateConfigurationSetEventDestinationCommand = deserializeAws_restJson1CreateConfigurationSetEventDestinationCommand;
1207
986
  const deserializeAws_restJson1CreateConfigurationSetEventDestinationCommandError = async (output, context) => {
@@ -1209,7 +988,6 @@ const deserializeAws_restJson1CreateConfigurationSetEventDestinationCommandError
1209
988
  ...output,
1210
989
  body: await parseBody(output.body, context),
1211
990
  };
1212
- let response;
1213
991
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1214
992
  switch (errorCode) {
1215
993
  case "AlreadyExistsException":
@@ -1229,25 +1007,23 @@ const deserializeAws_restJson1CreateConfigurationSetEventDestinationCommandError
1229
1007
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1230
1008
  default:
1231
1009
  const parsedBody = parsedOutput.body;
1232
- const $metadata = deserializeMetadata(output);
1233
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1234
- response = new PinpointEmailServiceException_1.PinpointEmailServiceException({
1235
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1236
- $fault: "client",
1237
- $metadata,
1010
+ (0, smithy_client_1.throwDefaultError)({
1011
+ output,
1012
+ parsedBody,
1013
+ exceptionCtor: PinpointEmailServiceException_1.PinpointEmailServiceException,
1014
+ errorCode,
1238
1015
  });
1239
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1240
1016
  }
1241
1017
  };
1242
1018
  const deserializeAws_restJson1CreateDedicatedIpPoolCommand = async (output, context) => {
1243
1019
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1244
1020
  return deserializeAws_restJson1CreateDedicatedIpPoolCommandError(output, context);
1245
1021
  }
1246
- const contents = {
1022
+ const contents = map({
1247
1023
  $metadata: deserializeMetadata(output),
1248
- };
1024
+ });
1249
1025
  await collectBody(output.body, context);
1250
- return Promise.resolve(contents);
1026
+ return contents;
1251
1027
  };
1252
1028
  exports.deserializeAws_restJson1CreateDedicatedIpPoolCommand = deserializeAws_restJson1CreateDedicatedIpPoolCommand;
1253
1029
  const deserializeAws_restJson1CreateDedicatedIpPoolCommandError = async (output, context) => {
@@ -1255,7 +1031,6 @@ const deserializeAws_restJson1CreateDedicatedIpPoolCommandError = async (output,
1255
1031
  ...output,
1256
1032
  body: await parseBody(output.body, context),
1257
1033
  };
1258
- let response;
1259
1034
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1260
1035
  switch (errorCode) {
1261
1036
  case "AlreadyExistsException":
@@ -1275,33 +1050,29 @@ const deserializeAws_restJson1CreateDedicatedIpPoolCommandError = async (output,
1275
1050
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1276
1051
  default:
1277
1052
  const parsedBody = parsedOutput.body;
1278
- const $metadata = deserializeMetadata(output);
1279
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1280
- response = new PinpointEmailServiceException_1.PinpointEmailServiceException({
1281
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1282
- $fault: "client",
1283
- $metadata,
1053
+ (0, smithy_client_1.throwDefaultError)({
1054
+ output,
1055
+ parsedBody,
1056
+ exceptionCtor: PinpointEmailServiceException_1.PinpointEmailServiceException,
1057
+ errorCode,
1284
1058
  });
1285
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1286
1059
  }
1287
1060
  };
1288
1061
  const deserializeAws_restJson1CreateDeliverabilityTestReportCommand = async (output, context) => {
1289
1062
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1290
1063
  return deserializeAws_restJson1CreateDeliverabilityTestReportCommandError(output, context);
1291
1064
  }
1292
- const contents = {
1065
+ const contents = map({
1293
1066
  $metadata: deserializeMetadata(output),
1294
- DeliverabilityTestStatus: undefined,
1295
- ReportId: undefined,
1296
- };
1067
+ });
1297
1068
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1298
- if (data.DeliverabilityTestStatus !== undefined && data.DeliverabilityTestStatus !== null) {
1069
+ if (data.DeliverabilityTestStatus != null) {
1299
1070
  contents.DeliverabilityTestStatus = (0, smithy_client_1.expectString)(data.DeliverabilityTestStatus);
1300
1071
  }
1301
- if (data.ReportId !== undefined && data.ReportId !== null) {
1072
+ if (data.ReportId != null) {
1302
1073
  contents.ReportId = (0, smithy_client_1.expectString)(data.ReportId);
1303
1074
  }
1304
- return Promise.resolve(contents);
1075
+ return contents;
1305
1076
  };
1306
1077
  exports.deserializeAws_restJson1CreateDeliverabilityTestReportCommand = deserializeAws_restJson1CreateDeliverabilityTestReportCommand;
1307
1078
  const deserializeAws_restJson1CreateDeliverabilityTestReportCommandError = async (output, context) => {
@@ -1309,7 +1080,6 @@ const deserializeAws_restJson1CreateDeliverabilityTestReportCommandError = async
1309
1080
  ...output,
1310
1081
  body: await parseBody(output.body, context),
1311
1082
  };
1312
- let response;
1313
1083
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1314
1084
  switch (errorCode) {
1315
1085
  case "AccountSuspendedException":
@@ -1341,37 +1111,32 @@ const deserializeAws_restJson1CreateDeliverabilityTestReportCommandError = async
1341
1111
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1342
1112
  default:
1343
1113
  const parsedBody = parsedOutput.body;
1344
- const $metadata = deserializeMetadata(output);
1345
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1346
- response = new PinpointEmailServiceException_1.PinpointEmailServiceException({
1347
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1348
- $fault: "client",
1349
- $metadata,
1114
+ (0, smithy_client_1.throwDefaultError)({
1115
+ output,
1116
+ parsedBody,
1117
+ exceptionCtor: PinpointEmailServiceException_1.PinpointEmailServiceException,
1118
+ errorCode,
1350
1119
  });
1351
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1352
1120
  }
1353
1121
  };
1354
1122
  const deserializeAws_restJson1CreateEmailIdentityCommand = async (output, context) => {
1355
1123
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1356
1124
  return deserializeAws_restJson1CreateEmailIdentityCommandError(output, context);
1357
1125
  }
1358
- const contents = {
1126
+ const contents = map({
1359
1127
  $metadata: deserializeMetadata(output),
1360
- DkimAttributes: undefined,
1361
- IdentityType: undefined,
1362
- VerifiedForSendingStatus: undefined,
1363
- };
1128
+ });
1364
1129
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1365
- if (data.DkimAttributes !== undefined && data.DkimAttributes !== null) {
1130
+ if (data.DkimAttributes != null) {
1366
1131
  contents.DkimAttributes = deserializeAws_restJson1DkimAttributes(data.DkimAttributes, context);
1367
1132
  }
1368
- if (data.IdentityType !== undefined && data.IdentityType !== null) {
1133
+ if (data.IdentityType != null) {
1369
1134
  contents.IdentityType = (0, smithy_client_1.expectString)(data.IdentityType);
1370
1135
  }
1371
- if (data.VerifiedForSendingStatus !== undefined && data.VerifiedForSendingStatus !== null) {
1136
+ if (data.VerifiedForSendingStatus != null) {
1372
1137
  contents.VerifiedForSendingStatus = (0, smithy_client_1.expectBoolean)(data.VerifiedForSendingStatus);
1373
1138
  }
1374
- return Promise.resolve(contents);
1139
+ return contents;
1375
1140
  };
1376
1141
  exports.deserializeAws_restJson1CreateEmailIdentityCommand = deserializeAws_restJson1CreateEmailIdentityCommand;
1377
1142
  const deserializeAws_restJson1CreateEmailIdentityCommandError = async (output, context) => {
@@ -1379,7 +1144,6 @@ const deserializeAws_restJson1CreateEmailIdentityCommandError = async (output, c
1379
1144
  ...output,
1380
1145
  body: await parseBody(output.body, context),
1381
1146
  };
1382
- let response;
1383
1147
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1384
1148
  switch (errorCode) {
1385
1149
  case "BadRequestException":
@@ -1396,25 +1160,23 @@ const deserializeAws_restJson1CreateEmailIdentityCommandError = async (output, c
1396
1160
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1397
1161
  default:
1398
1162
  const parsedBody = parsedOutput.body;
1399
- const $metadata = deserializeMetadata(output);
1400
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1401
- response = new PinpointEmailServiceException_1.PinpointEmailServiceException({
1402
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1403
- $fault: "client",
1404
- $metadata,
1163
+ (0, smithy_client_1.throwDefaultError)({
1164
+ output,
1165
+ parsedBody,
1166
+ exceptionCtor: PinpointEmailServiceException_1.PinpointEmailServiceException,
1167
+ errorCode,
1405
1168
  });
1406
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1407
1169
  }
1408
1170
  };
1409
1171
  const deserializeAws_restJson1DeleteConfigurationSetCommand = async (output, context) => {
1410
1172
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1411
1173
  return deserializeAws_restJson1DeleteConfigurationSetCommandError(output, context);
1412
1174
  }
1413
- const contents = {
1175
+ const contents = map({
1414
1176
  $metadata: deserializeMetadata(output),
1415
- };
1177
+ });
1416
1178
  await collectBody(output.body, context);
1417
- return Promise.resolve(contents);
1179
+ return contents;
1418
1180
  };
1419
1181
  exports.deserializeAws_restJson1DeleteConfigurationSetCommand = deserializeAws_restJson1DeleteConfigurationSetCommand;
1420
1182
  const deserializeAws_restJson1DeleteConfigurationSetCommandError = async (output, context) => {
@@ -1422,7 +1184,6 @@ const deserializeAws_restJson1DeleteConfigurationSetCommandError = async (output
1422
1184
  ...output,
1423
1185
  body: await parseBody(output.body, context),
1424
1186
  };
1425
- let response;
1426
1187
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1427
1188
  switch (errorCode) {
1428
1189
  case "BadRequestException":
@@ -1439,25 +1200,23 @@ const deserializeAws_restJson1DeleteConfigurationSetCommandError = async (output
1439
1200
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1440
1201
  default:
1441
1202
  const parsedBody = parsedOutput.body;
1442
- const $metadata = deserializeMetadata(output);
1443
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1444
- response = new PinpointEmailServiceException_1.PinpointEmailServiceException({
1445
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1446
- $fault: "client",
1447
- $metadata,
1203
+ (0, smithy_client_1.throwDefaultError)({
1204
+ output,
1205
+ parsedBody,
1206
+ exceptionCtor: PinpointEmailServiceException_1.PinpointEmailServiceException,
1207
+ errorCode,
1448
1208
  });
1449
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1450
1209
  }
1451
1210
  };
1452
1211
  const deserializeAws_restJson1DeleteConfigurationSetEventDestinationCommand = async (output, context) => {
1453
1212
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1454
1213
  return deserializeAws_restJson1DeleteConfigurationSetEventDestinationCommandError(output, context);
1455
1214
  }
1456
- const contents = {
1215
+ const contents = map({
1457
1216
  $metadata: deserializeMetadata(output),
1458
- };
1217
+ });
1459
1218
  await collectBody(output.body, context);
1460
- return Promise.resolve(contents);
1219
+ return contents;
1461
1220
  };
1462
1221
  exports.deserializeAws_restJson1DeleteConfigurationSetEventDestinationCommand = deserializeAws_restJson1DeleteConfigurationSetEventDestinationCommand;
1463
1222
  const deserializeAws_restJson1DeleteConfigurationSetEventDestinationCommandError = async (output, context) => {
@@ -1465,7 +1224,6 @@ const deserializeAws_restJson1DeleteConfigurationSetEventDestinationCommandError
1465
1224
  ...output,
1466
1225
  body: await parseBody(output.body, context),
1467
1226
  };
1468
- let response;
1469
1227
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1470
1228
  switch (errorCode) {
1471
1229
  case "BadRequestException":
@@ -1479,25 +1237,23 @@ const deserializeAws_restJson1DeleteConfigurationSetEventDestinationCommandError
1479
1237
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1480
1238
  default:
1481
1239
  const parsedBody = parsedOutput.body;
1482
- const $metadata = deserializeMetadata(output);
1483
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1484
- response = new PinpointEmailServiceException_1.PinpointEmailServiceException({
1485
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1486
- $fault: "client",
1487
- $metadata,
1240
+ (0, smithy_client_1.throwDefaultError)({
1241
+ output,
1242
+ parsedBody,
1243
+ exceptionCtor: PinpointEmailServiceException_1.PinpointEmailServiceException,
1244
+ errorCode,
1488
1245
  });
1489
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1490
1246
  }
1491
1247
  };
1492
1248
  const deserializeAws_restJson1DeleteDedicatedIpPoolCommand = async (output, context) => {
1493
1249
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1494
1250
  return deserializeAws_restJson1DeleteDedicatedIpPoolCommandError(output, context);
1495
1251
  }
1496
- const contents = {
1252
+ const contents = map({
1497
1253
  $metadata: deserializeMetadata(output),
1498
- };
1254
+ });
1499
1255
  await collectBody(output.body, context);
1500
- return Promise.resolve(contents);
1256
+ return contents;
1501
1257
  };
1502
1258
  exports.deserializeAws_restJson1DeleteDedicatedIpPoolCommand = deserializeAws_restJson1DeleteDedicatedIpPoolCommand;
1503
1259
  const deserializeAws_restJson1DeleteDedicatedIpPoolCommandError = async (output, context) => {
@@ -1505,7 +1261,6 @@ const deserializeAws_restJson1DeleteDedicatedIpPoolCommandError = async (output,
1505
1261
  ...output,
1506
1262
  body: await parseBody(output.body, context),
1507
1263
  };
1508
- let response;
1509
1264
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1510
1265
  switch (errorCode) {
1511
1266
  case "BadRequestException":
@@ -1522,25 +1277,23 @@ const deserializeAws_restJson1DeleteDedicatedIpPoolCommandError = async (output,
1522
1277
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1523
1278
  default:
1524
1279
  const parsedBody = parsedOutput.body;
1525
- const $metadata = deserializeMetadata(output);
1526
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1527
- response = new PinpointEmailServiceException_1.PinpointEmailServiceException({
1528
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1529
- $fault: "client",
1530
- $metadata,
1280
+ (0, smithy_client_1.throwDefaultError)({
1281
+ output,
1282
+ parsedBody,
1283
+ exceptionCtor: PinpointEmailServiceException_1.PinpointEmailServiceException,
1284
+ errorCode,
1531
1285
  });
1532
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1533
1286
  }
1534
1287
  };
1535
1288
  const deserializeAws_restJson1DeleteEmailIdentityCommand = async (output, context) => {
1536
1289
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1537
1290
  return deserializeAws_restJson1DeleteEmailIdentityCommandError(output, context);
1538
1291
  }
1539
- const contents = {
1292
+ const contents = map({
1540
1293
  $metadata: deserializeMetadata(output),
1541
- };
1294
+ });
1542
1295
  await collectBody(output.body, context);
1543
- return Promise.resolve(contents);
1296
+ return contents;
1544
1297
  };
1545
1298
  exports.deserializeAws_restJson1DeleteEmailIdentityCommand = deserializeAws_restJson1DeleteEmailIdentityCommand;
1546
1299
  const deserializeAws_restJson1DeleteEmailIdentityCommandError = async (output, context) => {
@@ -1548,7 +1301,6 @@ const deserializeAws_restJson1DeleteEmailIdentityCommandError = async (output, c
1548
1301
  ...output,
1549
1302
  body: await parseBody(output.body, context),
1550
1303
  };
1551
- let response;
1552
1304
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1553
1305
  switch (errorCode) {
1554
1306
  case "BadRequestException":
@@ -1565,45 +1317,38 @@ const deserializeAws_restJson1DeleteEmailIdentityCommandError = async (output, c
1565
1317
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1566
1318
  default:
1567
1319
  const parsedBody = parsedOutput.body;
1568
- const $metadata = deserializeMetadata(output);
1569
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1570
- response = new PinpointEmailServiceException_1.PinpointEmailServiceException({
1571
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1572
- $fault: "client",
1573
- $metadata,
1320
+ (0, smithy_client_1.throwDefaultError)({
1321
+ output,
1322
+ parsedBody,
1323
+ exceptionCtor: PinpointEmailServiceException_1.PinpointEmailServiceException,
1324
+ errorCode,
1574
1325
  });
1575
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1576
1326
  }
1577
1327
  };
1578
1328
  const deserializeAws_restJson1GetAccountCommand = async (output, context) => {
1579
1329
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1580
1330
  return deserializeAws_restJson1GetAccountCommandError(output, context);
1581
1331
  }
1582
- const contents = {
1332
+ const contents = map({
1583
1333
  $metadata: deserializeMetadata(output),
1584
- DedicatedIpAutoWarmupEnabled: undefined,
1585
- EnforcementStatus: undefined,
1586
- ProductionAccessEnabled: undefined,
1587
- SendQuota: undefined,
1588
- SendingEnabled: undefined,
1589
- };
1334
+ });
1590
1335
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1591
- if (data.DedicatedIpAutoWarmupEnabled !== undefined && data.DedicatedIpAutoWarmupEnabled !== null) {
1336
+ if (data.DedicatedIpAutoWarmupEnabled != null) {
1592
1337
  contents.DedicatedIpAutoWarmupEnabled = (0, smithy_client_1.expectBoolean)(data.DedicatedIpAutoWarmupEnabled);
1593
1338
  }
1594
- if (data.EnforcementStatus !== undefined && data.EnforcementStatus !== null) {
1339
+ if (data.EnforcementStatus != null) {
1595
1340
  contents.EnforcementStatus = (0, smithy_client_1.expectString)(data.EnforcementStatus);
1596
1341
  }
1597
- if (data.ProductionAccessEnabled !== undefined && data.ProductionAccessEnabled !== null) {
1342
+ if (data.ProductionAccessEnabled != null) {
1598
1343
  contents.ProductionAccessEnabled = (0, smithy_client_1.expectBoolean)(data.ProductionAccessEnabled);
1599
1344
  }
1600
- if (data.SendQuota !== undefined && data.SendQuota !== null) {
1345
+ if (data.SendQuota != null) {
1601
1346
  contents.SendQuota = deserializeAws_restJson1SendQuota(data.SendQuota, context);
1602
1347
  }
1603
- if (data.SendingEnabled !== undefined && data.SendingEnabled !== null) {
1348
+ if (data.SendingEnabled != null) {
1604
1349
  contents.SendingEnabled = (0, smithy_client_1.expectBoolean)(data.SendingEnabled);
1605
1350
  }
1606
- return Promise.resolve(contents);
1351
+ return contents;
1607
1352
  };
1608
1353
  exports.deserializeAws_restJson1GetAccountCommand = deserializeAws_restJson1GetAccountCommand;
1609
1354
  const deserializeAws_restJson1GetAccountCommandError = async (output, context) => {
@@ -1611,7 +1356,6 @@ const deserializeAws_restJson1GetAccountCommandError = async (output, context) =
1611
1356
  ...output,
1612
1357
  body: await parseBody(output.body, context),
1613
1358
  };
1614
- let response;
1615
1359
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1616
1360
  switch (errorCode) {
1617
1361
  case "BadRequestException":
@@ -1622,29 +1366,26 @@ const deserializeAws_restJson1GetAccountCommandError = async (output, context) =
1622
1366
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1623
1367
  default:
1624
1368
  const parsedBody = parsedOutput.body;
1625
- const $metadata = deserializeMetadata(output);
1626
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1627
- response = new PinpointEmailServiceException_1.PinpointEmailServiceException({
1628
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1629
- $fault: "client",
1630
- $metadata,
1369
+ (0, smithy_client_1.throwDefaultError)({
1370
+ output,
1371
+ parsedBody,
1372
+ exceptionCtor: PinpointEmailServiceException_1.PinpointEmailServiceException,
1373
+ errorCode,
1631
1374
  });
1632
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1633
1375
  }
1634
1376
  };
1635
1377
  const deserializeAws_restJson1GetBlacklistReportsCommand = async (output, context) => {
1636
1378
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1637
1379
  return deserializeAws_restJson1GetBlacklistReportsCommandError(output, context);
1638
1380
  }
1639
- const contents = {
1381
+ const contents = map({
1640
1382
  $metadata: deserializeMetadata(output),
1641
- BlacklistReport: undefined,
1642
- };
1383
+ });
1643
1384
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1644
- if (data.BlacklistReport !== undefined && data.BlacklistReport !== null) {
1385
+ if (data.BlacklistReport != null) {
1645
1386
  contents.BlacklistReport = deserializeAws_restJson1BlacklistReport(data.BlacklistReport, context);
1646
1387
  }
1647
- return Promise.resolve(contents);
1388
+ return contents;
1648
1389
  };
1649
1390
  exports.deserializeAws_restJson1GetBlacklistReportsCommand = deserializeAws_restJson1GetBlacklistReportsCommand;
1650
1391
  const deserializeAws_restJson1GetBlacklistReportsCommandError = async (output, context) => {
@@ -1652,7 +1393,6 @@ const deserializeAws_restJson1GetBlacklistReportsCommandError = async (output, c
1652
1393
  ...output,
1653
1394
  body: await parseBody(output.body, context),
1654
1395
  };
1655
- let response;
1656
1396
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1657
1397
  switch (errorCode) {
1658
1398
  case "BadRequestException":
@@ -1666,49 +1406,41 @@ const deserializeAws_restJson1GetBlacklistReportsCommandError = async (output, c
1666
1406
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1667
1407
  default:
1668
1408
  const parsedBody = parsedOutput.body;
1669
- const $metadata = deserializeMetadata(output);
1670
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1671
- response = new PinpointEmailServiceException_1.PinpointEmailServiceException({
1672
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1673
- $fault: "client",
1674
- $metadata,
1409
+ (0, smithy_client_1.throwDefaultError)({
1410
+ output,
1411
+ parsedBody,
1412
+ exceptionCtor: PinpointEmailServiceException_1.PinpointEmailServiceException,
1413
+ errorCode,
1675
1414
  });
1676
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1677
1415
  }
1678
1416
  };
1679
1417
  const deserializeAws_restJson1GetConfigurationSetCommand = async (output, context) => {
1680
1418
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1681
1419
  return deserializeAws_restJson1GetConfigurationSetCommandError(output, context);
1682
1420
  }
1683
- const contents = {
1421
+ const contents = map({
1684
1422
  $metadata: deserializeMetadata(output),
1685
- ConfigurationSetName: undefined,
1686
- DeliveryOptions: undefined,
1687
- ReputationOptions: undefined,
1688
- SendingOptions: undefined,
1689
- Tags: undefined,
1690
- TrackingOptions: undefined,
1691
- };
1423
+ });
1692
1424
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1693
- if (data.ConfigurationSetName !== undefined && data.ConfigurationSetName !== null) {
1425
+ if (data.ConfigurationSetName != null) {
1694
1426
  contents.ConfigurationSetName = (0, smithy_client_1.expectString)(data.ConfigurationSetName);
1695
1427
  }
1696
- if (data.DeliveryOptions !== undefined && data.DeliveryOptions !== null) {
1428
+ if (data.DeliveryOptions != null) {
1697
1429
  contents.DeliveryOptions = deserializeAws_restJson1DeliveryOptions(data.DeliveryOptions, context);
1698
1430
  }
1699
- if (data.ReputationOptions !== undefined && data.ReputationOptions !== null) {
1431
+ if (data.ReputationOptions != null) {
1700
1432
  contents.ReputationOptions = deserializeAws_restJson1ReputationOptions(data.ReputationOptions, context);
1701
1433
  }
1702
- if (data.SendingOptions !== undefined && data.SendingOptions !== null) {
1434
+ if (data.SendingOptions != null) {
1703
1435
  contents.SendingOptions = deserializeAws_restJson1SendingOptions(data.SendingOptions, context);
1704
1436
  }
1705
- if (data.Tags !== undefined && data.Tags !== null) {
1437
+ if (data.Tags != null) {
1706
1438
  contents.Tags = deserializeAws_restJson1TagList(data.Tags, context);
1707
1439
  }
1708
- if (data.TrackingOptions !== undefined && data.TrackingOptions !== null) {
1440
+ if (data.TrackingOptions != null) {
1709
1441
  contents.TrackingOptions = deserializeAws_restJson1TrackingOptions(data.TrackingOptions, context);
1710
1442
  }
1711
- return Promise.resolve(contents);
1443
+ return contents;
1712
1444
  };
1713
1445
  exports.deserializeAws_restJson1GetConfigurationSetCommand = deserializeAws_restJson1GetConfigurationSetCommand;
1714
1446
  const deserializeAws_restJson1GetConfigurationSetCommandError = async (output, context) => {
@@ -1716,7 +1448,6 @@ const deserializeAws_restJson1GetConfigurationSetCommandError = async (output, c
1716
1448
  ...output,
1717
1449
  body: await parseBody(output.body, context),
1718
1450
  };
1719
- let response;
1720
1451
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1721
1452
  switch (errorCode) {
1722
1453
  case "BadRequestException":
@@ -1730,29 +1461,26 @@ const deserializeAws_restJson1GetConfigurationSetCommandError = async (output, c
1730
1461
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1731
1462
  default:
1732
1463
  const parsedBody = parsedOutput.body;
1733
- const $metadata = deserializeMetadata(output);
1734
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1735
- response = new PinpointEmailServiceException_1.PinpointEmailServiceException({
1736
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1737
- $fault: "client",
1738
- $metadata,
1464
+ (0, smithy_client_1.throwDefaultError)({
1465
+ output,
1466
+ parsedBody,
1467
+ exceptionCtor: PinpointEmailServiceException_1.PinpointEmailServiceException,
1468
+ errorCode,
1739
1469
  });
1740
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1741
1470
  }
1742
1471
  };
1743
1472
  const deserializeAws_restJson1GetConfigurationSetEventDestinationsCommand = async (output, context) => {
1744
1473
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1745
1474
  return deserializeAws_restJson1GetConfigurationSetEventDestinationsCommandError(output, context);
1746
1475
  }
1747
- const contents = {
1476
+ const contents = map({
1748
1477
  $metadata: deserializeMetadata(output),
1749
- EventDestinations: undefined,
1750
- };
1478
+ });
1751
1479
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1752
- if (data.EventDestinations !== undefined && data.EventDestinations !== null) {
1480
+ if (data.EventDestinations != null) {
1753
1481
  contents.EventDestinations = deserializeAws_restJson1EventDestinations(data.EventDestinations, context);
1754
1482
  }
1755
- return Promise.resolve(contents);
1483
+ return contents;
1756
1484
  };
1757
1485
  exports.deserializeAws_restJson1GetConfigurationSetEventDestinationsCommand = deserializeAws_restJson1GetConfigurationSetEventDestinationsCommand;
1758
1486
  const deserializeAws_restJson1GetConfigurationSetEventDestinationsCommandError = async (output, context) => {
@@ -1760,7 +1488,6 @@ const deserializeAws_restJson1GetConfigurationSetEventDestinationsCommandError =
1760
1488
  ...output,
1761
1489
  body: await parseBody(output.body, context),
1762
1490
  };
1763
- let response;
1764
1491
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1765
1492
  switch (errorCode) {
1766
1493
  case "BadRequestException":
@@ -1774,29 +1501,26 @@ const deserializeAws_restJson1GetConfigurationSetEventDestinationsCommandError =
1774
1501
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1775
1502
  default:
1776
1503
  const parsedBody = parsedOutput.body;
1777
- const $metadata = deserializeMetadata(output);
1778
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1779
- response = new PinpointEmailServiceException_1.PinpointEmailServiceException({
1780
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1781
- $fault: "client",
1782
- $metadata,
1504
+ (0, smithy_client_1.throwDefaultError)({
1505
+ output,
1506
+ parsedBody,
1507
+ exceptionCtor: PinpointEmailServiceException_1.PinpointEmailServiceException,
1508
+ errorCode,
1783
1509
  });
1784
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1785
1510
  }
1786
1511
  };
1787
1512
  const deserializeAws_restJson1GetDedicatedIpCommand = async (output, context) => {
1788
1513
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1789
1514
  return deserializeAws_restJson1GetDedicatedIpCommandError(output, context);
1790
1515
  }
1791
- const contents = {
1516
+ const contents = map({
1792
1517
  $metadata: deserializeMetadata(output),
1793
- DedicatedIp: undefined,
1794
- };
1518
+ });
1795
1519
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1796
- if (data.DedicatedIp !== undefined && data.DedicatedIp !== null) {
1520
+ if (data.DedicatedIp != null) {
1797
1521
  contents.DedicatedIp = deserializeAws_restJson1DedicatedIp(data.DedicatedIp, context);
1798
1522
  }
1799
- return Promise.resolve(contents);
1523
+ return contents;
1800
1524
  };
1801
1525
  exports.deserializeAws_restJson1GetDedicatedIpCommand = deserializeAws_restJson1GetDedicatedIpCommand;
1802
1526
  const deserializeAws_restJson1GetDedicatedIpCommandError = async (output, context) => {
@@ -1804,7 +1528,6 @@ const deserializeAws_restJson1GetDedicatedIpCommandError = async (output, contex
1804
1528
  ...output,
1805
1529
  body: await parseBody(output.body, context),
1806
1530
  };
1807
- let response;
1808
1531
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1809
1532
  switch (errorCode) {
1810
1533
  case "BadRequestException":
@@ -1818,33 +1541,29 @@ const deserializeAws_restJson1GetDedicatedIpCommandError = async (output, contex
1818
1541
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1819
1542
  default:
1820
1543
  const parsedBody = parsedOutput.body;
1821
- const $metadata = deserializeMetadata(output);
1822
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1823
- response = new PinpointEmailServiceException_1.PinpointEmailServiceException({
1824
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1825
- $fault: "client",
1826
- $metadata,
1544
+ (0, smithy_client_1.throwDefaultError)({
1545
+ output,
1546
+ parsedBody,
1547
+ exceptionCtor: PinpointEmailServiceException_1.PinpointEmailServiceException,
1548
+ errorCode,
1827
1549
  });
1828
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1829
1550
  }
1830
1551
  };
1831
1552
  const deserializeAws_restJson1GetDedicatedIpsCommand = async (output, context) => {
1832
1553
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1833
1554
  return deserializeAws_restJson1GetDedicatedIpsCommandError(output, context);
1834
1555
  }
1835
- const contents = {
1556
+ const contents = map({
1836
1557
  $metadata: deserializeMetadata(output),
1837
- DedicatedIps: undefined,
1838
- NextToken: undefined,
1839
- };
1558
+ });
1840
1559
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1841
- if (data.DedicatedIps !== undefined && data.DedicatedIps !== null) {
1560
+ if (data.DedicatedIps != null) {
1842
1561
  contents.DedicatedIps = deserializeAws_restJson1DedicatedIpList(data.DedicatedIps, context);
1843
1562
  }
1844
- if (data.NextToken !== undefined && data.NextToken !== null) {
1563
+ if (data.NextToken != null) {
1845
1564
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
1846
1565
  }
1847
- return Promise.resolve(contents);
1566
+ return contents;
1848
1567
  };
1849
1568
  exports.deserializeAws_restJson1GetDedicatedIpsCommand = deserializeAws_restJson1GetDedicatedIpsCommand;
1850
1569
  const deserializeAws_restJson1GetDedicatedIpsCommandError = async (output, context) => {
@@ -1852,7 +1571,6 @@ const deserializeAws_restJson1GetDedicatedIpsCommandError = async (output, conte
1852
1571
  ...output,
1853
1572
  body: await parseBody(output.body, context),
1854
1573
  };
1855
- let response;
1856
1574
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1857
1575
  switch (errorCode) {
1858
1576
  case "BadRequestException":
@@ -1866,45 +1584,38 @@ const deserializeAws_restJson1GetDedicatedIpsCommandError = async (output, conte
1866
1584
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1867
1585
  default:
1868
1586
  const parsedBody = parsedOutput.body;
1869
- const $metadata = deserializeMetadata(output);
1870
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1871
- response = new PinpointEmailServiceException_1.PinpointEmailServiceException({
1872
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1873
- $fault: "client",
1874
- $metadata,
1587
+ (0, smithy_client_1.throwDefaultError)({
1588
+ output,
1589
+ parsedBody,
1590
+ exceptionCtor: PinpointEmailServiceException_1.PinpointEmailServiceException,
1591
+ errorCode,
1875
1592
  });
1876
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1877
1593
  }
1878
1594
  };
1879
1595
  const deserializeAws_restJson1GetDeliverabilityDashboardOptionsCommand = async (output, context) => {
1880
1596
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1881
1597
  return deserializeAws_restJson1GetDeliverabilityDashboardOptionsCommandError(output, context);
1882
1598
  }
1883
- const contents = {
1599
+ const contents = map({
1884
1600
  $metadata: deserializeMetadata(output),
1885
- AccountStatus: undefined,
1886
- ActiveSubscribedDomains: undefined,
1887
- DashboardEnabled: undefined,
1888
- PendingExpirationSubscribedDomains: undefined,
1889
- SubscriptionExpiryDate: undefined,
1890
- };
1601
+ });
1891
1602
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1892
- if (data.AccountStatus !== undefined && data.AccountStatus !== null) {
1603
+ if (data.AccountStatus != null) {
1893
1604
  contents.AccountStatus = (0, smithy_client_1.expectString)(data.AccountStatus);
1894
1605
  }
1895
- if (data.ActiveSubscribedDomains !== undefined && data.ActiveSubscribedDomains !== null) {
1606
+ if (data.ActiveSubscribedDomains != null) {
1896
1607
  contents.ActiveSubscribedDomains = deserializeAws_restJson1DomainDeliverabilityTrackingOptions(data.ActiveSubscribedDomains, context);
1897
1608
  }
1898
- if (data.DashboardEnabled !== undefined && data.DashboardEnabled !== null) {
1609
+ if (data.DashboardEnabled != null) {
1899
1610
  contents.DashboardEnabled = (0, smithy_client_1.expectBoolean)(data.DashboardEnabled);
1900
1611
  }
1901
- if (data.PendingExpirationSubscribedDomains !== undefined && data.PendingExpirationSubscribedDomains !== null) {
1612
+ if (data.PendingExpirationSubscribedDomains != null) {
1902
1613
  contents.PendingExpirationSubscribedDomains = deserializeAws_restJson1DomainDeliverabilityTrackingOptions(data.PendingExpirationSubscribedDomains, context);
1903
1614
  }
1904
- if (data.SubscriptionExpiryDate !== undefined && data.SubscriptionExpiryDate !== null) {
1615
+ if (data.SubscriptionExpiryDate != null) {
1905
1616
  contents.SubscriptionExpiryDate = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(data.SubscriptionExpiryDate)));
1906
1617
  }
1907
- return Promise.resolve(contents);
1618
+ return contents;
1908
1619
  };
1909
1620
  exports.deserializeAws_restJson1GetDeliverabilityDashboardOptionsCommand = deserializeAws_restJson1GetDeliverabilityDashboardOptionsCommand;
1910
1621
  const deserializeAws_restJson1GetDeliverabilityDashboardOptionsCommandError = async (output, context) => {
@@ -1912,7 +1623,6 @@ const deserializeAws_restJson1GetDeliverabilityDashboardOptionsCommandError = as
1912
1623
  ...output,
1913
1624
  body: await parseBody(output.body, context),
1914
1625
  };
1915
- let response;
1916
1626
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1917
1627
  switch (errorCode) {
1918
1628
  case "BadRequestException":
@@ -1926,45 +1636,38 @@ const deserializeAws_restJson1GetDeliverabilityDashboardOptionsCommandError = as
1926
1636
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1927
1637
  default:
1928
1638
  const parsedBody = parsedOutput.body;
1929
- const $metadata = deserializeMetadata(output);
1930
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1931
- response = new PinpointEmailServiceException_1.PinpointEmailServiceException({
1932
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1933
- $fault: "client",
1934
- $metadata,
1639
+ (0, smithy_client_1.throwDefaultError)({
1640
+ output,
1641
+ parsedBody,
1642
+ exceptionCtor: PinpointEmailServiceException_1.PinpointEmailServiceException,
1643
+ errorCode,
1935
1644
  });
1936
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1937
1645
  }
1938
1646
  };
1939
1647
  const deserializeAws_restJson1GetDeliverabilityTestReportCommand = async (output, context) => {
1940
1648
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1941
1649
  return deserializeAws_restJson1GetDeliverabilityTestReportCommandError(output, context);
1942
1650
  }
1943
- const contents = {
1651
+ const contents = map({
1944
1652
  $metadata: deserializeMetadata(output),
1945
- DeliverabilityTestReport: undefined,
1946
- IspPlacements: undefined,
1947
- Message: undefined,
1948
- OverallPlacement: undefined,
1949
- Tags: undefined,
1950
- };
1653
+ });
1951
1654
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1952
- if (data.DeliverabilityTestReport !== undefined && data.DeliverabilityTestReport !== null) {
1655
+ if (data.DeliverabilityTestReport != null) {
1953
1656
  contents.DeliverabilityTestReport = deserializeAws_restJson1DeliverabilityTestReport(data.DeliverabilityTestReport, context);
1954
1657
  }
1955
- if (data.IspPlacements !== undefined && data.IspPlacements !== null) {
1658
+ if (data.IspPlacements != null) {
1956
1659
  contents.IspPlacements = deserializeAws_restJson1IspPlacements(data.IspPlacements, context);
1957
1660
  }
1958
- if (data.Message !== undefined && data.Message !== null) {
1661
+ if (data.Message != null) {
1959
1662
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
1960
1663
  }
1961
- if (data.OverallPlacement !== undefined && data.OverallPlacement !== null) {
1664
+ if (data.OverallPlacement != null) {
1962
1665
  contents.OverallPlacement = deserializeAws_restJson1PlacementStatistics(data.OverallPlacement, context);
1963
1666
  }
1964
- if (data.Tags !== undefined && data.Tags !== null) {
1667
+ if (data.Tags != null) {
1965
1668
  contents.Tags = deserializeAws_restJson1TagList(data.Tags, context);
1966
1669
  }
1967
- return Promise.resolve(contents);
1670
+ return contents;
1968
1671
  };
1969
1672
  exports.deserializeAws_restJson1GetDeliverabilityTestReportCommand = deserializeAws_restJson1GetDeliverabilityTestReportCommand;
1970
1673
  const deserializeAws_restJson1GetDeliverabilityTestReportCommandError = async (output, context) => {
@@ -1972,7 +1675,6 @@ const deserializeAws_restJson1GetDeliverabilityTestReportCommandError = async (o
1972
1675
  ...output,
1973
1676
  body: await parseBody(output.body, context),
1974
1677
  };
1975
- let response;
1976
1678
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1977
1679
  switch (errorCode) {
1978
1680
  case "BadRequestException":
@@ -1986,29 +1688,26 @@ const deserializeAws_restJson1GetDeliverabilityTestReportCommandError = async (o
1986
1688
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1987
1689
  default:
1988
1690
  const parsedBody = parsedOutput.body;
1989
- const $metadata = deserializeMetadata(output);
1990
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1991
- response = new PinpointEmailServiceException_1.PinpointEmailServiceException({
1992
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1993
- $fault: "client",
1994
- $metadata,
1691
+ (0, smithy_client_1.throwDefaultError)({
1692
+ output,
1693
+ parsedBody,
1694
+ exceptionCtor: PinpointEmailServiceException_1.PinpointEmailServiceException,
1695
+ errorCode,
1995
1696
  });
1996
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1997
1697
  }
1998
1698
  };
1999
1699
  const deserializeAws_restJson1GetDomainDeliverabilityCampaignCommand = async (output, context) => {
2000
1700
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2001
1701
  return deserializeAws_restJson1GetDomainDeliverabilityCampaignCommandError(output, context);
2002
1702
  }
2003
- const contents = {
1703
+ const contents = map({
2004
1704
  $metadata: deserializeMetadata(output),
2005
- DomainDeliverabilityCampaign: undefined,
2006
- };
1705
+ });
2007
1706
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2008
- if (data.DomainDeliverabilityCampaign !== undefined && data.DomainDeliverabilityCampaign !== null) {
1707
+ if (data.DomainDeliverabilityCampaign != null) {
2009
1708
  contents.DomainDeliverabilityCampaign = deserializeAws_restJson1DomainDeliverabilityCampaign(data.DomainDeliverabilityCampaign, context);
2010
1709
  }
2011
- return Promise.resolve(contents);
1710
+ return contents;
2012
1711
  };
2013
1712
  exports.deserializeAws_restJson1GetDomainDeliverabilityCampaignCommand = deserializeAws_restJson1GetDomainDeliverabilityCampaignCommand;
2014
1713
  const deserializeAws_restJson1GetDomainDeliverabilityCampaignCommandError = async (output, context) => {
@@ -2016,7 +1715,6 @@ const deserializeAws_restJson1GetDomainDeliverabilityCampaignCommandError = asyn
2016
1715
  ...output,
2017
1716
  body: await parseBody(output.body, context),
2018
1717
  };
2019
- let response;
2020
1718
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2021
1719
  switch (errorCode) {
2022
1720
  case "BadRequestException":
@@ -2030,33 +1728,29 @@ const deserializeAws_restJson1GetDomainDeliverabilityCampaignCommandError = asyn
2030
1728
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2031
1729
  default:
2032
1730
  const parsedBody = parsedOutput.body;
2033
- const $metadata = deserializeMetadata(output);
2034
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2035
- response = new PinpointEmailServiceException_1.PinpointEmailServiceException({
2036
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2037
- $fault: "client",
2038
- $metadata,
1731
+ (0, smithy_client_1.throwDefaultError)({
1732
+ output,
1733
+ parsedBody,
1734
+ exceptionCtor: PinpointEmailServiceException_1.PinpointEmailServiceException,
1735
+ errorCode,
2039
1736
  });
2040
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2041
1737
  }
2042
1738
  };
2043
1739
  const deserializeAws_restJson1GetDomainStatisticsReportCommand = async (output, context) => {
2044
1740
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2045
1741
  return deserializeAws_restJson1GetDomainStatisticsReportCommandError(output, context);
2046
1742
  }
2047
- const contents = {
1743
+ const contents = map({
2048
1744
  $metadata: deserializeMetadata(output),
2049
- DailyVolumes: undefined,
2050
- OverallVolume: undefined,
2051
- };
1745
+ });
2052
1746
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2053
- if (data.DailyVolumes !== undefined && data.DailyVolumes !== null) {
1747
+ if (data.DailyVolumes != null) {
2054
1748
  contents.DailyVolumes = deserializeAws_restJson1DailyVolumes(data.DailyVolumes, context);
2055
1749
  }
2056
- if (data.OverallVolume !== undefined && data.OverallVolume !== null) {
1750
+ if (data.OverallVolume != null) {
2057
1751
  contents.OverallVolume = deserializeAws_restJson1OverallVolume(data.OverallVolume, context);
2058
1752
  }
2059
- return Promise.resolve(contents);
1753
+ return contents;
2060
1754
  };
2061
1755
  exports.deserializeAws_restJson1GetDomainStatisticsReportCommand = deserializeAws_restJson1GetDomainStatisticsReportCommand;
2062
1756
  const deserializeAws_restJson1GetDomainStatisticsReportCommandError = async (output, context) => {
@@ -2064,7 +1758,6 @@ const deserializeAws_restJson1GetDomainStatisticsReportCommandError = async (out
2064
1758
  ...output,
2065
1759
  body: await parseBody(output.body, context),
2066
1760
  };
2067
- let response;
2068
1761
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2069
1762
  switch (errorCode) {
2070
1763
  case "BadRequestException":
@@ -2078,49 +1771,41 @@ const deserializeAws_restJson1GetDomainStatisticsReportCommandError = async (out
2078
1771
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2079
1772
  default:
2080
1773
  const parsedBody = parsedOutput.body;
2081
- const $metadata = deserializeMetadata(output);
2082
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2083
- response = new PinpointEmailServiceException_1.PinpointEmailServiceException({
2084
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2085
- $fault: "client",
2086
- $metadata,
1774
+ (0, smithy_client_1.throwDefaultError)({
1775
+ output,
1776
+ parsedBody,
1777
+ exceptionCtor: PinpointEmailServiceException_1.PinpointEmailServiceException,
1778
+ errorCode,
2087
1779
  });
2088
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2089
1780
  }
2090
1781
  };
2091
1782
  const deserializeAws_restJson1GetEmailIdentityCommand = async (output, context) => {
2092
1783
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2093
1784
  return deserializeAws_restJson1GetEmailIdentityCommandError(output, context);
2094
1785
  }
2095
- const contents = {
1786
+ const contents = map({
2096
1787
  $metadata: deserializeMetadata(output),
2097
- DkimAttributes: undefined,
2098
- FeedbackForwardingStatus: undefined,
2099
- IdentityType: undefined,
2100
- MailFromAttributes: undefined,
2101
- Tags: undefined,
2102
- VerifiedForSendingStatus: undefined,
2103
- };
1788
+ });
2104
1789
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2105
- if (data.DkimAttributes !== undefined && data.DkimAttributes !== null) {
1790
+ if (data.DkimAttributes != null) {
2106
1791
  contents.DkimAttributes = deserializeAws_restJson1DkimAttributes(data.DkimAttributes, context);
2107
1792
  }
2108
- if (data.FeedbackForwardingStatus !== undefined && data.FeedbackForwardingStatus !== null) {
1793
+ if (data.FeedbackForwardingStatus != null) {
2109
1794
  contents.FeedbackForwardingStatus = (0, smithy_client_1.expectBoolean)(data.FeedbackForwardingStatus);
2110
1795
  }
2111
- if (data.IdentityType !== undefined && data.IdentityType !== null) {
1796
+ if (data.IdentityType != null) {
2112
1797
  contents.IdentityType = (0, smithy_client_1.expectString)(data.IdentityType);
2113
1798
  }
2114
- if (data.MailFromAttributes !== undefined && data.MailFromAttributes !== null) {
1799
+ if (data.MailFromAttributes != null) {
2115
1800
  contents.MailFromAttributes = deserializeAws_restJson1MailFromAttributes(data.MailFromAttributes, context);
2116
1801
  }
2117
- if (data.Tags !== undefined && data.Tags !== null) {
1802
+ if (data.Tags != null) {
2118
1803
  contents.Tags = deserializeAws_restJson1TagList(data.Tags, context);
2119
1804
  }
2120
- if (data.VerifiedForSendingStatus !== undefined && data.VerifiedForSendingStatus !== null) {
1805
+ if (data.VerifiedForSendingStatus != null) {
2121
1806
  contents.VerifiedForSendingStatus = (0, smithy_client_1.expectBoolean)(data.VerifiedForSendingStatus);
2122
1807
  }
2123
- return Promise.resolve(contents);
1808
+ return contents;
2124
1809
  };
2125
1810
  exports.deserializeAws_restJson1GetEmailIdentityCommand = deserializeAws_restJson1GetEmailIdentityCommand;
2126
1811
  const deserializeAws_restJson1GetEmailIdentityCommandError = async (output, context) => {
@@ -2128,7 +1813,6 @@ const deserializeAws_restJson1GetEmailIdentityCommandError = async (output, cont
2128
1813
  ...output,
2129
1814
  body: await parseBody(output.body, context),
2130
1815
  };
2131
- let response;
2132
1816
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2133
1817
  switch (errorCode) {
2134
1818
  case "BadRequestException":
@@ -2142,33 +1826,29 @@ const deserializeAws_restJson1GetEmailIdentityCommandError = async (output, cont
2142
1826
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2143
1827
  default:
2144
1828
  const parsedBody = parsedOutput.body;
2145
- const $metadata = deserializeMetadata(output);
2146
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2147
- response = new PinpointEmailServiceException_1.PinpointEmailServiceException({
2148
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2149
- $fault: "client",
2150
- $metadata,
1829
+ (0, smithy_client_1.throwDefaultError)({
1830
+ output,
1831
+ parsedBody,
1832
+ exceptionCtor: PinpointEmailServiceException_1.PinpointEmailServiceException,
1833
+ errorCode,
2151
1834
  });
2152
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2153
1835
  }
2154
1836
  };
2155
1837
  const deserializeAws_restJson1ListConfigurationSetsCommand = async (output, context) => {
2156
1838
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2157
1839
  return deserializeAws_restJson1ListConfigurationSetsCommandError(output, context);
2158
1840
  }
2159
- const contents = {
1841
+ const contents = map({
2160
1842
  $metadata: deserializeMetadata(output),
2161
- ConfigurationSets: undefined,
2162
- NextToken: undefined,
2163
- };
1843
+ });
2164
1844
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2165
- if (data.ConfigurationSets !== undefined && data.ConfigurationSets !== null) {
1845
+ if (data.ConfigurationSets != null) {
2166
1846
  contents.ConfigurationSets = deserializeAws_restJson1ConfigurationSetNameList(data.ConfigurationSets, context);
2167
1847
  }
2168
- if (data.NextToken !== undefined && data.NextToken !== null) {
1848
+ if (data.NextToken != null) {
2169
1849
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
2170
1850
  }
2171
- return Promise.resolve(contents);
1851
+ return contents;
2172
1852
  };
2173
1853
  exports.deserializeAws_restJson1ListConfigurationSetsCommand = deserializeAws_restJson1ListConfigurationSetsCommand;
2174
1854
  const deserializeAws_restJson1ListConfigurationSetsCommandError = async (output, context) => {
@@ -2176,7 +1856,6 @@ const deserializeAws_restJson1ListConfigurationSetsCommandError = async (output,
2176
1856
  ...output,
2177
1857
  body: await parseBody(output.body, context),
2178
1858
  };
2179
- let response;
2180
1859
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2181
1860
  switch (errorCode) {
2182
1861
  case "BadRequestException":
@@ -2187,33 +1866,29 @@ const deserializeAws_restJson1ListConfigurationSetsCommandError = async (output,
2187
1866
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2188
1867
  default:
2189
1868
  const parsedBody = parsedOutput.body;
2190
- const $metadata = deserializeMetadata(output);
2191
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2192
- response = new PinpointEmailServiceException_1.PinpointEmailServiceException({
2193
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2194
- $fault: "client",
2195
- $metadata,
1869
+ (0, smithy_client_1.throwDefaultError)({
1870
+ output,
1871
+ parsedBody,
1872
+ exceptionCtor: PinpointEmailServiceException_1.PinpointEmailServiceException,
1873
+ errorCode,
2196
1874
  });
2197
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2198
1875
  }
2199
1876
  };
2200
1877
  const deserializeAws_restJson1ListDedicatedIpPoolsCommand = async (output, context) => {
2201
1878
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2202
1879
  return deserializeAws_restJson1ListDedicatedIpPoolsCommandError(output, context);
2203
1880
  }
2204
- const contents = {
1881
+ const contents = map({
2205
1882
  $metadata: deserializeMetadata(output),
2206
- DedicatedIpPools: undefined,
2207
- NextToken: undefined,
2208
- };
1883
+ });
2209
1884
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2210
- if (data.DedicatedIpPools !== undefined && data.DedicatedIpPools !== null) {
1885
+ if (data.DedicatedIpPools != null) {
2211
1886
  contents.DedicatedIpPools = deserializeAws_restJson1ListOfDedicatedIpPools(data.DedicatedIpPools, context);
2212
1887
  }
2213
- if (data.NextToken !== undefined && data.NextToken !== null) {
1888
+ if (data.NextToken != null) {
2214
1889
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
2215
1890
  }
2216
- return Promise.resolve(contents);
1891
+ return contents;
2217
1892
  };
2218
1893
  exports.deserializeAws_restJson1ListDedicatedIpPoolsCommand = deserializeAws_restJson1ListDedicatedIpPoolsCommand;
2219
1894
  const deserializeAws_restJson1ListDedicatedIpPoolsCommandError = async (output, context) => {
@@ -2221,7 +1896,6 @@ const deserializeAws_restJson1ListDedicatedIpPoolsCommandError = async (output,
2221
1896
  ...output,
2222
1897
  body: await parseBody(output.body, context),
2223
1898
  };
2224
- let response;
2225
1899
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2226
1900
  switch (errorCode) {
2227
1901
  case "BadRequestException":
@@ -2232,33 +1906,29 @@ const deserializeAws_restJson1ListDedicatedIpPoolsCommandError = async (output,
2232
1906
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2233
1907
  default:
2234
1908
  const parsedBody = parsedOutput.body;
2235
- const $metadata = deserializeMetadata(output);
2236
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2237
- response = new PinpointEmailServiceException_1.PinpointEmailServiceException({
2238
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2239
- $fault: "client",
2240
- $metadata,
1909
+ (0, smithy_client_1.throwDefaultError)({
1910
+ output,
1911
+ parsedBody,
1912
+ exceptionCtor: PinpointEmailServiceException_1.PinpointEmailServiceException,
1913
+ errorCode,
2241
1914
  });
2242
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2243
1915
  }
2244
1916
  };
2245
1917
  const deserializeAws_restJson1ListDeliverabilityTestReportsCommand = async (output, context) => {
2246
1918
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2247
1919
  return deserializeAws_restJson1ListDeliverabilityTestReportsCommandError(output, context);
2248
1920
  }
2249
- const contents = {
1921
+ const contents = map({
2250
1922
  $metadata: deserializeMetadata(output),
2251
- DeliverabilityTestReports: undefined,
2252
- NextToken: undefined,
2253
- };
1923
+ });
2254
1924
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2255
- if (data.DeliverabilityTestReports !== undefined && data.DeliverabilityTestReports !== null) {
1925
+ if (data.DeliverabilityTestReports != null) {
2256
1926
  contents.DeliverabilityTestReports = deserializeAws_restJson1DeliverabilityTestReports(data.DeliverabilityTestReports, context);
2257
1927
  }
2258
- if (data.NextToken !== undefined && data.NextToken !== null) {
1928
+ if (data.NextToken != null) {
2259
1929
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
2260
1930
  }
2261
- return Promise.resolve(contents);
1931
+ return contents;
2262
1932
  };
2263
1933
  exports.deserializeAws_restJson1ListDeliverabilityTestReportsCommand = deserializeAws_restJson1ListDeliverabilityTestReportsCommand;
2264
1934
  const deserializeAws_restJson1ListDeliverabilityTestReportsCommandError = async (output, context) => {
@@ -2266,7 +1936,6 @@ const deserializeAws_restJson1ListDeliverabilityTestReportsCommandError = async
2266
1936
  ...output,
2267
1937
  body: await parseBody(output.body, context),
2268
1938
  };
2269
- let response;
2270
1939
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2271
1940
  switch (errorCode) {
2272
1941
  case "BadRequestException":
@@ -2280,33 +1949,29 @@ const deserializeAws_restJson1ListDeliverabilityTestReportsCommandError = async
2280
1949
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2281
1950
  default:
2282
1951
  const parsedBody = parsedOutput.body;
2283
- const $metadata = deserializeMetadata(output);
2284
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2285
- response = new PinpointEmailServiceException_1.PinpointEmailServiceException({
2286
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2287
- $fault: "client",
2288
- $metadata,
1952
+ (0, smithy_client_1.throwDefaultError)({
1953
+ output,
1954
+ parsedBody,
1955
+ exceptionCtor: PinpointEmailServiceException_1.PinpointEmailServiceException,
1956
+ errorCode,
2289
1957
  });
2290
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2291
1958
  }
2292
1959
  };
2293
1960
  const deserializeAws_restJson1ListDomainDeliverabilityCampaignsCommand = async (output, context) => {
2294
1961
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2295
1962
  return deserializeAws_restJson1ListDomainDeliverabilityCampaignsCommandError(output, context);
2296
1963
  }
2297
- const contents = {
1964
+ const contents = map({
2298
1965
  $metadata: deserializeMetadata(output),
2299
- DomainDeliverabilityCampaigns: undefined,
2300
- NextToken: undefined,
2301
- };
1966
+ });
2302
1967
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2303
- if (data.DomainDeliverabilityCampaigns !== undefined && data.DomainDeliverabilityCampaigns !== null) {
1968
+ if (data.DomainDeliverabilityCampaigns != null) {
2304
1969
  contents.DomainDeliverabilityCampaigns = deserializeAws_restJson1DomainDeliverabilityCampaignList(data.DomainDeliverabilityCampaigns, context);
2305
1970
  }
2306
- if (data.NextToken !== undefined && data.NextToken !== null) {
1971
+ if (data.NextToken != null) {
2307
1972
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
2308
1973
  }
2309
- return Promise.resolve(contents);
1974
+ return contents;
2310
1975
  };
2311
1976
  exports.deserializeAws_restJson1ListDomainDeliverabilityCampaignsCommand = deserializeAws_restJson1ListDomainDeliverabilityCampaignsCommand;
2312
1977
  const deserializeAws_restJson1ListDomainDeliverabilityCampaignsCommandError = async (output, context) => {
@@ -2314,7 +1979,6 @@ const deserializeAws_restJson1ListDomainDeliverabilityCampaignsCommandError = as
2314
1979
  ...output,
2315
1980
  body: await parseBody(output.body, context),
2316
1981
  };
2317
- let response;
2318
1982
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2319
1983
  switch (errorCode) {
2320
1984
  case "BadRequestException":
@@ -2328,33 +1992,29 @@ const deserializeAws_restJson1ListDomainDeliverabilityCampaignsCommandError = as
2328
1992
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2329
1993
  default:
2330
1994
  const parsedBody = parsedOutput.body;
2331
- const $metadata = deserializeMetadata(output);
2332
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2333
- response = new PinpointEmailServiceException_1.PinpointEmailServiceException({
2334
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2335
- $fault: "client",
2336
- $metadata,
1995
+ (0, smithy_client_1.throwDefaultError)({
1996
+ output,
1997
+ parsedBody,
1998
+ exceptionCtor: PinpointEmailServiceException_1.PinpointEmailServiceException,
1999
+ errorCode,
2337
2000
  });
2338
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2339
2001
  }
2340
2002
  };
2341
2003
  const deserializeAws_restJson1ListEmailIdentitiesCommand = async (output, context) => {
2342
2004
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2343
2005
  return deserializeAws_restJson1ListEmailIdentitiesCommandError(output, context);
2344
2006
  }
2345
- const contents = {
2007
+ const contents = map({
2346
2008
  $metadata: deserializeMetadata(output),
2347
- EmailIdentities: undefined,
2348
- NextToken: undefined,
2349
- };
2009
+ });
2350
2010
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2351
- if (data.EmailIdentities !== undefined && data.EmailIdentities !== null) {
2011
+ if (data.EmailIdentities != null) {
2352
2012
  contents.EmailIdentities = deserializeAws_restJson1IdentityInfoList(data.EmailIdentities, context);
2353
2013
  }
2354
- if (data.NextToken !== undefined && data.NextToken !== null) {
2014
+ if (data.NextToken != null) {
2355
2015
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
2356
2016
  }
2357
- return Promise.resolve(contents);
2017
+ return contents;
2358
2018
  };
2359
2019
  exports.deserializeAws_restJson1ListEmailIdentitiesCommand = deserializeAws_restJson1ListEmailIdentitiesCommand;
2360
2020
  const deserializeAws_restJson1ListEmailIdentitiesCommandError = async (output, context) => {
@@ -2362,7 +2022,6 @@ const deserializeAws_restJson1ListEmailIdentitiesCommandError = async (output, c
2362
2022
  ...output,
2363
2023
  body: await parseBody(output.body, context),
2364
2024
  };
2365
- let response;
2366
2025
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2367
2026
  switch (errorCode) {
2368
2027
  case "BadRequestException":
@@ -2373,29 +2032,26 @@ const deserializeAws_restJson1ListEmailIdentitiesCommandError = async (output, c
2373
2032
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2374
2033
  default:
2375
2034
  const parsedBody = parsedOutput.body;
2376
- const $metadata = deserializeMetadata(output);
2377
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2378
- response = new PinpointEmailServiceException_1.PinpointEmailServiceException({
2379
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2380
- $fault: "client",
2381
- $metadata,
2035
+ (0, smithy_client_1.throwDefaultError)({
2036
+ output,
2037
+ parsedBody,
2038
+ exceptionCtor: PinpointEmailServiceException_1.PinpointEmailServiceException,
2039
+ errorCode,
2382
2040
  });
2383
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2384
2041
  }
2385
2042
  };
2386
2043
  const deserializeAws_restJson1ListTagsForResourceCommand = async (output, context) => {
2387
2044
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2388
2045
  return deserializeAws_restJson1ListTagsForResourceCommandError(output, context);
2389
2046
  }
2390
- const contents = {
2047
+ const contents = map({
2391
2048
  $metadata: deserializeMetadata(output),
2392
- Tags: undefined,
2393
- };
2049
+ });
2394
2050
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2395
- if (data.Tags !== undefined && data.Tags !== null) {
2051
+ if (data.Tags != null) {
2396
2052
  contents.Tags = deserializeAws_restJson1TagList(data.Tags, context);
2397
2053
  }
2398
- return Promise.resolve(contents);
2054
+ return contents;
2399
2055
  };
2400
2056
  exports.deserializeAws_restJson1ListTagsForResourceCommand = deserializeAws_restJson1ListTagsForResourceCommand;
2401
2057
  const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, context) => {
@@ -2403,7 +2059,6 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
2403
2059
  ...output,
2404
2060
  body: await parseBody(output.body, context),
2405
2061
  };
2406
- let response;
2407
2062
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2408
2063
  switch (errorCode) {
2409
2064
  case "BadRequestException":
@@ -2417,25 +2072,23 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
2417
2072
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2418
2073
  default:
2419
2074
  const parsedBody = parsedOutput.body;
2420
- const $metadata = deserializeMetadata(output);
2421
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2422
- response = new PinpointEmailServiceException_1.PinpointEmailServiceException({
2423
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2424
- $fault: "client",
2425
- $metadata,
2075
+ (0, smithy_client_1.throwDefaultError)({
2076
+ output,
2077
+ parsedBody,
2078
+ exceptionCtor: PinpointEmailServiceException_1.PinpointEmailServiceException,
2079
+ errorCode,
2426
2080
  });
2427
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2428
2081
  }
2429
2082
  };
2430
2083
  const deserializeAws_restJson1PutAccountDedicatedIpWarmupAttributesCommand = async (output, context) => {
2431
2084
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2432
2085
  return deserializeAws_restJson1PutAccountDedicatedIpWarmupAttributesCommandError(output, context);
2433
2086
  }
2434
- const contents = {
2087
+ const contents = map({
2435
2088
  $metadata: deserializeMetadata(output),
2436
- };
2089
+ });
2437
2090
  await collectBody(output.body, context);
2438
- return Promise.resolve(contents);
2091
+ return contents;
2439
2092
  };
2440
2093
  exports.deserializeAws_restJson1PutAccountDedicatedIpWarmupAttributesCommand = deserializeAws_restJson1PutAccountDedicatedIpWarmupAttributesCommand;
2441
2094
  const deserializeAws_restJson1PutAccountDedicatedIpWarmupAttributesCommandError = async (output, context) => {
@@ -2443,7 +2096,6 @@ const deserializeAws_restJson1PutAccountDedicatedIpWarmupAttributesCommandError
2443
2096
  ...output,
2444
2097
  body: await parseBody(output.body, context),
2445
2098
  };
2446
- let response;
2447
2099
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2448
2100
  switch (errorCode) {
2449
2101
  case "BadRequestException":
@@ -2454,25 +2106,23 @@ const deserializeAws_restJson1PutAccountDedicatedIpWarmupAttributesCommandError
2454
2106
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2455
2107
  default:
2456
2108
  const parsedBody = parsedOutput.body;
2457
- const $metadata = deserializeMetadata(output);
2458
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2459
- response = new PinpointEmailServiceException_1.PinpointEmailServiceException({
2460
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2461
- $fault: "client",
2462
- $metadata,
2109
+ (0, smithy_client_1.throwDefaultError)({
2110
+ output,
2111
+ parsedBody,
2112
+ exceptionCtor: PinpointEmailServiceException_1.PinpointEmailServiceException,
2113
+ errorCode,
2463
2114
  });
2464
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2465
2115
  }
2466
2116
  };
2467
2117
  const deserializeAws_restJson1PutAccountSendingAttributesCommand = async (output, context) => {
2468
2118
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2469
2119
  return deserializeAws_restJson1PutAccountSendingAttributesCommandError(output, context);
2470
2120
  }
2471
- const contents = {
2121
+ const contents = map({
2472
2122
  $metadata: deserializeMetadata(output),
2473
- };
2123
+ });
2474
2124
  await collectBody(output.body, context);
2475
- return Promise.resolve(contents);
2125
+ return contents;
2476
2126
  };
2477
2127
  exports.deserializeAws_restJson1PutAccountSendingAttributesCommand = deserializeAws_restJson1PutAccountSendingAttributesCommand;
2478
2128
  const deserializeAws_restJson1PutAccountSendingAttributesCommandError = async (output, context) => {
@@ -2480,7 +2130,6 @@ const deserializeAws_restJson1PutAccountSendingAttributesCommandError = async (o
2480
2130
  ...output,
2481
2131
  body: await parseBody(output.body, context),
2482
2132
  };
2483
- let response;
2484
2133
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2485
2134
  switch (errorCode) {
2486
2135
  case "BadRequestException":
@@ -2491,25 +2140,23 @@ const deserializeAws_restJson1PutAccountSendingAttributesCommandError = async (o
2491
2140
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2492
2141
  default:
2493
2142
  const parsedBody = parsedOutput.body;
2494
- const $metadata = deserializeMetadata(output);
2495
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2496
- response = new PinpointEmailServiceException_1.PinpointEmailServiceException({
2497
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2498
- $fault: "client",
2499
- $metadata,
2143
+ (0, smithy_client_1.throwDefaultError)({
2144
+ output,
2145
+ parsedBody,
2146
+ exceptionCtor: PinpointEmailServiceException_1.PinpointEmailServiceException,
2147
+ errorCode,
2500
2148
  });
2501
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2502
2149
  }
2503
2150
  };
2504
2151
  const deserializeAws_restJson1PutConfigurationSetDeliveryOptionsCommand = async (output, context) => {
2505
2152
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2506
2153
  return deserializeAws_restJson1PutConfigurationSetDeliveryOptionsCommandError(output, context);
2507
2154
  }
2508
- const contents = {
2155
+ const contents = map({
2509
2156
  $metadata: deserializeMetadata(output),
2510
- };
2157
+ });
2511
2158
  await collectBody(output.body, context);
2512
- return Promise.resolve(contents);
2159
+ return contents;
2513
2160
  };
2514
2161
  exports.deserializeAws_restJson1PutConfigurationSetDeliveryOptionsCommand = deserializeAws_restJson1PutConfigurationSetDeliveryOptionsCommand;
2515
2162
  const deserializeAws_restJson1PutConfigurationSetDeliveryOptionsCommandError = async (output, context) => {
@@ -2517,7 +2164,6 @@ const deserializeAws_restJson1PutConfigurationSetDeliveryOptionsCommandError = a
2517
2164
  ...output,
2518
2165
  body: await parseBody(output.body, context),
2519
2166
  };
2520
- let response;
2521
2167
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2522
2168
  switch (errorCode) {
2523
2169
  case "BadRequestException":
@@ -2531,25 +2177,23 @@ const deserializeAws_restJson1PutConfigurationSetDeliveryOptionsCommandError = a
2531
2177
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2532
2178
  default:
2533
2179
  const parsedBody = parsedOutput.body;
2534
- const $metadata = deserializeMetadata(output);
2535
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2536
- response = new PinpointEmailServiceException_1.PinpointEmailServiceException({
2537
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2538
- $fault: "client",
2539
- $metadata,
2180
+ (0, smithy_client_1.throwDefaultError)({
2181
+ output,
2182
+ parsedBody,
2183
+ exceptionCtor: PinpointEmailServiceException_1.PinpointEmailServiceException,
2184
+ errorCode,
2540
2185
  });
2541
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2542
2186
  }
2543
2187
  };
2544
2188
  const deserializeAws_restJson1PutConfigurationSetReputationOptionsCommand = async (output, context) => {
2545
2189
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2546
2190
  return deserializeAws_restJson1PutConfigurationSetReputationOptionsCommandError(output, context);
2547
2191
  }
2548
- const contents = {
2192
+ const contents = map({
2549
2193
  $metadata: deserializeMetadata(output),
2550
- };
2194
+ });
2551
2195
  await collectBody(output.body, context);
2552
- return Promise.resolve(contents);
2196
+ return contents;
2553
2197
  };
2554
2198
  exports.deserializeAws_restJson1PutConfigurationSetReputationOptionsCommand = deserializeAws_restJson1PutConfigurationSetReputationOptionsCommand;
2555
2199
  const deserializeAws_restJson1PutConfigurationSetReputationOptionsCommandError = async (output, context) => {
@@ -2557,7 +2201,6 @@ const deserializeAws_restJson1PutConfigurationSetReputationOptionsCommandError =
2557
2201
  ...output,
2558
2202
  body: await parseBody(output.body, context),
2559
2203
  };
2560
- let response;
2561
2204
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2562
2205
  switch (errorCode) {
2563
2206
  case "BadRequestException":
@@ -2571,25 +2214,23 @@ const deserializeAws_restJson1PutConfigurationSetReputationOptionsCommandError =
2571
2214
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2572
2215
  default:
2573
2216
  const parsedBody = parsedOutput.body;
2574
- const $metadata = deserializeMetadata(output);
2575
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2576
- response = new PinpointEmailServiceException_1.PinpointEmailServiceException({
2577
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2578
- $fault: "client",
2579
- $metadata,
2217
+ (0, smithy_client_1.throwDefaultError)({
2218
+ output,
2219
+ parsedBody,
2220
+ exceptionCtor: PinpointEmailServiceException_1.PinpointEmailServiceException,
2221
+ errorCode,
2580
2222
  });
2581
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2582
2223
  }
2583
2224
  };
2584
2225
  const deserializeAws_restJson1PutConfigurationSetSendingOptionsCommand = async (output, context) => {
2585
2226
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2586
2227
  return deserializeAws_restJson1PutConfigurationSetSendingOptionsCommandError(output, context);
2587
2228
  }
2588
- const contents = {
2229
+ const contents = map({
2589
2230
  $metadata: deserializeMetadata(output),
2590
- };
2231
+ });
2591
2232
  await collectBody(output.body, context);
2592
- return Promise.resolve(contents);
2233
+ return contents;
2593
2234
  };
2594
2235
  exports.deserializeAws_restJson1PutConfigurationSetSendingOptionsCommand = deserializeAws_restJson1PutConfigurationSetSendingOptionsCommand;
2595
2236
  const deserializeAws_restJson1PutConfigurationSetSendingOptionsCommandError = async (output, context) => {
@@ -2597,7 +2238,6 @@ const deserializeAws_restJson1PutConfigurationSetSendingOptionsCommandError = as
2597
2238
  ...output,
2598
2239
  body: await parseBody(output.body, context),
2599
2240
  };
2600
- let response;
2601
2241
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2602
2242
  switch (errorCode) {
2603
2243
  case "BadRequestException":
@@ -2611,25 +2251,23 @@ const deserializeAws_restJson1PutConfigurationSetSendingOptionsCommandError = as
2611
2251
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2612
2252
  default:
2613
2253
  const parsedBody = parsedOutput.body;
2614
- const $metadata = deserializeMetadata(output);
2615
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2616
- response = new PinpointEmailServiceException_1.PinpointEmailServiceException({
2617
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2618
- $fault: "client",
2619
- $metadata,
2254
+ (0, smithy_client_1.throwDefaultError)({
2255
+ output,
2256
+ parsedBody,
2257
+ exceptionCtor: PinpointEmailServiceException_1.PinpointEmailServiceException,
2258
+ errorCode,
2620
2259
  });
2621
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2622
2260
  }
2623
2261
  };
2624
2262
  const deserializeAws_restJson1PutConfigurationSetTrackingOptionsCommand = async (output, context) => {
2625
2263
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2626
2264
  return deserializeAws_restJson1PutConfigurationSetTrackingOptionsCommandError(output, context);
2627
2265
  }
2628
- const contents = {
2266
+ const contents = map({
2629
2267
  $metadata: deserializeMetadata(output),
2630
- };
2268
+ });
2631
2269
  await collectBody(output.body, context);
2632
- return Promise.resolve(contents);
2270
+ return contents;
2633
2271
  };
2634
2272
  exports.deserializeAws_restJson1PutConfigurationSetTrackingOptionsCommand = deserializeAws_restJson1PutConfigurationSetTrackingOptionsCommand;
2635
2273
  const deserializeAws_restJson1PutConfigurationSetTrackingOptionsCommandError = async (output, context) => {
@@ -2637,7 +2275,6 @@ const deserializeAws_restJson1PutConfigurationSetTrackingOptionsCommandError = a
2637
2275
  ...output,
2638
2276
  body: await parseBody(output.body, context),
2639
2277
  };
2640
- let response;
2641
2278
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2642
2279
  switch (errorCode) {
2643
2280
  case "BadRequestException":
@@ -2651,25 +2288,23 @@ const deserializeAws_restJson1PutConfigurationSetTrackingOptionsCommandError = a
2651
2288
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2652
2289
  default:
2653
2290
  const parsedBody = parsedOutput.body;
2654
- const $metadata = deserializeMetadata(output);
2655
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2656
- response = new PinpointEmailServiceException_1.PinpointEmailServiceException({
2657
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2658
- $fault: "client",
2659
- $metadata,
2291
+ (0, smithy_client_1.throwDefaultError)({
2292
+ output,
2293
+ parsedBody,
2294
+ exceptionCtor: PinpointEmailServiceException_1.PinpointEmailServiceException,
2295
+ errorCode,
2660
2296
  });
2661
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2662
2297
  }
2663
2298
  };
2664
2299
  const deserializeAws_restJson1PutDedicatedIpInPoolCommand = async (output, context) => {
2665
2300
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2666
2301
  return deserializeAws_restJson1PutDedicatedIpInPoolCommandError(output, context);
2667
2302
  }
2668
- const contents = {
2303
+ const contents = map({
2669
2304
  $metadata: deserializeMetadata(output),
2670
- };
2305
+ });
2671
2306
  await collectBody(output.body, context);
2672
- return Promise.resolve(contents);
2307
+ return contents;
2673
2308
  };
2674
2309
  exports.deserializeAws_restJson1PutDedicatedIpInPoolCommand = deserializeAws_restJson1PutDedicatedIpInPoolCommand;
2675
2310
  const deserializeAws_restJson1PutDedicatedIpInPoolCommandError = async (output, context) => {
@@ -2677,7 +2312,6 @@ const deserializeAws_restJson1PutDedicatedIpInPoolCommandError = async (output,
2677
2312
  ...output,
2678
2313
  body: await parseBody(output.body, context),
2679
2314
  };
2680
- let response;
2681
2315
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2682
2316
  switch (errorCode) {
2683
2317
  case "BadRequestException":
@@ -2691,25 +2325,23 @@ const deserializeAws_restJson1PutDedicatedIpInPoolCommandError = async (output,
2691
2325
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2692
2326
  default:
2693
2327
  const parsedBody = parsedOutput.body;
2694
- const $metadata = deserializeMetadata(output);
2695
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2696
- response = new PinpointEmailServiceException_1.PinpointEmailServiceException({
2697
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2698
- $fault: "client",
2699
- $metadata,
2328
+ (0, smithy_client_1.throwDefaultError)({
2329
+ output,
2330
+ parsedBody,
2331
+ exceptionCtor: PinpointEmailServiceException_1.PinpointEmailServiceException,
2332
+ errorCode,
2700
2333
  });
2701
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2702
2334
  }
2703
2335
  };
2704
2336
  const deserializeAws_restJson1PutDedicatedIpWarmupAttributesCommand = async (output, context) => {
2705
2337
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2706
2338
  return deserializeAws_restJson1PutDedicatedIpWarmupAttributesCommandError(output, context);
2707
2339
  }
2708
- const contents = {
2340
+ const contents = map({
2709
2341
  $metadata: deserializeMetadata(output),
2710
- };
2342
+ });
2711
2343
  await collectBody(output.body, context);
2712
- return Promise.resolve(contents);
2344
+ return contents;
2713
2345
  };
2714
2346
  exports.deserializeAws_restJson1PutDedicatedIpWarmupAttributesCommand = deserializeAws_restJson1PutDedicatedIpWarmupAttributesCommand;
2715
2347
  const deserializeAws_restJson1PutDedicatedIpWarmupAttributesCommandError = async (output, context) => {
@@ -2717,7 +2349,6 @@ const deserializeAws_restJson1PutDedicatedIpWarmupAttributesCommandError = async
2717
2349
  ...output,
2718
2350
  body: await parseBody(output.body, context),
2719
2351
  };
2720
- let response;
2721
2352
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2722
2353
  switch (errorCode) {
2723
2354
  case "BadRequestException":
@@ -2731,25 +2362,23 @@ const deserializeAws_restJson1PutDedicatedIpWarmupAttributesCommandError = async
2731
2362
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2732
2363
  default:
2733
2364
  const parsedBody = parsedOutput.body;
2734
- const $metadata = deserializeMetadata(output);
2735
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2736
- response = new PinpointEmailServiceException_1.PinpointEmailServiceException({
2737
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2738
- $fault: "client",
2739
- $metadata,
2365
+ (0, smithy_client_1.throwDefaultError)({
2366
+ output,
2367
+ parsedBody,
2368
+ exceptionCtor: PinpointEmailServiceException_1.PinpointEmailServiceException,
2369
+ errorCode,
2740
2370
  });
2741
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2742
2371
  }
2743
2372
  };
2744
2373
  const deserializeAws_restJson1PutDeliverabilityDashboardOptionCommand = async (output, context) => {
2745
2374
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2746
2375
  return deserializeAws_restJson1PutDeliverabilityDashboardOptionCommandError(output, context);
2747
2376
  }
2748
- const contents = {
2377
+ const contents = map({
2749
2378
  $metadata: deserializeMetadata(output),
2750
- };
2379
+ });
2751
2380
  await collectBody(output.body, context);
2752
- return Promise.resolve(contents);
2381
+ return contents;
2753
2382
  };
2754
2383
  exports.deserializeAws_restJson1PutDeliverabilityDashboardOptionCommand = deserializeAws_restJson1PutDeliverabilityDashboardOptionCommand;
2755
2384
  const deserializeAws_restJson1PutDeliverabilityDashboardOptionCommandError = async (output, context) => {
@@ -2757,7 +2386,6 @@ const deserializeAws_restJson1PutDeliverabilityDashboardOptionCommandError = asy
2757
2386
  ...output,
2758
2387
  body: await parseBody(output.body, context),
2759
2388
  };
2760
- let response;
2761
2389
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2762
2390
  switch (errorCode) {
2763
2391
  case "AlreadyExistsException":
@@ -2777,25 +2405,23 @@ const deserializeAws_restJson1PutDeliverabilityDashboardOptionCommandError = asy
2777
2405
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2778
2406
  default:
2779
2407
  const parsedBody = parsedOutput.body;
2780
- const $metadata = deserializeMetadata(output);
2781
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2782
- response = new PinpointEmailServiceException_1.PinpointEmailServiceException({
2783
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2784
- $fault: "client",
2785
- $metadata,
2408
+ (0, smithy_client_1.throwDefaultError)({
2409
+ output,
2410
+ parsedBody,
2411
+ exceptionCtor: PinpointEmailServiceException_1.PinpointEmailServiceException,
2412
+ errorCode,
2786
2413
  });
2787
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2788
2414
  }
2789
2415
  };
2790
2416
  const deserializeAws_restJson1PutEmailIdentityDkimAttributesCommand = async (output, context) => {
2791
2417
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2792
2418
  return deserializeAws_restJson1PutEmailIdentityDkimAttributesCommandError(output, context);
2793
2419
  }
2794
- const contents = {
2420
+ const contents = map({
2795
2421
  $metadata: deserializeMetadata(output),
2796
- };
2422
+ });
2797
2423
  await collectBody(output.body, context);
2798
- return Promise.resolve(contents);
2424
+ return contents;
2799
2425
  };
2800
2426
  exports.deserializeAws_restJson1PutEmailIdentityDkimAttributesCommand = deserializeAws_restJson1PutEmailIdentityDkimAttributesCommand;
2801
2427
  const deserializeAws_restJson1PutEmailIdentityDkimAttributesCommandError = async (output, context) => {
@@ -2803,7 +2429,6 @@ const deserializeAws_restJson1PutEmailIdentityDkimAttributesCommandError = async
2803
2429
  ...output,
2804
2430
  body: await parseBody(output.body, context),
2805
2431
  };
2806
- let response;
2807
2432
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2808
2433
  switch (errorCode) {
2809
2434
  case "BadRequestException":
@@ -2817,25 +2442,23 @@ const deserializeAws_restJson1PutEmailIdentityDkimAttributesCommandError = async
2817
2442
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2818
2443
  default:
2819
2444
  const parsedBody = parsedOutput.body;
2820
- const $metadata = deserializeMetadata(output);
2821
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2822
- response = new PinpointEmailServiceException_1.PinpointEmailServiceException({
2823
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2824
- $fault: "client",
2825
- $metadata,
2445
+ (0, smithy_client_1.throwDefaultError)({
2446
+ output,
2447
+ parsedBody,
2448
+ exceptionCtor: PinpointEmailServiceException_1.PinpointEmailServiceException,
2449
+ errorCode,
2826
2450
  });
2827
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2828
2451
  }
2829
2452
  };
2830
2453
  const deserializeAws_restJson1PutEmailIdentityFeedbackAttributesCommand = async (output, context) => {
2831
2454
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2832
2455
  return deserializeAws_restJson1PutEmailIdentityFeedbackAttributesCommandError(output, context);
2833
2456
  }
2834
- const contents = {
2457
+ const contents = map({
2835
2458
  $metadata: deserializeMetadata(output),
2836
- };
2459
+ });
2837
2460
  await collectBody(output.body, context);
2838
- return Promise.resolve(contents);
2461
+ return contents;
2839
2462
  };
2840
2463
  exports.deserializeAws_restJson1PutEmailIdentityFeedbackAttributesCommand = deserializeAws_restJson1PutEmailIdentityFeedbackAttributesCommand;
2841
2464
  const deserializeAws_restJson1PutEmailIdentityFeedbackAttributesCommandError = async (output, context) => {
@@ -2843,7 +2466,6 @@ const deserializeAws_restJson1PutEmailIdentityFeedbackAttributesCommandError = a
2843
2466
  ...output,
2844
2467
  body: await parseBody(output.body, context),
2845
2468
  };
2846
- let response;
2847
2469
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2848
2470
  switch (errorCode) {
2849
2471
  case "BadRequestException":
@@ -2857,25 +2479,23 @@ const deserializeAws_restJson1PutEmailIdentityFeedbackAttributesCommandError = a
2857
2479
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2858
2480
  default:
2859
2481
  const parsedBody = parsedOutput.body;
2860
- const $metadata = deserializeMetadata(output);
2861
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2862
- response = new PinpointEmailServiceException_1.PinpointEmailServiceException({
2863
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2864
- $fault: "client",
2865
- $metadata,
2482
+ (0, smithy_client_1.throwDefaultError)({
2483
+ output,
2484
+ parsedBody,
2485
+ exceptionCtor: PinpointEmailServiceException_1.PinpointEmailServiceException,
2486
+ errorCode,
2866
2487
  });
2867
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2868
2488
  }
2869
2489
  };
2870
2490
  const deserializeAws_restJson1PutEmailIdentityMailFromAttributesCommand = async (output, context) => {
2871
2491
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2872
2492
  return deserializeAws_restJson1PutEmailIdentityMailFromAttributesCommandError(output, context);
2873
2493
  }
2874
- const contents = {
2494
+ const contents = map({
2875
2495
  $metadata: deserializeMetadata(output),
2876
- };
2496
+ });
2877
2497
  await collectBody(output.body, context);
2878
- return Promise.resolve(contents);
2498
+ return contents;
2879
2499
  };
2880
2500
  exports.deserializeAws_restJson1PutEmailIdentityMailFromAttributesCommand = deserializeAws_restJson1PutEmailIdentityMailFromAttributesCommand;
2881
2501
  const deserializeAws_restJson1PutEmailIdentityMailFromAttributesCommandError = async (output, context) => {
@@ -2883,7 +2503,6 @@ const deserializeAws_restJson1PutEmailIdentityMailFromAttributesCommandError = a
2883
2503
  ...output,
2884
2504
  body: await parseBody(output.body, context),
2885
2505
  };
2886
- let response;
2887
2506
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2888
2507
  switch (errorCode) {
2889
2508
  case "BadRequestException":
@@ -2897,29 +2516,26 @@ const deserializeAws_restJson1PutEmailIdentityMailFromAttributesCommandError = a
2897
2516
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2898
2517
  default:
2899
2518
  const parsedBody = parsedOutput.body;
2900
- const $metadata = deserializeMetadata(output);
2901
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2902
- response = new PinpointEmailServiceException_1.PinpointEmailServiceException({
2903
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2904
- $fault: "client",
2905
- $metadata,
2519
+ (0, smithy_client_1.throwDefaultError)({
2520
+ output,
2521
+ parsedBody,
2522
+ exceptionCtor: PinpointEmailServiceException_1.PinpointEmailServiceException,
2523
+ errorCode,
2906
2524
  });
2907
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2908
2525
  }
2909
2526
  };
2910
2527
  const deserializeAws_restJson1SendEmailCommand = async (output, context) => {
2911
2528
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2912
2529
  return deserializeAws_restJson1SendEmailCommandError(output, context);
2913
2530
  }
2914
- const contents = {
2531
+ const contents = map({
2915
2532
  $metadata: deserializeMetadata(output),
2916
- MessageId: undefined,
2917
- };
2533
+ });
2918
2534
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2919
- if (data.MessageId !== undefined && data.MessageId !== null) {
2535
+ if (data.MessageId != null) {
2920
2536
  contents.MessageId = (0, smithy_client_1.expectString)(data.MessageId);
2921
2537
  }
2922
- return Promise.resolve(contents);
2538
+ return contents;
2923
2539
  };
2924
2540
  exports.deserializeAws_restJson1SendEmailCommand = deserializeAws_restJson1SendEmailCommand;
2925
2541
  const deserializeAws_restJson1SendEmailCommandError = async (output, context) => {
@@ -2927,7 +2543,6 @@ const deserializeAws_restJson1SendEmailCommandError = async (output, context) =>
2927
2543
  ...output,
2928
2544
  body: await parseBody(output.body, context),
2929
2545
  };
2930
- let response;
2931
2546
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2932
2547
  switch (errorCode) {
2933
2548
  case "AccountSuspendedException":
@@ -2956,25 +2571,23 @@ const deserializeAws_restJson1SendEmailCommandError = async (output, context) =>
2956
2571
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2957
2572
  default:
2958
2573
  const parsedBody = parsedOutput.body;
2959
- const $metadata = deserializeMetadata(output);
2960
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2961
- response = new PinpointEmailServiceException_1.PinpointEmailServiceException({
2962
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2963
- $fault: "client",
2964
- $metadata,
2574
+ (0, smithy_client_1.throwDefaultError)({
2575
+ output,
2576
+ parsedBody,
2577
+ exceptionCtor: PinpointEmailServiceException_1.PinpointEmailServiceException,
2578
+ errorCode,
2965
2579
  });
2966
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2967
2580
  }
2968
2581
  };
2969
2582
  const deserializeAws_restJson1TagResourceCommand = async (output, context) => {
2970
2583
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2971
2584
  return deserializeAws_restJson1TagResourceCommandError(output, context);
2972
2585
  }
2973
- const contents = {
2586
+ const contents = map({
2974
2587
  $metadata: deserializeMetadata(output),
2975
- };
2588
+ });
2976
2589
  await collectBody(output.body, context);
2977
- return Promise.resolve(contents);
2590
+ return contents;
2978
2591
  };
2979
2592
  exports.deserializeAws_restJson1TagResourceCommand = deserializeAws_restJson1TagResourceCommand;
2980
2593
  const deserializeAws_restJson1TagResourceCommandError = async (output, context) => {
@@ -2982,7 +2595,6 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
2982
2595
  ...output,
2983
2596
  body: await parseBody(output.body, context),
2984
2597
  };
2985
- let response;
2986
2598
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2987
2599
  switch (errorCode) {
2988
2600
  case "BadRequestException":
@@ -2999,25 +2611,23 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
2999
2611
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
3000
2612
  default:
3001
2613
  const parsedBody = parsedOutput.body;
3002
- const $metadata = deserializeMetadata(output);
3003
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3004
- response = new PinpointEmailServiceException_1.PinpointEmailServiceException({
3005
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3006
- $fault: "client",
3007
- $metadata,
2614
+ (0, smithy_client_1.throwDefaultError)({
2615
+ output,
2616
+ parsedBody,
2617
+ exceptionCtor: PinpointEmailServiceException_1.PinpointEmailServiceException,
2618
+ errorCode,
3008
2619
  });
3009
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3010
2620
  }
3011
2621
  };
3012
2622
  const deserializeAws_restJson1UntagResourceCommand = async (output, context) => {
3013
2623
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3014
2624
  return deserializeAws_restJson1UntagResourceCommandError(output, context);
3015
2625
  }
3016
- const contents = {
2626
+ const contents = map({
3017
2627
  $metadata: deserializeMetadata(output),
3018
- };
2628
+ });
3019
2629
  await collectBody(output.body, context);
3020
- return Promise.resolve(contents);
2630
+ return contents;
3021
2631
  };
3022
2632
  exports.deserializeAws_restJson1UntagResourceCommand = deserializeAws_restJson1UntagResourceCommand;
3023
2633
  const deserializeAws_restJson1UntagResourceCommandError = async (output, context) => {
@@ -3025,7 +2635,6 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
3025
2635
  ...output,
3026
2636
  body: await parseBody(output.body, context),
3027
2637
  };
3028
- let response;
3029
2638
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3030
2639
  switch (errorCode) {
3031
2640
  case "BadRequestException":
@@ -3042,25 +2651,23 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
3042
2651
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
3043
2652
  default:
3044
2653
  const parsedBody = parsedOutput.body;
3045
- const $metadata = deserializeMetadata(output);
3046
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3047
- response = new PinpointEmailServiceException_1.PinpointEmailServiceException({
3048
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3049
- $fault: "client",
3050
- $metadata,
2654
+ (0, smithy_client_1.throwDefaultError)({
2655
+ output,
2656
+ parsedBody,
2657
+ exceptionCtor: PinpointEmailServiceException_1.PinpointEmailServiceException,
2658
+ errorCode,
3051
2659
  });
3052
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3053
2660
  }
3054
2661
  };
3055
2662
  const deserializeAws_restJson1UpdateConfigurationSetEventDestinationCommand = async (output, context) => {
3056
2663
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3057
2664
  return deserializeAws_restJson1UpdateConfigurationSetEventDestinationCommandError(output, context);
3058
2665
  }
3059
- const contents = {
2666
+ const contents = map({
3060
2667
  $metadata: deserializeMetadata(output),
3061
- };
2668
+ });
3062
2669
  await collectBody(output.body, context);
3063
- return Promise.resolve(contents);
2670
+ return contents;
3064
2671
  };
3065
2672
  exports.deserializeAws_restJson1UpdateConfigurationSetEventDestinationCommand = deserializeAws_restJson1UpdateConfigurationSetEventDestinationCommand;
3066
2673
  const deserializeAws_restJson1UpdateConfigurationSetEventDestinationCommandError = async (output, context) => {
@@ -3068,7 +2675,6 @@ const deserializeAws_restJson1UpdateConfigurationSetEventDestinationCommandError
3068
2675
  ...output,
3069
2676
  body: await parseBody(output.body, context),
3070
2677
  };
3071
- let response;
3072
2678
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3073
2679
  switch (errorCode) {
3074
2680
  case "BadRequestException":
@@ -3082,20 +2688,19 @@ const deserializeAws_restJson1UpdateConfigurationSetEventDestinationCommandError
3082
2688
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
3083
2689
  default:
3084
2690
  const parsedBody = parsedOutput.body;
3085
- const $metadata = deserializeMetadata(output);
3086
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3087
- response = new PinpointEmailServiceException_1.PinpointEmailServiceException({
3088
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3089
- $fault: "client",
3090
- $metadata,
2691
+ (0, smithy_client_1.throwDefaultError)({
2692
+ output,
2693
+ parsedBody,
2694
+ exceptionCtor: PinpointEmailServiceException_1.PinpointEmailServiceException,
2695
+ errorCode,
3091
2696
  });
3092
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3093
2697
  }
3094
2698
  };
2699
+ const map = smithy_client_1.map;
3095
2700
  const deserializeAws_restJson1AccountSuspendedExceptionResponse = async (parsedOutput, context) => {
3096
- const contents = {};
2701
+ const contents = map({});
3097
2702
  const data = parsedOutput.body;
3098
- if (data.message !== undefined && data.message !== null) {
2703
+ if (data.message != null) {
3099
2704
  contents.message = (0, smithy_client_1.expectString)(data.message);
3100
2705
  }
3101
2706
  const exception = new models_0_1.AccountSuspendedException({
@@ -3105,9 +2710,9 @@ const deserializeAws_restJson1AccountSuspendedExceptionResponse = async (parsedO
3105
2710
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3106
2711
  };
3107
2712
  const deserializeAws_restJson1AlreadyExistsExceptionResponse = async (parsedOutput, context) => {
3108
- const contents = {};
2713
+ const contents = map({});
3109
2714
  const data = parsedOutput.body;
3110
- if (data.message !== undefined && data.message !== null) {
2715
+ if (data.message != null) {
3111
2716
  contents.message = (0, smithy_client_1.expectString)(data.message);
3112
2717
  }
3113
2718
  const exception = new models_0_1.AlreadyExistsException({
@@ -3117,9 +2722,9 @@ const deserializeAws_restJson1AlreadyExistsExceptionResponse = async (parsedOutp
3117
2722
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3118
2723
  };
3119
2724
  const deserializeAws_restJson1BadRequestExceptionResponse = async (parsedOutput, context) => {
3120
- const contents = {};
2725
+ const contents = map({});
3121
2726
  const data = parsedOutput.body;
3122
- if (data.message !== undefined && data.message !== null) {
2727
+ if (data.message != null) {
3123
2728
  contents.message = (0, smithy_client_1.expectString)(data.message);
3124
2729
  }
3125
2730
  const exception = new models_0_1.BadRequestException({
@@ -3129,9 +2734,9 @@ const deserializeAws_restJson1BadRequestExceptionResponse = async (parsedOutput,
3129
2734
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3130
2735
  };
3131
2736
  const deserializeAws_restJson1ConcurrentModificationExceptionResponse = async (parsedOutput, context) => {
3132
- const contents = {};
2737
+ const contents = map({});
3133
2738
  const data = parsedOutput.body;
3134
- if (data.message !== undefined && data.message !== null) {
2739
+ if (data.message != null) {
3135
2740
  contents.message = (0, smithy_client_1.expectString)(data.message);
3136
2741
  }
3137
2742
  const exception = new models_0_1.ConcurrentModificationException({
@@ -3141,9 +2746,9 @@ const deserializeAws_restJson1ConcurrentModificationExceptionResponse = async (p
3141
2746
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3142
2747
  };
3143
2748
  const deserializeAws_restJson1LimitExceededExceptionResponse = async (parsedOutput, context) => {
3144
- const contents = {};
2749
+ const contents = map({});
3145
2750
  const data = parsedOutput.body;
3146
- if (data.message !== undefined && data.message !== null) {
2751
+ if (data.message != null) {
3147
2752
  contents.message = (0, smithy_client_1.expectString)(data.message);
3148
2753
  }
3149
2754
  const exception = new models_0_1.LimitExceededException({
@@ -3153,9 +2758,9 @@ const deserializeAws_restJson1LimitExceededExceptionResponse = async (parsedOutp
3153
2758
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3154
2759
  };
3155
2760
  const deserializeAws_restJson1MailFromDomainNotVerifiedExceptionResponse = async (parsedOutput, context) => {
3156
- const contents = {};
2761
+ const contents = map({});
3157
2762
  const data = parsedOutput.body;
3158
- if (data.message !== undefined && data.message !== null) {
2763
+ if (data.message != null) {
3159
2764
  contents.message = (0, smithy_client_1.expectString)(data.message);
3160
2765
  }
3161
2766
  const exception = new models_0_1.MailFromDomainNotVerifiedException({
@@ -3165,9 +2770,9 @@ const deserializeAws_restJson1MailFromDomainNotVerifiedExceptionResponse = async
3165
2770
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3166
2771
  };
3167
2772
  const deserializeAws_restJson1MessageRejectedResponse = async (parsedOutput, context) => {
3168
- const contents = {};
2773
+ const contents = map({});
3169
2774
  const data = parsedOutput.body;
3170
- if (data.message !== undefined && data.message !== null) {
2775
+ if (data.message != null) {
3171
2776
  contents.message = (0, smithy_client_1.expectString)(data.message);
3172
2777
  }
3173
2778
  const exception = new models_0_1.MessageRejected({
@@ -3177,9 +2782,9 @@ const deserializeAws_restJson1MessageRejectedResponse = async (parsedOutput, con
3177
2782
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3178
2783
  };
3179
2784
  const deserializeAws_restJson1NotFoundExceptionResponse = async (parsedOutput, context) => {
3180
- const contents = {};
2785
+ const contents = map({});
3181
2786
  const data = parsedOutput.body;
3182
- if (data.message !== undefined && data.message !== null) {
2787
+ if (data.message != null) {
3183
2788
  contents.message = (0, smithy_client_1.expectString)(data.message);
3184
2789
  }
3185
2790
  const exception = new models_0_1.NotFoundException({
@@ -3189,9 +2794,9 @@ const deserializeAws_restJson1NotFoundExceptionResponse = async (parsedOutput, c
3189
2794
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3190
2795
  };
3191
2796
  const deserializeAws_restJson1SendingPausedExceptionResponse = async (parsedOutput, context) => {
3192
- const contents = {};
2797
+ const contents = map({});
3193
2798
  const data = parsedOutput.body;
3194
- if (data.message !== undefined && data.message !== null) {
2799
+ if (data.message != null) {
3195
2800
  contents.message = (0, smithy_client_1.expectString)(data.message);
3196
2801
  }
3197
2802
  const exception = new models_0_1.SendingPausedException({
@@ -3201,9 +2806,9 @@ const deserializeAws_restJson1SendingPausedExceptionResponse = async (parsedOutp
3201
2806
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3202
2807
  };
3203
2808
  const deserializeAws_restJson1TooManyRequestsExceptionResponse = async (parsedOutput, context) => {
3204
- const contents = {};
2809
+ const contents = map({});
3205
2810
  const data = parsedOutput.body;
3206
- if (data.message !== undefined && data.message !== null) {
2811
+ if (data.message != null) {
3207
2812
  contents.message = (0, smithy_client_1.expectString)(data.message);
3208
2813
  }
3209
2814
  const exception = new models_0_1.TooManyRequestsException({
@@ -3236,9 +2841,6 @@ const serializeAws_restJson1CloudWatchDimensionConfigurations = (input, context)
3236
2841
  return input
3237
2842
  .filter((e) => e != null)
3238
2843
  .map((entry) => {
3239
- if (entry === null) {
3240
- return null;
3241
- }
3242
2844
  return serializeAws_restJson1CloudWatchDimensionConfiguration(entry, context);
3243
2845
  });
3244
2846
  };
@@ -3282,9 +2884,6 @@ const serializeAws_restJson1DomainDeliverabilityTrackingOptions = (input, contex
3282
2884
  return input
3283
2885
  .filter((e) => e != null)
3284
2886
  .map((entry) => {
3285
- if (entry === null) {
3286
- return null;
3287
- }
3288
2887
  return serializeAws_restJson1DomainDeliverabilityTrackingOption(entry, context);
3289
2888
  });
3290
2889
  };
@@ -3292,9 +2891,6 @@ const serializeAws_restJson1EmailAddressList = (input, context) => {
3292
2891
  return input
3293
2892
  .filter((e) => e != null)
3294
2893
  .map((entry) => {
3295
- if (entry === null) {
3296
- return null;
3297
- }
3298
2894
  return entry;
3299
2895
  });
3300
2896
  };
@@ -3329,9 +2925,6 @@ const serializeAws_restJson1EventTypes = (input, context) => {
3329
2925
  return input
3330
2926
  .filter((e) => e != null)
3331
2927
  .map((entry) => {
3332
- if (entry === null) {
3333
- return null;
3334
- }
3335
2928
  return entry;
3336
2929
  });
3337
2930
  };
@@ -3345,9 +2938,6 @@ const serializeAws_restJson1IspNameList = (input, context) => {
3345
2938
  return input
3346
2939
  .filter((e) => e != null)
3347
2940
  .map((entry) => {
3348
- if (entry === null) {
3349
- return null;
3350
- }
3351
2941
  return entry;
3352
2942
  });
3353
2943
  };
@@ -3373,9 +2963,6 @@ const serializeAws_restJson1MessageTagList = (input, context) => {
3373
2963
  return input
3374
2964
  .filter((e) => e != null)
3375
2965
  .map((entry) => {
3376
- if (entry === null) {
3377
- return null;
3378
- }
3379
2966
  return serializeAws_restJson1MessageTag(entry, context);
3380
2967
  });
3381
2968
  };
@@ -3415,9 +3002,6 @@ const serializeAws_restJson1TagList = (input, context) => {
3415
3002
  return input
3416
3003
  .filter((e) => e != null)
3417
3004
  .map((entry) => {
3418
- if (entry === null) {
3419
- return null;
3420
- }
3421
3005
  return serializeAws_restJson1Tag(entry, context);
3422
3006
  });
3423
3007
  };