@aws-sdk/client-kafka 3.137.0 → 3.145.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,16 +12,7 @@ const serializeAws_restJson1BatchAssociateScramSecretCommand = async (input, con
12
12
  "content-type": "application/json",
13
13
  };
14
14
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/clusters/{ClusterArn}/scram-secrets";
15
- if (input.ClusterArn !== undefined) {
16
- const labelValue = input.ClusterArn;
17
- if (labelValue.length <= 0) {
18
- throw new Error("Empty value provided for input HTTP label: ClusterArn.");
19
- }
20
- resolvedPath = resolvedPath.replace("{ClusterArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
21
- }
22
- else {
23
- throw new Error("No value provided for input HTTP label: ClusterArn.");
24
- }
15
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ClusterArn", () => input.ClusterArn, "{ClusterArn}", false);
25
16
  let body;
26
17
  body = JSON.stringify({
27
18
  ...(input.SecretArnList != null && {
@@ -45,16 +36,7 @@ const serializeAws_restJson1BatchDisassociateScramSecretCommand = async (input,
45
36
  "content-type": "application/json",
46
37
  };
47
38
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/clusters/{ClusterArn}/scram-secrets";
48
- if (input.ClusterArn !== undefined) {
49
- const labelValue = input.ClusterArn;
50
- if (labelValue.length <= 0) {
51
- throw new Error("Empty value provided for input HTTP label: ClusterArn.");
52
- }
53
- resolvedPath = resolvedPath.replace("{ClusterArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
54
- }
55
- else {
56
- throw new Error("No value provided for input HTTP label: ClusterArn.");
57
- }
39
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ClusterArn", () => input.ClusterArn, "{ClusterArn}", false);
58
40
  let body;
59
41
  body = JSON.stringify({
60
42
  ...(input.SecretArnList != null && {
@@ -169,19 +151,10 @@ const serializeAws_restJson1DeleteClusterCommand = async (input, context) => {
169
151
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
170
152
  const headers = {};
171
153
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/clusters/{ClusterArn}";
172
- if (input.ClusterArn !== undefined) {
173
- const labelValue = input.ClusterArn;
174
- if (labelValue.length <= 0) {
175
- throw new Error("Empty value provided for input HTTP label: ClusterArn.");
176
- }
177
- resolvedPath = resolvedPath.replace("{ClusterArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
178
- }
179
- else {
180
- throw new Error("No value provided for input HTTP label: ClusterArn.");
181
- }
182
- const query = {
183
- ...(input.CurrentVersion !== undefined && { currentVersion: input.CurrentVersion }),
184
- };
154
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ClusterArn", () => input.ClusterArn, "{ClusterArn}", false);
155
+ const query = map({
156
+ currentVersion: [, input.CurrentVersion],
157
+ });
185
158
  let body;
186
159
  return new protocol_http_1.HttpRequest({
187
160
  protocol,
@@ -199,16 +172,7 @@ const serializeAws_restJson1DeleteConfigurationCommand = async (input, context)
199
172
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
200
173
  const headers = {};
201
174
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/configurations/{Arn}";
202
- if (input.Arn !== undefined) {
203
- const labelValue = input.Arn;
204
- if (labelValue.length <= 0) {
205
- throw new Error("Empty value provided for input HTTP label: Arn.");
206
- }
207
- resolvedPath = resolvedPath.replace("{Arn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
208
- }
209
- else {
210
- throw new Error("No value provided for input HTTP label: Arn.");
211
- }
175
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "Arn", () => input.Arn, "{Arn}", false);
212
176
  let body;
213
177
  return new protocol_http_1.HttpRequest({
214
178
  protocol,
@@ -225,16 +189,7 @@ const serializeAws_restJson1DescribeClusterCommand = async (input, context) => {
225
189
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
226
190
  const headers = {};
227
191
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/clusters/{ClusterArn}";
228
- if (input.ClusterArn !== undefined) {
229
- const labelValue = input.ClusterArn;
230
- if (labelValue.length <= 0) {
231
- throw new Error("Empty value provided for input HTTP label: ClusterArn.");
232
- }
233
- resolvedPath = resolvedPath.replace("{ClusterArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
234
- }
235
- else {
236
- throw new Error("No value provided for input HTTP label: ClusterArn.");
237
- }
192
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ClusterArn", () => input.ClusterArn, "{ClusterArn}", false);
238
193
  let body;
239
194
  return new protocol_http_1.HttpRequest({
240
195
  protocol,
@@ -251,16 +206,7 @@ const serializeAws_restJson1DescribeClusterOperationCommand = async (input, cont
251
206
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
252
207
  const headers = {};
253
208
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/operations/{ClusterOperationArn}";
254
- if (input.ClusterOperationArn !== undefined) {
255
- const labelValue = input.ClusterOperationArn;
256
- if (labelValue.length <= 0) {
257
- throw new Error("Empty value provided for input HTTP label: ClusterOperationArn.");
258
- }
259
- resolvedPath = resolvedPath.replace("{ClusterOperationArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
260
- }
261
- else {
262
- throw new Error("No value provided for input HTTP label: ClusterOperationArn.");
263
- }
209
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ClusterOperationArn", () => input.ClusterOperationArn, "{ClusterOperationArn}", false);
264
210
  let body;
265
211
  return new protocol_http_1.HttpRequest({
266
212
  protocol,
@@ -277,16 +223,7 @@ const serializeAws_restJson1DescribeClusterV2Command = async (input, context) =>
277
223
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
278
224
  const headers = {};
279
225
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/api/v2/clusters/{ClusterArn}";
280
- if (input.ClusterArn !== undefined) {
281
- const labelValue = input.ClusterArn;
282
- if (labelValue.length <= 0) {
283
- throw new Error("Empty value provided for input HTTP label: ClusterArn.");
284
- }
285
- resolvedPath = resolvedPath.replace("{ClusterArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
286
- }
287
- else {
288
- throw new Error("No value provided for input HTTP label: ClusterArn.");
289
- }
226
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ClusterArn", () => input.ClusterArn, "{ClusterArn}", false);
290
227
  let body;
291
228
  return new protocol_http_1.HttpRequest({
292
229
  protocol,
@@ -303,16 +240,7 @@ const serializeAws_restJson1DescribeConfigurationCommand = async (input, context
303
240
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
304
241
  const headers = {};
305
242
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/configurations/{Arn}";
306
- if (input.Arn !== undefined) {
307
- const labelValue = input.Arn;
308
- if (labelValue.length <= 0) {
309
- throw new Error("Empty value provided for input HTTP label: Arn.");
310
- }
311
- resolvedPath = resolvedPath.replace("{Arn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
312
- }
313
- else {
314
- throw new Error("No value provided for input HTTP label: Arn.");
315
- }
243
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "Arn", () => input.Arn, "{Arn}", false);
316
244
  let body;
317
245
  return new protocol_http_1.HttpRequest({
318
246
  protocol,
@@ -330,26 +258,8 @@ const serializeAws_restJson1DescribeConfigurationRevisionCommand = async (input,
330
258
  const headers = {};
331
259
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
332
260
  "/v1/configurations/{Arn}/revisions/{Revision}";
333
- if (input.Arn !== undefined) {
334
- const labelValue = input.Arn;
335
- if (labelValue.length <= 0) {
336
- throw new Error("Empty value provided for input HTTP label: Arn.");
337
- }
338
- resolvedPath = resolvedPath.replace("{Arn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
339
- }
340
- else {
341
- throw new Error("No value provided for input HTTP label: Arn.");
342
- }
343
- if (input.Revision !== undefined) {
344
- const labelValue = input.Revision.toString();
345
- if (labelValue.length <= 0) {
346
- throw new Error("Empty value provided for input HTTP label: Revision.");
347
- }
348
- resolvedPath = resolvedPath.replace("{Revision}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
349
- }
350
- else {
351
- throw new Error("No value provided for input HTTP label: Revision.");
352
- }
261
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "Arn", () => input.Arn, "{Arn}", false);
262
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "Revision", () => input.Revision.toString(), "{Revision}", false);
353
263
  let body;
354
264
  return new protocol_http_1.HttpRequest({
355
265
  protocol,
@@ -367,16 +277,7 @@ const serializeAws_restJson1GetBootstrapBrokersCommand = async (input, context)
367
277
  const headers = {};
368
278
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
369
279
  "/v1/clusters/{ClusterArn}/bootstrap-brokers";
370
- if (input.ClusterArn !== undefined) {
371
- const labelValue = input.ClusterArn;
372
- if (labelValue.length <= 0) {
373
- throw new Error("Empty value provided for input HTTP label: ClusterArn.");
374
- }
375
- resolvedPath = resolvedPath.replace("{ClusterArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
376
- }
377
- else {
378
- throw new Error("No value provided for input HTTP label: ClusterArn.");
379
- }
280
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ClusterArn", () => input.ClusterArn, "{ClusterArn}", false);
380
281
  let body;
381
282
  return new protocol_http_1.HttpRequest({
382
283
  protocol,
@@ -393,9 +294,9 @@ const serializeAws_restJson1GetCompatibleKafkaVersionsCommand = async (input, co
393
294
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
394
295
  const headers = {};
395
296
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/compatible-kafka-versions";
396
- const query = {
397
- ...(input.ClusterArn !== undefined && { clusterArn: input.ClusterArn }),
398
- };
297
+ const query = map({
298
+ clusterArn: [, input.ClusterArn],
299
+ });
399
300
  let body;
400
301
  return new protocol_http_1.HttpRequest({
401
302
  protocol,
@@ -413,20 +314,11 @@ const serializeAws_restJson1ListClusterOperationsCommand = async (input, context
413
314
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
414
315
  const headers = {};
415
316
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/clusters/{ClusterArn}/operations";
416
- if (input.ClusterArn !== undefined) {
417
- const labelValue = input.ClusterArn;
418
- if (labelValue.length <= 0) {
419
- throw new Error("Empty value provided for input HTTP label: ClusterArn.");
420
- }
421
- resolvedPath = resolvedPath.replace("{ClusterArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
422
- }
423
- else {
424
- throw new Error("No value provided for input HTTP label: ClusterArn.");
425
- }
426
- const query = {
427
- ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }),
428
- ...(input.NextToken !== undefined && { nextToken: input.NextToken }),
429
- };
317
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ClusterArn", () => input.ClusterArn, "{ClusterArn}", false);
318
+ const query = map({
319
+ maxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
320
+ nextToken: [, input.NextToken],
321
+ });
430
322
  let body;
431
323
  return new protocol_http_1.HttpRequest({
432
324
  protocol,
@@ -444,11 +336,11 @@ const serializeAws_restJson1ListClustersCommand = async (input, context) => {
444
336
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
445
337
  const headers = {};
446
338
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/clusters";
447
- const query = {
448
- ...(input.ClusterNameFilter !== undefined && { clusterNameFilter: input.ClusterNameFilter }),
449
- ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }),
450
- ...(input.NextToken !== undefined && { nextToken: input.NextToken }),
451
- };
339
+ const query = map({
340
+ clusterNameFilter: [, input.ClusterNameFilter],
341
+ maxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
342
+ nextToken: [, input.NextToken],
343
+ });
452
344
  let body;
453
345
  return new protocol_http_1.HttpRequest({
454
346
  protocol,
@@ -466,12 +358,12 @@ const serializeAws_restJson1ListClustersV2Command = async (input, context) => {
466
358
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
467
359
  const headers = {};
468
360
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/api/v2/clusters";
469
- const query = {
470
- ...(input.ClusterNameFilter !== undefined && { clusterNameFilter: input.ClusterNameFilter }),
471
- ...(input.ClusterTypeFilter !== undefined && { clusterTypeFilter: input.ClusterTypeFilter }),
472
- ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }),
473
- ...(input.NextToken !== undefined && { nextToken: input.NextToken }),
474
- };
361
+ const query = map({
362
+ clusterNameFilter: [, input.ClusterNameFilter],
363
+ clusterTypeFilter: [, input.ClusterTypeFilter],
364
+ maxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
365
+ nextToken: [, input.NextToken],
366
+ });
475
367
  let body;
476
368
  return new protocol_http_1.HttpRequest({
477
369
  protocol,
@@ -489,20 +381,11 @@ const serializeAws_restJson1ListConfigurationRevisionsCommand = async (input, co
489
381
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
490
382
  const headers = {};
491
383
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/configurations/{Arn}/revisions";
492
- if (input.Arn !== undefined) {
493
- const labelValue = input.Arn;
494
- if (labelValue.length <= 0) {
495
- throw new Error("Empty value provided for input HTTP label: Arn.");
496
- }
497
- resolvedPath = resolvedPath.replace("{Arn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
498
- }
499
- else {
500
- throw new Error("No value provided for input HTTP label: Arn.");
501
- }
502
- const query = {
503
- ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }),
504
- ...(input.NextToken !== undefined && { nextToken: input.NextToken }),
505
- };
384
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "Arn", () => input.Arn, "{Arn}", false);
385
+ const query = map({
386
+ maxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
387
+ nextToken: [, input.NextToken],
388
+ });
506
389
  let body;
507
390
  return new protocol_http_1.HttpRequest({
508
391
  protocol,
@@ -520,10 +403,10 @@ const serializeAws_restJson1ListConfigurationsCommand = async (input, context) =
520
403
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
521
404
  const headers = {};
522
405
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/configurations";
523
- const query = {
524
- ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }),
525
- ...(input.NextToken !== undefined && { nextToken: input.NextToken }),
526
- };
406
+ const query = map({
407
+ maxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
408
+ nextToken: [, input.NextToken],
409
+ });
527
410
  let body;
528
411
  return new protocol_http_1.HttpRequest({
529
412
  protocol,
@@ -541,10 +424,10 @@ const serializeAws_restJson1ListKafkaVersionsCommand = async (input, context) =>
541
424
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
542
425
  const headers = {};
543
426
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/kafka-versions";
544
- const query = {
545
- ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }),
546
- ...(input.NextToken !== undefined && { nextToken: input.NextToken }),
547
- };
427
+ const query = map({
428
+ maxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
429
+ nextToken: [, input.NextToken],
430
+ });
548
431
  let body;
549
432
  return new protocol_http_1.HttpRequest({
550
433
  protocol,
@@ -562,20 +445,11 @@ const serializeAws_restJson1ListNodesCommand = async (input, context) => {
562
445
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
563
446
  const headers = {};
564
447
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/clusters/{ClusterArn}/nodes";
565
- if (input.ClusterArn !== undefined) {
566
- const labelValue = input.ClusterArn;
567
- if (labelValue.length <= 0) {
568
- throw new Error("Empty value provided for input HTTP label: ClusterArn.");
569
- }
570
- resolvedPath = resolvedPath.replace("{ClusterArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
571
- }
572
- else {
573
- throw new Error("No value provided for input HTTP label: ClusterArn.");
574
- }
575
- const query = {
576
- ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }),
577
- ...(input.NextToken !== undefined && { nextToken: input.NextToken }),
578
- };
448
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ClusterArn", () => input.ClusterArn, "{ClusterArn}", false);
449
+ const query = map({
450
+ maxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
451
+ nextToken: [, input.NextToken],
452
+ });
579
453
  let body;
580
454
  return new protocol_http_1.HttpRequest({
581
455
  protocol,
@@ -593,20 +467,11 @@ const serializeAws_restJson1ListScramSecretsCommand = async (input, context) =>
593
467
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
594
468
  const headers = {};
595
469
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/clusters/{ClusterArn}/scram-secrets";
596
- if (input.ClusterArn !== undefined) {
597
- const labelValue = input.ClusterArn;
598
- if (labelValue.length <= 0) {
599
- throw new Error("Empty value provided for input HTTP label: ClusterArn.");
600
- }
601
- resolvedPath = resolvedPath.replace("{ClusterArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
602
- }
603
- else {
604
- throw new Error("No value provided for input HTTP label: ClusterArn.");
605
- }
606
- const query = {
607
- ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }),
608
- ...(input.NextToken !== undefined && { nextToken: input.NextToken }),
609
- };
470
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ClusterArn", () => input.ClusterArn, "{ClusterArn}", false);
471
+ const query = map({
472
+ maxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
473
+ nextToken: [, input.NextToken],
474
+ });
610
475
  let body;
611
476
  return new protocol_http_1.HttpRequest({
612
477
  protocol,
@@ -624,16 +489,7 @@ const serializeAws_restJson1ListTagsForResourceCommand = async (input, context)
624
489
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
625
490
  const headers = {};
626
491
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/tags/{ResourceArn}";
627
- if (input.ResourceArn !== undefined) {
628
- const labelValue = input.ResourceArn;
629
- if (labelValue.length <= 0) {
630
- throw new Error("Empty value provided for input HTTP label: ResourceArn.");
631
- }
632
- resolvedPath = resolvedPath.replace("{ResourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
633
- }
634
- else {
635
- throw new Error("No value provided for input HTTP label: ResourceArn.");
636
- }
492
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ResourceArn", () => input.ResourceArn, "{ResourceArn}", false);
637
493
  let body;
638
494
  return new protocol_http_1.HttpRequest({
639
495
  protocol,
@@ -652,16 +508,7 @@ const serializeAws_restJson1RebootBrokerCommand = async (input, context) => {
652
508
  "content-type": "application/json",
653
509
  };
654
510
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/clusters/{ClusterArn}/reboot-broker";
655
- if (input.ClusterArn !== undefined) {
656
- const labelValue = input.ClusterArn;
657
- if (labelValue.length <= 0) {
658
- throw new Error("Empty value provided for input HTTP label: ClusterArn.");
659
- }
660
- resolvedPath = resolvedPath.replace("{ClusterArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
661
- }
662
- else {
663
- throw new Error("No value provided for input HTTP label: ClusterArn.");
664
- }
511
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ClusterArn", () => input.ClusterArn, "{ClusterArn}", false);
665
512
  let body;
666
513
  body = JSON.stringify({
667
514
  ...(input.BrokerIds != null && { brokerIds: serializeAws_restJson1__listOf__string(input.BrokerIds, context) }),
@@ -683,16 +530,7 @@ const serializeAws_restJson1TagResourceCommand = async (input, context) => {
683
530
  "content-type": "application/json",
684
531
  };
685
532
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/tags/{ResourceArn}";
686
- if (input.ResourceArn !== undefined) {
687
- const labelValue = input.ResourceArn;
688
- if (labelValue.length <= 0) {
689
- throw new Error("Empty value provided for input HTTP label: ResourceArn.");
690
- }
691
- resolvedPath = resolvedPath.replace("{ResourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
692
- }
693
- else {
694
- throw new Error("No value provided for input HTTP label: ResourceArn.");
695
- }
533
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ResourceArn", () => input.ResourceArn, "{ResourceArn}", false);
696
534
  let body;
697
535
  body = JSON.stringify({
698
536
  ...(input.Tags != null && { tags: serializeAws_restJson1__mapOf__string(input.Tags, context) }),
@@ -712,19 +550,10 @@ const serializeAws_restJson1UntagResourceCommand = async (input, context) => {
712
550
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
713
551
  const headers = {};
714
552
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/tags/{ResourceArn}";
715
- if (input.ResourceArn !== undefined) {
716
- const labelValue = input.ResourceArn;
717
- if (labelValue.length <= 0) {
718
- throw new Error("Empty value provided for input HTTP label: ResourceArn.");
719
- }
720
- resolvedPath = resolvedPath.replace("{ResourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
721
- }
722
- else {
723
- throw new Error("No value provided for input HTTP label: ResourceArn.");
724
- }
725
- const query = {
726
- ...(input.TagKeys !== undefined && { tagKeys: (input.TagKeys || []).map((_entry) => _entry) }),
727
- };
553
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ResourceArn", () => input.ResourceArn, "{ResourceArn}", false);
554
+ const query = map({
555
+ tagKeys: [() => input.TagKeys !== void 0, () => (input.TagKeys || []).map((_entry) => _entry)],
556
+ });
728
557
  let body;
729
558
  return new protocol_http_1.HttpRequest({
730
559
  protocol,
@@ -744,16 +573,7 @@ const serializeAws_restJson1UpdateBrokerCountCommand = async (input, context) =>
744
573
  "content-type": "application/json",
745
574
  };
746
575
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/clusters/{ClusterArn}/nodes/count";
747
- if (input.ClusterArn !== undefined) {
748
- const labelValue = input.ClusterArn;
749
- if (labelValue.length <= 0) {
750
- throw new Error("Empty value provided for input HTTP label: ClusterArn.");
751
- }
752
- resolvedPath = resolvedPath.replace("{ClusterArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
753
- }
754
- else {
755
- throw new Error("No value provided for input HTTP label: ClusterArn.");
756
- }
576
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ClusterArn", () => input.ClusterArn, "{ClusterArn}", false);
757
577
  let body;
758
578
  body = JSON.stringify({
759
579
  ...(input.CurrentVersion != null && { currentVersion: input.CurrentVersion }),
@@ -776,16 +596,7 @@ const serializeAws_restJson1UpdateBrokerStorageCommand = async (input, context)
776
596
  "content-type": "application/json",
777
597
  };
778
598
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/clusters/{ClusterArn}/nodes/storage";
779
- if (input.ClusterArn !== undefined) {
780
- const labelValue = input.ClusterArn;
781
- if (labelValue.length <= 0) {
782
- throw new Error("Empty value provided for input HTTP label: ClusterArn.");
783
- }
784
- resolvedPath = resolvedPath.replace("{ClusterArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
785
- }
786
- else {
787
- throw new Error("No value provided for input HTTP label: ClusterArn.");
788
- }
599
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ClusterArn", () => input.ClusterArn, "{ClusterArn}", false);
789
600
  let body;
790
601
  body = JSON.stringify({
791
602
  ...(input.CurrentVersion != null && { currentVersion: input.CurrentVersion }),
@@ -810,16 +621,7 @@ const serializeAws_restJson1UpdateBrokerTypeCommand = async (input, context) =>
810
621
  "content-type": "application/json",
811
622
  };
812
623
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/clusters/{ClusterArn}/nodes/type";
813
- if (input.ClusterArn !== undefined) {
814
- const labelValue = input.ClusterArn;
815
- if (labelValue.length <= 0) {
816
- throw new Error("Empty value provided for input HTTP label: ClusterArn.");
817
- }
818
- resolvedPath = resolvedPath.replace("{ClusterArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
819
- }
820
- else {
821
- throw new Error("No value provided for input HTTP label: ClusterArn.");
822
- }
624
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ClusterArn", () => input.ClusterArn, "{ClusterArn}", false);
823
625
  let body;
824
626
  body = JSON.stringify({
825
627
  ...(input.CurrentVersion != null && { currentVersion: input.CurrentVersion }),
@@ -842,16 +644,7 @@ const serializeAws_restJson1UpdateClusterConfigurationCommand = async (input, co
842
644
  "content-type": "application/json",
843
645
  };
844
646
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/clusters/{ClusterArn}/configuration";
845
- if (input.ClusterArn !== undefined) {
846
- const labelValue = input.ClusterArn;
847
- if (labelValue.length <= 0) {
848
- throw new Error("Empty value provided for input HTTP label: ClusterArn.");
849
- }
850
- resolvedPath = resolvedPath.replace("{ClusterArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
851
- }
852
- else {
853
- throw new Error("No value provided for input HTTP label: ClusterArn.");
854
- }
647
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ClusterArn", () => input.ClusterArn, "{ClusterArn}", false);
855
648
  let body;
856
649
  body = JSON.stringify({
857
650
  ...(input.ConfigurationInfo != null && {
@@ -876,16 +669,7 @@ const serializeAws_restJson1UpdateClusterKafkaVersionCommand = async (input, con
876
669
  "content-type": "application/json",
877
670
  };
878
671
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/clusters/{ClusterArn}/version";
879
- if (input.ClusterArn !== undefined) {
880
- const labelValue = input.ClusterArn;
881
- if (labelValue.length <= 0) {
882
- throw new Error("Empty value provided for input HTTP label: ClusterArn.");
883
- }
884
- resolvedPath = resolvedPath.replace("{ClusterArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
885
- }
886
- else {
887
- throw new Error("No value provided for input HTTP label: ClusterArn.");
888
- }
672
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ClusterArn", () => input.ClusterArn, "{ClusterArn}", false);
889
673
  let body;
890
674
  body = JSON.stringify({
891
675
  ...(input.ConfigurationInfo != null && {
@@ -911,16 +695,7 @@ const serializeAws_restJson1UpdateConfigurationCommand = async (input, context)
911
695
  "content-type": "application/json",
912
696
  };
913
697
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/configurations/{Arn}";
914
- if (input.Arn !== undefined) {
915
- const labelValue = input.Arn;
916
- if (labelValue.length <= 0) {
917
- throw new Error("Empty value provided for input HTTP label: Arn.");
918
- }
919
- resolvedPath = resolvedPath.replace("{Arn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
920
- }
921
- else {
922
- throw new Error("No value provided for input HTTP label: Arn.");
923
- }
698
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "Arn", () => input.Arn, "{Arn}", false);
924
699
  let body;
925
700
  body = JSON.stringify({
926
701
  ...(input.Description != null && { description: input.Description }),
@@ -943,16 +718,7 @@ const serializeAws_restJson1UpdateConnectivityCommand = async (input, context) =
943
718
  "content-type": "application/json",
944
719
  };
945
720
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/clusters/{ClusterArn}/connectivity";
946
- if (input.ClusterArn !== undefined) {
947
- const labelValue = input.ClusterArn;
948
- if (labelValue.length <= 0) {
949
- throw new Error("Empty value provided for input HTTP label: ClusterArn.");
950
- }
951
- resolvedPath = resolvedPath.replace("{ClusterArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
952
- }
953
- else {
954
- throw new Error("No value provided for input HTTP label: ClusterArn.");
955
- }
721
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ClusterArn", () => input.ClusterArn, "{ClusterArn}", false);
956
722
  let body;
957
723
  body = JSON.stringify({
958
724
  ...(input.ConnectivityInfo != null && {
@@ -977,16 +743,7 @@ const serializeAws_restJson1UpdateMonitoringCommand = async (input, context) =>
977
743
  "content-type": "application/json",
978
744
  };
979
745
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/clusters/{ClusterArn}/monitoring";
980
- if (input.ClusterArn !== undefined) {
981
- const labelValue = input.ClusterArn;
982
- if (labelValue.length <= 0) {
983
- throw new Error("Empty value provided for input HTTP label: ClusterArn.");
984
- }
985
- resolvedPath = resolvedPath.replace("{ClusterArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
986
- }
987
- else {
988
- throw new Error("No value provided for input HTTP label: ClusterArn.");
989
- }
746
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ClusterArn", () => input.ClusterArn, "{ClusterArn}", false);
990
747
  let body;
991
748
  body = JSON.stringify({
992
749
  ...(input.CurrentVersion != null && { currentVersion: input.CurrentVersion }),
@@ -1013,16 +770,7 @@ const serializeAws_restJson1UpdateSecurityCommand = async (input, context) => {
1013
770
  "content-type": "application/json",
1014
771
  };
1015
772
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/clusters/{ClusterArn}/security";
1016
- if (input.ClusterArn !== undefined) {
1017
- const labelValue = input.ClusterArn;
1018
- if (labelValue.length <= 0) {
1019
- throw new Error("Empty value provided for input HTTP label: ClusterArn.");
1020
- }
1021
- resolvedPath = resolvedPath.replace("{ClusterArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1022
- }
1023
- else {
1024
- throw new Error("No value provided for input HTTP label: ClusterArn.");
1025
- }
773
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ClusterArn", () => input.ClusterArn, "{ClusterArn}", false);
1026
774
  let body;
1027
775
  body = JSON.stringify({
1028
776
  ...(input.ClientAuthentication != null && {
@@ -1048,19 +796,17 @@ const deserializeAws_restJson1BatchAssociateScramSecretCommand = async (output,
1048
796
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1049
797
  return deserializeAws_restJson1BatchAssociateScramSecretCommandError(output, context);
1050
798
  }
1051
- const contents = {
799
+ const contents = map({
1052
800
  $metadata: deserializeMetadata(output),
1053
- ClusterArn: undefined,
1054
- UnprocessedScramSecrets: undefined,
1055
- };
801
+ });
1056
802
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1057
- if (data.clusterArn !== undefined && data.clusterArn !== null) {
803
+ if (data.clusterArn != null) {
1058
804
  contents.ClusterArn = (0, smithy_client_1.expectString)(data.clusterArn);
1059
805
  }
1060
- if (data.unprocessedScramSecrets !== undefined && data.unprocessedScramSecrets !== null) {
806
+ if (data.unprocessedScramSecrets != null) {
1061
807
  contents.UnprocessedScramSecrets = deserializeAws_restJson1__listOfUnprocessedScramSecret(data.unprocessedScramSecrets, context);
1062
808
  }
1063
- return Promise.resolve(contents);
809
+ return contents;
1064
810
  };
1065
811
  exports.deserializeAws_restJson1BatchAssociateScramSecretCommand = deserializeAws_restJson1BatchAssociateScramSecretCommand;
1066
812
  const deserializeAws_restJson1BatchAssociateScramSecretCommandError = async (output, context) => {
@@ -1068,7 +814,6 @@ const deserializeAws_restJson1BatchAssociateScramSecretCommandError = async (out
1068
814
  ...output,
1069
815
  body: await parseBody(output.body, context),
1070
816
  };
1071
- let response;
1072
817
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1073
818
  switch (errorCode) {
1074
819
  case "BadRequestException":
@@ -1094,33 +839,29 @@ const deserializeAws_restJson1BatchAssociateScramSecretCommandError = async (out
1094
839
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
1095
840
  default:
1096
841
  const parsedBody = parsedOutput.body;
1097
- const $metadata = deserializeMetadata(output);
1098
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1099
- response = new KafkaServiceException_1.KafkaServiceException({
1100
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1101
- $fault: "client",
1102
- $metadata,
842
+ (0, smithy_client_1.throwDefaultError)({
843
+ output,
844
+ parsedBody,
845
+ exceptionCtor: KafkaServiceException_1.KafkaServiceException,
846
+ errorCode,
1103
847
  });
1104
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1105
848
  }
1106
849
  };
1107
850
  const deserializeAws_restJson1BatchDisassociateScramSecretCommand = async (output, context) => {
1108
851
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1109
852
  return deserializeAws_restJson1BatchDisassociateScramSecretCommandError(output, context);
1110
853
  }
1111
- const contents = {
854
+ const contents = map({
1112
855
  $metadata: deserializeMetadata(output),
1113
- ClusterArn: undefined,
1114
- UnprocessedScramSecrets: undefined,
1115
- };
856
+ });
1116
857
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1117
- if (data.clusterArn !== undefined && data.clusterArn !== null) {
858
+ if (data.clusterArn != null) {
1118
859
  contents.ClusterArn = (0, smithy_client_1.expectString)(data.clusterArn);
1119
860
  }
1120
- if (data.unprocessedScramSecrets !== undefined && data.unprocessedScramSecrets !== null) {
861
+ if (data.unprocessedScramSecrets != null) {
1121
862
  contents.UnprocessedScramSecrets = deserializeAws_restJson1__listOfUnprocessedScramSecret(data.unprocessedScramSecrets, context);
1122
863
  }
1123
- return Promise.resolve(contents);
864
+ return contents;
1124
865
  };
1125
866
  exports.deserializeAws_restJson1BatchDisassociateScramSecretCommand = deserializeAws_restJson1BatchDisassociateScramSecretCommand;
1126
867
  const deserializeAws_restJson1BatchDisassociateScramSecretCommandError = async (output, context) => {
@@ -1128,7 +869,6 @@ const deserializeAws_restJson1BatchDisassociateScramSecretCommandError = async (
1128
869
  ...output,
1129
870
  body: await parseBody(output.body, context),
1130
871
  };
1131
- let response;
1132
872
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1133
873
  switch (errorCode) {
1134
874
  case "BadRequestException":
@@ -1154,37 +894,32 @@ const deserializeAws_restJson1BatchDisassociateScramSecretCommandError = async (
1154
894
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
1155
895
  default:
1156
896
  const parsedBody = parsedOutput.body;
1157
- const $metadata = deserializeMetadata(output);
1158
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1159
- response = new KafkaServiceException_1.KafkaServiceException({
1160
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1161
- $fault: "client",
1162
- $metadata,
897
+ (0, smithy_client_1.throwDefaultError)({
898
+ output,
899
+ parsedBody,
900
+ exceptionCtor: KafkaServiceException_1.KafkaServiceException,
901
+ errorCode,
1163
902
  });
1164
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1165
903
  }
1166
904
  };
1167
905
  const deserializeAws_restJson1CreateClusterCommand = async (output, context) => {
1168
906
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1169
907
  return deserializeAws_restJson1CreateClusterCommandError(output, context);
1170
908
  }
1171
- const contents = {
909
+ const contents = map({
1172
910
  $metadata: deserializeMetadata(output),
1173
- ClusterArn: undefined,
1174
- ClusterName: undefined,
1175
- State: undefined,
1176
- };
911
+ });
1177
912
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1178
- if (data.clusterArn !== undefined && data.clusterArn !== null) {
913
+ if (data.clusterArn != null) {
1179
914
  contents.ClusterArn = (0, smithy_client_1.expectString)(data.clusterArn);
1180
915
  }
1181
- if (data.clusterName !== undefined && data.clusterName !== null) {
916
+ if (data.clusterName != null) {
1182
917
  contents.ClusterName = (0, smithy_client_1.expectString)(data.clusterName);
1183
918
  }
1184
- if (data.state !== undefined && data.state !== null) {
919
+ if (data.state != null) {
1185
920
  contents.State = (0, smithy_client_1.expectString)(data.state);
1186
921
  }
1187
- return Promise.resolve(contents);
922
+ return contents;
1188
923
  };
1189
924
  exports.deserializeAws_restJson1CreateClusterCommand = deserializeAws_restJson1CreateClusterCommand;
1190
925
  const deserializeAws_restJson1CreateClusterCommandError = async (output, context) => {
@@ -1192,7 +927,6 @@ const deserializeAws_restJson1CreateClusterCommandError = async (output, context
1192
927
  ...output,
1193
928
  body: await parseBody(output.body, context),
1194
929
  };
1195
- let response;
1196
930
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1197
931
  switch (errorCode) {
1198
932
  case "BadRequestException":
@@ -1218,41 +952,35 @@ const deserializeAws_restJson1CreateClusterCommandError = async (output, context
1218
952
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
1219
953
  default:
1220
954
  const parsedBody = parsedOutput.body;
1221
- const $metadata = deserializeMetadata(output);
1222
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1223
- response = new KafkaServiceException_1.KafkaServiceException({
1224
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1225
- $fault: "client",
1226
- $metadata,
955
+ (0, smithy_client_1.throwDefaultError)({
956
+ output,
957
+ parsedBody,
958
+ exceptionCtor: KafkaServiceException_1.KafkaServiceException,
959
+ errorCode,
1227
960
  });
1228
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1229
961
  }
1230
962
  };
1231
963
  const deserializeAws_restJson1CreateClusterV2Command = async (output, context) => {
1232
964
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1233
965
  return deserializeAws_restJson1CreateClusterV2CommandError(output, context);
1234
966
  }
1235
- const contents = {
967
+ const contents = map({
1236
968
  $metadata: deserializeMetadata(output),
1237
- ClusterArn: undefined,
1238
- ClusterName: undefined,
1239
- ClusterType: undefined,
1240
- State: undefined,
1241
- };
969
+ });
1242
970
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1243
- if (data.clusterArn !== undefined && data.clusterArn !== null) {
971
+ if (data.clusterArn != null) {
1244
972
  contents.ClusterArn = (0, smithy_client_1.expectString)(data.clusterArn);
1245
973
  }
1246
- if (data.clusterName !== undefined && data.clusterName !== null) {
974
+ if (data.clusterName != null) {
1247
975
  contents.ClusterName = (0, smithy_client_1.expectString)(data.clusterName);
1248
976
  }
1249
- if (data.clusterType !== undefined && data.clusterType !== null) {
977
+ if (data.clusterType != null) {
1250
978
  contents.ClusterType = (0, smithy_client_1.expectString)(data.clusterType);
1251
979
  }
1252
- if (data.state !== undefined && data.state !== null) {
980
+ if (data.state != null) {
1253
981
  contents.State = (0, smithy_client_1.expectString)(data.state);
1254
982
  }
1255
- return Promise.resolve(contents);
983
+ return contents;
1256
984
  };
1257
985
  exports.deserializeAws_restJson1CreateClusterV2Command = deserializeAws_restJson1CreateClusterV2Command;
1258
986
  const deserializeAws_restJson1CreateClusterV2CommandError = async (output, context) => {
@@ -1260,7 +988,6 @@ const deserializeAws_restJson1CreateClusterV2CommandError = async (output, conte
1260
988
  ...output,
1261
989
  body: await parseBody(output.body, context),
1262
990
  };
1263
- let response;
1264
991
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1265
992
  switch (errorCode) {
1266
993
  case "BadRequestException":
@@ -1286,45 +1013,38 @@ const deserializeAws_restJson1CreateClusterV2CommandError = async (output, conte
1286
1013
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
1287
1014
  default:
1288
1015
  const parsedBody = parsedOutput.body;
1289
- const $metadata = deserializeMetadata(output);
1290
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1291
- response = new KafkaServiceException_1.KafkaServiceException({
1292
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1293
- $fault: "client",
1294
- $metadata,
1016
+ (0, smithy_client_1.throwDefaultError)({
1017
+ output,
1018
+ parsedBody,
1019
+ exceptionCtor: KafkaServiceException_1.KafkaServiceException,
1020
+ errorCode,
1295
1021
  });
1296
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1297
1022
  }
1298
1023
  };
1299
1024
  const deserializeAws_restJson1CreateConfigurationCommand = async (output, context) => {
1300
1025
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1301
1026
  return deserializeAws_restJson1CreateConfigurationCommandError(output, context);
1302
1027
  }
1303
- const contents = {
1028
+ const contents = map({
1304
1029
  $metadata: deserializeMetadata(output),
1305
- Arn: undefined,
1306
- CreationTime: undefined,
1307
- LatestRevision: undefined,
1308
- Name: undefined,
1309
- State: undefined,
1310
- };
1030
+ });
1311
1031
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1312
- if (data.arn !== undefined && data.arn !== null) {
1032
+ if (data.arn != null) {
1313
1033
  contents.Arn = (0, smithy_client_1.expectString)(data.arn);
1314
1034
  }
1315
- if (data.creationTime !== undefined && data.creationTime !== null) {
1035
+ if (data.creationTime != null) {
1316
1036
  contents.CreationTime = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTime)(data.creationTime));
1317
1037
  }
1318
- if (data.latestRevision !== undefined && data.latestRevision !== null) {
1038
+ if (data.latestRevision != null) {
1319
1039
  contents.LatestRevision = deserializeAws_restJson1ConfigurationRevision(data.latestRevision, context);
1320
1040
  }
1321
- if (data.name !== undefined && data.name !== null) {
1041
+ if (data.name != null) {
1322
1042
  contents.Name = (0, smithy_client_1.expectString)(data.name);
1323
1043
  }
1324
- if (data.state !== undefined && data.state !== null) {
1044
+ if (data.state != null) {
1325
1045
  contents.State = (0, smithy_client_1.expectString)(data.state);
1326
1046
  }
1327
- return Promise.resolve(contents);
1047
+ return contents;
1328
1048
  };
1329
1049
  exports.deserializeAws_restJson1CreateConfigurationCommand = deserializeAws_restJson1CreateConfigurationCommand;
1330
1050
  const deserializeAws_restJson1CreateConfigurationCommandError = async (output, context) => {
@@ -1332,7 +1052,6 @@ const deserializeAws_restJson1CreateConfigurationCommandError = async (output, c
1332
1052
  ...output,
1333
1053
  body: await parseBody(output.body, context),
1334
1054
  };
1335
- let response;
1336
1055
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1337
1056
  switch (errorCode) {
1338
1057
  case "BadRequestException":
@@ -1358,33 +1077,29 @@ const deserializeAws_restJson1CreateConfigurationCommandError = async (output, c
1358
1077
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
1359
1078
  default:
1360
1079
  const parsedBody = parsedOutput.body;
1361
- const $metadata = deserializeMetadata(output);
1362
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1363
- response = new KafkaServiceException_1.KafkaServiceException({
1364
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1365
- $fault: "client",
1366
- $metadata,
1080
+ (0, smithy_client_1.throwDefaultError)({
1081
+ output,
1082
+ parsedBody,
1083
+ exceptionCtor: KafkaServiceException_1.KafkaServiceException,
1084
+ errorCode,
1367
1085
  });
1368
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1369
1086
  }
1370
1087
  };
1371
1088
  const deserializeAws_restJson1DeleteClusterCommand = async (output, context) => {
1372
1089
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1373
1090
  return deserializeAws_restJson1DeleteClusterCommandError(output, context);
1374
1091
  }
1375
- const contents = {
1092
+ const contents = map({
1376
1093
  $metadata: deserializeMetadata(output),
1377
- ClusterArn: undefined,
1378
- State: undefined,
1379
- };
1094
+ });
1380
1095
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1381
- if (data.clusterArn !== undefined && data.clusterArn !== null) {
1096
+ if (data.clusterArn != null) {
1382
1097
  contents.ClusterArn = (0, smithy_client_1.expectString)(data.clusterArn);
1383
1098
  }
1384
- if (data.state !== undefined && data.state !== null) {
1099
+ if (data.state != null) {
1385
1100
  contents.State = (0, smithy_client_1.expectString)(data.state);
1386
1101
  }
1387
- return Promise.resolve(contents);
1102
+ return contents;
1388
1103
  };
1389
1104
  exports.deserializeAws_restJson1DeleteClusterCommand = deserializeAws_restJson1DeleteClusterCommand;
1390
1105
  const deserializeAws_restJson1DeleteClusterCommandError = async (output, context) => {
@@ -1392,7 +1107,6 @@ const deserializeAws_restJson1DeleteClusterCommandError = async (output, context
1392
1107
  ...output,
1393
1108
  body: await parseBody(output.body, context),
1394
1109
  };
1395
- let response;
1396
1110
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1397
1111
  switch (errorCode) {
1398
1112
  case "BadRequestException":
@@ -1409,33 +1123,29 @@ const deserializeAws_restJson1DeleteClusterCommandError = async (output, context
1409
1123
  throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
1410
1124
  default:
1411
1125
  const parsedBody = parsedOutput.body;
1412
- const $metadata = deserializeMetadata(output);
1413
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1414
- response = new KafkaServiceException_1.KafkaServiceException({
1415
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1416
- $fault: "client",
1417
- $metadata,
1126
+ (0, smithy_client_1.throwDefaultError)({
1127
+ output,
1128
+ parsedBody,
1129
+ exceptionCtor: KafkaServiceException_1.KafkaServiceException,
1130
+ errorCode,
1418
1131
  });
1419
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1420
1132
  }
1421
1133
  };
1422
1134
  const deserializeAws_restJson1DeleteConfigurationCommand = async (output, context) => {
1423
1135
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1424
1136
  return deserializeAws_restJson1DeleteConfigurationCommandError(output, context);
1425
1137
  }
1426
- const contents = {
1138
+ const contents = map({
1427
1139
  $metadata: deserializeMetadata(output),
1428
- Arn: undefined,
1429
- State: undefined,
1430
- };
1140
+ });
1431
1141
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1432
- if (data.arn !== undefined && data.arn !== null) {
1142
+ if (data.arn != null) {
1433
1143
  contents.Arn = (0, smithy_client_1.expectString)(data.arn);
1434
1144
  }
1435
- if (data.state !== undefined && data.state !== null) {
1145
+ if (data.state != null) {
1436
1146
  contents.State = (0, smithy_client_1.expectString)(data.state);
1437
1147
  }
1438
- return Promise.resolve(contents);
1148
+ return contents;
1439
1149
  };
1440
1150
  exports.deserializeAws_restJson1DeleteConfigurationCommand = deserializeAws_restJson1DeleteConfigurationCommand;
1441
1151
  const deserializeAws_restJson1DeleteConfigurationCommandError = async (output, context) => {
@@ -1443,7 +1153,6 @@ const deserializeAws_restJson1DeleteConfigurationCommandError = async (output, c
1443
1153
  ...output,
1444
1154
  body: await parseBody(output.body, context),
1445
1155
  };
1446
- let response;
1447
1156
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1448
1157
  switch (errorCode) {
1449
1158
  case "BadRequestException":
@@ -1460,29 +1169,26 @@ const deserializeAws_restJson1DeleteConfigurationCommandError = async (output, c
1460
1169
  throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
1461
1170
  default:
1462
1171
  const parsedBody = parsedOutput.body;
1463
- const $metadata = deserializeMetadata(output);
1464
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1465
- response = new KafkaServiceException_1.KafkaServiceException({
1466
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1467
- $fault: "client",
1468
- $metadata,
1172
+ (0, smithy_client_1.throwDefaultError)({
1173
+ output,
1174
+ parsedBody,
1175
+ exceptionCtor: KafkaServiceException_1.KafkaServiceException,
1176
+ errorCode,
1469
1177
  });
1470
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1471
1178
  }
1472
1179
  };
1473
1180
  const deserializeAws_restJson1DescribeClusterCommand = async (output, context) => {
1474
1181
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1475
1182
  return deserializeAws_restJson1DescribeClusterCommandError(output, context);
1476
1183
  }
1477
- const contents = {
1184
+ const contents = map({
1478
1185
  $metadata: deserializeMetadata(output),
1479
- ClusterInfo: undefined,
1480
- };
1186
+ });
1481
1187
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1482
- if (data.clusterInfo !== undefined && data.clusterInfo !== null) {
1188
+ if (data.clusterInfo != null) {
1483
1189
  contents.ClusterInfo = deserializeAws_restJson1ClusterInfo(data.clusterInfo, context);
1484
1190
  }
1485
- return Promise.resolve(contents);
1191
+ return contents;
1486
1192
  };
1487
1193
  exports.deserializeAws_restJson1DescribeClusterCommand = deserializeAws_restJson1DescribeClusterCommand;
1488
1194
  const deserializeAws_restJson1DescribeClusterCommandError = async (output, context) => {
@@ -1490,7 +1196,6 @@ const deserializeAws_restJson1DescribeClusterCommandError = async (output, conte
1490
1196
  ...output,
1491
1197
  body: await parseBody(output.body, context),
1492
1198
  };
1493
- let response;
1494
1199
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1495
1200
  switch (errorCode) {
1496
1201
  case "BadRequestException":
@@ -1510,29 +1215,26 @@ const deserializeAws_restJson1DescribeClusterCommandError = async (output, conte
1510
1215
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
1511
1216
  default:
1512
1217
  const parsedBody = parsedOutput.body;
1513
- const $metadata = deserializeMetadata(output);
1514
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1515
- response = new KafkaServiceException_1.KafkaServiceException({
1516
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1517
- $fault: "client",
1518
- $metadata,
1218
+ (0, smithy_client_1.throwDefaultError)({
1219
+ output,
1220
+ parsedBody,
1221
+ exceptionCtor: KafkaServiceException_1.KafkaServiceException,
1222
+ errorCode,
1519
1223
  });
1520
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1521
1224
  }
1522
1225
  };
1523
1226
  const deserializeAws_restJson1DescribeClusterOperationCommand = async (output, context) => {
1524
1227
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1525
1228
  return deserializeAws_restJson1DescribeClusterOperationCommandError(output, context);
1526
1229
  }
1527
- const contents = {
1230
+ const contents = map({
1528
1231
  $metadata: deserializeMetadata(output),
1529
- ClusterOperationInfo: undefined,
1530
- };
1232
+ });
1531
1233
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1532
- if (data.clusterOperationInfo !== undefined && data.clusterOperationInfo !== null) {
1234
+ if (data.clusterOperationInfo != null) {
1533
1235
  contents.ClusterOperationInfo = deserializeAws_restJson1ClusterOperationInfo(data.clusterOperationInfo, context);
1534
1236
  }
1535
- return Promise.resolve(contents);
1237
+ return contents;
1536
1238
  };
1537
1239
  exports.deserializeAws_restJson1DescribeClusterOperationCommand = deserializeAws_restJson1DescribeClusterOperationCommand;
1538
1240
  const deserializeAws_restJson1DescribeClusterOperationCommandError = async (output, context) => {
@@ -1540,7 +1242,6 @@ const deserializeAws_restJson1DescribeClusterOperationCommandError = async (outp
1540
1242
  ...output,
1541
1243
  body: await parseBody(output.body, context),
1542
1244
  };
1543
- let response;
1544
1245
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1545
1246
  switch (errorCode) {
1546
1247
  case "BadRequestException":
@@ -1560,29 +1261,26 @@ const deserializeAws_restJson1DescribeClusterOperationCommandError = async (outp
1560
1261
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
1561
1262
  default:
1562
1263
  const parsedBody = parsedOutput.body;
1563
- const $metadata = deserializeMetadata(output);
1564
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1565
- response = new KafkaServiceException_1.KafkaServiceException({
1566
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1567
- $fault: "client",
1568
- $metadata,
1264
+ (0, smithy_client_1.throwDefaultError)({
1265
+ output,
1266
+ parsedBody,
1267
+ exceptionCtor: KafkaServiceException_1.KafkaServiceException,
1268
+ errorCode,
1569
1269
  });
1570
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1571
1270
  }
1572
1271
  };
1573
1272
  const deserializeAws_restJson1DescribeClusterV2Command = async (output, context) => {
1574
1273
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1575
1274
  return deserializeAws_restJson1DescribeClusterV2CommandError(output, context);
1576
1275
  }
1577
- const contents = {
1276
+ const contents = map({
1578
1277
  $metadata: deserializeMetadata(output),
1579
- ClusterInfo: undefined,
1580
- };
1278
+ });
1581
1279
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1582
- if (data.clusterInfo !== undefined && data.clusterInfo !== null) {
1280
+ if (data.clusterInfo != null) {
1583
1281
  contents.ClusterInfo = deserializeAws_restJson1Cluster(data.clusterInfo, context);
1584
1282
  }
1585
- return Promise.resolve(contents);
1283
+ return contents;
1586
1284
  };
1587
1285
  exports.deserializeAws_restJson1DescribeClusterV2Command = deserializeAws_restJson1DescribeClusterV2Command;
1588
1286
  const deserializeAws_restJson1DescribeClusterV2CommandError = async (output, context) => {
@@ -1590,7 +1288,6 @@ const deserializeAws_restJson1DescribeClusterV2CommandError = async (output, con
1590
1288
  ...output,
1591
1289
  body: await parseBody(output.body, context),
1592
1290
  };
1593
- let response;
1594
1291
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1595
1292
  switch (errorCode) {
1596
1293
  case "BadRequestException":
@@ -1610,53 +1307,44 @@ const deserializeAws_restJson1DescribeClusterV2CommandError = async (output, con
1610
1307
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
1611
1308
  default:
1612
1309
  const parsedBody = parsedOutput.body;
1613
- const $metadata = deserializeMetadata(output);
1614
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1615
- response = new KafkaServiceException_1.KafkaServiceException({
1616
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1617
- $fault: "client",
1618
- $metadata,
1310
+ (0, smithy_client_1.throwDefaultError)({
1311
+ output,
1312
+ parsedBody,
1313
+ exceptionCtor: KafkaServiceException_1.KafkaServiceException,
1314
+ errorCode,
1619
1315
  });
1620
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1621
1316
  }
1622
1317
  };
1623
1318
  const deserializeAws_restJson1DescribeConfigurationCommand = async (output, context) => {
1624
1319
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1625
1320
  return deserializeAws_restJson1DescribeConfigurationCommandError(output, context);
1626
1321
  }
1627
- const contents = {
1322
+ const contents = map({
1628
1323
  $metadata: deserializeMetadata(output),
1629
- Arn: undefined,
1630
- CreationTime: undefined,
1631
- Description: undefined,
1632
- KafkaVersions: undefined,
1633
- LatestRevision: undefined,
1634
- Name: undefined,
1635
- State: undefined,
1636
- };
1324
+ });
1637
1325
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1638
- if (data.arn !== undefined && data.arn !== null) {
1326
+ if (data.arn != null) {
1639
1327
  contents.Arn = (0, smithy_client_1.expectString)(data.arn);
1640
1328
  }
1641
- if (data.creationTime !== undefined && data.creationTime !== null) {
1329
+ if (data.creationTime != null) {
1642
1330
  contents.CreationTime = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTime)(data.creationTime));
1643
1331
  }
1644
- if (data.description !== undefined && data.description !== null) {
1332
+ if (data.description != null) {
1645
1333
  contents.Description = (0, smithy_client_1.expectString)(data.description);
1646
1334
  }
1647
- if (data.kafkaVersions !== undefined && data.kafkaVersions !== null) {
1335
+ if (data.kafkaVersions != null) {
1648
1336
  contents.KafkaVersions = deserializeAws_restJson1__listOf__string(data.kafkaVersions, context);
1649
1337
  }
1650
- if (data.latestRevision !== undefined && data.latestRevision !== null) {
1338
+ if (data.latestRevision != null) {
1651
1339
  contents.LatestRevision = deserializeAws_restJson1ConfigurationRevision(data.latestRevision, context);
1652
1340
  }
1653
- if (data.name !== undefined && data.name !== null) {
1341
+ if (data.name != null) {
1654
1342
  contents.Name = (0, smithy_client_1.expectString)(data.name);
1655
1343
  }
1656
- if (data.state !== undefined && data.state !== null) {
1344
+ if (data.state != null) {
1657
1345
  contents.State = (0, smithy_client_1.expectString)(data.state);
1658
1346
  }
1659
- return Promise.resolve(contents);
1347
+ return contents;
1660
1348
  };
1661
1349
  exports.deserializeAws_restJson1DescribeConfigurationCommand = deserializeAws_restJson1DescribeConfigurationCommand;
1662
1350
  const deserializeAws_restJson1DescribeConfigurationCommandError = async (output, context) => {
@@ -1664,7 +1352,6 @@ const deserializeAws_restJson1DescribeConfigurationCommandError = async (output,
1664
1352
  ...output,
1665
1353
  body: await parseBody(output.body, context),
1666
1354
  };
1667
- let response;
1668
1355
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1669
1356
  switch (errorCode) {
1670
1357
  case "BadRequestException":
@@ -1687,45 +1374,38 @@ const deserializeAws_restJson1DescribeConfigurationCommandError = async (output,
1687
1374
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
1688
1375
  default:
1689
1376
  const parsedBody = parsedOutput.body;
1690
- const $metadata = deserializeMetadata(output);
1691
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1692
- response = new KafkaServiceException_1.KafkaServiceException({
1693
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1694
- $fault: "client",
1695
- $metadata,
1377
+ (0, smithy_client_1.throwDefaultError)({
1378
+ output,
1379
+ parsedBody,
1380
+ exceptionCtor: KafkaServiceException_1.KafkaServiceException,
1381
+ errorCode,
1696
1382
  });
1697
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1698
1383
  }
1699
1384
  };
1700
1385
  const deserializeAws_restJson1DescribeConfigurationRevisionCommand = async (output, context) => {
1701
1386
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1702
1387
  return deserializeAws_restJson1DescribeConfigurationRevisionCommandError(output, context);
1703
1388
  }
1704
- const contents = {
1389
+ const contents = map({
1705
1390
  $metadata: deserializeMetadata(output),
1706
- Arn: undefined,
1707
- CreationTime: undefined,
1708
- Description: undefined,
1709
- Revision: undefined,
1710
- ServerProperties: undefined,
1711
- };
1391
+ });
1712
1392
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1713
- if (data.arn !== undefined && data.arn !== null) {
1393
+ if (data.arn != null) {
1714
1394
  contents.Arn = (0, smithy_client_1.expectString)(data.arn);
1715
1395
  }
1716
- if (data.creationTime !== undefined && data.creationTime !== null) {
1396
+ if (data.creationTime != null) {
1717
1397
  contents.CreationTime = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTime)(data.creationTime));
1718
1398
  }
1719
- if (data.description !== undefined && data.description !== null) {
1399
+ if (data.description != null) {
1720
1400
  contents.Description = (0, smithy_client_1.expectString)(data.description);
1721
1401
  }
1722
- if (data.revision !== undefined && data.revision !== null) {
1402
+ if (data.revision != null) {
1723
1403
  contents.Revision = (0, smithy_client_1.expectLong)(data.revision);
1724
1404
  }
1725
- if (data.serverProperties !== undefined && data.serverProperties !== null) {
1405
+ if (data.serverProperties != null) {
1726
1406
  contents.ServerProperties = context.base64Decoder(data.serverProperties);
1727
1407
  }
1728
- return Promise.resolve(contents);
1408
+ return contents;
1729
1409
  };
1730
1410
  exports.deserializeAws_restJson1DescribeConfigurationRevisionCommand = deserializeAws_restJson1DescribeConfigurationRevisionCommand;
1731
1411
  const deserializeAws_restJson1DescribeConfigurationRevisionCommandError = async (output, context) => {
@@ -1733,7 +1413,6 @@ const deserializeAws_restJson1DescribeConfigurationRevisionCommandError = async
1733
1413
  ...output,
1734
1414
  body: await parseBody(output.body, context),
1735
1415
  };
1736
- let response;
1737
1416
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1738
1417
  switch (errorCode) {
1739
1418
  case "BadRequestException":
@@ -1756,53 +1435,44 @@ const deserializeAws_restJson1DescribeConfigurationRevisionCommandError = async
1756
1435
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
1757
1436
  default:
1758
1437
  const parsedBody = parsedOutput.body;
1759
- const $metadata = deserializeMetadata(output);
1760
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1761
- response = new KafkaServiceException_1.KafkaServiceException({
1762
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1763
- $fault: "client",
1764
- $metadata,
1438
+ (0, smithy_client_1.throwDefaultError)({
1439
+ output,
1440
+ parsedBody,
1441
+ exceptionCtor: KafkaServiceException_1.KafkaServiceException,
1442
+ errorCode,
1765
1443
  });
1766
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1767
1444
  }
1768
1445
  };
1769
1446
  const deserializeAws_restJson1GetBootstrapBrokersCommand = async (output, context) => {
1770
1447
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1771
1448
  return deserializeAws_restJson1GetBootstrapBrokersCommandError(output, context);
1772
1449
  }
1773
- const contents = {
1450
+ const contents = map({
1774
1451
  $metadata: deserializeMetadata(output),
1775
- BootstrapBrokerString: undefined,
1776
- BootstrapBrokerStringPublicSaslIam: undefined,
1777
- BootstrapBrokerStringPublicSaslScram: undefined,
1778
- BootstrapBrokerStringPublicTls: undefined,
1779
- BootstrapBrokerStringSaslIam: undefined,
1780
- BootstrapBrokerStringSaslScram: undefined,
1781
- BootstrapBrokerStringTls: undefined,
1782
- };
1452
+ });
1783
1453
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1784
- if (data.bootstrapBrokerString !== undefined && data.bootstrapBrokerString !== null) {
1454
+ if (data.bootstrapBrokerString != null) {
1785
1455
  contents.BootstrapBrokerString = (0, smithy_client_1.expectString)(data.bootstrapBrokerString);
1786
1456
  }
1787
- if (data.bootstrapBrokerStringPublicSaslIam !== undefined && data.bootstrapBrokerStringPublicSaslIam !== null) {
1457
+ if (data.bootstrapBrokerStringPublicSaslIam != null) {
1788
1458
  contents.BootstrapBrokerStringPublicSaslIam = (0, smithy_client_1.expectString)(data.bootstrapBrokerStringPublicSaslIam);
1789
1459
  }
1790
- if (data.bootstrapBrokerStringPublicSaslScram !== undefined && data.bootstrapBrokerStringPublicSaslScram !== null) {
1460
+ if (data.bootstrapBrokerStringPublicSaslScram != null) {
1791
1461
  contents.BootstrapBrokerStringPublicSaslScram = (0, smithy_client_1.expectString)(data.bootstrapBrokerStringPublicSaslScram);
1792
1462
  }
1793
- if (data.bootstrapBrokerStringPublicTls !== undefined && data.bootstrapBrokerStringPublicTls !== null) {
1463
+ if (data.bootstrapBrokerStringPublicTls != null) {
1794
1464
  contents.BootstrapBrokerStringPublicTls = (0, smithy_client_1.expectString)(data.bootstrapBrokerStringPublicTls);
1795
1465
  }
1796
- if (data.bootstrapBrokerStringSaslIam !== undefined && data.bootstrapBrokerStringSaslIam !== null) {
1466
+ if (data.bootstrapBrokerStringSaslIam != null) {
1797
1467
  contents.BootstrapBrokerStringSaslIam = (0, smithy_client_1.expectString)(data.bootstrapBrokerStringSaslIam);
1798
1468
  }
1799
- if (data.bootstrapBrokerStringSaslScram !== undefined && data.bootstrapBrokerStringSaslScram !== null) {
1469
+ if (data.bootstrapBrokerStringSaslScram != null) {
1800
1470
  contents.BootstrapBrokerStringSaslScram = (0, smithy_client_1.expectString)(data.bootstrapBrokerStringSaslScram);
1801
1471
  }
1802
- if (data.bootstrapBrokerStringTls !== undefined && data.bootstrapBrokerStringTls !== null) {
1472
+ if (data.bootstrapBrokerStringTls != null) {
1803
1473
  contents.BootstrapBrokerStringTls = (0, smithy_client_1.expectString)(data.bootstrapBrokerStringTls);
1804
1474
  }
1805
- return Promise.resolve(contents);
1475
+ return contents;
1806
1476
  };
1807
1477
  exports.deserializeAws_restJson1GetBootstrapBrokersCommand = deserializeAws_restJson1GetBootstrapBrokersCommand;
1808
1478
  const deserializeAws_restJson1GetBootstrapBrokersCommandError = async (output, context) => {
@@ -1810,7 +1480,6 @@ const deserializeAws_restJson1GetBootstrapBrokersCommandError = async (output, c
1810
1480
  ...output,
1811
1481
  body: await parseBody(output.body, context),
1812
1482
  };
1813
- let response;
1814
1483
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1815
1484
  switch (errorCode) {
1816
1485
  case "BadRequestException":
@@ -1830,29 +1499,26 @@ const deserializeAws_restJson1GetBootstrapBrokersCommandError = async (output, c
1830
1499
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
1831
1500
  default:
1832
1501
  const parsedBody = parsedOutput.body;
1833
- const $metadata = deserializeMetadata(output);
1834
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1835
- response = new KafkaServiceException_1.KafkaServiceException({
1836
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1837
- $fault: "client",
1838
- $metadata,
1502
+ (0, smithy_client_1.throwDefaultError)({
1503
+ output,
1504
+ parsedBody,
1505
+ exceptionCtor: KafkaServiceException_1.KafkaServiceException,
1506
+ errorCode,
1839
1507
  });
1840
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1841
1508
  }
1842
1509
  };
1843
1510
  const deserializeAws_restJson1GetCompatibleKafkaVersionsCommand = async (output, context) => {
1844
1511
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1845
1512
  return deserializeAws_restJson1GetCompatibleKafkaVersionsCommandError(output, context);
1846
1513
  }
1847
- const contents = {
1514
+ const contents = map({
1848
1515
  $metadata: deserializeMetadata(output),
1849
- CompatibleKafkaVersions: undefined,
1850
- };
1516
+ });
1851
1517
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1852
- if (data.compatibleKafkaVersions !== undefined && data.compatibleKafkaVersions !== null) {
1518
+ if (data.compatibleKafkaVersions != null) {
1853
1519
  contents.CompatibleKafkaVersions = deserializeAws_restJson1__listOfCompatibleKafkaVersion(data.compatibleKafkaVersions, context);
1854
1520
  }
1855
- return Promise.resolve(contents);
1521
+ return contents;
1856
1522
  };
1857
1523
  exports.deserializeAws_restJson1GetCompatibleKafkaVersionsCommand = deserializeAws_restJson1GetCompatibleKafkaVersionsCommand;
1858
1524
  const deserializeAws_restJson1GetCompatibleKafkaVersionsCommandError = async (output, context) => {
@@ -1860,7 +1526,6 @@ const deserializeAws_restJson1GetCompatibleKafkaVersionsCommandError = async (ou
1860
1526
  ...output,
1861
1527
  body: await parseBody(output.body, context),
1862
1528
  };
1863
- let response;
1864
1529
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1865
1530
  switch (errorCode) {
1866
1531
  case "BadRequestException":
@@ -1886,33 +1551,29 @@ const deserializeAws_restJson1GetCompatibleKafkaVersionsCommandError = async (ou
1886
1551
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
1887
1552
  default:
1888
1553
  const parsedBody = parsedOutput.body;
1889
- const $metadata = deserializeMetadata(output);
1890
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1891
- response = new KafkaServiceException_1.KafkaServiceException({
1892
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1893
- $fault: "client",
1894
- $metadata,
1554
+ (0, smithy_client_1.throwDefaultError)({
1555
+ output,
1556
+ parsedBody,
1557
+ exceptionCtor: KafkaServiceException_1.KafkaServiceException,
1558
+ errorCode,
1895
1559
  });
1896
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1897
1560
  }
1898
1561
  };
1899
1562
  const deserializeAws_restJson1ListClusterOperationsCommand = async (output, context) => {
1900
1563
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1901
1564
  return deserializeAws_restJson1ListClusterOperationsCommandError(output, context);
1902
1565
  }
1903
- const contents = {
1566
+ const contents = map({
1904
1567
  $metadata: deserializeMetadata(output),
1905
- ClusterOperationInfoList: undefined,
1906
- NextToken: undefined,
1907
- };
1568
+ });
1908
1569
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1909
- if (data.clusterOperationInfoList !== undefined && data.clusterOperationInfoList !== null) {
1570
+ if (data.clusterOperationInfoList != null) {
1910
1571
  contents.ClusterOperationInfoList = deserializeAws_restJson1__listOfClusterOperationInfo(data.clusterOperationInfoList, context);
1911
1572
  }
1912
- if (data.nextToken !== undefined && data.nextToken !== null) {
1573
+ if (data.nextToken != null) {
1913
1574
  contents.NextToken = (0, smithy_client_1.expectString)(data.nextToken);
1914
1575
  }
1915
- return Promise.resolve(contents);
1576
+ return contents;
1916
1577
  };
1917
1578
  exports.deserializeAws_restJson1ListClusterOperationsCommand = deserializeAws_restJson1ListClusterOperationsCommand;
1918
1579
  const deserializeAws_restJson1ListClusterOperationsCommandError = async (output, context) => {
@@ -1920,7 +1581,6 @@ const deserializeAws_restJson1ListClusterOperationsCommandError = async (output,
1920
1581
  ...output,
1921
1582
  body: await parseBody(output.body, context),
1922
1583
  };
1923
- let response;
1924
1584
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1925
1585
  switch (errorCode) {
1926
1586
  case "BadRequestException":
@@ -1937,33 +1597,29 @@ const deserializeAws_restJson1ListClusterOperationsCommandError = async (output,
1937
1597
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
1938
1598
  default:
1939
1599
  const parsedBody = parsedOutput.body;
1940
- const $metadata = deserializeMetadata(output);
1941
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1942
- response = new KafkaServiceException_1.KafkaServiceException({
1943
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1944
- $fault: "client",
1945
- $metadata,
1600
+ (0, smithy_client_1.throwDefaultError)({
1601
+ output,
1602
+ parsedBody,
1603
+ exceptionCtor: KafkaServiceException_1.KafkaServiceException,
1604
+ errorCode,
1946
1605
  });
1947
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1948
1606
  }
1949
1607
  };
1950
1608
  const deserializeAws_restJson1ListClustersCommand = async (output, context) => {
1951
1609
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1952
1610
  return deserializeAws_restJson1ListClustersCommandError(output, context);
1953
1611
  }
1954
- const contents = {
1612
+ const contents = map({
1955
1613
  $metadata: deserializeMetadata(output),
1956
- ClusterInfoList: undefined,
1957
- NextToken: undefined,
1958
- };
1614
+ });
1959
1615
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1960
- if (data.clusterInfoList !== undefined && data.clusterInfoList !== null) {
1616
+ if (data.clusterInfoList != null) {
1961
1617
  contents.ClusterInfoList = deserializeAws_restJson1__listOfClusterInfo(data.clusterInfoList, context);
1962
1618
  }
1963
- if (data.nextToken !== undefined && data.nextToken !== null) {
1619
+ if (data.nextToken != null) {
1964
1620
  contents.NextToken = (0, smithy_client_1.expectString)(data.nextToken);
1965
1621
  }
1966
- return Promise.resolve(contents);
1622
+ return contents;
1967
1623
  };
1968
1624
  exports.deserializeAws_restJson1ListClustersCommand = deserializeAws_restJson1ListClustersCommand;
1969
1625
  const deserializeAws_restJson1ListClustersCommandError = async (output, context) => {
@@ -1971,7 +1627,6 @@ const deserializeAws_restJson1ListClustersCommandError = async (output, context)
1971
1627
  ...output,
1972
1628
  body: await parseBody(output.body, context),
1973
1629
  };
1974
- let response;
1975
1630
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1976
1631
  switch (errorCode) {
1977
1632
  case "BadRequestException":
@@ -1988,33 +1643,29 @@ const deserializeAws_restJson1ListClustersCommandError = async (output, context)
1988
1643
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
1989
1644
  default:
1990
1645
  const parsedBody = parsedOutput.body;
1991
- const $metadata = deserializeMetadata(output);
1992
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1993
- response = new KafkaServiceException_1.KafkaServiceException({
1994
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1995
- $fault: "client",
1996
- $metadata,
1646
+ (0, smithy_client_1.throwDefaultError)({
1647
+ output,
1648
+ parsedBody,
1649
+ exceptionCtor: KafkaServiceException_1.KafkaServiceException,
1650
+ errorCode,
1997
1651
  });
1998
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1999
1652
  }
2000
1653
  };
2001
1654
  const deserializeAws_restJson1ListClustersV2Command = async (output, context) => {
2002
1655
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2003
1656
  return deserializeAws_restJson1ListClustersV2CommandError(output, context);
2004
1657
  }
2005
- const contents = {
1658
+ const contents = map({
2006
1659
  $metadata: deserializeMetadata(output),
2007
- ClusterInfoList: undefined,
2008
- NextToken: undefined,
2009
- };
1660
+ });
2010
1661
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2011
- if (data.clusterInfoList !== undefined && data.clusterInfoList !== null) {
1662
+ if (data.clusterInfoList != null) {
2012
1663
  contents.ClusterInfoList = deserializeAws_restJson1__listOfCluster(data.clusterInfoList, context);
2013
1664
  }
2014
- if (data.nextToken !== undefined && data.nextToken !== null) {
1665
+ if (data.nextToken != null) {
2015
1666
  contents.NextToken = (0, smithy_client_1.expectString)(data.nextToken);
2016
1667
  }
2017
- return Promise.resolve(contents);
1668
+ return contents;
2018
1669
  };
2019
1670
  exports.deserializeAws_restJson1ListClustersV2Command = deserializeAws_restJson1ListClustersV2Command;
2020
1671
  const deserializeAws_restJson1ListClustersV2CommandError = async (output, context) => {
@@ -2022,7 +1673,6 @@ const deserializeAws_restJson1ListClustersV2CommandError = async (output, contex
2022
1673
  ...output,
2023
1674
  body: await parseBody(output.body, context),
2024
1675
  };
2025
- let response;
2026
1676
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2027
1677
  switch (errorCode) {
2028
1678
  case "BadRequestException":
@@ -2039,33 +1689,29 @@ const deserializeAws_restJson1ListClustersV2CommandError = async (output, contex
2039
1689
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2040
1690
  default:
2041
1691
  const parsedBody = parsedOutput.body;
2042
- const $metadata = deserializeMetadata(output);
2043
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2044
- response = new KafkaServiceException_1.KafkaServiceException({
2045
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2046
- $fault: "client",
2047
- $metadata,
1692
+ (0, smithy_client_1.throwDefaultError)({
1693
+ output,
1694
+ parsedBody,
1695
+ exceptionCtor: KafkaServiceException_1.KafkaServiceException,
1696
+ errorCode,
2048
1697
  });
2049
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2050
1698
  }
2051
1699
  };
2052
1700
  const deserializeAws_restJson1ListConfigurationRevisionsCommand = async (output, context) => {
2053
1701
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2054
1702
  return deserializeAws_restJson1ListConfigurationRevisionsCommandError(output, context);
2055
1703
  }
2056
- const contents = {
1704
+ const contents = map({
2057
1705
  $metadata: deserializeMetadata(output),
2058
- NextToken: undefined,
2059
- Revisions: undefined,
2060
- };
1706
+ });
2061
1707
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2062
- if (data.nextToken !== undefined && data.nextToken !== null) {
1708
+ if (data.nextToken != null) {
2063
1709
  contents.NextToken = (0, smithy_client_1.expectString)(data.nextToken);
2064
1710
  }
2065
- if (data.revisions !== undefined && data.revisions !== null) {
1711
+ if (data.revisions != null) {
2066
1712
  contents.Revisions = deserializeAws_restJson1__listOfConfigurationRevision(data.revisions, context);
2067
1713
  }
2068
- return Promise.resolve(contents);
1714
+ return contents;
2069
1715
  };
2070
1716
  exports.deserializeAws_restJson1ListConfigurationRevisionsCommand = deserializeAws_restJson1ListConfigurationRevisionsCommand;
2071
1717
  const deserializeAws_restJson1ListConfigurationRevisionsCommandError = async (output, context) => {
@@ -2073,7 +1719,6 @@ const deserializeAws_restJson1ListConfigurationRevisionsCommandError = async (ou
2073
1719
  ...output,
2074
1720
  body: await parseBody(output.body, context),
2075
1721
  };
2076
- let response;
2077
1722
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2078
1723
  switch (errorCode) {
2079
1724
  case "BadRequestException":
@@ -2096,33 +1741,29 @@ const deserializeAws_restJson1ListConfigurationRevisionsCommandError = async (ou
2096
1741
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2097
1742
  default:
2098
1743
  const parsedBody = parsedOutput.body;
2099
- const $metadata = deserializeMetadata(output);
2100
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2101
- response = new KafkaServiceException_1.KafkaServiceException({
2102
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2103
- $fault: "client",
2104
- $metadata,
1744
+ (0, smithy_client_1.throwDefaultError)({
1745
+ output,
1746
+ parsedBody,
1747
+ exceptionCtor: KafkaServiceException_1.KafkaServiceException,
1748
+ errorCode,
2105
1749
  });
2106
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2107
1750
  }
2108
1751
  };
2109
1752
  const deserializeAws_restJson1ListConfigurationsCommand = async (output, context) => {
2110
1753
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2111
1754
  return deserializeAws_restJson1ListConfigurationsCommandError(output, context);
2112
1755
  }
2113
- const contents = {
1756
+ const contents = map({
2114
1757
  $metadata: deserializeMetadata(output),
2115
- Configurations: undefined,
2116
- NextToken: undefined,
2117
- };
1758
+ });
2118
1759
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2119
- if (data.configurations !== undefined && data.configurations !== null) {
1760
+ if (data.configurations != null) {
2120
1761
  contents.Configurations = deserializeAws_restJson1__listOfConfiguration(data.configurations, context);
2121
1762
  }
2122
- if (data.nextToken !== undefined && data.nextToken !== null) {
1763
+ if (data.nextToken != null) {
2123
1764
  contents.NextToken = (0, smithy_client_1.expectString)(data.nextToken);
2124
1765
  }
2125
- return Promise.resolve(contents);
1766
+ return contents;
2126
1767
  };
2127
1768
  exports.deserializeAws_restJson1ListConfigurationsCommand = deserializeAws_restJson1ListConfigurationsCommand;
2128
1769
  const deserializeAws_restJson1ListConfigurationsCommandError = async (output, context) => {
@@ -2130,7 +1771,6 @@ const deserializeAws_restJson1ListConfigurationsCommandError = async (output, co
2130
1771
  ...output,
2131
1772
  body: await parseBody(output.body, context),
2132
1773
  };
2133
- let response;
2134
1774
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2135
1775
  switch (errorCode) {
2136
1776
  case "BadRequestException":
@@ -2150,33 +1790,29 @@ const deserializeAws_restJson1ListConfigurationsCommandError = async (output, co
2150
1790
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2151
1791
  default:
2152
1792
  const parsedBody = parsedOutput.body;
2153
- const $metadata = deserializeMetadata(output);
2154
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2155
- response = new KafkaServiceException_1.KafkaServiceException({
2156
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2157
- $fault: "client",
2158
- $metadata,
1793
+ (0, smithy_client_1.throwDefaultError)({
1794
+ output,
1795
+ parsedBody,
1796
+ exceptionCtor: KafkaServiceException_1.KafkaServiceException,
1797
+ errorCode,
2159
1798
  });
2160
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2161
1799
  }
2162
1800
  };
2163
1801
  const deserializeAws_restJson1ListKafkaVersionsCommand = async (output, context) => {
2164
1802
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2165
1803
  return deserializeAws_restJson1ListKafkaVersionsCommandError(output, context);
2166
1804
  }
2167
- const contents = {
1805
+ const contents = map({
2168
1806
  $metadata: deserializeMetadata(output),
2169
- KafkaVersions: undefined,
2170
- NextToken: undefined,
2171
- };
1807
+ });
2172
1808
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2173
- if (data.kafkaVersions !== undefined && data.kafkaVersions !== null) {
1809
+ if (data.kafkaVersions != null) {
2174
1810
  contents.KafkaVersions = deserializeAws_restJson1__listOfKafkaVersion(data.kafkaVersions, context);
2175
1811
  }
2176
- if (data.nextToken !== undefined && data.nextToken !== null) {
1812
+ if (data.nextToken != null) {
2177
1813
  contents.NextToken = (0, smithy_client_1.expectString)(data.nextToken);
2178
1814
  }
2179
- return Promise.resolve(contents);
1815
+ return contents;
2180
1816
  };
2181
1817
  exports.deserializeAws_restJson1ListKafkaVersionsCommand = deserializeAws_restJson1ListKafkaVersionsCommand;
2182
1818
  const deserializeAws_restJson1ListKafkaVersionsCommandError = async (output, context) => {
@@ -2184,7 +1820,6 @@ const deserializeAws_restJson1ListKafkaVersionsCommandError = async (output, con
2184
1820
  ...output,
2185
1821
  body: await parseBody(output.body, context),
2186
1822
  };
2187
- let response;
2188
1823
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2189
1824
  switch (errorCode) {
2190
1825
  case "BadRequestException":
@@ -2201,33 +1836,29 @@ const deserializeAws_restJson1ListKafkaVersionsCommandError = async (output, con
2201
1836
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2202
1837
  default:
2203
1838
  const parsedBody = parsedOutput.body;
2204
- const $metadata = deserializeMetadata(output);
2205
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2206
- response = new KafkaServiceException_1.KafkaServiceException({
2207
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2208
- $fault: "client",
2209
- $metadata,
1839
+ (0, smithy_client_1.throwDefaultError)({
1840
+ output,
1841
+ parsedBody,
1842
+ exceptionCtor: KafkaServiceException_1.KafkaServiceException,
1843
+ errorCode,
2210
1844
  });
2211
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2212
1845
  }
2213
1846
  };
2214
1847
  const deserializeAws_restJson1ListNodesCommand = async (output, context) => {
2215
1848
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2216
1849
  return deserializeAws_restJson1ListNodesCommandError(output, context);
2217
1850
  }
2218
- const contents = {
1851
+ const contents = map({
2219
1852
  $metadata: deserializeMetadata(output),
2220
- NextToken: undefined,
2221
- NodeInfoList: undefined,
2222
- };
1853
+ });
2223
1854
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2224
- if (data.nextToken !== undefined && data.nextToken !== null) {
1855
+ if (data.nextToken != null) {
2225
1856
  contents.NextToken = (0, smithy_client_1.expectString)(data.nextToken);
2226
1857
  }
2227
- if (data.nodeInfoList !== undefined && data.nodeInfoList !== null) {
1858
+ if (data.nodeInfoList != null) {
2228
1859
  contents.NodeInfoList = deserializeAws_restJson1__listOfNodeInfo(data.nodeInfoList, context);
2229
1860
  }
2230
- return Promise.resolve(contents);
1861
+ return contents;
2231
1862
  };
2232
1863
  exports.deserializeAws_restJson1ListNodesCommand = deserializeAws_restJson1ListNodesCommand;
2233
1864
  const deserializeAws_restJson1ListNodesCommandError = async (output, context) => {
@@ -2235,7 +1866,6 @@ const deserializeAws_restJson1ListNodesCommandError = async (output, context) =>
2235
1866
  ...output,
2236
1867
  body: await parseBody(output.body, context),
2237
1868
  };
2238
- let response;
2239
1869
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2240
1870
  switch (errorCode) {
2241
1871
  case "BadRequestException":
@@ -2252,33 +1882,29 @@ const deserializeAws_restJson1ListNodesCommandError = async (output, context) =>
2252
1882
  throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
2253
1883
  default:
2254
1884
  const parsedBody = parsedOutput.body;
2255
- const $metadata = deserializeMetadata(output);
2256
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2257
- response = new KafkaServiceException_1.KafkaServiceException({
2258
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2259
- $fault: "client",
2260
- $metadata,
1885
+ (0, smithy_client_1.throwDefaultError)({
1886
+ output,
1887
+ parsedBody,
1888
+ exceptionCtor: KafkaServiceException_1.KafkaServiceException,
1889
+ errorCode,
2261
1890
  });
2262
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2263
1891
  }
2264
1892
  };
2265
1893
  const deserializeAws_restJson1ListScramSecretsCommand = async (output, context) => {
2266
1894
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2267
1895
  return deserializeAws_restJson1ListScramSecretsCommandError(output, context);
2268
1896
  }
2269
- const contents = {
1897
+ const contents = map({
2270
1898
  $metadata: deserializeMetadata(output),
2271
- NextToken: undefined,
2272
- SecretArnList: undefined,
2273
- };
1899
+ });
2274
1900
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2275
- if (data.nextToken !== undefined && data.nextToken !== null) {
1901
+ if (data.nextToken != null) {
2276
1902
  contents.NextToken = (0, smithy_client_1.expectString)(data.nextToken);
2277
1903
  }
2278
- if (data.secretArnList !== undefined && data.secretArnList !== null) {
1904
+ if (data.secretArnList != null) {
2279
1905
  contents.SecretArnList = deserializeAws_restJson1__listOf__string(data.secretArnList, context);
2280
1906
  }
2281
- return Promise.resolve(contents);
1907
+ return contents;
2282
1908
  };
2283
1909
  exports.deserializeAws_restJson1ListScramSecretsCommand = deserializeAws_restJson1ListScramSecretsCommand;
2284
1910
  const deserializeAws_restJson1ListScramSecretsCommandError = async (output, context) => {
@@ -2286,7 +1912,6 @@ const deserializeAws_restJson1ListScramSecretsCommandError = async (output, cont
2286
1912
  ...output,
2287
1913
  body: await parseBody(output.body, context),
2288
1914
  };
2289
- let response;
2290
1915
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2291
1916
  switch (errorCode) {
2292
1917
  case "BadRequestException":
@@ -2312,29 +1937,26 @@ const deserializeAws_restJson1ListScramSecretsCommandError = async (output, cont
2312
1937
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2313
1938
  default:
2314
1939
  const parsedBody = parsedOutput.body;
2315
- const $metadata = deserializeMetadata(output);
2316
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2317
- response = new KafkaServiceException_1.KafkaServiceException({
2318
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2319
- $fault: "client",
2320
- $metadata,
1940
+ (0, smithy_client_1.throwDefaultError)({
1941
+ output,
1942
+ parsedBody,
1943
+ exceptionCtor: KafkaServiceException_1.KafkaServiceException,
1944
+ errorCode,
2321
1945
  });
2322
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2323
1946
  }
2324
1947
  };
2325
1948
  const deserializeAws_restJson1ListTagsForResourceCommand = async (output, context) => {
2326
1949
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2327
1950
  return deserializeAws_restJson1ListTagsForResourceCommandError(output, context);
2328
1951
  }
2329
- const contents = {
1952
+ const contents = map({
2330
1953
  $metadata: deserializeMetadata(output),
2331
- Tags: undefined,
2332
- };
1954
+ });
2333
1955
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2334
- if (data.tags !== undefined && data.tags !== null) {
1956
+ if (data.tags != null) {
2335
1957
  contents.Tags = deserializeAws_restJson1__mapOf__string(data.tags, context);
2336
1958
  }
2337
- return Promise.resolve(contents);
1959
+ return contents;
2338
1960
  };
2339
1961
  exports.deserializeAws_restJson1ListTagsForResourceCommand = deserializeAws_restJson1ListTagsForResourceCommand;
2340
1962
  const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, context) => {
@@ -2342,7 +1964,6 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
2342
1964
  ...output,
2343
1965
  body: await parseBody(output.body, context),
2344
1966
  };
2345
- let response;
2346
1967
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2347
1968
  switch (errorCode) {
2348
1969
  case "BadRequestException":
@@ -2356,33 +1977,29 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
2356
1977
  throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
2357
1978
  default:
2358
1979
  const parsedBody = parsedOutput.body;
2359
- const $metadata = deserializeMetadata(output);
2360
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2361
- response = new KafkaServiceException_1.KafkaServiceException({
2362
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2363
- $fault: "client",
2364
- $metadata,
1980
+ (0, smithy_client_1.throwDefaultError)({
1981
+ output,
1982
+ parsedBody,
1983
+ exceptionCtor: KafkaServiceException_1.KafkaServiceException,
1984
+ errorCode,
2365
1985
  });
2366
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2367
1986
  }
2368
1987
  };
2369
1988
  const deserializeAws_restJson1RebootBrokerCommand = async (output, context) => {
2370
1989
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2371
1990
  return deserializeAws_restJson1RebootBrokerCommandError(output, context);
2372
1991
  }
2373
- const contents = {
1992
+ const contents = map({
2374
1993
  $metadata: deserializeMetadata(output),
2375
- ClusterArn: undefined,
2376
- ClusterOperationArn: undefined,
2377
- };
1994
+ });
2378
1995
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2379
- if (data.clusterArn !== undefined && data.clusterArn !== null) {
1996
+ if (data.clusterArn != null) {
2380
1997
  contents.ClusterArn = (0, smithy_client_1.expectString)(data.clusterArn);
2381
1998
  }
2382
- if (data.clusterOperationArn !== undefined && data.clusterOperationArn !== null) {
1999
+ if (data.clusterOperationArn != null) {
2383
2000
  contents.ClusterOperationArn = (0, smithy_client_1.expectString)(data.clusterOperationArn);
2384
2001
  }
2385
- return Promise.resolve(contents);
2002
+ return contents;
2386
2003
  };
2387
2004
  exports.deserializeAws_restJson1RebootBrokerCommand = deserializeAws_restJson1RebootBrokerCommand;
2388
2005
  const deserializeAws_restJson1RebootBrokerCommandError = async (output, context) => {
@@ -2390,7 +2007,6 @@ const deserializeAws_restJson1RebootBrokerCommandError = async (output, context)
2390
2007
  ...output,
2391
2008
  body: await parseBody(output.body, context),
2392
2009
  };
2393
- let response;
2394
2010
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2395
2011
  switch (errorCode) {
2396
2012
  case "BadRequestException":
@@ -2416,25 +2032,23 @@ const deserializeAws_restJson1RebootBrokerCommandError = async (output, context)
2416
2032
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2417
2033
  default:
2418
2034
  const parsedBody = parsedOutput.body;
2419
- const $metadata = deserializeMetadata(output);
2420
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2421
- response = new KafkaServiceException_1.KafkaServiceException({
2422
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2423
- $fault: "client",
2424
- $metadata,
2035
+ (0, smithy_client_1.throwDefaultError)({
2036
+ output,
2037
+ parsedBody,
2038
+ exceptionCtor: KafkaServiceException_1.KafkaServiceException,
2039
+ errorCode,
2425
2040
  });
2426
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2427
2041
  }
2428
2042
  };
2429
2043
  const deserializeAws_restJson1TagResourceCommand = async (output, context) => {
2430
2044
  if (output.statusCode !== 204 && output.statusCode >= 300) {
2431
2045
  return deserializeAws_restJson1TagResourceCommandError(output, context);
2432
2046
  }
2433
- const contents = {
2047
+ const contents = map({
2434
2048
  $metadata: deserializeMetadata(output),
2435
- };
2049
+ });
2436
2050
  await collectBody(output.body, context);
2437
- return Promise.resolve(contents);
2051
+ return contents;
2438
2052
  };
2439
2053
  exports.deserializeAws_restJson1TagResourceCommand = deserializeAws_restJson1TagResourceCommand;
2440
2054
  const deserializeAws_restJson1TagResourceCommandError = async (output, context) => {
@@ -2442,7 +2056,6 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
2442
2056
  ...output,
2443
2057
  body: await parseBody(output.body, context),
2444
2058
  };
2445
- let response;
2446
2059
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2447
2060
  switch (errorCode) {
2448
2061
  case "BadRequestException":
@@ -2456,25 +2069,23 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
2456
2069
  throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
2457
2070
  default:
2458
2071
  const parsedBody = parsedOutput.body;
2459
- const $metadata = deserializeMetadata(output);
2460
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2461
- response = new KafkaServiceException_1.KafkaServiceException({
2462
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2463
- $fault: "client",
2464
- $metadata,
2072
+ (0, smithy_client_1.throwDefaultError)({
2073
+ output,
2074
+ parsedBody,
2075
+ exceptionCtor: KafkaServiceException_1.KafkaServiceException,
2076
+ errorCode,
2465
2077
  });
2466
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2467
2078
  }
2468
2079
  };
2469
2080
  const deserializeAws_restJson1UntagResourceCommand = async (output, context) => {
2470
2081
  if (output.statusCode !== 204 && output.statusCode >= 300) {
2471
2082
  return deserializeAws_restJson1UntagResourceCommandError(output, context);
2472
2083
  }
2473
- const contents = {
2084
+ const contents = map({
2474
2085
  $metadata: deserializeMetadata(output),
2475
- };
2086
+ });
2476
2087
  await collectBody(output.body, context);
2477
- return Promise.resolve(contents);
2088
+ return contents;
2478
2089
  };
2479
2090
  exports.deserializeAws_restJson1UntagResourceCommand = deserializeAws_restJson1UntagResourceCommand;
2480
2091
  const deserializeAws_restJson1UntagResourceCommandError = async (output, context) => {
@@ -2482,7 +2093,6 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
2482
2093
  ...output,
2483
2094
  body: await parseBody(output.body, context),
2484
2095
  };
2485
- let response;
2486
2096
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2487
2097
  switch (errorCode) {
2488
2098
  case "BadRequestException":
@@ -2496,33 +2106,29 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
2496
2106
  throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
2497
2107
  default:
2498
2108
  const parsedBody = parsedOutput.body;
2499
- const $metadata = deserializeMetadata(output);
2500
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2501
- response = new KafkaServiceException_1.KafkaServiceException({
2502
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2503
- $fault: "client",
2504
- $metadata,
2109
+ (0, smithy_client_1.throwDefaultError)({
2110
+ output,
2111
+ parsedBody,
2112
+ exceptionCtor: KafkaServiceException_1.KafkaServiceException,
2113
+ errorCode,
2505
2114
  });
2506
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2507
2115
  }
2508
2116
  };
2509
2117
  const deserializeAws_restJson1UpdateBrokerCountCommand = async (output, context) => {
2510
2118
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2511
2119
  return deserializeAws_restJson1UpdateBrokerCountCommandError(output, context);
2512
2120
  }
2513
- const contents = {
2121
+ const contents = map({
2514
2122
  $metadata: deserializeMetadata(output),
2515
- ClusterArn: undefined,
2516
- ClusterOperationArn: undefined,
2517
- };
2123
+ });
2518
2124
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2519
- if (data.clusterArn !== undefined && data.clusterArn !== null) {
2125
+ if (data.clusterArn != null) {
2520
2126
  contents.ClusterArn = (0, smithy_client_1.expectString)(data.clusterArn);
2521
2127
  }
2522
- if (data.clusterOperationArn !== undefined && data.clusterOperationArn !== null) {
2128
+ if (data.clusterOperationArn != null) {
2523
2129
  contents.ClusterOperationArn = (0, smithy_client_1.expectString)(data.clusterOperationArn);
2524
2130
  }
2525
- return Promise.resolve(contents);
2131
+ return contents;
2526
2132
  };
2527
2133
  exports.deserializeAws_restJson1UpdateBrokerCountCommand = deserializeAws_restJson1UpdateBrokerCountCommand;
2528
2134
  const deserializeAws_restJson1UpdateBrokerCountCommandError = async (output, context) => {
@@ -2530,7 +2136,6 @@ const deserializeAws_restJson1UpdateBrokerCountCommandError = async (output, con
2530
2136
  ...output,
2531
2137
  body: await parseBody(output.body, context),
2532
2138
  };
2533
- let response;
2534
2139
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2535
2140
  switch (errorCode) {
2536
2141
  case "BadRequestException":
@@ -2550,33 +2155,29 @@ const deserializeAws_restJson1UpdateBrokerCountCommandError = async (output, con
2550
2155
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2551
2156
  default:
2552
2157
  const parsedBody = parsedOutput.body;
2553
- const $metadata = deserializeMetadata(output);
2554
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2555
- response = new KafkaServiceException_1.KafkaServiceException({
2556
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2557
- $fault: "client",
2558
- $metadata,
2158
+ (0, smithy_client_1.throwDefaultError)({
2159
+ output,
2160
+ parsedBody,
2161
+ exceptionCtor: KafkaServiceException_1.KafkaServiceException,
2162
+ errorCode,
2559
2163
  });
2560
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2561
2164
  }
2562
2165
  };
2563
2166
  const deserializeAws_restJson1UpdateBrokerStorageCommand = async (output, context) => {
2564
2167
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2565
2168
  return deserializeAws_restJson1UpdateBrokerStorageCommandError(output, context);
2566
2169
  }
2567
- const contents = {
2170
+ const contents = map({
2568
2171
  $metadata: deserializeMetadata(output),
2569
- ClusterArn: undefined,
2570
- ClusterOperationArn: undefined,
2571
- };
2172
+ });
2572
2173
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2573
- if (data.clusterArn !== undefined && data.clusterArn !== null) {
2174
+ if (data.clusterArn != null) {
2574
2175
  contents.ClusterArn = (0, smithy_client_1.expectString)(data.clusterArn);
2575
2176
  }
2576
- if (data.clusterOperationArn !== undefined && data.clusterOperationArn !== null) {
2177
+ if (data.clusterOperationArn != null) {
2577
2178
  contents.ClusterOperationArn = (0, smithy_client_1.expectString)(data.clusterOperationArn);
2578
2179
  }
2579
- return Promise.resolve(contents);
2180
+ return contents;
2580
2181
  };
2581
2182
  exports.deserializeAws_restJson1UpdateBrokerStorageCommand = deserializeAws_restJson1UpdateBrokerStorageCommand;
2582
2183
  const deserializeAws_restJson1UpdateBrokerStorageCommandError = async (output, context) => {
@@ -2584,7 +2185,6 @@ const deserializeAws_restJson1UpdateBrokerStorageCommandError = async (output, c
2584
2185
  ...output,
2585
2186
  body: await parseBody(output.body, context),
2586
2187
  };
2587
- let response;
2588
2188
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2589
2189
  switch (errorCode) {
2590
2190
  case "BadRequestException":
@@ -2604,33 +2204,29 @@ const deserializeAws_restJson1UpdateBrokerStorageCommandError = async (output, c
2604
2204
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2605
2205
  default:
2606
2206
  const parsedBody = parsedOutput.body;
2607
- const $metadata = deserializeMetadata(output);
2608
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2609
- response = new KafkaServiceException_1.KafkaServiceException({
2610
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2611
- $fault: "client",
2612
- $metadata,
2207
+ (0, smithy_client_1.throwDefaultError)({
2208
+ output,
2209
+ parsedBody,
2210
+ exceptionCtor: KafkaServiceException_1.KafkaServiceException,
2211
+ errorCode,
2613
2212
  });
2614
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2615
2213
  }
2616
2214
  };
2617
2215
  const deserializeAws_restJson1UpdateBrokerTypeCommand = async (output, context) => {
2618
2216
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2619
2217
  return deserializeAws_restJson1UpdateBrokerTypeCommandError(output, context);
2620
2218
  }
2621
- const contents = {
2219
+ const contents = map({
2622
2220
  $metadata: deserializeMetadata(output),
2623
- ClusterArn: undefined,
2624
- ClusterOperationArn: undefined,
2625
- };
2221
+ });
2626
2222
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2627
- if (data.clusterArn !== undefined && data.clusterArn !== null) {
2223
+ if (data.clusterArn != null) {
2628
2224
  contents.ClusterArn = (0, smithy_client_1.expectString)(data.clusterArn);
2629
2225
  }
2630
- if (data.clusterOperationArn !== undefined && data.clusterOperationArn !== null) {
2226
+ if (data.clusterOperationArn != null) {
2631
2227
  contents.ClusterOperationArn = (0, smithy_client_1.expectString)(data.clusterOperationArn);
2632
2228
  }
2633
- return Promise.resolve(contents);
2229
+ return contents;
2634
2230
  };
2635
2231
  exports.deserializeAws_restJson1UpdateBrokerTypeCommand = deserializeAws_restJson1UpdateBrokerTypeCommand;
2636
2232
  const deserializeAws_restJson1UpdateBrokerTypeCommandError = async (output, context) => {
@@ -2638,7 +2234,6 @@ const deserializeAws_restJson1UpdateBrokerTypeCommandError = async (output, cont
2638
2234
  ...output,
2639
2235
  body: await parseBody(output.body, context),
2640
2236
  };
2641
- let response;
2642
2237
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2643
2238
  switch (errorCode) {
2644
2239
  case "BadRequestException":
@@ -2664,33 +2259,29 @@ const deserializeAws_restJson1UpdateBrokerTypeCommandError = async (output, cont
2664
2259
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2665
2260
  default:
2666
2261
  const parsedBody = parsedOutput.body;
2667
- const $metadata = deserializeMetadata(output);
2668
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2669
- response = new KafkaServiceException_1.KafkaServiceException({
2670
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2671
- $fault: "client",
2672
- $metadata,
2262
+ (0, smithy_client_1.throwDefaultError)({
2263
+ output,
2264
+ parsedBody,
2265
+ exceptionCtor: KafkaServiceException_1.KafkaServiceException,
2266
+ errorCode,
2673
2267
  });
2674
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2675
2268
  }
2676
2269
  };
2677
2270
  const deserializeAws_restJson1UpdateClusterConfigurationCommand = async (output, context) => {
2678
2271
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2679
2272
  return deserializeAws_restJson1UpdateClusterConfigurationCommandError(output, context);
2680
2273
  }
2681
- const contents = {
2274
+ const contents = map({
2682
2275
  $metadata: deserializeMetadata(output),
2683
- ClusterArn: undefined,
2684
- ClusterOperationArn: undefined,
2685
- };
2276
+ });
2686
2277
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2687
- if (data.clusterArn !== undefined && data.clusterArn !== null) {
2278
+ if (data.clusterArn != null) {
2688
2279
  contents.ClusterArn = (0, smithy_client_1.expectString)(data.clusterArn);
2689
2280
  }
2690
- if (data.clusterOperationArn !== undefined && data.clusterOperationArn !== null) {
2281
+ if (data.clusterOperationArn != null) {
2691
2282
  contents.ClusterOperationArn = (0, smithy_client_1.expectString)(data.clusterOperationArn);
2692
2283
  }
2693
- return Promise.resolve(contents);
2284
+ return contents;
2694
2285
  };
2695
2286
  exports.deserializeAws_restJson1UpdateClusterConfigurationCommand = deserializeAws_restJson1UpdateClusterConfigurationCommand;
2696
2287
  const deserializeAws_restJson1UpdateClusterConfigurationCommandError = async (output, context) => {
@@ -2698,7 +2289,6 @@ const deserializeAws_restJson1UpdateClusterConfigurationCommandError = async (ou
2698
2289
  ...output,
2699
2290
  body: await parseBody(output.body, context),
2700
2291
  };
2701
- let response;
2702
2292
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2703
2293
  switch (errorCode) {
2704
2294
  case "BadRequestException":
@@ -2721,33 +2311,29 @@ const deserializeAws_restJson1UpdateClusterConfigurationCommandError = async (ou
2721
2311
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2722
2312
  default:
2723
2313
  const parsedBody = parsedOutput.body;
2724
- const $metadata = deserializeMetadata(output);
2725
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2726
- response = new KafkaServiceException_1.KafkaServiceException({
2727
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2728
- $fault: "client",
2729
- $metadata,
2314
+ (0, smithy_client_1.throwDefaultError)({
2315
+ output,
2316
+ parsedBody,
2317
+ exceptionCtor: KafkaServiceException_1.KafkaServiceException,
2318
+ errorCode,
2730
2319
  });
2731
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2732
2320
  }
2733
2321
  };
2734
2322
  const deserializeAws_restJson1UpdateClusterKafkaVersionCommand = async (output, context) => {
2735
2323
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2736
2324
  return deserializeAws_restJson1UpdateClusterKafkaVersionCommandError(output, context);
2737
2325
  }
2738
- const contents = {
2326
+ const contents = map({
2739
2327
  $metadata: deserializeMetadata(output),
2740
- ClusterArn: undefined,
2741
- ClusterOperationArn: undefined,
2742
- };
2328
+ });
2743
2329
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2744
- if (data.clusterArn !== undefined && data.clusterArn !== null) {
2330
+ if (data.clusterArn != null) {
2745
2331
  contents.ClusterArn = (0, smithy_client_1.expectString)(data.clusterArn);
2746
2332
  }
2747
- if (data.clusterOperationArn !== undefined && data.clusterOperationArn !== null) {
2333
+ if (data.clusterOperationArn != null) {
2748
2334
  contents.ClusterOperationArn = (0, smithy_client_1.expectString)(data.clusterOperationArn);
2749
2335
  }
2750
- return Promise.resolve(contents);
2336
+ return contents;
2751
2337
  };
2752
2338
  exports.deserializeAws_restJson1UpdateClusterKafkaVersionCommand = deserializeAws_restJson1UpdateClusterKafkaVersionCommand;
2753
2339
  const deserializeAws_restJson1UpdateClusterKafkaVersionCommandError = async (output, context) => {
@@ -2755,7 +2341,6 @@ const deserializeAws_restJson1UpdateClusterKafkaVersionCommandError = async (out
2755
2341
  ...output,
2756
2342
  body: await parseBody(output.body, context),
2757
2343
  };
2758
- let response;
2759
2344
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2760
2345
  switch (errorCode) {
2761
2346
  case "BadRequestException":
@@ -2781,33 +2366,29 @@ const deserializeAws_restJson1UpdateClusterKafkaVersionCommandError = async (out
2781
2366
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2782
2367
  default:
2783
2368
  const parsedBody = parsedOutput.body;
2784
- const $metadata = deserializeMetadata(output);
2785
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2786
- response = new KafkaServiceException_1.KafkaServiceException({
2787
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2788
- $fault: "client",
2789
- $metadata,
2369
+ (0, smithy_client_1.throwDefaultError)({
2370
+ output,
2371
+ parsedBody,
2372
+ exceptionCtor: KafkaServiceException_1.KafkaServiceException,
2373
+ errorCode,
2790
2374
  });
2791
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2792
2375
  }
2793
2376
  };
2794
2377
  const deserializeAws_restJson1UpdateConfigurationCommand = async (output, context) => {
2795
2378
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2796
2379
  return deserializeAws_restJson1UpdateConfigurationCommandError(output, context);
2797
2380
  }
2798
- const contents = {
2381
+ const contents = map({
2799
2382
  $metadata: deserializeMetadata(output),
2800
- Arn: undefined,
2801
- LatestRevision: undefined,
2802
- };
2383
+ });
2803
2384
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2804
- if (data.arn !== undefined && data.arn !== null) {
2385
+ if (data.arn != null) {
2805
2386
  contents.Arn = (0, smithy_client_1.expectString)(data.arn);
2806
2387
  }
2807
- if (data.latestRevision !== undefined && data.latestRevision !== null) {
2388
+ if (data.latestRevision != null) {
2808
2389
  contents.LatestRevision = deserializeAws_restJson1ConfigurationRevision(data.latestRevision, context);
2809
2390
  }
2810
- return Promise.resolve(contents);
2391
+ return contents;
2811
2392
  };
2812
2393
  exports.deserializeAws_restJson1UpdateConfigurationCommand = deserializeAws_restJson1UpdateConfigurationCommand;
2813
2394
  const deserializeAws_restJson1UpdateConfigurationCommandError = async (output, context) => {
@@ -2815,7 +2396,6 @@ const deserializeAws_restJson1UpdateConfigurationCommandError = async (output, c
2815
2396
  ...output,
2816
2397
  body: await parseBody(output.body, context),
2817
2398
  };
2818
- let response;
2819
2399
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2820
2400
  switch (errorCode) {
2821
2401
  case "BadRequestException":
@@ -2838,33 +2418,29 @@ const deserializeAws_restJson1UpdateConfigurationCommandError = async (output, c
2838
2418
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2839
2419
  default:
2840
2420
  const parsedBody = parsedOutput.body;
2841
- const $metadata = deserializeMetadata(output);
2842
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2843
- response = new KafkaServiceException_1.KafkaServiceException({
2844
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2845
- $fault: "client",
2846
- $metadata,
2421
+ (0, smithy_client_1.throwDefaultError)({
2422
+ output,
2423
+ parsedBody,
2424
+ exceptionCtor: KafkaServiceException_1.KafkaServiceException,
2425
+ errorCode,
2847
2426
  });
2848
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2849
2427
  }
2850
2428
  };
2851
2429
  const deserializeAws_restJson1UpdateConnectivityCommand = async (output, context) => {
2852
2430
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2853
2431
  return deserializeAws_restJson1UpdateConnectivityCommandError(output, context);
2854
2432
  }
2855
- const contents = {
2433
+ const contents = map({
2856
2434
  $metadata: deserializeMetadata(output),
2857
- ClusterArn: undefined,
2858
- ClusterOperationArn: undefined,
2859
- };
2435
+ });
2860
2436
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2861
- if (data.clusterArn !== undefined && data.clusterArn !== null) {
2437
+ if (data.clusterArn != null) {
2862
2438
  contents.ClusterArn = (0, smithy_client_1.expectString)(data.clusterArn);
2863
2439
  }
2864
- if (data.clusterOperationArn !== undefined && data.clusterOperationArn !== null) {
2440
+ if (data.clusterOperationArn != null) {
2865
2441
  contents.ClusterOperationArn = (0, smithy_client_1.expectString)(data.clusterOperationArn);
2866
2442
  }
2867
- return Promise.resolve(contents);
2443
+ return contents;
2868
2444
  };
2869
2445
  exports.deserializeAws_restJson1UpdateConnectivityCommand = deserializeAws_restJson1UpdateConnectivityCommand;
2870
2446
  const deserializeAws_restJson1UpdateConnectivityCommandError = async (output, context) => {
@@ -2872,7 +2448,6 @@ const deserializeAws_restJson1UpdateConnectivityCommandError = async (output, co
2872
2448
  ...output,
2873
2449
  body: await parseBody(output.body, context),
2874
2450
  };
2875
- let response;
2876
2451
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2877
2452
  switch (errorCode) {
2878
2453
  case "BadRequestException":
@@ -2895,33 +2470,29 @@ const deserializeAws_restJson1UpdateConnectivityCommandError = async (output, co
2895
2470
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2896
2471
  default:
2897
2472
  const parsedBody = parsedOutput.body;
2898
- const $metadata = deserializeMetadata(output);
2899
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2900
- response = new KafkaServiceException_1.KafkaServiceException({
2901
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2902
- $fault: "client",
2903
- $metadata,
2473
+ (0, smithy_client_1.throwDefaultError)({
2474
+ output,
2475
+ parsedBody,
2476
+ exceptionCtor: KafkaServiceException_1.KafkaServiceException,
2477
+ errorCode,
2904
2478
  });
2905
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2906
2479
  }
2907
2480
  };
2908
2481
  const deserializeAws_restJson1UpdateMonitoringCommand = async (output, context) => {
2909
2482
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2910
2483
  return deserializeAws_restJson1UpdateMonitoringCommandError(output, context);
2911
2484
  }
2912
- const contents = {
2485
+ const contents = map({
2913
2486
  $metadata: deserializeMetadata(output),
2914
- ClusterArn: undefined,
2915
- ClusterOperationArn: undefined,
2916
- };
2487
+ });
2917
2488
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2918
- if (data.clusterArn !== undefined && data.clusterArn !== null) {
2489
+ if (data.clusterArn != null) {
2919
2490
  contents.ClusterArn = (0, smithy_client_1.expectString)(data.clusterArn);
2920
2491
  }
2921
- if (data.clusterOperationArn !== undefined && data.clusterOperationArn !== null) {
2492
+ if (data.clusterOperationArn != null) {
2922
2493
  contents.ClusterOperationArn = (0, smithy_client_1.expectString)(data.clusterOperationArn);
2923
2494
  }
2924
- return Promise.resolve(contents);
2495
+ return contents;
2925
2496
  };
2926
2497
  exports.deserializeAws_restJson1UpdateMonitoringCommand = deserializeAws_restJson1UpdateMonitoringCommand;
2927
2498
  const deserializeAws_restJson1UpdateMonitoringCommandError = async (output, context) => {
@@ -2929,7 +2500,6 @@ const deserializeAws_restJson1UpdateMonitoringCommandError = async (output, cont
2929
2500
  ...output,
2930
2501
  body: await parseBody(output.body, context),
2931
2502
  };
2932
- let response;
2933
2503
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2934
2504
  switch (errorCode) {
2935
2505
  case "BadRequestException":
@@ -2949,33 +2519,29 @@ const deserializeAws_restJson1UpdateMonitoringCommandError = async (output, cont
2949
2519
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2950
2520
  default:
2951
2521
  const parsedBody = parsedOutput.body;
2952
- const $metadata = deserializeMetadata(output);
2953
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2954
- response = new KafkaServiceException_1.KafkaServiceException({
2955
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2956
- $fault: "client",
2957
- $metadata,
2522
+ (0, smithy_client_1.throwDefaultError)({
2523
+ output,
2524
+ parsedBody,
2525
+ exceptionCtor: KafkaServiceException_1.KafkaServiceException,
2526
+ errorCode,
2958
2527
  });
2959
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2960
2528
  }
2961
2529
  };
2962
2530
  const deserializeAws_restJson1UpdateSecurityCommand = async (output, context) => {
2963
2531
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2964
2532
  return deserializeAws_restJson1UpdateSecurityCommandError(output, context);
2965
2533
  }
2966
- const contents = {
2534
+ const contents = map({
2967
2535
  $metadata: deserializeMetadata(output),
2968
- ClusterArn: undefined,
2969
- ClusterOperationArn: undefined,
2970
- };
2536
+ });
2971
2537
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2972
- if (data.clusterArn !== undefined && data.clusterArn !== null) {
2538
+ if (data.clusterArn != null) {
2973
2539
  contents.ClusterArn = (0, smithy_client_1.expectString)(data.clusterArn);
2974
2540
  }
2975
- if (data.clusterOperationArn !== undefined && data.clusterOperationArn !== null) {
2541
+ if (data.clusterOperationArn != null) {
2976
2542
  contents.ClusterOperationArn = (0, smithy_client_1.expectString)(data.clusterOperationArn);
2977
2543
  }
2978
- return Promise.resolve(contents);
2544
+ return contents;
2979
2545
  };
2980
2546
  exports.deserializeAws_restJson1UpdateSecurityCommand = deserializeAws_restJson1UpdateSecurityCommand;
2981
2547
  const deserializeAws_restJson1UpdateSecurityCommandError = async (output, context) => {
@@ -2983,7 +2549,6 @@ const deserializeAws_restJson1UpdateSecurityCommandError = async (output, contex
2983
2549
  ...output,
2984
2550
  body: await parseBody(output.body, context),
2985
2551
  };
2986
- let response;
2987
2552
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2988
2553
  switch (errorCode) {
2989
2554
  case "BadRequestException":
@@ -3009,23 +2574,22 @@ const deserializeAws_restJson1UpdateSecurityCommandError = async (output, contex
3009
2574
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
3010
2575
  default:
3011
2576
  const parsedBody = parsedOutput.body;
3012
- const $metadata = deserializeMetadata(output);
3013
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3014
- response = new KafkaServiceException_1.KafkaServiceException({
3015
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3016
- $fault: "client",
3017
- $metadata,
2577
+ (0, smithy_client_1.throwDefaultError)({
2578
+ output,
2579
+ parsedBody,
2580
+ exceptionCtor: KafkaServiceException_1.KafkaServiceException,
2581
+ errorCode,
3018
2582
  });
3019
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3020
2583
  }
3021
2584
  };
2585
+ const map = smithy_client_1.map;
3022
2586
  const deserializeAws_restJson1BadRequestExceptionResponse = async (parsedOutput, context) => {
3023
- const contents = {};
2587
+ const contents = map({});
3024
2588
  const data = parsedOutput.body;
3025
- if (data.invalidParameter !== undefined && data.invalidParameter !== null) {
2589
+ if (data.invalidParameter != null) {
3026
2590
  contents.InvalidParameter = (0, smithy_client_1.expectString)(data.invalidParameter);
3027
2591
  }
3028
- if (data.message !== undefined && data.message !== null) {
2592
+ if (data.message != null) {
3029
2593
  contents.Message = (0, smithy_client_1.expectString)(data.message);
3030
2594
  }
3031
2595
  const exception = new models_0_1.BadRequestException({
@@ -3035,12 +2599,12 @@ const deserializeAws_restJson1BadRequestExceptionResponse = async (parsedOutput,
3035
2599
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3036
2600
  };
3037
2601
  const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, context) => {
3038
- const contents = {};
2602
+ const contents = map({});
3039
2603
  const data = parsedOutput.body;
3040
- if (data.invalidParameter !== undefined && data.invalidParameter !== null) {
2604
+ if (data.invalidParameter != null) {
3041
2605
  contents.InvalidParameter = (0, smithy_client_1.expectString)(data.invalidParameter);
3042
2606
  }
3043
- if (data.message !== undefined && data.message !== null) {
2607
+ if (data.message != null) {
3044
2608
  contents.Message = (0, smithy_client_1.expectString)(data.message);
3045
2609
  }
3046
2610
  const exception = new models_0_1.ConflictException({
@@ -3050,12 +2614,12 @@ const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, c
3050
2614
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3051
2615
  };
3052
2616
  const deserializeAws_restJson1ForbiddenExceptionResponse = async (parsedOutput, context) => {
3053
- const contents = {};
2617
+ const contents = map({});
3054
2618
  const data = parsedOutput.body;
3055
- if (data.invalidParameter !== undefined && data.invalidParameter !== null) {
2619
+ if (data.invalidParameter != null) {
3056
2620
  contents.InvalidParameter = (0, smithy_client_1.expectString)(data.invalidParameter);
3057
2621
  }
3058
- if (data.message !== undefined && data.message !== null) {
2622
+ if (data.message != null) {
3059
2623
  contents.Message = (0, smithy_client_1.expectString)(data.message);
3060
2624
  }
3061
2625
  const exception = new models_0_1.ForbiddenException({
@@ -3065,12 +2629,12 @@ const deserializeAws_restJson1ForbiddenExceptionResponse = async (parsedOutput,
3065
2629
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3066
2630
  };
3067
2631
  const deserializeAws_restJson1InternalServerErrorExceptionResponse = async (parsedOutput, context) => {
3068
- const contents = {};
2632
+ const contents = map({});
3069
2633
  const data = parsedOutput.body;
3070
- if (data.invalidParameter !== undefined && data.invalidParameter !== null) {
2634
+ if (data.invalidParameter != null) {
3071
2635
  contents.InvalidParameter = (0, smithy_client_1.expectString)(data.invalidParameter);
3072
2636
  }
3073
- if (data.message !== undefined && data.message !== null) {
2637
+ if (data.message != null) {
3074
2638
  contents.Message = (0, smithy_client_1.expectString)(data.message);
3075
2639
  }
3076
2640
  const exception = new models_0_1.InternalServerErrorException({
@@ -3080,12 +2644,12 @@ const deserializeAws_restJson1InternalServerErrorExceptionResponse = async (pars
3080
2644
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3081
2645
  };
3082
2646
  const deserializeAws_restJson1NotFoundExceptionResponse = async (parsedOutput, context) => {
3083
- const contents = {};
2647
+ const contents = map({});
3084
2648
  const data = parsedOutput.body;
3085
- if (data.invalidParameter !== undefined && data.invalidParameter !== null) {
2649
+ if (data.invalidParameter != null) {
3086
2650
  contents.InvalidParameter = (0, smithy_client_1.expectString)(data.invalidParameter);
3087
2651
  }
3088
- if (data.message !== undefined && data.message !== null) {
2652
+ if (data.message != null) {
3089
2653
  contents.Message = (0, smithy_client_1.expectString)(data.message);
3090
2654
  }
3091
2655
  const exception = new models_0_1.NotFoundException({
@@ -3095,12 +2659,12 @@ const deserializeAws_restJson1NotFoundExceptionResponse = async (parsedOutput, c
3095
2659
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3096
2660
  };
3097
2661
  const deserializeAws_restJson1ServiceUnavailableExceptionResponse = async (parsedOutput, context) => {
3098
- const contents = {};
2662
+ const contents = map({});
3099
2663
  const data = parsedOutput.body;
3100
- if (data.invalidParameter !== undefined && data.invalidParameter !== null) {
2664
+ if (data.invalidParameter != null) {
3101
2665
  contents.InvalidParameter = (0, smithy_client_1.expectString)(data.invalidParameter);
3102
2666
  }
3103
- if (data.message !== undefined && data.message !== null) {
2667
+ if (data.message != null) {
3104
2668
  contents.Message = (0, smithy_client_1.expectString)(data.message);
3105
2669
  }
3106
2670
  const exception = new models_0_1.ServiceUnavailableException({
@@ -3110,12 +2674,12 @@ const deserializeAws_restJson1ServiceUnavailableExceptionResponse = async (parse
3110
2674
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3111
2675
  };
3112
2676
  const deserializeAws_restJson1TooManyRequestsExceptionResponse = async (parsedOutput, context) => {
3113
- const contents = {};
2677
+ const contents = map({});
3114
2678
  const data = parsedOutput.body;
3115
- if (data.invalidParameter !== undefined && data.invalidParameter !== null) {
2679
+ if (data.invalidParameter != null) {
3116
2680
  contents.InvalidParameter = (0, smithy_client_1.expectString)(data.invalidParameter);
3117
2681
  }
3118
- if (data.message !== undefined && data.message !== null) {
2682
+ if (data.message != null) {
3119
2683
  contents.Message = (0, smithy_client_1.expectString)(data.message);
3120
2684
  }
3121
2685
  const exception = new models_0_1.TooManyRequestsException({
@@ -3125,12 +2689,12 @@ const deserializeAws_restJson1TooManyRequestsExceptionResponse = async (parsedOu
3125
2689
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3126
2690
  };
3127
2691
  const deserializeAws_restJson1UnauthorizedExceptionResponse = async (parsedOutput, context) => {
3128
- const contents = {};
2692
+ const contents = map({});
3129
2693
  const data = parsedOutput.body;
3130
- if (data.invalidParameter !== undefined && data.invalidParameter !== null) {
2694
+ if (data.invalidParameter != null) {
3131
2695
  contents.InvalidParameter = (0, smithy_client_1.expectString)(data.invalidParameter);
3132
2696
  }
3133
- if (data.message !== undefined && data.message !== null) {
2697
+ if (data.message != null) {
3134
2698
  contents.Message = (0, smithy_client_1.expectString)(data.message);
3135
2699
  }
3136
2700
  const exception = new models_0_1.UnauthorizedException({
@@ -3143,9 +2707,6 @@ const serializeAws_restJson1__listOf__string = (input, context) => {
3143
2707
  return input
3144
2708
  .filter((e) => e != null)
3145
2709
  .map((entry) => {
3146
- if (entry === null) {
3147
- return null;
3148
- }
3149
2710
  return entry;
3150
2711
  });
3151
2712
  };
@@ -3153,9 +2714,6 @@ const serializeAws_restJson1__listOfBrokerEBSVolumeInfo = (input, context) => {
3153
2714
  return input
3154
2715
  .filter((e) => e != null)
3155
2716
  .map((entry) => {
3156
- if (entry === null) {
3157
- return null;
3158
- }
3159
2717
  return serializeAws_restJson1BrokerEBSVolumeInfo(entry, context);
3160
2718
  });
3161
2719
  };
@@ -3163,9 +2721,6 @@ const serializeAws_restJson1__listOfVpcConfig = (input, context) => {
3163
2721
  return input
3164
2722
  .filter((e) => e != null)
3165
2723
  .map((entry) => {
3166
- if (entry === null) {
3167
- return null;
3168
- }
3169
2724
  return serializeAws_restJson1VpcConfig(entry, context);
3170
2725
  });
3171
2726
  };