@aws-sdk/client-rum 3.141.0 → 3.142.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -36,16 +36,7 @@ const serializeAws_restJson1DeleteAppMonitorCommand = 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 || ""}` + "/appmonitor/{Name}";
39
- if (input.Name !== undefined) {
40
- const labelValue = input.Name;
41
- if (labelValue.length <= 0) {
42
- throw new Error("Empty value provided for input HTTP label: Name.");
43
- }
44
- resolvedPath = resolvedPath.replace("{Name}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
45
- }
46
- else {
47
- throw new Error("No value provided for input HTTP label: Name.");
48
- }
39
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "Name", () => input.Name, "{Name}", false);
49
40
  let body;
50
41
  return new protocol_http_1.HttpRequest({
51
42
  protocol,
@@ -62,16 +53,7 @@ const serializeAws_restJson1GetAppMonitorCommand = async (input, context) => {
62
53
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
63
54
  const headers = {};
64
55
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/appmonitor/{Name}";
65
- if (input.Name !== undefined) {
66
- const labelValue = input.Name;
67
- if (labelValue.length <= 0) {
68
- throw new Error("Empty value provided for input HTTP label: Name.");
69
- }
70
- resolvedPath = resolvedPath.replace("{Name}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
71
- }
72
- else {
73
- throw new Error("No value provided for input HTTP label: Name.");
74
- }
56
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "Name", () => input.Name, "{Name}", false);
75
57
  let body;
76
58
  return new protocol_http_1.HttpRequest({
77
59
  protocol,
@@ -90,16 +72,7 @@ const serializeAws_restJson1GetAppMonitorDataCommand = async (input, context) =>
90
72
  "content-type": "application/json",
91
73
  };
92
74
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/appmonitor/{Name}/data";
93
- if (input.Name !== undefined) {
94
- const labelValue = input.Name;
95
- if (labelValue.length <= 0) {
96
- throw new Error("Empty value provided for input HTTP label: Name.");
97
- }
98
- resolvedPath = resolvedPath.replace("{Name}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
99
- }
100
- else {
101
- throw new Error("No value provided for input HTTP label: Name.");
102
- }
75
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "Name", () => input.Name, "{Name}", false);
103
76
  let body;
104
77
  body = JSON.stringify({
105
78
  ...(input.Filters != null && { Filters: serializeAws_restJson1QueryFilters(input.Filters, context) }),
@@ -122,10 +95,10 @@ const serializeAws_restJson1ListAppMonitorsCommand = async (input, context) => {
122
95
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
123
96
  const headers = {};
124
97
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/appmonitors";
125
- const query = {
126
- ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }),
127
- ...(input.NextToken !== undefined && { nextToken: input.NextToken }),
128
- };
98
+ const query = map({
99
+ maxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
100
+ nextToken: [, input.NextToken],
101
+ });
129
102
  let body;
130
103
  return new protocol_http_1.HttpRequest({
131
104
  protocol,
@@ -143,16 +116,7 @@ const serializeAws_restJson1ListTagsForResourceCommand = async (input, context)
143
116
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
144
117
  const headers = {};
145
118
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}";
146
- if (input.ResourceArn !== undefined) {
147
- const labelValue = input.ResourceArn;
148
- if (labelValue.length <= 0) {
149
- throw new Error("Empty value provided for input HTTP label: ResourceArn.");
150
- }
151
- resolvedPath = resolvedPath.replace("{ResourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
152
- }
153
- else {
154
- throw new Error("No value provided for input HTTP label: ResourceArn.");
155
- }
119
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ResourceArn", () => input.ResourceArn, "{ResourceArn}", false);
156
120
  let body;
157
121
  return new protocol_http_1.HttpRequest({
158
122
  protocol,
@@ -171,16 +135,7 @@ const serializeAws_restJson1PutRumEventsCommand = async (input, context) => {
171
135
  "content-type": "application/json",
172
136
  };
173
137
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/appmonitors/{Id}";
174
- if (input.Id !== undefined) {
175
- const labelValue = input.Id;
176
- if (labelValue.length <= 0) {
177
- throw new Error("Empty value provided for input HTTP label: Id.");
178
- }
179
- resolvedPath = resolvedPath.replace("{Id}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
180
- }
181
- else {
182
- throw new Error("No value provided for input HTTP label: Id.");
183
- }
138
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "Id", () => input.Id, "{Id}", false);
184
139
  let body;
185
140
  body = JSON.stringify({
186
141
  ...(input.AppMonitorDetails != null && {
@@ -214,16 +169,7 @@ const serializeAws_restJson1TagResourceCommand = async (input, context) => {
214
169
  "content-type": "application/json",
215
170
  };
216
171
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}";
217
- if (input.ResourceArn !== undefined) {
218
- const labelValue = input.ResourceArn;
219
- if (labelValue.length <= 0) {
220
- throw new Error("Empty value provided for input HTTP label: ResourceArn.");
221
- }
222
- resolvedPath = resolvedPath.replace("{ResourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
223
- }
224
- else {
225
- throw new Error("No value provided for input HTTP label: ResourceArn.");
226
- }
172
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ResourceArn", () => input.ResourceArn, "{ResourceArn}", false);
227
173
  let body;
228
174
  body = JSON.stringify({
229
175
  ...(input.Tags != null && { Tags: serializeAws_restJson1TagMap(input.Tags, context) }),
@@ -243,19 +189,10 @@ const serializeAws_restJson1UntagResourceCommand = async (input, context) => {
243
189
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
244
190
  const headers = {};
245
191
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}";
246
- if (input.ResourceArn !== undefined) {
247
- const labelValue = input.ResourceArn;
248
- if (labelValue.length <= 0) {
249
- throw new Error("Empty value provided for input HTTP label: ResourceArn.");
250
- }
251
- resolvedPath = resolvedPath.replace("{ResourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
252
- }
253
- else {
254
- throw new Error("No value provided for input HTTP label: ResourceArn.");
255
- }
256
- const query = {
257
- ...(input.TagKeys !== undefined && { tagKeys: (input.TagKeys || []).map((_entry) => _entry) }),
258
- };
192
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ResourceArn", () => input.ResourceArn, "{ResourceArn}", false);
193
+ const query = map({
194
+ tagKeys: [() => input.TagKeys !== void 0, () => (input.TagKeys || []).map((_entry) => _entry)],
195
+ });
259
196
  let body;
260
197
  return new protocol_http_1.HttpRequest({
261
198
  protocol,
@@ -275,16 +212,7 @@ const serializeAws_restJson1UpdateAppMonitorCommand = async (input, context) =>
275
212
  "content-type": "application/json",
276
213
  };
277
214
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/appmonitor/{Name}";
278
- if (input.Name !== undefined) {
279
- const labelValue = input.Name;
280
- if (labelValue.length <= 0) {
281
- throw new Error("Empty value provided for input HTTP label: Name.");
282
- }
283
- resolvedPath = resolvedPath.replace("{Name}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
284
- }
285
- else {
286
- throw new Error("No value provided for input HTTP label: Name.");
287
- }
215
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "Name", () => input.Name, "{Name}", false);
288
216
  let body;
289
217
  body = JSON.stringify({
290
218
  ...(input.AppMonitorConfiguration != null && {
@@ -308,15 +236,14 @@ const deserializeAws_restJson1CreateAppMonitorCommand = async (output, context)
308
236
  if (output.statusCode !== 200 && output.statusCode >= 300) {
309
237
  return deserializeAws_restJson1CreateAppMonitorCommandError(output, context);
310
238
  }
311
- const contents = {
239
+ const contents = map({
312
240
  $metadata: deserializeMetadata(output),
313
- Id: undefined,
314
- };
241
+ });
315
242
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
316
- if (data.Id !== undefined && data.Id !== null) {
243
+ if (data.Id != null) {
317
244
  contents.Id = (0, smithy_client_1.expectString)(data.Id);
318
245
  }
319
- return Promise.resolve(contents);
246
+ return contents;
320
247
  };
321
248
  exports.deserializeAws_restJson1CreateAppMonitorCommand = deserializeAws_restJson1CreateAppMonitorCommand;
322
249
  const deserializeAws_restJson1CreateAppMonitorCommandError = async (output, context) => {
@@ -324,7 +251,6 @@ const deserializeAws_restJson1CreateAppMonitorCommandError = async (output, cont
324
251
  ...output,
325
252
  body: await parseBody(output.body, context),
326
253
  };
327
- let response;
328
254
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
329
255
  switch (errorCode) {
330
256
  case "AccessDeniedException":
@@ -347,25 +273,23 @@ const deserializeAws_restJson1CreateAppMonitorCommandError = async (output, cont
347
273
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
348
274
  default:
349
275
  const parsedBody = parsedOutput.body;
350
- const $metadata = deserializeMetadata(output);
351
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
352
- response = new RUMServiceException_1.RUMServiceException({
353
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
354
- $fault: "client",
355
- $metadata,
276
+ (0, smithy_client_1.throwDefaultError)({
277
+ output,
278
+ parsedBody,
279
+ exceptionCtor: RUMServiceException_1.RUMServiceException,
280
+ errorCode,
356
281
  });
357
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
358
282
  }
359
283
  };
360
284
  const deserializeAws_restJson1DeleteAppMonitorCommand = async (output, context) => {
361
285
  if (output.statusCode !== 200 && output.statusCode >= 300) {
362
286
  return deserializeAws_restJson1DeleteAppMonitorCommandError(output, context);
363
287
  }
364
- const contents = {
288
+ const contents = map({
365
289
  $metadata: deserializeMetadata(output),
366
- };
290
+ });
367
291
  await collectBody(output.body, context);
368
- return Promise.resolve(contents);
292
+ return contents;
369
293
  };
370
294
  exports.deserializeAws_restJson1DeleteAppMonitorCommand = deserializeAws_restJson1DeleteAppMonitorCommand;
371
295
  const deserializeAws_restJson1DeleteAppMonitorCommandError = async (output, context) => {
@@ -373,7 +297,6 @@ const deserializeAws_restJson1DeleteAppMonitorCommandError = async (output, cont
373
297
  ...output,
374
298
  body: await parseBody(output.body, context),
375
299
  };
376
- let response;
377
300
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
378
301
  switch (errorCode) {
379
302
  case "AccessDeniedException":
@@ -396,29 +319,26 @@ const deserializeAws_restJson1DeleteAppMonitorCommandError = async (output, cont
396
319
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
397
320
  default:
398
321
  const parsedBody = parsedOutput.body;
399
- const $metadata = deserializeMetadata(output);
400
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
401
- response = new RUMServiceException_1.RUMServiceException({
402
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
403
- $fault: "client",
404
- $metadata,
322
+ (0, smithy_client_1.throwDefaultError)({
323
+ output,
324
+ parsedBody,
325
+ exceptionCtor: RUMServiceException_1.RUMServiceException,
326
+ errorCode,
405
327
  });
406
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
407
328
  }
408
329
  };
409
330
  const deserializeAws_restJson1GetAppMonitorCommand = async (output, context) => {
410
331
  if (output.statusCode !== 200 && output.statusCode >= 300) {
411
332
  return deserializeAws_restJson1GetAppMonitorCommandError(output, context);
412
333
  }
413
- const contents = {
334
+ const contents = map({
414
335
  $metadata: deserializeMetadata(output),
415
- AppMonitor: undefined,
416
- };
336
+ });
417
337
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
418
- if (data.AppMonitor !== undefined && data.AppMonitor !== null) {
338
+ if (data.AppMonitor != null) {
419
339
  contents.AppMonitor = deserializeAws_restJson1AppMonitor(data.AppMonitor, context);
420
340
  }
421
- return Promise.resolve(contents);
341
+ return contents;
422
342
  };
423
343
  exports.deserializeAws_restJson1GetAppMonitorCommand = deserializeAws_restJson1GetAppMonitorCommand;
424
344
  const deserializeAws_restJson1GetAppMonitorCommandError = async (output, context) => {
@@ -426,7 +346,6 @@ const deserializeAws_restJson1GetAppMonitorCommandError = async (output, context
426
346
  ...output,
427
347
  body: await parseBody(output.body, context),
428
348
  };
429
- let response;
430
349
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
431
350
  switch (errorCode) {
432
351
  case "AccessDeniedException":
@@ -446,33 +365,29 @@ const deserializeAws_restJson1GetAppMonitorCommandError = async (output, context
446
365
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
447
366
  default:
448
367
  const parsedBody = parsedOutput.body;
449
- const $metadata = deserializeMetadata(output);
450
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
451
- response = new RUMServiceException_1.RUMServiceException({
452
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
453
- $fault: "client",
454
- $metadata,
368
+ (0, smithy_client_1.throwDefaultError)({
369
+ output,
370
+ parsedBody,
371
+ exceptionCtor: RUMServiceException_1.RUMServiceException,
372
+ errorCode,
455
373
  });
456
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
457
374
  }
458
375
  };
459
376
  const deserializeAws_restJson1GetAppMonitorDataCommand = async (output, context) => {
460
377
  if (output.statusCode !== 200 && output.statusCode >= 300) {
461
378
  return deserializeAws_restJson1GetAppMonitorDataCommandError(output, context);
462
379
  }
463
- const contents = {
380
+ const contents = map({
464
381
  $metadata: deserializeMetadata(output),
465
- Events: undefined,
466
- NextToken: undefined,
467
- };
382
+ });
468
383
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
469
- if (data.Events !== undefined && data.Events !== null) {
384
+ if (data.Events != null) {
470
385
  contents.Events = deserializeAws_restJson1EventDataList(data.Events, context);
471
386
  }
472
- if (data.NextToken !== undefined && data.NextToken !== null) {
387
+ if (data.NextToken != null) {
473
388
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
474
389
  }
475
- return Promise.resolve(contents);
390
+ return contents;
476
391
  };
477
392
  exports.deserializeAws_restJson1GetAppMonitorDataCommand = deserializeAws_restJson1GetAppMonitorDataCommand;
478
393
  const deserializeAws_restJson1GetAppMonitorDataCommandError = async (output, context) => {
@@ -480,7 +395,6 @@ const deserializeAws_restJson1GetAppMonitorDataCommandError = async (output, con
480
395
  ...output,
481
396
  body: await parseBody(output.body, context),
482
397
  };
483
- let response;
484
398
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
485
399
  switch (errorCode) {
486
400
  case "AccessDeniedException":
@@ -500,33 +414,29 @@ const deserializeAws_restJson1GetAppMonitorDataCommandError = async (output, con
500
414
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
501
415
  default:
502
416
  const parsedBody = parsedOutput.body;
503
- const $metadata = deserializeMetadata(output);
504
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
505
- response = new RUMServiceException_1.RUMServiceException({
506
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
507
- $fault: "client",
508
- $metadata,
417
+ (0, smithy_client_1.throwDefaultError)({
418
+ output,
419
+ parsedBody,
420
+ exceptionCtor: RUMServiceException_1.RUMServiceException,
421
+ errorCode,
509
422
  });
510
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
511
423
  }
512
424
  };
513
425
  const deserializeAws_restJson1ListAppMonitorsCommand = async (output, context) => {
514
426
  if (output.statusCode !== 200 && output.statusCode >= 300) {
515
427
  return deserializeAws_restJson1ListAppMonitorsCommandError(output, context);
516
428
  }
517
- const contents = {
429
+ const contents = map({
518
430
  $metadata: deserializeMetadata(output),
519
- AppMonitorSummaries: undefined,
520
- NextToken: undefined,
521
- };
431
+ });
522
432
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
523
- if (data.AppMonitorSummaries !== undefined && data.AppMonitorSummaries !== null) {
433
+ if (data.AppMonitorSummaries != null) {
524
434
  contents.AppMonitorSummaries = deserializeAws_restJson1AppMonitorSummaryList(data.AppMonitorSummaries, context);
525
435
  }
526
- if (data.NextToken !== undefined && data.NextToken !== null) {
436
+ if (data.NextToken != null) {
527
437
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
528
438
  }
529
- return Promise.resolve(contents);
439
+ return contents;
530
440
  };
531
441
  exports.deserializeAws_restJson1ListAppMonitorsCommand = deserializeAws_restJson1ListAppMonitorsCommand;
532
442
  const deserializeAws_restJson1ListAppMonitorsCommandError = async (output, context) => {
@@ -534,7 +444,6 @@ const deserializeAws_restJson1ListAppMonitorsCommandError = async (output, conte
534
444
  ...output,
535
445
  body: await parseBody(output.body, context),
536
446
  };
537
- let response;
538
447
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
539
448
  switch (errorCode) {
540
449
  case "AccessDeniedException":
@@ -551,33 +460,29 @@ const deserializeAws_restJson1ListAppMonitorsCommandError = async (output, conte
551
460
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
552
461
  default:
553
462
  const parsedBody = parsedOutput.body;
554
- const $metadata = deserializeMetadata(output);
555
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
556
- response = new RUMServiceException_1.RUMServiceException({
557
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
558
- $fault: "client",
559
- $metadata,
463
+ (0, smithy_client_1.throwDefaultError)({
464
+ output,
465
+ parsedBody,
466
+ exceptionCtor: RUMServiceException_1.RUMServiceException,
467
+ errorCode,
560
468
  });
561
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
562
469
  }
563
470
  };
564
471
  const deserializeAws_restJson1ListTagsForResourceCommand = async (output, context) => {
565
472
  if (output.statusCode !== 200 && output.statusCode >= 300) {
566
473
  return deserializeAws_restJson1ListTagsForResourceCommandError(output, context);
567
474
  }
568
- const contents = {
475
+ const contents = map({
569
476
  $metadata: deserializeMetadata(output),
570
- ResourceArn: undefined,
571
- Tags: undefined,
572
- };
477
+ });
573
478
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
574
- if (data.ResourceArn !== undefined && data.ResourceArn !== null) {
479
+ if (data.ResourceArn != null) {
575
480
  contents.ResourceArn = (0, smithy_client_1.expectString)(data.ResourceArn);
576
481
  }
577
- if (data.Tags !== undefined && data.Tags !== null) {
482
+ if (data.Tags != null) {
578
483
  contents.Tags = deserializeAws_restJson1TagMap(data.Tags, context);
579
484
  }
580
- return Promise.resolve(contents);
485
+ return contents;
581
486
  };
582
487
  exports.deserializeAws_restJson1ListTagsForResourceCommand = deserializeAws_restJson1ListTagsForResourceCommand;
583
488
  const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, context) => {
@@ -585,7 +490,6 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
585
490
  ...output,
586
491
  body: await parseBody(output.body, context),
587
492
  };
588
- let response;
589
493
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
590
494
  switch (errorCode) {
591
495
  case "InternalServerException":
@@ -599,25 +503,23 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
599
503
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
600
504
  default:
601
505
  const parsedBody = parsedOutput.body;
602
- const $metadata = deserializeMetadata(output);
603
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
604
- response = new RUMServiceException_1.RUMServiceException({
605
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
606
- $fault: "client",
607
- $metadata,
506
+ (0, smithy_client_1.throwDefaultError)({
507
+ output,
508
+ parsedBody,
509
+ exceptionCtor: RUMServiceException_1.RUMServiceException,
510
+ errorCode,
608
511
  });
609
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
610
512
  }
611
513
  };
612
514
  const deserializeAws_restJson1PutRumEventsCommand = async (output, context) => {
613
515
  if (output.statusCode !== 200 && output.statusCode >= 300) {
614
516
  return deserializeAws_restJson1PutRumEventsCommandError(output, context);
615
517
  }
616
- const contents = {
518
+ const contents = map({
617
519
  $metadata: deserializeMetadata(output),
618
- };
520
+ });
619
521
  await collectBody(output.body, context);
620
- return Promise.resolve(contents);
522
+ return contents;
621
523
  };
622
524
  exports.deserializeAws_restJson1PutRumEventsCommand = deserializeAws_restJson1PutRumEventsCommand;
623
525
  const deserializeAws_restJson1PutRumEventsCommandError = async (output, context) => {
@@ -625,7 +527,6 @@ const deserializeAws_restJson1PutRumEventsCommandError = async (output, context)
625
527
  ...output,
626
528
  body: await parseBody(output.body, context),
627
529
  };
628
- let response;
629
530
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
630
531
  switch (errorCode) {
631
532
  case "AccessDeniedException":
@@ -645,25 +546,23 @@ const deserializeAws_restJson1PutRumEventsCommandError = async (output, context)
645
546
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
646
547
  default:
647
548
  const parsedBody = parsedOutput.body;
648
- const $metadata = deserializeMetadata(output);
649
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
650
- response = new RUMServiceException_1.RUMServiceException({
651
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
652
- $fault: "client",
653
- $metadata,
549
+ (0, smithy_client_1.throwDefaultError)({
550
+ output,
551
+ parsedBody,
552
+ exceptionCtor: RUMServiceException_1.RUMServiceException,
553
+ errorCode,
654
554
  });
655
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
656
555
  }
657
556
  };
658
557
  const deserializeAws_restJson1TagResourceCommand = async (output, context) => {
659
558
  if (output.statusCode !== 200 && output.statusCode >= 300) {
660
559
  return deserializeAws_restJson1TagResourceCommandError(output, context);
661
560
  }
662
- const contents = {
561
+ const contents = map({
663
562
  $metadata: deserializeMetadata(output),
664
- };
563
+ });
665
564
  await collectBody(output.body, context);
666
- return Promise.resolve(contents);
565
+ return contents;
667
566
  };
668
567
  exports.deserializeAws_restJson1TagResourceCommand = deserializeAws_restJson1TagResourceCommand;
669
568
  const deserializeAws_restJson1TagResourceCommandError = async (output, context) => {
@@ -671,7 +570,6 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
671
570
  ...output,
672
571
  body: await parseBody(output.body, context),
673
572
  };
674
- let response;
675
573
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
676
574
  switch (errorCode) {
677
575
  case "InternalServerException":
@@ -685,25 +583,23 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
685
583
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
686
584
  default:
687
585
  const parsedBody = parsedOutput.body;
688
- const $metadata = deserializeMetadata(output);
689
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
690
- response = new RUMServiceException_1.RUMServiceException({
691
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
692
- $fault: "client",
693
- $metadata,
586
+ (0, smithy_client_1.throwDefaultError)({
587
+ output,
588
+ parsedBody,
589
+ exceptionCtor: RUMServiceException_1.RUMServiceException,
590
+ errorCode,
694
591
  });
695
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
696
592
  }
697
593
  };
698
594
  const deserializeAws_restJson1UntagResourceCommand = async (output, context) => {
699
595
  if (output.statusCode !== 200 && output.statusCode >= 300) {
700
596
  return deserializeAws_restJson1UntagResourceCommandError(output, context);
701
597
  }
702
- const contents = {
598
+ const contents = map({
703
599
  $metadata: deserializeMetadata(output),
704
- };
600
+ });
705
601
  await collectBody(output.body, context);
706
- return Promise.resolve(contents);
602
+ return contents;
707
603
  };
708
604
  exports.deserializeAws_restJson1UntagResourceCommand = deserializeAws_restJson1UntagResourceCommand;
709
605
  const deserializeAws_restJson1UntagResourceCommandError = async (output, context) => {
@@ -711,7 +607,6 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
711
607
  ...output,
712
608
  body: await parseBody(output.body, context),
713
609
  };
714
- let response;
715
610
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
716
611
  switch (errorCode) {
717
612
  case "InternalServerException":
@@ -725,25 +620,23 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
725
620
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
726
621
  default:
727
622
  const parsedBody = parsedOutput.body;
728
- const $metadata = deserializeMetadata(output);
729
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
730
- response = new RUMServiceException_1.RUMServiceException({
731
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
732
- $fault: "client",
733
- $metadata,
623
+ (0, smithy_client_1.throwDefaultError)({
624
+ output,
625
+ parsedBody,
626
+ exceptionCtor: RUMServiceException_1.RUMServiceException,
627
+ errorCode,
734
628
  });
735
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
736
629
  }
737
630
  };
738
631
  const deserializeAws_restJson1UpdateAppMonitorCommand = async (output, context) => {
739
632
  if (output.statusCode !== 200 && output.statusCode >= 300) {
740
633
  return deserializeAws_restJson1UpdateAppMonitorCommandError(output, context);
741
634
  }
742
- const contents = {
635
+ const contents = map({
743
636
  $metadata: deserializeMetadata(output),
744
- };
637
+ });
745
638
  await collectBody(output.body, context);
746
- return Promise.resolve(contents);
639
+ return contents;
747
640
  };
748
641
  exports.deserializeAws_restJson1UpdateAppMonitorCommand = deserializeAws_restJson1UpdateAppMonitorCommand;
749
642
  const deserializeAws_restJson1UpdateAppMonitorCommandError = async (output, context) => {
@@ -751,7 +644,6 @@ const deserializeAws_restJson1UpdateAppMonitorCommandError = async (output, cont
751
644
  ...output,
752
645
  body: await parseBody(output.body, context),
753
646
  };
754
- let response;
755
647
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
756
648
  switch (errorCode) {
757
649
  case "AccessDeniedException":
@@ -774,20 +666,19 @@ const deserializeAws_restJson1UpdateAppMonitorCommandError = async (output, cont
774
666
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
775
667
  default:
776
668
  const parsedBody = parsedOutput.body;
777
- const $metadata = deserializeMetadata(output);
778
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
779
- response = new RUMServiceException_1.RUMServiceException({
780
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
781
- $fault: "client",
782
- $metadata,
669
+ (0, smithy_client_1.throwDefaultError)({
670
+ output,
671
+ parsedBody,
672
+ exceptionCtor: RUMServiceException_1.RUMServiceException,
673
+ errorCode,
783
674
  });
784
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
785
675
  }
786
676
  };
677
+ const map = smithy_client_1.map;
787
678
  const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutput, context) => {
788
- const contents = {};
679
+ const contents = map({});
789
680
  const data = parsedOutput.body;
790
- if (data.message !== undefined && data.message !== null) {
681
+ if (data.message != null) {
791
682
  contents.message = (0, smithy_client_1.expectString)(data.message);
792
683
  }
793
684
  const exception = new models_0_1.AccessDeniedException({
@@ -797,15 +688,15 @@ const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutpu
797
688
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
798
689
  };
799
690
  const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, context) => {
800
- const contents = {};
691
+ const contents = map({});
801
692
  const data = parsedOutput.body;
802
- if (data.message !== undefined && data.message !== null) {
693
+ if (data.message != null) {
803
694
  contents.message = (0, smithy_client_1.expectString)(data.message);
804
695
  }
805
- if (data.resourceName !== undefined && data.resourceName !== null) {
696
+ if (data.resourceName != null) {
806
697
  contents.resourceName = (0, smithy_client_1.expectString)(data.resourceName);
807
698
  }
808
- if (data.resourceType !== undefined && data.resourceType !== null) {
699
+ if (data.resourceType != null) {
809
700
  contents.resourceType = (0, smithy_client_1.expectString)(data.resourceType);
810
701
  }
811
702
  const exception = new models_0_1.ConflictException({
@@ -815,12 +706,14 @@ const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, c
815
706
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
816
707
  };
817
708
  const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOutput, context) => {
818
- const contents = {};
819
- if (parsedOutput.headers["retry-after"] !== undefined) {
820
- contents.retryAfterSeconds = (0, smithy_client_1.strictParseInt32)(parsedOutput.headers["retry-after"]);
821
- }
709
+ const contents = map({
710
+ retryAfterSeconds: [
711
+ () => void 0 !== parsedOutput.headers["retry-after"],
712
+ () => (0, smithy_client_1.strictParseInt32)(parsedOutput.headers["retry-after"]),
713
+ ],
714
+ });
822
715
  const data = parsedOutput.body;
823
- if (data.message !== undefined && data.message !== null) {
716
+ if (data.message != null) {
824
717
  contents.message = (0, smithy_client_1.expectString)(data.message);
825
718
  }
826
719
  const exception = new models_0_1.InternalServerException({
@@ -830,15 +723,15 @@ const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOut
830
723
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
831
724
  };
832
725
  const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
833
- const contents = {};
726
+ const contents = map({});
834
727
  const data = parsedOutput.body;
835
- if (data.message !== undefined && data.message !== null) {
728
+ if (data.message != null) {
836
729
  contents.message = (0, smithy_client_1.expectString)(data.message);
837
730
  }
838
- if (data.resourceName !== undefined && data.resourceName !== null) {
731
+ if (data.resourceName != null) {
839
732
  contents.resourceName = (0, smithy_client_1.expectString)(data.resourceName);
840
733
  }
841
- if (data.resourceType !== undefined && data.resourceType !== null) {
734
+ if (data.resourceType != null) {
842
735
  contents.resourceType = (0, smithy_client_1.expectString)(data.resourceType);
843
736
  }
844
737
  const exception = new models_0_1.ResourceNotFoundException({
@@ -848,9 +741,9 @@ const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedO
848
741
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
849
742
  };
850
743
  const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (parsedOutput, context) => {
851
- const contents = {};
744
+ const contents = map({});
852
745
  const data = parsedOutput.body;
853
- if (data.message !== undefined && data.message !== null) {
746
+ if (data.message != null) {
854
747
  contents.message = (0, smithy_client_1.expectString)(data.message);
855
748
  }
856
749
  const exception = new models_0_1.ServiceQuotaExceededException({
@@ -860,18 +753,20 @@ const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (par
860
753
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
861
754
  };
862
755
  const deserializeAws_restJson1ThrottlingExceptionResponse = async (parsedOutput, context) => {
863
- const contents = {};
864
- if (parsedOutput.headers["retry-after"] !== undefined) {
865
- contents.retryAfterSeconds = (0, smithy_client_1.strictParseInt32)(parsedOutput.headers["retry-after"]);
866
- }
756
+ const contents = map({
757
+ retryAfterSeconds: [
758
+ () => void 0 !== parsedOutput.headers["retry-after"],
759
+ () => (0, smithy_client_1.strictParseInt32)(parsedOutput.headers["retry-after"]),
760
+ ],
761
+ });
867
762
  const data = parsedOutput.body;
868
- if (data.message !== undefined && data.message !== null) {
763
+ if (data.message != null) {
869
764
  contents.message = (0, smithy_client_1.expectString)(data.message);
870
765
  }
871
- if (data.quotaCode !== undefined && data.quotaCode !== null) {
766
+ if (data.quotaCode != null) {
872
767
  contents.quotaCode = (0, smithy_client_1.expectString)(data.quotaCode);
873
768
  }
874
- if (data.serviceCode !== undefined && data.serviceCode !== null) {
769
+ if (data.serviceCode != null) {
875
770
  contents.serviceCode = (0, smithy_client_1.expectString)(data.serviceCode);
876
771
  }
877
772
  const exception = new models_0_1.ThrottlingException({
@@ -881,9 +776,9 @@ const deserializeAws_restJson1ThrottlingExceptionResponse = async (parsedOutput,
881
776
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
882
777
  };
883
778
  const deserializeAws_restJson1ValidationExceptionResponse = async (parsedOutput, context) => {
884
- const contents = {};
779
+ const contents = map({});
885
780
  const data = parsedOutput.body;
886
- if (data.message !== undefined && data.message !== null) {
781
+ if (data.message != null) {
887
782
  contents.message = (0, smithy_client_1.expectString)(data.message);
888
783
  }
889
784
  const exception = new models_0_1.ValidationException({
@@ -918,9 +813,6 @@ const serializeAws_restJson1FavoritePages = (input, context) => {
918
813
  return input
919
814
  .filter((e) => e != null)
920
815
  .map((entry) => {
921
- if (entry === null) {
922
- return null;
923
- }
924
816
  return entry;
925
817
  });
926
818
  };
@@ -928,9 +820,6 @@ const serializeAws_restJson1Pages = (input, context) => {
928
820
  return input
929
821
  .filter((e) => e != null)
930
822
  .map((entry) => {
931
- if (entry === null) {
932
- return null;
933
- }
934
823
  return entry;
935
824
  });
936
825
  };
@@ -944,9 +833,6 @@ const serializeAws_restJson1QueryFilters = (input, context) => {
944
833
  return input
945
834
  .filter((e) => e != null)
946
835
  .map((entry) => {
947
- if (entry === null) {
948
- return null;
949
- }
950
836
  return serializeAws_restJson1QueryFilter(entry, context);
951
837
  });
952
838
  };
@@ -954,9 +840,6 @@ const serializeAws_restJson1QueryFilterValueList = (input, context) => {
954
840
  return input
955
841
  .filter((e) => e != null)
956
842
  .map((entry) => {
957
- if (entry === null) {
958
- return null;
959
- }
960
843
  return entry;
961
844
  });
962
845
  };
@@ -973,9 +856,6 @@ const serializeAws_restJson1RumEventList = (input, context) => {
973
856
  return input
974
857
  .filter((e) => e != null)
975
858
  .map((entry) => {
976
- if (entry === null) {
977
- return null;
978
- }
979
859
  return serializeAws_restJson1RumEvent(entry, context);
980
860
  });
981
861
  };
@@ -994,9 +874,6 @@ const serializeAws_restJson1Telemetries = (input, context) => {
994
874
  return input
995
875
  .filter((e) => e != null)
996
876
  .map((entry) => {
997
- if (entry === null) {
998
- return null;
999
- }
1000
877
  return entry;
1001
878
  });
1002
879
  };