@aws-sdk/client-dlm 3.131.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.
@@ -36,16 +36,7 @@ const serializeAws_restJson1DeleteLifecyclePolicyCommand = async (input, context
36
36
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
37
37
  const headers = {};
38
38
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/policies/{PolicyId}";
39
- if (input.PolicyId !== undefined) {
40
- const labelValue = input.PolicyId;
41
- if (labelValue.length <= 0) {
42
- throw new Error("Empty value provided for input HTTP label: PolicyId.");
43
- }
44
- resolvedPath = resolvedPath.replace("{PolicyId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
45
- }
46
- else {
47
- throw new Error("No value provided for input HTTP label: PolicyId.");
48
- }
39
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "PolicyId", () => input.PolicyId, "{PolicyId}", false);
49
40
  let body;
50
41
  return new protocol_http_1.HttpRequest({
51
42
  protocol,
@@ -62,15 +53,16 @@ const serializeAws_restJson1GetLifecyclePoliciesCommand = async (input, context)
62
53
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
63
54
  const headers = {};
64
55
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/policies";
65
- const query = {
66
- ...(input.PolicyIds !== undefined && { policyIds: (input.PolicyIds || []).map((_entry) => _entry) }),
67
- ...(input.State !== undefined && { state: input.State }),
68
- ...(input.ResourceTypes !== undefined && {
69
- resourceTypes: (input.ResourceTypes || []).map((_entry) => _entry),
70
- }),
71
- ...(input.TargetTags !== undefined && { targetTags: (input.TargetTags || []).map((_entry) => _entry) }),
72
- ...(input.TagsToAdd !== undefined && { tagsToAdd: (input.TagsToAdd || []).map((_entry) => _entry) }),
73
- };
56
+ const query = map({
57
+ policyIds: [() => input.PolicyIds !== void 0, () => (input.PolicyIds || []).map((_entry) => _entry)],
58
+ state: [, input.State],
59
+ resourceTypes: [
60
+ () => input.ResourceTypes !== void 0,
61
+ () => (input.ResourceTypes || []).map((_entry) => _entry),
62
+ ],
63
+ targetTags: [() => input.TargetTags !== void 0, () => (input.TargetTags || []).map((_entry) => _entry)],
64
+ tagsToAdd: [() => input.TagsToAdd !== void 0, () => (input.TagsToAdd || []).map((_entry) => _entry)],
65
+ });
74
66
  let body;
75
67
  return new protocol_http_1.HttpRequest({
76
68
  protocol,
@@ -88,16 +80,7 @@ const serializeAws_restJson1GetLifecyclePolicyCommand = async (input, context) =
88
80
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
89
81
  const headers = {};
90
82
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/policies/{PolicyId}";
91
- if (input.PolicyId !== undefined) {
92
- const labelValue = input.PolicyId;
93
- if (labelValue.length <= 0) {
94
- throw new Error("Empty value provided for input HTTP label: PolicyId.");
95
- }
96
- resolvedPath = resolvedPath.replace("{PolicyId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
97
- }
98
- else {
99
- throw new Error("No value provided for input HTTP label: PolicyId.");
100
- }
83
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "PolicyId", () => input.PolicyId, "{PolicyId}", false);
101
84
  let body;
102
85
  return new protocol_http_1.HttpRequest({
103
86
  protocol,
@@ -114,16 +97,7 @@ const serializeAws_restJson1ListTagsForResourceCommand = async (input, context)
114
97
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
115
98
  const headers = {};
116
99
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}";
117
- if (input.ResourceArn !== undefined) {
118
- const labelValue = input.ResourceArn;
119
- if (labelValue.length <= 0) {
120
- throw new Error("Empty value provided for input HTTP label: ResourceArn.");
121
- }
122
- resolvedPath = resolvedPath.replace("{ResourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
123
- }
124
- else {
125
- throw new Error("No value provided for input HTTP label: ResourceArn.");
126
- }
100
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ResourceArn", () => input.ResourceArn, "{ResourceArn}", false);
127
101
  let body;
128
102
  return new protocol_http_1.HttpRequest({
129
103
  protocol,
@@ -142,16 +116,7 @@ const serializeAws_restJson1TagResourceCommand = async (input, context) => {
142
116
  "content-type": "application/json",
143
117
  };
144
118
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}";
145
- if (input.ResourceArn !== undefined) {
146
- const labelValue = input.ResourceArn;
147
- if (labelValue.length <= 0) {
148
- throw new Error("Empty value provided for input HTTP label: ResourceArn.");
149
- }
150
- resolvedPath = resolvedPath.replace("{ResourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
151
- }
152
- else {
153
- throw new Error("No value provided for input HTTP label: ResourceArn.");
154
- }
119
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ResourceArn", () => input.ResourceArn, "{ResourceArn}", false);
155
120
  let body;
156
121
  body = JSON.stringify({
157
122
  ...(input.Tags != null && { Tags: serializeAws_restJson1TagMap(input.Tags, context) }),
@@ -171,19 +136,10 @@ const serializeAws_restJson1UntagResourceCommand = async (input, context) => {
171
136
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
172
137
  const headers = {};
173
138
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}";
174
- if (input.ResourceArn !== undefined) {
175
- const labelValue = input.ResourceArn;
176
- if (labelValue.length <= 0) {
177
- throw new Error("Empty value provided for input HTTP label: ResourceArn.");
178
- }
179
- resolvedPath = resolvedPath.replace("{ResourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
180
- }
181
- else {
182
- throw new Error("No value provided for input HTTP label: ResourceArn.");
183
- }
184
- const query = {
185
- ...(input.TagKeys !== undefined && { tagKeys: (input.TagKeys || []).map((_entry) => _entry) }),
186
- };
139
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ResourceArn", () => input.ResourceArn, "{ResourceArn}", false);
140
+ const query = map({
141
+ tagKeys: [() => input.TagKeys !== void 0, () => (input.TagKeys || []).map((_entry) => _entry)],
142
+ });
187
143
  let body;
188
144
  return new protocol_http_1.HttpRequest({
189
145
  protocol,
@@ -203,16 +159,7 @@ const serializeAws_restJson1UpdateLifecyclePolicyCommand = async (input, context
203
159
  "content-type": "application/json",
204
160
  };
205
161
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/policies/{PolicyId}";
206
- if (input.PolicyId !== undefined) {
207
- const labelValue = input.PolicyId;
208
- if (labelValue.length <= 0) {
209
- throw new Error("Empty value provided for input HTTP label: PolicyId.");
210
- }
211
- resolvedPath = resolvedPath.replace("{PolicyId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
212
- }
213
- else {
214
- throw new Error("No value provided for input HTTP label: PolicyId.");
215
- }
162
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "PolicyId", () => input.PolicyId, "{PolicyId}", false);
216
163
  let body;
217
164
  body = JSON.stringify({
218
165
  ...(input.Description != null && { Description: input.Description }),
@@ -237,15 +184,14 @@ const deserializeAws_restJson1CreateLifecyclePolicyCommand = async (output, cont
237
184
  if (output.statusCode !== 200 && output.statusCode >= 300) {
238
185
  return deserializeAws_restJson1CreateLifecyclePolicyCommandError(output, context);
239
186
  }
240
- const contents = {
187
+ const contents = map({
241
188
  $metadata: deserializeMetadata(output),
242
- PolicyId: undefined,
243
- };
189
+ });
244
190
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
245
- if (data.PolicyId !== undefined && data.PolicyId !== null) {
191
+ if (data.PolicyId != null) {
246
192
  contents.PolicyId = (0, smithy_client_1.expectString)(data.PolicyId);
247
193
  }
248
- return Promise.resolve(contents);
194
+ return contents;
249
195
  };
250
196
  exports.deserializeAws_restJson1CreateLifecyclePolicyCommand = deserializeAws_restJson1CreateLifecyclePolicyCommand;
251
197
  const deserializeAws_restJson1CreateLifecyclePolicyCommandError = async (output, context) => {
@@ -253,7 +199,6 @@ const deserializeAws_restJson1CreateLifecyclePolicyCommandError = async (output,
253
199
  ...output,
254
200
  body: await parseBody(output.body, context),
255
201
  };
256
- let response;
257
202
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
258
203
  switch (errorCode) {
259
204
  case "InternalServerException":
@@ -267,25 +212,23 @@ const deserializeAws_restJson1CreateLifecyclePolicyCommandError = async (output,
267
212
  throw await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context);
268
213
  default:
269
214
  const parsedBody = parsedOutput.body;
270
- const $metadata = deserializeMetadata(output);
271
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
272
- response = new DLMServiceException_1.DLMServiceException({
273
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
274
- $fault: "client",
275
- $metadata,
215
+ (0, smithy_client_1.throwDefaultError)({
216
+ output,
217
+ parsedBody,
218
+ exceptionCtor: DLMServiceException_1.DLMServiceException,
219
+ errorCode,
276
220
  });
277
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
278
221
  }
279
222
  };
280
223
  const deserializeAws_restJson1DeleteLifecyclePolicyCommand = async (output, context) => {
281
224
  if (output.statusCode !== 200 && output.statusCode >= 300) {
282
225
  return deserializeAws_restJson1DeleteLifecyclePolicyCommandError(output, context);
283
226
  }
284
- const contents = {
227
+ const contents = map({
285
228
  $metadata: deserializeMetadata(output),
286
- };
229
+ });
287
230
  await collectBody(output.body, context);
288
- return Promise.resolve(contents);
231
+ return contents;
289
232
  };
290
233
  exports.deserializeAws_restJson1DeleteLifecyclePolicyCommand = deserializeAws_restJson1DeleteLifecyclePolicyCommand;
291
234
  const deserializeAws_restJson1DeleteLifecyclePolicyCommandError = async (output, context) => {
@@ -293,7 +236,6 @@ const deserializeAws_restJson1DeleteLifecyclePolicyCommandError = async (output,
293
236
  ...output,
294
237
  body: await parseBody(output.body, context),
295
238
  };
296
- let response;
297
239
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
298
240
  switch (errorCode) {
299
241
  case "InternalServerException":
@@ -307,29 +249,26 @@ const deserializeAws_restJson1DeleteLifecyclePolicyCommandError = async (output,
307
249
  throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
308
250
  default:
309
251
  const parsedBody = parsedOutput.body;
310
- const $metadata = deserializeMetadata(output);
311
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
312
- response = new DLMServiceException_1.DLMServiceException({
313
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
314
- $fault: "client",
315
- $metadata,
252
+ (0, smithy_client_1.throwDefaultError)({
253
+ output,
254
+ parsedBody,
255
+ exceptionCtor: DLMServiceException_1.DLMServiceException,
256
+ errorCode,
316
257
  });
317
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
318
258
  }
319
259
  };
320
260
  const deserializeAws_restJson1GetLifecyclePoliciesCommand = async (output, context) => {
321
261
  if (output.statusCode !== 200 && output.statusCode >= 300) {
322
262
  return deserializeAws_restJson1GetLifecyclePoliciesCommandError(output, context);
323
263
  }
324
- const contents = {
264
+ const contents = map({
325
265
  $metadata: deserializeMetadata(output),
326
- Policies: undefined,
327
- };
266
+ });
328
267
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
329
- if (data.Policies !== undefined && data.Policies !== null) {
268
+ if (data.Policies != null) {
330
269
  contents.Policies = deserializeAws_restJson1LifecyclePolicySummaryList(data.Policies, context);
331
270
  }
332
- return Promise.resolve(contents);
271
+ return contents;
333
272
  };
334
273
  exports.deserializeAws_restJson1GetLifecyclePoliciesCommand = deserializeAws_restJson1GetLifecyclePoliciesCommand;
335
274
  const deserializeAws_restJson1GetLifecyclePoliciesCommandError = async (output, context) => {
@@ -337,7 +276,6 @@ const deserializeAws_restJson1GetLifecyclePoliciesCommandError = async (output,
337
276
  ...output,
338
277
  body: await parseBody(output.body, context),
339
278
  };
340
- let response;
341
279
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
342
280
  switch (errorCode) {
343
281
  case "InternalServerException":
@@ -354,29 +292,26 @@ const deserializeAws_restJson1GetLifecyclePoliciesCommandError = async (output,
354
292
  throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
355
293
  default:
356
294
  const parsedBody = parsedOutput.body;
357
- const $metadata = deserializeMetadata(output);
358
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
359
- response = new DLMServiceException_1.DLMServiceException({
360
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
361
- $fault: "client",
362
- $metadata,
295
+ (0, smithy_client_1.throwDefaultError)({
296
+ output,
297
+ parsedBody,
298
+ exceptionCtor: DLMServiceException_1.DLMServiceException,
299
+ errorCode,
363
300
  });
364
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
365
301
  }
366
302
  };
367
303
  const deserializeAws_restJson1GetLifecyclePolicyCommand = async (output, context) => {
368
304
  if (output.statusCode !== 200 && output.statusCode >= 300) {
369
305
  return deserializeAws_restJson1GetLifecyclePolicyCommandError(output, context);
370
306
  }
371
- const contents = {
307
+ const contents = map({
372
308
  $metadata: deserializeMetadata(output),
373
- Policy: undefined,
374
- };
309
+ });
375
310
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
376
- if (data.Policy !== undefined && data.Policy !== null) {
311
+ if (data.Policy != null) {
377
312
  contents.Policy = deserializeAws_restJson1LifecyclePolicy(data.Policy, context);
378
313
  }
379
- return Promise.resolve(contents);
314
+ return contents;
380
315
  };
381
316
  exports.deserializeAws_restJson1GetLifecyclePolicyCommand = deserializeAws_restJson1GetLifecyclePolicyCommand;
382
317
  const deserializeAws_restJson1GetLifecyclePolicyCommandError = async (output, context) => {
@@ -384,7 +319,6 @@ const deserializeAws_restJson1GetLifecyclePolicyCommandError = async (output, co
384
319
  ...output,
385
320
  body: await parseBody(output.body, context),
386
321
  };
387
- let response;
388
322
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
389
323
  switch (errorCode) {
390
324
  case "InternalServerException":
@@ -398,29 +332,26 @@ const deserializeAws_restJson1GetLifecyclePolicyCommandError = async (output, co
398
332
  throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
399
333
  default:
400
334
  const parsedBody = parsedOutput.body;
401
- const $metadata = deserializeMetadata(output);
402
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
403
- response = new DLMServiceException_1.DLMServiceException({
404
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
405
- $fault: "client",
406
- $metadata,
335
+ (0, smithy_client_1.throwDefaultError)({
336
+ output,
337
+ parsedBody,
338
+ exceptionCtor: DLMServiceException_1.DLMServiceException,
339
+ errorCode,
407
340
  });
408
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
409
341
  }
410
342
  };
411
343
  const deserializeAws_restJson1ListTagsForResourceCommand = async (output, context) => {
412
344
  if (output.statusCode !== 200 && output.statusCode >= 300) {
413
345
  return deserializeAws_restJson1ListTagsForResourceCommandError(output, context);
414
346
  }
415
- const contents = {
347
+ const contents = map({
416
348
  $metadata: deserializeMetadata(output),
417
- Tags: undefined,
418
- };
349
+ });
419
350
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
420
- if (data.Tags !== undefined && data.Tags !== null) {
351
+ if (data.Tags != null) {
421
352
  contents.Tags = deserializeAws_restJson1TagMap(data.Tags, context);
422
353
  }
423
- return Promise.resolve(contents);
354
+ return contents;
424
355
  };
425
356
  exports.deserializeAws_restJson1ListTagsForResourceCommand = deserializeAws_restJson1ListTagsForResourceCommand;
426
357
  const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, context) => {
@@ -428,7 +359,6 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
428
359
  ...output,
429
360
  body: await parseBody(output.body, context),
430
361
  };
431
- let response;
432
362
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
433
363
  switch (errorCode) {
434
364
  case "InternalServerException":
@@ -442,25 +372,23 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
442
372
  throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
443
373
  default:
444
374
  const parsedBody = parsedOutput.body;
445
- const $metadata = deserializeMetadata(output);
446
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
447
- response = new DLMServiceException_1.DLMServiceException({
448
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
449
- $fault: "client",
450
- $metadata,
375
+ (0, smithy_client_1.throwDefaultError)({
376
+ output,
377
+ parsedBody,
378
+ exceptionCtor: DLMServiceException_1.DLMServiceException,
379
+ errorCode,
451
380
  });
452
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
453
381
  }
454
382
  };
455
383
  const deserializeAws_restJson1TagResourceCommand = async (output, context) => {
456
384
  if (output.statusCode !== 200 && output.statusCode >= 300) {
457
385
  return deserializeAws_restJson1TagResourceCommandError(output, context);
458
386
  }
459
- const contents = {
387
+ const contents = map({
460
388
  $metadata: deserializeMetadata(output),
461
- };
389
+ });
462
390
  await collectBody(output.body, context);
463
- return Promise.resolve(contents);
391
+ return contents;
464
392
  };
465
393
  exports.deserializeAws_restJson1TagResourceCommand = deserializeAws_restJson1TagResourceCommand;
466
394
  const deserializeAws_restJson1TagResourceCommandError = async (output, context) => {
@@ -468,7 +396,6 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
468
396
  ...output,
469
397
  body: await parseBody(output.body, context),
470
398
  };
471
- let response;
472
399
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
473
400
  switch (errorCode) {
474
401
  case "InternalServerException":
@@ -482,25 +409,23 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
482
409
  throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
483
410
  default:
484
411
  const parsedBody = parsedOutput.body;
485
- const $metadata = deserializeMetadata(output);
486
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
487
- response = new DLMServiceException_1.DLMServiceException({
488
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
489
- $fault: "client",
490
- $metadata,
412
+ (0, smithy_client_1.throwDefaultError)({
413
+ output,
414
+ parsedBody,
415
+ exceptionCtor: DLMServiceException_1.DLMServiceException,
416
+ errorCode,
491
417
  });
492
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
493
418
  }
494
419
  };
495
420
  const deserializeAws_restJson1UntagResourceCommand = async (output, context) => {
496
421
  if (output.statusCode !== 200 && output.statusCode >= 300) {
497
422
  return deserializeAws_restJson1UntagResourceCommandError(output, context);
498
423
  }
499
- const contents = {
424
+ const contents = map({
500
425
  $metadata: deserializeMetadata(output),
501
- };
426
+ });
502
427
  await collectBody(output.body, context);
503
- return Promise.resolve(contents);
428
+ return contents;
504
429
  };
505
430
  exports.deserializeAws_restJson1UntagResourceCommand = deserializeAws_restJson1UntagResourceCommand;
506
431
  const deserializeAws_restJson1UntagResourceCommandError = async (output, context) => {
@@ -508,7 +433,6 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
508
433
  ...output,
509
434
  body: await parseBody(output.body, context),
510
435
  };
511
- let response;
512
436
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
513
437
  switch (errorCode) {
514
438
  case "InternalServerException":
@@ -522,25 +446,23 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
522
446
  throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
523
447
  default:
524
448
  const parsedBody = parsedOutput.body;
525
- const $metadata = deserializeMetadata(output);
526
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
527
- response = new DLMServiceException_1.DLMServiceException({
528
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
529
- $fault: "client",
530
- $metadata,
449
+ (0, smithy_client_1.throwDefaultError)({
450
+ output,
451
+ parsedBody,
452
+ exceptionCtor: DLMServiceException_1.DLMServiceException,
453
+ errorCode,
531
454
  });
532
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
533
455
  }
534
456
  };
535
457
  const deserializeAws_restJson1UpdateLifecyclePolicyCommand = async (output, context) => {
536
458
  if (output.statusCode !== 200 && output.statusCode >= 300) {
537
459
  return deserializeAws_restJson1UpdateLifecyclePolicyCommandError(output, context);
538
460
  }
539
- const contents = {
461
+ const contents = map({
540
462
  $metadata: deserializeMetadata(output),
541
- };
463
+ });
542
464
  await collectBody(output.body, context);
543
- return Promise.resolve(contents);
465
+ return contents;
544
466
  };
545
467
  exports.deserializeAws_restJson1UpdateLifecyclePolicyCommand = deserializeAws_restJson1UpdateLifecyclePolicyCommand;
546
468
  const deserializeAws_restJson1UpdateLifecyclePolicyCommandError = async (output, context) => {
@@ -548,7 +470,6 @@ const deserializeAws_restJson1UpdateLifecyclePolicyCommandError = async (output,
548
470
  ...output,
549
471
  body: await parseBody(output.body, context),
550
472
  };
551
- let response;
552
473
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
553
474
  switch (errorCode) {
554
475
  case "InternalServerException":
@@ -565,23 +486,22 @@ const deserializeAws_restJson1UpdateLifecyclePolicyCommandError = async (output,
565
486
  throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
566
487
  default:
567
488
  const parsedBody = parsedOutput.body;
568
- const $metadata = deserializeMetadata(output);
569
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
570
- response = new DLMServiceException_1.DLMServiceException({
571
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
572
- $fault: "client",
573
- $metadata,
489
+ (0, smithy_client_1.throwDefaultError)({
490
+ output,
491
+ parsedBody,
492
+ exceptionCtor: DLMServiceException_1.DLMServiceException,
493
+ errorCode,
574
494
  });
575
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
576
495
  }
577
496
  };
497
+ const map = smithy_client_1.map;
578
498
  const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOutput, context) => {
579
- const contents = {};
499
+ const contents = map({});
580
500
  const data = parsedOutput.body;
581
- if (data.Code !== undefined && data.Code !== null) {
501
+ if (data.Code != null) {
582
502
  contents.Code = (0, smithy_client_1.expectString)(data.Code);
583
503
  }
584
- if (data.Message !== undefined && data.Message !== null) {
504
+ if (data.Message != null) {
585
505
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
586
506
  }
587
507
  const exception = new models_0_1.InternalServerException({
@@ -591,18 +511,18 @@ const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOut
591
511
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
592
512
  };
593
513
  const deserializeAws_restJson1InvalidRequestExceptionResponse = async (parsedOutput, context) => {
594
- const contents = {};
514
+ const contents = map({});
595
515
  const data = parsedOutput.body;
596
- if (data.Code !== undefined && data.Code !== null) {
516
+ if (data.Code != null) {
597
517
  contents.Code = (0, smithy_client_1.expectString)(data.Code);
598
518
  }
599
- if (data.Message !== undefined && data.Message !== null) {
519
+ if (data.Message != null) {
600
520
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
601
521
  }
602
- if (data.MutuallyExclusiveParameters !== undefined && data.MutuallyExclusiveParameters !== null) {
522
+ if (data.MutuallyExclusiveParameters != null) {
603
523
  contents.MutuallyExclusiveParameters = deserializeAws_restJson1ParameterList(data.MutuallyExclusiveParameters, context);
604
524
  }
605
- if (data.RequiredParameters !== undefined && data.RequiredParameters !== null) {
525
+ if (data.RequiredParameters != null) {
606
526
  contents.RequiredParameters = deserializeAws_restJson1ParameterList(data.RequiredParameters, context);
607
527
  }
608
528
  const exception = new models_0_1.InvalidRequestException({
@@ -612,15 +532,15 @@ const deserializeAws_restJson1InvalidRequestExceptionResponse = async (parsedOut
612
532
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
613
533
  };
614
534
  const deserializeAws_restJson1LimitExceededExceptionResponse = async (parsedOutput, context) => {
615
- const contents = {};
535
+ const contents = map({});
616
536
  const data = parsedOutput.body;
617
- if (data.Code !== undefined && data.Code !== null) {
537
+ if (data.Code != null) {
618
538
  contents.Code = (0, smithy_client_1.expectString)(data.Code);
619
539
  }
620
- if (data.Message !== undefined && data.Message !== null) {
540
+ if (data.Message != null) {
621
541
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
622
542
  }
623
- if (data.ResourceType !== undefined && data.ResourceType !== null) {
543
+ if (data.ResourceType != null) {
624
544
  contents.ResourceType = (0, smithy_client_1.expectString)(data.ResourceType);
625
545
  }
626
546
  const exception = new models_0_1.LimitExceededException({
@@ -630,18 +550,18 @@ const deserializeAws_restJson1LimitExceededExceptionResponse = async (parsedOutp
630
550
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
631
551
  };
632
552
  const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
633
- const contents = {};
553
+ const contents = map({});
634
554
  const data = parsedOutput.body;
635
- if (data.Code !== undefined && data.Code !== null) {
555
+ if (data.Code != null) {
636
556
  contents.Code = (0, smithy_client_1.expectString)(data.Code);
637
557
  }
638
- if (data.Message !== undefined && data.Message !== null) {
558
+ if (data.Message != null) {
639
559
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
640
560
  }
641
- if (data.ResourceIds !== undefined && data.ResourceIds !== null) {
561
+ if (data.ResourceIds != null) {
642
562
  contents.ResourceIds = deserializeAws_restJson1PolicyIdList(data.ResourceIds, context);
643
563
  }
644
- if (data.ResourceType !== undefined && data.ResourceType !== null) {
564
+ if (data.ResourceType != null) {
645
565
  contents.ResourceType = (0, smithy_client_1.expectString)(data.ResourceType);
646
566
  }
647
567
  const exception = new models_0_1.ResourceNotFoundException({
@@ -662,9 +582,6 @@ const serializeAws_restJson1ActionList = (input, context) => {
662
582
  return input
663
583
  .filter((e) => e != null)
664
584
  .map((entry) => {
665
- if (entry === null) {
666
- return null;
667
- }
668
585
  return serializeAws_restJson1Action(entry, context);
669
586
  });
670
587
  };
@@ -672,9 +589,6 @@ const serializeAws_restJson1AvailabilityZoneList = (input, context) => {
672
589
  return input
673
590
  .filter((e) => e != null)
674
591
  .map((entry) => {
675
- if (entry === null) {
676
- return null;
677
- }
678
592
  return entry;
679
593
  });
680
594
  };
@@ -702,9 +616,6 @@ const serializeAws_restJson1CrossRegionCopyActionList = (input, context) => {
702
616
  return input
703
617
  .filter((e) => e != null)
704
618
  .map((entry) => {
705
- if (entry === null) {
706
- return null;
707
- }
708
619
  return serializeAws_restJson1CrossRegionCopyAction(entry, context);
709
620
  });
710
621
  };
@@ -739,9 +650,6 @@ const serializeAws_restJson1CrossRegionCopyRules = (input, context) => {
739
650
  return input
740
651
  .filter((e) => e != null)
741
652
  .map((entry) => {
742
- if (entry === null) {
743
- return null;
744
- }
745
653
  return serializeAws_restJson1CrossRegionCopyRule(entry, context);
746
654
  });
747
655
  };
@@ -809,9 +717,6 @@ const serializeAws_restJson1ResourceLocationList = (input, context) => {
809
717
  return input
810
718
  .filter((e) => e != null)
811
719
  .map((entry) => {
812
- if (entry === null) {
813
- return null;
814
- }
815
720
  return entry;
816
721
  });
817
722
  };
@@ -819,9 +724,6 @@ const serializeAws_restJson1ResourceTypeValuesList = (input, context) => {
819
724
  return input
820
725
  .filter((e) => e != null)
821
726
  .map((entry) => {
822
- if (entry === null) {
823
- return null;
824
- }
825
727
  return entry;
826
728
  });
827
729
  };
@@ -858,9 +760,6 @@ const serializeAws_restJson1ScheduleList = (input, context) => {
858
760
  return input
859
761
  .filter((e) => e != null)
860
762
  .map((entry) => {
861
- if (entry === null) {
862
- return null;
863
- }
864
763
  return serializeAws_restJson1Schedule(entry, context);
865
764
  });
866
765
  };
@@ -877,9 +776,6 @@ const serializeAws_restJson1ShareRules = (input, context) => {
877
776
  return input
878
777
  .filter((e) => e != null)
879
778
  .map((entry) => {
880
- if (entry === null) {
881
- return null;
882
- }
883
779
  return serializeAws_restJson1ShareRule(entry, context);
884
780
  });
885
781
  };
@@ -887,9 +783,6 @@ const serializeAws_restJson1ShareTargetAccountList = (input, context) => {
887
783
  return input
888
784
  .filter((e) => e != null)
889
785
  .map((entry) => {
890
- if (entry === null) {
891
- return null;
892
- }
893
786
  return entry;
894
787
  });
895
788
  };
@@ -897,9 +790,6 @@ const serializeAws_restJson1SnapshotOwnerList = (input, context) => {
897
790
  return input
898
791
  .filter((e) => e != null)
899
792
  .map((entry) => {
900
- if (entry === null) {
901
- return null;
902
- }
903
793
  return entry;
904
794
  });
905
795
  };
@@ -924,9 +814,6 @@ const serializeAws_restJson1TagsToAddList = (input, context) => {
924
814
  return input
925
815
  .filter((e) => e != null)
926
816
  .map((entry) => {
927
- if (entry === null) {
928
- return null;
929
- }
930
817
  return serializeAws_restJson1Tag(entry, context);
931
818
  });
932
819
  };
@@ -934,9 +821,6 @@ const serializeAws_restJson1TargetTagList = (input, context) => {
934
821
  return input
935
822
  .filter((e) => e != null)
936
823
  .map((entry) => {
937
- if (entry === null) {
938
- return null;
939
- }
940
824
  return serializeAws_restJson1Tag(entry, context);
941
825
  });
942
826
  };
@@ -944,9 +828,6 @@ const serializeAws_restJson1TimesList = (input, context) => {
944
828
  return input
945
829
  .filter((e) => e != null)
946
830
  .map((entry) => {
947
- if (entry === null) {
948
- return null;
949
- }
950
831
  return entry;
951
832
  });
952
833
  };
@@ -954,9 +835,6 @@ const serializeAws_restJson1VariableTagsList = (input, context) => {
954
835
  return input
955
836
  .filter((e) => e != null)
956
837
  .map((entry) => {
957
- if (entry === null) {
958
- return null;
959
- }
960
838
  return serializeAws_restJson1Tag(entry, context);
961
839
  });
962
840
  };