@aws-sdk/client-mediatailor 3.141.0 → 3.150.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.
@@ -34,16 +34,7 @@ const serializeAws_restJson1CreateChannelCommand = async (input, context) => {
34
34
  "content-type": "application/json",
35
35
  };
36
36
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/channel/{ChannelName}";
37
- if (input.ChannelName !== undefined) {
38
- const labelValue = input.ChannelName;
39
- if (labelValue.length <= 0) {
40
- throw new Error("Empty value provided for input HTTP label: ChannelName.");
41
- }
42
- resolvedPath = resolvedPath.replace("{ChannelName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
43
- }
44
- else {
45
- throw new Error("No value provided for input HTTP label: ChannelName.");
46
- }
37
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ChannelName", () => input.ChannelName, "{ChannelName}", false);
47
38
  let body;
48
39
  body = JSON.stringify({
49
40
  ...(input.FillerSlate != null && { FillerSlate: serializeAws_restJson1SlateSource(input.FillerSlate, context) }),
@@ -70,26 +61,8 @@ const serializeAws_restJson1CreateLiveSourceCommand = async (input, context) =>
70
61
  };
71
62
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
72
63
  "/sourceLocation/{SourceLocationName}/liveSource/{LiveSourceName}";
73
- if (input.LiveSourceName !== undefined) {
74
- const labelValue = input.LiveSourceName;
75
- if (labelValue.length <= 0) {
76
- throw new Error("Empty value provided for input HTTP label: LiveSourceName.");
77
- }
78
- resolvedPath = resolvedPath.replace("{LiveSourceName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
79
- }
80
- else {
81
- throw new Error("No value provided for input HTTP label: LiveSourceName.");
82
- }
83
- if (input.SourceLocationName !== undefined) {
84
- const labelValue = input.SourceLocationName;
85
- if (labelValue.length <= 0) {
86
- throw new Error("Empty value provided for input HTTP label: SourceLocationName.");
87
- }
88
- resolvedPath = resolvedPath.replace("{SourceLocationName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
89
- }
90
- else {
91
- throw new Error("No value provided for input HTTP label: SourceLocationName.");
92
- }
64
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "LiveSourceName", () => input.LiveSourceName, "{LiveSourceName}", false);
65
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "SourceLocationName", () => input.SourceLocationName, "{SourceLocationName}", false);
93
66
  let body;
94
67
  body = JSON.stringify({
95
68
  ...(input.HttpPackageConfigurations != null && {
@@ -115,26 +88,8 @@ const serializeAws_restJson1CreatePrefetchScheduleCommand = async (input, contex
115
88
  };
116
89
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
117
90
  "/prefetchSchedule/{PlaybackConfigurationName}/{Name}";
118
- if (input.Name !== undefined) {
119
- const labelValue = input.Name;
120
- if (labelValue.length <= 0) {
121
- throw new Error("Empty value provided for input HTTP label: Name.");
122
- }
123
- resolvedPath = resolvedPath.replace("{Name}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
124
- }
125
- else {
126
- throw new Error("No value provided for input HTTP label: Name.");
127
- }
128
- if (input.PlaybackConfigurationName !== undefined) {
129
- const labelValue = input.PlaybackConfigurationName;
130
- if (labelValue.length <= 0) {
131
- throw new Error("Empty value provided for input HTTP label: PlaybackConfigurationName.");
132
- }
133
- resolvedPath = resolvedPath.replace("{PlaybackConfigurationName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
134
- }
135
- else {
136
- throw new Error("No value provided for input HTTP label: PlaybackConfigurationName.");
137
- }
91
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "Name", () => input.Name, "{Name}", false);
92
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "PlaybackConfigurationName", () => input.PlaybackConfigurationName, "{PlaybackConfigurationName}", false);
138
93
  let body;
139
94
  body = JSON.stringify({
140
95
  ...(input.Consumption != null && {
@@ -161,26 +116,8 @@ const serializeAws_restJson1CreateProgramCommand = async (input, context) => {
161
116
  };
162
117
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
163
118
  "/channel/{ChannelName}/program/{ProgramName}";
164
- if (input.ChannelName !== undefined) {
165
- const labelValue = input.ChannelName;
166
- if (labelValue.length <= 0) {
167
- throw new Error("Empty value provided for input HTTP label: ChannelName.");
168
- }
169
- resolvedPath = resolvedPath.replace("{ChannelName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
170
- }
171
- else {
172
- throw new Error("No value provided for input HTTP label: ChannelName.");
173
- }
174
- if (input.ProgramName !== undefined) {
175
- const labelValue = input.ProgramName;
176
- if (labelValue.length <= 0) {
177
- throw new Error("Empty value provided for input HTTP label: ProgramName.");
178
- }
179
- resolvedPath = resolvedPath.replace("{ProgramName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
180
- }
181
- else {
182
- throw new Error("No value provided for input HTTP label: ProgramName.");
183
- }
119
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ChannelName", () => input.ChannelName, "{ChannelName}", false);
120
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ProgramName", () => input.ProgramName, "{ProgramName}", false);
184
121
  let body;
185
122
  body = JSON.stringify({
186
123
  ...(input.AdBreaks != null && { AdBreaks: serializeAws_restJson1__listOfAdBreak(input.AdBreaks, context) }),
@@ -208,16 +145,7 @@ const serializeAws_restJson1CreateSourceLocationCommand = async (input, context)
208
145
  "content-type": "application/json",
209
146
  };
210
147
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/sourceLocation/{SourceLocationName}";
211
- if (input.SourceLocationName !== undefined) {
212
- const labelValue = input.SourceLocationName;
213
- if (labelValue.length <= 0) {
214
- throw new Error("Empty value provided for input HTTP label: SourceLocationName.");
215
- }
216
- resolvedPath = resolvedPath.replace("{SourceLocationName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
217
- }
218
- else {
219
- throw new Error("No value provided for input HTTP label: SourceLocationName.");
220
- }
148
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "SourceLocationName", () => input.SourceLocationName, "{SourceLocationName}", false);
221
149
  let body;
222
150
  body = JSON.stringify({
223
151
  ...(input.AccessConfiguration != null && {
@@ -252,26 +180,8 @@ const serializeAws_restJson1CreateVodSourceCommand = async (input, context) => {
252
180
  };
253
181
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
254
182
  "/sourceLocation/{SourceLocationName}/vodSource/{VodSourceName}";
255
- if (input.SourceLocationName !== undefined) {
256
- const labelValue = input.SourceLocationName;
257
- if (labelValue.length <= 0) {
258
- throw new Error("Empty value provided for input HTTP label: SourceLocationName.");
259
- }
260
- resolvedPath = resolvedPath.replace("{SourceLocationName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
261
- }
262
- else {
263
- throw new Error("No value provided for input HTTP label: SourceLocationName.");
264
- }
265
- if (input.VodSourceName !== undefined) {
266
- const labelValue = input.VodSourceName;
267
- if (labelValue.length <= 0) {
268
- throw new Error("Empty value provided for input HTTP label: VodSourceName.");
269
- }
270
- resolvedPath = resolvedPath.replace("{VodSourceName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
271
- }
272
- else {
273
- throw new Error("No value provided for input HTTP label: VodSourceName.");
274
- }
183
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "SourceLocationName", () => input.SourceLocationName, "{SourceLocationName}", false);
184
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "VodSourceName", () => input.VodSourceName, "{VodSourceName}", false);
275
185
  let body;
276
186
  body = JSON.stringify({
277
187
  ...(input.HttpPackageConfigurations != null && {
@@ -294,16 +204,7 @@ const serializeAws_restJson1DeleteChannelCommand = async (input, context) => {
294
204
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
295
205
  const headers = {};
296
206
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/channel/{ChannelName}";
297
- if (input.ChannelName !== undefined) {
298
- const labelValue = input.ChannelName;
299
- if (labelValue.length <= 0) {
300
- throw new Error("Empty value provided for input HTTP label: ChannelName.");
301
- }
302
- resolvedPath = resolvedPath.replace("{ChannelName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
303
- }
304
- else {
305
- throw new Error("No value provided for input HTTP label: ChannelName.");
306
- }
207
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ChannelName", () => input.ChannelName, "{ChannelName}", false);
307
208
  let body;
308
209
  return new protocol_http_1.HttpRequest({
309
210
  protocol,
@@ -320,16 +221,7 @@ const serializeAws_restJson1DeleteChannelPolicyCommand = async (input, context)
320
221
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
321
222
  const headers = {};
322
223
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/channel/{ChannelName}/policy";
323
- if (input.ChannelName !== undefined) {
324
- const labelValue = input.ChannelName;
325
- if (labelValue.length <= 0) {
326
- throw new Error("Empty value provided for input HTTP label: ChannelName.");
327
- }
328
- resolvedPath = resolvedPath.replace("{ChannelName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
329
- }
330
- else {
331
- throw new Error("No value provided for input HTTP label: ChannelName.");
332
- }
224
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ChannelName", () => input.ChannelName, "{ChannelName}", false);
333
225
  let body;
334
226
  return new protocol_http_1.HttpRequest({
335
227
  protocol,
@@ -347,26 +239,8 @@ const serializeAws_restJson1DeleteLiveSourceCommand = async (input, context) =>
347
239
  const headers = {};
348
240
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
349
241
  "/sourceLocation/{SourceLocationName}/liveSource/{LiveSourceName}";
350
- if (input.LiveSourceName !== undefined) {
351
- const labelValue = input.LiveSourceName;
352
- if (labelValue.length <= 0) {
353
- throw new Error("Empty value provided for input HTTP label: LiveSourceName.");
354
- }
355
- resolvedPath = resolvedPath.replace("{LiveSourceName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
356
- }
357
- else {
358
- throw new Error("No value provided for input HTTP label: LiveSourceName.");
359
- }
360
- if (input.SourceLocationName !== undefined) {
361
- const labelValue = input.SourceLocationName;
362
- if (labelValue.length <= 0) {
363
- throw new Error("Empty value provided for input HTTP label: SourceLocationName.");
364
- }
365
- resolvedPath = resolvedPath.replace("{SourceLocationName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
366
- }
367
- else {
368
- throw new Error("No value provided for input HTTP label: SourceLocationName.");
369
- }
242
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "LiveSourceName", () => input.LiveSourceName, "{LiveSourceName}", false);
243
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "SourceLocationName", () => input.SourceLocationName, "{SourceLocationName}", false);
370
244
  let body;
371
245
  return new protocol_http_1.HttpRequest({
372
246
  protocol,
@@ -383,16 +257,7 @@ const serializeAws_restJson1DeletePlaybackConfigurationCommand = async (input, c
383
257
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
384
258
  const headers = {};
385
259
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/playbackConfiguration/{Name}";
386
- if (input.Name !== undefined) {
387
- const labelValue = input.Name;
388
- if (labelValue.length <= 0) {
389
- throw new Error("Empty value provided for input HTTP label: Name.");
390
- }
391
- resolvedPath = resolvedPath.replace("{Name}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
392
- }
393
- else {
394
- throw new Error("No value provided for input HTTP label: Name.");
395
- }
260
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "Name", () => input.Name, "{Name}", false);
396
261
  let body;
397
262
  return new protocol_http_1.HttpRequest({
398
263
  protocol,
@@ -410,26 +275,8 @@ const serializeAws_restJson1DeletePrefetchScheduleCommand = async (input, contex
410
275
  const headers = {};
411
276
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
412
277
  "/prefetchSchedule/{PlaybackConfigurationName}/{Name}";
413
- if (input.Name !== undefined) {
414
- const labelValue = input.Name;
415
- if (labelValue.length <= 0) {
416
- throw new Error("Empty value provided for input HTTP label: Name.");
417
- }
418
- resolvedPath = resolvedPath.replace("{Name}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
419
- }
420
- else {
421
- throw new Error("No value provided for input HTTP label: Name.");
422
- }
423
- if (input.PlaybackConfigurationName !== undefined) {
424
- const labelValue = input.PlaybackConfigurationName;
425
- if (labelValue.length <= 0) {
426
- throw new Error("Empty value provided for input HTTP label: PlaybackConfigurationName.");
427
- }
428
- resolvedPath = resolvedPath.replace("{PlaybackConfigurationName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
429
- }
430
- else {
431
- throw new Error("No value provided for input HTTP label: PlaybackConfigurationName.");
432
- }
278
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "Name", () => input.Name, "{Name}", false);
279
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "PlaybackConfigurationName", () => input.PlaybackConfigurationName, "{PlaybackConfigurationName}", false);
433
280
  let body;
434
281
  return new protocol_http_1.HttpRequest({
435
282
  protocol,
@@ -447,26 +294,8 @@ const serializeAws_restJson1DeleteProgramCommand = async (input, context) => {
447
294
  const headers = {};
448
295
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
449
296
  "/channel/{ChannelName}/program/{ProgramName}";
450
- if (input.ChannelName !== undefined) {
451
- const labelValue = input.ChannelName;
452
- if (labelValue.length <= 0) {
453
- throw new Error("Empty value provided for input HTTP label: ChannelName.");
454
- }
455
- resolvedPath = resolvedPath.replace("{ChannelName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
456
- }
457
- else {
458
- throw new Error("No value provided for input HTTP label: ChannelName.");
459
- }
460
- if (input.ProgramName !== undefined) {
461
- const labelValue = input.ProgramName;
462
- if (labelValue.length <= 0) {
463
- throw new Error("Empty value provided for input HTTP label: ProgramName.");
464
- }
465
- resolvedPath = resolvedPath.replace("{ProgramName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
466
- }
467
- else {
468
- throw new Error("No value provided for input HTTP label: ProgramName.");
469
- }
297
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ChannelName", () => input.ChannelName, "{ChannelName}", false);
298
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ProgramName", () => input.ProgramName, "{ProgramName}", false);
470
299
  let body;
471
300
  return new protocol_http_1.HttpRequest({
472
301
  protocol,
@@ -483,16 +312,7 @@ const serializeAws_restJson1DeleteSourceLocationCommand = async (input, context)
483
312
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
484
313
  const headers = {};
485
314
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/sourceLocation/{SourceLocationName}";
486
- if (input.SourceLocationName !== undefined) {
487
- const labelValue = input.SourceLocationName;
488
- if (labelValue.length <= 0) {
489
- throw new Error("Empty value provided for input HTTP label: SourceLocationName.");
490
- }
491
- resolvedPath = resolvedPath.replace("{SourceLocationName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
492
- }
493
- else {
494
- throw new Error("No value provided for input HTTP label: SourceLocationName.");
495
- }
315
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "SourceLocationName", () => input.SourceLocationName, "{SourceLocationName}", false);
496
316
  let body;
497
317
  return new protocol_http_1.HttpRequest({
498
318
  protocol,
@@ -510,26 +330,8 @@ const serializeAws_restJson1DeleteVodSourceCommand = async (input, context) => {
510
330
  const headers = {};
511
331
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
512
332
  "/sourceLocation/{SourceLocationName}/vodSource/{VodSourceName}";
513
- if (input.SourceLocationName !== undefined) {
514
- const labelValue = input.SourceLocationName;
515
- if (labelValue.length <= 0) {
516
- throw new Error("Empty value provided for input HTTP label: SourceLocationName.");
517
- }
518
- resolvedPath = resolvedPath.replace("{SourceLocationName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
519
- }
520
- else {
521
- throw new Error("No value provided for input HTTP label: SourceLocationName.");
522
- }
523
- if (input.VodSourceName !== undefined) {
524
- const labelValue = input.VodSourceName;
525
- if (labelValue.length <= 0) {
526
- throw new Error("Empty value provided for input HTTP label: VodSourceName.");
527
- }
528
- resolvedPath = resolvedPath.replace("{VodSourceName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
529
- }
530
- else {
531
- throw new Error("No value provided for input HTTP label: VodSourceName.");
532
- }
333
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "SourceLocationName", () => input.SourceLocationName, "{SourceLocationName}", false);
334
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "VodSourceName", () => input.VodSourceName, "{VodSourceName}", false);
533
335
  let body;
534
336
  return new protocol_http_1.HttpRequest({
535
337
  protocol,
@@ -546,16 +348,7 @@ const serializeAws_restJson1DescribeChannelCommand = async (input, context) => {
546
348
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
547
349
  const headers = {};
548
350
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/channel/{ChannelName}";
549
- if (input.ChannelName !== undefined) {
550
- const labelValue = input.ChannelName;
551
- if (labelValue.length <= 0) {
552
- throw new Error("Empty value provided for input HTTP label: ChannelName.");
553
- }
554
- resolvedPath = resolvedPath.replace("{ChannelName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
555
- }
556
- else {
557
- throw new Error("No value provided for input HTTP label: ChannelName.");
558
- }
351
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ChannelName", () => input.ChannelName, "{ChannelName}", false);
559
352
  let body;
560
353
  return new protocol_http_1.HttpRequest({
561
354
  protocol,
@@ -573,26 +366,8 @@ const serializeAws_restJson1DescribeLiveSourceCommand = async (input, context) =
573
366
  const headers = {};
574
367
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
575
368
  "/sourceLocation/{SourceLocationName}/liveSource/{LiveSourceName}";
576
- if (input.LiveSourceName !== undefined) {
577
- const labelValue = input.LiveSourceName;
578
- if (labelValue.length <= 0) {
579
- throw new Error("Empty value provided for input HTTP label: LiveSourceName.");
580
- }
581
- resolvedPath = resolvedPath.replace("{LiveSourceName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
582
- }
583
- else {
584
- throw new Error("No value provided for input HTTP label: LiveSourceName.");
585
- }
586
- if (input.SourceLocationName !== undefined) {
587
- const labelValue = input.SourceLocationName;
588
- if (labelValue.length <= 0) {
589
- throw new Error("Empty value provided for input HTTP label: SourceLocationName.");
590
- }
591
- resolvedPath = resolvedPath.replace("{SourceLocationName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
592
- }
593
- else {
594
- throw new Error("No value provided for input HTTP label: SourceLocationName.");
595
- }
369
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "LiveSourceName", () => input.LiveSourceName, "{LiveSourceName}", false);
370
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "SourceLocationName", () => input.SourceLocationName, "{SourceLocationName}", false);
596
371
  let body;
597
372
  return new protocol_http_1.HttpRequest({
598
373
  protocol,
@@ -610,26 +385,8 @@ const serializeAws_restJson1DescribeProgramCommand = async (input, context) => {
610
385
  const headers = {};
611
386
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
612
387
  "/channel/{ChannelName}/program/{ProgramName}";
613
- if (input.ChannelName !== undefined) {
614
- const labelValue = input.ChannelName;
615
- if (labelValue.length <= 0) {
616
- throw new Error("Empty value provided for input HTTP label: ChannelName.");
617
- }
618
- resolvedPath = resolvedPath.replace("{ChannelName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
619
- }
620
- else {
621
- throw new Error("No value provided for input HTTP label: ChannelName.");
622
- }
623
- if (input.ProgramName !== undefined) {
624
- const labelValue = input.ProgramName;
625
- if (labelValue.length <= 0) {
626
- throw new Error("Empty value provided for input HTTP label: ProgramName.");
627
- }
628
- resolvedPath = resolvedPath.replace("{ProgramName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
629
- }
630
- else {
631
- throw new Error("No value provided for input HTTP label: ProgramName.");
632
- }
388
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ChannelName", () => input.ChannelName, "{ChannelName}", false);
389
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ProgramName", () => input.ProgramName, "{ProgramName}", false);
633
390
  let body;
634
391
  return new protocol_http_1.HttpRequest({
635
392
  protocol,
@@ -646,16 +403,7 @@ const serializeAws_restJson1DescribeSourceLocationCommand = async (input, contex
646
403
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
647
404
  const headers = {};
648
405
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/sourceLocation/{SourceLocationName}";
649
- if (input.SourceLocationName !== undefined) {
650
- const labelValue = input.SourceLocationName;
651
- if (labelValue.length <= 0) {
652
- throw new Error("Empty value provided for input HTTP label: SourceLocationName.");
653
- }
654
- resolvedPath = resolvedPath.replace("{SourceLocationName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
655
- }
656
- else {
657
- throw new Error("No value provided for input HTTP label: SourceLocationName.");
658
- }
406
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "SourceLocationName", () => input.SourceLocationName, "{SourceLocationName}", false);
659
407
  let body;
660
408
  return new protocol_http_1.HttpRequest({
661
409
  protocol,
@@ -673,26 +421,8 @@ const serializeAws_restJson1DescribeVodSourceCommand = async (input, context) =>
673
421
  const headers = {};
674
422
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
675
423
  "/sourceLocation/{SourceLocationName}/vodSource/{VodSourceName}";
676
- if (input.SourceLocationName !== undefined) {
677
- const labelValue = input.SourceLocationName;
678
- if (labelValue.length <= 0) {
679
- throw new Error("Empty value provided for input HTTP label: SourceLocationName.");
680
- }
681
- resolvedPath = resolvedPath.replace("{SourceLocationName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
682
- }
683
- else {
684
- throw new Error("No value provided for input HTTP label: SourceLocationName.");
685
- }
686
- if (input.VodSourceName !== undefined) {
687
- const labelValue = input.VodSourceName;
688
- if (labelValue.length <= 0) {
689
- throw new Error("Empty value provided for input HTTP label: VodSourceName.");
690
- }
691
- resolvedPath = resolvedPath.replace("{VodSourceName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
692
- }
693
- else {
694
- throw new Error("No value provided for input HTTP label: VodSourceName.");
695
- }
424
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "SourceLocationName", () => input.SourceLocationName, "{SourceLocationName}", false);
425
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "VodSourceName", () => input.VodSourceName, "{VodSourceName}", false);
696
426
  let body;
697
427
  return new protocol_http_1.HttpRequest({
698
428
  protocol,
@@ -709,16 +439,7 @@ const serializeAws_restJson1GetChannelPolicyCommand = async (input, context) =>
709
439
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
710
440
  const headers = {};
711
441
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/channel/{ChannelName}/policy";
712
- if (input.ChannelName !== undefined) {
713
- const labelValue = input.ChannelName;
714
- if (labelValue.length <= 0) {
715
- throw new Error("Empty value provided for input HTTP label: ChannelName.");
716
- }
717
- resolvedPath = resolvedPath.replace("{ChannelName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
718
- }
719
- else {
720
- throw new Error("No value provided for input HTTP label: ChannelName.");
721
- }
442
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ChannelName", () => input.ChannelName, "{ChannelName}", false);
722
443
  let body;
723
444
  return new protocol_http_1.HttpRequest({
724
445
  protocol,
@@ -735,21 +456,12 @@ const serializeAws_restJson1GetChannelScheduleCommand = async (input, context) =
735
456
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
736
457
  const headers = {};
737
458
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/channel/{ChannelName}/schedule";
738
- if (input.ChannelName !== undefined) {
739
- const labelValue = input.ChannelName;
740
- if (labelValue.length <= 0) {
741
- throw new Error("Empty value provided for input HTTP label: ChannelName.");
742
- }
743
- resolvedPath = resolvedPath.replace("{ChannelName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
744
- }
745
- else {
746
- throw new Error("No value provided for input HTTP label: ChannelName.");
747
- }
748
- const query = {
749
- ...(input.DurationMinutes !== undefined && { durationMinutes: input.DurationMinutes }),
750
- ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }),
751
- ...(input.NextToken !== undefined && { nextToken: input.NextToken }),
752
- };
459
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ChannelName", () => input.ChannelName, "{ChannelName}", false);
460
+ const query = map({
461
+ durationMinutes: [, input.DurationMinutes],
462
+ maxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
463
+ nextToken: [, input.NextToken],
464
+ });
753
465
  let body;
754
466
  return new protocol_http_1.HttpRequest({
755
467
  protocol,
@@ -767,16 +479,7 @@ const serializeAws_restJson1GetPlaybackConfigurationCommand = async (input, cont
767
479
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
768
480
  const headers = {};
769
481
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/playbackConfiguration/{Name}";
770
- if (input.Name !== undefined) {
771
- const labelValue = input.Name;
772
- if (labelValue.length <= 0) {
773
- throw new Error("Empty value provided for input HTTP label: Name.");
774
- }
775
- resolvedPath = resolvedPath.replace("{Name}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
776
- }
777
- else {
778
- throw new Error("No value provided for input HTTP label: Name.");
779
- }
482
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "Name", () => input.Name, "{Name}", false);
780
483
  let body;
781
484
  return new protocol_http_1.HttpRequest({
782
485
  protocol,
@@ -794,26 +497,8 @@ const serializeAws_restJson1GetPrefetchScheduleCommand = async (input, context)
794
497
  const headers = {};
795
498
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
796
499
  "/prefetchSchedule/{PlaybackConfigurationName}/{Name}";
797
- if (input.Name !== undefined) {
798
- const labelValue = input.Name;
799
- if (labelValue.length <= 0) {
800
- throw new Error("Empty value provided for input HTTP label: Name.");
801
- }
802
- resolvedPath = resolvedPath.replace("{Name}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
803
- }
804
- else {
805
- throw new Error("No value provided for input HTTP label: Name.");
806
- }
807
- if (input.PlaybackConfigurationName !== undefined) {
808
- const labelValue = input.PlaybackConfigurationName;
809
- if (labelValue.length <= 0) {
810
- throw new Error("Empty value provided for input HTTP label: PlaybackConfigurationName.");
811
- }
812
- resolvedPath = resolvedPath.replace("{PlaybackConfigurationName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
813
- }
814
- else {
815
- throw new Error("No value provided for input HTTP label: PlaybackConfigurationName.");
816
- }
500
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "Name", () => input.Name, "{Name}", false);
501
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "PlaybackConfigurationName", () => input.PlaybackConfigurationName, "{PlaybackConfigurationName}", false);
817
502
  let body;
818
503
  return new protocol_http_1.HttpRequest({
819
504
  protocol,
@@ -830,11 +515,11 @@ const serializeAws_restJson1ListAlertsCommand = async (input, context) => {
830
515
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
831
516
  const headers = {};
832
517
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/alerts";
833
- const query = {
834
- ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }),
835
- ...(input.NextToken !== undefined && { nextToken: input.NextToken }),
836
- ...(input.ResourceArn !== undefined && { resourceArn: input.ResourceArn }),
837
- };
518
+ const query = map({
519
+ maxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
520
+ nextToken: [, input.NextToken],
521
+ resourceArn: [, input.ResourceArn],
522
+ });
838
523
  let body;
839
524
  return new protocol_http_1.HttpRequest({
840
525
  protocol,
@@ -852,10 +537,10 @@ const serializeAws_restJson1ListChannelsCommand = async (input, context) => {
852
537
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
853
538
  const headers = {};
854
539
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/channels";
855
- const query = {
856
- ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }),
857
- ...(input.NextToken !== undefined && { nextToken: input.NextToken }),
858
- };
540
+ const query = map({
541
+ maxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
542
+ nextToken: [, input.NextToken],
543
+ });
859
544
  let body;
860
545
  return new protocol_http_1.HttpRequest({
861
546
  protocol,
@@ -874,20 +559,11 @@ const serializeAws_restJson1ListLiveSourcesCommand = async (input, context) => {
874
559
  const headers = {};
875
560
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
876
561
  "/sourceLocation/{SourceLocationName}/liveSources";
877
- if (input.SourceLocationName !== undefined) {
878
- const labelValue = input.SourceLocationName;
879
- if (labelValue.length <= 0) {
880
- throw new Error("Empty value provided for input HTTP label: SourceLocationName.");
881
- }
882
- resolvedPath = resolvedPath.replace("{SourceLocationName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
883
- }
884
- else {
885
- throw new Error("No value provided for input HTTP label: SourceLocationName.");
886
- }
887
- const query = {
888
- ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }),
889
- ...(input.NextToken !== undefined && { nextToken: input.NextToken }),
890
- };
562
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "SourceLocationName", () => input.SourceLocationName, "{SourceLocationName}", false);
563
+ const query = map({
564
+ maxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
565
+ nextToken: [, input.NextToken],
566
+ });
891
567
  let body;
892
568
  return new protocol_http_1.HttpRequest({
893
569
  protocol,
@@ -905,10 +581,10 @@ const serializeAws_restJson1ListPlaybackConfigurationsCommand = async (input, co
905
581
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
906
582
  const headers = {};
907
583
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/playbackConfigurations";
908
- const query = {
909
- ...(input.MaxResults !== undefined && { MaxResults: input.MaxResults.toString() }),
910
- ...(input.NextToken !== undefined && { NextToken: input.NextToken }),
911
- };
584
+ const query = map({
585
+ MaxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
586
+ NextToken: [, input.NextToken],
587
+ });
912
588
  let body;
913
589
  return new protocol_http_1.HttpRequest({
914
590
  protocol,
@@ -929,16 +605,7 @@ const serializeAws_restJson1ListPrefetchSchedulesCommand = async (input, context
929
605
  };
930
606
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
931
607
  "/prefetchSchedule/{PlaybackConfigurationName}";
932
- if (input.PlaybackConfigurationName !== undefined) {
933
- const labelValue = input.PlaybackConfigurationName;
934
- if (labelValue.length <= 0) {
935
- throw new Error("Empty value provided for input HTTP label: PlaybackConfigurationName.");
936
- }
937
- resolvedPath = resolvedPath.replace("{PlaybackConfigurationName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
938
- }
939
- else {
940
- throw new Error("No value provided for input HTTP label: PlaybackConfigurationName.");
941
- }
608
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "PlaybackConfigurationName", () => input.PlaybackConfigurationName, "{PlaybackConfigurationName}", false);
942
609
  let body;
943
610
  body = JSON.stringify({
944
611
  ...(input.MaxResults != null && { MaxResults: input.MaxResults }),
@@ -960,10 +627,10 @@ const serializeAws_restJson1ListSourceLocationsCommand = async (input, context)
960
627
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
961
628
  const headers = {};
962
629
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/sourceLocations";
963
- const query = {
964
- ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }),
965
- ...(input.NextToken !== undefined && { nextToken: input.NextToken }),
966
- };
630
+ const query = map({
631
+ maxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
632
+ nextToken: [, input.NextToken],
633
+ });
967
634
  let body;
968
635
  return new protocol_http_1.HttpRequest({
969
636
  protocol,
@@ -981,16 +648,7 @@ const serializeAws_restJson1ListTagsForResourceCommand = async (input, context)
981
648
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
982
649
  const headers = {};
983
650
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}";
984
- if (input.ResourceArn !== undefined) {
985
- const labelValue = input.ResourceArn;
986
- if (labelValue.length <= 0) {
987
- throw new Error("Empty value provided for input HTTP label: ResourceArn.");
988
- }
989
- resolvedPath = resolvedPath.replace("{ResourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
990
- }
991
- else {
992
- throw new Error("No value provided for input HTTP label: ResourceArn.");
993
- }
651
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ResourceArn", () => input.ResourceArn, "{ResourceArn}", false);
994
652
  let body;
995
653
  return new protocol_http_1.HttpRequest({
996
654
  protocol,
@@ -1008,20 +666,11 @@ const serializeAws_restJson1ListVodSourcesCommand = async (input, context) => {
1008
666
  const headers = {};
1009
667
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
1010
668
  "/sourceLocation/{SourceLocationName}/vodSources";
1011
- if (input.SourceLocationName !== undefined) {
1012
- const labelValue = input.SourceLocationName;
1013
- if (labelValue.length <= 0) {
1014
- throw new Error("Empty value provided for input HTTP label: SourceLocationName.");
1015
- }
1016
- resolvedPath = resolvedPath.replace("{SourceLocationName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1017
- }
1018
- else {
1019
- throw new Error("No value provided for input HTTP label: SourceLocationName.");
1020
- }
1021
- const query = {
1022
- ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }),
1023
- ...(input.NextToken !== undefined && { nextToken: input.NextToken }),
1024
- };
669
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "SourceLocationName", () => input.SourceLocationName, "{SourceLocationName}", false);
670
+ const query = map({
671
+ maxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
672
+ nextToken: [, input.NextToken],
673
+ });
1025
674
  let body;
1026
675
  return new protocol_http_1.HttpRequest({
1027
676
  protocol,
@@ -1041,16 +690,7 @@ const serializeAws_restJson1PutChannelPolicyCommand = async (input, context) =>
1041
690
  "content-type": "application/json",
1042
691
  };
1043
692
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/channel/{ChannelName}/policy";
1044
- if (input.ChannelName !== undefined) {
1045
- const labelValue = input.ChannelName;
1046
- if (labelValue.length <= 0) {
1047
- throw new Error("Empty value provided for input HTTP label: ChannelName.");
1048
- }
1049
- resolvedPath = resolvedPath.replace("{ChannelName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1050
- }
1051
- else {
1052
- throw new Error("No value provided for input HTTP label: ChannelName.");
1053
- }
693
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ChannelName", () => input.ChannelName, "{ChannelName}", false);
1054
694
  let body;
1055
695
  body = JSON.stringify({
1056
696
  ...(input.Policy != null && { Policy: input.Policy }),
@@ -1118,16 +758,7 @@ const serializeAws_restJson1StartChannelCommand = async (input, context) => {
1118
758
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1119
759
  const headers = {};
1120
760
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/channel/{ChannelName}/start";
1121
- if (input.ChannelName !== undefined) {
1122
- const labelValue = input.ChannelName;
1123
- if (labelValue.length <= 0) {
1124
- throw new Error("Empty value provided for input HTTP label: ChannelName.");
1125
- }
1126
- resolvedPath = resolvedPath.replace("{ChannelName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1127
- }
1128
- else {
1129
- throw new Error("No value provided for input HTTP label: ChannelName.");
1130
- }
761
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ChannelName", () => input.ChannelName, "{ChannelName}", false);
1131
762
  let body;
1132
763
  return new protocol_http_1.HttpRequest({
1133
764
  protocol,
@@ -1144,16 +775,7 @@ const serializeAws_restJson1StopChannelCommand = async (input, context) => {
1144
775
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1145
776
  const headers = {};
1146
777
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/channel/{ChannelName}/stop";
1147
- if (input.ChannelName !== undefined) {
1148
- const labelValue = input.ChannelName;
1149
- if (labelValue.length <= 0) {
1150
- throw new Error("Empty value provided for input HTTP label: ChannelName.");
1151
- }
1152
- resolvedPath = resolvedPath.replace("{ChannelName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1153
- }
1154
- else {
1155
- throw new Error("No value provided for input HTTP label: ChannelName.");
1156
- }
778
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ChannelName", () => input.ChannelName, "{ChannelName}", false);
1157
779
  let body;
1158
780
  return new protocol_http_1.HttpRequest({
1159
781
  protocol,
@@ -1172,16 +794,7 @@ const serializeAws_restJson1TagResourceCommand = async (input, context) => {
1172
794
  "content-type": "application/json",
1173
795
  };
1174
796
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}";
1175
- if (input.ResourceArn !== undefined) {
1176
- const labelValue = input.ResourceArn;
1177
- if (labelValue.length <= 0) {
1178
- throw new Error("Empty value provided for input HTTP label: ResourceArn.");
1179
- }
1180
- resolvedPath = resolvedPath.replace("{ResourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1181
- }
1182
- else {
1183
- throw new Error("No value provided for input HTTP label: ResourceArn.");
1184
- }
797
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ResourceArn", () => input.ResourceArn, "{ResourceArn}", false);
1185
798
  let body;
1186
799
  body = JSON.stringify({
1187
800
  ...(input.Tags != null && { tags: serializeAws_restJson1__mapOf__string(input.Tags, context) }),
@@ -1201,19 +814,10 @@ const serializeAws_restJson1UntagResourceCommand = async (input, context) => {
1201
814
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1202
815
  const headers = {};
1203
816
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}";
1204
- if (input.ResourceArn !== undefined) {
1205
- const labelValue = input.ResourceArn;
1206
- if (labelValue.length <= 0) {
1207
- throw new Error("Empty value provided for input HTTP label: ResourceArn.");
1208
- }
1209
- resolvedPath = resolvedPath.replace("{ResourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1210
- }
1211
- else {
1212
- throw new Error("No value provided for input HTTP label: ResourceArn.");
1213
- }
1214
- const query = {
1215
- ...(input.TagKeys !== undefined && { tagKeys: (input.TagKeys || []).map((_entry) => _entry) }),
1216
- };
817
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ResourceArn", () => input.ResourceArn, "{ResourceArn}", false);
818
+ const query = map({
819
+ tagKeys: [() => input.TagKeys !== void 0, () => (input.TagKeys || []).map((_entry) => _entry)],
820
+ });
1217
821
  let body;
1218
822
  return new protocol_http_1.HttpRequest({
1219
823
  protocol,
@@ -1233,16 +837,7 @@ const serializeAws_restJson1UpdateChannelCommand = async (input, context) => {
1233
837
  "content-type": "application/json",
1234
838
  };
1235
839
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/channel/{ChannelName}";
1236
- if (input.ChannelName !== undefined) {
1237
- const labelValue = input.ChannelName;
1238
- if (labelValue.length <= 0) {
1239
- throw new Error("Empty value provided for input HTTP label: ChannelName.");
1240
- }
1241
- resolvedPath = resolvedPath.replace("{ChannelName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1242
- }
1243
- else {
1244
- throw new Error("No value provided for input HTTP label: ChannelName.");
1245
- }
840
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ChannelName", () => input.ChannelName, "{ChannelName}", false);
1246
841
  let body;
1247
842
  body = JSON.stringify({
1248
843
  ...(input.FillerSlate != null && { FillerSlate: serializeAws_restJson1SlateSource(input.FillerSlate, context) }),
@@ -1266,26 +861,8 @@ const serializeAws_restJson1UpdateLiveSourceCommand = async (input, context) =>
1266
861
  };
1267
862
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
1268
863
  "/sourceLocation/{SourceLocationName}/liveSource/{LiveSourceName}";
1269
- if (input.LiveSourceName !== undefined) {
1270
- const labelValue = input.LiveSourceName;
1271
- if (labelValue.length <= 0) {
1272
- throw new Error("Empty value provided for input HTTP label: LiveSourceName.");
1273
- }
1274
- resolvedPath = resolvedPath.replace("{LiveSourceName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1275
- }
1276
- else {
1277
- throw new Error("No value provided for input HTTP label: LiveSourceName.");
1278
- }
1279
- if (input.SourceLocationName !== undefined) {
1280
- const labelValue = input.SourceLocationName;
1281
- if (labelValue.length <= 0) {
1282
- throw new Error("Empty value provided for input HTTP label: SourceLocationName.");
1283
- }
1284
- resolvedPath = resolvedPath.replace("{SourceLocationName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1285
- }
1286
- else {
1287
- throw new Error("No value provided for input HTTP label: SourceLocationName.");
1288
- }
864
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "LiveSourceName", () => input.LiveSourceName, "{LiveSourceName}", false);
865
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "SourceLocationName", () => input.SourceLocationName, "{SourceLocationName}", false);
1289
866
  let body;
1290
867
  body = JSON.stringify({
1291
868
  ...(input.HttpPackageConfigurations != null && {
@@ -1309,16 +886,7 @@ const serializeAws_restJson1UpdateSourceLocationCommand = async (input, context)
1309
886
  "content-type": "application/json",
1310
887
  };
1311
888
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/sourceLocation/{SourceLocationName}";
1312
- if (input.SourceLocationName !== undefined) {
1313
- const labelValue = input.SourceLocationName;
1314
- if (labelValue.length <= 0) {
1315
- throw new Error("Empty value provided for input HTTP label: SourceLocationName.");
1316
- }
1317
- resolvedPath = resolvedPath.replace("{SourceLocationName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1318
- }
1319
- else {
1320
- throw new Error("No value provided for input HTTP label: SourceLocationName.");
1321
- }
889
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "SourceLocationName", () => input.SourceLocationName, "{SourceLocationName}", false);
1322
890
  let body;
1323
891
  body = JSON.stringify({
1324
892
  ...(input.AccessConfiguration != null && {
@@ -1352,26 +920,8 @@ const serializeAws_restJson1UpdateVodSourceCommand = async (input, context) => {
1352
920
  };
1353
921
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
1354
922
  "/sourceLocation/{SourceLocationName}/vodSource/{VodSourceName}";
1355
- if (input.SourceLocationName !== undefined) {
1356
- const labelValue = input.SourceLocationName;
1357
- if (labelValue.length <= 0) {
1358
- throw new Error("Empty value provided for input HTTP label: SourceLocationName.");
1359
- }
1360
- resolvedPath = resolvedPath.replace("{SourceLocationName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1361
- }
1362
- else {
1363
- throw new Error("No value provided for input HTTP label: SourceLocationName.");
1364
- }
1365
- if (input.VodSourceName !== undefined) {
1366
- const labelValue = input.VodSourceName;
1367
- if (labelValue.length <= 0) {
1368
- throw new Error("Empty value provided for input HTTP label: VodSourceName.");
1369
- }
1370
- resolvedPath = resolvedPath.replace("{VodSourceName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1371
- }
1372
- else {
1373
- throw new Error("No value provided for input HTTP label: VodSourceName.");
1374
- }
923
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "SourceLocationName", () => input.SourceLocationName, "{SourceLocationName}", false);
924
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "VodSourceName", () => input.VodSourceName, "{VodSourceName}", false);
1375
925
  let body;
1376
926
  body = JSON.stringify({
1377
927
  ...(input.HttpPackageConfigurations != null && {
@@ -1393,19 +943,17 @@ const deserializeAws_restJson1ConfigureLogsForPlaybackConfigurationCommand = asy
1393
943
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1394
944
  return deserializeAws_restJson1ConfigureLogsForPlaybackConfigurationCommandError(output, context);
1395
945
  }
1396
- const contents = {
946
+ const contents = map({
1397
947
  $metadata: deserializeMetadata(output),
1398
- PercentEnabled: undefined,
1399
- PlaybackConfigurationName: undefined,
1400
- };
948
+ });
1401
949
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1402
- if (data.PercentEnabled !== undefined && data.PercentEnabled !== null) {
950
+ if (data.PercentEnabled != null) {
1403
951
  contents.PercentEnabled = (0, smithy_client_1.expectInt32)(data.PercentEnabled);
1404
952
  }
1405
- if (data.PlaybackConfigurationName !== undefined && data.PlaybackConfigurationName !== null) {
953
+ if (data.PlaybackConfigurationName != null) {
1406
954
  contents.PlaybackConfigurationName = (0, smithy_client_1.expectString)(data.PlaybackConfigurationName);
1407
955
  }
1408
- return Promise.resolve(contents);
956
+ return contents;
1409
957
  };
1410
958
  exports.deserializeAws_restJson1ConfigureLogsForPlaybackConfigurationCommand = deserializeAws_restJson1ConfigureLogsForPlaybackConfigurationCommand;
1411
959
  const deserializeAws_restJson1ConfigureLogsForPlaybackConfigurationCommandError = async (output, context) => {
@@ -1413,70 +961,54 @@ const deserializeAws_restJson1ConfigureLogsForPlaybackConfigurationCommandError
1413
961
  ...output,
1414
962
  body: await parseBody(output.body, context),
1415
963
  };
1416
- let response;
1417
964
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1418
- switch (errorCode) {
1419
- default:
1420
- const parsedBody = parsedOutput.body;
1421
- const $metadata = deserializeMetadata(output);
1422
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1423
- response = new MediaTailorServiceException_1.MediaTailorServiceException({
1424
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1425
- $fault: "client",
1426
- $metadata,
1427
- });
1428
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1429
- }
965
+ const parsedBody = parsedOutput.body;
966
+ (0, smithy_client_1.throwDefaultError)({
967
+ output,
968
+ parsedBody,
969
+ exceptionCtor: MediaTailorServiceException_1.MediaTailorServiceException,
970
+ errorCode,
971
+ });
1430
972
  };
1431
973
  const deserializeAws_restJson1CreateChannelCommand = async (output, context) => {
1432
974
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1433
975
  return deserializeAws_restJson1CreateChannelCommandError(output, context);
1434
976
  }
1435
- const contents = {
977
+ const contents = map({
1436
978
  $metadata: deserializeMetadata(output),
1437
- Arn: undefined,
1438
- ChannelName: undefined,
1439
- ChannelState: undefined,
1440
- CreationTime: undefined,
1441
- FillerSlate: undefined,
1442
- LastModifiedTime: undefined,
1443
- Outputs: undefined,
1444
- PlaybackMode: undefined,
1445
- Tags: undefined,
1446
- Tier: undefined,
1447
- };
979
+ });
1448
980
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1449
- if (data.Arn !== undefined && data.Arn !== null) {
981
+ if (data.Arn != null) {
1450
982
  contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
1451
983
  }
1452
- if (data.ChannelName !== undefined && data.ChannelName !== null) {
984
+ if (data.ChannelName != null) {
1453
985
  contents.ChannelName = (0, smithy_client_1.expectString)(data.ChannelName);
1454
986
  }
1455
- if (data.ChannelState !== undefined && data.ChannelState !== null) {
987
+ if (data.ChannelState != null) {
1456
988
  contents.ChannelState = (0, smithy_client_1.expectString)(data.ChannelState);
1457
989
  }
1458
- if (data.CreationTime !== undefined && data.CreationTime !== null) {
990
+ if (data.CreationTime != null) {
1459
991
  contents.CreationTime = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(data.CreationTime)));
1460
992
  }
1461
- if (data.FillerSlate !== undefined && data.FillerSlate !== null) {
993
+ if (data.FillerSlate != null) {
1462
994
  contents.FillerSlate = deserializeAws_restJson1SlateSource(data.FillerSlate, context);
1463
995
  }
1464
- if (data.LastModifiedTime !== undefined && data.LastModifiedTime !== null) {
996
+ if (data.LastModifiedTime != null) {
1465
997
  contents.LastModifiedTime = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(data.LastModifiedTime)));
1466
998
  }
1467
- if (data.Outputs !== undefined && data.Outputs !== null) {
999
+ if (data.Outputs != null) {
1468
1000
  contents.Outputs = deserializeAws_restJson1ResponseOutputs(data.Outputs, context);
1469
1001
  }
1470
- if (data.PlaybackMode !== undefined && data.PlaybackMode !== null) {
1002
+ if (data.PlaybackMode != null) {
1471
1003
  contents.PlaybackMode = (0, smithy_client_1.expectString)(data.PlaybackMode);
1472
1004
  }
1473
- if (data.tags !== undefined && data.tags !== null) {
1005
+ if (data.tags != null) {
1474
1006
  contents.Tags = deserializeAws_restJson1__mapOf__string(data.tags, context);
1475
1007
  }
1476
- if (data.Tier !== undefined && data.Tier !== null) {
1008
+ if (data.Tier != null) {
1477
1009
  contents.Tier = (0, smithy_client_1.expectString)(data.Tier);
1478
1010
  }
1479
- return Promise.resolve(contents);
1011
+ return contents;
1480
1012
  };
1481
1013
  exports.deserializeAws_restJson1CreateChannelCommand = deserializeAws_restJson1CreateChannelCommand;
1482
1014
  const deserializeAws_restJson1CreateChannelCommandError = async (output, context) => {
@@ -1484,58 +1016,45 @@ const deserializeAws_restJson1CreateChannelCommandError = async (output, context
1484
1016
  ...output,
1485
1017
  body: await parseBody(output.body, context),
1486
1018
  };
1487
- let response;
1488
1019
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1489
- switch (errorCode) {
1490
- default:
1491
- const parsedBody = parsedOutput.body;
1492
- const $metadata = deserializeMetadata(output);
1493
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1494
- response = new MediaTailorServiceException_1.MediaTailorServiceException({
1495
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1496
- $fault: "client",
1497
- $metadata,
1498
- });
1499
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1500
- }
1020
+ const parsedBody = parsedOutput.body;
1021
+ (0, smithy_client_1.throwDefaultError)({
1022
+ output,
1023
+ parsedBody,
1024
+ exceptionCtor: MediaTailorServiceException_1.MediaTailorServiceException,
1025
+ errorCode,
1026
+ });
1501
1027
  };
1502
1028
  const deserializeAws_restJson1CreateLiveSourceCommand = async (output, context) => {
1503
1029
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1504
1030
  return deserializeAws_restJson1CreateLiveSourceCommandError(output, context);
1505
1031
  }
1506
- const contents = {
1032
+ const contents = map({
1507
1033
  $metadata: deserializeMetadata(output),
1508
- Arn: undefined,
1509
- CreationTime: undefined,
1510
- HttpPackageConfigurations: undefined,
1511
- LastModifiedTime: undefined,
1512
- LiveSourceName: undefined,
1513
- SourceLocationName: undefined,
1514
- Tags: undefined,
1515
- };
1034
+ });
1516
1035
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1517
- if (data.Arn !== undefined && data.Arn !== null) {
1036
+ if (data.Arn != null) {
1518
1037
  contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
1519
1038
  }
1520
- if (data.CreationTime !== undefined && data.CreationTime !== null) {
1039
+ if (data.CreationTime != null) {
1521
1040
  contents.CreationTime = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(data.CreationTime)));
1522
1041
  }
1523
- if (data.HttpPackageConfigurations !== undefined && data.HttpPackageConfigurations !== null) {
1042
+ if (data.HttpPackageConfigurations != null) {
1524
1043
  contents.HttpPackageConfigurations = deserializeAws_restJson1HttpPackageConfigurations(data.HttpPackageConfigurations, context);
1525
1044
  }
1526
- if (data.LastModifiedTime !== undefined && data.LastModifiedTime !== null) {
1045
+ if (data.LastModifiedTime != null) {
1527
1046
  contents.LastModifiedTime = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(data.LastModifiedTime)));
1528
1047
  }
1529
- if (data.LiveSourceName !== undefined && data.LiveSourceName !== null) {
1048
+ if (data.LiveSourceName != null) {
1530
1049
  contents.LiveSourceName = (0, smithy_client_1.expectString)(data.LiveSourceName);
1531
1050
  }
1532
- if (data.SourceLocationName !== undefined && data.SourceLocationName !== null) {
1051
+ if (data.SourceLocationName != null) {
1533
1052
  contents.SourceLocationName = (0, smithy_client_1.expectString)(data.SourceLocationName);
1534
1053
  }
1535
- if (data.tags !== undefined && data.tags !== null) {
1054
+ if (data.tags != null) {
1536
1055
  contents.Tags = deserializeAws_restJson1__mapOf__string(data.tags, context);
1537
1056
  }
1538
- return Promise.resolve(contents);
1057
+ return contents;
1539
1058
  };
1540
1059
  exports.deserializeAws_restJson1CreateLiveSourceCommand = deserializeAws_restJson1CreateLiveSourceCommand;
1541
1060
  const deserializeAws_restJson1CreateLiveSourceCommandError = async (output, context) => {
@@ -1543,54 +1062,42 @@ const deserializeAws_restJson1CreateLiveSourceCommandError = async (output, cont
1543
1062
  ...output,
1544
1063
  body: await parseBody(output.body, context),
1545
1064
  };
1546
- let response;
1547
1065
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1548
- switch (errorCode) {
1549
- default:
1550
- const parsedBody = parsedOutput.body;
1551
- const $metadata = deserializeMetadata(output);
1552
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1553
- response = new MediaTailorServiceException_1.MediaTailorServiceException({
1554
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1555
- $fault: "client",
1556
- $metadata,
1557
- });
1558
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1559
- }
1066
+ const parsedBody = parsedOutput.body;
1067
+ (0, smithy_client_1.throwDefaultError)({
1068
+ output,
1069
+ parsedBody,
1070
+ exceptionCtor: MediaTailorServiceException_1.MediaTailorServiceException,
1071
+ errorCode,
1072
+ });
1560
1073
  };
1561
1074
  const deserializeAws_restJson1CreatePrefetchScheduleCommand = async (output, context) => {
1562
1075
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1563
1076
  return deserializeAws_restJson1CreatePrefetchScheduleCommandError(output, context);
1564
1077
  }
1565
- const contents = {
1078
+ const contents = map({
1566
1079
  $metadata: deserializeMetadata(output),
1567
- Arn: undefined,
1568
- Consumption: undefined,
1569
- Name: undefined,
1570
- PlaybackConfigurationName: undefined,
1571
- Retrieval: undefined,
1572
- StreamId: undefined,
1573
- };
1080
+ });
1574
1081
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1575
- if (data.Arn !== undefined && data.Arn !== null) {
1082
+ if (data.Arn != null) {
1576
1083
  contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
1577
1084
  }
1578
- if (data.Consumption !== undefined && data.Consumption !== null) {
1085
+ if (data.Consumption != null) {
1579
1086
  contents.Consumption = deserializeAws_restJson1PrefetchConsumption(data.Consumption, context);
1580
1087
  }
1581
- if (data.Name !== undefined && data.Name !== null) {
1088
+ if (data.Name != null) {
1582
1089
  contents.Name = (0, smithy_client_1.expectString)(data.Name);
1583
1090
  }
1584
- if (data.PlaybackConfigurationName !== undefined && data.PlaybackConfigurationName !== null) {
1091
+ if (data.PlaybackConfigurationName != null) {
1585
1092
  contents.PlaybackConfigurationName = (0, smithy_client_1.expectString)(data.PlaybackConfigurationName);
1586
1093
  }
1587
- if (data.Retrieval !== undefined && data.Retrieval !== null) {
1094
+ if (data.Retrieval != null) {
1588
1095
  contents.Retrieval = deserializeAws_restJson1PrefetchRetrieval(data.Retrieval, context);
1589
1096
  }
1590
- if (data.StreamId !== undefined && data.StreamId !== null) {
1097
+ if (data.StreamId != null) {
1591
1098
  contents.StreamId = (0, smithy_client_1.expectString)(data.StreamId);
1592
1099
  }
1593
- return Promise.resolve(contents);
1100
+ return contents;
1594
1101
  };
1595
1102
  exports.deserializeAws_restJson1CreatePrefetchScheduleCommand = deserializeAws_restJson1CreatePrefetchScheduleCommand;
1596
1103
  const deserializeAws_restJson1CreatePrefetchScheduleCommandError = async (output, context) => {
@@ -1598,66 +1105,51 @@ const deserializeAws_restJson1CreatePrefetchScheduleCommandError = async (output
1598
1105
  ...output,
1599
1106
  body: await parseBody(output.body, context),
1600
1107
  };
1601
- let response;
1602
1108
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1603
- switch (errorCode) {
1604
- default:
1605
- const parsedBody = parsedOutput.body;
1606
- const $metadata = deserializeMetadata(output);
1607
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1608
- response = new MediaTailorServiceException_1.MediaTailorServiceException({
1609
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1610
- $fault: "client",
1611
- $metadata,
1612
- });
1613
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1614
- }
1109
+ const parsedBody = parsedOutput.body;
1110
+ (0, smithy_client_1.throwDefaultError)({
1111
+ output,
1112
+ parsedBody,
1113
+ exceptionCtor: MediaTailorServiceException_1.MediaTailorServiceException,
1114
+ errorCode,
1115
+ });
1615
1116
  };
1616
1117
  const deserializeAws_restJson1CreateProgramCommand = async (output, context) => {
1617
1118
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1618
1119
  return deserializeAws_restJson1CreateProgramCommandError(output, context);
1619
1120
  }
1620
- const contents = {
1121
+ const contents = map({
1621
1122
  $metadata: deserializeMetadata(output),
1622
- AdBreaks: undefined,
1623
- Arn: undefined,
1624
- ChannelName: undefined,
1625
- CreationTime: undefined,
1626
- LiveSourceName: undefined,
1627
- ProgramName: undefined,
1628
- ScheduledStartTime: undefined,
1629
- SourceLocationName: undefined,
1630
- VodSourceName: undefined,
1631
- };
1123
+ });
1632
1124
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1633
- if (data.AdBreaks !== undefined && data.AdBreaks !== null) {
1125
+ if (data.AdBreaks != null) {
1634
1126
  contents.AdBreaks = deserializeAws_restJson1__listOfAdBreak(data.AdBreaks, context);
1635
1127
  }
1636
- if (data.Arn !== undefined && data.Arn !== null) {
1128
+ if (data.Arn != null) {
1637
1129
  contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
1638
1130
  }
1639
- if (data.ChannelName !== undefined && data.ChannelName !== null) {
1131
+ if (data.ChannelName != null) {
1640
1132
  contents.ChannelName = (0, smithy_client_1.expectString)(data.ChannelName);
1641
1133
  }
1642
- if (data.CreationTime !== undefined && data.CreationTime !== null) {
1134
+ if (data.CreationTime != null) {
1643
1135
  contents.CreationTime = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(data.CreationTime)));
1644
1136
  }
1645
- if (data.LiveSourceName !== undefined && data.LiveSourceName !== null) {
1137
+ if (data.LiveSourceName != null) {
1646
1138
  contents.LiveSourceName = (0, smithy_client_1.expectString)(data.LiveSourceName);
1647
1139
  }
1648
- if (data.ProgramName !== undefined && data.ProgramName !== null) {
1140
+ if (data.ProgramName != null) {
1649
1141
  contents.ProgramName = (0, smithy_client_1.expectString)(data.ProgramName);
1650
1142
  }
1651
- if (data.ScheduledStartTime !== undefined && data.ScheduledStartTime !== null) {
1143
+ if (data.ScheduledStartTime != null) {
1652
1144
  contents.ScheduledStartTime = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(data.ScheduledStartTime)));
1653
1145
  }
1654
- if (data.SourceLocationName !== undefined && data.SourceLocationName !== null) {
1146
+ if (data.SourceLocationName != null) {
1655
1147
  contents.SourceLocationName = (0, smithy_client_1.expectString)(data.SourceLocationName);
1656
1148
  }
1657
- if (data.VodSourceName !== undefined && data.VodSourceName !== null) {
1149
+ if (data.VodSourceName != null) {
1658
1150
  contents.VodSourceName = (0, smithy_client_1.expectString)(data.VodSourceName);
1659
1151
  }
1660
- return Promise.resolve(contents);
1152
+ return contents;
1661
1153
  };
1662
1154
  exports.deserializeAws_restJson1CreateProgramCommand = deserializeAws_restJson1CreateProgramCommand;
1663
1155
  const deserializeAws_restJson1CreateProgramCommandError = async (output, context) => {
@@ -1665,66 +1157,51 @@ const deserializeAws_restJson1CreateProgramCommandError = async (output, context
1665
1157
  ...output,
1666
1158
  body: await parseBody(output.body, context),
1667
1159
  };
1668
- let response;
1669
1160
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1670
- switch (errorCode) {
1671
- default:
1672
- const parsedBody = parsedOutput.body;
1673
- const $metadata = deserializeMetadata(output);
1674
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1675
- response = new MediaTailorServiceException_1.MediaTailorServiceException({
1676
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1677
- $fault: "client",
1678
- $metadata,
1679
- });
1680
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1681
- }
1161
+ const parsedBody = parsedOutput.body;
1162
+ (0, smithy_client_1.throwDefaultError)({
1163
+ output,
1164
+ parsedBody,
1165
+ exceptionCtor: MediaTailorServiceException_1.MediaTailorServiceException,
1166
+ errorCode,
1167
+ });
1682
1168
  };
1683
1169
  const deserializeAws_restJson1CreateSourceLocationCommand = async (output, context) => {
1684
1170
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1685
1171
  return deserializeAws_restJson1CreateSourceLocationCommandError(output, context);
1686
1172
  }
1687
- const contents = {
1173
+ const contents = map({
1688
1174
  $metadata: deserializeMetadata(output),
1689
- AccessConfiguration: undefined,
1690
- Arn: undefined,
1691
- CreationTime: undefined,
1692
- DefaultSegmentDeliveryConfiguration: undefined,
1693
- HttpConfiguration: undefined,
1694
- LastModifiedTime: undefined,
1695
- SegmentDeliveryConfigurations: undefined,
1696
- SourceLocationName: undefined,
1697
- Tags: undefined,
1698
- };
1175
+ });
1699
1176
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1700
- if (data.AccessConfiguration !== undefined && data.AccessConfiguration !== null) {
1177
+ if (data.AccessConfiguration != null) {
1701
1178
  contents.AccessConfiguration = deserializeAws_restJson1AccessConfiguration(data.AccessConfiguration, context);
1702
1179
  }
1703
- if (data.Arn !== undefined && data.Arn !== null) {
1180
+ if (data.Arn != null) {
1704
1181
  contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
1705
1182
  }
1706
- if (data.CreationTime !== undefined && data.CreationTime !== null) {
1183
+ if (data.CreationTime != null) {
1707
1184
  contents.CreationTime = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(data.CreationTime)));
1708
1185
  }
1709
- if (data.DefaultSegmentDeliveryConfiguration !== undefined && data.DefaultSegmentDeliveryConfiguration !== null) {
1186
+ if (data.DefaultSegmentDeliveryConfiguration != null) {
1710
1187
  contents.DefaultSegmentDeliveryConfiguration = deserializeAws_restJson1DefaultSegmentDeliveryConfiguration(data.DefaultSegmentDeliveryConfiguration, context);
1711
1188
  }
1712
- if (data.HttpConfiguration !== undefined && data.HttpConfiguration !== null) {
1189
+ if (data.HttpConfiguration != null) {
1713
1190
  contents.HttpConfiguration = deserializeAws_restJson1HttpConfiguration(data.HttpConfiguration, context);
1714
1191
  }
1715
- if (data.LastModifiedTime !== undefined && data.LastModifiedTime !== null) {
1192
+ if (data.LastModifiedTime != null) {
1716
1193
  contents.LastModifiedTime = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(data.LastModifiedTime)));
1717
1194
  }
1718
- if (data.SegmentDeliveryConfigurations !== undefined && data.SegmentDeliveryConfigurations !== null) {
1195
+ if (data.SegmentDeliveryConfigurations != null) {
1719
1196
  contents.SegmentDeliveryConfigurations = deserializeAws_restJson1__listOfSegmentDeliveryConfiguration(data.SegmentDeliveryConfigurations, context);
1720
1197
  }
1721
- if (data.SourceLocationName !== undefined && data.SourceLocationName !== null) {
1198
+ if (data.SourceLocationName != null) {
1722
1199
  contents.SourceLocationName = (0, smithy_client_1.expectString)(data.SourceLocationName);
1723
1200
  }
1724
- if (data.tags !== undefined && data.tags !== null) {
1201
+ if (data.tags != null) {
1725
1202
  contents.Tags = deserializeAws_restJson1__mapOf__string(data.tags, context);
1726
1203
  }
1727
- return Promise.resolve(contents);
1204
+ return contents;
1728
1205
  };
1729
1206
  exports.deserializeAws_restJson1CreateSourceLocationCommand = deserializeAws_restJson1CreateSourceLocationCommand;
1730
1207
  const deserializeAws_restJson1CreateSourceLocationCommandError = async (output, context) => {
@@ -1732,58 +1209,45 @@ const deserializeAws_restJson1CreateSourceLocationCommandError = async (output,
1732
1209
  ...output,
1733
1210
  body: await parseBody(output.body, context),
1734
1211
  };
1735
- let response;
1736
1212
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1737
- switch (errorCode) {
1738
- default:
1739
- const parsedBody = parsedOutput.body;
1740
- const $metadata = deserializeMetadata(output);
1741
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1742
- response = new MediaTailorServiceException_1.MediaTailorServiceException({
1743
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1744
- $fault: "client",
1745
- $metadata,
1746
- });
1747
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1748
- }
1213
+ const parsedBody = parsedOutput.body;
1214
+ (0, smithy_client_1.throwDefaultError)({
1215
+ output,
1216
+ parsedBody,
1217
+ exceptionCtor: MediaTailorServiceException_1.MediaTailorServiceException,
1218
+ errorCode,
1219
+ });
1749
1220
  };
1750
1221
  const deserializeAws_restJson1CreateVodSourceCommand = async (output, context) => {
1751
1222
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1752
1223
  return deserializeAws_restJson1CreateVodSourceCommandError(output, context);
1753
1224
  }
1754
- const contents = {
1225
+ const contents = map({
1755
1226
  $metadata: deserializeMetadata(output),
1756
- Arn: undefined,
1757
- CreationTime: undefined,
1758
- HttpPackageConfigurations: undefined,
1759
- LastModifiedTime: undefined,
1760
- SourceLocationName: undefined,
1761
- Tags: undefined,
1762
- VodSourceName: undefined,
1763
- };
1227
+ });
1764
1228
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1765
- if (data.Arn !== undefined && data.Arn !== null) {
1229
+ if (data.Arn != null) {
1766
1230
  contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
1767
1231
  }
1768
- if (data.CreationTime !== undefined && data.CreationTime !== null) {
1232
+ if (data.CreationTime != null) {
1769
1233
  contents.CreationTime = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(data.CreationTime)));
1770
1234
  }
1771
- if (data.HttpPackageConfigurations !== undefined && data.HttpPackageConfigurations !== null) {
1235
+ if (data.HttpPackageConfigurations != null) {
1772
1236
  contents.HttpPackageConfigurations = deserializeAws_restJson1HttpPackageConfigurations(data.HttpPackageConfigurations, context);
1773
1237
  }
1774
- if (data.LastModifiedTime !== undefined && data.LastModifiedTime !== null) {
1238
+ if (data.LastModifiedTime != null) {
1775
1239
  contents.LastModifiedTime = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(data.LastModifiedTime)));
1776
1240
  }
1777
- if (data.SourceLocationName !== undefined && data.SourceLocationName !== null) {
1241
+ if (data.SourceLocationName != null) {
1778
1242
  contents.SourceLocationName = (0, smithy_client_1.expectString)(data.SourceLocationName);
1779
1243
  }
1780
- if (data.tags !== undefined && data.tags !== null) {
1244
+ if (data.tags != null) {
1781
1245
  contents.Tags = deserializeAws_restJson1__mapOf__string(data.tags, context);
1782
1246
  }
1783
- if (data.VodSourceName !== undefined && data.VodSourceName !== null) {
1247
+ if (data.VodSourceName != null) {
1784
1248
  contents.VodSourceName = (0, smithy_client_1.expectString)(data.VodSourceName);
1785
1249
  }
1786
- return Promise.resolve(contents);
1250
+ return contents;
1787
1251
  };
1788
1252
  exports.deserializeAws_restJson1CreateVodSourceCommand = deserializeAws_restJson1CreateVodSourceCommand;
1789
1253
  const deserializeAws_restJson1CreateVodSourceCommandError = async (output, context) => {
@@ -1791,30 +1255,24 @@ const deserializeAws_restJson1CreateVodSourceCommandError = async (output, conte
1791
1255
  ...output,
1792
1256
  body: await parseBody(output.body, context),
1793
1257
  };
1794
- let response;
1795
1258
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1796
- switch (errorCode) {
1797
- default:
1798
- const parsedBody = parsedOutput.body;
1799
- const $metadata = deserializeMetadata(output);
1800
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1801
- response = new MediaTailorServiceException_1.MediaTailorServiceException({
1802
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1803
- $fault: "client",
1804
- $metadata,
1805
- });
1806
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1807
- }
1259
+ const parsedBody = parsedOutput.body;
1260
+ (0, smithy_client_1.throwDefaultError)({
1261
+ output,
1262
+ parsedBody,
1263
+ exceptionCtor: MediaTailorServiceException_1.MediaTailorServiceException,
1264
+ errorCode,
1265
+ });
1808
1266
  };
1809
1267
  const deserializeAws_restJson1DeleteChannelCommand = async (output, context) => {
1810
1268
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1811
1269
  return deserializeAws_restJson1DeleteChannelCommandError(output, context);
1812
1270
  }
1813
- const contents = {
1271
+ const contents = map({
1814
1272
  $metadata: deserializeMetadata(output),
1815
- };
1273
+ });
1816
1274
  await collectBody(output.body, context);
1817
- return Promise.resolve(contents);
1275
+ return contents;
1818
1276
  };
1819
1277
  exports.deserializeAws_restJson1DeleteChannelCommand = deserializeAws_restJson1DeleteChannelCommand;
1820
1278
  const deserializeAws_restJson1DeleteChannelCommandError = async (output, context) => {
@@ -1822,30 +1280,24 @@ const deserializeAws_restJson1DeleteChannelCommandError = async (output, context
1822
1280
  ...output,
1823
1281
  body: await parseBody(output.body, context),
1824
1282
  };
1825
- let response;
1826
1283
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1827
- switch (errorCode) {
1828
- default:
1829
- const parsedBody = parsedOutput.body;
1830
- const $metadata = deserializeMetadata(output);
1831
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1832
- response = new MediaTailorServiceException_1.MediaTailorServiceException({
1833
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1834
- $fault: "client",
1835
- $metadata,
1836
- });
1837
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1838
- }
1284
+ const parsedBody = parsedOutput.body;
1285
+ (0, smithy_client_1.throwDefaultError)({
1286
+ output,
1287
+ parsedBody,
1288
+ exceptionCtor: MediaTailorServiceException_1.MediaTailorServiceException,
1289
+ errorCode,
1290
+ });
1839
1291
  };
1840
1292
  const deserializeAws_restJson1DeleteChannelPolicyCommand = async (output, context) => {
1841
1293
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1842
1294
  return deserializeAws_restJson1DeleteChannelPolicyCommandError(output, context);
1843
1295
  }
1844
- const contents = {
1296
+ const contents = map({
1845
1297
  $metadata: deserializeMetadata(output),
1846
- };
1298
+ });
1847
1299
  await collectBody(output.body, context);
1848
- return Promise.resolve(contents);
1300
+ return contents;
1849
1301
  };
1850
1302
  exports.deserializeAws_restJson1DeleteChannelPolicyCommand = deserializeAws_restJson1DeleteChannelPolicyCommand;
1851
1303
  const deserializeAws_restJson1DeleteChannelPolicyCommandError = async (output, context) => {
@@ -1853,30 +1305,24 @@ const deserializeAws_restJson1DeleteChannelPolicyCommandError = async (output, c
1853
1305
  ...output,
1854
1306
  body: await parseBody(output.body, context),
1855
1307
  };
1856
- let response;
1857
1308
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1858
- switch (errorCode) {
1859
- default:
1860
- const parsedBody = parsedOutput.body;
1861
- const $metadata = deserializeMetadata(output);
1862
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1863
- response = new MediaTailorServiceException_1.MediaTailorServiceException({
1864
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1865
- $fault: "client",
1866
- $metadata,
1867
- });
1868
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1869
- }
1309
+ const parsedBody = parsedOutput.body;
1310
+ (0, smithy_client_1.throwDefaultError)({
1311
+ output,
1312
+ parsedBody,
1313
+ exceptionCtor: MediaTailorServiceException_1.MediaTailorServiceException,
1314
+ errorCode,
1315
+ });
1870
1316
  };
1871
1317
  const deserializeAws_restJson1DeleteLiveSourceCommand = async (output, context) => {
1872
1318
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1873
1319
  return deserializeAws_restJson1DeleteLiveSourceCommandError(output, context);
1874
1320
  }
1875
- const contents = {
1321
+ const contents = map({
1876
1322
  $metadata: deserializeMetadata(output),
1877
- };
1323
+ });
1878
1324
  await collectBody(output.body, context);
1879
- return Promise.resolve(contents);
1325
+ return contents;
1880
1326
  };
1881
1327
  exports.deserializeAws_restJson1DeleteLiveSourceCommand = deserializeAws_restJson1DeleteLiveSourceCommand;
1882
1328
  const deserializeAws_restJson1DeleteLiveSourceCommandError = async (output, context) => {
@@ -1884,30 +1330,24 @@ const deserializeAws_restJson1DeleteLiveSourceCommandError = async (output, cont
1884
1330
  ...output,
1885
1331
  body: await parseBody(output.body, context),
1886
1332
  };
1887
- let response;
1888
1333
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1889
- switch (errorCode) {
1890
- default:
1891
- const parsedBody = parsedOutput.body;
1892
- const $metadata = deserializeMetadata(output);
1893
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1894
- response = new MediaTailorServiceException_1.MediaTailorServiceException({
1895
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1896
- $fault: "client",
1897
- $metadata,
1898
- });
1899
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1900
- }
1334
+ const parsedBody = parsedOutput.body;
1335
+ (0, smithy_client_1.throwDefaultError)({
1336
+ output,
1337
+ parsedBody,
1338
+ exceptionCtor: MediaTailorServiceException_1.MediaTailorServiceException,
1339
+ errorCode,
1340
+ });
1901
1341
  };
1902
1342
  const deserializeAws_restJson1DeletePlaybackConfigurationCommand = async (output, context) => {
1903
1343
  if (output.statusCode !== 204 && output.statusCode >= 300) {
1904
1344
  return deserializeAws_restJson1DeletePlaybackConfigurationCommandError(output, context);
1905
1345
  }
1906
- const contents = {
1346
+ const contents = map({
1907
1347
  $metadata: deserializeMetadata(output),
1908
- };
1348
+ });
1909
1349
  await collectBody(output.body, context);
1910
- return Promise.resolve(contents);
1350
+ return contents;
1911
1351
  };
1912
1352
  exports.deserializeAws_restJson1DeletePlaybackConfigurationCommand = deserializeAws_restJson1DeletePlaybackConfigurationCommand;
1913
1353
  const deserializeAws_restJson1DeletePlaybackConfigurationCommandError = async (output, context) => {
@@ -1915,30 +1355,24 @@ const deserializeAws_restJson1DeletePlaybackConfigurationCommandError = async (o
1915
1355
  ...output,
1916
1356
  body: await parseBody(output.body, context),
1917
1357
  };
1918
- let response;
1919
1358
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1920
- switch (errorCode) {
1921
- default:
1922
- const parsedBody = parsedOutput.body;
1923
- const $metadata = deserializeMetadata(output);
1924
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1925
- response = new MediaTailorServiceException_1.MediaTailorServiceException({
1926
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1927
- $fault: "client",
1928
- $metadata,
1929
- });
1930
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1931
- }
1359
+ const parsedBody = parsedOutput.body;
1360
+ (0, smithy_client_1.throwDefaultError)({
1361
+ output,
1362
+ parsedBody,
1363
+ exceptionCtor: MediaTailorServiceException_1.MediaTailorServiceException,
1364
+ errorCode,
1365
+ });
1932
1366
  };
1933
1367
  const deserializeAws_restJson1DeletePrefetchScheduleCommand = async (output, context) => {
1934
1368
  if (output.statusCode !== 204 && output.statusCode >= 300) {
1935
1369
  return deserializeAws_restJson1DeletePrefetchScheduleCommandError(output, context);
1936
1370
  }
1937
- const contents = {
1371
+ const contents = map({
1938
1372
  $metadata: deserializeMetadata(output),
1939
- };
1373
+ });
1940
1374
  await collectBody(output.body, context);
1941
- return Promise.resolve(contents);
1375
+ return contents;
1942
1376
  };
1943
1377
  exports.deserializeAws_restJson1DeletePrefetchScheduleCommand = deserializeAws_restJson1DeletePrefetchScheduleCommand;
1944
1378
  const deserializeAws_restJson1DeletePrefetchScheduleCommandError = async (output, context) => {
@@ -1946,30 +1380,24 @@ const deserializeAws_restJson1DeletePrefetchScheduleCommandError = async (output
1946
1380
  ...output,
1947
1381
  body: await parseBody(output.body, context),
1948
1382
  };
1949
- let response;
1950
1383
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1951
- switch (errorCode) {
1952
- default:
1953
- const parsedBody = parsedOutput.body;
1954
- const $metadata = deserializeMetadata(output);
1955
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1956
- response = new MediaTailorServiceException_1.MediaTailorServiceException({
1957
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1958
- $fault: "client",
1959
- $metadata,
1960
- });
1961
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1962
- }
1384
+ const parsedBody = parsedOutput.body;
1385
+ (0, smithy_client_1.throwDefaultError)({
1386
+ output,
1387
+ parsedBody,
1388
+ exceptionCtor: MediaTailorServiceException_1.MediaTailorServiceException,
1389
+ errorCode,
1390
+ });
1963
1391
  };
1964
1392
  const deserializeAws_restJson1DeleteProgramCommand = async (output, context) => {
1965
1393
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1966
1394
  return deserializeAws_restJson1DeleteProgramCommandError(output, context);
1967
1395
  }
1968
- const contents = {
1396
+ const contents = map({
1969
1397
  $metadata: deserializeMetadata(output),
1970
- };
1398
+ });
1971
1399
  await collectBody(output.body, context);
1972
- return Promise.resolve(contents);
1400
+ return contents;
1973
1401
  };
1974
1402
  exports.deserializeAws_restJson1DeleteProgramCommand = deserializeAws_restJson1DeleteProgramCommand;
1975
1403
  const deserializeAws_restJson1DeleteProgramCommandError = async (output, context) => {
@@ -1977,30 +1405,24 @@ const deserializeAws_restJson1DeleteProgramCommandError = async (output, context
1977
1405
  ...output,
1978
1406
  body: await parseBody(output.body, context),
1979
1407
  };
1980
- let response;
1981
1408
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1982
- switch (errorCode) {
1983
- default:
1984
- const parsedBody = parsedOutput.body;
1985
- const $metadata = deserializeMetadata(output);
1986
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1987
- response = new MediaTailorServiceException_1.MediaTailorServiceException({
1988
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1989
- $fault: "client",
1990
- $metadata,
1991
- });
1992
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1993
- }
1409
+ const parsedBody = parsedOutput.body;
1410
+ (0, smithy_client_1.throwDefaultError)({
1411
+ output,
1412
+ parsedBody,
1413
+ exceptionCtor: MediaTailorServiceException_1.MediaTailorServiceException,
1414
+ errorCode,
1415
+ });
1994
1416
  };
1995
1417
  const deserializeAws_restJson1DeleteSourceLocationCommand = async (output, context) => {
1996
1418
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1997
1419
  return deserializeAws_restJson1DeleteSourceLocationCommandError(output, context);
1998
1420
  }
1999
- const contents = {
1421
+ const contents = map({
2000
1422
  $metadata: deserializeMetadata(output),
2001
- };
1423
+ });
2002
1424
  await collectBody(output.body, context);
2003
- return Promise.resolve(contents);
1425
+ return contents;
2004
1426
  };
2005
1427
  exports.deserializeAws_restJson1DeleteSourceLocationCommand = deserializeAws_restJson1DeleteSourceLocationCommand;
2006
1428
  const deserializeAws_restJson1DeleteSourceLocationCommandError = async (output, context) => {
@@ -2008,30 +1430,24 @@ const deserializeAws_restJson1DeleteSourceLocationCommandError = async (output,
2008
1430
  ...output,
2009
1431
  body: await parseBody(output.body, context),
2010
1432
  };
2011
- let response;
2012
1433
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2013
- switch (errorCode) {
2014
- default:
2015
- const parsedBody = parsedOutput.body;
2016
- const $metadata = deserializeMetadata(output);
2017
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2018
- response = new MediaTailorServiceException_1.MediaTailorServiceException({
2019
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2020
- $fault: "client",
2021
- $metadata,
2022
- });
2023
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2024
- }
1434
+ const parsedBody = parsedOutput.body;
1435
+ (0, smithy_client_1.throwDefaultError)({
1436
+ output,
1437
+ parsedBody,
1438
+ exceptionCtor: MediaTailorServiceException_1.MediaTailorServiceException,
1439
+ errorCode,
1440
+ });
2025
1441
  };
2026
1442
  const deserializeAws_restJson1DeleteVodSourceCommand = async (output, context) => {
2027
1443
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2028
1444
  return deserializeAws_restJson1DeleteVodSourceCommandError(output, context);
2029
1445
  }
2030
- const contents = {
1446
+ const contents = map({
2031
1447
  $metadata: deserializeMetadata(output),
2032
- };
1448
+ });
2033
1449
  await collectBody(output.body, context);
2034
- return Promise.resolve(contents);
1450
+ return contents;
2035
1451
  };
2036
1452
  exports.deserializeAws_restJson1DeleteVodSourceCommand = deserializeAws_restJson1DeleteVodSourceCommand;
2037
1453
  const deserializeAws_restJson1DeleteVodSourceCommandError = async (output, context) => {
@@ -2039,70 +1455,54 @@ const deserializeAws_restJson1DeleteVodSourceCommandError = async (output, conte
2039
1455
  ...output,
2040
1456
  body: await parseBody(output.body, context),
2041
1457
  };
2042
- let response;
2043
1458
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2044
- switch (errorCode) {
2045
- default:
2046
- const parsedBody = parsedOutput.body;
2047
- const $metadata = deserializeMetadata(output);
2048
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2049
- response = new MediaTailorServiceException_1.MediaTailorServiceException({
2050
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2051
- $fault: "client",
2052
- $metadata,
2053
- });
2054
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2055
- }
1459
+ const parsedBody = parsedOutput.body;
1460
+ (0, smithy_client_1.throwDefaultError)({
1461
+ output,
1462
+ parsedBody,
1463
+ exceptionCtor: MediaTailorServiceException_1.MediaTailorServiceException,
1464
+ errorCode,
1465
+ });
2056
1466
  };
2057
1467
  const deserializeAws_restJson1DescribeChannelCommand = async (output, context) => {
2058
1468
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2059
1469
  return deserializeAws_restJson1DescribeChannelCommandError(output, context);
2060
1470
  }
2061
- const contents = {
1471
+ const contents = map({
2062
1472
  $metadata: deserializeMetadata(output),
2063
- Arn: undefined,
2064
- ChannelName: undefined,
2065
- ChannelState: undefined,
2066
- CreationTime: undefined,
2067
- FillerSlate: undefined,
2068
- LastModifiedTime: undefined,
2069
- Outputs: undefined,
2070
- PlaybackMode: undefined,
2071
- Tags: undefined,
2072
- Tier: undefined,
2073
- };
1473
+ });
2074
1474
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2075
- if (data.Arn !== undefined && data.Arn !== null) {
1475
+ if (data.Arn != null) {
2076
1476
  contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
2077
1477
  }
2078
- if (data.ChannelName !== undefined && data.ChannelName !== null) {
1478
+ if (data.ChannelName != null) {
2079
1479
  contents.ChannelName = (0, smithy_client_1.expectString)(data.ChannelName);
2080
1480
  }
2081
- if (data.ChannelState !== undefined && data.ChannelState !== null) {
1481
+ if (data.ChannelState != null) {
2082
1482
  contents.ChannelState = (0, smithy_client_1.expectString)(data.ChannelState);
2083
1483
  }
2084
- if (data.CreationTime !== undefined && data.CreationTime !== null) {
1484
+ if (data.CreationTime != null) {
2085
1485
  contents.CreationTime = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(data.CreationTime)));
2086
1486
  }
2087
- if (data.FillerSlate !== undefined && data.FillerSlate !== null) {
1487
+ if (data.FillerSlate != null) {
2088
1488
  contents.FillerSlate = deserializeAws_restJson1SlateSource(data.FillerSlate, context);
2089
1489
  }
2090
- if (data.LastModifiedTime !== undefined && data.LastModifiedTime !== null) {
1490
+ if (data.LastModifiedTime != null) {
2091
1491
  contents.LastModifiedTime = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(data.LastModifiedTime)));
2092
1492
  }
2093
- if (data.Outputs !== undefined && data.Outputs !== null) {
1493
+ if (data.Outputs != null) {
2094
1494
  contents.Outputs = deserializeAws_restJson1ResponseOutputs(data.Outputs, context);
2095
1495
  }
2096
- if (data.PlaybackMode !== undefined && data.PlaybackMode !== null) {
1496
+ if (data.PlaybackMode != null) {
2097
1497
  contents.PlaybackMode = (0, smithy_client_1.expectString)(data.PlaybackMode);
2098
1498
  }
2099
- if (data.tags !== undefined && data.tags !== null) {
1499
+ if (data.tags != null) {
2100
1500
  contents.Tags = deserializeAws_restJson1__mapOf__string(data.tags, context);
2101
1501
  }
2102
- if (data.Tier !== undefined && data.Tier !== null) {
1502
+ if (data.Tier != null) {
2103
1503
  contents.Tier = (0, smithy_client_1.expectString)(data.Tier);
2104
1504
  }
2105
- return Promise.resolve(contents);
1505
+ return contents;
2106
1506
  };
2107
1507
  exports.deserializeAws_restJson1DescribeChannelCommand = deserializeAws_restJson1DescribeChannelCommand;
2108
1508
  const deserializeAws_restJson1DescribeChannelCommandError = async (output, context) => {
@@ -2110,58 +1510,45 @@ const deserializeAws_restJson1DescribeChannelCommandError = async (output, conte
2110
1510
  ...output,
2111
1511
  body: await parseBody(output.body, context),
2112
1512
  };
2113
- let response;
2114
1513
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2115
- switch (errorCode) {
2116
- default:
2117
- const parsedBody = parsedOutput.body;
2118
- const $metadata = deserializeMetadata(output);
2119
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2120
- response = new MediaTailorServiceException_1.MediaTailorServiceException({
2121
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2122
- $fault: "client",
2123
- $metadata,
2124
- });
2125
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2126
- }
1514
+ const parsedBody = parsedOutput.body;
1515
+ (0, smithy_client_1.throwDefaultError)({
1516
+ output,
1517
+ parsedBody,
1518
+ exceptionCtor: MediaTailorServiceException_1.MediaTailorServiceException,
1519
+ errorCode,
1520
+ });
2127
1521
  };
2128
1522
  const deserializeAws_restJson1DescribeLiveSourceCommand = async (output, context) => {
2129
1523
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2130
1524
  return deserializeAws_restJson1DescribeLiveSourceCommandError(output, context);
2131
1525
  }
2132
- const contents = {
1526
+ const contents = map({
2133
1527
  $metadata: deserializeMetadata(output),
2134
- Arn: undefined,
2135
- CreationTime: undefined,
2136
- HttpPackageConfigurations: undefined,
2137
- LastModifiedTime: undefined,
2138
- LiveSourceName: undefined,
2139
- SourceLocationName: undefined,
2140
- Tags: undefined,
2141
- };
1528
+ });
2142
1529
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2143
- if (data.Arn !== undefined && data.Arn !== null) {
1530
+ if (data.Arn != null) {
2144
1531
  contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
2145
1532
  }
2146
- if (data.CreationTime !== undefined && data.CreationTime !== null) {
1533
+ if (data.CreationTime != null) {
2147
1534
  contents.CreationTime = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(data.CreationTime)));
2148
1535
  }
2149
- if (data.HttpPackageConfigurations !== undefined && data.HttpPackageConfigurations !== null) {
1536
+ if (data.HttpPackageConfigurations != null) {
2150
1537
  contents.HttpPackageConfigurations = deserializeAws_restJson1HttpPackageConfigurations(data.HttpPackageConfigurations, context);
2151
1538
  }
2152
- if (data.LastModifiedTime !== undefined && data.LastModifiedTime !== null) {
1539
+ if (data.LastModifiedTime != null) {
2153
1540
  contents.LastModifiedTime = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(data.LastModifiedTime)));
2154
1541
  }
2155
- if (data.LiveSourceName !== undefined && data.LiveSourceName !== null) {
1542
+ if (data.LiveSourceName != null) {
2156
1543
  contents.LiveSourceName = (0, smithy_client_1.expectString)(data.LiveSourceName);
2157
1544
  }
2158
- if (data.SourceLocationName !== undefined && data.SourceLocationName !== null) {
1545
+ if (data.SourceLocationName != null) {
2159
1546
  contents.SourceLocationName = (0, smithy_client_1.expectString)(data.SourceLocationName);
2160
1547
  }
2161
- if (data.tags !== undefined && data.tags !== null) {
1548
+ if (data.tags != null) {
2162
1549
  contents.Tags = deserializeAws_restJson1__mapOf__string(data.tags, context);
2163
1550
  }
2164
- return Promise.resolve(contents);
1551
+ return contents;
2165
1552
  };
2166
1553
  exports.deserializeAws_restJson1DescribeLiveSourceCommand = deserializeAws_restJson1DescribeLiveSourceCommand;
2167
1554
  const deserializeAws_restJson1DescribeLiveSourceCommandError = async (output, context) => {
@@ -2169,66 +1556,51 @@ const deserializeAws_restJson1DescribeLiveSourceCommandError = async (output, co
2169
1556
  ...output,
2170
1557
  body: await parseBody(output.body, context),
2171
1558
  };
2172
- let response;
2173
1559
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2174
- switch (errorCode) {
2175
- default:
2176
- const parsedBody = parsedOutput.body;
2177
- const $metadata = deserializeMetadata(output);
2178
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2179
- response = new MediaTailorServiceException_1.MediaTailorServiceException({
2180
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2181
- $fault: "client",
2182
- $metadata,
2183
- });
2184
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2185
- }
1560
+ const parsedBody = parsedOutput.body;
1561
+ (0, smithy_client_1.throwDefaultError)({
1562
+ output,
1563
+ parsedBody,
1564
+ exceptionCtor: MediaTailorServiceException_1.MediaTailorServiceException,
1565
+ errorCode,
1566
+ });
2186
1567
  };
2187
1568
  const deserializeAws_restJson1DescribeProgramCommand = async (output, context) => {
2188
1569
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2189
1570
  return deserializeAws_restJson1DescribeProgramCommandError(output, context);
2190
1571
  }
2191
- const contents = {
1572
+ const contents = map({
2192
1573
  $metadata: deserializeMetadata(output),
2193
- AdBreaks: undefined,
2194
- Arn: undefined,
2195
- ChannelName: undefined,
2196
- CreationTime: undefined,
2197
- LiveSourceName: undefined,
2198
- ProgramName: undefined,
2199
- ScheduledStartTime: undefined,
2200
- SourceLocationName: undefined,
2201
- VodSourceName: undefined,
2202
- };
1574
+ });
2203
1575
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2204
- if (data.AdBreaks !== undefined && data.AdBreaks !== null) {
1576
+ if (data.AdBreaks != null) {
2205
1577
  contents.AdBreaks = deserializeAws_restJson1__listOfAdBreak(data.AdBreaks, context);
2206
1578
  }
2207
- if (data.Arn !== undefined && data.Arn !== null) {
1579
+ if (data.Arn != null) {
2208
1580
  contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
2209
1581
  }
2210
- if (data.ChannelName !== undefined && data.ChannelName !== null) {
1582
+ if (data.ChannelName != null) {
2211
1583
  contents.ChannelName = (0, smithy_client_1.expectString)(data.ChannelName);
2212
1584
  }
2213
- if (data.CreationTime !== undefined && data.CreationTime !== null) {
1585
+ if (data.CreationTime != null) {
2214
1586
  contents.CreationTime = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(data.CreationTime)));
2215
1587
  }
2216
- if (data.LiveSourceName !== undefined && data.LiveSourceName !== null) {
1588
+ if (data.LiveSourceName != null) {
2217
1589
  contents.LiveSourceName = (0, smithy_client_1.expectString)(data.LiveSourceName);
2218
1590
  }
2219
- if (data.ProgramName !== undefined && data.ProgramName !== null) {
1591
+ if (data.ProgramName != null) {
2220
1592
  contents.ProgramName = (0, smithy_client_1.expectString)(data.ProgramName);
2221
1593
  }
2222
- if (data.ScheduledStartTime !== undefined && data.ScheduledStartTime !== null) {
1594
+ if (data.ScheduledStartTime != null) {
2223
1595
  contents.ScheduledStartTime = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(data.ScheduledStartTime)));
2224
1596
  }
2225
- if (data.SourceLocationName !== undefined && data.SourceLocationName !== null) {
1597
+ if (data.SourceLocationName != null) {
2226
1598
  contents.SourceLocationName = (0, smithy_client_1.expectString)(data.SourceLocationName);
2227
1599
  }
2228
- if (data.VodSourceName !== undefined && data.VodSourceName !== null) {
1600
+ if (data.VodSourceName != null) {
2229
1601
  contents.VodSourceName = (0, smithy_client_1.expectString)(data.VodSourceName);
2230
1602
  }
2231
- return Promise.resolve(contents);
1603
+ return contents;
2232
1604
  };
2233
1605
  exports.deserializeAws_restJson1DescribeProgramCommand = deserializeAws_restJson1DescribeProgramCommand;
2234
1606
  const deserializeAws_restJson1DescribeProgramCommandError = async (output, context) => {
@@ -2236,66 +1608,51 @@ const deserializeAws_restJson1DescribeProgramCommandError = async (output, conte
2236
1608
  ...output,
2237
1609
  body: await parseBody(output.body, context),
2238
1610
  };
2239
- let response;
2240
1611
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2241
- switch (errorCode) {
2242
- default:
2243
- const parsedBody = parsedOutput.body;
2244
- const $metadata = deserializeMetadata(output);
2245
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2246
- response = new MediaTailorServiceException_1.MediaTailorServiceException({
2247
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2248
- $fault: "client",
2249
- $metadata,
2250
- });
2251
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2252
- }
1612
+ const parsedBody = parsedOutput.body;
1613
+ (0, smithy_client_1.throwDefaultError)({
1614
+ output,
1615
+ parsedBody,
1616
+ exceptionCtor: MediaTailorServiceException_1.MediaTailorServiceException,
1617
+ errorCode,
1618
+ });
2253
1619
  };
2254
1620
  const deserializeAws_restJson1DescribeSourceLocationCommand = async (output, context) => {
2255
1621
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2256
1622
  return deserializeAws_restJson1DescribeSourceLocationCommandError(output, context);
2257
1623
  }
2258
- const contents = {
1624
+ const contents = map({
2259
1625
  $metadata: deserializeMetadata(output),
2260
- AccessConfiguration: undefined,
2261
- Arn: undefined,
2262
- CreationTime: undefined,
2263
- DefaultSegmentDeliveryConfiguration: undefined,
2264
- HttpConfiguration: undefined,
2265
- LastModifiedTime: undefined,
2266
- SegmentDeliveryConfigurations: undefined,
2267
- SourceLocationName: undefined,
2268
- Tags: undefined,
2269
- };
1626
+ });
2270
1627
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2271
- if (data.AccessConfiguration !== undefined && data.AccessConfiguration !== null) {
1628
+ if (data.AccessConfiguration != null) {
2272
1629
  contents.AccessConfiguration = deserializeAws_restJson1AccessConfiguration(data.AccessConfiguration, context);
2273
1630
  }
2274
- if (data.Arn !== undefined && data.Arn !== null) {
1631
+ if (data.Arn != null) {
2275
1632
  contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
2276
1633
  }
2277
- if (data.CreationTime !== undefined && data.CreationTime !== null) {
1634
+ if (data.CreationTime != null) {
2278
1635
  contents.CreationTime = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(data.CreationTime)));
2279
1636
  }
2280
- if (data.DefaultSegmentDeliveryConfiguration !== undefined && data.DefaultSegmentDeliveryConfiguration !== null) {
1637
+ if (data.DefaultSegmentDeliveryConfiguration != null) {
2281
1638
  contents.DefaultSegmentDeliveryConfiguration = deserializeAws_restJson1DefaultSegmentDeliveryConfiguration(data.DefaultSegmentDeliveryConfiguration, context);
2282
1639
  }
2283
- if (data.HttpConfiguration !== undefined && data.HttpConfiguration !== null) {
1640
+ if (data.HttpConfiguration != null) {
2284
1641
  contents.HttpConfiguration = deserializeAws_restJson1HttpConfiguration(data.HttpConfiguration, context);
2285
1642
  }
2286
- if (data.LastModifiedTime !== undefined && data.LastModifiedTime !== null) {
1643
+ if (data.LastModifiedTime != null) {
2287
1644
  contents.LastModifiedTime = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(data.LastModifiedTime)));
2288
1645
  }
2289
- if (data.SegmentDeliveryConfigurations !== undefined && data.SegmentDeliveryConfigurations !== null) {
1646
+ if (data.SegmentDeliveryConfigurations != null) {
2290
1647
  contents.SegmentDeliveryConfigurations = deserializeAws_restJson1__listOfSegmentDeliveryConfiguration(data.SegmentDeliveryConfigurations, context);
2291
1648
  }
2292
- if (data.SourceLocationName !== undefined && data.SourceLocationName !== null) {
1649
+ if (data.SourceLocationName != null) {
2293
1650
  contents.SourceLocationName = (0, smithy_client_1.expectString)(data.SourceLocationName);
2294
1651
  }
2295
- if (data.tags !== undefined && data.tags !== null) {
1652
+ if (data.tags != null) {
2296
1653
  contents.Tags = deserializeAws_restJson1__mapOf__string(data.tags, context);
2297
1654
  }
2298
- return Promise.resolve(contents);
1655
+ return contents;
2299
1656
  };
2300
1657
  exports.deserializeAws_restJson1DescribeSourceLocationCommand = deserializeAws_restJson1DescribeSourceLocationCommand;
2301
1658
  const deserializeAws_restJson1DescribeSourceLocationCommandError = async (output, context) => {
@@ -2303,58 +1660,45 @@ const deserializeAws_restJson1DescribeSourceLocationCommandError = async (output
2303
1660
  ...output,
2304
1661
  body: await parseBody(output.body, context),
2305
1662
  };
2306
- let response;
2307
1663
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2308
- switch (errorCode) {
2309
- default:
2310
- const parsedBody = parsedOutput.body;
2311
- const $metadata = deserializeMetadata(output);
2312
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2313
- response = new MediaTailorServiceException_1.MediaTailorServiceException({
2314
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2315
- $fault: "client",
2316
- $metadata,
2317
- });
2318
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2319
- }
1664
+ const parsedBody = parsedOutput.body;
1665
+ (0, smithy_client_1.throwDefaultError)({
1666
+ output,
1667
+ parsedBody,
1668
+ exceptionCtor: MediaTailorServiceException_1.MediaTailorServiceException,
1669
+ errorCode,
1670
+ });
2320
1671
  };
2321
1672
  const deserializeAws_restJson1DescribeVodSourceCommand = async (output, context) => {
2322
1673
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2323
1674
  return deserializeAws_restJson1DescribeVodSourceCommandError(output, context);
2324
1675
  }
2325
- const contents = {
1676
+ const contents = map({
2326
1677
  $metadata: deserializeMetadata(output),
2327
- Arn: undefined,
2328
- CreationTime: undefined,
2329
- HttpPackageConfigurations: undefined,
2330
- LastModifiedTime: undefined,
2331
- SourceLocationName: undefined,
2332
- Tags: undefined,
2333
- VodSourceName: undefined,
2334
- };
1678
+ });
2335
1679
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2336
- if (data.Arn !== undefined && data.Arn !== null) {
1680
+ if (data.Arn != null) {
2337
1681
  contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
2338
1682
  }
2339
- if (data.CreationTime !== undefined && data.CreationTime !== null) {
1683
+ if (data.CreationTime != null) {
2340
1684
  contents.CreationTime = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(data.CreationTime)));
2341
1685
  }
2342
- if (data.HttpPackageConfigurations !== undefined && data.HttpPackageConfigurations !== null) {
1686
+ if (data.HttpPackageConfigurations != null) {
2343
1687
  contents.HttpPackageConfigurations = deserializeAws_restJson1HttpPackageConfigurations(data.HttpPackageConfigurations, context);
2344
1688
  }
2345
- if (data.LastModifiedTime !== undefined && data.LastModifiedTime !== null) {
1689
+ if (data.LastModifiedTime != null) {
2346
1690
  contents.LastModifiedTime = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(data.LastModifiedTime)));
2347
1691
  }
2348
- if (data.SourceLocationName !== undefined && data.SourceLocationName !== null) {
1692
+ if (data.SourceLocationName != null) {
2349
1693
  contents.SourceLocationName = (0, smithy_client_1.expectString)(data.SourceLocationName);
2350
1694
  }
2351
- if (data.tags !== undefined && data.tags !== null) {
1695
+ if (data.tags != null) {
2352
1696
  contents.Tags = deserializeAws_restJson1__mapOf__string(data.tags, context);
2353
1697
  }
2354
- if (data.VodSourceName !== undefined && data.VodSourceName !== null) {
1698
+ if (data.VodSourceName != null) {
2355
1699
  contents.VodSourceName = (0, smithy_client_1.expectString)(data.VodSourceName);
2356
1700
  }
2357
- return Promise.resolve(contents);
1701
+ return contents;
2358
1702
  };
2359
1703
  exports.deserializeAws_restJson1DescribeVodSourceCommand = deserializeAws_restJson1DescribeVodSourceCommand;
2360
1704
  const deserializeAws_restJson1DescribeVodSourceCommandError = async (output, context) => {
@@ -2362,34 +1706,27 @@ const deserializeAws_restJson1DescribeVodSourceCommandError = async (output, con
2362
1706
  ...output,
2363
1707
  body: await parseBody(output.body, context),
2364
1708
  };
2365
- let response;
2366
1709
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2367
- switch (errorCode) {
2368
- default:
2369
- const parsedBody = parsedOutput.body;
2370
- const $metadata = deserializeMetadata(output);
2371
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2372
- response = new MediaTailorServiceException_1.MediaTailorServiceException({
2373
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2374
- $fault: "client",
2375
- $metadata,
2376
- });
2377
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2378
- }
1710
+ const parsedBody = parsedOutput.body;
1711
+ (0, smithy_client_1.throwDefaultError)({
1712
+ output,
1713
+ parsedBody,
1714
+ exceptionCtor: MediaTailorServiceException_1.MediaTailorServiceException,
1715
+ errorCode,
1716
+ });
2379
1717
  };
2380
1718
  const deserializeAws_restJson1GetChannelPolicyCommand = async (output, context) => {
2381
1719
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2382
1720
  return deserializeAws_restJson1GetChannelPolicyCommandError(output, context);
2383
1721
  }
2384
- const contents = {
1722
+ const contents = map({
2385
1723
  $metadata: deserializeMetadata(output),
2386
- Policy: undefined,
2387
- };
1724
+ });
2388
1725
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2389
- if (data.Policy !== undefined && data.Policy !== null) {
1726
+ if (data.Policy != null) {
2390
1727
  contents.Policy = (0, smithy_client_1.expectString)(data.Policy);
2391
1728
  }
2392
- return Promise.resolve(contents);
1729
+ return contents;
2393
1730
  };
2394
1731
  exports.deserializeAws_restJson1GetChannelPolicyCommand = deserializeAws_restJson1GetChannelPolicyCommand;
2395
1732
  const deserializeAws_restJson1GetChannelPolicyCommandError = async (output, context) => {
@@ -2397,38 +1734,30 @@ const deserializeAws_restJson1GetChannelPolicyCommandError = async (output, cont
2397
1734
  ...output,
2398
1735
  body: await parseBody(output.body, context),
2399
1736
  };
2400
- let response;
2401
1737
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2402
- switch (errorCode) {
2403
- default:
2404
- const parsedBody = parsedOutput.body;
2405
- const $metadata = deserializeMetadata(output);
2406
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2407
- response = new MediaTailorServiceException_1.MediaTailorServiceException({
2408
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2409
- $fault: "client",
2410
- $metadata,
2411
- });
2412
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2413
- }
1738
+ const parsedBody = parsedOutput.body;
1739
+ (0, smithy_client_1.throwDefaultError)({
1740
+ output,
1741
+ parsedBody,
1742
+ exceptionCtor: MediaTailorServiceException_1.MediaTailorServiceException,
1743
+ errorCode,
1744
+ });
2414
1745
  };
2415
1746
  const deserializeAws_restJson1GetChannelScheduleCommand = async (output, context) => {
2416
1747
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2417
1748
  return deserializeAws_restJson1GetChannelScheduleCommandError(output, context);
2418
1749
  }
2419
- const contents = {
1750
+ const contents = map({
2420
1751
  $metadata: deserializeMetadata(output),
2421
- Items: undefined,
2422
- NextToken: undefined,
2423
- };
1752
+ });
2424
1753
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2425
- if (data.Items !== undefined && data.Items !== null) {
1754
+ if (data.Items != null) {
2426
1755
  contents.Items = deserializeAws_restJson1__listOfScheduleEntry(data.Items, context);
2427
1756
  }
2428
- if (data.NextToken !== undefined && data.NextToken !== null) {
1757
+ if (data.NextToken != null) {
2429
1758
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
2430
1759
  }
2431
- return Promise.resolve(contents);
1760
+ return contents;
2432
1761
  };
2433
1762
  exports.deserializeAws_restJson1GetChannelScheduleCommand = deserializeAws_restJson1GetChannelScheduleCommand;
2434
1763
  const deserializeAws_restJson1GetChannelScheduleCommandError = async (output, context) => {
@@ -2436,106 +1765,81 @@ const deserializeAws_restJson1GetChannelScheduleCommandError = async (output, co
2436
1765
  ...output,
2437
1766
  body: await parseBody(output.body, context),
2438
1767
  };
2439
- let response;
2440
1768
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2441
- switch (errorCode) {
2442
- default:
2443
- const parsedBody = parsedOutput.body;
2444
- const $metadata = deserializeMetadata(output);
2445
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2446
- response = new MediaTailorServiceException_1.MediaTailorServiceException({
2447
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2448
- $fault: "client",
2449
- $metadata,
2450
- });
2451
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2452
- }
1769
+ const parsedBody = parsedOutput.body;
1770
+ (0, smithy_client_1.throwDefaultError)({
1771
+ output,
1772
+ parsedBody,
1773
+ exceptionCtor: MediaTailorServiceException_1.MediaTailorServiceException,
1774
+ errorCode,
1775
+ });
2453
1776
  };
2454
1777
  const deserializeAws_restJson1GetPlaybackConfigurationCommand = async (output, context) => {
2455
1778
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2456
1779
  return deserializeAws_restJson1GetPlaybackConfigurationCommandError(output, context);
2457
1780
  }
2458
- const contents = {
1781
+ const contents = map({
2459
1782
  $metadata: deserializeMetadata(output),
2460
- AdDecisionServerUrl: undefined,
2461
- AvailSuppression: undefined,
2462
- Bumper: undefined,
2463
- CdnConfiguration: undefined,
2464
- ConfigurationAliases: undefined,
2465
- DashConfiguration: undefined,
2466
- HlsConfiguration: undefined,
2467
- LivePreRollConfiguration: undefined,
2468
- LogConfiguration: undefined,
2469
- ManifestProcessingRules: undefined,
2470
- Name: undefined,
2471
- PersonalizationThresholdSeconds: undefined,
2472
- PlaybackConfigurationArn: undefined,
2473
- PlaybackEndpointPrefix: undefined,
2474
- SessionInitializationEndpointPrefix: undefined,
2475
- SlateAdUrl: undefined,
2476
- Tags: undefined,
2477
- TranscodeProfileName: undefined,
2478
- VideoContentSourceUrl: undefined,
2479
- };
1783
+ });
2480
1784
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2481
- if (data.AdDecisionServerUrl !== undefined && data.AdDecisionServerUrl !== null) {
1785
+ if (data.AdDecisionServerUrl != null) {
2482
1786
  contents.AdDecisionServerUrl = (0, smithy_client_1.expectString)(data.AdDecisionServerUrl);
2483
1787
  }
2484
- if (data.AvailSuppression !== undefined && data.AvailSuppression !== null) {
1788
+ if (data.AvailSuppression != null) {
2485
1789
  contents.AvailSuppression = deserializeAws_restJson1AvailSuppression(data.AvailSuppression, context);
2486
1790
  }
2487
- if (data.Bumper !== undefined && data.Bumper !== null) {
1791
+ if (data.Bumper != null) {
2488
1792
  contents.Bumper = deserializeAws_restJson1Bumper(data.Bumper, context);
2489
1793
  }
2490
- if (data.CdnConfiguration !== undefined && data.CdnConfiguration !== null) {
1794
+ if (data.CdnConfiguration != null) {
2491
1795
  contents.CdnConfiguration = deserializeAws_restJson1CdnConfiguration(data.CdnConfiguration, context);
2492
1796
  }
2493
- if (data.ConfigurationAliases !== undefined && data.ConfigurationAliases !== null) {
1797
+ if (data.ConfigurationAliases != null) {
2494
1798
  contents.ConfigurationAliases = deserializeAws_restJson1ConfigurationAliasesResponse(data.ConfigurationAliases, context);
2495
1799
  }
2496
- if (data.DashConfiguration !== undefined && data.DashConfiguration !== null) {
1800
+ if (data.DashConfiguration != null) {
2497
1801
  contents.DashConfiguration = deserializeAws_restJson1DashConfiguration(data.DashConfiguration, context);
2498
1802
  }
2499
- if (data.HlsConfiguration !== undefined && data.HlsConfiguration !== null) {
1803
+ if (data.HlsConfiguration != null) {
2500
1804
  contents.HlsConfiguration = deserializeAws_restJson1HlsConfiguration(data.HlsConfiguration, context);
2501
1805
  }
2502
- if (data.LivePreRollConfiguration !== undefined && data.LivePreRollConfiguration !== null) {
1806
+ if (data.LivePreRollConfiguration != null) {
2503
1807
  contents.LivePreRollConfiguration = deserializeAws_restJson1LivePreRollConfiguration(data.LivePreRollConfiguration, context);
2504
1808
  }
2505
- if (data.LogConfiguration !== undefined && data.LogConfiguration !== null) {
1809
+ if (data.LogConfiguration != null) {
2506
1810
  contents.LogConfiguration = deserializeAws_restJson1LogConfiguration(data.LogConfiguration, context);
2507
1811
  }
2508
- if (data.ManifestProcessingRules !== undefined && data.ManifestProcessingRules !== null) {
1812
+ if (data.ManifestProcessingRules != null) {
2509
1813
  contents.ManifestProcessingRules = deserializeAws_restJson1ManifestProcessingRules(data.ManifestProcessingRules, context);
2510
1814
  }
2511
- if (data.Name !== undefined && data.Name !== null) {
1815
+ if (data.Name != null) {
2512
1816
  contents.Name = (0, smithy_client_1.expectString)(data.Name);
2513
1817
  }
2514
- if (data.PersonalizationThresholdSeconds !== undefined && data.PersonalizationThresholdSeconds !== null) {
1818
+ if (data.PersonalizationThresholdSeconds != null) {
2515
1819
  contents.PersonalizationThresholdSeconds = (0, smithy_client_1.expectInt32)(data.PersonalizationThresholdSeconds);
2516
1820
  }
2517
- if (data.PlaybackConfigurationArn !== undefined && data.PlaybackConfigurationArn !== null) {
1821
+ if (data.PlaybackConfigurationArn != null) {
2518
1822
  contents.PlaybackConfigurationArn = (0, smithy_client_1.expectString)(data.PlaybackConfigurationArn);
2519
1823
  }
2520
- if (data.PlaybackEndpointPrefix !== undefined && data.PlaybackEndpointPrefix !== null) {
1824
+ if (data.PlaybackEndpointPrefix != null) {
2521
1825
  contents.PlaybackEndpointPrefix = (0, smithy_client_1.expectString)(data.PlaybackEndpointPrefix);
2522
1826
  }
2523
- if (data.SessionInitializationEndpointPrefix !== undefined && data.SessionInitializationEndpointPrefix !== null) {
1827
+ if (data.SessionInitializationEndpointPrefix != null) {
2524
1828
  contents.SessionInitializationEndpointPrefix = (0, smithy_client_1.expectString)(data.SessionInitializationEndpointPrefix);
2525
1829
  }
2526
- if (data.SlateAdUrl !== undefined && data.SlateAdUrl !== null) {
1830
+ if (data.SlateAdUrl != null) {
2527
1831
  contents.SlateAdUrl = (0, smithy_client_1.expectString)(data.SlateAdUrl);
2528
1832
  }
2529
- if (data.tags !== undefined && data.tags !== null) {
1833
+ if (data.tags != null) {
2530
1834
  contents.Tags = deserializeAws_restJson1__mapOf__string(data.tags, context);
2531
1835
  }
2532
- if (data.TranscodeProfileName !== undefined && data.TranscodeProfileName !== null) {
1836
+ if (data.TranscodeProfileName != null) {
2533
1837
  contents.TranscodeProfileName = (0, smithy_client_1.expectString)(data.TranscodeProfileName);
2534
1838
  }
2535
- if (data.VideoContentSourceUrl !== undefined && data.VideoContentSourceUrl !== null) {
1839
+ if (data.VideoContentSourceUrl != null) {
2536
1840
  contents.VideoContentSourceUrl = (0, smithy_client_1.expectString)(data.VideoContentSourceUrl);
2537
1841
  }
2538
- return Promise.resolve(contents);
1842
+ return contents;
2539
1843
  };
2540
1844
  exports.deserializeAws_restJson1GetPlaybackConfigurationCommand = deserializeAws_restJson1GetPlaybackConfigurationCommand;
2541
1845
  const deserializeAws_restJson1GetPlaybackConfigurationCommandError = async (output, context) => {
@@ -2543,54 +1847,42 @@ const deserializeAws_restJson1GetPlaybackConfigurationCommandError = async (outp
2543
1847
  ...output,
2544
1848
  body: await parseBody(output.body, context),
2545
1849
  };
2546
- let response;
2547
1850
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2548
- switch (errorCode) {
2549
- default:
2550
- const parsedBody = parsedOutput.body;
2551
- const $metadata = deserializeMetadata(output);
2552
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2553
- response = new MediaTailorServiceException_1.MediaTailorServiceException({
2554
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2555
- $fault: "client",
2556
- $metadata,
2557
- });
2558
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2559
- }
1851
+ const parsedBody = parsedOutput.body;
1852
+ (0, smithy_client_1.throwDefaultError)({
1853
+ output,
1854
+ parsedBody,
1855
+ exceptionCtor: MediaTailorServiceException_1.MediaTailorServiceException,
1856
+ errorCode,
1857
+ });
2560
1858
  };
2561
1859
  const deserializeAws_restJson1GetPrefetchScheduleCommand = async (output, context) => {
2562
1860
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2563
1861
  return deserializeAws_restJson1GetPrefetchScheduleCommandError(output, context);
2564
1862
  }
2565
- const contents = {
1863
+ const contents = map({
2566
1864
  $metadata: deserializeMetadata(output),
2567
- Arn: undefined,
2568
- Consumption: undefined,
2569
- Name: undefined,
2570
- PlaybackConfigurationName: undefined,
2571
- Retrieval: undefined,
2572
- StreamId: undefined,
2573
- };
1865
+ });
2574
1866
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2575
- if (data.Arn !== undefined && data.Arn !== null) {
1867
+ if (data.Arn != null) {
2576
1868
  contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
2577
1869
  }
2578
- if (data.Consumption !== undefined && data.Consumption !== null) {
1870
+ if (data.Consumption != null) {
2579
1871
  contents.Consumption = deserializeAws_restJson1PrefetchConsumption(data.Consumption, context);
2580
1872
  }
2581
- if (data.Name !== undefined && data.Name !== null) {
1873
+ if (data.Name != null) {
2582
1874
  contents.Name = (0, smithy_client_1.expectString)(data.Name);
2583
1875
  }
2584
- if (data.PlaybackConfigurationName !== undefined && data.PlaybackConfigurationName !== null) {
1876
+ if (data.PlaybackConfigurationName != null) {
2585
1877
  contents.PlaybackConfigurationName = (0, smithy_client_1.expectString)(data.PlaybackConfigurationName);
2586
1878
  }
2587
- if (data.Retrieval !== undefined && data.Retrieval !== null) {
1879
+ if (data.Retrieval != null) {
2588
1880
  contents.Retrieval = deserializeAws_restJson1PrefetchRetrieval(data.Retrieval, context);
2589
1881
  }
2590
- if (data.StreamId !== undefined && data.StreamId !== null) {
1882
+ if (data.StreamId != null) {
2591
1883
  contents.StreamId = (0, smithy_client_1.expectString)(data.StreamId);
2592
1884
  }
2593
- return Promise.resolve(contents);
1885
+ return contents;
2594
1886
  };
2595
1887
  exports.deserializeAws_restJson1GetPrefetchScheduleCommand = deserializeAws_restJson1GetPrefetchScheduleCommand;
2596
1888
  const deserializeAws_restJson1GetPrefetchScheduleCommandError = async (output, context) => {
@@ -2598,38 +1890,30 @@ const deserializeAws_restJson1GetPrefetchScheduleCommandError = async (output, c
2598
1890
  ...output,
2599
1891
  body: await parseBody(output.body, context),
2600
1892
  };
2601
- let response;
2602
1893
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2603
- switch (errorCode) {
2604
- default:
2605
- const parsedBody = parsedOutput.body;
2606
- const $metadata = deserializeMetadata(output);
2607
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2608
- response = new MediaTailorServiceException_1.MediaTailorServiceException({
2609
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2610
- $fault: "client",
2611
- $metadata,
2612
- });
2613
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2614
- }
1894
+ const parsedBody = parsedOutput.body;
1895
+ (0, smithy_client_1.throwDefaultError)({
1896
+ output,
1897
+ parsedBody,
1898
+ exceptionCtor: MediaTailorServiceException_1.MediaTailorServiceException,
1899
+ errorCode,
1900
+ });
2615
1901
  };
2616
1902
  const deserializeAws_restJson1ListAlertsCommand = async (output, context) => {
2617
1903
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2618
1904
  return deserializeAws_restJson1ListAlertsCommandError(output, context);
2619
1905
  }
2620
- const contents = {
1906
+ const contents = map({
2621
1907
  $metadata: deserializeMetadata(output),
2622
- Items: undefined,
2623
- NextToken: undefined,
2624
- };
1908
+ });
2625
1909
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2626
- if (data.Items !== undefined && data.Items !== null) {
1910
+ if (data.Items != null) {
2627
1911
  contents.Items = deserializeAws_restJson1__listOfAlert(data.Items, context);
2628
1912
  }
2629
- if (data.NextToken !== undefined && data.NextToken !== null) {
1913
+ if (data.NextToken != null) {
2630
1914
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
2631
1915
  }
2632
- return Promise.resolve(contents);
1916
+ return contents;
2633
1917
  };
2634
1918
  exports.deserializeAws_restJson1ListAlertsCommand = deserializeAws_restJson1ListAlertsCommand;
2635
1919
  const deserializeAws_restJson1ListAlertsCommandError = async (output, context) => {
@@ -2637,38 +1921,30 @@ const deserializeAws_restJson1ListAlertsCommandError = async (output, context) =
2637
1921
  ...output,
2638
1922
  body: await parseBody(output.body, context),
2639
1923
  };
2640
- let response;
2641
1924
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2642
- switch (errorCode) {
2643
- default:
2644
- const parsedBody = parsedOutput.body;
2645
- const $metadata = deserializeMetadata(output);
2646
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2647
- response = new MediaTailorServiceException_1.MediaTailorServiceException({
2648
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2649
- $fault: "client",
2650
- $metadata,
2651
- });
2652
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2653
- }
1925
+ const parsedBody = parsedOutput.body;
1926
+ (0, smithy_client_1.throwDefaultError)({
1927
+ output,
1928
+ parsedBody,
1929
+ exceptionCtor: MediaTailorServiceException_1.MediaTailorServiceException,
1930
+ errorCode,
1931
+ });
2654
1932
  };
2655
1933
  const deserializeAws_restJson1ListChannelsCommand = async (output, context) => {
2656
1934
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2657
1935
  return deserializeAws_restJson1ListChannelsCommandError(output, context);
2658
1936
  }
2659
- const contents = {
1937
+ const contents = map({
2660
1938
  $metadata: deserializeMetadata(output),
2661
- Items: undefined,
2662
- NextToken: undefined,
2663
- };
1939
+ });
2664
1940
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2665
- if (data.Items !== undefined && data.Items !== null) {
1941
+ if (data.Items != null) {
2666
1942
  contents.Items = deserializeAws_restJson1__listOfChannel(data.Items, context);
2667
1943
  }
2668
- if (data.NextToken !== undefined && data.NextToken !== null) {
1944
+ if (data.NextToken != null) {
2669
1945
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
2670
1946
  }
2671
- return Promise.resolve(contents);
1947
+ return contents;
2672
1948
  };
2673
1949
  exports.deserializeAws_restJson1ListChannelsCommand = deserializeAws_restJson1ListChannelsCommand;
2674
1950
  const deserializeAws_restJson1ListChannelsCommandError = async (output, context) => {
@@ -2676,38 +1952,30 @@ const deserializeAws_restJson1ListChannelsCommandError = async (output, context)
2676
1952
  ...output,
2677
1953
  body: await parseBody(output.body, context),
2678
1954
  };
2679
- let response;
2680
1955
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2681
- switch (errorCode) {
2682
- default:
2683
- const parsedBody = parsedOutput.body;
2684
- const $metadata = deserializeMetadata(output);
2685
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2686
- response = new MediaTailorServiceException_1.MediaTailorServiceException({
2687
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2688
- $fault: "client",
2689
- $metadata,
2690
- });
2691
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2692
- }
1956
+ const parsedBody = parsedOutput.body;
1957
+ (0, smithy_client_1.throwDefaultError)({
1958
+ output,
1959
+ parsedBody,
1960
+ exceptionCtor: MediaTailorServiceException_1.MediaTailorServiceException,
1961
+ errorCode,
1962
+ });
2693
1963
  };
2694
1964
  const deserializeAws_restJson1ListLiveSourcesCommand = async (output, context) => {
2695
1965
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2696
1966
  return deserializeAws_restJson1ListLiveSourcesCommandError(output, context);
2697
1967
  }
2698
- const contents = {
1968
+ const contents = map({
2699
1969
  $metadata: deserializeMetadata(output),
2700
- Items: undefined,
2701
- NextToken: undefined,
2702
- };
1970
+ });
2703
1971
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2704
- if (data.Items !== undefined && data.Items !== null) {
1972
+ if (data.Items != null) {
2705
1973
  contents.Items = deserializeAws_restJson1__listOfLiveSource(data.Items, context);
2706
1974
  }
2707
- if (data.NextToken !== undefined && data.NextToken !== null) {
1975
+ if (data.NextToken != null) {
2708
1976
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
2709
1977
  }
2710
- return Promise.resolve(contents);
1978
+ return contents;
2711
1979
  };
2712
1980
  exports.deserializeAws_restJson1ListLiveSourcesCommand = deserializeAws_restJson1ListLiveSourcesCommand;
2713
1981
  const deserializeAws_restJson1ListLiveSourcesCommandError = async (output, context) => {
@@ -2715,38 +1983,30 @@ const deserializeAws_restJson1ListLiveSourcesCommandError = async (output, conte
2715
1983
  ...output,
2716
1984
  body: await parseBody(output.body, context),
2717
1985
  };
2718
- let response;
2719
1986
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2720
- switch (errorCode) {
2721
- default:
2722
- const parsedBody = parsedOutput.body;
2723
- const $metadata = deserializeMetadata(output);
2724
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2725
- response = new MediaTailorServiceException_1.MediaTailorServiceException({
2726
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2727
- $fault: "client",
2728
- $metadata,
2729
- });
2730
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2731
- }
1987
+ const parsedBody = parsedOutput.body;
1988
+ (0, smithy_client_1.throwDefaultError)({
1989
+ output,
1990
+ parsedBody,
1991
+ exceptionCtor: MediaTailorServiceException_1.MediaTailorServiceException,
1992
+ errorCode,
1993
+ });
2732
1994
  };
2733
1995
  const deserializeAws_restJson1ListPlaybackConfigurationsCommand = async (output, context) => {
2734
1996
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2735
1997
  return deserializeAws_restJson1ListPlaybackConfigurationsCommandError(output, context);
2736
1998
  }
2737
- const contents = {
1999
+ const contents = map({
2738
2000
  $metadata: deserializeMetadata(output),
2739
- Items: undefined,
2740
- NextToken: undefined,
2741
- };
2001
+ });
2742
2002
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2743
- if (data.Items !== undefined && data.Items !== null) {
2003
+ if (data.Items != null) {
2744
2004
  contents.Items = deserializeAws_restJson1__listOfPlaybackConfiguration(data.Items, context);
2745
2005
  }
2746
- if (data.NextToken !== undefined && data.NextToken !== null) {
2006
+ if (data.NextToken != null) {
2747
2007
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
2748
2008
  }
2749
- return Promise.resolve(contents);
2009
+ return contents;
2750
2010
  };
2751
2011
  exports.deserializeAws_restJson1ListPlaybackConfigurationsCommand = deserializeAws_restJson1ListPlaybackConfigurationsCommand;
2752
2012
  const deserializeAws_restJson1ListPlaybackConfigurationsCommandError = async (output, context) => {
@@ -2754,38 +2014,30 @@ const deserializeAws_restJson1ListPlaybackConfigurationsCommandError = async (ou
2754
2014
  ...output,
2755
2015
  body: await parseBody(output.body, context),
2756
2016
  };
2757
- let response;
2758
2017
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2759
- switch (errorCode) {
2760
- default:
2761
- const parsedBody = parsedOutput.body;
2762
- const $metadata = deserializeMetadata(output);
2763
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2764
- response = new MediaTailorServiceException_1.MediaTailorServiceException({
2765
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2766
- $fault: "client",
2767
- $metadata,
2768
- });
2769
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2770
- }
2018
+ const parsedBody = parsedOutput.body;
2019
+ (0, smithy_client_1.throwDefaultError)({
2020
+ output,
2021
+ parsedBody,
2022
+ exceptionCtor: MediaTailorServiceException_1.MediaTailorServiceException,
2023
+ errorCode,
2024
+ });
2771
2025
  };
2772
2026
  const deserializeAws_restJson1ListPrefetchSchedulesCommand = async (output, context) => {
2773
2027
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2774
2028
  return deserializeAws_restJson1ListPrefetchSchedulesCommandError(output, context);
2775
2029
  }
2776
- const contents = {
2030
+ const contents = map({
2777
2031
  $metadata: deserializeMetadata(output),
2778
- Items: undefined,
2779
- NextToken: undefined,
2780
- };
2032
+ });
2781
2033
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2782
- if (data.Items !== undefined && data.Items !== null) {
2034
+ if (data.Items != null) {
2783
2035
  contents.Items = deserializeAws_restJson1__listOfPrefetchSchedule(data.Items, context);
2784
2036
  }
2785
- if (data.NextToken !== undefined && data.NextToken !== null) {
2037
+ if (data.NextToken != null) {
2786
2038
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
2787
2039
  }
2788
- return Promise.resolve(contents);
2040
+ return contents;
2789
2041
  };
2790
2042
  exports.deserializeAws_restJson1ListPrefetchSchedulesCommand = deserializeAws_restJson1ListPrefetchSchedulesCommand;
2791
2043
  const deserializeAws_restJson1ListPrefetchSchedulesCommandError = async (output, context) => {
@@ -2793,38 +2045,30 @@ const deserializeAws_restJson1ListPrefetchSchedulesCommandError = async (output,
2793
2045
  ...output,
2794
2046
  body: await parseBody(output.body, context),
2795
2047
  };
2796
- let response;
2797
2048
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2798
- switch (errorCode) {
2799
- default:
2800
- const parsedBody = parsedOutput.body;
2801
- const $metadata = deserializeMetadata(output);
2802
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2803
- response = new MediaTailorServiceException_1.MediaTailorServiceException({
2804
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2805
- $fault: "client",
2806
- $metadata,
2807
- });
2808
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2809
- }
2049
+ const parsedBody = parsedOutput.body;
2050
+ (0, smithy_client_1.throwDefaultError)({
2051
+ output,
2052
+ parsedBody,
2053
+ exceptionCtor: MediaTailorServiceException_1.MediaTailorServiceException,
2054
+ errorCode,
2055
+ });
2810
2056
  };
2811
2057
  const deserializeAws_restJson1ListSourceLocationsCommand = async (output, context) => {
2812
2058
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2813
2059
  return deserializeAws_restJson1ListSourceLocationsCommandError(output, context);
2814
2060
  }
2815
- const contents = {
2061
+ const contents = map({
2816
2062
  $metadata: deserializeMetadata(output),
2817
- Items: undefined,
2818
- NextToken: undefined,
2819
- };
2063
+ });
2820
2064
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2821
- if (data.Items !== undefined && data.Items !== null) {
2065
+ if (data.Items != null) {
2822
2066
  contents.Items = deserializeAws_restJson1__listOfSourceLocation(data.Items, context);
2823
2067
  }
2824
- if (data.NextToken !== undefined && data.NextToken !== null) {
2068
+ if (data.NextToken != null) {
2825
2069
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
2826
2070
  }
2827
- return Promise.resolve(contents);
2071
+ return contents;
2828
2072
  };
2829
2073
  exports.deserializeAws_restJson1ListSourceLocationsCommand = deserializeAws_restJson1ListSourceLocationsCommand;
2830
2074
  const deserializeAws_restJson1ListSourceLocationsCommandError = async (output, context) => {
@@ -2832,34 +2076,27 @@ const deserializeAws_restJson1ListSourceLocationsCommandError = async (output, c
2832
2076
  ...output,
2833
2077
  body: await parseBody(output.body, context),
2834
2078
  };
2835
- let response;
2836
2079
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2837
- switch (errorCode) {
2838
- default:
2839
- const parsedBody = parsedOutput.body;
2840
- const $metadata = deserializeMetadata(output);
2841
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2842
- response = new MediaTailorServiceException_1.MediaTailorServiceException({
2843
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2844
- $fault: "client",
2845
- $metadata,
2846
- });
2847
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2848
- }
2080
+ const parsedBody = parsedOutput.body;
2081
+ (0, smithy_client_1.throwDefaultError)({
2082
+ output,
2083
+ parsedBody,
2084
+ exceptionCtor: MediaTailorServiceException_1.MediaTailorServiceException,
2085
+ errorCode,
2086
+ });
2849
2087
  };
2850
2088
  const deserializeAws_restJson1ListTagsForResourceCommand = async (output, context) => {
2851
2089
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2852
2090
  return deserializeAws_restJson1ListTagsForResourceCommandError(output, context);
2853
2091
  }
2854
- const contents = {
2092
+ const contents = map({
2855
2093
  $metadata: deserializeMetadata(output),
2856
- Tags: undefined,
2857
- };
2094
+ });
2858
2095
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2859
- if (data.tags !== undefined && data.tags !== null) {
2096
+ if (data.tags != null) {
2860
2097
  contents.Tags = deserializeAws_restJson1__mapOf__string(data.tags, context);
2861
2098
  }
2862
- return Promise.resolve(contents);
2099
+ return contents;
2863
2100
  };
2864
2101
  exports.deserializeAws_restJson1ListTagsForResourceCommand = deserializeAws_restJson1ListTagsForResourceCommand;
2865
2102
  const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, context) => {
@@ -2867,7 +2104,6 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
2867
2104
  ...output,
2868
2105
  body: await parseBody(output.body, context),
2869
2106
  };
2870
- let response;
2871
2107
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2872
2108
  switch (errorCode) {
2873
2109
  case "BadRequestException":
@@ -2875,33 +2111,29 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
2875
2111
  throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
2876
2112
  default:
2877
2113
  const parsedBody = parsedOutput.body;
2878
- const $metadata = deserializeMetadata(output);
2879
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2880
- response = new MediaTailorServiceException_1.MediaTailorServiceException({
2881
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2882
- $fault: "client",
2883
- $metadata,
2114
+ (0, smithy_client_1.throwDefaultError)({
2115
+ output,
2116
+ parsedBody,
2117
+ exceptionCtor: MediaTailorServiceException_1.MediaTailorServiceException,
2118
+ errorCode,
2884
2119
  });
2885
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2886
2120
  }
2887
2121
  };
2888
2122
  const deserializeAws_restJson1ListVodSourcesCommand = async (output, context) => {
2889
2123
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2890
2124
  return deserializeAws_restJson1ListVodSourcesCommandError(output, context);
2891
2125
  }
2892
- const contents = {
2126
+ const contents = map({
2893
2127
  $metadata: deserializeMetadata(output),
2894
- Items: undefined,
2895
- NextToken: undefined,
2896
- };
2128
+ });
2897
2129
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2898
- if (data.Items !== undefined && data.Items !== null) {
2130
+ if (data.Items != null) {
2899
2131
  contents.Items = deserializeAws_restJson1__listOfVodSource(data.Items, context);
2900
2132
  }
2901
- if (data.NextToken !== undefined && data.NextToken !== null) {
2133
+ if (data.NextToken != null) {
2902
2134
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
2903
2135
  }
2904
- return Promise.resolve(contents);
2136
+ return contents;
2905
2137
  };
2906
2138
  exports.deserializeAws_restJson1ListVodSourcesCommand = deserializeAws_restJson1ListVodSourcesCommand;
2907
2139
  const deserializeAws_restJson1ListVodSourcesCommandError = async (output, context) => {
@@ -2909,30 +2141,24 @@ const deserializeAws_restJson1ListVodSourcesCommandError = async (output, contex
2909
2141
  ...output,
2910
2142
  body: await parseBody(output.body, context),
2911
2143
  };
2912
- let response;
2913
2144
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2914
- switch (errorCode) {
2915
- default:
2916
- const parsedBody = parsedOutput.body;
2917
- const $metadata = deserializeMetadata(output);
2918
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2919
- response = new MediaTailorServiceException_1.MediaTailorServiceException({
2920
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2921
- $fault: "client",
2922
- $metadata,
2923
- });
2924
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2925
- }
2145
+ const parsedBody = parsedOutput.body;
2146
+ (0, smithy_client_1.throwDefaultError)({
2147
+ output,
2148
+ parsedBody,
2149
+ exceptionCtor: MediaTailorServiceException_1.MediaTailorServiceException,
2150
+ errorCode,
2151
+ });
2926
2152
  };
2927
2153
  const deserializeAws_restJson1PutChannelPolicyCommand = async (output, context) => {
2928
2154
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2929
2155
  return deserializeAws_restJson1PutChannelPolicyCommandError(output, context);
2930
2156
  }
2931
- const contents = {
2157
+ const contents = map({
2932
2158
  $metadata: deserializeMetadata(output),
2933
- };
2159
+ });
2934
2160
  await collectBody(output.body, context);
2935
- return Promise.resolve(contents);
2161
+ return contents;
2936
2162
  };
2937
2163
  exports.deserializeAws_restJson1PutChannelPolicyCommand = deserializeAws_restJson1PutChannelPolicyCommand;
2938
2164
  const deserializeAws_restJson1PutChannelPolicyCommandError = async (output, context) => {
@@ -2940,106 +2166,81 @@ const deserializeAws_restJson1PutChannelPolicyCommandError = async (output, cont
2940
2166
  ...output,
2941
2167
  body: await parseBody(output.body, context),
2942
2168
  };
2943
- let response;
2944
2169
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2945
- switch (errorCode) {
2946
- default:
2947
- const parsedBody = parsedOutput.body;
2948
- const $metadata = deserializeMetadata(output);
2949
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2950
- response = new MediaTailorServiceException_1.MediaTailorServiceException({
2951
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2952
- $fault: "client",
2953
- $metadata,
2954
- });
2955
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2956
- }
2170
+ const parsedBody = parsedOutput.body;
2171
+ (0, smithy_client_1.throwDefaultError)({
2172
+ output,
2173
+ parsedBody,
2174
+ exceptionCtor: MediaTailorServiceException_1.MediaTailorServiceException,
2175
+ errorCode,
2176
+ });
2957
2177
  };
2958
2178
  const deserializeAws_restJson1PutPlaybackConfigurationCommand = async (output, context) => {
2959
2179
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2960
2180
  return deserializeAws_restJson1PutPlaybackConfigurationCommandError(output, context);
2961
2181
  }
2962
- const contents = {
2182
+ const contents = map({
2963
2183
  $metadata: deserializeMetadata(output),
2964
- AdDecisionServerUrl: undefined,
2965
- AvailSuppression: undefined,
2966
- Bumper: undefined,
2967
- CdnConfiguration: undefined,
2968
- ConfigurationAliases: undefined,
2969
- DashConfiguration: undefined,
2970
- HlsConfiguration: undefined,
2971
- LivePreRollConfiguration: undefined,
2972
- LogConfiguration: undefined,
2973
- ManifestProcessingRules: undefined,
2974
- Name: undefined,
2975
- PersonalizationThresholdSeconds: undefined,
2976
- PlaybackConfigurationArn: undefined,
2977
- PlaybackEndpointPrefix: undefined,
2978
- SessionInitializationEndpointPrefix: undefined,
2979
- SlateAdUrl: undefined,
2980
- Tags: undefined,
2981
- TranscodeProfileName: undefined,
2982
- VideoContentSourceUrl: undefined,
2983
- };
2184
+ });
2984
2185
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2985
- if (data.AdDecisionServerUrl !== undefined && data.AdDecisionServerUrl !== null) {
2186
+ if (data.AdDecisionServerUrl != null) {
2986
2187
  contents.AdDecisionServerUrl = (0, smithy_client_1.expectString)(data.AdDecisionServerUrl);
2987
2188
  }
2988
- if (data.AvailSuppression !== undefined && data.AvailSuppression !== null) {
2189
+ if (data.AvailSuppression != null) {
2989
2190
  contents.AvailSuppression = deserializeAws_restJson1AvailSuppression(data.AvailSuppression, context);
2990
2191
  }
2991
- if (data.Bumper !== undefined && data.Bumper !== null) {
2192
+ if (data.Bumper != null) {
2992
2193
  contents.Bumper = deserializeAws_restJson1Bumper(data.Bumper, context);
2993
2194
  }
2994
- if (data.CdnConfiguration !== undefined && data.CdnConfiguration !== null) {
2195
+ if (data.CdnConfiguration != null) {
2995
2196
  contents.CdnConfiguration = deserializeAws_restJson1CdnConfiguration(data.CdnConfiguration, context);
2996
2197
  }
2997
- if (data.ConfigurationAliases !== undefined && data.ConfigurationAliases !== null) {
2198
+ if (data.ConfigurationAliases != null) {
2998
2199
  contents.ConfigurationAliases = deserializeAws_restJson1ConfigurationAliasesResponse(data.ConfigurationAliases, context);
2999
2200
  }
3000
- if (data.DashConfiguration !== undefined && data.DashConfiguration !== null) {
2201
+ if (data.DashConfiguration != null) {
3001
2202
  contents.DashConfiguration = deserializeAws_restJson1DashConfiguration(data.DashConfiguration, context);
3002
2203
  }
3003
- if (data.HlsConfiguration !== undefined && data.HlsConfiguration !== null) {
2204
+ if (data.HlsConfiguration != null) {
3004
2205
  contents.HlsConfiguration = deserializeAws_restJson1HlsConfiguration(data.HlsConfiguration, context);
3005
2206
  }
3006
- if (data.LivePreRollConfiguration !== undefined && data.LivePreRollConfiguration !== null) {
2207
+ if (data.LivePreRollConfiguration != null) {
3007
2208
  contents.LivePreRollConfiguration = deserializeAws_restJson1LivePreRollConfiguration(data.LivePreRollConfiguration, context);
3008
2209
  }
3009
- if (data.LogConfiguration !== undefined && data.LogConfiguration !== null) {
2210
+ if (data.LogConfiguration != null) {
3010
2211
  contents.LogConfiguration = deserializeAws_restJson1LogConfiguration(data.LogConfiguration, context);
3011
2212
  }
3012
- if (data.ManifestProcessingRules !== undefined && data.ManifestProcessingRules !== null) {
2213
+ if (data.ManifestProcessingRules != null) {
3013
2214
  contents.ManifestProcessingRules = deserializeAws_restJson1ManifestProcessingRules(data.ManifestProcessingRules, context);
3014
2215
  }
3015
- if (data.Name !== undefined && data.Name !== null) {
2216
+ if (data.Name != null) {
3016
2217
  contents.Name = (0, smithy_client_1.expectString)(data.Name);
3017
2218
  }
3018
- if (data.PersonalizationThresholdSeconds !== undefined && data.PersonalizationThresholdSeconds !== null) {
2219
+ if (data.PersonalizationThresholdSeconds != null) {
3019
2220
  contents.PersonalizationThresholdSeconds = (0, smithy_client_1.expectInt32)(data.PersonalizationThresholdSeconds);
3020
2221
  }
3021
- if (data.PlaybackConfigurationArn !== undefined && data.PlaybackConfigurationArn !== null) {
2222
+ if (data.PlaybackConfigurationArn != null) {
3022
2223
  contents.PlaybackConfigurationArn = (0, smithy_client_1.expectString)(data.PlaybackConfigurationArn);
3023
2224
  }
3024
- if (data.PlaybackEndpointPrefix !== undefined && data.PlaybackEndpointPrefix !== null) {
2225
+ if (data.PlaybackEndpointPrefix != null) {
3025
2226
  contents.PlaybackEndpointPrefix = (0, smithy_client_1.expectString)(data.PlaybackEndpointPrefix);
3026
2227
  }
3027
- if (data.SessionInitializationEndpointPrefix !== undefined && data.SessionInitializationEndpointPrefix !== null) {
2228
+ if (data.SessionInitializationEndpointPrefix != null) {
3028
2229
  contents.SessionInitializationEndpointPrefix = (0, smithy_client_1.expectString)(data.SessionInitializationEndpointPrefix);
3029
2230
  }
3030
- if (data.SlateAdUrl !== undefined && data.SlateAdUrl !== null) {
2231
+ if (data.SlateAdUrl != null) {
3031
2232
  contents.SlateAdUrl = (0, smithy_client_1.expectString)(data.SlateAdUrl);
3032
2233
  }
3033
- if (data.tags !== undefined && data.tags !== null) {
2234
+ if (data.tags != null) {
3034
2235
  contents.Tags = deserializeAws_restJson1__mapOf__string(data.tags, context);
3035
2236
  }
3036
- if (data.TranscodeProfileName !== undefined && data.TranscodeProfileName !== null) {
2237
+ if (data.TranscodeProfileName != null) {
3037
2238
  contents.TranscodeProfileName = (0, smithy_client_1.expectString)(data.TranscodeProfileName);
3038
2239
  }
3039
- if (data.VideoContentSourceUrl !== undefined && data.VideoContentSourceUrl !== null) {
2240
+ if (data.VideoContentSourceUrl != null) {
3040
2241
  contents.VideoContentSourceUrl = (0, smithy_client_1.expectString)(data.VideoContentSourceUrl);
3041
2242
  }
3042
- return Promise.resolve(contents);
2243
+ return contents;
3043
2244
  };
3044
2245
  exports.deserializeAws_restJson1PutPlaybackConfigurationCommand = deserializeAws_restJson1PutPlaybackConfigurationCommand;
3045
2246
  const deserializeAws_restJson1PutPlaybackConfigurationCommandError = async (output, context) => {
@@ -3047,30 +2248,24 @@ const deserializeAws_restJson1PutPlaybackConfigurationCommandError = async (outp
3047
2248
  ...output,
3048
2249
  body: await parseBody(output.body, context),
3049
2250
  };
3050
- let response;
3051
2251
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3052
- switch (errorCode) {
3053
- default:
3054
- const parsedBody = parsedOutput.body;
3055
- const $metadata = deserializeMetadata(output);
3056
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3057
- response = new MediaTailorServiceException_1.MediaTailorServiceException({
3058
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3059
- $fault: "client",
3060
- $metadata,
3061
- });
3062
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3063
- }
2252
+ const parsedBody = parsedOutput.body;
2253
+ (0, smithy_client_1.throwDefaultError)({
2254
+ output,
2255
+ parsedBody,
2256
+ exceptionCtor: MediaTailorServiceException_1.MediaTailorServiceException,
2257
+ errorCode,
2258
+ });
3064
2259
  };
3065
2260
  const deserializeAws_restJson1StartChannelCommand = async (output, context) => {
3066
2261
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3067
2262
  return deserializeAws_restJson1StartChannelCommandError(output, context);
3068
2263
  }
3069
- const contents = {
2264
+ const contents = map({
3070
2265
  $metadata: deserializeMetadata(output),
3071
- };
2266
+ });
3072
2267
  await collectBody(output.body, context);
3073
- return Promise.resolve(contents);
2268
+ return contents;
3074
2269
  };
3075
2270
  exports.deserializeAws_restJson1StartChannelCommand = deserializeAws_restJson1StartChannelCommand;
3076
2271
  const deserializeAws_restJson1StartChannelCommandError = async (output, context) => {
@@ -3078,30 +2273,24 @@ const deserializeAws_restJson1StartChannelCommandError = async (output, context)
3078
2273
  ...output,
3079
2274
  body: await parseBody(output.body, context),
3080
2275
  };
3081
- let response;
3082
2276
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3083
- switch (errorCode) {
3084
- default:
3085
- const parsedBody = parsedOutput.body;
3086
- const $metadata = deserializeMetadata(output);
3087
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3088
- response = new MediaTailorServiceException_1.MediaTailorServiceException({
3089
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3090
- $fault: "client",
3091
- $metadata,
3092
- });
3093
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3094
- }
2277
+ const parsedBody = parsedOutput.body;
2278
+ (0, smithy_client_1.throwDefaultError)({
2279
+ output,
2280
+ parsedBody,
2281
+ exceptionCtor: MediaTailorServiceException_1.MediaTailorServiceException,
2282
+ errorCode,
2283
+ });
3095
2284
  };
3096
2285
  const deserializeAws_restJson1StopChannelCommand = async (output, context) => {
3097
2286
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3098
2287
  return deserializeAws_restJson1StopChannelCommandError(output, context);
3099
2288
  }
3100
- const contents = {
2289
+ const contents = map({
3101
2290
  $metadata: deserializeMetadata(output),
3102
- };
2291
+ });
3103
2292
  await collectBody(output.body, context);
3104
- return Promise.resolve(contents);
2293
+ return contents;
3105
2294
  };
3106
2295
  exports.deserializeAws_restJson1StopChannelCommand = deserializeAws_restJson1StopChannelCommand;
3107
2296
  const deserializeAws_restJson1StopChannelCommandError = async (output, context) => {
@@ -3109,30 +2298,24 @@ const deserializeAws_restJson1StopChannelCommandError = async (output, context)
3109
2298
  ...output,
3110
2299
  body: await parseBody(output.body, context),
3111
2300
  };
3112
- let response;
3113
2301
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3114
- switch (errorCode) {
3115
- default:
3116
- const parsedBody = parsedOutput.body;
3117
- const $metadata = deserializeMetadata(output);
3118
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3119
- response = new MediaTailorServiceException_1.MediaTailorServiceException({
3120
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3121
- $fault: "client",
3122
- $metadata,
3123
- });
3124
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3125
- }
2302
+ const parsedBody = parsedOutput.body;
2303
+ (0, smithy_client_1.throwDefaultError)({
2304
+ output,
2305
+ parsedBody,
2306
+ exceptionCtor: MediaTailorServiceException_1.MediaTailorServiceException,
2307
+ errorCode,
2308
+ });
3126
2309
  };
3127
2310
  const deserializeAws_restJson1TagResourceCommand = async (output, context) => {
3128
2311
  if (output.statusCode !== 204 && output.statusCode >= 300) {
3129
2312
  return deserializeAws_restJson1TagResourceCommandError(output, context);
3130
2313
  }
3131
- const contents = {
2314
+ const contents = map({
3132
2315
  $metadata: deserializeMetadata(output),
3133
- };
2316
+ });
3134
2317
  await collectBody(output.body, context);
3135
- return Promise.resolve(contents);
2318
+ return contents;
3136
2319
  };
3137
2320
  exports.deserializeAws_restJson1TagResourceCommand = deserializeAws_restJson1TagResourceCommand;
3138
2321
  const deserializeAws_restJson1TagResourceCommandError = async (output, context) => {
@@ -3140,7 +2323,6 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
3140
2323
  ...output,
3141
2324
  body: await parseBody(output.body, context),
3142
2325
  };
3143
- let response;
3144
2326
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3145
2327
  switch (errorCode) {
3146
2328
  case "BadRequestException":
@@ -3148,25 +2330,23 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
3148
2330
  throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
3149
2331
  default:
3150
2332
  const parsedBody = parsedOutput.body;
3151
- const $metadata = deserializeMetadata(output);
3152
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3153
- response = new MediaTailorServiceException_1.MediaTailorServiceException({
3154
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3155
- $fault: "client",
3156
- $metadata,
2333
+ (0, smithy_client_1.throwDefaultError)({
2334
+ output,
2335
+ parsedBody,
2336
+ exceptionCtor: MediaTailorServiceException_1.MediaTailorServiceException,
2337
+ errorCode,
3157
2338
  });
3158
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3159
2339
  }
3160
2340
  };
3161
2341
  const deserializeAws_restJson1UntagResourceCommand = async (output, context) => {
3162
2342
  if (output.statusCode !== 204 && output.statusCode >= 300) {
3163
2343
  return deserializeAws_restJson1UntagResourceCommandError(output, context);
3164
2344
  }
3165
- const contents = {
2345
+ const contents = map({
3166
2346
  $metadata: deserializeMetadata(output),
3167
- };
2347
+ });
3168
2348
  await collectBody(output.body, context);
3169
- return Promise.resolve(contents);
2349
+ return contents;
3170
2350
  };
3171
2351
  exports.deserializeAws_restJson1UntagResourceCommand = deserializeAws_restJson1UntagResourceCommand;
3172
2352
  const deserializeAws_restJson1UntagResourceCommandError = async (output, context) => {
@@ -3174,7 +2354,6 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
3174
2354
  ...output,
3175
2355
  body: await parseBody(output.body, context),
3176
2356
  };
3177
- let response;
3178
2357
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3179
2358
  switch (errorCode) {
3180
2359
  case "BadRequestException":
@@ -3182,65 +2361,53 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
3182
2361
  throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
3183
2362
  default:
3184
2363
  const parsedBody = parsedOutput.body;
3185
- const $metadata = deserializeMetadata(output);
3186
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3187
- response = new MediaTailorServiceException_1.MediaTailorServiceException({
3188
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3189
- $fault: "client",
3190
- $metadata,
2364
+ (0, smithy_client_1.throwDefaultError)({
2365
+ output,
2366
+ parsedBody,
2367
+ exceptionCtor: MediaTailorServiceException_1.MediaTailorServiceException,
2368
+ errorCode,
3191
2369
  });
3192
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3193
2370
  }
3194
2371
  };
3195
2372
  const deserializeAws_restJson1UpdateChannelCommand = async (output, context) => {
3196
2373
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3197
2374
  return deserializeAws_restJson1UpdateChannelCommandError(output, context);
3198
2375
  }
3199
- const contents = {
2376
+ const contents = map({
3200
2377
  $metadata: deserializeMetadata(output),
3201
- Arn: undefined,
3202
- ChannelName: undefined,
3203
- ChannelState: undefined,
3204
- CreationTime: undefined,
3205
- FillerSlate: undefined,
3206
- LastModifiedTime: undefined,
3207
- Outputs: undefined,
3208
- PlaybackMode: undefined,
3209
- Tags: undefined,
3210
- Tier: undefined,
3211
- };
2378
+ });
3212
2379
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3213
- if (data.Arn !== undefined && data.Arn !== null) {
2380
+ if (data.Arn != null) {
3214
2381
  contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
3215
2382
  }
3216
- if (data.ChannelName !== undefined && data.ChannelName !== null) {
2383
+ if (data.ChannelName != null) {
3217
2384
  contents.ChannelName = (0, smithy_client_1.expectString)(data.ChannelName);
3218
2385
  }
3219
- if (data.ChannelState !== undefined && data.ChannelState !== null) {
2386
+ if (data.ChannelState != null) {
3220
2387
  contents.ChannelState = (0, smithy_client_1.expectString)(data.ChannelState);
3221
2388
  }
3222
- if (data.CreationTime !== undefined && data.CreationTime !== null) {
2389
+ if (data.CreationTime != null) {
3223
2390
  contents.CreationTime = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(data.CreationTime)));
3224
2391
  }
3225
- if (data.FillerSlate !== undefined && data.FillerSlate !== null) {
2392
+ if (data.FillerSlate != null) {
3226
2393
  contents.FillerSlate = deserializeAws_restJson1SlateSource(data.FillerSlate, context);
3227
2394
  }
3228
- if (data.LastModifiedTime !== undefined && data.LastModifiedTime !== null) {
2395
+ if (data.LastModifiedTime != null) {
3229
2396
  contents.LastModifiedTime = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(data.LastModifiedTime)));
3230
2397
  }
3231
- if (data.Outputs !== undefined && data.Outputs !== null) {
2398
+ if (data.Outputs != null) {
3232
2399
  contents.Outputs = deserializeAws_restJson1ResponseOutputs(data.Outputs, context);
3233
2400
  }
3234
- if (data.PlaybackMode !== undefined && data.PlaybackMode !== null) {
2401
+ if (data.PlaybackMode != null) {
3235
2402
  contents.PlaybackMode = (0, smithy_client_1.expectString)(data.PlaybackMode);
3236
2403
  }
3237
- if (data.tags !== undefined && data.tags !== null) {
2404
+ if (data.tags != null) {
3238
2405
  contents.Tags = deserializeAws_restJson1__mapOf__string(data.tags, context);
3239
2406
  }
3240
- if (data.Tier !== undefined && data.Tier !== null) {
2407
+ if (data.Tier != null) {
3241
2408
  contents.Tier = (0, smithy_client_1.expectString)(data.Tier);
3242
2409
  }
3243
- return Promise.resolve(contents);
2410
+ return contents;
3244
2411
  };
3245
2412
  exports.deserializeAws_restJson1UpdateChannelCommand = deserializeAws_restJson1UpdateChannelCommand;
3246
2413
  const deserializeAws_restJson1UpdateChannelCommandError = async (output, context) => {
@@ -3248,58 +2415,45 @@ const deserializeAws_restJson1UpdateChannelCommandError = async (output, context
3248
2415
  ...output,
3249
2416
  body: await parseBody(output.body, context),
3250
2417
  };
3251
- let response;
3252
2418
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3253
- switch (errorCode) {
3254
- default:
3255
- const parsedBody = parsedOutput.body;
3256
- const $metadata = deserializeMetadata(output);
3257
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3258
- response = new MediaTailorServiceException_1.MediaTailorServiceException({
3259
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3260
- $fault: "client",
3261
- $metadata,
3262
- });
3263
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3264
- }
2419
+ const parsedBody = parsedOutput.body;
2420
+ (0, smithy_client_1.throwDefaultError)({
2421
+ output,
2422
+ parsedBody,
2423
+ exceptionCtor: MediaTailorServiceException_1.MediaTailorServiceException,
2424
+ errorCode,
2425
+ });
3265
2426
  };
3266
2427
  const deserializeAws_restJson1UpdateLiveSourceCommand = async (output, context) => {
3267
2428
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3268
2429
  return deserializeAws_restJson1UpdateLiveSourceCommandError(output, context);
3269
2430
  }
3270
- const contents = {
2431
+ const contents = map({
3271
2432
  $metadata: deserializeMetadata(output),
3272
- Arn: undefined,
3273
- CreationTime: undefined,
3274
- HttpPackageConfigurations: undefined,
3275
- LastModifiedTime: undefined,
3276
- LiveSourceName: undefined,
3277
- SourceLocationName: undefined,
3278
- Tags: undefined,
3279
- };
2433
+ });
3280
2434
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3281
- if (data.Arn !== undefined && data.Arn !== null) {
2435
+ if (data.Arn != null) {
3282
2436
  contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
3283
2437
  }
3284
- if (data.CreationTime !== undefined && data.CreationTime !== null) {
2438
+ if (data.CreationTime != null) {
3285
2439
  contents.CreationTime = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(data.CreationTime)));
3286
2440
  }
3287
- if (data.HttpPackageConfigurations !== undefined && data.HttpPackageConfigurations !== null) {
2441
+ if (data.HttpPackageConfigurations != null) {
3288
2442
  contents.HttpPackageConfigurations = deserializeAws_restJson1HttpPackageConfigurations(data.HttpPackageConfigurations, context);
3289
2443
  }
3290
- if (data.LastModifiedTime !== undefined && data.LastModifiedTime !== null) {
2444
+ if (data.LastModifiedTime != null) {
3291
2445
  contents.LastModifiedTime = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(data.LastModifiedTime)));
3292
2446
  }
3293
- if (data.LiveSourceName !== undefined && data.LiveSourceName !== null) {
2447
+ if (data.LiveSourceName != null) {
3294
2448
  contents.LiveSourceName = (0, smithy_client_1.expectString)(data.LiveSourceName);
3295
2449
  }
3296
- if (data.SourceLocationName !== undefined && data.SourceLocationName !== null) {
2450
+ if (data.SourceLocationName != null) {
3297
2451
  contents.SourceLocationName = (0, smithy_client_1.expectString)(data.SourceLocationName);
3298
2452
  }
3299
- if (data.tags !== undefined && data.tags !== null) {
2453
+ if (data.tags != null) {
3300
2454
  contents.Tags = deserializeAws_restJson1__mapOf__string(data.tags, context);
3301
2455
  }
3302
- return Promise.resolve(contents);
2456
+ return contents;
3303
2457
  };
3304
2458
  exports.deserializeAws_restJson1UpdateLiveSourceCommand = deserializeAws_restJson1UpdateLiveSourceCommand;
3305
2459
  const deserializeAws_restJson1UpdateLiveSourceCommandError = async (output, context) => {
@@ -3307,66 +2461,51 @@ const deserializeAws_restJson1UpdateLiveSourceCommandError = async (output, cont
3307
2461
  ...output,
3308
2462
  body: await parseBody(output.body, context),
3309
2463
  };
3310
- let response;
3311
2464
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3312
- switch (errorCode) {
3313
- default:
3314
- const parsedBody = parsedOutput.body;
3315
- const $metadata = deserializeMetadata(output);
3316
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3317
- response = new MediaTailorServiceException_1.MediaTailorServiceException({
3318
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3319
- $fault: "client",
3320
- $metadata,
3321
- });
3322
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3323
- }
2465
+ const parsedBody = parsedOutput.body;
2466
+ (0, smithy_client_1.throwDefaultError)({
2467
+ output,
2468
+ parsedBody,
2469
+ exceptionCtor: MediaTailorServiceException_1.MediaTailorServiceException,
2470
+ errorCode,
2471
+ });
3324
2472
  };
3325
2473
  const deserializeAws_restJson1UpdateSourceLocationCommand = async (output, context) => {
3326
2474
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3327
2475
  return deserializeAws_restJson1UpdateSourceLocationCommandError(output, context);
3328
2476
  }
3329
- const contents = {
2477
+ const contents = map({
3330
2478
  $metadata: deserializeMetadata(output),
3331
- AccessConfiguration: undefined,
3332
- Arn: undefined,
3333
- CreationTime: undefined,
3334
- DefaultSegmentDeliveryConfiguration: undefined,
3335
- HttpConfiguration: undefined,
3336
- LastModifiedTime: undefined,
3337
- SegmentDeliveryConfigurations: undefined,
3338
- SourceLocationName: undefined,
3339
- Tags: undefined,
3340
- };
2479
+ });
3341
2480
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3342
- if (data.AccessConfiguration !== undefined && data.AccessConfiguration !== null) {
2481
+ if (data.AccessConfiguration != null) {
3343
2482
  contents.AccessConfiguration = deserializeAws_restJson1AccessConfiguration(data.AccessConfiguration, context);
3344
2483
  }
3345
- if (data.Arn !== undefined && data.Arn !== null) {
2484
+ if (data.Arn != null) {
3346
2485
  contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
3347
2486
  }
3348
- if (data.CreationTime !== undefined && data.CreationTime !== null) {
2487
+ if (data.CreationTime != null) {
3349
2488
  contents.CreationTime = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(data.CreationTime)));
3350
2489
  }
3351
- if (data.DefaultSegmentDeliveryConfiguration !== undefined && data.DefaultSegmentDeliveryConfiguration !== null) {
2490
+ if (data.DefaultSegmentDeliveryConfiguration != null) {
3352
2491
  contents.DefaultSegmentDeliveryConfiguration = deserializeAws_restJson1DefaultSegmentDeliveryConfiguration(data.DefaultSegmentDeliveryConfiguration, context);
3353
2492
  }
3354
- if (data.HttpConfiguration !== undefined && data.HttpConfiguration !== null) {
2493
+ if (data.HttpConfiguration != null) {
3355
2494
  contents.HttpConfiguration = deserializeAws_restJson1HttpConfiguration(data.HttpConfiguration, context);
3356
2495
  }
3357
- if (data.LastModifiedTime !== undefined && data.LastModifiedTime !== null) {
2496
+ if (data.LastModifiedTime != null) {
3358
2497
  contents.LastModifiedTime = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(data.LastModifiedTime)));
3359
2498
  }
3360
- if (data.SegmentDeliveryConfigurations !== undefined && data.SegmentDeliveryConfigurations !== null) {
2499
+ if (data.SegmentDeliveryConfigurations != null) {
3361
2500
  contents.SegmentDeliveryConfigurations = deserializeAws_restJson1__listOfSegmentDeliveryConfiguration(data.SegmentDeliveryConfigurations, context);
3362
2501
  }
3363
- if (data.SourceLocationName !== undefined && data.SourceLocationName !== null) {
2502
+ if (data.SourceLocationName != null) {
3364
2503
  contents.SourceLocationName = (0, smithy_client_1.expectString)(data.SourceLocationName);
3365
2504
  }
3366
- if (data.tags !== undefined && data.tags !== null) {
2505
+ if (data.tags != null) {
3367
2506
  contents.Tags = deserializeAws_restJson1__mapOf__string(data.tags, context);
3368
2507
  }
3369
- return Promise.resolve(contents);
2508
+ return contents;
3370
2509
  };
3371
2510
  exports.deserializeAws_restJson1UpdateSourceLocationCommand = deserializeAws_restJson1UpdateSourceLocationCommand;
3372
2511
  const deserializeAws_restJson1UpdateSourceLocationCommandError = async (output, context) => {
@@ -3374,58 +2513,45 @@ const deserializeAws_restJson1UpdateSourceLocationCommandError = async (output,
3374
2513
  ...output,
3375
2514
  body: await parseBody(output.body, context),
3376
2515
  };
3377
- let response;
3378
2516
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3379
- switch (errorCode) {
3380
- default:
3381
- const parsedBody = parsedOutput.body;
3382
- const $metadata = deserializeMetadata(output);
3383
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3384
- response = new MediaTailorServiceException_1.MediaTailorServiceException({
3385
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3386
- $fault: "client",
3387
- $metadata,
3388
- });
3389
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3390
- }
2517
+ const parsedBody = parsedOutput.body;
2518
+ (0, smithy_client_1.throwDefaultError)({
2519
+ output,
2520
+ parsedBody,
2521
+ exceptionCtor: MediaTailorServiceException_1.MediaTailorServiceException,
2522
+ errorCode,
2523
+ });
3391
2524
  };
3392
2525
  const deserializeAws_restJson1UpdateVodSourceCommand = async (output, context) => {
3393
2526
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3394
2527
  return deserializeAws_restJson1UpdateVodSourceCommandError(output, context);
3395
2528
  }
3396
- const contents = {
2529
+ const contents = map({
3397
2530
  $metadata: deserializeMetadata(output),
3398
- Arn: undefined,
3399
- CreationTime: undefined,
3400
- HttpPackageConfigurations: undefined,
3401
- LastModifiedTime: undefined,
3402
- SourceLocationName: undefined,
3403
- Tags: undefined,
3404
- VodSourceName: undefined,
3405
- };
2531
+ });
3406
2532
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3407
- if (data.Arn !== undefined && data.Arn !== null) {
2533
+ if (data.Arn != null) {
3408
2534
  contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
3409
2535
  }
3410
- if (data.CreationTime !== undefined && data.CreationTime !== null) {
2536
+ if (data.CreationTime != null) {
3411
2537
  contents.CreationTime = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(data.CreationTime)));
3412
2538
  }
3413
- if (data.HttpPackageConfigurations !== undefined && data.HttpPackageConfigurations !== null) {
2539
+ if (data.HttpPackageConfigurations != null) {
3414
2540
  contents.HttpPackageConfigurations = deserializeAws_restJson1HttpPackageConfigurations(data.HttpPackageConfigurations, context);
3415
2541
  }
3416
- if (data.LastModifiedTime !== undefined && data.LastModifiedTime !== null) {
2542
+ if (data.LastModifiedTime != null) {
3417
2543
  contents.LastModifiedTime = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(data.LastModifiedTime)));
3418
2544
  }
3419
- if (data.SourceLocationName !== undefined && data.SourceLocationName !== null) {
2545
+ if (data.SourceLocationName != null) {
3420
2546
  contents.SourceLocationName = (0, smithy_client_1.expectString)(data.SourceLocationName);
3421
2547
  }
3422
- if (data.tags !== undefined && data.tags !== null) {
2548
+ if (data.tags != null) {
3423
2549
  contents.Tags = deserializeAws_restJson1__mapOf__string(data.tags, context);
3424
2550
  }
3425
- if (data.VodSourceName !== undefined && data.VodSourceName !== null) {
2551
+ if (data.VodSourceName != null) {
3426
2552
  contents.VodSourceName = (0, smithy_client_1.expectString)(data.VodSourceName);
3427
2553
  }
3428
- return Promise.resolve(contents);
2554
+ return contents;
3429
2555
  };
3430
2556
  exports.deserializeAws_restJson1UpdateVodSourceCommand = deserializeAws_restJson1UpdateVodSourceCommand;
3431
2557
  const deserializeAws_restJson1UpdateVodSourceCommandError = async (output, context) => {
@@ -3433,25 +2559,20 @@ const deserializeAws_restJson1UpdateVodSourceCommandError = async (output, conte
3433
2559
  ...output,
3434
2560
  body: await parseBody(output.body, context),
3435
2561
  };
3436
- let response;
3437
2562
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3438
- switch (errorCode) {
3439
- default:
3440
- const parsedBody = parsedOutput.body;
3441
- const $metadata = deserializeMetadata(output);
3442
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3443
- response = new MediaTailorServiceException_1.MediaTailorServiceException({
3444
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3445
- $fault: "client",
3446
- $metadata,
3447
- });
3448
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3449
- }
2563
+ const parsedBody = parsedOutput.body;
2564
+ (0, smithy_client_1.throwDefaultError)({
2565
+ output,
2566
+ parsedBody,
2567
+ exceptionCtor: MediaTailorServiceException_1.MediaTailorServiceException,
2568
+ errorCode,
2569
+ });
3450
2570
  };
2571
+ const map = smithy_client_1.map;
3451
2572
  const deserializeAws_restJson1BadRequestExceptionResponse = async (parsedOutput, context) => {
3452
- const contents = {};
2573
+ const contents = map({});
3453
2574
  const data = parsedOutput.body;
3454
- if (data.Message !== undefined && data.Message !== null) {
2575
+ if (data.Message != null) {
3455
2576
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
3456
2577
  }
3457
2578
  const exception = new models_0_1.BadRequestException({
@@ -3464,9 +2585,6 @@ const serializeAws_restJson1__listOfAdBreak = (input, context) => {
3464
2585
  return input
3465
2586
  .filter((e) => e != null)
3466
2587
  .map((entry) => {
3467
- if (entry === null) {
3468
- return null;
3469
- }
3470
2588
  return serializeAws_restJson1AdBreak(entry, context);
3471
2589
  });
3472
2590
  };
@@ -3474,9 +2592,6 @@ const serializeAws_restJson1__listOfAvailMatchingCriteria = (input, context) =>
3474
2592
  return input
3475
2593
  .filter((e) => e != null)
3476
2594
  .map((entry) => {
3477
- if (entry === null) {
3478
- return null;
3479
- }
3480
2595
  return serializeAws_restJson1AvailMatchingCriteria(entry, context);
3481
2596
  });
3482
2597
  };
@@ -3484,9 +2599,6 @@ const serializeAws_restJson1__listOfSegmentDeliveryConfiguration = (input, conte
3484
2599
  return input
3485
2600
  .filter((e) => e != null)
3486
2601
  .map((entry) => {
3487
- if (entry === null) {
3488
- return null;
3489
- }
3490
2602
  return serializeAws_restJson1SegmentDeliveryConfiguration(entry, context);
3491
2603
  });
3492
2604
  };
@@ -3601,9 +2713,6 @@ const serializeAws_restJson1HttpPackageConfigurations = (input, context) => {
3601
2713
  return input
3602
2714
  .filter((e) => e != null)
3603
2715
  .map((entry) => {
3604
- if (entry === null) {
3605
- return null;
3606
- }
3607
2716
  return serializeAws_restJson1HttpPackageConfiguration(entry, context);
3608
2717
  });
3609
2718
  };
@@ -3654,9 +2763,6 @@ const serializeAws_restJson1RequestOutputs = (input, context) => {
3654
2763
  return input
3655
2764
  .filter((e) => e != null)
3656
2765
  .map((entry) => {
3657
- if (entry === null) {
3658
- return null;
3659
- }
3660
2766
  return serializeAws_restJson1RequestOutputItem(entry, context);
3661
2767
  });
3662
2768
  };