@aws-sdk/client-emr-containers 3.141.0 → 3.150.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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
  "/virtualclusters/{virtualClusterId}/jobruns/{id}";
14
- if (input.id !== undefined) {
15
- const labelValue = input.id;
16
- if (labelValue.length <= 0) {
17
- throw new Error("Empty value provided for input HTTP label: id.");
18
- }
19
- resolvedPath = resolvedPath.replace("{id}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
20
- }
21
- else {
22
- throw new Error("No value provided for input HTTP label: id.");
23
- }
24
- if (input.virtualClusterId !== undefined) {
25
- const labelValue = input.virtualClusterId;
26
- if (labelValue.length <= 0) {
27
- throw new Error("Empty value provided for input HTTP label: virtualClusterId.");
28
- }
29
- resolvedPath = resolvedPath.replace("{virtualClusterId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
30
- }
31
- else {
32
- throw new Error("No value provided for input HTTP label: virtualClusterId.");
33
- }
14
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "id", () => input.id, "{id}", false);
15
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "virtualClusterId", () => input.virtualClusterId, "{virtualClusterId}", false);
34
16
  let body;
35
17
  return new protocol_http_1.HttpRequest({
36
18
  protocol,
@@ -51,16 +33,7 @@ const serializeAws_restJson1CreateManagedEndpointCommand = async (input, context
51
33
  };
52
34
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
53
35
  "/virtualclusters/{virtualClusterId}/endpoints";
54
- if (input.virtualClusterId !== undefined) {
55
- const labelValue = input.virtualClusterId;
56
- if (labelValue.length <= 0) {
57
- throw new Error("Empty value provided for input HTTP label: virtualClusterId.");
58
- }
59
- resolvedPath = resolvedPath.replace("{virtualClusterId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
60
- }
61
- else {
62
- throw new Error("No value provided for input HTTP label: virtualClusterId.");
63
- }
36
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "virtualClusterId", () => input.virtualClusterId, "{virtualClusterId}", false);
64
37
  let body;
65
38
  body = JSON.stringify({
66
39
  ...(input.certificateArn != null && { certificateArn: input.certificateArn }),
@@ -117,26 +90,8 @@ const serializeAws_restJson1DeleteManagedEndpointCommand = async (input, context
117
90
  const headers = {};
118
91
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
119
92
  "/virtualclusters/{virtualClusterId}/endpoints/{id}";
120
- if (input.id !== undefined) {
121
- const labelValue = input.id;
122
- if (labelValue.length <= 0) {
123
- throw new Error("Empty value provided for input HTTP label: id.");
124
- }
125
- resolvedPath = resolvedPath.replace("{id}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
126
- }
127
- else {
128
- throw new Error("No value provided for input HTTP label: id.");
129
- }
130
- if (input.virtualClusterId !== undefined) {
131
- const labelValue = input.virtualClusterId;
132
- if (labelValue.length <= 0) {
133
- throw new Error("Empty value provided for input HTTP label: virtualClusterId.");
134
- }
135
- resolvedPath = resolvedPath.replace("{virtualClusterId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
136
- }
137
- else {
138
- throw new Error("No value provided for input HTTP label: virtualClusterId.");
139
- }
93
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "id", () => input.id, "{id}", false);
94
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "virtualClusterId", () => input.virtualClusterId, "{virtualClusterId}", false);
140
95
  let body;
141
96
  return new protocol_http_1.HttpRequest({
142
97
  protocol,
@@ -153,16 +108,7 @@ const serializeAws_restJson1DeleteVirtualClusterCommand = async (input, context)
153
108
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
154
109
  const headers = {};
155
110
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/virtualclusters/{id}";
156
- if (input.id !== undefined) {
157
- const labelValue = input.id;
158
- if (labelValue.length <= 0) {
159
- throw new Error("Empty value provided for input HTTP label: id.");
160
- }
161
- resolvedPath = resolvedPath.replace("{id}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
162
- }
163
- else {
164
- throw new Error("No value provided for input HTTP label: id.");
165
- }
111
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "id", () => input.id, "{id}", false);
166
112
  let body;
167
113
  return new protocol_http_1.HttpRequest({
168
114
  protocol,
@@ -180,26 +126,8 @@ const serializeAws_restJson1DescribeJobRunCommand = async (input, context) => {
180
126
  const headers = {};
181
127
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
182
128
  "/virtualclusters/{virtualClusterId}/jobruns/{id}";
183
- if (input.id !== undefined) {
184
- const labelValue = input.id;
185
- if (labelValue.length <= 0) {
186
- throw new Error("Empty value provided for input HTTP label: id.");
187
- }
188
- resolvedPath = resolvedPath.replace("{id}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
189
- }
190
- else {
191
- throw new Error("No value provided for input HTTP label: id.");
192
- }
193
- if (input.virtualClusterId !== undefined) {
194
- const labelValue = input.virtualClusterId;
195
- if (labelValue.length <= 0) {
196
- throw new Error("Empty value provided for input HTTP label: virtualClusterId.");
197
- }
198
- resolvedPath = resolvedPath.replace("{virtualClusterId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
199
- }
200
- else {
201
- throw new Error("No value provided for input HTTP label: virtualClusterId.");
202
- }
129
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "id", () => input.id, "{id}", false);
130
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "virtualClusterId", () => input.virtualClusterId, "{virtualClusterId}", false);
203
131
  let body;
204
132
  return new protocol_http_1.HttpRequest({
205
133
  protocol,
@@ -217,26 +145,8 @@ const serializeAws_restJson1DescribeManagedEndpointCommand = async (input, conte
217
145
  const headers = {};
218
146
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
219
147
  "/virtualclusters/{virtualClusterId}/endpoints/{id}";
220
- if (input.id !== undefined) {
221
- const labelValue = input.id;
222
- if (labelValue.length <= 0) {
223
- throw new Error("Empty value provided for input HTTP label: id.");
224
- }
225
- resolvedPath = resolvedPath.replace("{id}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
226
- }
227
- else {
228
- throw new Error("No value provided for input HTTP label: id.");
229
- }
230
- if (input.virtualClusterId !== undefined) {
231
- const labelValue = input.virtualClusterId;
232
- if (labelValue.length <= 0) {
233
- throw new Error("Empty value provided for input HTTP label: virtualClusterId.");
234
- }
235
- resolvedPath = resolvedPath.replace("{virtualClusterId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
236
- }
237
- else {
238
- throw new Error("No value provided for input HTTP label: virtualClusterId.");
239
- }
148
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "id", () => input.id, "{id}", false);
149
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "virtualClusterId", () => input.virtualClusterId, "{virtualClusterId}", false);
240
150
  let body;
241
151
  return new protocol_http_1.HttpRequest({
242
152
  protocol,
@@ -253,16 +163,7 @@ const serializeAws_restJson1DescribeVirtualClusterCommand = async (input, contex
253
163
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
254
164
  const headers = {};
255
165
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/virtualclusters/{id}";
256
- if (input.id !== undefined) {
257
- const labelValue = input.id;
258
- if (labelValue.length <= 0) {
259
- throw new Error("Empty value provided for input HTTP label: id.");
260
- }
261
- resolvedPath = resolvedPath.replace("{id}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
262
- }
263
- else {
264
- throw new Error("No value provided for input HTTP label: id.");
265
- }
166
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "id", () => input.id, "{id}", false);
266
167
  let body;
267
168
  return new protocol_http_1.HttpRequest({
268
169
  protocol,
@@ -280,28 +181,21 @@ const serializeAws_restJson1ListJobRunsCommand = async (input, context) => {
280
181
  const headers = {};
281
182
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
282
183
  "/virtualclusters/{virtualClusterId}/jobruns";
283
- if (input.virtualClusterId !== undefined) {
284
- const labelValue = input.virtualClusterId;
285
- if (labelValue.length <= 0) {
286
- throw new Error("Empty value provided for input HTTP label: virtualClusterId.");
287
- }
288
- resolvedPath = resolvedPath.replace("{virtualClusterId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
289
- }
290
- else {
291
- throw new Error("No value provided for input HTTP label: virtualClusterId.");
292
- }
293
- const query = {
294
- ...(input.createdBefore !== undefined && {
295
- createdBefore: (input.createdBefore.toISOString().split(".")[0] + "Z").toString(),
296
- }),
297
- ...(input.createdAfter !== undefined && {
298
- createdAfter: (input.createdAfter.toISOString().split(".")[0] + "Z").toString(),
299
- }),
300
- ...(input.name !== undefined && { name: input.name }),
301
- ...(input.states !== undefined && { states: (input.states || []).map((_entry) => _entry) }),
302
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
303
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
304
- };
184
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "virtualClusterId", () => input.virtualClusterId, "{virtualClusterId}", false);
185
+ const query = map({
186
+ createdBefore: [
187
+ () => input.createdBefore !== void 0,
188
+ () => (input.createdBefore.toISOString().split(".")[0] + "Z").toString(),
189
+ ],
190
+ createdAfter: [
191
+ () => input.createdAfter !== void 0,
192
+ () => (input.createdAfter.toISOString().split(".")[0] + "Z").toString(),
193
+ ],
194
+ name: [, input.name],
195
+ states: [() => input.states !== void 0, () => (input.states || []).map((_entry) => _entry)],
196
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
197
+ nextToken: [, input.nextToken],
198
+ });
305
199
  let body;
306
200
  return new protocol_http_1.HttpRequest({
307
201
  protocol,
@@ -320,28 +214,21 @@ const serializeAws_restJson1ListManagedEndpointsCommand = async (input, context)
320
214
  const headers = {};
321
215
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
322
216
  "/virtualclusters/{virtualClusterId}/endpoints";
323
- if (input.virtualClusterId !== undefined) {
324
- const labelValue = input.virtualClusterId;
325
- if (labelValue.length <= 0) {
326
- throw new Error("Empty value provided for input HTTP label: virtualClusterId.");
327
- }
328
- resolvedPath = resolvedPath.replace("{virtualClusterId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
329
- }
330
- else {
331
- throw new Error("No value provided for input HTTP label: virtualClusterId.");
332
- }
333
- const query = {
334
- ...(input.createdBefore !== undefined && {
335
- createdBefore: (input.createdBefore.toISOString().split(".")[0] + "Z").toString(),
336
- }),
337
- ...(input.createdAfter !== undefined && {
338
- createdAfter: (input.createdAfter.toISOString().split(".")[0] + "Z").toString(),
339
- }),
340
- ...(input.types !== undefined && { types: (input.types || []).map((_entry) => _entry) }),
341
- ...(input.states !== undefined && { states: (input.states || []).map((_entry) => _entry) }),
342
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
343
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
344
- };
217
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "virtualClusterId", () => input.virtualClusterId, "{virtualClusterId}", false);
218
+ const query = map({
219
+ createdBefore: [
220
+ () => input.createdBefore !== void 0,
221
+ () => (input.createdBefore.toISOString().split(".")[0] + "Z").toString(),
222
+ ],
223
+ createdAfter: [
224
+ () => input.createdAfter !== void 0,
225
+ () => (input.createdAfter.toISOString().split(".")[0] + "Z").toString(),
226
+ ],
227
+ types: [() => input.types !== void 0, () => (input.types || []).map((_entry) => _entry)],
228
+ states: [() => input.states !== void 0, () => (input.states || []).map((_entry) => _entry)],
229
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
230
+ nextToken: [, input.nextToken],
231
+ });
345
232
  let body;
346
233
  return new protocol_http_1.HttpRequest({
347
234
  protocol,
@@ -359,16 +246,7 @@ const serializeAws_restJson1ListTagsForResourceCommand = async (input, context)
359
246
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
360
247
  const headers = {};
361
248
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
362
- if (input.resourceArn !== undefined) {
363
- const labelValue = input.resourceArn;
364
- if (labelValue.length <= 0) {
365
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
366
- }
367
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
368
- }
369
- else {
370
- throw new Error("No value provided for input HTTP label: resourceArn.");
371
- }
249
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
372
250
  let body;
373
251
  return new protocol_http_1.HttpRequest({
374
252
  protocol,
@@ -385,19 +263,21 @@ const serializeAws_restJson1ListVirtualClustersCommand = async (input, context)
385
263
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
386
264
  const headers = {};
387
265
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/virtualclusters";
388
- const query = {
389
- ...(input.containerProviderId !== undefined && { containerProviderId: input.containerProviderId }),
390
- ...(input.containerProviderType !== undefined && { containerProviderType: input.containerProviderType }),
391
- ...(input.createdAfter !== undefined && {
392
- createdAfter: (input.createdAfter.toISOString().split(".")[0] + "Z").toString(),
393
- }),
394
- ...(input.createdBefore !== undefined && {
395
- createdBefore: (input.createdBefore.toISOString().split(".")[0] + "Z").toString(),
396
- }),
397
- ...(input.states !== undefined && { states: (input.states || []).map((_entry) => _entry) }),
398
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
399
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
400
- };
266
+ const query = map({
267
+ containerProviderId: [, input.containerProviderId],
268
+ containerProviderType: [, input.containerProviderType],
269
+ createdAfter: [
270
+ () => input.createdAfter !== void 0,
271
+ () => (input.createdAfter.toISOString().split(".")[0] + "Z").toString(),
272
+ ],
273
+ createdBefore: [
274
+ () => input.createdBefore !== void 0,
275
+ () => (input.createdBefore.toISOString().split(".")[0] + "Z").toString(),
276
+ ],
277
+ states: [() => input.states !== void 0, () => (input.states || []).map((_entry) => _entry)],
278
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
279
+ nextToken: [, input.nextToken],
280
+ });
401
281
  let body;
402
282
  return new protocol_http_1.HttpRequest({
403
283
  protocol,
@@ -419,16 +299,7 @@ const serializeAws_restJson1StartJobRunCommand = async (input, context) => {
419
299
  };
420
300
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
421
301
  "/virtualclusters/{virtualClusterId}/jobruns";
422
- if (input.virtualClusterId !== undefined) {
423
- const labelValue = input.virtualClusterId;
424
- if (labelValue.length <= 0) {
425
- throw new Error("Empty value provided for input HTTP label: virtualClusterId.");
426
- }
427
- resolvedPath = resolvedPath.replace("{virtualClusterId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
428
- }
429
- else {
430
- throw new Error("No value provided for input HTTP label: virtualClusterId.");
431
- }
302
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "virtualClusterId", () => input.virtualClusterId, "{virtualClusterId}", false);
432
303
  let body;
433
304
  body = JSON.stringify({
434
305
  clientToken: (_a = input.clientToken) !== null && _a !== void 0 ? _a : (0, uuid_1.v4)(),
@@ -458,16 +329,7 @@ const serializeAws_restJson1TagResourceCommand = async (input, context) => {
458
329
  "content-type": "application/json",
459
330
  };
460
331
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
461
- if (input.resourceArn !== undefined) {
462
- const labelValue = input.resourceArn;
463
- if (labelValue.length <= 0) {
464
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
465
- }
466
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
467
- }
468
- else {
469
- throw new Error("No value provided for input HTTP label: resourceArn.");
470
- }
332
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
471
333
  let body;
472
334
  body = JSON.stringify({
473
335
  ...(input.tags != null && { tags: serializeAws_restJson1TagMap(input.tags, context) }),
@@ -487,19 +349,10 @@ const serializeAws_restJson1UntagResourceCommand = async (input, context) => {
487
349
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
488
350
  const headers = {};
489
351
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
490
- if (input.resourceArn !== undefined) {
491
- const labelValue = input.resourceArn;
492
- if (labelValue.length <= 0) {
493
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
494
- }
495
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
496
- }
497
- else {
498
- throw new Error("No value provided for input HTTP label: resourceArn.");
499
- }
500
- const query = {
501
- ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry) }),
502
- };
352
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
353
+ const query = map({
354
+ tagKeys: [() => input.tagKeys !== void 0, () => (input.tagKeys || []).map((_entry) => _entry)],
355
+ });
503
356
  let body;
504
357
  return new protocol_http_1.HttpRequest({
505
358
  protocol,
@@ -517,19 +370,17 @@ const deserializeAws_restJson1CancelJobRunCommand = async (output, context) => {
517
370
  if (output.statusCode !== 200 && output.statusCode >= 300) {
518
371
  return deserializeAws_restJson1CancelJobRunCommandError(output, context);
519
372
  }
520
- const contents = {
373
+ const contents = map({
521
374
  $metadata: deserializeMetadata(output),
522
- id: undefined,
523
- virtualClusterId: undefined,
524
- };
375
+ });
525
376
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
526
- if (data.id !== undefined && data.id !== null) {
377
+ if (data.id != null) {
527
378
  contents.id = (0, smithy_client_1.expectString)(data.id);
528
379
  }
529
- if (data.virtualClusterId !== undefined && data.virtualClusterId !== null) {
380
+ if (data.virtualClusterId != null) {
530
381
  contents.virtualClusterId = (0, smithy_client_1.expectString)(data.virtualClusterId);
531
382
  }
532
- return Promise.resolve(contents);
383
+ return contents;
533
384
  };
534
385
  exports.deserializeAws_restJson1CancelJobRunCommand = deserializeAws_restJson1CancelJobRunCommand;
535
386
  const deserializeAws_restJson1CancelJobRunCommandError = async (output, context) => {
@@ -537,7 +388,6 @@ const deserializeAws_restJson1CancelJobRunCommandError = async (output, context)
537
388
  ...output,
538
389
  body: await parseBody(output.body, context),
539
390
  };
540
- let response;
541
391
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
542
392
  switch (errorCode) {
543
393
  case "InternalServerException":
@@ -548,41 +398,35 @@ const deserializeAws_restJson1CancelJobRunCommandError = async (output, context)
548
398
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
549
399
  default:
550
400
  const parsedBody = parsedOutput.body;
551
- const $metadata = deserializeMetadata(output);
552
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
553
- response = new EMRContainersServiceException_1.EMRContainersServiceException({
554
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
555
- $fault: "client",
556
- $metadata,
401
+ (0, smithy_client_1.throwDefaultError)({
402
+ output,
403
+ parsedBody,
404
+ exceptionCtor: EMRContainersServiceException_1.EMRContainersServiceException,
405
+ errorCode,
557
406
  });
558
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
559
407
  }
560
408
  };
561
409
  const deserializeAws_restJson1CreateManagedEndpointCommand = async (output, context) => {
562
410
  if (output.statusCode !== 200 && output.statusCode >= 300) {
563
411
  return deserializeAws_restJson1CreateManagedEndpointCommandError(output, context);
564
412
  }
565
- const contents = {
413
+ const contents = map({
566
414
  $metadata: deserializeMetadata(output),
567
- arn: undefined,
568
- id: undefined,
569
- name: undefined,
570
- virtualClusterId: undefined,
571
- };
415
+ });
572
416
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
573
- if (data.arn !== undefined && data.arn !== null) {
417
+ if (data.arn != null) {
574
418
  contents.arn = (0, smithy_client_1.expectString)(data.arn);
575
419
  }
576
- if (data.id !== undefined && data.id !== null) {
420
+ if (data.id != null) {
577
421
  contents.id = (0, smithy_client_1.expectString)(data.id);
578
422
  }
579
- if (data.name !== undefined && data.name !== null) {
423
+ if (data.name != null) {
580
424
  contents.name = (0, smithy_client_1.expectString)(data.name);
581
425
  }
582
- if (data.virtualClusterId !== undefined && data.virtualClusterId !== null) {
426
+ if (data.virtualClusterId != null) {
583
427
  contents.virtualClusterId = (0, smithy_client_1.expectString)(data.virtualClusterId);
584
428
  }
585
- return Promise.resolve(contents);
429
+ return contents;
586
430
  };
587
431
  exports.deserializeAws_restJson1CreateManagedEndpointCommand = deserializeAws_restJson1CreateManagedEndpointCommand;
588
432
  const deserializeAws_restJson1CreateManagedEndpointCommandError = async (output, context) => {
@@ -590,7 +434,6 @@ const deserializeAws_restJson1CreateManagedEndpointCommandError = async (output,
590
434
  ...output,
591
435
  body: await parseBody(output.body, context),
592
436
  };
593
- let response;
594
437
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
595
438
  switch (errorCode) {
596
439
  case "InternalServerException":
@@ -604,37 +447,32 @@ const deserializeAws_restJson1CreateManagedEndpointCommandError = async (output,
604
447
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
605
448
  default:
606
449
  const parsedBody = parsedOutput.body;
607
- const $metadata = deserializeMetadata(output);
608
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
609
- response = new EMRContainersServiceException_1.EMRContainersServiceException({
610
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
611
- $fault: "client",
612
- $metadata,
450
+ (0, smithy_client_1.throwDefaultError)({
451
+ output,
452
+ parsedBody,
453
+ exceptionCtor: EMRContainersServiceException_1.EMRContainersServiceException,
454
+ errorCode,
613
455
  });
614
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
615
456
  }
616
457
  };
617
458
  const deserializeAws_restJson1CreateVirtualClusterCommand = async (output, context) => {
618
459
  if (output.statusCode !== 200 && output.statusCode >= 300) {
619
460
  return deserializeAws_restJson1CreateVirtualClusterCommandError(output, context);
620
461
  }
621
- const contents = {
462
+ const contents = map({
622
463
  $metadata: deserializeMetadata(output),
623
- arn: undefined,
624
- id: undefined,
625
- name: undefined,
626
- };
464
+ });
627
465
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
628
- if (data.arn !== undefined && data.arn !== null) {
466
+ if (data.arn != null) {
629
467
  contents.arn = (0, smithy_client_1.expectString)(data.arn);
630
468
  }
631
- if (data.id !== undefined && data.id !== null) {
469
+ if (data.id != null) {
632
470
  contents.id = (0, smithy_client_1.expectString)(data.id);
633
471
  }
634
- if (data.name !== undefined && data.name !== null) {
472
+ if (data.name != null) {
635
473
  contents.name = (0, smithy_client_1.expectString)(data.name);
636
474
  }
637
- return Promise.resolve(contents);
475
+ return contents;
638
476
  };
639
477
  exports.deserializeAws_restJson1CreateVirtualClusterCommand = deserializeAws_restJson1CreateVirtualClusterCommand;
640
478
  const deserializeAws_restJson1CreateVirtualClusterCommandError = async (output, context) => {
@@ -642,7 +480,6 @@ const deserializeAws_restJson1CreateVirtualClusterCommandError = async (output,
642
480
  ...output,
643
481
  body: await parseBody(output.body, context),
644
482
  };
645
- let response;
646
483
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
647
484
  switch (errorCode) {
648
485
  case "InternalServerException":
@@ -656,33 +493,29 @@ const deserializeAws_restJson1CreateVirtualClusterCommandError = async (output,
656
493
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
657
494
  default:
658
495
  const parsedBody = parsedOutput.body;
659
- const $metadata = deserializeMetadata(output);
660
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
661
- response = new EMRContainersServiceException_1.EMRContainersServiceException({
662
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
663
- $fault: "client",
664
- $metadata,
496
+ (0, smithy_client_1.throwDefaultError)({
497
+ output,
498
+ parsedBody,
499
+ exceptionCtor: EMRContainersServiceException_1.EMRContainersServiceException,
500
+ errorCode,
665
501
  });
666
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
667
502
  }
668
503
  };
669
504
  const deserializeAws_restJson1DeleteManagedEndpointCommand = async (output, context) => {
670
505
  if (output.statusCode !== 200 && output.statusCode >= 300) {
671
506
  return deserializeAws_restJson1DeleteManagedEndpointCommandError(output, context);
672
507
  }
673
- const contents = {
508
+ const contents = map({
674
509
  $metadata: deserializeMetadata(output),
675
- id: undefined,
676
- virtualClusterId: undefined,
677
- };
510
+ });
678
511
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
679
- if (data.id !== undefined && data.id !== null) {
512
+ if (data.id != null) {
680
513
  contents.id = (0, smithy_client_1.expectString)(data.id);
681
514
  }
682
- if (data.virtualClusterId !== undefined && data.virtualClusterId !== null) {
515
+ if (data.virtualClusterId != null) {
683
516
  contents.virtualClusterId = (0, smithy_client_1.expectString)(data.virtualClusterId);
684
517
  }
685
- return Promise.resolve(contents);
518
+ return contents;
686
519
  };
687
520
  exports.deserializeAws_restJson1DeleteManagedEndpointCommand = deserializeAws_restJson1DeleteManagedEndpointCommand;
688
521
  const deserializeAws_restJson1DeleteManagedEndpointCommandError = async (output, context) => {
@@ -690,7 +523,6 @@ const deserializeAws_restJson1DeleteManagedEndpointCommandError = async (output,
690
523
  ...output,
691
524
  body: await parseBody(output.body, context),
692
525
  };
693
- let response;
694
526
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
695
527
  switch (errorCode) {
696
528
  case "InternalServerException":
@@ -701,29 +533,26 @@ const deserializeAws_restJson1DeleteManagedEndpointCommandError = async (output,
701
533
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
702
534
  default:
703
535
  const parsedBody = parsedOutput.body;
704
- const $metadata = deserializeMetadata(output);
705
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
706
- response = new EMRContainersServiceException_1.EMRContainersServiceException({
707
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
708
- $fault: "client",
709
- $metadata,
536
+ (0, smithy_client_1.throwDefaultError)({
537
+ output,
538
+ parsedBody,
539
+ exceptionCtor: EMRContainersServiceException_1.EMRContainersServiceException,
540
+ errorCode,
710
541
  });
711
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
712
542
  }
713
543
  };
714
544
  const deserializeAws_restJson1DeleteVirtualClusterCommand = async (output, context) => {
715
545
  if (output.statusCode !== 200 && output.statusCode >= 300) {
716
546
  return deserializeAws_restJson1DeleteVirtualClusterCommandError(output, context);
717
547
  }
718
- const contents = {
548
+ const contents = map({
719
549
  $metadata: deserializeMetadata(output),
720
- id: undefined,
721
- };
550
+ });
722
551
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
723
- if (data.id !== undefined && data.id !== null) {
552
+ if (data.id != null) {
724
553
  contents.id = (0, smithy_client_1.expectString)(data.id);
725
554
  }
726
- return Promise.resolve(contents);
555
+ return contents;
727
556
  };
728
557
  exports.deserializeAws_restJson1DeleteVirtualClusterCommand = deserializeAws_restJson1DeleteVirtualClusterCommand;
729
558
  const deserializeAws_restJson1DeleteVirtualClusterCommandError = async (output, context) => {
@@ -731,7 +560,6 @@ const deserializeAws_restJson1DeleteVirtualClusterCommandError = async (output,
731
560
  ...output,
732
561
  body: await parseBody(output.body, context),
733
562
  };
734
- let response;
735
563
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
736
564
  switch (errorCode) {
737
565
  case "InternalServerException":
@@ -742,29 +570,26 @@ const deserializeAws_restJson1DeleteVirtualClusterCommandError = async (output,
742
570
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
743
571
  default:
744
572
  const parsedBody = parsedOutput.body;
745
- const $metadata = deserializeMetadata(output);
746
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
747
- response = new EMRContainersServiceException_1.EMRContainersServiceException({
748
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
749
- $fault: "client",
750
- $metadata,
573
+ (0, smithy_client_1.throwDefaultError)({
574
+ output,
575
+ parsedBody,
576
+ exceptionCtor: EMRContainersServiceException_1.EMRContainersServiceException,
577
+ errorCode,
751
578
  });
752
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
753
579
  }
754
580
  };
755
581
  const deserializeAws_restJson1DescribeJobRunCommand = async (output, context) => {
756
582
  if (output.statusCode !== 200 && output.statusCode >= 300) {
757
583
  return deserializeAws_restJson1DescribeJobRunCommandError(output, context);
758
584
  }
759
- const contents = {
585
+ const contents = map({
760
586
  $metadata: deserializeMetadata(output),
761
- jobRun: undefined,
762
- };
587
+ });
763
588
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
764
- if (data.jobRun !== undefined && data.jobRun !== null) {
589
+ if (data.jobRun != null) {
765
590
  contents.jobRun = deserializeAws_restJson1JobRun(data.jobRun, context);
766
591
  }
767
- return Promise.resolve(contents);
592
+ return contents;
768
593
  };
769
594
  exports.deserializeAws_restJson1DescribeJobRunCommand = deserializeAws_restJson1DescribeJobRunCommand;
770
595
  const deserializeAws_restJson1DescribeJobRunCommandError = async (output, context) => {
@@ -772,7 +597,6 @@ const deserializeAws_restJson1DescribeJobRunCommandError = async (output, contex
772
597
  ...output,
773
598
  body: await parseBody(output.body, context),
774
599
  };
775
- let response;
776
600
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
777
601
  switch (errorCode) {
778
602
  case "InternalServerException":
@@ -786,29 +610,26 @@ const deserializeAws_restJson1DescribeJobRunCommandError = async (output, contex
786
610
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
787
611
  default:
788
612
  const parsedBody = parsedOutput.body;
789
- const $metadata = deserializeMetadata(output);
790
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
791
- response = new EMRContainersServiceException_1.EMRContainersServiceException({
792
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
793
- $fault: "client",
794
- $metadata,
613
+ (0, smithy_client_1.throwDefaultError)({
614
+ output,
615
+ parsedBody,
616
+ exceptionCtor: EMRContainersServiceException_1.EMRContainersServiceException,
617
+ errorCode,
795
618
  });
796
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
797
619
  }
798
620
  };
799
621
  const deserializeAws_restJson1DescribeManagedEndpointCommand = async (output, context) => {
800
622
  if (output.statusCode !== 200 && output.statusCode >= 300) {
801
623
  return deserializeAws_restJson1DescribeManagedEndpointCommandError(output, context);
802
624
  }
803
- const contents = {
625
+ const contents = map({
804
626
  $metadata: deserializeMetadata(output),
805
- endpoint: undefined,
806
- };
627
+ });
807
628
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
808
- if (data.endpoint !== undefined && data.endpoint !== null) {
629
+ if (data.endpoint != null) {
809
630
  contents.endpoint = deserializeAws_restJson1Endpoint(data.endpoint, context);
810
631
  }
811
- return Promise.resolve(contents);
632
+ return contents;
812
633
  };
813
634
  exports.deserializeAws_restJson1DescribeManagedEndpointCommand = deserializeAws_restJson1DescribeManagedEndpointCommand;
814
635
  const deserializeAws_restJson1DescribeManagedEndpointCommandError = async (output, context) => {
@@ -816,7 +637,6 @@ const deserializeAws_restJson1DescribeManagedEndpointCommandError = async (outpu
816
637
  ...output,
817
638
  body: await parseBody(output.body, context),
818
639
  };
819
- let response;
820
640
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
821
641
  switch (errorCode) {
822
642
  case "InternalServerException":
@@ -830,29 +650,26 @@ const deserializeAws_restJson1DescribeManagedEndpointCommandError = async (outpu
830
650
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
831
651
  default:
832
652
  const parsedBody = parsedOutput.body;
833
- const $metadata = deserializeMetadata(output);
834
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
835
- response = new EMRContainersServiceException_1.EMRContainersServiceException({
836
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
837
- $fault: "client",
838
- $metadata,
653
+ (0, smithy_client_1.throwDefaultError)({
654
+ output,
655
+ parsedBody,
656
+ exceptionCtor: EMRContainersServiceException_1.EMRContainersServiceException,
657
+ errorCode,
839
658
  });
840
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
841
659
  }
842
660
  };
843
661
  const deserializeAws_restJson1DescribeVirtualClusterCommand = async (output, context) => {
844
662
  if (output.statusCode !== 200 && output.statusCode >= 300) {
845
663
  return deserializeAws_restJson1DescribeVirtualClusterCommandError(output, context);
846
664
  }
847
- const contents = {
665
+ const contents = map({
848
666
  $metadata: deserializeMetadata(output),
849
- virtualCluster: undefined,
850
- };
667
+ });
851
668
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
852
- if (data.virtualCluster !== undefined && data.virtualCluster !== null) {
669
+ if (data.virtualCluster != null) {
853
670
  contents.virtualCluster = deserializeAws_restJson1VirtualCluster(data.virtualCluster, context);
854
671
  }
855
- return Promise.resolve(contents);
672
+ return contents;
856
673
  };
857
674
  exports.deserializeAws_restJson1DescribeVirtualClusterCommand = deserializeAws_restJson1DescribeVirtualClusterCommand;
858
675
  const deserializeAws_restJson1DescribeVirtualClusterCommandError = async (output, context) => {
@@ -860,7 +677,6 @@ const deserializeAws_restJson1DescribeVirtualClusterCommandError = async (output
860
677
  ...output,
861
678
  body: await parseBody(output.body, context),
862
679
  };
863
- let response;
864
680
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
865
681
  switch (errorCode) {
866
682
  case "InternalServerException":
@@ -874,33 +690,29 @@ const deserializeAws_restJson1DescribeVirtualClusterCommandError = async (output
874
690
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
875
691
  default:
876
692
  const parsedBody = parsedOutput.body;
877
- const $metadata = deserializeMetadata(output);
878
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
879
- response = new EMRContainersServiceException_1.EMRContainersServiceException({
880
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
881
- $fault: "client",
882
- $metadata,
693
+ (0, smithy_client_1.throwDefaultError)({
694
+ output,
695
+ parsedBody,
696
+ exceptionCtor: EMRContainersServiceException_1.EMRContainersServiceException,
697
+ errorCode,
883
698
  });
884
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
885
699
  }
886
700
  };
887
701
  const deserializeAws_restJson1ListJobRunsCommand = async (output, context) => {
888
702
  if (output.statusCode !== 200 && output.statusCode >= 300) {
889
703
  return deserializeAws_restJson1ListJobRunsCommandError(output, context);
890
704
  }
891
- const contents = {
705
+ const contents = map({
892
706
  $metadata: deserializeMetadata(output),
893
- jobRuns: undefined,
894
- nextToken: undefined,
895
- };
707
+ });
896
708
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
897
- if (data.jobRuns !== undefined && data.jobRuns !== null) {
709
+ if (data.jobRuns != null) {
898
710
  contents.jobRuns = deserializeAws_restJson1JobRuns(data.jobRuns, context);
899
711
  }
900
- if (data.nextToken !== undefined && data.nextToken !== null) {
712
+ if (data.nextToken != null) {
901
713
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
902
714
  }
903
- return Promise.resolve(contents);
715
+ return contents;
904
716
  };
905
717
  exports.deserializeAws_restJson1ListJobRunsCommand = deserializeAws_restJson1ListJobRunsCommand;
906
718
  const deserializeAws_restJson1ListJobRunsCommandError = async (output, context) => {
@@ -908,7 +720,6 @@ const deserializeAws_restJson1ListJobRunsCommandError = async (output, context)
908
720
  ...output,
909
721
  body: await parseBody(output.body, context),
910
722
  };
911
- let response;
912
723
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
913
724
  switch (errorCode) {
914
725
  case "InternalServerException":
@@ -919,33 +730,29 @@ const deserializeAws_restJson1ListJobRunsCommandError = async (output, context)
919
730
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
920
731
  default:
921
732
  const parsedBody = parsedOutput.body;
922
- const $metadata = deserializeMetadata(output);
923
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
924
- response = new EMRContainersServiceException_1.EMRContainersServiceException({
925
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
926
- $fault: "client",
927
- $metadata,
733
+ (0, smithy_client_1.throwDefaultError)({
734
+ output,
735
+ parsedBody,
736
+ exceptionCtor: EMRContainersServiceException_1.EMRContainersServiceException,
737
+ errorCode,
928
738
  });
929
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
930
739
  }
931
740
  };
932
741
  const deserializeAws_restJson1ListManagedEndpointsCommand = async (output, context) => {
933
742
  if (output.statusCode !== 200 && output.statusCode >= 300) {
934
743
  return deserializeAws_restJson1ListManagedEndpointsCommandError(output, context);
935
744
  }
936
- const contents = {
745
+ const contents = map({
937
746
  $metadata: deserializeMetadata(output),
938
- endpoints: undefined,
939
- nextToken: undefined,
940
- };
747
+ });
941
748
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
942
- if (data.endpoints !== undefined && data.endpoints !== null) {
749
+ if (data.endpoints != null) {
943
750
  contents.endpoints = deserializeAws_restJson1Endpoints(data.endpoints, context);
944
751
  }
945
- if (data.nextToken !== undefined && data.nextToken !== null) {
752
+ if (data.nextToken != null) {
946
753
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
947
754
  }
948
- return Promise.resolve(contents);
755
+ return contents;
949
756
  };
950
757
  exports.deserializeAws_restJson1ListManagedEndpointsCommand = deserializeAws_restJson1ListManagedEndpointsCommand;
951
758
  const deserializeAws_restJson1ListManagedEndpointsCommandError = async (output, context) => {
@@ -953,7 +760,6 @@ const deserializeAws_restJson1ListManagedEndpointsCommandError = async (output,
953
760
  ...output,
954
761
  body: await parseBody(output.body, context),
955
762
  };
956
- let response;
957
763
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
958
764
  switch (errorCode) {
959
765
  case "InternalServerException":
@@ -964,29 +770,26 @@ const deserializeAws_restJson1ListManagedEndpointsCommandError = async (output,
964
770
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
965
771
  default:
966
772
  const parsedBody = parsedOutput.body;
967
- const $metadata = deserializeMetadata(output);
968
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
969
- response = new EMRContainersServiceException_1.EMRContainersServiceException({
970
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
971
- $fault: "client",
972
- $metadata,
773
+ (0, smithy_client_1.throwDefaultError)({
774
+ output,
775
+ parsedBody,
776
+ exceptionCtor: EMRContainersServiceException_1.EMRContainersServiceException,
777
+ errorCode,
973
778
  });
974
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
975
779
  }
976
780
  };
977
781
  const deserializeAws_restJson1ListTagsForResourceCommand = async (output, context) => {
978
782
  if (output.statusCode !== 200 && output.statusCode >= 300) {
979
783
  return deserializeAws_restJson1ListTagsForResourceCommandError(output, context);
980
784
  }
981
- const contents = {
785
+ const contents = map({
982
786
  $metadata: deserializeMetadata(output),
983
- tags: undefined,
984
- };
787
+ });
985
788
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
986
- if (data.tags !== undefined && data.tags !== null) {
789
+ if (data.tags != null) {
987
790
  contents.tags = deserializeAws_restJson1TagMap(data.tags, context);
988
791
  }
989
- return Promise.resolve(contents);
792
+ return contents;
990
793
  };
991
794
  exports.deserializeAws_restJson1ListTagsForResourceCommand = deserializeAws_restJson1ListTagsForResourceCommand;
992
795
  const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, context) => {
@@ -994,7 +797,6 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
994
797
  ...output,
995
798
  body: await parseBody(output.body, context),
996
799
  };
997
- let response;
998
800
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
999
801
  switch (errorCode) {
1000
802
  case "InternalServerException":
@@ -1008,33 +810,29 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
1008
810
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1009
811
  default:
1010
812
  const parsedBody = parsedOutput.body;
1011
- const $metadata = deserializeMetadata(output);
1012
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1013
- response = new EMRContainersServiceException_1.EMRContainersServiceException({
1014
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1015
- $fault: "client",
1016
- $metadata,
813
+ (0, smithy_client_1.throwDefaultError)({
814
+ output,
815
+ parsedBody,
816
+ exceptionCtor: EMRContainersServiceException_1.EMRContainersServiceException,
817
+ errorCode,
1017
818
  });
1018
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1019
819
  }
1020
820
  };
1021
821
  const deserializeAws_restJson1ListVirtualClustersCommand = async (output, context) => {
1022
822
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1023
823
  return deserializeAws_restJson1ListVirtualClustersCommandError(output, context);
1024
824
  }
1025
- const contents = {
825
+ const contents = map({
1026
826
  $metadata: deserializeMetadata(output),
1027
- nextToken: undefined,
1028
- virtualClusters: undefined,
1029
- };
827
+ });
1030
828
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1031
- if (data.nextToken !== undefined && data.nextToken !== null) {
829
+ if (data.nextToken != null) {
1032
830
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1033
831
  }
1034
- if (data.virtualClusters !== undefined && data.virtualClusters !== null) {
832
+ if (data.virtualClusters != null) {
1035
833
  contents.virtualClusters = deserializeAws_restJson1VirtualClusters(data.virtualClusters, context);
1036
834
  }
1037
- return Promise.resolve(contents);
835
+ return contents;
1038
836
  };
1039
837
  exports.deserializeAws_restJson1ListVirtualClustersCommand = deserializeAws_restJson1ListVirtualClustersCommand;
1040
838
  const deserializeAws_restJson1ListVirtualClustersCommandError = async (output, context) => {
@@ -1042,7 +840,6 @@ const deserializeAws_restJson1ListVirtualClustersCommandError = async (output, c
1042
840
  ...output,
1043
841
  body: await parseBody(output.body, context),
1044
842
  };
1045
- let response;
1046
843
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1047
844
  switch (errorCode) {
1048
845
  case "InternalServerException":
@@ -1053,41 +850,35 @@ const deserializeAws_restJson1ListVirtualClustersCommandError = async (output, c
1053
850
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1054
851
  default:
1055
852
  const parsedBody = parsedOutput.body;
1056
- const $metadata = deserializeMetadata(output);
1057
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1058
- response = new EMRContainersServiceException_1.EMRContainersServiceException({
1059
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1060
- $fault: "client",
1061
- $metadata,
853
+ (0, smithy_client_1.throwDefaultError)({
854
+ output,
855
+ parsedBody,
856
+ exceptionCtor: EMRContainersServiceException_1.EMRContainersServiceException,
857
+ errorCode,
1062
858
  });
1063
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1064
859
  }
1065
860
  };
1066
861
  const deserializeAws_restJson1StartJobRunCommand = async (output, context) => {
1067
862
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1068
863
  return deserializeAws_restJson1StartJobRunCommandError(output, context);
1069
864
  }
1070
- const contents = {
865
+ const contents = map({
1071
866
  $metadata: deserializeMetadata(output),
1072
- arn: undefined,
1073
- id: undefined,
1074
- name: undefined,
1075
- virtualClusterId: undefined,
1076
- };
867
+ });
1077
868
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1078
- if (data.arn !== undefined && data.arn !== null) {
869
+ if (data.arn != null) {
1079
870
  contents.arn = (0, smithy_client_1.expectString)(data.arn);
1080
871
  }
1081
- if (data.id !== undefined && data.id !== null) {
872
+ if (data.id != null) {
1082
873
  contents.id = (0, smithy_client_1.expectString)(data.id);
1083
874
  }
1084
- if (data.name !== undefined && data.name !== null) {
875
+ if (data.name != null) {
1085
876
  contents.name = (0, smithy_client_1.expectString)(data.name);
1086
877
  }
1087
- if (data.virtualClusterId !== undefined && data.virtualClusterId !== null) {
878
+ if (data.virtualClusterId != null) {
1088
879
  contents.virtualClusterId = (0, smithy_client_1.expectString)(data.virtualClusterId);
1089
880
  }
1090
- return Promise.resolve(contents);
881
+ return contents;
1091
882
  };
1092
883
  exports.deserializeAws_restJson1StartJobRunCommand = deserializeAws_restJson1StartJobRunCommand;
1093
884
  const deserializeAws_restJson1StartJobRunCommandError = async (output, context) => {
@@ -1095,7 +886,6 @@ const deserializeAws_restJson1StartJobRunCommandError = async (output, context)
1095
886
  ...output,
1096
887
  body: await parseBody(output.body, context),
1097
888
  };
1098
- let response;
1099
889
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1100
890
  switch (errorCode) {
1101
891
  case "InternalServerException":
@@ -1109,25 +899,23 @@ const deserializeAws_restJson1StartJobRunCommandError = async (output, context)
1109
899
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1110
900
  default:
1111
901
  const parsedBody = parsedOutput.body;
1112
- const $metadata = deserializeMetadata(output);
1113
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1114
- response = new EMRContainersServiceException_1.EMRContainersServiceException({
1115
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1116
- $fault: "client",
1117
- $metadata,
902
+ (0, smithy_client_1.throwDefaultError)({
903
+ output,
904
+ parsedBody,
905
+ exceptionCtor: EMRContainersServiceException_1.EMRContainersServiceException,
906
+ errorCode,
1118
907
  });
1119
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1120
908
  }
1121
909
  };
1122
910
  const deserializeAws_restJson1TagResourceCommand = async (output, context) => {
1123
911
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1124
912
  return deserializeAws_restJson1TagResourceCommandError(output, context);
1125
913
  }
1126
- const contents = {
914
+ const contents = map({
1127
915
  $metadata: deserializeMetadata(output),
1128
- };
916
+ });
1129
917
  await collectBody(output.body, context);
1130
- return Promise.resolve(contents);
918
+ return contents;
1131
919
  };
1132
920
  exports.deserializeAws_restJson1TagResourceCommand = deserializeAws_restJson1TagResourceCommand;
1133
921
  const deserializeAws_restJson1TagResourceCommandError = async (output, context) => {
@@ -1135,7 +923,6 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
1135
923
  ...output,
1136
924
  body: await parseBody(output.body, context),
1137
925
  };
1138
- let response;
1139
926
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1140
927
  switch (errorCode) {
1141
928
  case "InternalServerException":
@@ -1149,25 +936,23 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
1149
936
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1150
937
  default:
1151
938
  const parsedBody = parsedOutput.body;
1152
- const $metadata = deserializeMetadata(output);
1153
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1154
- response = new EMRContainersServiceException_1.EMRContainersServiceException({
1155
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1156
- $fault: "client",
1157
- $metadata,
939
+ (0, smithy_client_1.throwDefaultError)({
940
+ output,
941
+ parsedBody,
942
+ exceptionCtor: EMRContainersServiceException_1.EMRContainersServiceException,
943
+ errorCode,
1158
944
  });
1159
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1160
945
  }
1161
946
  };
1162
947
  const deserializeAws_restJson1UntagResourceCommand = async (output, context) => {
1163
948
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1164
949
  return deserializeAws_restJson1UntagResourceCommandError(output, context);
1165
950
  }
1166
- const contents = {
951
+ const contents = map({
1167
952
  $metadata: deserializeMetadata(output),
1168
- };
953
+ });
1169
954
  await collectBody(output.body, context);
1170
- return Promise.resolve(contents);
955
+ return contents;
1171
956
  };
1172
957
  exports.deserializeAws_restJson1UntagResourceCommand = deserializeAws_restJson1UntagResourceCommand;
1173
958
  const deserializeAws_restJson1UntagResourceCommandError = async (output, context) => {
@@ -1175,7 +960,6 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
1175
960
  ...output,
1176
961
  body: await parseBody(output.body, context),
1177
962
  };
1178
- let response;
1179
963
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1180
964
  switch (errorCode) {
1181
965
  case "InternalServerException":
@@ -1189,20 +973,19 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
1189
973
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1190
974
  default:
1191
975
  const parsedBody = parsedOutput.body;
1192
- const $metadata = deserializeMetadata(output);
1193
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1194
- response = new EMRContainersServiceException_1.EMRContainersServiceException({
1195
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1196
- $fault: "client",
1197
- $metadata,
976
+ (0, smithy_client_1.throwDefaultError)({
977
+ output,
978
+ parsedBody,
979
+ exceptionCtor: EMRContainersServiceException_1.EMRContainersServiceException,
980
+ errorCode,
1198
981
  });
1199
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1200
982
  }
1201
983
  };
984
+ const map = smithy_client_1.map;
1202
985
  const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOutput, context) => {
1203
- const contents = {};
986
+ const contents = map({});
1204
987
  const data = parsedOutput.body;
1205
- if (data.message !== undefined && data.message !== null) {
988
+ if (data.message != null) {
1206
989
  contents.message = (0, smithy_client_1.expectString)(data.message);
1207
990
  }
1208
991
  const exception = new models_0_1.InternalServerException({
@@ -1212,9 +995,9 @@ const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOut
1212
995
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1213
996
  };
1214
997
  const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
1215
- const contents = {};
998
+ const contents = map({});
1216
999
  const data = parsedOutput.body;
1217
- if (data.message !== undefined && data.message !== null) {
1000
+ if (data.message != null) {
1218
1001
  contents.message = (0, smithy_client_1.expectString)(data.message);
1219
1002
  }
1220
1003
  const exception = new models_0_1.ResourceNotFoundException({
@@ -1224,9 +1007,9 @@ const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedO
1224
1007
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1225
1008
  };
1226
1009
  const deserializeAws_restJson1ValidationExceptionResponse = async (parsedOutput, context) => {
1227
- const contents = {};
1010
+ const contents = map({});
1228
1011
  const data = parsedOutput.body;
1229
- if (data.message !== undefined && data.message !== null) {
1012
+ if (data.message != null) {
1230
1013
  contents.message = (0, smithy_client_1.expectString)(data.message);
1231
1014
  }
1232
1015
  const exception = new models_0_1.ValidationException({
@@ -1256,9 +1039,6 @@ const serializeAws_restJson1ConfigurationList = (input, context) => {
1256
1039
  return input
1257
1040
  .filter((e) => e != null)
1258
1041
  .map((entry) => {
1259
- if (entry === null) {
1260
- return null;
1261
- }
1262
1042
  return serializeAws_restJson1Configuration(entry, context);
1263
1043
  });
1264
1044
  };
@@ -1294,9 +1074,6 @@ const serializeAws_restJson1EntryPointArguments = (input, context) => {
1294
1074
  return input
1295
1075
  .filter((e) => e != null)
1296
1076
  .map((entry) => {
1297
- if (entry === null) {
1298
- return null;
1299
- }
1300
1077
  return entry;
1301
1078
  });
1302
1079
  };
@@ -1399,7 +1176,7 @@ const deserializeAws_restJson1ConfigurationOverrides = (output, context) => {
1399
1176
  };
1400
1177
  };
1401
1178
  const deserializeAws_restJson1ContainerInfo = (output, context) => {
1402
- if (output.eksInfo !== undefined && output.eksInfo !== null) {
1179
+ if (output.eksInfo != null) {
1403
1180
  return {
1404
1181
  eksInfo: deserializeAws_restJson1EksInfo(output.eksInfo, context),
1405
1182
  };