@aws-sdk/client-emr-serverless 3.141.0 → 3.142.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,26 +11,8 @@ const serializeAws_restJson1CancelJobRunCommand = async (input, context) => {
11
11
  const headers = {};
12
12
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
13
13
  "/applications/{applicationId}/jobruns/{jobRunId}";
14
- if (input.applicationId !== undefined) {
15
- const labelValue = input.applicationId;
16
- if (labelValue.length <= 0) {
17
- throw new Error("Empty value provided for input HTTP label: applicationId.");
18
- }
19
- resolvedPath = resolvedPath.replace("{applicationId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
20
- }
21
- else {
22
- throw new Error("No value provided for input HTTP label: applicationId.");
23
- }
24
- if (input.jobRunId !== undefined) {
25
- const labelValue = input.jobRunId;
26
- if (labelValue.length <= 0) {
27
- throw new Error("Empty value provided for input HTTP label: jobRunId.");
28
- }
29
- resolvedPath = resolvedPath.replace("{jobRunId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
30
- }
31
- else {
32
- throw new Error("No value provided for input HTTP label: jobRunId.");
33
- }
14
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "applicationId", () => input.applicationId, "{applicationId}", false);
15
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "jobRunId", () => input.jobRunId, "{jobRunId}", false);
34
16
  let body;
35
17
  return new protocol_http_1.HttpRequest({
36
18
  protocol,
@@ -88,16 +70,7 @@ const serializeAws_restJson1DeleteApplicationCommand = async (input, context) =>
88
70
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
89
71
  const headers = {};
90
72
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/applications/{applicationId}";
91
- if (input.applicationId !== undefined) {
92
- const labelValue = input.applicationId;
93
- if (labelValue.length <= 0) {
94
- throw new Error("Empty value provided for input HTTP label: applicationId.");
95
- }
96
- resolvedPath = resolvedPath.replace("{applicationId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
97
- }
98
- else {
99
- throw new Error("No value provided for input HTTP label: applicationId.");
100
- }
73
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "applicationId", () => input.applicationId, "{applicationId}", false);
101
74
  let body;
102
75
  return new protocol_http_1.HttpRequest({
103
76
  protocol,
@@ -114,16 +87,7 @@ const serializeAws_restJson1GetApplicationCommand = async (input, context) => {
114
87
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
115
88
  const headers = {};
116
89
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/applications/{applicationId}";
117
- if (input.applicationId !== undefined) {
118
- const labelValue = input.applicationId;
119
- if (labelValue.length <= 0) {
120
- throw new Error("Empty value provided for input HTTP label: applicationId.");
121
- }
122
- resolvedPath = resolvedPath.replace("{applicationId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
123
- }
124
- else {
125
- throw new Error("No value provided for input HTTP label: applicationId.");
126
- }
90
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "applicationId", () => input.applicationId, "{applicationId}", false);
127
91
  let body;
128
92
  return new protocol_http_1.HttpRequest({
129
93
  protocol,
@@ -141,26 +105,8 @@ const serializeAws_restJson1GetJobRunCommand = async (input, context) => {
141
105
  const headers = {};
142
106
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
143
107
  "/applications/{applicationId}/jobruns/{jobRunId}";
144
- if (input.applicationId !== undefined) {
145
- const labelValue = input.applicationId;
146
- if (labelValue.length <= 0) {
147
- throw new Error("Empty value provided for input HTTP label: applicationId.");
148
- }
149
- resolvedPath = resolvedPath.replace("{applicationId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
150
- }
151
- else {
152
- throw new Error("No value provided for input HTTP label: applicationId.");
153
- }
154
- if (input.jobRunId !== undefined) {
155
- const labelValue = input.jobRunId;
156
- if (labelValue.length <= 0) {
157
- throw new Error("Empty value provided for input HTTP label: jobRunId.");
158
- }
159
- resolvedPath = resolvedPath.replace("{jobRunId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
160
- }
161
- else {
162
- throw new Error("No value provided for input HTTP label: jobRunId.");
163
- }
108
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "applicationId", () => input.applicationId, "{applicationId}", false);
109
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "jobRunId", () => input.jobRunId, "{jobRunId}", false);
164
110
  let body;
165
111
  return new protocol_http_1.HttpRequest({
166
112
  protocol,
@@ -177,13 +123,14 @@ const serializeAws_restJson1ListApplicationsCommand = async (input, context) =>
177
123
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
178
124
  const headers = {};
179
125
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/applications";
180
- const query = {
181
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
182
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
183
- ...(input.states !== undefined && {
184
- states: (Array.from(input.states.values()) || []).map((_entry) => _entry),
185
- }),
186
- };
126
+ const query = map({
127
+ nextToken: [, input.nextToken],
128
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
129
+ states: [
130
+ () => input.states !== void 0,
131
+ () => (Array.from(input.states.values()) || []).map((_entry) => _entry),
132
+ ],
133
+ });
187
134
  let body;
188
135
  return new protocol_http_1.HttpRequest({
189
136
  protocol,
@@ -201,29 +148,23 @@ const serializeAws_restJson1ListJobRunsCommand = async (input, context) => {
201
148
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
202
149
  const headers = {};
203
150
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/applications/{applicationId}/jobruns";
204
- if (input.applicationId !== undefined) {
205
- const labelValue = input.applicationId;
206
- if (labelValue.length <= 0) {
207
- throw new Error("Empty value provided for input HTTP label: applicationId.");
208
- }
209
- resolvedPath = resolvedPath.replace("{applicationId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
210
- }
211
- else {
212
- throw new Error("No value provided for input HTTP label: applicationId.");
213
- }
214
- const query = {
215
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
216
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
217
- ...(input.createdAtAfter !== undefined && {
218
- createdAtAfter: (input.createdAtAfter.toISOString().split(".")[0] + "Z").toString(),
219
- }),
220
- ...(input.createdAtBefore !== undefined && {
221
- createdAtBefore: (input.createdAtBefore.toISOString().split(".")[0] + "Z").toString(),
222
- }),
223
- ...(input.states !== undefined && {
224
- states: (Array.from(input.states.values()) || []).map((_entry) => _entry),
225
- }),
226
- };
151
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "applicationId", () => input.applicationId, "{applicationId}", false);
152
+ const query = map({
153
+ nextToken: [, input.nextToken],
154
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
155
+ createdAtAfter: [
156
+ () => input.createdAtAfter !== void 0,
157
+ () => (input.createdAtAfter.toISOString().split(".")[0] + "Z").toString(),
158
+ ],
159
+ createdAtBefore: [
160
+ () => input.createdAtBefore !== void 0,
161
+ () => (input.createdAtBefore.toISOString().split(".")[0] + "Z").toString(),
162
+ ],
163
+ states: [
164
+ () => input.states !== void 0,
165
+ () => (Array.from(input.states.values()) || []).map((_entry) => _entry),
166
+ ],
167
+ });
227
168
  let body;
228
169
  return new protocol_http_1.HttpRequest({
229
170
  protocol,
@@ -241,16 +182,7 @@ const serializeAws_restJson1ListTagsForResourceCommand = async (input, context)
241
182
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
242
183
  const headers = {};
243
184
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
244
- if (input.resourceArn !== undefined) {
245
- const labelValue = input.resourceArn;
246
- if (labelValue.length <= 0) {
247
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
248
- }
249
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
250
- }
251
- else {
252
- throw new Error("No value provided for input HTTP label: resourceArn.");
253
- }
185
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
254
186
  let body;
255
187
  return new protocol_http_1.HttpRequest({
256
188
  protocol,
@@ -267,16 +199,7 @@ const serializeAws_restJson1StartApplicationCommand = async (input, context) =>
267
199
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
268
200
  const headers = {};
269
201
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/applications/{applicationId}/start";
270
- if (input.applicationId !== undefined) {
271
- const labelValue = input.applicationId;
272
- if (labelValue.length <= 0) {
273
- throw new Error("Empty value provided for input HTTP label: applicationId.");
274
- }
275
- resolvedPath = resolvedPath.replace("{applicationId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
276
- }
277
- else {
278
- throw new Error("No value provided for input HTTP label: applicationId.");
279
- }
202
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "applicationId", () => input.applicationId, "{applicationId}", false);
280
203
  let body;
281
204
  return new protocol_http_1.HttpRequest({
282
205
  protocol,
@@ -296,16 +219,7 @@ const serializeAws_restJson1StartJobRunCommand = async (input, context) => {
296
219
  "content-type": "application/json",
297
220
  };
298
221
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/applications/{applicationId}/jobruns";
299
- if (input.applicationId !== undefined) {
300
- const labelValue = input.applicationId;
301
- if (labelValue.length <= 0) {
302
- throw new Error("Empty value provided for input HTTP label: applicationId.");
303
- }
304
- resolvedPath = resolvedPath.replace("{applicationId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
305
- }
306
- else {
307
- throw new Error("No value provided for input HTTP label: applicationId.");
308
- }
222
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "applicationId", () => input.applicationId, "{applicationId}", false);
309
223
  let body;
310
224
  body = JSON.stringify({
311
225
  clientToken: (_a = input.clientToken) !== null && _a !== void 0 ? _a : (0, uuid_1.v4)(),
@@ -333,16 +247,7 @@ const serializeAws_restJson1StopApplicationCommand = async (input, context) => {
333
247
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
334
248
  const headers = {};
335
249
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/applications/{applicationId}/stop";
336
- if (input.applicationId !== undefined) {
337
- const labelValue = input.applicationId;
338
- if (labelValue.length <= 0) {
339
- throw new Error("Empty value provided for input HTTP label: applicationId.");
340
- }
341
- resolvedPath = resolvedPath.replace("{applicationId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
342
- }
343
- else {
344
- throw new Error("No value provided for input HTTP label: applicationId.");
345
- }
250
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "applicationId", () => input.applicationId, "{applicationId}", false);
346
251
  let body;
347
252
  return new protocol_http_1.HttpRequest({
348
253
  protocol,
@@ -361,16 +266,7 @@ const serializeAws_restJson1TagResourceCommand = async (input, context) => {
361
266
  "content-type": "application/json",
362
267
  };
363
268
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
364
- if (input.resourceArn !== undefined) {
365
- const labelValue = input.resourceArn;
366
- if (labelValue.length <= 0) {
367
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
368
- }
369
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
370
- }
371
- else {
372
- throw new Error("No value provided for input HTTP label: resourceArn.");
373
- }
269
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
374
270
  let body;
375
271
  body = JSON.stringify({
376
272
  ...(input.tags != null && { tags: serializeAws_restJson1TagMap(input.tags, context) }),
@@ -390,19 +286,10 @@ const serializeAws_restJson1UntagResourceCommand = async (input, context) => {
390
286
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
391
287
  const headers = {};
392
288
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
393
- if (input.resourceArn !== undefined) {
394
- const labelValue = input.resourceArn;
395
- if (labelValue.length <= 0) {
396
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
397
- }
398
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
399
- }
400
- else {
401
- throw new Error("No value provided for input HTTP label: resourceArn.");
402
- }
403
- const query = {
404
- ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry) }),
405
- };
289
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
290
+ const query = map({
291
+ tagKeys: [() => input.tagKeys !== void 0, () => (input.tagKeys || []).map((_entry) => _entry)],
292
+ });
406
293
  let body;
407
294
  return new protocol_http_1.HttpRequest({
408
295
  protocol,
@@ -423,16 +310,7 @@ const serializeAws_restJson1UpdateApplicationCommand = async (input, context) =>
423
310
  "content-type": "application/json",
424
311
  };
425
312
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/applications/{applicationId}";
426
- if (input.applicationId !== undefined) {
427
- const labelValue = input.applicationId;
428
- if (labelValue.length <= 0) {
429
- throw new Error("Empty value provided for input HTTP label: applicationId.");
430
- }
431
- resolvedPath = resolvedPath.replace("{applicationId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
432
- }
433
- else {
434
- throw new Error("No value provided for input HTTP label: applicationId.");
435
- }
313
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "applicationId", () => input.applicationId, "{applicationId}", false);
436
314
  let body;
437
315
  body = JSON.stringify({
438
316
  ...(input.autoStartConfiguration != null && {
@@ -467,19 +345,17 @@ const deserializeAws_restJson1CancelJobRunCommand = async (output, context) => {
467
345
  if (output.statusCode !== 200 && output.statusCode >= 300) {
468
346
  return deserializeAws_restJson1CancelJobRunCommandError(output, context);
469
347
  }
470
- const contents = {
348
+ const contents = map({
471
349
  $metadata: deserializeMetadata(output),
472
- applicationId: undefined,
473
- jobRunId: undefined,
474
- };
350
+ });
475
351
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
476
- if (data.applicationId !== undefined && data.applicationId !== null) {
352
+ if (data.applicationId != null) {
477
353
  contents.applicationId = (0, smithy_client_1.expectString)(data.applicationId);
478
354
  }
479
- if (data.jobRunId !== undefined && data.jobRunId !== null) {
355
+ if (data.jobRunId != null) {
480
356
  contents.jobRunId = (0, smithy_client_1.expectString)(data.jobRunId);
481
357
  }
482
- return Promise.resolve(contents);
358
+ return contents;
483
359
  };
484
360
  exports.deserializeAws_restJson1CancelJobRunCommand = deserializeAws_restJson1CancelJobRunCommand;
485
361
  const deserializeAws_restJson1CancelJobRunCommandError = async (output, context) => {
@@ -487,7 +363,6 @@ const deserializeAws_restJson1CancelJobRunCommandError = async (output, context)
487
363
  ...output,
488
364
  body: await parseBody(output.body, context),
489
365
  };
490
- let response;
491
366
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
492
367
  switch (errorCode) {
493
368
  case "InternalServerException":
@@ -501,37 +376,32 @@ const deserializeAws_restJson1CancelJobRunCommandError = async (output, context)
501
376
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
502
377
  default:
503
378
  const parsedBody = parsedOutput.body;
504
- const $metadata = deserializeMetadata(output);
505
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
506
- response = new EMRServerlessServiceException_1.EMRServerlessServiceException({
507
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
508
- $fault: "client",
509
- $metadata,
379
+ (0, smithy_client_1.throwDefaultError)({
380
+ output,
381
+ parsedBody,
382
+ exceptionCtor: EMRServerlessServiceException_1.EMRServerlessServiceException,
383
+ errorCode,
510
384
  });
511
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
512
385
  }
513
386
  };
514
387
  const deserializeAws_restJson1CreateApplicationCommand = async (output, context) => {
515
388
  if (output.statusCode !== 200 && output.statusCode >= 300) {
516
389
  return deserializeAws_restJson1CreateApplicationCommandError(output, context);
517
390
  }
518
- const contents = {
391
+ const contents = map({
519
392
  $metadata: deserializeMetadata(output),
520
- applicationId: undefined,
521
- arn: undefined,
522
- name: undefined,
523
- };
393
+ });
524
394
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
525
- if (data.applicationId !== undefined && data.applicationId !== null) {
395
+ if (data.applicationId != null) {
526
396
  contents.applicationId = (0, smithy_client_1.expectString)(data.applicationId);
527
397
  }
528
- if (data.arn !== undefined && data.arn !== null) {
398
+ if (data.arn != null) {
529
399
  contents.arn = (0, smithy_client_1.expectString)(data.arn);
530
400
  }
531
- if (data.name !== undefined && data.name !== null) {
401
+ if (data.name != null) {
532
402
  contents.name = (0, smithy_client_1.expectString)(data.name);
533
403
  }
534
- return Promise.resolve(contents);
404
+ return contents;
535
405
  };
536
406
  exports.deserializeAws_restJson1CreateApplicationCommand = deserializeAws_restJson1CreateApplicationCommand;
537
407
  const deserializeAws_restJson1CreateApplicationCommandError = async (output, context) => {
@@ -539,7 +409,6 @@ const deserializeAws_restJson1CreateApplicationCommandError = async (output, con
539
409
  ...output,
540
410
  body: await parseBody(output.body, context),
541
411
  };
542
- let response;
543
412
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
544
413
  switch (errorCode) {
545
414
  case "ConflictException":
@@ -553,25 +422,23 @@ const deserializeAws_restJson1CreateApplicationCommandError = async (output, con
553
422
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
554
423
  default:
555
424
  const parsedBody = parsedOutput.body;
556
- const $metadata = deserializeMetadata(output);
557
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
558
- response = new EMRServerlessServiceException_1.EMRServerlessServiceException({
559
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
560
- $fault: "client",
561
- $metadata,
425
+ (0, smithy_client_1.throwDefaultError)({
426
+ output,
427
+ parsedBody,
428
+ exceptionCtor: EMRServerlessServiceException_1.EMRServerlessServiceException,
429
+ errorCode,
562
430
  });
563
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
564
431
  }
565
432
  };
566
433
  const deserializeAws_restJson1DeleteApplicationCommand = async (output, context) => {
567
434
  if (output.statusCode !== 200 && output.statusCode >= 300) {
568
435
  return deserializeAws_restJson1DeleteApplicationCommandError(output, context);
569
436
  }
570
- const contents = {
437
+ const contents = map({
571
438
  $metadata: deserializeMetadata(output),
572
- };
439
+ });
573
440
  await collectBody(output.body, context);
574
- return Promise.resolve(contents);
441
+ return contents;
575
442
  };
576
443
  exports.deserializeAws_restJson1DeleteApplicationCommand = deserializeAws_restJson1DeleteApplicationCommand;
577
444
  const deserializeAws_restJson1DeleteApplicationCommandError = async (output, context) => {
@@ -579,7 +446,6 @@ const deserializeAws_restJson1DeleteApplicationCommandError = async (output, con
579
446
  ...output,
580
447
  body: await parseBody(output.body, context),
581
448
  };
582
- let response;
583
449
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
584
450
  switch (errorCode) {
585
451
  case "InternalServerException":
@@ -593,29 +459,26 @@ const deserializeAws_restJson1DeleteApplicationCommandError = async (output, con
593
459
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
594
460
  default:
595
461
  const parsedBody = parsedOutput.body;
596
- const $metadata = deserializeMetadata(output);
597
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
598
- response = new EMRServerlessServiceException_1.EMRServerlessServiceException({
599
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
600
- $fault: "client",
601
- $metadata,
462
+ (0, smithy_client_1.throwDefaultError)({
463
+ output,
464
+ parsedBody,
465
+ exceptionCtor: EMRServerlessServiceException_1.EMRServerlessServiceException,
466
+ errorCode,
602
467
  });
603
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
604
468
  }
605
469
  };
606
470
  const deserializeAws_restJson1GetApplicationCommand = async (output, context) => {
607
471
  if (output.statusCode !== 200 && output.statusCode >= 300) {
608
472
  return deserializeAws_restJson1GetApplicationCommandError(output, context);
609
473
  }
610
- const contents = {
474
+ const contents = map({
611
475
  $metadata: deserializeMetadata(output),
612
- application: undefined,
613
- };
476
+ });
614
477
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
615
- if (data.application !== undefined && data.application !== null) {
478
+ if (data.application != null) {
616
479
  contents.application = deserializeAws_restJson1Application(data.application, context);
617
480
  }
618
- return Promise.resolve(contents);
481
+ return contents;
619
482
  };
620
483
  exports.deserializeAws_restJson1GetApplicationCommand = deserializeAws_restJson1GetApplicationCommand;
621
484
  const deserializeAws_restJson1GetApplicationCommandError = async (output, context) => {
@@ -623,7 +486,6 @@ const deserializeAws_restJson1GetApplicationCommandError = async (output, contex
623
486
  ...output,
624
487
  body: await parseBody(output.body, context),
625
488
  };
626
- let response;
627
489
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
628
490
  switch (errorCode) {
629
491
  case "InternalServerException":
@@ -637,29 +499,26 @@ const deserializeAws_restJson1GetApplicationCommandError = async (output, contex
637
499
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
638
500
  default:
639
501
  const parsedBody = parsedOutput.body;
640
- const $metadata = deserializeMetadata(output);
641
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
642
- response = new EMRServerlessServiceException_1.EMRServerlessServiceException({
643
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
644
- $fault: "client",
645
- $metadata,
502
+ (0, smithy_client_1.throwDefaultError)({
503
+ output,
504
+ parsedBody,
505
+ exceptionCtor: EMRServerlessServiceException_1.EMRServerlessServiceException,
506
+ errorCode,
646
507
  });
647
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
648
508
  }
649
509
  };
650
510
  const deserializeAws_restJson1GetJobRunCommand = async (output, context) => {
651
511
  if (output.statusCode !== 200 && output.statusCode >= 300) {
652
512
  return deserializeAws_restJson1GetJobRunCommandError(output, context);
653
513
  }
654
- const contents = {
514
+ const contents = map({
655
515
  $metadata: deserializeMetadata(output),
656
- jobRun: undefined,
657
- };
516
+ });
658
517
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
659
- if (data.jobRun !== undefined && data.jobRun !== null) {
518
+ if (data.jobRun != null) {
660
519
  contents.jobRun = deserializeAws_restJson1JobRun(data.jobRun, context);
661
520
  }
662
- return Promise.resolve(contents);
521
+ return contents;
663
522
  };
664
523
  exports.deserializeAws_restJson1GetJobRunCommand = deserializeAws_restJson1GetJobRunCommand;
665
524
  const deserializeAws_restJson1GetJobRunCommandError = async (output, context) => {
@@ -667,7 +526,6 @@ const deserializeAws_restJson1GetJobRunCommandError = async (output, context) =>
667
526
  ...output,
668
527
  body: await parseBody(output.body, context),
669
528
  };
670
- let response;
671
529
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
672
530
  switch (errorCode) {
673
531
  case "InternalServerException":
@@ -681,33 +539,29 @@ const deserializeAws_restJson1GetJobRunCommandError = async (output, context) =>
681
539
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
682
540
  default:
683
541
  const parsedBody = parsedOutput.body;
684
- const $metadata = deserializeMetadata(output);
685
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
686
- response = new EMRServerlessServiceException_1.EMRServerlessServiceException({
687
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
688
- $fault: "client",
689
- $metadata,
542
+ (0, smithy_client_1.throwDefaultError)({
543
+ output,
544
+ parsedBody,
545
+ exceptionCtor: EMRServerlessServiceException_1.EMRServerlessServiceException,
546
+ errorCode,
690
547
  });
691
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
692
548
  }
693
549
  };
694
550
  const deserializeAws_restJson1ListApplicationsCommand = async (output, context) => {
695
551
  if (output.statusCode !== 200 && output.statusCode >= 300) {
696
552
  return deserializeAws_restJson1ListApplicationsCommandError(output, context);
697
553
  }
698
- const contents = {
554
+ const contents = map({
699
555
  $metadata: deserializeMetadata(output),
700
- applications: undefined,
701
- nextToken: undefined,
702
- };
556
+ });
703
557
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
704
- if (data.applications !== undefined && data.applications !== null) {
558
+ if (data.applications != null) {
705
559
  contents.applications = deserializeAws_restJson1ApplicationList(data.applications, context);
706
560
  }
707
- if (data.nextToken !== undefined && data.nextToken !== null) {
561
+ if (data.nextToken != null) {
708
562
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
709
563
  }
710
- return Promise.resolve(contents);
564
+ return contents;
711
565
  };
712
566
  exports.deserializeAws_restJson1ListApplicationsCommand = deserializeAws_restJson1ListApplicationsCommand;
713
567
  const deserializeAws_restJson1ListApplicationsCommandError = async (output, context) => {
@@ -715,7 +569,6 @@ const deserializeAws_restJson1ListApplicationsCommandError = async (output, cont
715
569
  ...output,
716
570
  body: await parseBody(output.body, context),
717
571
  };
718
- let response;
719
572
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
720
573
  switch (errorCode) {
721
574
  case "InternalServerException":
@@ -726,33 +579,29 @@ const deserializeAws_restJson1ListApplicationsCommandError = async (output, cont
726
579
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
727
580
  default:
728
581
  const parsedBody = parsedOutput.body;
729
- const $metadata = deserializeMetadata(output);
730
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
731
- response = new EMRServerlessServiceException_1.EMRServerlessServiceException({
732
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
733
- $fault: "client",
734
- $metadata,
582
+ (0, smithy_client_1.throwDefaultError)({
583
+ output,
584
+ parsedBody,
585
+ exceptionCtor: EMRServerlessServiceException_1.EMRServerlessServiceException,
586
+ errorCode,
735
587
  });
736
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
737
588
  }
738
589
  };
739
590
  const deserializeAws_restJson1ListJobRunsCommand = async (output, context) => {
740
591
  if (output.statusCode !== 200 && output.statusCode >= 300) {
741
592
  return deserializeAws_restJson1ListJobRunsCommandError(output, context);
742
593
  }
743
- const contents = {
594
+ const contents = map({
744
595
  $metadata: deserializeMetadata(output),
745
- jobRuns: undefined,
746
- nextToken: undefined,
747
- };
596
+ });
748
597
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
749
- if (data.jobRuns !== undefined && data.jobRuns !== null) {
598
+ if (data.jobRuns != null) {
750
599
  contents.jobRuns = deserializeAws_restJson1JobRuns(data.jobRuns, context);
751
600
  }
752
- if (data.nextToken !== undefined && data.nextToken !== null) {
601
+ if (data.nextToken != null) {
753
602
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
754
603
  }
755
- return Promise.resolve(contents);
604
+ return contents;
756
605
  };
757
606
  exports.deserializeAws_restJson1ListJobRunsCommand = deserializeAws_restJson1ListJobRunsCommand;
758
607
  const deserializeAws_restJson1ListJobRunsCommandError = async (output, context) => {
@@ -760,7 +609,6 @@ const deserializeAws_restJson1ListJobRunsCommandError = async (output, context)
760
609
  ...output,
761
610
  body: await parseBody(output.body, context),
762
611
  };
763
- let response;
764
612
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
765
613
  switch (errorCode) {
766
614
  case "InternalServerException":
@@ -771,29 +619,26 @@ const deserializeAws_restJson1ListJobRunsCommandError = async (output, context)
771
619
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
772
620
  default:
773
621
  const parsedBody = parsedOutput.body;
774
- const $metadata = deserializeMetadata(output);
775
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
776
- response = new EMRServerlessServiceException_1.EMRServerlessServiceException({
777
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
778
- $fault: "client",
779
- $metadata,
622
+ (0, smithy_client_1.throwDefaultError)({
623
+ output,
624
+ parsedBody,
625
+ exceptionCtor: EMRServerlessServiceException_1.EMRServerlessServiceException,
626
+ errorCode,
780
627
  });
781
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
782
628
  }
783
629
  };
784
630
  const deserializeAws_restJson1ListTagsForResourceCommand = async (output, context) => {
785
631
  if (output.statusCode !== 200 && output.statusCode >= 300) {
786
632
  return deserializeAws_restJson1ListTagsForResourceCommandError(output, context);
787
633
  }
788
- const contents = {
634
+ const contents = map({
789
635
  $metadata: deserializeMetadata(output),
790
- tags: undefined,
791
- };
636
+ });
792
637
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
793
- if (data.tags !== undefined && data.tags !== null) {
638
+ if (data.tags != null) {
794
639
  contents.tags = deserializeAws_restJson1TagMap(data.tags, context);
795
640
  }
796
- return Promise.resolve(contents);
641
+ return contents;
797
642
  };
798
643
  exports.deserializeAws_restJson1ListTagsForResourceCommand = deserializeAws_restJson1ListTagsForResourceCommand;
799
644
  const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, context) => {
@@ -801,7 +646,6 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
801
646
  ...output,
802
647
  body: await parseBody(output.body, context),
803
648
  };
804
- let response;
805
649
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
806
650
  switch (errorCode) {
807
651
  case "InternalServerException":
@@ -815,25 +659,23 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
815
659
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
816
660
  default:
817
661
  const parsedBody = parsedOutput.body;
818
- const $metadata = deserializeMetadata(output);
819
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
820
- response = new EMRServerlessServiceException_1.EMRServerlessServiceException({
821
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
822
- $fault: "client",
823
- $metadata,
662
+ (0, smithy_client_1.throwDefaultError)({
663
+ output,
664
+ parsedBody,
665
+ exceptionCtor: EMRServerlessServiceException_1.EMRServerlessServiceException,
666
+ errorCode,
824
667
  });
825
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
826
668
  }
827
669
  };
828
670
  const deserializeAws_restJson1StartApplicationCommand = async (output, context) => {
829
671
  if (output.statusCode !== 200 && output.statusCode >= 300) {
830
672
  return deserializeAws_restJson1StartApplicationCommandError(output, context);
831
673
  }
832
- const contents = {
674
+ const contents = map({
833
675
  $metadata: deserializeMetadata(output),
834
- };
676
+ });
835
677
  await collectBody(output.body, context);
836
- return Promise.resolve(contents);
678
+ return contents;
837
679
  };
838
680
  exports.deserializeAws_restJson1StartApplicationCommand = deserializeAws_restJson1StartApplicationCommand;
839
681
  const deserializeAws_restJson1StartApplicationCommandError = async (output, context) => {
@@ -841,7 +683,6 @@ const deserializeAws_restJson1StartApplicationCommandError = async (output, cont
841
683
  ...output,
842
684
  body: await parseBody(output.body, context),
843
685
  };
844
- let response;
845
686
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
846
687
  switch (errorCode) {
847
688
  case "InternalServerException":
@@ -858,37 +699,32 @@ const deserializeAws_restJson1StartApplicationCommandError = async (output, cont
858
699
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
859
700
  default:
860
701
  const parsedBody = parsedOutput.body;
861
- const $metadata = deserializeMetadata(output);
862
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
863
- response = new EMRServerlessServiceException_1.EMRServerlessServiceException({
864
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
865
- $fault: "client",
866
- $metadata,
702
+ (0, smithy_client_1.throwDefaultError)({
703
+ output,
704
+ parsedBody,
705
+ exceptionCtor: EMRServerlessServiceException_1.EMRServerlessServiceException,
706
+ errorCode,
867
707
  });
868
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
869
708
  }
870
709
  };
871
710
  const deserializeAws_restJson1StartJobRunCommand = async (output, context) => {
872
711
  if (output.statusCode !== 200 && output.statusCode >= 300) {
873
712
  return deserializeAws_restJson1StartJobRunCommandError(output, context);
874
713
  }
875
- const contents = {
714
+ const contents = map({
876
715
  $metadata: deserializeMetadata(output),
877
- applicationId: undefined,
878
- arn: undefined,
879
- jobRunId: undefined,
880
- };
716
+ });
881
717
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
882
- if (data.applicationId !== undefined && data.applicationId !== null) {
718
+ if (data.applicationId != null) {
883
719
  contents.applicationId = (0, smithy_client_1.expectString)(data.applicationId);
884
720
  }
885
- if (data.arn !== undefined && data.arn !== null) {
721
+ if (data.arn != null) {
886
722
  contents.arn = (0, smithy_client_1.expectString)(data.arn);
887
723
  }
888
- if (data.jobRunId !== undefined && data.jobRunId !== null) {
724
+ if (data.jobRunId != null) {
889
725
  contents.jobRunId = (0, smithy_client_1.expectString)(data.jobRunId);
890
726
  }
891
- return Promise.resolve(contents);
727
+ return contents;
892
728
  };
893
729
  exports.deserializeAws_restJson1StartJobRunCommand = deserializeAws_restJson1StartJobRunCommand;
894
730
  const deserializeAws_restJson1StartJobRunCommandError = async (output, context) => {
@@ -896,7 +732,6 @@ const deserializeAws_restJson1StartJobRunCommandError = async (output, context)
896
732
  ...output,
897
733
  body: await parseBody(output.body, context),
898
734
  };
899
- let response;
900
735
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
901
736
  switch (errorCode) {
902
737
  case "ConflictException":
@@ -913,25 +748,23 @@ const deserializeAws_restJson1StartJobRunCommandError = async (output, context)
913
748
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
914
749
  default:
915
750
  const parsedBody = parsedOutput.body;
916
- const $metadata = deserializeMetadata(output);
917
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
918
- response = new EMRServerlessServiceException_1.EMRServerlessServiceException({
919
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
920
- $fault: "client",
921
- $metadata,
751
+ (0, smithy_client_1.throwDefaultError)({
752
+ output,
753
+ parsedBody,
754
+ exceptionCtor: EMRServerlessServiceException_1.EMRServerlessServiceException,
755
+ errorCode,
922
756
  });
923
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
924
757
  }
925
758
  };
926
759
  const deserializeAws_restJson1StopApplicationCommand = async (output, context) => {
927
760
  if (output.statusCode !== 200 && output.statusCode >= 300) {
928
761
  return deserializeAws_restJson1StopApplicationCommandError(output, context);
929
762
  }
930
- const contents = {
763
+ const contents = map({
931
764
  $metadata: deserializeMetadata(output),
932
- };
765
+ });
933
766
  await collectBody(output.body, context);
934
- return Promise.resolve(contents);
767
+ return contents;
935
768
  };
936
769
  exports.deserializeAws_restJson1StopApplicationCommand = deserializeAws_restJson1StopApplicationCommand;
937
770
  const deserializeAws_restJson1StopApplicationCommandError = async (output, context) => {
@@ -939,7 +772,6 @@ const deserializeAws_restJson1StopApplicationCommandError = async (output, conte
939
772
  ...output,
940
773
  body: await parseBody(output.body, context),
941
774
  };
942
- let response;
943
775
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
944
776
  switch (errorCode) {
945
777
  case "InternalServerException":
@@ -953,25 +785,23 @@ const deserializeAws_restJson1StopApplicationCommandError = async (output, conte
953
785
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
954
786
  default:
955
787
  const parsedBody = parsedOutput.body;
956
- const $metadata = deserializeMetadata(output);
957
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
958
- response = new EMRServerlessServiceException_1.EMRServerlessServiceException({
959
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
960
- $fault: "client",
961
- $metadata,
788
+ (0, smithy_client_1.throwDefaultError)({
789
+ output,
790
+ parsedBody,
791
+ exceptionCtor: EMRServerlessServiceException_1.EMRServerlessServiceException,
792
+ errorCode,
962
793
  });
963
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
964
794
  }
965
795
  };
966
796
  const deserializeAws_restJson1TagResourceCommand = async (output, context) => {
967
797
  if (output.statusCode !== 200 && output.statusCode >= 300) {
968
798
  return deserializeAws_restJson1TagResourceCommandError(output, context);
969
799
  }
970
- const contents = {
800
+ const contents = map({
971
801
  $metadata: deserializeMetadata(output),
972
- };
802
+ });
973
803
  await collectBody(output.body, context);
974
- return Promise.resolve(contents);
804
+ return contents;
975
805
  };
976
806
  exports.deserializeAws_restJson1TagResourceCommand = deserializeAws_restJson1TagResourceCommand;
977
807
  const deserializeAws_restJson1TagResourceCommandError = async (output, context) => {
@@ -979,7 +809,6 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
979
809
  ...output,
980
810
  body: await parseBody(output.body, context),
981
811
  };
982
- let response;
983
812
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
984
813
  switch (errorCode) {
985
814
  case "InternalServerException":
@@ -993,25 +822,23 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
993
822
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
994
823
  default:
995
824
  const parsedBody = parsedOutput.body;
996
- const $metadata = deserializeMetadata(output);
997
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
998
- response = new EMRServerlessServiceException_1.EMRServerlessServiceException({
999
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1000
- $fault: "client",
1001
- $metadata,
825
+ (0, smithy_client_1.throwDefaultError)({
826
+ output,
827
+ parsedBody,
828
+ exceptionCtor: EMRServerlessServiceException_1.EMRServerlessServiceException,
829
+ errorCode,
1002
830
  });
1003
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1004
831
  }
1005
832
  };
1006
833
  const deserializeAws_restJson1UntagResourceCommand = async (output, context) => {
1007
834
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1008
835
  return deserializeAws_restJson1UntagResourceCommandError(output, context);
1009
836
  }
1010
- const contents = {
837
+ const contents = map({
1011
838
  $metadata: deserializeMetadata(output),
1012
- };
839
+ });
1013
840
  await collectBody(output.body, context);
1014
- return Promise.resolve(contents);
841
+ return contents;
1015
842
  };
1016
843
  exports.deserializeAws_restJson1UntagResourceCommand = deserializeAws_restJson1UntagResourceCommand;
1017
844
  const deserializeAws_restJson1UntagResourceCommandError = async (output, context) => {
@@ -1019,7 +846,6 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
1019
846
  ...output,
1020
847
  body: await parseBody(output.body, context),
1021
848
  };
1022
- let response;
1023
849
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1024
850
  switch (errorCode) {
1025
851
  case "InternalServerException":
@@ -1033,29 +859,26 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
1033
859
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1034
860
  default:
1035
861
  const parsedBody = parsedOutput.body;
1036
- const $metadata = deserializeMetadata(output);
1037
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1038
- response = new EMRServerlessServiceException_1.EMRServerlessServiceException({
1039
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1040
- $fault: "client",
1041
- $metadata,
862
+ (0, smithy_client_1.throwDefaultError)({
863
+ output,
864
+ parsedBody,
865
+ exceptionCtor: EMRServerlessServiceException_1.EMRServerlessServiceException,
866
+ errorCode,
1042
867
  });
1043
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1044
868
  }
1045
869
  };
1046
870
  const deserializeAws_restJson1UpdateApplicationCommand = async (output, context) => {
1047
871
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1048
872
  return deserializeAws_restJson1UpdateApplicationCommandError(output, context);
1049
873
  }
1050
- const contents = {
874
+ const contents = map({
1051
875
  $metadata: deserializeMetadata(output),
1052
- application: undefined,
1053
- };
876
+ });
1054
877
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1055
- if (data.application !== undefined && data.application !== null) {
878
+ if (data.application != null) {
1056
879
  contents.application = deserializeAws_restJson1Application(data.application, context);
1057
880
  }
1058
- return Promise.resolve(contents);
881
+ return contents;
1059
882
  };
1060
883
  exports.deserializeAws_restJson1UpdateApplicationCommand = deserializeAws_restJson1UpdateApplicationCommand;
1061
884
  const deserializeAws_restJson1UpdateApplicationCommandError = async (output, context) => {
@@ -1063,7 +886,6 @@ const deserializeAws_restJson1UpdateApplicationCommandError = async (output, con
1063
886
  ...output,
1064
887
  body: await parseBody(output.body, context),
1065
888
  };
1066
- let response;
1067
889
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1068
890
  switch (errorCode) {
1069
891
  case "InternalServerException":
@@ -1077,20 +899,19 @@ const deserializeAws_restJson1UpdateApplicationCommandError = async (output, con
1077
899
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1078
900
  default:
1079
901
  const parsedBody = parsedOutput.body;
1080
- const $metadata = deserializeMetadata(output);
1081
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1082
- response = new EMRServerlessServiceException_1.EMRServerlessServiceException({
1083
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1084
- $fault: "client",
1085
- $metadata,
902
+ (0, smithy_client_1.throwDefaultError)({
903
+ output,
904
+ parsedBody,
905
+ exceptionCtor: EMRServerlessServiceException_1.EMRServerlessServiceException,
906
+ errorCode,
1086
907
  });
1087
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1088
908
  }
1089
909
  };
910
+ const map = smithy_client_1.map;
1090
911
  const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, context) => {
1091
- const contents = {};
912
+ const contents = map({});
1092
913
  const data = parsedOutput.body;
1093
- if (data.message !== undefined && data.message !== null) {
914
+ if (data.message != null) {
1094
915
  contents.message = (0, smithy_client_1.expectString)(data.message);
1095
916
  }
1096
917
  const exception = new models_0_1.ConflictException({
@@ -1100,9 +921,9 @@ const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, c
1100
921
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1101
922
  };
1102
923
  const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOutput, context) => {
1103
- const contents = {};
924
+ const contents = map({});
1104
925
  const data = parsedOutput.body;
1105
- if (data.message !== undefined && data.message !== null) {
926
+ if (data.message != null) {
1106
927
  contents.message = (0, smithy_client_1.expectString)(data.message);
1107
928
  }
1108
929
  const exception = new models_0_1.InternalServerException({
@@ -1112,9 +933,9 @@ const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOut
1112
933
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1113
934
  };
1114
935
  const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
1115
- const contents = {};
936
+ const contents = map({});
1116
937
  const data = parsedOutput.body;
1117
- if (data.message !== undefined && data.message !== null) {
938
+ if (data.message != null) {
1118
939
  contents.message = (0, smithy_client_1.expectString)(data.message);
1119
940
  }
1120
941
  const exception = new models_0_1.ResourceNotFoundException({
@@ -1124,9 +945,9 @@ const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedO
1124
945
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1125
946
  };
1126
947
  const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (parsedOutput, context) => {
1127
- const contents = {};
948
+ const contents = map({});
1128
949
  const data = parsedOutput.body;
1129
- if (data.message !== undefined && data.message !== null) {
950
+ if (data.message != null) {
1130
951
  contents.message = (0, smithy_client_1.expectString)(data.message);
1131
952
  }
1132
953
  const exception = new models_0_1.ServiceQuotaExceededException({
@@ -1136,9 +957,9 @@ const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (par
1136
957
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1137
958
  };
1138
959
  const deserializeAws_restJson1ValidationExceptionResponse = async (parsedOutput, context) => {
1139
- const contents = {};
960
+ const contents = map({});
1140
961
  const data = parsedOutput.body;
1141
- if (data.message !== undefined && data.message !== null) {
962
+ if (data.message != null) {
1142
963
  contents.message = (0, smithy_client_1.expectString)(data.message);
1143
964
  }
1144
965
  const exception = new models_0_1.ValidationException({
@@ -1173,9 +994,6 @@ const serializeAws_restJson1ConfigurationList = (input, context) => {
1173
994
  return input
1174
995
  .filter((e) => e != null)
1175
996
  .map((entry) => {
1176
- if (entry === null) {
1177
- return null;
1178
- }
1179
997
  return serializeAws_restJson1Configuration(entry, context);
1180
998
  });
1181
999
  };
@@ -1193,9 +1011,6 @@ const serializeAws_restJson1EntryPointArguments = (input, context) => {
1193
1011
  return input
1194
1012
  .filter((e) => e != null)
1195
1013
  .map((entry) => {
1196
- if (entry === null) {
1197
- return null;
1198
- }
1199
1014
  return entry;
1200
1015
  });
1201
1016
  };
@@ -1273,9 +1088,6 @@ const serializeAws_restJson1SecurityGroupIds = (input, context) => {
1273
1088
  return input
1274
1089
  .filter((e) => e != null)
1275
1090
  .map((entry) => {
1276
- if (entry === null) {
1277
- return null;
1278
- }
1279
1091
  return entry;
1280
1092
  });
1281
1093
  };
@@ -1303,9 +1115,6 @@ const serializeAws_restJson1SubnetIds = (input, context) => {
1303
1115
  return input
1304
1116
  .filter((e) => e != null)
1305
1117
  .map((entry) => {
1306
- if (entry === null) {
1307
- return null;
1308
- }
1309
1118
  return entry;
1310
1119
  });
1311
1120
  };
@@ -1461,12 +1270,12 @@ const deserializeAws_restJson1InitialCapacityConfigMap = (output, context) => {
1461
1270
  }, {});
1462
1271
  };
1463
1272
  const deserializeAws_restJson1JobDriver = (output, context) => {
1464
- if (output.hive !== undefined && output.hive !== null) {
1273
+ if (output.hive != null) {
1465
1274
  return {
1466
1275
  hive: deserializeAws_restJson1Hive(output.hive, context),
1467
1276
  };
1468
1277
  }
1469
- if (output.sparkSubmit !== undefined && output.sparkSubmit !== null) {
1278
+ if (output.sparkSubmit != null) {
1470
1279
  return {
1471
1280
  sparkSubmit: deserializeAws_restJson1SparkSubmit(output.sparkSubmit, context),
1472
1281
  };