@aws-sdk/client-mediaconnect 3.141.0 → 3.142.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,16 +12,7 @@ const serializeAws_restJson1AddFlowMediaStreamsCommand = async (input, context)
12
12
  "content-type": "application/json",
13
13
  };
14
14
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/flows/{FlowArn}/mediaStreams";
15
- if (input.FlowArn !== undefined) {
16
- const labelValue = input.FlowArn;
17
- if (labelValue.length <= 0) {
18
- throw new Error("Empty value provided for input HTTP label: FlowArn.");
19
- }
20
- resolvedPath = resolvedPath.replace("{FlowArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
21
- }
22
- else {
23
- throw new Error("No value provided for input HTTP label: FlowArn.");
24
- }
15
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "FlowArn", () => input.FlowArn, "{FlowArn}", false);
25
16
  let body;
26
17
  body = JSON.stringify({
27
18
  ...(input.MediaStreams != null && {
@@ -45,16 +36,7 @@ const serializeAws_restJson1AddFlowOutputsCommand = async (input, context) => {
45
36
  "content-type": "application/json",
46
37
  };
47
38
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/flows/{FlowArn}/outputs";
48
- if (input.FlowArn !== undefined) {
49
- const labelValue = input.FlowArn;
50
- if (labelValue.length <= 0) {
51
- throw new Error("Empty value provided for input HTTP label: FlowArn.");
52
- }
53
- resolvedPath = resolvedPath.replace("{FlowArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
54
- }
55
- else {
56
- throw new Error("No value provided for input HTTP label: FlowArn.");
57
- }
39
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "FlowArn", () => input.FlowArn, "{FlowArn}", false);
58
40
  let body;
59
41
  body = JSON.stringify({
60
42
  ...(input.Outputs != null && { outputs: serializeAws_restJson1__listOfAddOutputRequest(input.Outputs, context) }),
@@ -76,16 +58,7 @@ const serializeAws_restJson1AddFlowSourcesCommand = async (input, context) => {
76
58
  "content-type": "application/json",
77
59
  };
78
60
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/flows/{FlowArn}/source";
79
- if (input.FlowArn !== undefined) {
80
- const labelValue = input.FlowArn;
81
- if (labelValue.length <= 0) {
82
- throw new Error("Empty value provided for input HTTP label: FlowArn.");
83
- }
84
- resolvedPath = resolvedPath.replace("{FlowArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
85
- }
86
- else {
87
- throw new Error("No value provided for input HTTP label: FlowArn.");
88
- }
61
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "FlowArn", () => input.FlowArn, "{FlowArn}", false);
89
62
  let body;
90
63
  body = JSON.stringify({
91
64
  ...(input.Sources != null && { sources: serializeAws_restJson1__listOfSetSourceRequest(input.Sources, context) }),
@@ -107,16 +80,7 @@ const serializeAws_restJson1AddFlowVpcInterfacesCommand = async (input, context)
107
80
  "content-type": "application/json",
108
81
  };
109
82
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/flows/{FlowArn}/vpcInterfaces";
110
- if (input.FlowArn !== undefined) {
111
- const labelValue = input.FlowArn;
112
- if (labelValue.length <= 0) {
113
- throw new Error("Empty value provided for input HTTP label: FlowArn.");
114
- }
115
- resolvedPath = resolvedPath.replace("{FlowArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
116
- }
117
- else {
118
- throw new Error("No value provided for input HTTP label: FlowArn.");
119
- }
83
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "FlowArn", () => input.FlowArn, "{FlowArn}", false);
120
84
  let body;
121
85
  body = JSON.stringify({
122
86
  ...(input.VpcInterfaces != null && {
@@ -176,16 +140,7 @@ const serializeAws_restJson1DeleteFlowCommand = async (input, context) => {
176
140
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
177
141
  const headers = {};
178
142
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/flows/{FlowArn}";
179
- if (input.FlowArn !== undefined) {
180
- const labelValue = input.FlowArn;
181
- if (labelValue.length <= 0) {
182
- throw new Error("Empty value provided for input HTTP label: FlowArn.");
183
- }
184
- resolvedPath = resolvedPath.replace("{FlowArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
185
- }
186
- else {
187
- throw new Error("No value provided for input HTTP label: FlowArn.");
188
- }
143
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "FlowArn", () => input.FlowArn, "{FlowArn}", false);
189
144
  let body;
190
145
  return new protocol_http_1.HttpRequest({
191
146
  protocol,
@@ -202,16 +157,7 @@ const serializeAws_restJson1DescribeFlowCommand = async (input, context) => {
202
157
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
203
158
  const headers = {};
204
159
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/flows/{FlowArn}";
205
- if (input.FlowArn !== undefined) {
206
- const labelValue = input.FlowArn;
207
- if (labelValue.length <= 0) {
208
- throw new Error("Empty value provided for input HTTP label: FlowArn.");
209
- }
210
- resolvedPath = resolvedPath.replace("{FlowArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
211
- }
212
- else {
213
- throw new Error("No value provided for input HTTP label: FlowArn.");
214
- }
160
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "FlowArn", () => input.FlowArn, "{FlowArn}", false);
215
161
  let body;
216
162
  return new protocol_http_1.HttpRequest({
217
163
  protocol,
@@ -228,16 +174,7 @@ const serializeAws_restJson1DescribeOfferingCommand = async (input, context) =>
228
174
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
229
175
  const headers = {};
230
176
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/offerings/{OfferingArn}";
231
- if (input.OfferingArn !== undefined) {
232
- const labelValue = input.OfferingArn;
233
- if (labelValue.length <= 0) {
234
- throw new Error("Empty value provided for input HTTP label: OfferingArn.");
235
- }
236
- resolvedPath = resolvedPath.replace("{OfferingArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
237
- }
238
- else {
239
- throw new Error("No value provided for input HTTP label: OfferingArn.");
240
- }
177
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "OfferingArn", () => input.OfferingArn, "{OfferingArn}", false);
241
178
  let body;
242
179
  return new protocol_http_1.HttpRequest({
243
180
  protocol,
@@ -254,16 +191,7 @@ const serializeAws_restJson1DescribeReservationCommand = async (input, context)
254
191
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
255
192
  const headers = {};
256
193
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/reservations/{ReservationArn}";
257
- if (input.ReservationArn !== undefined) {
258
- const labelValue = input.ReservationArn;
259
- if (labelValue.length <= 0) {
260
- throw new Error("Empty value provided for input HTTP label: ReservationArn.");
261
- }
262
- resolvedPath = resolvedPath.replace("{ReservationArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
263
- }
264
- else {
265
- throw new Error("No value provided for input HTTP label: ReservationArn.");
266
- }
194
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ReservationArn", () => input.ReservationArn, "{ReservationArn}", false);
267
195
  let body;
268
196
  return new protocol_http_1.HttpRequest({
269
197
  protocol,
@@ -282,16 +210,7 @@ const serializeAws_restJson1GrantFlowEntitlementsCommand = async (input, context
282
210
  "content-type": "application/json",
283
211
  };
284
212
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/flows/{FlowArn}/entitlements";
285
- if (input.FlowArn !== undefined) {
286
- const labelValue = input.FlowArn;
287
- if (labelValue.length <= 0) {
288
- throw new Error("Empty value provided for input HTTP label: FlowArn.");
289
- }
290
- resolvedPath = resolvedPath.replace("{FlowArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
291
- }
292
- else {
293
- throw new Error("No value provided for input HTTP label: FlowArn.");
294
- }
213
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "FlowArn", () => input.FlowArn, "{FlowArn}", false);
295
214
  let body;
296
215
  body = JSON.stringify({
297
216
  ...(input.Entitlements != null && {
@@ -313,10 +232,10 @@ const serializeAws_restJson1ListEntitlementsCommand = async (input, context) =>
313
232
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
314
233
  const headers = {};
315
234
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/entitlements";
316
- const query = {
317
- ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }),
318
- ...(input.NextToken !== undefined && { nextToken: input.NextToken }),
319
- };
235
+ const query = map({
236
+ maxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
237
+ nextToken: [, input.NextToken],
238
+ });
320
239
  let body;
321
240
  return new protocol_http_1.HttpRequest({
322
241
  protocol,
@@ -334,10 +253,10 @@ const serializeAws_restJson1ListFlowsCommand = async (input, context) => {
334
253
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
335
254
  const headers = {};
336
255
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/flows";
337
- const query = {
338
- ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }),
339
- ...(input.NextToken !== undefined && { nextToken: input.NextToken }),
340
- };
256
+ const query = map({
257
+ maxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
258
+ nextToken: [, input.NextToken],
259
+ });
341
260
  let body;
342
261
  return new protocol_http_1.HttpRequest({
343
262
  protocol,
@@ -355,10 +274,10 @@ const serializeAws_restJson1ListOfferingsCommand = async (input, context) => {
355
274
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
356
275
  const headers = {};
357
276
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/offerings";
358
- const query = {
359
- ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }),
360
- ...(input.NextToken !== undefined && { nextToken: input.NextToken }),
361
- };
277
+ const query = map({
278
+ maxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
279
+ nextToken: [, input.NextToken],
280
+ });
362
281
  let body;
363
282
  return new protocol_http_1.HttpRequest({
364
283
  protocol,
@@ -376,10 +295,10 @@ const serializeAws_restJson1ListReservationsCommand = async (input, context) =>
376
295
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
377
296
  const headers = {};
378
297
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/reservations";
379
- const query = {
380
- ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }),
381
- ...(input.NextToken !== undefined && { nextToken: input.NextToken }),
382
- };
298
+ const query = map({
299
+ maxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
300
+ nextToken: [, input.NextToken],
301
+ });
383
302
  let body;
384
303
  return new protocol_http_1.HttpRequest({
385
304
  protocol,
@@ -397,16 +316,7 @@ const serializeAws_restJson1ListTagsForResourceCommand = async (input, context)
397
316
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
398
317
  const headers = {};
399
318
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}";
400
- if (input.ResourceArn !== undefined) {
401
- const labelValue = input.ResourceArn;
402
- if (labelValue.length <= 0) {
403
- throw new Error("Empty value provided for input HTTP label: ResourceArn.");
404
- }
405
- resolvedPath = resolvedPath.replace("{ResourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
406
- }
407
- else {
408
- throw new Error("No value provided for input HTTP label: ResourceArn.");
409
- }
319
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ResourceArn", () => input.ResourceArn, "{ResourceArn}", false);
410
320
  let body;
411
321
  return new protocol_http_1.HttpRequest({
412
322
  protocol,
@@ -425,16 +335,7 @@ const serializeAws_restJson1PurchaseOfferingCommand = async (input, context) =>
425
335
  "content-type": "application/json",
426
336
  };
427
337
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/offerings/{OfferingArn}";
428
- if (input.OfferingArn !== undefined) {
429
- const labelValue = input.OfferingArn;
430
- if (labelValue.length <= 0) {
431
- throw new Error("Empty value provided for input HTTP label: OfferingArn.");
432
- }
433
- resolvedPath = resolvedPath.replace("{OfferingArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
434
- }
435
- else {
436
- throw new Error("No value provided for input HTTP label: OfferingArn.");
437
- }
338
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "OfferingArn", () => input.OfferingArn, "{OfferingArn}", false);
438
339
  let body;
439
340
  body = JSON.stringify({
440
341
  ...(input.ReservationName != null && { reservationName: input.ReservationName }),
@@ -456,26 +357,8 @@ const serializeAws_restJson1RemoveFlowMediaStreamCommand = async (input, context
456
357
  const headers = {};
457
358
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
458
359
  "/v1/flows/{FlowArn}/mediaStreams/{MediaStreamName}";
459
- if (input.FlowArn !== undefined) {
460
- const labelValue = input.FlowArn;
461
- if (labelValue.length <= 0) {
462
- throw new Error("Empty value provided for input HTTP label: FlowArn.");
463
- }
464
- resolvedPath = resolvedPath.replace("{FlowArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
465
- }
466
- else {
467
- throw new Error("No value provided for input HTTP label: FlowArn.");
468
- }
469
- if (input.MediaStreamName !== undefined) {
470
- const labelValue = input.MediaStreamName;
471
- if (labelValue.length <= 0) {
472
- throw new Error("Empty value provided for input HTTP label: MediaStreamName.");
473
- }
474
- resolvedPath = resolvedPath.replace("{MediaStreamName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
475
- }
476
- else {
477
- throw new Error("No value provided for input HTTP label: MediaStreamName.");
478
- }
360
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "FlowArn", () => input.FlowArn, "{FlowArn}", false);
361
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "MediaStreamName", () => input.MediaStreamName, "{MediaStreamName}", false);
479
362
  let body;
480
363
  return new protocol_http_1.HttpRequest({
481
364
  protocol,
@@ -492,26 +375,8 @@ const serializeAws_restJson1RemoveFlowOutputCommand = async (input, context) =>
492
375
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
493
376
  const headers = {};
494
377
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/flows/{FlowArn}/outputs/{OutputArn}";
495
- if (input.FlowArn !== undefined) {
496
- const labelValue = input.FlowArn;
497
- if (labelValue.length <= 0) {
498
- throw new Error("Empty value provided for input HTTP label: FlowArn.");
499
- }
500
- resolvedPath = resolvedPath.replace("{FlowArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
501
- }
502
- else {
503
- throw new Error("No value provided for input HTTP label: FlowArn.");
504
- }
505
- if (input.OutputArn !== undefined) {
506
- const labelValue = input.OutputArn;
507
- if (labelValue.length <= 0) {
508
- throw new Error("Empty value provided for input HTTP label: OutputArn.");
509
- }
510
- resolvedPath = resolvedPath.replace("{OutputArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
511
- }
512
- else {
513
- throw new Error("No value provided for input HTTP label: OutputArn.");
514
- }
378
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "FlowArn", () => input.FlowArn, "{FlowArn}", false);
379
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "OutputArn", () => input.OutputArn, "{OutputArn}", false);
515
380
  let body;
516
381
  return new protocol_http_1.HttpRequest({
517
382
  protocol,
@@ -528,26 +393,8 @@ const serializeAws_restJson1RemoveFlowSourceCommand = async (input, context) =>
528
393
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
529
394
  const headers = {};
530
395
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/flows/{FlowArn}/source/{SourceArn}";
531
- if (input.FlowArn !== undefined) {
532
- const labelValue = input.FlowArn;
533
- if (labelValue.length <= 0) {
534
- throw new Error("Empty value provided for input HTTP label: FlowArn.");
535
- }
536
- resolvedPath = resolvedPath.replace("{FlowArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
537
- }
538
- else {
539
- throw new Error("No value provided for input HTTP label: FlowArn.");
540
- }
541
- if (input.SourceArn !== undefined) {
542
- const labelValue = input.SourceArn;
543
- if (labelValue.length <= 0) {
544
- throw new Error("Empty value provided for input HTTP label: SourceArn.");
545
- }
546
- resolvedPath = resolvedPath.replace("{SourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
547
- }
548
- else {
549
- throw new Error("No value provided for input HTTP label: SourceArn.");
550
- }
396
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "FlowArn", () => input.FlowArn, "{FlowArn}", false);
397
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "SourceArn", () => input.SourceArn, "{SourceArn}", false);
551
398
  let body;
552
399
  return new protocol_http_1.HttpRequest({
553
400
  protocol,
@@ -565,26 +412,8 @@ const serializeAws_restJson1RemoveFlowVpcInterfaceCommand = async (input, contex
565
412
  const headers = {};
566
413
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
567
414
  "/v1/flows/{FlowArn}/vpcInterfaces/{VpcInterfaceName}";
568
- if (input.FlowArn !== undefined) {
569
- const labelValue = input.FlowArn;
570
- if (labelValue.length <= 0) {
571
- throw new Error("Empty value provided for input HTTP label: FlowArn.");
572
- }
573
- resolvedPath = resolvedPath.replace("{FlowArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
574
- }
575
- else {
576
- throw new Error("No value provided for input HTTP label: FlowArn.");
577
- }
578
- if (input.VpcInterfaceName !== undefined) {
579
- const labelValue = input.VpcInterfaceName;
580
- if (labelValue.length <= 0) {
581
- throw new Error("Empty value provided for input HTTP label: VpcInterfaceName.");
582
- }
583
- resolvedPath = resolvedPath.replace("{VpcInterfaceName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
584
- }
585
- else {
586
- throw new Error("No value provided for input HTTP label: VpcInterfaceName.");
587
- }
415
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "FlowArn", () => input.FlowArn, "{FlowArn}", false);
416
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "VpcInterfaceName", () => input.VpcInterfaceName, "{VpcInterfaceName}", false);
588
417
  let body;
589
418
  return new protocol_http_1.HttpRequest({
590
419
  protocol,
@@ -602,26 +431,8 @@ const serializeAws_restJson1RevokeFlowEntitlementCommand = async (input, context
602
431
  const headers = {};
603
432
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
604
433
  "/v1/flows/{FlowArn}/entitlements/{EntitlementArn}";
605
- if (input.EntitlementArn !== undefined) {
606
- const labelValue = input.EntitlementArn;
607
- if (labelValue.length <= 0) {
608
- throw new Error("Empty value provided for input HTTP label: EntitlementArn.");
609
- }
610
- resolvedPath = resolvedPath.replace("{EntitlementArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
611
- }
612
- else {
613
- throw new Error("No value provided for input HTTP label: EntitlementArn.");
614
- }
615
- if (input.FlowArn !== undefined) {
616
- const labelValue = input.FlowArn;
617
- if (labelValue.length <= 0) {
618
- throw new Error("Empty value provided for input HTTP label: FlowArn.");
619
- }
620
- resolvedPath = resolvedPath.replace("{FlowArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
621
- }
622
- else {
623
- throw new Error("No value provided for input HTTP label: FlowArn.");
624
- }
434
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "EntitlementArn", () => input.EntitlementArn, "{EntitlementArn}", false);
435
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "FlowArn", () => input.FlowArn, "{FlowArn}", false);
625
436
  let body;
626
437
  return new protocol_http_1.HttpRequest({
627
438
  protocol,
@@ -638,16 +449,7 @@ const serializeAws_restJson1StartFlowCommand = async (input, context) => {
638
449
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
639
450
  const headers = {};
640
451
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/flows/start/{FlowArn}";
641
- if (input.FlowArn !== undefined) {
642
- const labelValue = input.FlowArn;
643
- if (labelValue.length <= 0) {
644
- throw new Error("Empty value provided for input HTTP label: FlowArn.");
645
- }
646
- resolvedPath = resolvedPath.replace("{FlowArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
647
- }
648
- else {
649
- throw new Error("No value provided for input HTTP label: FlowArn.");
650
- }
452
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "FlowArn", () => input.FlowArn, "{FlowArn}", false);
651
453
  let body;
652
454
  return new protocol_http_1.HttpRequest({
653
455
  protocol,
@@ -664,16 +466,7 @@ const serializeAws_restJson1StopFlowCommand = async (input, context) => {
664
466
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
665
467
  const headers = {};
666
468
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/flows/stop/{FlowArn}";
667
- if (input.FlowArn !== undefined) {
668
- const labelValue = input.FlowArn;
669
- if (labelValue.length <= 0) {
670
- throw new Error("Empty value provided for input HTTP label: FlowArn.");
671
- }
672
- resolvedPath = resolvedPath.replace("{FlowArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
673
- }
674
- else {
675
- throw new Error("No value provided for input HTTP label: FlowArn.");
676
- }
469
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "FlowArn", () => input.FlowArn, "{FlowArn}", false);
677
470
  let body;
678
471
  return new protocol_http_1.HttpRequest({
679
472
  protocol,
@@ -692,16 +485,7 @@ const serializeAws_restJson1TagResourceCommand = async (input, context) => {
692
485
  "content-type": "application/json",
693
486
  };
694
487
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}";
695
- if (input.ResourceArn !== undefined) {
696
- const labelValue = input.ResourceArn;
697
- if (labelValue.length <= 0) {
698
- throw new Error("Empty value provided for input HTTP label: ResourceArn.");
699
- }
700
- resolvedPath = resolvedPath.replace("{ResourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
701
- }
702
- else {
703
- throw new Error("No value provided for input HTTP label: ResourceArn.");
704
- }
488
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ResourceArn", () => input.ResourceArn, "{ResourceArn}", false);
705
489
  let body;
706
490
  body = JSON.stringify({
707
491
  ...(input.Tags != null && { tags: serializeAws_restJson1__mapOf__string(input.Tags, context) }),
@@ -721,19 +505,10 @@ const serializeAws_restJson1UntagResourceCommand = async (input, context) => {
721
505
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
722
506
  const headers = {};
723
507
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}";
724
- if (input.ResourceArn !== undefined) {
725
- const labelValue = input.ResourceArn;
726
- if (labelValue.length <= 0) {
727
- throw new Error("Empty value provided for input HTTP label: ResourceArn.");
728
- }
729
- resolvedPath = resolvedPath.replace("{ResourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
730
- }
731
- else {
732
- throw new Error("No value provided for input HTTP label: ResourceArn.");
733
- }
734
- const query = {
735
- ...(input.TagKeys !== undefined && { tagKeys: (input.TagKeys || []).map((_entry) => _entry) }),
736
- };
508
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ResourceArn", () => input.ResourceArn, "{ResourceArn}", false);
509
+ const query = map({
510
+ tagKeys: [() => input.TagKeys !== void 0, () => (input.TagKeys || []).map((_entry) => _entry)],
511
+ });
737
512
  let body;
738
513
  return new protocol_http_1.HttpRequest({
739
514
  protocol,
@@ -753,16 +528,7 @@ const serializeAws_restJson1UpdateFlowCommand = async (input, context) => {
753
528
  "content-type": "application/json",
754
529
  };
755
530
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/flows/{FlowArn}";
756
- if (input.FlowArn !== undefined) {
757
- const labelValue = input.FlowArn;
758
- if (labelValue.length <= 0) {
759
- throw new Error("Empty value provided for input HTTP label: FlowArn.");
760
- }
761
- resolvedPath = resolvedPath.replace("{FlowArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
762
- }
763
- else {
764
- throw new Error("No value provided for input HTTP label: FlowArn.");
765
- }
531
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "FlowArn", () => input.FlowArn, "{FlowArn}", false);
766
532
  let body;
767
533
  body = JSON.stringify({
768
534
  ...(input.Maintenance != null && {
@@ -790,26 +556,8 @@ const serializeAws_restJson1UpdateFlowEntitlementCommand = async (input, context
790
556
  };
791
557
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
792
558
  "/v1/flows/{FlowArn}/entitlements/{EntitlementArn}";
793
- if (input.EntitlementArn !== undefined) {
794
- const labelValue = input.EntitlementArn;
795
- if (labelValue.length <= 0) {
796
- throw new Error("Empty value provided for input HTTP label: EntitlementArn.");
797
- }
798
- resolvedPath = resolvedPath.replace("{EntitlementArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
799
- }
800
- else {
801
- throw new Error("No value provided for input HTTP label: EntitlementArn.");
802
- }
803
- if (input.FlowArn !== undefined) {
804
- const labelValue = input.FlowArn;
805
- if (labelValue.length <= 0) {
806
- throw new Error("Empty value provided for input HTTP label: FlowArn.");
807
- }
808
- resolvedPath = resolvedPath.replace("{FlowArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
809
- }
810
- else {
811
- throw new Error("No value provided for input HTTP label: FlowArn.");
812
- }
559
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "EntitlementArn", () => input.EntitlementArn, "{EntitlementArn}", false);
560
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "FlowArn", () => input.FlowArn, "{FlowArn}", false);
813
561
  let body;
814
562
  body = JSON.stringify({
815
563
  ...(input.Description != null && { description: input.Description }),
@@ -837,26 +585,8 @@ const serializeAws_restJson1UpdateFlowMediaStreamCommand = async (input, context
837
585
  };
838
586
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
839
587
  "/v1/flows/{FlowArn}/mediaStreams/{MediaStreamName}";
840
- if (input.FlowArn !== undefined) {
841
- const labelValue = input.FlowArn;
842
- if (labelValue.length <= 0) {
843
- throw new Error("Empty value provided for input HTTP label: FlowArn.");
844
- }
845
- resolvedPath = resolvedPath.replace("{FlowArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
846
- }
847
- else {
848
- throw new Error("No value provided for input HTTP label: FlowArn.");
849
- }
850
- if (input.MediaStreamName !== undefined) {
851
- const labelValue = input.MediaStreamName;
852
- if (labelValue.length <= 0) {
853
- throw new Error("Empty value provided for input HTTP label: MediaStreamName.");
854
- }
855
- resolvedPath = resolvedPath.replace("{MediaStreamName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
856
- }
857
- else {
858
- throw new Error("No value provided for input HTTP label: MediaStreamName.");
859
- }
588
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "FlowArn", () => input.FlowArn, "{FlowArn}", false);
589
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "MediaStreamName", () => input.MediaStreamName, "{MediaStreamName}", false);
860
590
  let body;
861
591
  body = JSON.stringify({
862
592
  ...(input.Attributes != null && {
@@ -884,26 +614,8 @@ const serializeAws_restJson1UpdateFlowOutputCommand = async (input, context) =>
884
614
  "content-type": "application/json",
885
615
  };
886
616
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/flows/{FlowArn}/outputs/{OutputArn}";
887
- if (input.FlowArn !== undefined) {
888
- const labelValue = input.FlowArn;
889
- if (labelValue.length <= 0) {
890
- throw new Error("Empty value provided for input HTTP label: FlowArn.");
891
- }
892
- resolvedPath = resolvedPath.replace("{FlowArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
893
- }
894
- else {
895
- throw new Error("No value provided for input HTTP label: FlowArn.");
896
- }
897
- if (input.OutputArn !== undefined) {
898
- const labelValue = input.OutputArn;
899
- if (labelValue.length <= 0) {
900
- throw new Error("Empty value provided for input HTTP label: OutputArn.");
901
- }
902
- resolvedPath = resolvedPath.replace("{OutputArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
903
- }
904
- else {
905
- throw new Error("No value provided for input HTTP label: OutputArn.");
906
- }
617
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "FlowArn", () => input.FlowArn, "{FlowArn}", false);
618
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "OutputArn", () => input.OutputArn, "{OutputArn}", false);
907
619
  let body;
908
620
  body = JSON.stringify({
909
621
  ...(input.CidrAllowList != null && {
@@ -945,26 +657,8 @@ const serializeAws_restJson1UpdateFlowSourceCommand = async (input, context) =>
945
657
  "content-type": "application/json",
946
658
  };
947
659
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/flows/{FlowArn}/source/{SourceArn}";
948
- if (input.FlowArn !== undefined) {
949
- const labelValue = input.FlowArn;
950
- if (labelValue.length <= 0) {
951
- throw new Error("Empty value provided for input HTTP label: FlowArn.");
952
- }
953
- resolvedPath = resolvedPath.replace("{FlowArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
954
- }
955
- else {
956
- throw new Error("No value provided for input HTTP label: FlowArn.");
957
- }
958
- if (input.SourceArn !== undefined) {
959
- const labelValue = input.SourceArn;
960
- if (labelValue.length <= 0) {
961
- throw new Error("Empty value provided for input HTTP label: SourceArn.");
962
- }
963
- resolvedPath = resolvedPath.replace("{SourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
964
- }
965
- else {
966
- throw new Error("No value provided for input HTTP label: SourceArn.");
967
- }
660
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "FlowArn", () => input.FlowArn, "{FlowArn}", false);
661
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "SourceArn", () => input.SourceArn, "{SourceArn}", false);
968
662
  let body;
969
663
  body = JSON.stringify({
970
664
  ...(input.Decryption != null && { decryption: serializeAws_restJson1UpdateEncryption(input.Decryption, context) }),
@@ -1000,19 +694,17 @@ const deserializeAws_restJson1AddFlowMediaStreamsCommand = async (output, contex
1000
694
  if (output.statusCode !== 201 && output.statusCode >= 300) {
1001
695
  return deserializeAws_restJson1AddFlowMediaStreamsCommandError(output, context);
1002
696
  }
1003
- const contents = {
697
+ const contents = map({
1004
698
  $metadata: deserializeMetadata(output),
1005
- FlowArn: undefined,
1006
- MediaStreams: undefined,
1007
- };
699
+ });
1008
700
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1009
- if (data.flowArn !== undefined && data.flowArn !== null) {
701
+ if (data.flowArn != null) {
1010
702
  contents.FlowArn = (0, smithy_client_1.expectString)(data.flowArn);
1011
703
  }
1012
- if (data.mediaStreams !== undefined && data.mediaStreams !== null) {
704
+ if (data.mediaStreams != null) {
1013
705
  contents.MediaStreams = deserializeAws_restJson1__listOfMediaStream(data.mediaStreams, context);
1014
706
  }
1015
- return Promise.resolve(contents);
707
+ return contents;
1016
708
  };
1017
709
  exports.deserializeAws_restJson1AddFlowMediaStreamsCommand = deserializeAws_restJson1AddFlowMediaStreamsCommand;
1018
710
  const deserializeAws_restJson1AddFlowMediaStreamsCommandError = async (output, context) => {
@@ -1020,7 +712,6 @@ const deserializeAws_restJson1AddFlowMediaStreamsCommandError = async (output, c
1020
712
  ...output,
1021
713
  body: await parseBody(output.body, context),
1022
714
  };
1023
- let response;
1024
715
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1025
716
  switch (errorCode) {
1026
717
  case "BadRequestException":
@@ -1043,33 +734,29 @@ const deserializeAws_restJson1AddFlowMediaStreamsCommandError = async (output, c
1043
734
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1044
735
  default:
1045
736
  const parsedBody = parsedOutput.body;
1046
- const $metadata = deserializeMetadata(output);
1047
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1048
- response = new MediaConnectServiceException_1.MediaConnectServiceException({
1049
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1050
- $fault: "client",
1051
- $metadata,
737
+ (0, smithy_client_1.throwDefaultError)({
738
+ output,
739
+ parsedBody,
740
+ exceptionCtor: MediaConnectServiceException_1.MediaConnectServiceException,
741
+ errorCode,
1052
742
  });
1053
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1054
743
  }
1055
744
  };
1056
745
  const deserializeAws_restJson1AddFlowOutputsCommand = async (output, context) => {
1057
746
  if (output.statusCode !== 201 && output.statusCode >= 300) {
1058
747
  return deserializeAws_restJson1AddFlowOutputsCommandError(output, context);
1059
748
  }
1060
- const contents = {
749
+ const contents = map({
1061
750
  $metadata: deserializeMetadata(output),
1062
- FlowArn: undefined,
1063
- Outputs: undefined,
1064
- };
751
+ });
1065
752
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1066
- if (data.flowArn !== undefined && data.flowArn !== null) {
753
+ if (data.flowArn != null) {
1067
754
  contents.FlowArn = (0, smithy_client_1.expectString)(data.flowArn);
1068
755
  }
1069
- if (data.outputs !== undefined && data.outputs !== null) {
756
+ if (data.outputs != null) {
1070
757
  contents.Outputs = deserializeAws_restJson1__listOfOutput(data.outputs, context);
1071
758
  }
1072
- return Promise.resolve(contents);
759
+ return contents;
1073
760
  };
1074
761
  exports.deserializeAws_restJson1AddFlowOutputsCommand = deserializeAws_restJson1AddFlowOutputsCommand;
1075
762
  const deserializeAws_restJson1AddFlowOutputsCommandError = async (output, context) => {
@@ -1077,7 +764,6 @@ const deserializeAws_restJson1AddFlowOutputsCommandError = async (output, contex
1077
764
  ...output,
1078
765
  body: await parseBody(output.body, context),
1079
766
  };
1080
- let response;
1081
767
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1082
768
  switch (errorCode) {
1083
769
  case "AddFlowOutputs420Exception":
@@ -1103,33 +789,29 @@ const deserializeAws_restJson1AddFlowOutputsCommandError = async (output, contex
1103
789
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1104
790
  default:
1105
791
  const parsedBody = parsedOutput.body;
1106
- const $metadata = deserializeMetadata(output);
1107
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1108
- response = new MediaConnectServiceException_1.MediaConnectServiceException({
1109
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1110
- $fault: "client",
1111
- $metadata,
792
+ (0, smithy_client_1.throwDefaultError)({
793
+ output,
794
+ parsedBody,
795
+ exceptionCtor: MediaConnectServiceException_1.MediaConnectServiceException,
796
+ errorCode,
1112
797
  });
1113
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1114
798
  }
1115
799
  };
1116
800
  const deserializeAws_restJson1AddFlowSourcesCommand = async (output, context) => {
1117
801
  if (output.statusCode !== 201 && output.statusCode >= 300) {
1118
802
  return deserializeAws_restJson1AddFlowSourcesCommandError(output, context);
1119
803
  }
1120
- const contents = {
804
+ const contents = map({
1121
805
  $metadata: deserializeMetadata(output),
1122
- FlowArn: undefined,
1123
- Sources: undefined,
1124
- };
806
+ });
1125
807
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1126
- if (data.flowArn !== undefined && data.flowArn !== null) {
808
+ if (data.flowArn != null) {
1127
809
  contents.FlowArn = (0, smithy_client_1.expectString)(data.flowArn);
1128
810
  }
1129
- if (data.sources !== undefined && data.sources !== null) {
811
+ if (data.sources != null) {
1130
812
  contents.Sources = deserializeAws_restJson1__listOfSource(data.sources, context);
1131
813
  }
1132
- return Promise.resolve(contents);
814
+ return contents;
1133
815
  };
1134
816
  exports.deserializeAws_restJson1AddFlowSourcesCommand = deserializeAws_restJson1AddFlowSourcesCommand;
1135
817
  const deserializeAws_restJson1AddFlowSourcesCommandError = async (output, context) => {
@@ -1137,7 +819,6 @@ const deserializeAws_restJson1AddFlowSourcesCommandError = async (output, contex
1137
819
  ...output,
1138
820
  body: await parseBody(output.body, context),
1139
821
  };
1140
- let response;
1141
822
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1142
823
  switch (errorCode) {
1143
824
  case "BadRequestException":
@@ -1160,33 +841,29 @@ const deserializeAws_restJson1AddFlowSourcesCommandError = async (output, contex
1160
841
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1161
842
  default:
1162
843
  const parsedBody = parsedOutput.body;
1163
- const $metadata = deserializeMetadata(output);
1164
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1165
- response = new MediaConnectServiceException_1.MediaConnectServiceException({
1166
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1167
- $fault: "client",
1168
- $metadata,
844
+ (0, smithy_client_1.throwDefaultError)({
845
+ output,
846
+ parsedBody,
847
+ exceptionCtor: MediaConnectServiceException_1.MediaConnectServiceException,
848
+ errorCode,
1169
849
  });
1170
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1171
850
  }
1172
851
  };
1173
852
  const deserializeAws_restJson1AddFlowVpcInterfacesCommand = async (output, context) => {
1174
853
  if (output.statusCode !== 201 && output.statusCode >= 300) {
1175
854
  return deserializeAws_restJson1AddFlowVpcInterfacesCommandError(output, context);
1176
855
  }
1177
- const contents = {
856
+ const contents = map({
1178
857
  $metadata: deserializeMetadata(output),
1179
- FlowArn: undefined,
1180
- VpcInterfaces: undefined,
1181
- };
858
+ });
1182
859
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1183
- if (data.flowArn !== undefined && data.flowArn !== null) {
860
+ if (data.flowArn != null) {
1184
861
  contents.FlowArn = (0, smithy_client_1.expectString)(data.flowArn);
1185
862
  }
1186
- if (data.vpcInterfaces !== undefined && data.vpcInterfaces !== null) {
863
+ if (data.vpcInterfaces != null) {
1187
864
  contents.VpcInterfaces = deserializeAws_restJson1__listOfVpcInterface(data.vpcInterfaces, context);
1188
865
  }
1189
- return Promise.resolve(contents);
866
+ return contents;
1190
867
  };
1191
868
  exports.deserializeAws_restJson1AddFlowVpcInterfacesCommand = deserializeAws_restJson1AddFlowVpcInterfacesCommand;
1192
869
  const deserializeAws_restJson1AddFlowVpcInterfacesCommandError = async (output, context) => {
@@ -1194,7 +871,6 @@ const deserializeAws_restJson1AddFlowVpcInterfacesCommandError = async (output,
1194
871
  ...output,
1195
872
  body: await parseBody(output.body, context),
1196
873
  };
1197
- let response;
1198
874
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1199
875
  switch (errorCode) {
1200
876
  case "BadRequestException":
@@ -1217,29 +893,26 @@ const deserializeAws_restJson1AddFlowVpcInterfacesCommandError = async (output,
1217
893
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1218
894
  default:
1219
895
  const parsedBody = parsedOutput.body;
1220
- const $metadata = deserializeMetadata(output);
1221
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1222
- response = new MediaConnectServiceException_1.MediaConnectServiceException({
1223
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1224
- $fault: "client",
1225
- $metadata,
896
+ (0, smithy_client_1.throwDefaultError)({
897
+ output,
898
+ parsedBody,
899
+ exceptionCtor: MediaConnectServiceException_1.MediaConnectServiceException,
900
+ errorCode,
1226
901
  });
1227
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1228
902
  }
1229
903
  };
1230
904
  const deserializeAws_restJson1CreateFlowCommand = async (output, context) => {
1231
905
  if (output.statusCode !== 201 && output.statusCode >= 300) {
1232
906
  return deserializeAws_restJson1CreateFlowCommandError(output, context);
1233
907
  }
1234
- const contents = {
908
+ const contents = map({
1235
909
  $metadata: deserializeMetadata(output),
1236
- Flow: undefined,
1237
- };
910
+ });
1238
911
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1239
- if (data.flow !== undefined && data.flow !== null) {
912
+ if (data.flow != null) {
1240
913
  contents.Flow = deserializeAws_restJson1Flow(data.flow, context);
1241
914
  }
1242
- return Promise.resolve(contents);
915
+ return contents;
1243
916
  };
1244
917
  exports.deserializeAws_restJson1CreateFlowCommand = deserializeAws_restJson1CreateFlowCommand;
1245
918
  const deserializeAws_restJson1CreateFlowCommandError = async (output, context) => {
@@ -1247,7 +920,6 @@ const deserializeAws_restJson1CreateFlowCommandError = async (output, context) =
1247
920
  ...output,
1248
921
  body: await parseBody(output.body, context),
1249
922
  };
1250
- let response;
1251
923
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1252
924
  switch (errorCode) {
1253
925
  case "BadRequestException":
@@ -1270,33 +942,29 @@ const deserializeAws_restJson1CreateFlowCommandError = async (output, context) =
1270
942
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1271
943
  default:
1272
944
  const parsedBody = parsedOutput.body;
1273
- const $metadata = deserializeMetadata(output);
1274
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1275
- response = new MediaConnectServiceException_1.MediaConnectServiceException({
1276
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1277
- $fault: "client",
1278
- $metadata,
945
+ (0, smithy_client_1.throwDefaultError)({
946
+ output,
947
+ parsedBody,
948
+ exceptionCtor: MediaConnectServiceException_1.MediaConnectServiceException,
949
+ errorCode,
1279
950
  });
1280
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1281
951
  }
1282
952
  };
1283
953
  const deserializeAws_restJson1DeleteFlowCommand = async (output, context) => {
1284
954
  if (output.statusCode !== 202 && output.statusCode >= 300) {
1285
955
  return deserializeAws_restJson1DeleteFlowCommandError(output, context);
1286
956
  }
1287
- const contents = {
957
+ const contents = map({
1288
958
  $metadata: deserializeMetadata(output),
1289
- FlowArn: undefined,
1290
- Status: undefined,
1291
- };
959
+ });
1292
960
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1293
- if (data.flowArn !== undefined && data.flowArn !== null) {
961
+ if (data.flowArn != null) {
1294
962
  contents.FlowArn = (0, smithy_client_1.expectString)(data.flowArn);
1295
963
  }
1296
- if (data.status !== undefined && data.status !== null) {
964
+ if (data.status != null) {
1297
965
  contents.Status = (0, smithy_client_1.expectString)(data.status);
1298
966
  }
1299
- return Promise.resolve(contents);
967
+ return contents;
1300
968
  };
1301
969
  exports.deserializeAws_restJson1DeleteFlowCommand = deserializeAws_restJson1DeleteFlowCommand;
1302
970
  const deserializeAws_restJson1DeleteFlowCommandError = async (output, context) => {
@@ -1304,7 +972,6 @@ const deserializeAws_restJson1DeleteFlowCommandError = async (output, context) =
1304
972
  ...output,
1305
973
  body: await parseBody(output.body, context),
1306
974
  };
1307
- let response;
1308
975
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1309
976
  switch (errorCode) {
1310
977
  case "BadRequestException":
@@ -1327,33 +994,29 @@ const deserializeAws_restJson1DeleteFlowCommandError = async (output, context) =
1327
994
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1328
995
  default:
1329
996
  const parsedBody = parsedOutput.body;
1330
- const $metadata = deserializeMetadata(output);
1331
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1332
- response = new MediaConnectServiceException_1.MediaConnectServiceException({
1333
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1334
- $fault: "client",
1335
- $metadata,
997
+ (0, smithy_client_1.throwDefaultError)({
998
+ output,
999
+ parsedBody,
1000
+ exceptionCtor: MediaConnectServiceException_1.MediaConnectServiceException,
1001
+ errorCode,
1336
1002
  });
1337
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1338
1003
  }
1339
1004
  };
1340
1005
  const deserializeAws_restJson1DescribeFlowCommand = async (output, context) => {
1341
1006
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1342
1007
  return deserializeAws_restJson1DescribeFlowCommandError(output, context);
1343
1008
  }
1344
- const contents = {
1009
+ const contents = map({
1345
1010
  $metadata: deserializeMetadata(output),
1346
- Flow: undefined,
1347
- Messages: undefined,
1348
- };
1011
+ });
1349
1012
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1350
- if (data.flow !== undefined && data.flow !== null) {
1013
+ if (data.flow != null) {
1351
1014
  contents.Flow = deserializeAws_restJson1Flow(data.flow, context);
1352
1015
  }
1353
- if (data.messages !== undefined && data.messages !== null) {
1016
+ if (data.messages != null) {
1354
1017
  contents.Messages = deserializeAws_restJson1Messages(data.messages, context);
1355
1018
  }
1356
- return Promise.resolve(contents);
1019
+ return contents;
1357
1020
  };
1358
1021
  exports.deserializeAws_restJson1DescribeFlowCommand = deserializeAws_restJson1DescribeFlowCommand;
1359
1022
  const deserializeAws_restJson1DescribeFlowCommandError = async (output, context) => {
@@ -1361,7 +1024,6 @@ const deserializeAws_restJson1DescribeFlowCommandError = async (output, context)
1361
1024
  ...output,
1362
1025
  body: await parseBody(output.body, context),
1363
1026
  };
1364
- let response;
1365
1027
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1366
1028
  switch (errorCode) {
1367
1029
  case "BadRequestException":
@@ -1384,29 +1046,26 @@ const deserializeAws_restJson1DescribeFlowCommandError = async (output, context)
1384
1046
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1385
1047
  default:
1386
1048
  const parsedBody = parsedOutput.body;
1387
- const $metadata = deserializeMetadata(output);
1388
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1389
- response = new MediaConnectServiceException_1.MediaConnectServiceException({
1390
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1391
- $fault: "client",
1392
- $metadata,
1049
+ (0, smithy_client_1.throwDefaultError)({
1050
+ output,
1051
+ parsedBody,
1052
+ exceptionCtor: MediaConnectServiceException_1.MediaConnectServiceException,
1053
+ errorCode,
1393
1054
  });
1394
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1395
1055
  }
1396
1056
  };
1397
1057
  const deserializeAws_restJson1DescribeOfferingCommand = async (output, context) => {
1398
1058
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1399
1059
  return deserializeAws_restJson1DescribeOfferingCommandError(output, context);
1400
1060
  }
1401
- const contents = {
1061
+ const contents = map({
1402
1062
  $metadata: deserializeMetadata(output),
1403
- Offering: undefined,
1404
- };
1063
+ });
1405
1064
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1406
- if (data.offering !== undefined && data.offering !== null) {
1065
+ if (data.offering != null) {
1407
1066
  contents.Offering = deserializeAws_restJson1Offering(data.offering, context);
1408
1067
  }
1409
- return Promise.resolve(contents);
1068
+ return contents;
1410
1069
  };
1411
1070
  exports.deserializeAws_restJson1DescribeOfferingCommand = deserializeAws_restJson1DescribeOfferingCommand;
1412
1071
  const deserializeAws_restJson1DescribeOfferingCommandError = async (output, context) => {
@@ -1414,7 +1073,6 @@ const deserializeAws_restJson1DescribeOfferingCommandError = async (output, cont
1414
1073
  ...output,
1415
1074
  body: await parseBody(output.body, context),
1416
1075
  };
1417
- let response;
1418
1076
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1419
1077
  switch (errorCode) {
1420
1078
  case "BadRequestException":
@@ -1434,29 +1092,26 @@ const deserializeAws_restJson1DescribeOfferingCommandError = async (output, cont
1434
1092
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1435
1093
  default:
1436
1094
  const parsedBody = parsedOutput.body;
1437
- const $metadata = deserializeMetadata(output);
1438
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1439
- response = new MediaConnectServiceException_1.MediaConnectServiceException({
1440
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1441
- $fault: "client",
1442
- $metadata,
1095
+ (0, smithy_client_1.throwDefaultError)({
1096
+ output,
1097
+ parsedBody,
1098
+ exceptionCtor: MediaConnectServiceException_1.MediaConnectServiceException,
1099
+ errorCode,
1443
1100
  });
1444
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1445
1101
  }
1446
1102
  };
1447
1103
  const deserializeAws_restJson1DescribeReservationCommand = async (output, context) => {
1448
1104
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1449
1105
  return deserializeAws_restJson1DescribeReservationCommandError(output, context);
1450
1106
  }
1451
- const contents = {
1107
+ const contents = map({
1452
1108
  $metadata: deserializeMetadata(output),
1453
- Reservation: undefined,
1454
- };
1109
+ });
1455
1110
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1456
- if (data.reservation !== undefined && data.reservation !== null) {
1111
+ if (data.reservation != null) {
1457
1112
  contents.Reservation = deserializeAws_restJson1Reservation(data.reservation, context);
1458
1113
  }
1459
- return Promise.resolve(contents);
1114
+ return contents;
1460
1115
  };
1461
1116
  exports.deserializeAws_restJson1DescribeReservationCommand = deserializeAws_restJson1DescribeReservationCommand;
1462
1117
  const deserializeAws_restJson1DescribeReservationCommandError = async (output, context) => {
@@ -1464,7 +1119,6 @@ const deserializeAws_restJson1DescribeReservationCommandError = async (output, c
1464
1119
  ...output,
1465
1120
  body: await parseBody(output.body, context),
1466
1121
  };
1467
- let response;
1468
1122
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1469
1123
  switch (errorCode) {
1470
1124
  case "BadRequestException":
@@ -1484,33 +1138,29 @@ const deserializeAws_restJson1DescribeReservationCommandError = async (output, c
1484
1138
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1485
1139
  default:
1486
1140
  const parsedBody = parsedOutput.body;
1487
- const $metadata = deserializeMetadata(output);
1488
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1489
- response = new MediaConnectServiceException_1.MediaConnectServiceException({
1490
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1491
- $fault: "client",
1492
- $metadata,
1141
+ (0, smithy_client_1.throwDefaultError)({
1142
+ output,
1143
+ parsedBody,
1144
+ exceptionCtor: MediaConnectServiceException_1.MediaConnectServiceException,
1145
+ errorCode,
1493
1146
  });
1494
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1495
1147
  }
1496
1148
  };
1497
1149
  const deserializeAws_restJson1GrantFlowEntitlementsCommand = async (output, context) => {
1498
1150
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1499
1151
  return deserializeAws_restJson1GrantFlowEntitlementsCommandError(output, context);
1500
1152
  }
1501
- const contents = {
1153
+ const contents = map({
1502
1154
  $metadata: deserializeMetadata(output),
1503
- Entitlements: undefined,
1504
- FlowArn: undefined,
1505
- };
1155
+ });
1506
1156
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1507
- if (data.entitlements !== undefined && data.entitlements !== null) {
1157
+ if (data.entitlements != null) {
1508
1158
  contents.Entitlements = deserializeAws_restJson1__listOfEntitlement(data.entitlements, context);
1509
1159
  }
1510
- if (data.flowArn !== undefined && data.flowArn !== null) {
1160
+ if (data.flowArn != null) {
1511
1161
  contents.FlowArn = (0, smithy_client_1.expectString)(data.flowArn);
1512
1162
  }
1513
- return Promise.resolve(contents);
1163
+ return contents;
1514
1164
  };
1515
1165
  exports.deserializeAws_restJson1GrantFlowEntitlementsCommand = deserializeAws_restJson1GrantFlowEntitlementsCommand;
1516
1166
  const deserializeAws_restJson1GrantFlowEntitlementsCommandError = async (output, context) => {
@@ -1518,7 +1168,6 @@ const deserializeAws_restJson1GrantFlowEntitlementsCommandError = async (output,
1518
1168
  ...output,
1519
1169
  body: await parseBody(output.body, context),
1520
1170
  };
1521
- let response;
1522
1171
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1523
1172
  switch (errorCode) {
1524
1173
  case "BadRequestException":
@@ -1544,33 +1193,29 @@ const deserializeAws_restJson1GrantFlowEntitlementsCommandError = async (output,
1544
1193
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1545
1194
  default:
1546
1195
  const parsedBody = parsedOutput.body;
1547
- const $metadata = deserializeMetadata(output);
1548
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1549
- response = new MediaConnectServiceException_1.MediaConnectServiceException({
1550
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1551
- $fault: "client",
1552
- $metadata,
1196
+ (0, smithy_client_1.throwDefaultError)({
1197
+ output,
1198
+ parsedBody,
1199
+ exceptionCtor: MediaConnectServiceException_1.MediaConnectServiceException,
1200
+ errorCode,
1553
1201
  });
1554
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1555
1202
  }
1556
1203
  };
1557
1204
  const deserializeAws_restJson1ListEntitlementsCommand = async (output, context) => {
1558
1205
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1559
1206
  return deserializeAws_restJson1ListEntitlementsCommandError(output, context);
1560
1207
  }
1561
- const contents = {
1208
+ const contents = map({
1562
1209
  $metadata: deserializeMetadata(output),
1563
- Entitlements: undefined,
1564
- NextToken: undefined,
1565
- };
1210
+ });
1566
1211
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1567
- if (data.entitlements !== undefined && data.entitlements !== null) {
1212
+ if (data.entitlements != null) {
1568
1213
  contents.Entitlements = deserializeAws_restJson1__listOfListedEntitlement(data.entitlements, context);
1569
1214
  }
1570
- if (data.nextToken !== undefined && data.nextToken !== null) {
1215
+ if (data.nextToken != null) {
1571
1216
  contents.NextToken = (0, smithy_client_1.expectString)(data.nextToken);
1572
1217
  }
1573
- return Promise.resolve(contents);
1218
+ return contents;
1574
1219
  };
1575
1220
  exports.deserializeAws_restJson1ListEntitlementsCommand = deserializeAws_restJson1ListEntitlementsCommand;
1576
1221
  const deserializeAws_restJson1ListEntitlementsCommandError = async (output, context) => {
@@ -1578,7 +1223,6 @@ const deserializeAws_restJson1ListEntitlementsCommandError = async (output, cont
1578
1223
  ...output,
1579
1224
  body: await parseBody(output.body, context),
1580
1225
  };
1581
- let response;
1582
1226
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1583
1227
  switch (errorCode) {
1584
1228
  case "BadRequestException":
@@ -1595,33 +1239,29 @@ const deserializeAws_restJson1ListEntitlementsCommandError = async (output, cont
1595
1239
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1596
1240
  default:
1597
1241
  const parsedBody = parsedOutput.body;
1598
- const $metadata = deserializeMetadata(output);
1599
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1600
- response = new MediaConnectServiceException_1.MediaConnectServiceException({
1601
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1602
- $fault: "client",
1603
- $metadata,
1242
+ (0, smithy_client_1.throwDefaultError)({
1243
+ output,
1244
+ parsedBody,
1245
+ exceptionCtor: MediaConnectServiceException_1.MediaConnectServiceException,
1246
+ errorCode,
1604
1247
  });
1605
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1606
1248
  }
1607
1249
  };
1608
1250
  const deserializeAws_restJson1ListFlowsCommand = async (output, context) => {
1609
1251
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1610
1252
  return deserializeAws_restJson1ListFlowsCommandError(output, context);
1611
1253
  }
1612
- const contents = {
1254
+ const contents = map({
1613
1255
  $metadata: deserializeMetadata(output),
1614
- Flows: undefined,
1615
- NextToken: undefined,
1616
- };
1256
+ });
1617
1257
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1618
- if (data.flows !== undefined && data.flows !== null) {
1258
+ if (data.flows != null) {
1619
1259
  contents.Flows = deserializeAws_restJson1__listOfListedFlow(data.flows, context);
1620
1260
  }
1621
- if (data.nextToken !== undefined && data.nextToken !== null) {
1261
+ if (data.nextToken != null) {
1622
1262
  contents.NextToken = (0, smithy_client_1.expectString)(data.nextToken);
1623
1263
  }
1624
- return Promise.resolve(contents);
1264
+ return contents;
1625
1265
  };
1626
1266
  exports.deserializeAws_restJson1ListFlowsCommand = deserializeAws_restJson1ListFlowsCommand;
1627
1267
  const deserializeAws_restJson1ListFlowsCommandError = async (output, context) => {
@@ -1629,7 +1269,6 @@ const deserializeAws_restJson1ListFlowsCommandError = async (output, context) =>
1629
1269
  ...output,
1630
1270
  body: await parseBody(output.body, context),
1631
1271
  };
1632
- let response;
1633
1272
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1634
1273
  switch (errorCode) {
1635
1274
  case "BadRequestException":
@@ -1646,33 +1285,29 @@ const deserializeAws_restJson1ListFlowsCommandError = async (output, context) =>
1646
1285
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1647
1286
  default:
1648
1287
  const parsedBody = parsedOutput.body;
1649
- const $metadata = deserializeMetadata(output);
1650
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1651
- response = new MediaConnectServiceException_1.MediaConnectServiceException({
1652
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1653
- $fault: "client",
1654
- $metadata,
1288
+ (0, smithy_client_1.throwDefaultError)({
1289
+ output,
1290
+ parsedBody,
1291
+ exceptionCtor: MediaConnectServiceException_1.MediaConnectServiceException,
1292
+ errorCode,
1655
1293
  });
1656
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1657
1294
  }
1658
1295
  };
1659
1296
  const deserializeAws_restJson1ListOfferingsCommand = async (output, context) => {
1660
1297
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1661
1298
  return deserializeAws_restJson1ListOfferingsCommandError(output, context);
1662
1299
  }
1663
- const contents = {
1300
+ const contents = map({
1664
1301
  $metadata: deserializeMetadata(output),
1665
- NextToken: undefined,
1666
- Offerings: undefined,
1667
- };
1302
+ });
1668
1303
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1669
- if (data.nextToken !== undefined && data.nextToken !== null) {
1304
+ if (data.nextToken != null) {
1670
1305
  contents.NextToken = (0, smithy_client_1.expectString)(data.nextToken);
1671
1306
  }
1672
- if (data.offerings !== undefined && data.offerings !== null) {
1307
+ if (data.offerings != null) {
1673
1308
  contents.Offerings = deserializeAws_restJson1__listOfOffering(data.offerings, context);
1674
1309
  }
1675
- return Promise.resolve(contents);
1310
+ return contents;
1676
1311
  };
1677
1312
  exports.deserializeAws_restJson1ListOfferingsCommand = deserializeAws_restJson1ListOfferingsCommand;
1678
1313
  const deserializeAws_restJson1ListOfferingsCommandError = async (output, context) => {
@@ -1680,7 +1315,6 @@ const deserializeAws_restJson1ListOfferingsCommandError = async (output, context
1680
1315
  ...output,
1681
1316
  body: await parseBody(output.body, context),
1682
1317
  };
1683
- let response;
1684
1318
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1685
1319
  switch (errorCode) {
1686
1320
  case "BadRequestException":
@@ -1697,33 +1331,29 @@ const deserializeAws_restJson1ListOfferingsCommandError = async (output, context
1697
1331
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1698
1332
  default:
1699
1333
  const parsedBody = parsedOutput.body;
1700
- const $metadata = deserializeMetadata(output);
1701
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1702
- response = new MediaConnectServiceException_1.MediaConnectServiceException({
1703
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1704
- $fault: "client",
1705
- $metadata,
1334
+ (0, smithy_client_1.throwDefaultError)({
1335
+ output,
1336
+ parsedBody,
1337
+ exceptionCtor: MediaConnectServiceException_1.MediaConnectServiceException,
1338
+ errorCode,
1706
1339
  });
1707
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1708
1340
  }
1709
1341
  };
1710
1342
  const deserializeAws_restJson1ListReservationsCommand = async (output, context) => {
1711
1343
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1712
1344
  return deserializeAws_restJson1ListReservationsCommandError(output, context);
1713
1345
  }
1714
- const contents = {
1346
+ const contents = map({
1715
1347
  $metadata: deserializeMetadata(output),
1716
- NextToken: undefined,
1717
- Reservations: undefined,
1718
- };
1348
+ });
1719
1349
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1720
- if (data.nextToken !== undefined && data.nextToken !== null) {
1350
+ if (data.nextToken != null) {
1721
1351
  contents.NextToken = (0, smithy_client_1.expectString)(data.nextToken);
1722
1352
  }
1723
- if (data.reservations !== undefined && data.reservations !== null) {
1353
+ if (data.reservations != null) {
1724
1354
  contents.Reservations = deserializeAws_restJson1__listOfReservation(data.reservations, context);
1725
1355
  }
1726
- return Promise.resolve(contents);
1356
+ return contents;
1727
1357
  };
1728
1358
  exports.deserializeAws_restJson1ListReservationsCommand = deserializeAws_restJson1ListReservationsCommand;
1729
1359
  const deserializeAws_restJson1ListReservationsCommandError = async (output, context) => {
@@ -1731,7 +1361,6 @@ const deserializeAws_restJson1ListReservationsCommandError = async (output, cont
1731
1361
  ...output,
1732
1362
  body: await parseBody(output.body, context),
1733
1363
  };
1734
- let response;
1735
1364
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1736
1365
  switch (errorCode) {
1737
1366
  case "BadRequestException":
@@ -1748,29 +1377,26 @@ const deserializeAws_restJson1ListReservationsCommandError = async (output, cont
1748
1377
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1749
1378
  default:
1750
1379
  const parsedBody = parsedOutput.body;
1751
- const $metadata = deserializeMetadata(output);
1752
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1753
- response = new MediaConnectServiceException_1.MediaConnectServiceException({
1754
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1755
- $fault: "client",
1756
- $metadata,
1380
+ (0, smithy_client_1.throwDefaultError)({
1381
+ output,
1382
+ parsedBody,
1383
+ exceptionCtor: MediaConnectServiceException_1.MediaConnectServiceException,
1384
+ errorCode,
1757
1385
  });
1758
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1759
1386
  }
1760
1387
  };
1761
1388
  const deserializeAws_restJson1ListTagsForResourceCommand = async (output, context) => {
1762
1389
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1763
1390
  return deserializeAws_restJson1ListTagsForResourceCommandError(output, context);
1764
1391
  }
1765
- const contents = {
1392
+ const contents = map({
1766
1393
  $metadata: deserializeMetadata(output),
1767
- Tags: undefined,
1768
- };
1394
+ });
1769
1395
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1770
- if (data.tags !== undefined && data.tags !== null) {
1396
+ if (data.tags != null) {
1771
1397
  contents.Tags = deserializeAws_restJson1__mapOf__string(data.tags, context);
1772
1398
  }
1773
- return Promise.resolve(contents);
1399
+ return contents;
1774
1400
  };
1775
1401
  exports.deserializeAws_restJson1ListTagsForResourceCommand = deserializeAws_restJson1ListTagsForResourceCommand;
1776
1402
  const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, context) => {
@@ -1778,7 +1404,6 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
1778
1404
  ...output,
1779
1405
  body: await parseBody(output.body, context),
1780
1406
  };
1781
- let response;
1782
1407
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1783
1408
  switch (errorCode) {
1784
1409
  case "BadRequestException":
@@ -1792,29 +1417,26 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
1792
1417
  throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
1793
1418
  default:
1794
1419
  const parsedBody = parsedOutput.body;
1795
- const $metadata = deserializeMetadata(output);
1796
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1797
- response = new MediaConnectServiceException_1.MediaConnectServiceException({
1798
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1799
- $fault: "client",
1800
- $metadata,
1420
+ (0, smithy_client_1.throwDefaultError)({
1421
+ output,
1422
+ parsedBody,
1423
+ exceptionCtor: MediaConnectServiceException_1.MediaConnectServiceException,
1424
+ errorCode,
1801
1425
  });
1802
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1803
1426
  }
1804
1427
  };
1805
1428
  const deserializeAws_restJson1PurchaseOfferingCommand = async (output, context) => {
1806
1429
  if (output.statusCode !== 201 && output.statusCode >= 300) {
1807
1430
  return deserializeAws_restJson1PurchaseOfferingCommandError(output, context);
1808
1431
  }
1809
- const contents = {
1432
+ const contents = map({
1810
1433
  $metadata: deserializeMetadata(output),
1811
- Reservation: undefined,
1812
- };
1434
+ });
1813
1435
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1814
- if (data.reservation !== undefined && data.reservation !== null) {
1436
+ if (data.reservation != null) {
1815
1437
  contents.Reservation = deserializeAws_restJson1Reservation(data.reservation, context);
1816
1438
  }
1817
- return Promise.resolve(contents);
1439
+ return contents;
1818
1440
  };
1819
1441
  exports.deserializeAws_restJson1PurchaseOfferingCommand = deserializeAws_restJson1PurchaseOfferingCommand;
1820
1442
  const deserializeAws_restJson1PurchaseOfferingCommandError = async (output, context) => {
@@ -1822,7 +1444,6 @@ const deserializeAws_restJson1PurchaseOfferingCommandError = async (output, cont
1822
1444
  ...output,
1823
1445
  body: await parseBody(output.body, context),
1824
1446
  };
1825
- let response;
1826
1447
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1827
1448
  switch (errorCode) {
1828
1449
  case "BadRequestException":
@@ -1845,33 +1466,29 @@ const deserializeAws_restJson1PurchaseOfferingCommandError = async (output, cont
1845
1466
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1846
1467
  default:
1847
1468
  const parsedBody = parsedOutput.body;
1848
- const $metadata = deserializeMetadata(output);
1849
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1850
- response = new MediaConnectServiceException_1.MediaConnectServiceException({
1851
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1852
- $fault: "client",
1853
- $metadata,
1469
+ (0, smithy_client_1.throwDefaultError)({
1470
+ output,
1471
+ parsedBody,
1472
+ exceptionCtor: MediaConnectServiceException_1.MediaConnectServiceException,
1473
+ errorCode,
1854
1474
  });
1855
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1856
1475
  }
1857
1476
  };
1858
1477
  const deserializeAws_restJson1RemoveFlowMediaStreamCommand = async (output, context) => {
1859
1478
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1860
1479
  return deserializeAws_restJson1RemoveFlowMediaStreamCommandError(output, context);
1861
1480
  }
1862
- const contents = {
1481
+ const contents = map({
1863
1482
  $metadata: deserializeMetadata(output),
1864
- FlowArn: undefined,
1865
- MediaStreamName: undefined,
1866
- };
1483
+ });
1867
1484
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1868
- if (data.flowArn !== undefined && data.flowArn !== null) {
1485
+ if (data.flowArn != null) {
1869
1486
  contents.FlowArn = (0, smithy_client_1.expectString)(data.flowArn);
1870
1487
  }
1871
- if (data.mediaStreamName !== undefined && data.mediaStreamName !== null) {
1488
+ if (data.mediaStreamName != null) {
1872
1489
  contents.MediaStreamName = (0, smithy_client_1.expectString)(data.mediaStreamName);
1873
1490
  }
1874
- return Promise.resolve(contents);
1491
+ return contents;
1875
1492
  };
1876
1493
  exports.deserializeAws_restJson1RemoveFlowMediaStreamCommand = deserializeAws_restJson1RemoveFlowMediaStreamCommand;
1877
1494
  const deserializeAws_restJson1RemoveFlowMediaStreamCommandError = async (output, context) => {
@@ -1879,7 +1496,6 @@ const deserializeAws_restJson1RemoveFlowMediaStreamCommandError = async (output,
1879
1496
  ...output,
1880
1497
  body: await parseBody(output.body, context),
1881
1498
  };
1882
- let response;
1883
1499
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1884
1500
  switch (errorCode) {
1885
1501
  case "BadRequestException":
@@ -1902,33 +1518,29 @@ const deserializeAws_restJson1RemoveFlowMediaStreamCommandError = async (output,
1902
1518
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1903
1519
  default:
1904
1520
  const parsedBody = parsedOutput.body;
1905
- const $metadata = deserializeMetadata(output);
1906
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1907
- response = new MediaConnectServiceException_1.MediaConnectServiceException({
1908
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1909
- $fault: "client",
1910
- $metadata,
1521
+ (0, smithy_client_1.throwDefaultError)({
1522
+ output,
1523
+ parsedBody,
1524
+ exceptionCtor: MediaConnectServiceException_1.MediaConnectServiceException,
1525
+ errorCode,
1911
1526
  });
1912
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1913
1527
  }
1914
1528
  };
1915
1529
  const deserializeAws_restJson1RemoveFlowOutputCommand = async (output, context) => {
1916
1530
  if (output.statusCode !== 202 && output.statusCode >= 300) {
1917
1531
  return deserializeAws_restJson1RemoveFlowOutputCommandError(output, context);
1918
1532
  }
1919
- const contents = {
1533
+ const contents = map({
1920
1534
  $metadata: deserializeMetadata(output),
1921
- FlowArn: undefined,
1922
- OutputArn: undefined,
1923
- };
1535
+ });
1924
1536
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1925
- if (data.flowArn !== undefined && data.flowArn !== null) {
1537
+ if (data.flowArn != null) {
1926
1538
  contents.FlowArn = (0, smithy_client_1.expectString)(data.flowArn);
1927
1539
  }
1928
- if (data.outputArn !== undefined && data.outputArn !== null) {
1540
+ if (data.outputArn != null) {
1929
1541
  contents.OutputArn = (0, smithy_client_1.expectString)(data.outputArn);
1930
1542
  }
1931
- return Promise.resolve(contents);
1543
+ return contents;
1932
1544
  };
1933
1545
  exports.deserializeAws_restJson1RemoveFlowOutputCommand = deserializeAws_restJson1RemoveFlowOutputCommand;
1934
1546
  const deserializeAws_restJson1RemoveFlowOutputCommandError = async (output, context) => {
@@ -1936,7 +1548,6 @@ const deserializeAws_restJson1RemoveFlowOutputCommandError = async (output, cont
1936
1548
  ...output,
1937
1549
  body: await parseBody(output.body, context),
1938
1550
  };
1939
- let response;
1940
1551
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1941
1552
  switch (errorCode) {
1942
1553
  case "BadRequestException":
@@ -1959,33 +1570,29 @@ const deserializeAws_restJson1RemoveFlowOutputCommandError = async (output, cont
1959
1570
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1960
1571
  default:
1961
1572
  const parsedBody = parsedOutput.body;
1962
- const $metadata = deserializeMetadata(output);
1963
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1964
- response = new MediaConnectServiceException_1.MediaConnectServiceException({
1965
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1966
- $fault: "client",
1967
- $metadata,
1573
+ (0, smithy_client_1.throwDefaultError)({
1574
+ output,
1575
+ parsedBody,
1576
+ exceptionCtor: MediaConnectServiceException_1.MediaConnectServiceException,
1577
+ errorCode,
1968
1578
  });
1969
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1970
1579
  }
1971
1580
  };
1972
1581
  const deserializeAws_restJson1RemoveFlowSourceCommand = async (output, context) => {
1973
1582
  if (output.statusCode !== 202 && output.statusCode >= 300) {
1974
1583
  return deserializeAws_restJson1RemoveFlowSourceCommandError(output, context);
1975
1584
  }
1976
- const contents = {
1585
+ const contents = map({
1977
1586
  $metadata: deserializeMetadata(output),
1978
- FlowArn: undefined,
1979
- SourceArn: undefined,
1980
- };
1587
+ });
1981
1588
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1982
- if (data.flowArn !== undefined && data.flowArn !== null) {
1589
+ if (data.flowArn != null) {
1983
1590
  contents.FlowArn = (0, smithy_client_1.expectString)(data.flowArn);
1984
1591
  }
1985
- if (data.sourceArn !== undefined && data.sourceArn !== null) {
1592
+ if (data.sourceArn != null) {
1986
1593
  contents.SourceArn = (0, smithy_client_1.expectString)(data.sourceArn);
1987
1594
  }
1988
- return Promise.resolve(contents);
1595
+ return contents;
1989
1596
  };
1990
1597
  exports.deserializeAws_restJson1RemoveFlowSourceCommand = deserializeAws_restJson1RemoveFlowSourceCommand;
1991
1598
  const deserializeAws_restJson1RemoveFlowSourceCommandError = async (output, context) => {
@@ -1993,7 +1600,6 @@ const deserializeAws_restJson1RemoveFlowSourceCommandError = async (output, cont
1993
1600
  ...output,
1994
1601
  body: await parseBody(output.body, context),
1995
1602
  };
1996
- let response;
1997
1603
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1998
1604
  switch (errorCode) {
1999
1605
  case "BadRequestException":
@@ -2016,37 +1622,32 @@ const deserializeAws_restJson1RemoveFlowSourceCommandError = async (output, cont
2016
1622
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2017
1623
  default:
2018
1624
  const parsedBody = parsedOutput.body;
2019
- const $metadata = deserializeMetadata(output);
2020
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2021
- response = new MediaConnectServiceException_1.MediaConnectServiceException({
2022
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2023
- $fault: "client",
2024
- $metadata,
1625
+ (0, smithy_client_1.throwDefaultError)({
1626
+ output,
1627
+ parsedBody,
1628
+ exceptionCtor: MediaConnectServiceException_1.MediaConnectServiceException,
1629
+ errorCode,
2025
1630
  });
2026
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2027
1631
  }
2028
1632
  };
2029
1633
  const deserializeAws_restJson1RemoveFlowVpcInterfaceCommand = async (output, context) => {
2030
1634
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2031
1635
  return deserializeAws_restJson1RemoveFlowVpcInterfaceCommandError(output, context);
2032
1636
  }
2033
- const contents = {
1637
+ const contents = map({
2034
1638
  $metadata: deserializeMetadata(output),
2035
- FlowArn: undefined,
2036
- NonDeletedNetworkInterfaceIds: undefined,
2037
- VpcInterfaceName: undefined,
2038
- };
1639
+ });
2039
1640
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2040
- if (data.flowArn !== undefined && data.flowArn !== null) {
1641
+ if (data.flowArn != null) {
2041
1642
  contents.FlowArn = (0, smithy_client_1.expectString)(data.flowArn);
2042
1643
  }
2043
- if (data.nonDeletedNetworkInterfaceIds !== undefined && data.nonDeletedNetworkInterfaceIds !== null) {
1644
+ if (data.nonDeletedNetworkInterfaceIds != null) {
2044
1645
  contents.NonDeletedNetworkInterfaceIds = deserializeAws_restJson1__listOf__string(data.nonDeletedNetworkInterfaceIds, context);
2045
1646
  }
2046
- if (data.vpcInterfaceName !== undefined && data.vpcInterfaceName !== null) {
1647
+ if (data.vpcInterfaceName != null) {
2047
1648
  contents.VpcInterfaceName = (0, smithy_client_1.expectString)(data.vpcInterfaceName);
2048
1649
  }
2049
- return Promise.resolve(contents);
1650
+ return contents;
2050
1651
  };
2051
1652
  exports.deserializeAws_restJson1RemoveFlowVpcInterfaceCommand = deserializeAws_restJson1RemoveFlowVpcInterfaceCommand;
2052
1653
  const deserializeAws_restJson1RemoveFlowVpcInterfaceCommandError = async (output, context) => {
@@ -2054,7 +1655,6 @@ const deserializeAws_restJson1RemoveFlowVpcInterfaceCommandError = async (output
2054
1655
  ...output,
2055
1656
  body: await parseBody(output.body, context),
2056
1657
  };
2057
- let response;
2058
1658
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2059
1659
  switch (errorCode) {
2060
1660
  case "BadRequestException":
@@ -2077,33 +1677,29 @@ const deserializeAws_restJson1RemoveFlowVpcInterfaceCommandError = async (output
2077
1677
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2078
1678
  default:
2079
1679
  const parsedBody = parsedOutput.body;
2080
- const $metadata = deserializeMetadata(output);
2081
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2082
- response = new MediaConnectServiceException_1.MediaConnectServiceException({
2083
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2084
- $fault: "client",
2085
- $metadata,
1680
+ (0, smithy_client_1.throwDefaultError)({
1681
+ output,
1682
+ parsedBody,
1683
+ exceptionCtor: MediaConnectServiceException_1.MediaConnectServiceException,
1684
+ errorCode,
2086
1685
  });
2087
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2088
1686
  }
2089
1687
  };
2090
1688
  const deserializeAws_restJson1RevokeFlowEntitlementCommand = async (output, context) => {
2091
1689
  if (output.statusCode !== 202 && output.statusCode >= 300) {
2092
1690
  return deserializeAws_restJson1RevokeFlowEntitlementCommandError(output, context);
2093
1691
  }
2094
- const contents = {
1692
+ const contents = map({
2095
1693
  $metadata: deserializeMetadata(output),
2096
- EntitlementArn: undefined,
2097
- FlowArn: undefined,
2098
- };
1694
+ });
2099
1695
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2100
- if (data.entitlementArn !== undefined && data.entitlementArn !== null) {
1696
+ if (data.entitlementArn != null) {
2101
1697
  contents.EntitlementArn = (0, smithy_client_1.expectString)(data.entitlementArn);
2102
1698
  }
2103
- if (data.flowArn !== undefined && data.flowArn !== null) {
1699
+ if (data.flowArn != null) {
2104
1700
  contents.FlowArn = (0, smithy_client_1.expectString)(data.flowArn);
2105
1701
  }
2106
- return Promise.resolve(contents);
1702
+ return contents;
2107
1703
  };
2108
1704
  exports.deserializeAws_restJson1RevokeFlowEntitlementCommand = deserializeAws_restJson1RevokeFlowEntitlementCommand;
2109
1705
  const deserializeAws_restJson1RevokeFlowEntitlementCommandError = async (output, context) => {
@@ -2111,7 +1707,6 @@ const deserializeAws_restJson1RevokeFlowEntitlementCommandError = async (output,
2111
1707
  ...output,
2112
1708
  body: await parseBody(output.body, context),
2113
1709
  };
2114
- let response;
2115
1710
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2116
1711
  switch (errorCode) {
2117
1712
  case "BadRequestException":
@@ -2134,33 +1729,29 @@ const deserializeAws_restJson1RevokeFlowEntitlementCommandError = async (output,
2134
1729
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2135
1730
  default:
2136
1731
  const parsedBody = parsedOutput.body;
2137
- const $metadata = deserializeMetadata(output);
2138
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2139
- response = new MediaConnectServiceException_1.MediaConnectServiceException({
2140
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2141
- $fault: "client",
2142
- $metadata,
1732
+ (0, smithy_client_1.throwDefaultError)({
1733
+ output,
1734
+ parsedBody,
1735
+ exceptionCtor: MediaConnectServiceException_1.MediaConnectServiceException,
1736
+ errorCode,
2143
1737
  });
2144
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2145
1738
  }
2146
1739
  };
2147
1740
  const deserializeAws_restJson1StartFlowCommand = async (output, context) => {
2148
1741
  if (output.statusCode !== 202 && output.statusCode >= 300) {
2149
1742
  return deserializeAws_restJson1StartFlowCommandError(output, context);
2150
1743
  }
2151
- const contents = {
1744
+ const contents = map({
2152
1745
  $metadata: deserializeMetadata(output),
2153
- FlowArn: undefined,
2154
- Status: undefined,
2155
- };
1746
+ });
2156
1747
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2157
- if (data.flowArn !== undefined && data.flowArn !== null) {
1748
+ if (data.flowArn != null) {
2158
1749
  contents.FlowArn = (0, smithy_client_1.expectString)(data.flowArn);
2159
1750
  }
2160
- if (data.status !== undefined && data.status !== null) {
1751
+ if (data.status != null) {
2161
1752
  contents.Status = (0, smithy_client_1.expectString)(data.status);
2162
1753
  }
2163
- return Promise.resolve(contents);
1754
+ return contents;
2164
1755
  };
2165
1756
  exports.deserializeAws_restJson1StartFlowCommand = deserializeAws_restJson1StartFlowCommand;
2166
1757
  const deserializeAws_restJson1StartFlowCommandError = async (output, context) => {
@@ -2168,7 +1759,6 @@ const deserializeAws_restJson1StartFlowCommandError = async (output, context) =>
2168
1759
  ...output,
2169
1760
  body: await parseBody(output.body, context),
2170
1761
  };
2171
- let response;
2172
1762
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2173
1763
  switch (errorCode) {
2174
1764
  case "BadRequestException":
@@ -2191,33 +1781,29 @@ const deserializeAws_restJson1StartFlowCommandError = async (output, context) =>
2191
1781
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2192
1782
  default:
2193
1783
  const parsedBody = parsedOutput.body;
2194
- const $metadata = deserializeMetadata(output);
2195
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2196
- response = new MediaConnectServiceException_1.MediaConnectServiceException({
2197
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2198
- $fault: "client",
2199
- $metadata,
1784
+ (0, smithy_client_1.throwDefaultError)({
1785
+ output,
1786
+ parsedBody,
1787
+ exceptionCtor: MediaConnectServiceException_1.MediaConnectServiceException,
1788
+ errorCode,
2200
1789
  });
2201
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2202
1790
  }
2203
1791
  };
2204
1792
  const deserializeAws_restJson1StopFlowCommand = async (output, context) => {
2205
1793
  if (output.statusCode !== 202 && output.statusCode >= 300) {
2206
1794
  return deserializeAws_restJson1StopFlowCommandError(output, context);
2207
1795
  }
2208
- const contents = {
1796
+ const contents = map({
2209
1797
  $metadata: deserializeMetadata(output),
2210
- FlowArn: undefined,
2211
- Status: undefined,
2212
- };
1798
+ });
2213
1799
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2214
- if (data.flowArn !== undefined && data.flowArn !== null) {
1800
+ if (data.flowArn != null) {
2215
1801
  contents.FlowArn = (0, smithy_client_1.expectString)(data.flowArn);
2216
1802
  }
2217
- if (data.status !== undefined && data.status !== null) {
1803
+ if (data.status != null) {
2218
1804
  contents.Status = (0, smithy_client_1.expectString)(data.status);
2219
1805
  }
2220
- return Promise.resolve(contents);
1806
+ return contents;
2221
1807
  };
2222
1808
  exports.deserializeAws_restJson1StopFlowCommand = deserializeAws_restJson1StopFlowCommand;
2223
1809
  const deserializeAws_restJson1StopFlowCommandError = async (output, context) => {
@@ -2225,7 +1811,6 @@ const deserializeAws_restJson1StopFlowCommandError = async (output, context) =>
2225
1811
  ...output,
2226
1812
  body: await parseBody(output.body, context),
2227
1813
  };
2228
- let response;
2229
1814
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2230
1815
  switch (errorCode) {
2231
1816
  case "BadRequestException":
@@ -2248,25 +1833,23 @@ const deserializeAws_restJson1StopFlowCommandError = async (output, context) =>
2248
1833
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2249
1834
  default:
2250
1835
  const parsedBody = parsedOutput.body;
2251
- const $metadata = deserializeMetadata(output);
2252
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2253
- response = new MediaConnectServiceException_1.MediaConnectServiceException({
2254
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2255
- $fault: "client",
2256
- $metadata,
1836
+ (0, smithy_client_1.throwDefaultError)({
1837
+ output,
1838
+ parsedBody,
1839
+ exceptionCtor: MediaConnectServiceException_1.MediaConnectServiceException,
1840
+ errorCode,
2257
1841
  });
2258
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2259
1842
  }
2260
1843
  };
2261
1844
  const deserializeAws_restJson1TagResourceCommand = async (output, context) => {
2262
1845
  if (output.statusCode !== 204 && output.statusCode >= 300) {
2263
1846
  return deserializeAws_restJson1TagResourceCommandError(output, context);
2264
1847
  }
2265
- const contents = {
1848
+ const contents = map({
2266
1849
  $metadata: deserializeMetadata(output),
2267
- };
1850
+ });
2268
1851
  await collectBody(output.body, context);
2269
- return Promise.resolve(contents);
1852
+ return contents;
2270
1853
  };
2271
1854
  exports.deserializeAws_restJson1TagResourceCommand = deserializeAws_restJson1TagResourceCommand;
2272
1855
  const deserializeAws_restJson1TagResourceCommandError = async (output, context) => {
@@ -2274,7 +1857,6 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
2274
1857
  ...output,
2275
1858
  body: await parseBody(output.body, context),
2276
1859
  };
2277
- let response;
2278
1860
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2279
1861
  switch (errorCode) {
2280
1862
  case "BadRequestException":
@@ -2288,25 +1870,23 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
2288
1870
  throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
2289
1871
  default:
2290
1872
  const parsedBody = parsedOutput.body;
2291
- const $metadata = deserializeMetadata(output);
2292
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2293
- response = new MediaConnectServiceException_1.MediaConnectServiceException({
2294
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2295
- $fault: "client",
2296
- $metadata,
1873
+ (0, smithy_client_1.throwDefaultError)({
1874
+ output,
1875
+ parsedBody,
1876
+ exceptionCtor: MediaConnectServiceException_1.MediaConnectServiceException,
1877
+ errorCode,
2297
1878
  });
2298
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2299
1879
  }
2300
1880
  };
2301
1881
  const deserializeAws_restJson1UntagResourceCommand = async (output, context) => {
2302
1882
  if (output.statusCode !== 204 && output.statusCode >= 300) {
2303
1883
  return deserializeAws_restJson1UntagResourceCommandError(output, context);
2304
1884
  }
2305
- const contents = {
1885
+ const contents = map({
2306
1886
  $metadata: deserializeMetadata(output),
2307
- };
1887
+ });
2308
1888
  await collectBody(output.body, context);
2309
- return Promise.resolve(contents);
1889
+ return contents;
2310
1890
  };
2311
1891
  exports.deserializeAws_restJson1UntagResourceCommand = deserializeAws_restJson1UntagResourceCommand;
2312
1892
  const deserializeAws_restJson1UntagResourceCommandError = async (output, context) => {
@@ -2314,7 +1894,6 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
2314
1894
  ...output,
2315
1895
  body: await parseBody(output.body, context),
2316
1896
  };
2317
- let response;
2318
1897
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2319
1898
  switch (errorCode) {
2320
1899
  case "BadRequestException":
@@ -2328,29 +1907,26 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
2328
1907
  throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
2329
1908
  default:
2330
1909
  const parsedBody = parsedOutput.body;
2331
- const $metadata = deserializeMetadata(output);
2332
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2333
- response = new MediaConnectServiceException_1.MediaConnectServiceException({
2334
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2335
- $fault: "client",
2336
- $metadata,
1910
+ (0, smithy_client_1.throwDefaultError)({
1911
+ output,
1912
+ parsedBody,
1913
+ exceptionCtor: MediaConnectServiceException_1.MediaConnectServiceException,
1914
+ errorCode,
2337
1915
  });
2338
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2339
1916
  }
2340
1917
  };
2341
1918
  const deserializeAws_restJson1UpdateFlowCommand = async (output, context) => {
2342
1919
  if (output.statusCode !== 202 && output.statusCode >= 300) {
2343
1920
  return deserializeAws_restJson1UpdateFlowCommandError(output, context);
2344
1921
  }
2345
- const contents = {
1922
+ const contents = map({
2346
1923
  $metadata: deserializeMetadata(output),
2347
- Flow: undefined,
2348
- };
1924
+ });
2349
1925
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2350
- if (data.flow !== undefined && data.flow !== null) {
1926
+ if (data.flow != null) {
2351
1927
  contents.Flow = deserializeAws_restJson1Flow(data.flow, context);
2352
1928
  }
2353
- return Promise.resolve(contents);
1929
+ return contents;
2354
1930
  };
2355
1931
  exports.deserializeAws_restJson1UpdateFlowCommand = deserializeAws_restJson1UpdateFlowCommand;
2356
1932
  const deserializeAws_restJson1UpdateFlowCommandError = async (output, context) => {
@@ -2358,7 +1934,6 @@ const deserializeAws_restJson1UpdateFlowCommandError = async (output, context) =
2358
1934
  ...output,
2359
1935
  body: await parseBody(output.body, context),
2360
1936
  };
2361
- let response;
2362
1937
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2363
1938
  switch (errorCode) {
2364
1939
  case "BadRequestException":
@@ -2381,33 +1956,29 @@ const deserializeAws_restJson1UpdateFlowCommandError = async (output, context) =
2381
1956
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2382
1957
  default:
2383
1958
  const parsedBody = parsedOutput.body;
2384
- const $metadata = deserializeMetadata(output);
2385
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2386
- response = new MediaConnectServiceException_1.MediaConnectServiceException({
2387
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2388
- $fault: "client",
2389
- $metadata,
1959
+ (0, smithy_client_1.throwDefaultError)({
1960
+ output,
1961
+ parsedBody,
1962
+ exceptionCtor: MediaConnectServiceException_1.MediaConnectServiceException,
1963
+ errorCode,
2390
1964
  });
2391
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2392
1965
  }
2393
1966
  };
2394
1967
  const deserializeAws_restJson1UpdateFlowEntitlementCommand = async (output, context) => {
2395
1968
  if (output.statusCode !== 202 && output.statusCode >= 300) {
2396
1969
  return deserializeAws_restJson1UpdateFlowEntitlementCommandError(output, context);
2397
1970
  }
2398
- const contents = {
1971
+ const contents = map({
2399
1972
  $metadata: deserializeMetadata(output),
2400
- Entitlement: undefined,
2401
- FlowArn: undefined,
2402
- };
1973
+ });
2403
1974
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2404
- if (data.entitlement !== undefined && data.entitlement !== null) {
1975
+ if (data.entitlement != null) {
2405
1976
  contents.Entitlement = deserializeAws_restJson1Entitlement(data.entitlement, context);
2406
1977
  }
2407
- if (data.flowArn !== undefined && data.flowArn !== null) {
1978
+ if (data.flowArn != null) {
2408
1979
  contents.FlowArn = (0, smithy_client_1.expectString)(data.flowArn);
2409
1980
  }
2410
- return Promise.resolve(contents);
1981
+ return contents;
2411
1982
  };
2412
1983
  exports.deserializeAws_restJson1UpdateFlowEntitlementCommand = deserializeAws_restJson1UpdateFlowEntitlementCommand;
2413
1984
  const deserializeAws_restJson1UpdateFlowEntitlementCommandError = async (output, context) => {
@@ -2415,7 +1986,6 @@ const deserializeAws_restJson1UpdateFlowEntitlementCommandError = async (output,
2415
1986
  ...output,
2416
1987
  body: await parseBody(output.body, context),
2417
1988
  };
2418
- let response;
2419
1989
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2420
1990
  switch (errorCode) {
2421
1991
  case "BadRequestException":
@@ -2438,33 +2008,29 @@ const deserializeAws_restJson1UpdateFlowEntitlementCommandError = async (output,
2438
2008
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2439
2009
  default:
2440
2010
  const parsedBody = parsedOutput.body;
2441
- const $metadata = deserializeMetadata(output);
2442
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2443
- response = new MediaConnectServiceException_1.MediaConnectServiceException({
2444
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2445
- $fault: "client",
2446
- $metadata,
2011
+ (0, smithy_client_1.throwDefaultError)({
2012
+ output,
2013
+ parsedBody,
2014
+ exceptionCtor: MediaConnectServiceException_1.MediaConnectServiceException,
2015
+ errorCode,
2447
2016
  });
2448
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2449
2017
  }
2450
2018
  };
2451
2019
  const deserializeAws_restJson1UpdateFlowMediaStreamCommand = async (output, context) => {
2452
2020
  if (output.statusCode !== 202 && output.statusCode >= 300) {
2453
2021
  return deserializeAws_restJson1UpdateFlowMediaStreamCommandError(output, context);
2454
2022
  }
2455
- const contents = {
2023
+ const contents = map({
2456
2024
  $metadata: deserializeMetadata(output),
2457
- FlowArn: undefined,
2458
- MediaStream: undefined,
2459
- };
2025
+ });
2460
2026
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2461
- if (data.flowArn !== undefined && data.flowArn !== null) {
2027
+ if (data.flowArn != null) {
2462
2028
  contents.FlowArn = (0, smithy_client_1.expectString)(data.flowArn);
2463
2029
  }
2464
- if (data.mediaStream !== undefined && data.mediaStream !== null) {
2030
+ if (data.mediaStream != null) {
2465
2031
  contents.MediaStream = deserializeAws_restJson1MediaStream(data.mediaStream, context);
2466
2032
  }
2467
- return Promise.resolve(contents);
2033
+ return contents;
2468
2034
  };
2469
2035
  exports.deserializeAws_restJson1UpdateFlowMediaStreamCommand = deserializeAws_restJson1UpdateFlowMediaStreamCommand;
2470
2036
  const deserializeAws_restJson1UpdateFlowMediaStreamCommandError = async (output, context) => {
@@ -2472,7 +2038,6 @@ const deserializeAws_restJson1UpdateFlowMediaStreamCommandError = async (output,
2472
2038
  ...output,
2473
2039
  body: await parseBody(output.body, context),
2474
2040
  };
2475
- let response;
2476
2041
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2477
2042
  switch (errorCode) {
2478
2043
  case "BadRequestException":
@@ -2495,33 +2060,29 @@ const deserializeAws_restJson1UpdateFlowMediaStreamCommandError = async (output,
2495
2060
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2496
2061
  default:
2497
2062
  const parsedBody = parsedOutput.body;
2498
- const $metadata = deserializeMetadata(output);
2499
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2500
- response = new MediaConnectServiceException_1.MediaConnectServiceException({
2501
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2502
- $fault: "client",
2503
- $metadata,
2063
+ (0, smithy_client_1.throwDefaultError)({
2064
+ output,
2065
+ parsedBody,
2066
+ exceptionCtor: MediaConnectServiceException_1.MediaConnectServiceException,
2067
+ errorCode,
2504
2068
  });
2505
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2506
2069
  }
2507
2070
  };
2508
2071
  const deserializeAws_restJson1UpdateFlowOutputCommand = async (output, context) => {
2509
2072
  if (output.statusCode !== 202 && output.statusCode >= 300) {
2510
2073
  return deserializeAws_restJson1UpdateFlowOutputCommandError(output, context);
2511
2074
  }
2512
- const contents = {
2075
+ const contents = map({
2513
2076
  $metadata: deserializeMetadata(output),
2514
- FlowArn: undefined,
2515
- Output: undefined,
2516
- };
2077
+ });
2517
2078
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2518
- if (data.flowArn !== undefined && data.flowArn !== null) {
2079
+ if (data.flowArn != null) {
2519
2080
  contents.FlowArn = (0, smithy_client_1.expectString)(data.flowArn);
2520
2081
  }
2521
- if (data.output !== undefined && data.output !== null) {
2082
+ if (data.output != null) {
2522
2083
  contents.Output = deserializeAws_restJson1Output(data.output, context);
2523
2084
  }
2524
- return Promise.resolve(contents);
2085
+ return contents;
2525
2086
  };
2526
2087
  exports.deserializeAws_restJson1UpdateFlowOutputCommand = deserializeAws_restJson1UpdateFlowOutputCommand;
2527
2088
  const deserializeAws_restJson1UpdateFlowOutputCommandError = async (output, context) => {
@@ -2529,7 +2090,6 @@ const deserializeAws_restJson1UpdateFlowOutputCommandError = async (output, cont
2529
2090
  ...output,
2530
2091
  body: await parseBody(output.body, context),
2531
2092
  };
2532
- let response;
2533
2093
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2534
2094
  switch (errorCode) {
2535
2095
  case "BadRequestException":
@@ -2552,33 +2112,29 @@ const deserializeAws_restJson1UpdateFlowOutputCommandError = async (output, cont
2552
2112
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2553
2113
  default:
2554
2114
  const parsedBody = parsedOutput.body;
2555
- const $metadata = deserializeMetadata(output);
2556
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2557
- response = new MediaConnectServiceException_1.MediaConnectServiceException({
2558
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2559
- $fault: "client",
2560
- $metadata,
2115
+ (0, smithy_client_1.throwDefaultError)({
2116
+ output,
2117
+ parsedBody,
2118
+ exceptionCtor: MediaConnectServiceException_1.MediaConnectServiceException,
2119
+ errorCode,
2561
2120
  });
2562
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2563
2121
  }
2564
2122
  };
2565
2123
  const deserializeAws_restJson1UpdateFlowSourceCommand = async (output, context) => {
2566
2124
  if (output.statusCode !== 202 && output.statusCode >= 300) {
2567
2125
  return deserializeAws_restJson1UpdateFlowSourceCommandError(output, context);
2568
2126
  }
2569
- const contents = {
2127
+ const contents = map({
2570
2128
  $metadata: deserializeMetadata(output),
2571
- FlowArn: undefined,
2572
- Source: undefined,
2573
- };
2129
+ });
2574
2130
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2575
- if (data.flowArn !== undefined && data.flowArn !== null) {
2131
+ if (data.flowArn != null) {
2576
2132
  contents.FlowArn = (0, smithy_client_1.expectString)(data.flowArn);
2577
2133
  }
2578
- if (data.source !== undefined && data.source !== null) {
2134
+ if (data.source != null) {
2579
2135
  contents.Source = deserializeAws_restJson1Source(data.source, context);
2580
2136
  }
2581
- return Promise.resolve(contents);
2137
+ return contents;
2582
2138
  };
2583
2139
  exports.deserializeAws_restJson1UpdateFlowSourceCommand = deserializeAws_restJson1UpdateFlowSourceCommand;
2584
2140
  const deserializeAws_restJson1UpdateFlowSourceCommandError = async (output, context) => {
@@ -2586,7 +2142,6 @@ const deserializeAws_restJson1UpdateFlowSourceCommandError = async (output, cont
2586
2142
  ...output,
2587
2143
  body: await parseBody(output.body, context),
2588
2144
  };
2589
- let response;
2590
2145
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2591
2146
  switch (errorCode) {
2592
2147
  case "BadRequestException":
@@ -2609,20 +2164,19 @@ const deserializeAws_restJson1UpdateFlowSourceCommandError = async (output, cont
2609
2164
  throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2610
2165
  default:
2611
2166
  const parsedBody = parsedOutput.body;
2612
- const $metadata = deserializeMetadata(output);
2613
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2614
- response = new MediaConnectServiceException_1.MediaConnectServiceException({
2615
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2616
- $fault: "client",
2617
- $metadata,
2167
+ (0, smithy_client_1.throwDefaultError)({
2168
+ output,
2169
+ parsedBody,
2170
+ exceptionCtor: MediaConnectServiceException_1.MediaConnectServiceException,
2171
+ errorCode,
2618
2172
  });
2619
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2620
2173
  }
2621
2174
  };
2175
+ const map = smithy_client_1.map;
2622
2176
  const deserializeAws_restJson1AddFlowOutputs420ExceptionResponse = async (parsedOutput, context) => {
2623
- const contents = {};
2177
+ const contents = map({});
2624
2178
  const data = parsedOutput.body;
2625
- if (data.message !== undefined && data.message !== null) {
2179
+ if (data.message != null) {
2626
2180
  contents.Message = (0, smithy_client_1.expectString)(data.message);
2627
2181
  }
2628
2182
  const exception = new models_0_1.AddFlowOutputs420Exception({
@@ -2632,9 +2186,9 @@ const deserializeAws_restJson1AddFlowOutputs420ExceptionResponse = async (parsed
2632
2186
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2633
2187
  };
2634
2188
  const deserializeAws_restJson1BadRequestExceptionResponse = async (parsedOutput, context) => {
2635
- const contents = {};
2189
+ const contents = map({});
2636
2190
  const data = parsedOutput.body;
2637
- if (data.message !== undefined && data.message !== null) {
2191
+ if (data.message != null) {
2638
2192
  contents.Message = (0, smithy_client_1.expectString)(data.message);
2639
2193
  }
2640
2194
  const exception = new models_0_1.BadRequestException({
@@ -2644,9 +2198,9 @@ const deserializeAws_restJson1BadRequestExceptionResponse = async (parsedOutput,
2644
2198
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2645
2199
  };
2646
2200
  const deserializeAws_restJson1CreateFlow420ExceptionResponse = async (parsedOutput, context) => {
2647
- const contents = {};
2201
+ const contents = map({});
2648
2202
  const data = parsedOutput.body;
2649
- if (data.message !== undefined && data.message !== null) {
2203
+ if (data.message != null) {
2650
2204
  contents.Message = (0, smithy_client_1.expectString)(data.message);
2651
2205
  }
2652
2206
  const exception = new models_0_1.CreateFlow420Exception({
@@ -2656,9 +2210,9 @@ const deserializeAws_restJson1CreateFlow420ExceptionResponse = async (parsedOutp
2656
2210
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2657
2211
  };
2658
2212
  const deserializeAws_restJson1ForbiddenExceptionResponse = async (parsedOutput, context) => {
2659
- const contents = {};
2213
+ const contents = map({});
2660
2214
  const data = parsedOutput.body;
2661
- if (data.message !== undefined && data.message !== null) {
2215
+ if (data.message != null) {
2662
2216
  contents.Message = (0, smithy_client_1.expectString)(data.message);
2663
2217
  }
2664
2218
  const exception = new models_0_1.ForbiddenException({
@@ -2668,9 +2222,9 @@ const deserializeAws_restJson1ForbiddenExceptionResponse = async (parsedOutput,
2668
2222
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2669
2223
  };
2670
2224
  const deserializeAws_restJson1GrantFlowEntitlements420ExceptionResponse = async (parsedOutput, context) => {
2671
- const contents = {};
2225
+ const contents = map({});
2672
2226
  const data = parsedOutput.body;
2673
- if (data.message !== undefined && data.message !== null) {
2227
+ if (data.message != null) {
2674
2228
  contents.Message = (0, smithy_client_1.expectString)(data.message);
2675
2229
  }
2676
2230
  const exception = new models_0_1.GrantFlowEntitlements420Exception({
@@ -2680,9 +2234,9 @@ const deserializeAws_restJson1GrantFlowEntitlements420ExceptionResponse = async
2680
2234
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2681
2235
  };
2682
2236
  const deserializeAws_restJson1InternalServerErrorExceptionResponse = async (parsedOutput, context) => {
2683
- const contents = {};
2237
+ const contents = map({});
2684
2238
  const data = parsedOutput.body;
2685
- if (data.message !== undefined && data.message !== null) {
2239
+ if (data.message != null) {
2686
2240
  contents.Message = (0, smithy_client_1.expectString)(data.message);
2687
2241
  }
2688
2242
  const exception = new models_0_1.InternalServerErrorException({
@@ -2692,9 +2246,9 @@ const deserializeAws_restJson1InternalServerErrorExceptionResponse = async (pars
2692
2246
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2693
2247
  };
2694
2248
  const deserializeAws_restJson1NotFoundExceptionResponse = async (parsedOutput, context) => {
2695
- const contents = {};
2249
+ const contents = map({});
2696
2250
  const data = parsedOutput.body;
2697
- if (data.message !== undefined && data.message !== null) {
2251
+ if (data.message != null) {
2698
2252
  contents.Message = (0, smithy_client_1.expectString)(data.message);
2699
2253
  }
2700
2254
  const exception = new models_0_1.NotFoundException({
@@ -2704,9 +2258,9 @@ const deserializeAws_restJson1NotFoundExceptionResponse = async (parsedOutput, c
2704
2258
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2705
2259
  };
2706
2260
  const deserializeAws_restJson1ServiceUnavailableExceptionResponse = async (parsedOutput, context) => {
2707
- const contents = {};
2261
+ const contents = map({});
2708
2262
  const data = parsedOutput.body;
2709
- if (data.message !== undefined && data.message !== null) {
2263
+ if (data.message != null) {
2710
2264
  contents.Message = (0, smithy_client_1.expectString)(data.message);
2711
2265
  }
2712
2266
  const exception = new models_0_1.ServiceUnavailableException({
@@ -2716,9 +2270,9 @@ const deserializeAws_restJson1ServiceUnavailableExceptionResponse = async (parse
2716
2270
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2717
2271
  };
2718
2272
  const deserializeAws_restJson1TooManyRequestsExceptionResponse = async (parsedOutput, context) => {
2719
- const contents = {};
2273
+ const contents = map({});
2720
2274
  const data = parsedOutput.body;
2721
- if (data.message !== undefined && data.message !== null) {
2275
+ if (data.message != null) {
2722
2276
  contents.Message = (0, smithy_client_1.expectString)(data.message);
2723
2277
  }
2724
2278
  const exception = new models_0_1.TooManyRequestsException({
@@ -2731,9 +2285,6 @@ const serializeAws_restJson1__listOf__string = (input, context) => {
2731
2285
  return input
2732
2286
  .filter((e) => e != null)
2733
2287
  .map((entry) => {
2734
- if (entry === null) {
2735
- return null;
2736
- }
2737
2288
  return entry;
2738
2289
  });
2739
2290
  };
@@ -2741,9 +2292,6 @@ const serializeAws_restJson1__listOfAddMediaStreamRequest = (input, context) =>
2741
2292
  return input
2742
2293
  .filter((e) => e != null)
2743
2294
  .map((entry) => {
2744
- if (entry === null) {
2745
- return null;
2746
- }
2747
2295
  return serializeAws_restJson1AddMediaStreamRequest(entry, context);
2748
2296
  });
2749
2297
  };
@@ -2751,9 +2299,6 @@ const serializeAws_restJson1__listOfAddOutputRequest = (input, context) => {
2751
2299
  return input
2752
2300
  .filter((e) => e != null)
2753
2301
  .map((entry) => {
2754
- if (entry === null) {
2755
- return null;
2756
- }
2757
2302
  return serializeAws_restJson1AddOutputRequest(entry, context);
2758
2303
  });
2759
2304
  };
@@ -2761,9 +2306,6 @@ const serializeAws_restJson1__listOfDestinationConfigurationRequest = (input, co
2761
2306
  return input
2762
2307
  .filter((e) => e != null)
2763
2308
  .map((entry) => {
2764
- if (entry === null) {
2765
- return null;
2766
- }
2767
2309
  return serializeAws_restJson1DestinationConfigurationRequest(entry, context);
2768
2310
  });
2769
2311
  };
@@ -2771,9 +2313,6 @@ const serializeAws_restJson1__listOfGrantEntitlementRequest = (input, context) =
2771
2313
  return input
2772
2314
  .filter((e) => e != null)
2773
2315
  .map((entry) => {
2774
- if (entry === null) {
2775
- return null;
2776
- }
2777
2316
  return serializeAws_restJson1GrantEntitlementRequest(entry, context);
2778
2317
  });
2779
2318
  };
@@ -2781,9 +2320,6 @@ const serializeAws_restJson1__listOfInputConfigurationRequest = (input, context)
2781
2320
  return input
2782
2321
  .filter((e) => e != null)
2783
2322
  .map((entry) => {
2784
- if (entry === null) {
2785
- return null;
2786
- }
2787
2323
  return serializeAws_restJson1InputConfigurationRequest(entry, context);
2788
2324
  });
2789
2325
  };
@@ -2791,9 +2327,6 @@ const serializeAws_restJson1__listOfMediaStreamOutputConfigurationRequest = (inp
2791
2327
  return input
2792
2328
  .filter((e) => e != null)
2793
2329
  .map((entry) => {
2794
- if (entry === null) {
2795
- return null;
2796
- }
2797
2330
  return serializeAws_restJson1MediaStreamOutputConfigurationRequest(entry, context);
2798
2331
  });
2799
2332
  };
@@ -2801,9 +2334,6 @@ const serializeAws_restJson1__listOfMediaStreamSourceConfigurationRequest = (inp
2801
2334
  return input
2802
2335
  .filter((e) => e != null)
2803
2336
  .map((entry) => {
2804
- if (entry === null) {
2805
- return null;
2806
- }
2807
2337
  return serializeAws_restJson1MediaStreamSourceConfigurationRequest(entry, context);
2808
2338
  });
2809
2339
  };
@@ -2811,9 +2341,6 @@ const serializeAws_restJson1__listOfSetSourceRequest = (input, context) => {
2811
2341
  return input
2812
2342
  .filter((e) => e != null)
2813
2343
  .map((entry) => {
2814
- if (entry === null) {
2815
- return null;
2816
- }
2817
2344
  return serializeAws_restJson1SetSourceRequest(entry, context);
2818
2345
  });
2819
2346
  };
@@ -2821,9 +2348,6 @@ const serializeAws_restJson1__listOfVpcInterfaceRequest = (input, context) => {
2821
2348
  return input
2822
2349
  .filter((e) => e != null)
2823
2350
  .map((entry) => {
2824
- if (entry === null) {
2825
- return null;
2826
- }
2827
2351
  return serializeAws_restJson1VpcInterfaceRequest(entry, context);
2828
2352
  });
2829
2353
  };