@aws-sdk/client-rolesanywhere 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.
@@ -64,16 +64,7 @@ const serializeAws_restJson1DeleteCrlCommand = async (input, context) => {
64
64
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
65
65
  const headers = {};
66
66
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/crl/{crlId}";
67
- if (input.crlId !== undefined) {
68
- const labelValue = input.crlId;
69
- if (labelValue.length <= 0) {
70
- throw new Error("Empty value provided for input HTTP label: crlId.");
71
- }
72
- resolvedPath = resolvedPath.replace("{crlId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
73
- }
74
- else {
75
- throw new Error("No value provided for input HTTP label: crlId.");
76
- }
67
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "crlId", () => input.crlId, "{crlId}", false);
77
68
  let body;
78
69
  return new protocol_http_1.HttpRequest({
79
70
  protocol,
@@ -90,16 +81,7 @@ const serializeAws_restJson1DeleteProfileCommand = async (input, context) => {
90
81
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
91
82
  const headers = {};
92
83
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/profile/{profileId}";
93
- if (input.profileId !== undefined) {
94
- const labelValue = input.profileId;
95
- if (labelValue.length <= 0) {
96
- throw new Error("Empty value provided for input HTTP label: profileId.");
97
- }
98
- resolvedPath = resolvedPath.replace("{profileId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
99
- }
100
- else {
101
- throw new Error("No value provided for input HTTP label: profileId.");
102
- }
84
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "profileId", () => input.profileId, "{profileId}", false);
103
85
  let body;
104
86
  return new protocol_http_1.HttpRequest({
105
87
  protocol,
@@ -116,16 +98,7 @@ const serializeAws_restJson1DeleteTrustAnchorCommand = async (input, context) =>
116
98
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
117
99
  const headers = {};
118
100
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/trustanchor/{trustAnchorId}";
119
- if (input.trustAnchorId !== undefined) {
120
- const labelValue = input.trustAnchorId;
121
- if (labelValue.length <= 0) {
122
- throw new Error("Empty value provided for input HTTP label: trustAnchorId.");
123
- }
124
- resolvedPath = resolvedPath.replace("{trustAnchorId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
125
- }
126
- else {
127
- throw new Error("No value provided for input HTTP label: trustAnchorId.");
128
- }
101
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "trustAnchorId", () => input.trustAnchorId, "{trustAnchorId}", false);
129
102
  let body;
130
103
  return new protocol_http_1.HttpRequest({
131
104
  protocol,
@@ -142,16 +115,7 @@ const serializeAws_restJson1DisableCrlCommand = async (input, context) => {
142
115
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
143
116
  const headers = {};
144
117
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/crl/{crlId}/disable";
145
- if (input.crlId !== undefined) {
146
- const labelValue = input.crlId;
147
- if (labelValue.length <= 0) {
148
- throw new Error("Empty value provided for input HTTP label: crlId.");
149
- }
150
- resolvedPath = resolvedPath.replace("{crlId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
151
- }
152
- else {
153
- throw new Error("No value provided for input HTTP label: crlId.");
154
- }
118
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "crlId", () => input.crlId, "{crlId}", false);
155
119
  let body;
156
120
  return new protocol_http_1.HttpRequest({
157
121
  protocol,
@@ -168,16 +132,7 @@ const serializeAws_restJson1DisableProfileCommand = async (input, context) => {
168
132
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
169
133
  const headers = {};
170
134
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/profile/{profileId}/disable";
171
- if (input.profileId !== undefined) {
172
- const labelValue = input.profileId;
173
- if (labelValue.length <= 0) {
174
- throw new Error("Empty value provided for input HTTP label: profileId.");
175
- }
176
- resolvedPath = resolvedPath.replace("{profileId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
177
- }
178
- else {
179
- throw new Error("No value provided for input HTTP label: profileId.");
180
- }
135
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "profileId", () => input.profileId, "{profileId}", false);
181
136
  let body;
182
137
  return new protocol_http_1.HttpRequest({
183
138
  protocol,
@@ -194,16 +149,7 @@ const serializeAws_restJson1DisableTrustAnchorCommand = async (input, context) =
194
149
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
195
150
  const headers = {};
196
151
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/trustanchor/{trustAnchorId}/disable";
197
- if (input.trustAnchorId !== undefined) {
198
- const labelValue = input.trustAnchorId;
199
- if (labelValue.length <= 0) {
200
- throw new Error("Empty value provided for input HTTP label: trustAnchorId.");
201
- }
202
- resolvedPath = resolvedPath.replace("{trustAnchorId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
203
- }
204
- else {
205
- throw new Error("No value provided for input HTTP label: trustAnchorId.");
206
- }
152
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "trustAnchorId", () => input.trustAnchorId, "{trustAnchorId}", false);
207
153
  let body;
208
154
  return new protocol_http_1.HttpRequest({
209
155
  protocol,
@@ -220,16 +166,7 @@ const serializeAws_restJson1EnableCrlCommand = async (input, context) => {
220
166
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
221
167
  const headers = {};
222
168
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/crl/{crlId}/enable";
223
- if (input.crlId !== undefined) {
224
- const labelValue = input.crlId;
225
- if (labelValue.length <= 0) {
226
- throw new Error("Empty value provided for input HTTP label: crlId.");
227
- }
228
- resolvedPath = resolvedPath.replace("{crlId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
229
- }
230
- else {
231
- throw new Error("No value provided for input HTTP label: crlId.");
232
- }
169
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "crlId", () => input.crlId, "{crlId}", false);
233
170
  let body;
234
171
  return new protocol_http_1.HttpRequest({
235
172
  protocol,
@@ -246,16 +183,7 @@ const serializeAws_restJson1EnableProfileCommand = async (input, context) => {
246
183
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
247
184
  const headers = {};
248
185
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/profile/{profileId}/enable";
249
- if (input.profileId !== undefined) {
250
- const labelValue = input.profileId;
251
- if (labelValue.length <= 0) {
252
- throw new Error("Empty value provided for input HTTP label: profileId.");
253
- }
254
- resolvedPath = resolvedPath.replace("{profileId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
255
- }
256
- else {
257
- throw new Error("No value provided for input HTTP label: profileId.");
258
- }
186
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "profileId", () => input.profileId, "{profileId}", false);
259
187
  let body;
260
188
  return new protocol_http_1.HttpRequest({
261
189
  protocol,
@@ -272,16 +200,7 @@ const serializeAws_restJson1EnableTrustAnchorCommand = async (input, context) =>
272
200
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
273
201
  const headers = {};
274
202
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/trustanchor/{trustAnchorId}/enable";
275
- if (input.trustAnchorId !== undefined) {
276
- const labelValue = input.trustAnchorId;
277
- if (labelValue.length <= 0) {
278
- throw new Error("Empty value provided for input HTTP label: trustAnchorId.");
279
- }
280
- resolvedPath = resolvedPath.replace("{trustAnchorId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
281
- }
282
- else {
283
- throw new Error("No value provided for input HTTP label: trustAnchorId.");
284
- }
203
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "trustAnchorId", () => input.trustAnchorId, "{trustAnchorId}", false);
285
204
  let body;
286
205
  return new protocol_http_1.HttpRequest({
287
206
  protocol,
@@ -298,16 +217,7 @@ const serializeAws_restJson1GetCrlCommand = async (input, context) => {
298
217
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
299
218
  const headers = {};
300
219
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/crl/{crlId}";
301
- if (input.crlId !== undefined) {
302
- const labelValue = input.crlId;
303
- if (labelValue.length <= 0) {
304
- throw new Error("Empty value provided for input HTTP label: crlId.");
305
- }
306
- resolvedPath = resolvedPath.replace("{crlId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
307
- }
308
- else {
309
- throw new Error("No value provided for input HTTP label: crlId.");
310
- }
220
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "crlId", () => input.crlId, "{crlId}", false);
311
221
  let body;
312
222
  return new protocol_http_1.HttpRequest({
313
223
  protocol,
@@ -324,16 +234,7 @@ const serializeAws_restJson1GetProfileCommand = async (input, context) => {
324
234
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
325
235
  const headers = {};
326
236
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/profile/{profileId}";
327
- if (input.profileId !== undefined) {
328
- const labelValue = input.profileId;
329
- if (labelValue.length <= 0) {
330
- throw new Error("Empty value provided for input HTTP label: profileId.");
331
- }
332
- resolvedPath = resolvedPath.replace("{profileId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
333
- }
334
- else {
335
- throw new Error("No value provided for input HTTP label: profileId.");
336
- }
237
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "profileId", () => input.profileId, "{profileId}", false);
337
238
  let body;
338
239
  return new protocol_http_1.HttpRequest({
339
240
  protocol,
@@ -350,16 +251,7 @@ const serializeAws_restJson1GetSubjectCommand = async (input, context) => {
350
251
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
351
252
  const headers = {};
352
253
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/subject/{subjectId}";
353
- if (input.subjectId !== undefined) {
354
- const labelValue = input.subjectId;
355
- if (labelValue.length <= 0) {
356
- throw new Error("Empty value provided for input HTTP label: subjectId.");
357
- }
358
- resolvedPath = resolvedPath.replace("{subjectId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
359
- }
360
- else {
361
- throw new Error("No value provided for input HTTP label: subjectId.");
362
- }
254
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "subjectId", () => input.subjectId, "{subjectId}", false);
363
255
  let body;
364
256
  return new protocol_http_1.HttpRequest({
365
257
  protocol,
@@ -376,16 +268,7 @@ const serializeAws_restJson1GetTrustAnchorCommand = async (input, context) => {
376
268
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
377
269
  const headers = {};
378
270
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/trustanchor/{trustAnchorId}";
379
- if (input.trustAnchorId !== undefined) {
380
- const labelValue = input.trustAnchorId;
381
- if (labelValue.length <= 0) {
382
- throw new Error("Empty value provided for input HTTP label: trustAnchorId.");
383
- }
384
- resolvedPath = resolvedPath.replace("{trustAnchorId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
385
- }
386
- else {
387
- throw new Error("No value provided for input HTTP label: trustAnchorId.");
388
- }
271
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "trustAnchorId", () => input.trustAnchorId, "{trustAnchorId}", false);
389
272
  let body;
390
273
  return new protocol_http_1.HttpRequest({
391
274
  protocol,
@@ -427,10 +310,10 @@ const serializeAws_restJson1ListCrlsCommand = async (input, context) => {
427
310
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
428
311
  const headers = {};
429
312
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/crls";
430
- const query = {
431
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
432
- ...(input.pageSize !== undefined && { pageSize: input.pageSize.toString() }),
433
- };
313
+ const query = map({
314
+ nextToken: [, input.nextToken],
315
+ pageSize: [() => input.pageSize !== void 0, () => input.pageSize.toString()],
316
+ });
434
317
  let body;
435
318
  return new protocol_http_1.HttpRequest({
436
319
  protocol,
@@ -448,10 +331,10 @@ const serializeAws_restJson1ListProfilesCommand = async (input, context) => {
448
331
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
449
332
  const headers = {};
450
333
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/profiles";
451
- const query = {
452
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
453
- ...(input.pageSize !== undefined && { pageSize: input.pageSize.toString() }),
454
- };
334
+ const query = map({
335
+ nextToken: [, input.nextToken],
336
+ pageSize: [() => input.pageSize !== void 0, () => input.pageSize.toString()],
337
+ });
455
338
  let body;
456
339
  return new protocol_http_1.HttpRequest({
457
340
  protocol,
@@ -469,10 +352,10 @@ const serializeAws_restJson1ListSubjectsCommand = async (input, context) => {
469
352
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
470
353
  const headers = {};
471
354
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/subjects";
472
- const query = {
473
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
474
- ...(input.pageSize !== undefined && { pageSize: input.pageSize.toString() }),
475
- };
355
+ const query = map({
356
+ nextToken: [, input.nextToken],
357
+ pageSize: [() => input.pageSize !== void 0, () => input.pageSize.toString()],
358
+ });
476
359
  let body;
477
360
  return new protocol_http_1.HttpRequest({
478
361
  protocol,
@@ -490,9 +373,9 @@ const serializeAws_restJson1ListTagsForResourceCommand = async (input, context)
490
373
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
491
374
  const headers = {};
492
375
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/ListTagsForResource";
493
- const query = {
494
- ...(input.resourceArn !== undefined && { resourceArn: input.resourceArn }),
495
- };
376
+ const query = map({
377
+ resourceArn: [, input.resourceArn],
378
+ });
496
379
  let body;
497
380
  return new protocol_http_1.HttpRequest({
498
381
  protocol,
@@ -510,10 +393,10 @@ const serializeAws_restJson1ListTrustAnchorsCommand = async (input, context) =>
510
393
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
511
394
  const headers = {};
512
395
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/trustanchors";
513
- const query = {
514
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
515
- ...(input.pageSize !== undefined && { pageSize: input.pageSize.toString() }),
516
- };
396
+ const query = map({
397
+ nextToken: [, input.nextToken],
398
+ pageSize: [() => input.pageSize !== void 0, () => input.pageSize.toString()],
399
+ });
517
400
  let body;
518
401
  return new protocol_http_1.HttpRequest({
519
402
  protocol,
@@ -577,16 +460,7 @@ const serializeAws_restJson1UpdateCrlCommand = async (input, context) => {
577
460
  "content-type": "application/json",
578
461
  };
579
462
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/crl/{crlId}";
580
- if (input.crlId !== undefined) {
581
- const labelValue = input.crlId;
582
- if (labelValue.length <= 0) {
583
- throw new Error("Empty value provided for input HTTP label: crlId.");
584
- }
585
- resolvedPath = resolvedPath.replace("{crlId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
586
- }
587
- else {
588
- throw new Error("No value provided for input HTTP label: crlId.");
589
- }
463
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "crlId", () => input.crlId, "{crlId}", false);
590
464
  let body;
591
465
  body = JSON.stringify({
592
466
  ...(input.crlData != null && { crlData: context.base64Encoder(input.crlData) }),
@@ -609,16 +483,7 @@ const serializeAws_restJson1UpdateProfileCommand = async (input, context) => {
609
483
  "content-type": "application/json",
610
484
  };
611
485
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/profile/{profileId}";
612
- if (input.profileId !== undefined) {
613
- const labelValue = input.profileId;
614
- if (labelValue.length <= 0) {
615
- throw new Error("Empty value provided for input HTTP label: profileId.");
616
- }
617
- resolvedPath = resolvedPath.replace("{profileId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
618
- }
619
- else {
620
- throw new Error("No value provided for input HTTP label: profileId.");
621
- }
486
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "profileId", () => input.profileId, "{profileId}", false);
622
487
  let body;
623
488
  body = JSON.stringify({
624
489
  ...(input.durationSeconds != null && { durationSeconds: input.durationSeconds }),
@@ -646,16 +511,7 @@ const serializeAws_restJson1UpdateTrustAnchorCommand = async (input, context) =>
646
511
  "content-type": "application/json",
647
512
  };
648
513
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/trustanchor/{trustAnchorId}";
649
- if (input.trustAnchorId !== undefined) {
650
- const labelValue = input.trustAnchorId;
651
- if (labelValue.length <= 0) {
652
- throw new Error("Empty value provided for input HTTP label: trustAnchorId.");
653
- }
654
- resolvedPath = resolvedPath.replace("{trustAnchorId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
655
- }
656
- else {
657
- throw new Error("No value provided for input HTTP label: trustAnchorId.");
658
- }
514
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "trustAnchorId", () => input.trustAnchorId, "{trustAnchorId}", false);
659
515
  let body;
660
516
  body = JSON.stringify({
661
517
  ...(input.name != null && { name: input.name }),
@@ -676,15 +532,14 @@ const deserializeAws_restJson1CreateProfileCommand = async (output, context) =>
676
532
  if (output.statusCode !== 201 && output.statusCode >= 300) {
677
533
  return deserializeAws_restJson1CreateProfileCommandError(output, context);
678
534
  }
679
- const contents = {
535
+ const contents = map({
680
536
  $metadata: deserializeMetadata(output),
681
- profile: undefined,
682
- };
537
+ });
683
538
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
684
- if (data.profile !== undefined && data.profile !== null) {
539
+ if (data.profile != null) {
685
540
  contents.profile = deserializeAws_restJson1ProfileDetail(data.profile, context);
686
541
  }
687
- return Promise.resolve(contents);
542
+ return contents;
688
543
  };
689
544
  exports.deserializeAws_restJson1CreateProfileCommand = deserializeAws_restJson1CreateProfileCommand;
690
545
  const deserializeAws_restJson1CreateProfileCommandError = async (output, context) => {
@@ -692,7 +547,6 @@ const deserializeAws_restJson1CreateProfileCommandError = async (output, context
692
547
  ...output,
693
548
  body: await parseBody(output.body, context),
694
549
  };
695
- let response;
696
550
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
697
551
  switch (errorCode) {
698
552
  case "AccessDeniedException":
@@ -703,29 +557,26 @@ const deserializeAws_restJson1CreateProfileCommandError = async (output, context
703
557
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
704
558
  default:
705
559
  const parsedBody = parsedOutput.body;
706
- const $metadata = deserializeMetadata(output);
707
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
708
- response = new RolesAnywhereServiceException_1.RolesAnywhereServiceException({
709
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
710
- $fault: "client",
711
- $metadata,
560
+ (0, smithy_client_1.throwDefaultError)({
561
+ output,
562
+ parsedBody,
563
+ exceptionCtor: RolesAnywhereServiceException_1.RolesAnywhereServiceException,
564
+ errorCode,
712
565
  });
713
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
714
566
  }
715
567
  };
716
568
  const deserializeAws_restJson1CreateTrustAnchorCommand = async (output, context) => {
717
569
  if (output.statusCode !== 201 && output.statusCode >= 300) {
718
570
  return deserializeAws_restJson1CreateTrustAnchorCommandError(output, context);
719
571
  }
720
- const contents = {
572
+ const contents = map({
721
573
  $metadata: deserializeMetadata(output),
722
- trustAnchor: undefined,
723
- };
574
+ });
724
575
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
725
- if (data.trustAnchor !== undefined && data.trustAnchor !== null) {
576
+ if (data.trustAnchor != null) {
726
577
  contents.trustAnchor = deserializeAws_restJson1TrustAnchorDetail(data.trustAnchor, context);
727
578
  }
728
- return Promise.resolve(contents);
579
+ return contents;
729
580
  };
730
581
  exports.deserializeAws_restJson1CreateTrustAnchorCommand = deserializeAws_restJson1CreateTrustAnchorCommand;
731
582
  const deserializeAws_restJson1CreateTrustAnchorCommandError = async (output, context) => {
@@ -733,7 +584,6 @@ const deserializeAws_restJson1CreateTrustAnchorCommandError = async (output, con
733
584
  ...output,
734
585
  body: await parseBody(output.body, context),
735
586
  };
736
- let response;
737
587
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
738
588
  switch (errorCode) {
739
589
  case "AccessDeniedException":
@@ -744,29 +594,26 @@ const deserializeAws_restJson1CreateTrustAnchorCommandError = async (output, con
744
594
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
745
595
  default:
746
596
  const parsedBody = parsedOutput.body;
747
- const $metadata = deserializeMetadata(output);
748
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
749
- response = new RolesAnywhereServiceException_1.RolesAnywhereServiceException({
750
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
751
- $fault: "client",
752
- $metadata,
597
+ (0, smithy_client_1.throwDefaultError)({
598
+ output,
599
+ parsedBody,
600
+ exceptionCtor: RolesAnywhereServiceException_1.RolesAnywhereServiceException,
601
+ errorCode,
753
602
  });
754
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
755
603
  }
756
604
  };
757
605
  const deserializeAws_restJson1DeleteCrlCommand = async (output, context) => {
758
606
  if (output.statusCode !== 200 && output.statusCode >= 300) {
759
607
  return deserializeAws_restJson1DeleteCrlCommandError(output, context);
760
608
  }
761
- const contents = {
609
+ const contents = map({
762
610
  $metadata: deserializeMetadata(output),
763
- crl: undefined,
764
- };
611
+ });
765
612
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
766
- if (data.crl !== undefined && data.crl !== null) {
613
+ if (data.crl != null) {
767
614
  contents.crl = deserializeAws_restJson1CrlDetail(data.crl, context);
768
615
  }
769
- return Promise.resolve(contents);
616
+ return contents;
770
617
  };
771
618
  exports.deserializeAws_restJson1DeleteCrlCommand = deserializeAws_restJson1DeleteCrlCommand;
772
619
  const deserializeAws_restJson1DeleteCrlCommandError = async (output, context) => {
@@ -774,7 +621,6 @@ const deserializeAws_restJson1DeleteCrlCommandError = async (output, context) =>
774
621
  ...output,
775
622
  body: await parseBody(output.body, context),
776
623
  };
777
- let response;
778
624
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
779
625
  switch (errorCode) {
780
626
  case "AccessDeniedException":
@@ -785,29 +631,26 @@ const deserializeAws_restJson1DeleteCrlCommandError = async (output, context) =>
785
631
  throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
786
632
  default:
787
633
  const parsedBody = parsedOutput.body;
788
- const $metadata = deserializeMetadata(output);
789
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
790
- response = new RolesAnywhereServiceException_1.RolesAnywhereServiceException({
791
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
792
- $fault: "client",
793
- $metadata,
634
+ (0, smithy_client_1.throwDefaultError)({
635
+ output,
636
+ parsedBody,
637
+ exceptionCtor: RolesAnywhereServiceException_1.RolesAnywhereServiceException,
638
+ errorCode,
794
639
  });
795
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
796
640
  }
797
641
  };
798
642
  const deserializeAws_restJson1DeleteProfileCommand = async (output, context) => {
799
643
  if (output.statusCode !== 200 && output.statusCode >= 300) {
800
644
  return deserializeAws_restJson1DeleteProfileCommandError(output, context);
801
645
  }
802
- const contents = {
646
+ const contents = map({
803
647
  $metadata: deserializeMetadata(output),
804
- profile: undefined,
805
- };
648
+ });
806
649
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
807
- if (data.profile !== undefined && data.profile !== null) {
650
+ if (data.profile != null) {
808
651
  contents.profile = deserializeAws_restJson1ProfileDetail(data.profile, context);
809
652
  }
810
- return Promise.resolve(contents);
653
+ return contents;
811
654
  };
812
655
  exports.deserializeAws_restJson1DeleteProfileCommand = deserializeAws_restJson1DeleteProfileCommand;
813
656
  const deserializeAws_restJson1DeleteProfileCommandError = async (output, context) => {
@@ -815,7 +658,6 @@ const deserializeAws_restJson1DeleteProfileCommandError = async (output, context
815
658
  ...output,
816
659
  body: await parseBody(output.body, context),
817
660
  };
818
- let response;
819
661
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
820
662
  switch (errorCode) {
821
663
  case "AccessDeniedException":
@@ -826,29 +668,26 @@ const deserializeAws_restJson1DeleteProfileCommandError = async (output, context
826
668
  throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
827
669
  default:
828
670
  const parsedBody = parsedOutput.body;
829
- const $metadata = deserializeMetadata(output);
830
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
831
- response = new RolesAnywhereServiceException_1.RolesAnywhereServiceException({
832
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
833
- $fault: "client",
834
- $metadata,
671
+ (0, smithy_client_1.throwDefaultError)({
672
+ output,
673
+ parsedBody,
674
+ exceptionCtor: RolesAnywhereServiceException_1.RolesAnywhereServiceException,
675
+ errorCode,
835
676
  });
836
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
837
677
  }
838
678
  };
839
679
  const deserializeAws_restJson1DeleteTrustAnchorCommand = async (output, context) => {
840
680
  if (output.statusCode !== 200 && output.statusCode >= 300) {
841
681
  return deserializeAws_restJson1DeleteTrustAnchorCommandError(output, context);
842
682
  }
843
- const contents = {
683
+ const contents = map({
844
684
  $metadata: deserializeMetadata(output),
845
- trustAnchor: undefined,
846
- };
685
+ });
847
686
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
848
- if (data.trustAnchor !== undefined && data.trustAnchor !== null) {
687
+ if (data.trustAnchor != null) {
849
688
  contents.trustAnchor = deserializeAws_restJson1TrustAnchorDetail(data.trustAnchor, context);
850
689
  }
851
- return Promise.resolve(contents);
690
+ return contents;
852
691
  };
853
692
  exports.deserializeAws_restJson1DeleteTrustAnchorCommand = deserializeAws_restJson1DeleteTrustAnchorCommand;
854
693
  const deserializeAws_restJson1DeleteTrustAnchorCommandError = async (output, context) => {
@@ -856,7 +695,6 @@ const deserializeAws_restJson1DeleteTrustAnchorCommandError = async (output, con
856
695
  ...output,
857
696
  body: await parseBody(output.body, context),
858
697
  };
859
- let response;
860
698
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
861
699
  switch (errorCode) {
862
700
  case "AccessDeniedException":
@@ -867,29 +705,26 @@ const deserializeAws_restJson1DeleteTrustAnchorCommandError = async (output, con
867
705
  throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
868
706
  default:
869
707
  const parsedBody = parsedOutput.body;
870
- const $metadata = deserializeMetadata(output);
871
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
872
- response = new RolesAnywhereServiceException_1.RolesAnywhereServiceException({
873
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
874
- $fault: "client",
875
- $metadata,
708
+ (0, smithy_client_1.throwDefaultError)({
709
+ output,
710
+ parsedBody,
711
+ exceptionCtor: RolesAnywhereServiceException_1.RolesAnywhereServiceException,
712
+ errorCode,
876
713
  });
877
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
878
714
  }
879
715
  };
880
716
  const deserializeAws_restJson1DisableCrlCommand = async (output, context) => {
881
717
  if (output.statusCode !== 200 && output.statusCode >= 300) {
882
718
  return deserializeAws_restJson1DisableCrlCommandError(output, context);
883
719
  }
884
- const contents = {
720
+ const contents = map({
885
721
  $metadata: deserializeMetadata(output),
886
- crl: undefined,
887
- };
722
+ });
888
723
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
889
- if (data.crl !== undefined && data.crl !== null) {
724
+ if (data.crl != null) {
890
725
  contents.crl = deserializeAws_restJson1CrlDetail(data.crl, context);
891
726
  }
892
- return Promise.resolve(contents);
727
+ return contents;
893
728
  };
894
729
  exports.deserializeAws_restJson1DisableCrlCommand = deserializeAws_restJson1DisableCrlCommand;
895
730
  const deserializeAws_restJson1DisableCrlCommandError = async (output, context) => {
@@ -897,7 +732,6 @@ const deserializeAws_restJson1DisableCrlCommandError = async (output, context) =
897
732
  ...output,
898
733
  body: await parseBody(output.body, context),
899
734
  };
900
- let response;
901
735
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
902
736
  switch (errorCode) {
903
737
  case "AccessDeniedException":
@@ -908,29 +742,26 @@ const deserializeAws_restJson1DisableCrlCommandError = async (output, context) =
908
742
  throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
909
743
  default:
910
744
  const parsedBody = parsedOutput.body;
911
- const $metadata = deserializeMetadata(output);
912
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
913
- response = new RolesAnywhereServiceException_1.RolesAnywhereServiceException({
914
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
915
- $fault: "client",
916
- $metadata,
745
+ (0, smithy_client_1.throwDefaultError)({
746
+ output,
747
+ parsedBody,
748
+ exceptionCtor: RolesAnywhereServiceException_1.RolesAnywhereServiceException,
749
+ errorCode,
917
750
  });
918
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
919
751
  }
920
752
  };
921
753
  const deserializeAws_restJson1DisableProfileCommand = async (output, context) => {
922
754
  if (output.statusCode !== 200 && output.statusCode >= 300) {
923
755
  return deserializeAws_restJson1DisableProfileCommandError(output, context);
924
756
  }
925
- const contents = {
757
+ const contents = map({
926
758
  $metadata: deserializeMetadata(output),
927
- profile: undefined,
928
- };
759
+ });
929
760
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
930
- if (data.profile !== undefined && data.profile !== null) {
761
+ if (data.profile != null) {
931
762
  contents.profile = deserializeAws_restJson1ProfileDetail(data.profile, context);
932
763
  }
933
- return Promise.resolve(contents);
764
+ return contents;
934
765
  };
935
766
  exports.deserializeAws_restJson1DisableProfileCommand = deserializeAws_restJson1DisableProfileCommand;
936
767
  const deserializeAws_restJson1DisableProfileCommandError = async (output, context) => {
@@ -938,7 +769,6 @@ const deserializeAws_restJson1DisableProfileCommandError = async (output, contex
938
769
  ...output,
939
770
  body: await parseBody(output.body, context),
940
771
  };
941
- let response;
942
772
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
943
773
  switch (errorCode) {
944
774
  case "AccessDeniedException":
@@ -949,29 +779,26 @@ const deserializeAws_restJson1DisableProfileCommandError = async (output, contex
949
779
  throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
950
780
  default:
951
781
  const parsedBody = parsedOutput.body;
952
- const $metadata = deserializeMetadata(output);
953
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
954
- response = new RolesAnywhereServiceException_1.RolesAnywhereServiceException({
955
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
956
- $fault: "client",
957
- $metadata,
782
+ (0, smithy_client_1.throwDefaultError)({
783
+ output,
784
+ parsedBody,
785
+ exceptionCtor: RolesAnywhereServiceException_1.RolesAnywhereServiceException,
786
+ errorCode,
958
787
  });
959
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
960
788
  }
961
789
  };
962
790
  const deserializeAws_restJson1DisableTrustAnchorCommand = async (output, context) => {
963
791
  if (output.statusCode !== 200 && output.statusCode >= 300) {
964
792
  return deserializeAws_restJson1DisableTrustAnchorCommandError(output, context);
965
793
  }
966
- const contents = {
794
+ const contents = map({
967
795
  $metadata: deserializeMetadata(output),
968
- trustAnchor: undefined,
969
- };
796
+ });
970
797
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
971
- if (data.trustAnchor !== undefined && data.trustAnchor !== null) {
798
+ if (data.trustAnchor != null) {
972
799
  contents.trustAnchor = deserializeAws_restJson1TrustAnchorDetail(data.trustAnchor, context);
973
800
  }
974
- return Promise.resolve(contents);
801
+ return contents;
975
802
  };
976
803
  exports.deserializeAws_restJson1DisableTrustAnchorCommand = deserializeAws_restJson1DisableTrustAnchorCommand;
977
804
  const deserializeAws_restJson1DisableTrustAnchorCommandError = async (output, context) => {
@@ -979,7 +806,6 @@ const deserializeAws_restJson1DisableTrustAnchorCommandError = async (output, co
979
806
  ...output,
980
807
  body: await parseBody(output.body, context),
981
808
  };
982
- let response;
983
809
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
984
810
  switch (errorCode) {
985
811
  case "AccessDeniedException":
@@ -990,29 +816,26 @@ const deserializeAws_restJson1DisableTrustAnchorCommandError = async (output, co
990
816
  throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
991
817
  default:
992
818
  const parsedBody = parsedOutput.body;
993
- const $metadata = deserializeMetadata(output);
994
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
995
- response = new RolesAnywhereServiceException_1.RolesAnywhereServiceException({
996
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
997
- $fault: "client",
998
- $metadata,
819
+ (0, smithy_client_1.throwDefaultError)({
820
+ output,
821
+ parsedBody,
822
+ exceptionCtor: RolesAnywhereServiceException_1.RolesAnywhereServiceException,
823
+ errorCode,
999
824
  });
1000
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1001
825
  }
1002
826
  };
1003
827
  const deserializeAws_restJson1EnableCrlCommand = async (output, context) => {
1004
828
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1005
829
  return deserializeAws_restJson1EnableCrlCommandError(output, context);
1006
830
  }
1007
- const contents = {
831
+ const contents = map({
1008
832
  $metadata: deserializeMetadata(output),
1009
- crl: undefined,
1010
- };
833
+ });
1011
834
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1012
- if (data.crl !== undefined && data.crl !== null) {
835
+ if (data.crl != null) {
1013
836
  contents.crl = deserializeAws_restJson1CrlDetail(data.crl, context);
1014
837
  }
1015
- return Promise.resolve(contents);
838
+ return contents;
1016
839
  };
1017
840
  exports.deserializeAws_restJson1EnableCrlCommand = deserializeAws_restJson1EnableCrlCommand;
1018
841
  const deserializeAws_restJson1EnableCrlCommandError = async (output, context) => {
@@ -1020,7 +843,6 @@ const deserializeAws_restJson1EnableCrlCommandError = async (output, context) =>
1020
843
  ...output,
1021
844
  body: await parseBody(output.body, context),
1022
845
  };
1023
- let response;
1024
846
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1025
847
  switch (errorCode) {
1026
848
  case "AccessDeniedException":
@@ -1031,29 +853,26 @@ const deserializeAws_restJson1EnableCrlCommandError = async (output, context) =>
1031
853
  throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1032
854
  default:
1033
855
  const parsedBody = parsedOutput.body;
1034
- const $metadata = deserializeMetadata(output);
1035
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1036
- response = new RolesAnywhereServiceException_1.RolesAnywhereServiceException({
1037
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1038
- $fault: "client",
1039
- $metadata,
856
+ (0, smithy_client_1.throwDefaultError)({
857
+ output,
858
+ parsedBody,
859
+ exceptionCtor: RolesAnywhereServiceException_1.RolesAnywhereServiceException,
860
+ errorCode,
1040
861
  });
1041
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1042
862
  }
1043
863
  };
1044
864
  const deserializeAws_restJson1EnableProfileCommand = async (output, context) => {
1045
865
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1046
866
  return deserializeAws_restJson1EnableProfileCommandError(output, context);
1047
867
  }
1048
- const contents = {
868
+ const contents = map({
1049
869
  $metadata: deserializeMetadata(output),
1050
- profile: undefined,
1051
- };
870
+ });
1052
871
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1053
- if (data.profile !== undefined && data.profile !== null) {
872
+ if (data.profile != null) {
1054
873
  contents.profile = deserializeAws_restJson1ProfileDetail(data.profile, context);
1055
874
  }
1056
- return Promise.resolve(contents);
875
+ return contents;
1057
876
  };
1058
877
  exports.deserializeAws_restJson1EnableProfileCommand = deserializeAws_restJson1EnableProfileCommand;
1059
878
  const deserializeAws_restJson1EnableProfileCommandError = async (output, context) => {
@@ -1061,7 +880,6 @@ const deserializeAws_restJson1EnableProfileCommandError = async (output, context
1061
880
  ...output,
1062
881
  body: await parseBody(output.body, context),
1063
882
  };
1064
- let response;
1065
883
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1066
884
  switch (errorCode) {
1067
885
  case "AccessDeniedException":
@@ -1072,29 +890,26 @@ const deserializeAws_restJson1EnableProfileCommandError = async (output, context
1072
890
  throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1073
891
  default:
1074
892
  const parsedBody = parsedOutput.body;
1075
- const $metadata = deserializeMetadata(output);
1076
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1077
- response = new RolesAnywhereServiceException_1.RolesAnywhereServiceException({
1078
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1079
- $fault: "client",
1080
- $metadata,
893
+ (0, smithy_client_1.throwDefaultError)({
894
+ output,
895
+ parsedBody,
896
+ exceptionCtor: RolesAnywhereServiceException_1.RolesAnywhereServiceException,
897
+ errorCode,
1081
898
  });
1082
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1083
899
  }
1084
900
  };
1085
901
  const deserializeAws_restJson1EnableTrustAnchorCommand = async (output, context) => {
1086
902
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1087
903
  return deserializeAws_restJson1EnableTrustAnchorCommandError(output, context);
1088
904
  }
1089
- const contents = {
905
+ const contents = map({
1090
906
  $metadata: deserializeMetadata(output),
1091
- trustAnchor: undefined,
1092
- };
907
+ });
1093
908
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1094
- if (data.trustAnchor !== undefined && data.trustAnchor !== null) {
909
+ if (data.trustAnchor != null) {
1095
910
  contents.trustAnchor = deserializeAws_restJson1TrustAnchorDetail(data.trustAnchor, context);
1096
911
  }
1097
- return Promise.resolve(contents);
912
+ return contents;
1098
913
  };
1099
914
  exports.deserializeAws_restJson1EnableTrustAnchorCommand = deserializeAws_restJson1EnableTrustAnchorCommand;
1100
915
  const deserializeAws_restJson1EnableTrustAnchorCommandError = async (output, context) => {
@@ -1102,7 +917,6 @@ const deserializeAws_restJson1EnableTrustAnchorCommandError = async (output, con
1102
917
  ...output,
1103
918
  body: await parseBody(output.body, context),
1104
919
  };
1105
- let response;
1106
920
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1107
921
  switch (errorCode) {
1108
922
  case "AccessDeniedException":
@@ -1113,29 +927,26 @@ const deserializeAws_restJson1EnableTrustAnchorCommandError = async (output, con
1113
927
  throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1114
928
  default:
1115
929
  const parsedBody = parsedOutput.body;
1116
- const $metadata = deserializeMetadata(output);
1117
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1118
- response = new RolesAnywhereServiceException_1.RolesAnywhereServiceException({
1119
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1120
- $fault: "client",
1121
- $metadata,
930
+ (0, smithy_client_1.throwDefaultError)({
931
+ output,
932
+ parsedBody,
933
+ exceptionCtor: RolesAnywhereServiceException_1.RolesAnywhereServiceException,
934
+ errorCode,
1122
935
  });
1123
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1124
936
  }
1125
937
  };
1126
938
  const deserializeAws_restJson1GetCrlCommand = async (output, context) => {
1127
939
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1128
940
  return deserializeAws_restJson1GetCrlCommandError(output, context);
1129
941
  }
1130
- const contents = {
942
+ const contents = map({
1131
943
  $metadata: deserializeMetadata(output),
1132
- crl: undefined,
1133
- };
944
+ });
1134
945
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1135
- if (data.crl !== undefined && data.crl !== null) {
946
+ if (data.crl != null) {
1136
947
  contents.crl = deserializeAws_restJson1CrlDetail(data.crl, context);
1137
948
  }
1138
- return Promise.resolve(contents);
949
+ return contents;
1139
950
  };
1140
951
  exports.deserializeAws_restJson1GetCrlCommand = deserializeAws_restJson1GetCrlCommand;
1141
952
  const deserializeAws_restJson1GetCrlCommandError = async (output, context) => {
@@ -1143,7 +954,6 @@ const deserializeAws_restJson1GetCrlCommandError = async (output, context) => {
1143
954
  ...output,
1144
955
  body: await parseBody(output.body, context),
1145
956
  };
1146
- let response;
1147
957
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1148
958
  switch (errorCode) {
1149
959
  case "ResourceNotFoundException":
@@ -1151,29 +961,26 @@ const deserializeAws_restJson1GetCrlCommandError = async (output, context) => {
1151
961
  throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1152
962
  default:
1153
963
  const parsedBody = parsedOutput.body;
1154
- const $metadata = deserializeMetadata(output);
1155
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1156
- response = new RolesAnywhereServiceException_1.RolesAnywhereServiceException({
1157
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1158
- $fault: "client",
1159
- $metadata,
964
+ (0, smithy_client_1.throwDefaultError)({
965
+ output,
966
+ parsedBody,
967
+ exceptionCtor: RolesAnywhereServiceException_1.RolesAnywhereServiceException,
968
+ errorCode,
1160
969
  });
1161
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1162
970
  }
1163
971
  };
1164
972
  const deserializeAws_restJson1GetProfileCommand = async (output, context) => {
1165
973
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1166
974
  return deserializeAws_restJson1GetProfileCommandError(output, context);
1167
975
  }
1168
- const contents = {
976
+ const contents = map({
1169
977
  $metadata: deserializeMetadata(output),
1170
- profile: undefined,
1171
- };
978
+ });
1172
979
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1173
- if (data.profile !== undefined && data.profile !== null) {
980
+ if (data.profile != null) {
1174
981
  contents.profile = deserializeAws_restJson1ProfileDetail(data.profile, context);
1175
982
  }
1176
- return Promise.resolve(contents);
983
+ return contents;
1177
984
  };
1178
985
  exports.deserializeAws_restJson1GetProfileCommand = deserializeAws_restJson1GetProfileCommand;
1179
986
  const deserializeAws_restJson1GetProfileCommandError = async (output, context) => {
@@ -1181,7 +988,6 @@ const deserializeAws_restJson1GetProfileCommandError = async (output, context) =
1181
988
  ...output,
1182
989
  body: await parseBody(output.body, context),
1183
990
  };
1184
- let response;
1185
991
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1186
992
  switch (errorCode) {
1187
993
  case "AccessDeniedException":
@@ -1192,29 +998,26 @@ const deserializeAws_restJson1GetProfileCommandError = async (output, context) =
1192
998
  throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1193
999
  default:
1194
1000
  const parsedBody = parsedOutput.body;
1195
- const $metadata = deserializeMetadata(output);
1196
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1197
- response = new RolesAnywhereServiceException_1.RolesAnywhereServiceException({
1198
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1199
- $fault: "client",
1200
- $metadata,
1001
+ (0, smithy_client_1.throwDefaultError)({
1002
+ output,
1003
+ parsedBody,
1004
+ exceptionCtor: RolesAnywhereServiceException_1.RolesAnywhereServiceException,
1005
+ errorCode,
1201
1006
  });
1202
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1203
1007
  }
1204
1008
  };
1205
1009
  const deserializeAws_restJson1GetSubjectCommand = async (output, context) => {
1206
1010
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1207
1011
  return deserializeAws_restJson1GetSubjectCommandError(output, context);
1208
1012
  }
1209
- const contents = {
1013
+ const contents = map({
1210
1014
  $metadata: deserializeMetadata(output),
1211
- subject: undefined,
1212
- };
1015
+ });
1213
1016
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1214
- if (data.subject !== undefined && data.subject !== null) {
1017
+ if (data.subject != null) {
1215
1018
  contents.subject = deserializeAws_restJson1SubjectDetail(data.subject, context);
1216
1019
  }
1217
- return Promise.resolve(contents);
1020
+ return contents;
1218
1021
  };
1219
1022
  exports.deserializeAws_restJson1GetSubjectCommand = deserializeAws_restJson1GetSubjectCommand;
1220
1023
  const deserializeAws_restJson1GetSubjectCommandError = async (output, context) => {
@@ -1222,7 +1025,6 @@ const deserializeAws_restJson1GetSubjectCommandError = async (output, context) =
1222
1025
  ...output,
1223
1026
  body: await parseBody(output.body, context),
1224
1027
  };
1225
- let response;
1226
1028
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1227
1029
  switch (errorCode) {
1228
1030
  case "AccessDeniedException":
@@ -1233,29 +1035,26 @@ const deserializeAws_restJson1GetSubjectCommandError = async (output, context) =
1233
1035
  throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1234
1036
  default:
1235
1037
  const parsedBody = parsedOutput.body;
1236
- const $metadata = deserializeMetadata(output);
1237
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1238
- response = new RolesAnywhereServiceException_1.RolesAnywhereServiceException({
1239
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1240
- $fault: "client",
1241
- $metadata,
1038
+ (0, smithy_client_1.throwDefaultError)({
1039
+ output,
1040
+ parsedBody,
1041
+ exceptionCtor: RolesAnywhereServiceException_1.RolesAnywhereServiceException,
1042
+ errorCode,
1242
1043
  });
1243
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1244
1044
  }
1245
1045
  };
1246
1046
  const deserializeAws_restJson1GetTrustAnchorCommand = async (output, context) => {
1247
1047
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1248
1048
  return deserializeAws_restJson1GetTrustAnchorCommandError(output, context);
1249
1049
  }
1250
- const contents = {
1050
+ const contents = map({
1251
1051
  $metadata: deserializeMetadata(output),
1252
- trustAnchor: undefined,
1253
- };
1052
+ });
1254
1053
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1255
- if (data.trustAnchor !== undefined && data.trustAnchor !== null) {
1054
+ if (data.trustAnchor != null) {
1256
1055
  contents.trustAnchor = deserializeAws_restJson1TrustAnchorDetail(data.trustAnchor, context);
1257
1056
  }
1258
- return Promise.resolve(contents);
1057
+ return contents;
1259
1058
  };
1260
1059
  exports.deserializeAws_restJson1GetTrustAnchorCommand = deserializeAws_restJson1GetTrustAnchorCommand;
1261
1060
  const deserializeAws_restJson1GetTrustAnchorCommandError = async (output, context) => {
@@ -1263,7 +1062,6 @@ const deserializeAws_restJson1GetTrustAnchorCommandError = async (output, contex
1263
1062
  ...output,
1264
1063
  body: await parseBody(output.body, context),
1265
1064
  };
1266
- let response;
1267
1065
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1268
1066
  switch (errorCode) {
1269
1067
  case "AccessDeniedException":
@@ -1277,29 +1075,26 @@ const deserializeAws_restJson1GetTrustAnchorCommandError = async (output, contex
1277
1075
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1278
1076
  default:
1279
1077
  const parsedBody = parsedOutput.body;
1280
- const $metadata = deserializeMetadata(output);
1281
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1282
- response = new RolesAnywhereServiceException_1.RolesAnywhereServiceException({
1283
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1284
- $fault: "client",
1285
- $metadata,
1078
+ (0, smithy_client_1.throwDefaultError)({
1079
+ output,
1080
+ parsedBody,
1081
+ exceptionCtor: RolesAnywhereServiceException_1.RolesAnywhereServiceException,
1082
+ errorCode,
1286
1083
  });
1287
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1288
1084
  }
1289
1085
  };
1290
1086
  const deserializeAws_restJson1ImportCrlCommand = async (output, context) => {
1291
1087
  if (output.statusCode !== 201 && output.statusCode >= 300) {
1292
1088
  return deserializeAws_restJson1ImportCrlCommandError(output, context);
1293
1089
  }
1294
- const contents = {
1090
+ const contents = map({
1295
1091
  $metadata: deserializeMetadata(output),
1296
- crl: undefined,
1297
- };
1092
+ });
1298
1093
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1299
- if (data.crl !== undefined && data.crl !== null) {
1094
+ if (data.crl != null) {
1300
1095
  contents.crl = deserializeAws_restJson1CrlDetail(data.crl, context);
1301
1096
  }
1302
- return Promise.resolve(contents);
1097
+ return contents;
1303
1098
  };
1304
1099
  exports.deserializeAws_restJson1ImportCrlCommand = deserializeAws_restJson1ImportCrlCommand;
1305
1100
  const deserializeAws_restJson1ImportCrlCommandError = async (output, context) => {
@@ -1307,7 +1102,6 @@ const deserializeAws_restJson1ImportCrlCommandError = async (output, context) =>
1307
1102
  ...output,
1308
1103
  body: await parseBody(output.body, context),
1309
1104
  };
1310
- let response;
1311
1105
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1312
1106
  switch (errorCode) {
1313
1107
  case "AccessDeniedException":
@@ -1318,33 +1112,29 @@ const deserializeAws_restJson1ImportCrlCommandError = async (output, context) =>
1318
1112
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1319
1113
  default:
1320
1114
  const parsedBody = parsedOutput.body;
1321
- const $metadata = deserializeMetadata(output);
1322
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1323
- response = new RolesAnywhereServiceException_1.RolesAnywhereServiceException({
1324
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1325
- $fault: "client",
1326
- $metadata,
1115
+ (0, smithy_client_1.throwDefaultError)({
1116
+ output,
1117
+ parsedBody,
1118
+ exceptionCtor: RolesAnywhereServiceException_1.RolesAnywhereServiceException,
1119
+ errorCode,
1327
1120
  });
1328
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1329
1121
  }
1330
1122
  };
1331
1123
  const deserializeAws_restJson1ListCrlsCommand = async (output, context) => {
1332
1124
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1333
1125
  return deserializeAws_restJson1ListCrlsCommandError(output, context);
1334
1126
  }
1335
- const contents = {
1127
+ const contents = map({
1336
1128
  $metadata: deserializeMetadata(output),
1337
- crls: undefined,
1338
- nextToken: undefined,
1339
- };
1129
+ });
1340
1130
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1341
- if (data.crls !== undefined && data.crls !== null) {
1131
+ if (data.crls != null) {
1342
1132
  contents.crls = deserializeAws_restJson1CrlDetails(data.crls, context);
1343
1133
  }
1344
- if (data.nextToken !== undefined && data.nextToken !== null) {
1134
+ if (data.nextToken != null) {
1345
1135
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1346
1136
  }
1347
- return Promise.resolve(contents);
1137
+ return contents;
1348
1138
  };
1349
1139
  exports.deserializeAws_restJson1ListCrlsCommand = deserializeAws_restJson1ListCrlsCommand;
1350
1140
  const deserializeAws_restJson1ListCrlsCommandError = async (output, context) => {
@@ -1352,7 +1142,6 @@ const deserializeAws_restJson1ListCrlsCommandError = async (output, context) =>
1352
1142
  ...output,
1353
1143
  body: await parseBody(output.body, context),
1354
1144
  };
1355
- let response;
1356
1145
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1357
1146
  switch (errorCode) {
1358
1147
  case "AccessDeniedException":
@@ -1363,33 +1152,29 @@ const deserializeAws_restJson1ListCrlsCommandError = async (output, context) =>
1363
1152
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1364
1153
  default:
1365
1154
  const parsedBody = parsedOutput.body;
1366
- const $metadata = deserializeMetadata(output);
1367
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1368
- response = new RolesAnywhereServiceException_1.RolesAnywhereServiceException({
1369
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1370
- $fault: "client",
1371
- $metadata,
1155
+ (0, smithy_client_1.throwDefaultError)({
1156
+ output,
1157
+ parsedBody,
1158
+ exceptionCtor: RolesAnywhereServiceException_1.RolesAnywhereServiceException,
1159
+ errorCode,
1372
1160
  });
1373
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1374
1161
  }
1375
1162
  };
1376
1163
  const deserializeAws_restJson1ListProfilesCommand = async (output, context) => {
1377
1164
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1378
1165
  return deserializeAws_restJson1ListProfilesCommandError(output, context);
1379
1166
  }
1380
- const contents = {
1167
+ const contents = map({
1381
1168
  $metadata: deserializeMetadata(output),
1382
- nextToken: undefined,
1383
- profiles: undefined,
1384
- };
1169
+ });
1385
1170
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1386
- if (data.nextToken !== undefined && data.nextToken !== null) {
1171
+ if (data.nextToken != null) {
1387
1172
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1388
1173
  }
1389
- if (data.profiles !== undefined && data.profiles !== null) {
1174
+ if (data.profiles != null) {
1390
1175
  contents.profiles = deserializeAws_restJson1ProfileDetails(data.profiles, context);
1391
1176
  }
1392
- return Promise.resolve(contents);
1177
+ return contents;
1393
1178
  };
1394
1179
  exports.deserializeAws_restJson1ListProfilesCommand = deserializeAws_restJson1ListProfilesCommand;
1395
1180
  const deserializeAws_restJson1ListProfilesCommandError = async (output, context) => {
@@ -1397,7 +1182,6 @@ const deserializeAws_restJson1ListProfilesCommandError = async (output, context)
1397
1182
  ...output,
1398
1183
  body: await parseBody(output.body, context),
1399
1184
  };
1400
- let response;
1401
1185
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1402
1186
  switch (errorCode) {
1403
1187
  case "AccessDeniedException":
@@ -1408,33 +1192,29 @@ const deserializeAws_restJson1ListProfilesCommandError = async (output, context)
1408
1192
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1409
1193
  default:
1410
1194
  const parsedBody = parsedOutput.body;
1411
- const $metadata = deserializeMetadata(output);
1412
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1413
- response = new RolesAnywhereServiceException_1.RolesAnywhereServiceException({
1414
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1415
- $fault: "client",
1416
- $metadata,
1195
+ (0, smithy_client_1.throwDefaultError)({
1196
+ output,
1197
+ parsedBody,
1198
+ exceptionCtor: RolesAnywhereServiceException_1.RolesAnywhereServiceException,
1199
+ errorCode,
1417
1200
  });
1418
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1419
1201
  }
1420
1202
  };
1421
1203
  const deserializeAws_restJson1ListSubjectsCommand = async (output, context) => {
1422
1204
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1423
1205
  return deserializeAws_restJson1ListSubjectsCommandError(output, context);
1424
1206
  }
1425
- const contents = {
1207
+ const contents = map({
1426
1208
  $metadata: deserializeMetadata(output),
1427
- nextToken: undefined,
1428
- subjects: undefined,
1429
- };
1209
+ });
1430
1210
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1431
- if (data.nextToken !== undefined && data.nextToken !== null) {
1211
+ if (data.nextToken != null) {
1432
1212
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1433
1213
  }
1434
- if (data.subjects !== undefined && data.subjects !== null) {
1214
+ if (data.subjects != null) {
1435
1215
  contents.subjects = deserializeAws_restJson1SubjectSummaries(data.subjects, context);
1436
1216
  }
1437
- return Promise.resolve(contents);
1217
+ return contents;
1438
1218
  };
1439
1219
  exports.deserializeAws_restJson1ListSubjectsCommand = deserializeAws_restJson1ListSubjectsCommand;
1440
1220
  const deserializeAws_restJson1ListSubjectsCommandError = async (output, context) => {
@@ -1442,7 +1222,6 @@ const deserializeAws_restJson1ListSubjectsCommandError = async (output, context)
1442
1222
  ...output,
1443
1223
  body: await parseBody(output.body, context),
1444
1224
  };
1445
- let response;
1446
1225
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1447
1226
  switch (errorCode) {
1448
1227
  case "AccessDeniedException":
@@ -1453,29 +1232,26 @@ const deserializeAws_restJson1ListSubjectsCommandError = async (output, context)
1453
1232
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1454
1233
  default:
1455
1234
  const parsedBody = parsedOutput.body;
1456
- const $metadata = deserializeMetadata(output);
1457
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1458
- response = new RolesAnywhereServiceException_1.RolesAnywhereServiceException({
1459
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1460
- $fault: "client",
1461
- $metadata,
1235
+ (0, smithy_client_1.throwDefaultError)({
1236
+ output,
1237
+ parsedBody,
1238
+ exceptionCtor: RolesAnywhereServiceException_1.RolesAnywhereServiceException,
1239
+ errorCode,
1462
1240
  });
1463
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1464
1241
  }
1465
1242
  };
1466
1243
  const deserializeAws_restJson1ListTagsForResourceCommand = async (output, context) => {
1467
1244
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1468
1245
  return deserializeAws_restJson1ListTagsForResourceCommandError(output, context);
1469
1246
  }
1470
- const contents = {
1247
+ const contents = map({
1471
1248
  $metadata: deserializeMetadata(output),
1472
- tags: undefined,
1473
- };
1249
+ });
1474
1250
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1475
- if (data.tags !== undefined && data.tags !== null) {
1251
+ if (data.tags != null) {
1476
1252
  contents.tags = deserializeAws_restJson1TagList(data.tags, context);
1477
1253
  }
1478
- return Promise.resolve(contents);
1254
+ return contents;
1479
1255
  };
1480
1256
  exports.deserializeAws_restJson1ListTagsForResourceCommand = deserializeAws_restJson1ListTagsForResourceCommand;
1481
1257
  const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, context) => {
@@ -1483,7 +1259,6 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
1483
1259
  ...output,
1484
1260
  body: await parseBody(output.body, context),
1485
1261
  };
1486
- let response;
1487
1262
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1488
1263
  switch (errorCode) {
1489
1264
  case "AccessDeniedException":
@@ -1497,33 +1272,29 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
1497
1272
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1498
1273
  default:
1499
1274
  const parsedBody = parsedOutput.body;
1500
- const $metadata = deserializeMetadata(output);
1501
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1502
- response = new RolesAnywhereServiceException_1.RolesAnywhereServiceException({
1503
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1504
- $fault: "client",
1505
- $metadata,
1275
+ (0, smithy_client_1.throwDefaultError)({
1276
+ output,
1277
+ parsedBody,
1278
+ exceptionCtor: RolesAnywhereServiceException_1.RolesAnywhereServiceException,
1279
+ errorCode,
1506
1280
  });
1507
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1508
1281
  }
1509
1282
  };
1510
1283
  const deserializeAws_restJson1ListTrustAnchorsCommand = async (output, context) => {
1511
1284
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1512
1285
  return deserializeAws_restJson1ListTrustAnchorsCommandError(output, context);
1513
1286
  }
1514
- const contents = {
1287
+ const contents = map({
1515
1288
  $metadata: deserializeMetadata(output),
1516
- nextToken: undefined,
1517
- trustAnchors: undefined,
1518
- };
1289
+ });
1519
1290
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1520
- if (data.nextToken !== undefined && data.nextToken !== null) {
1291
+ if (data.nextToken != null) {
1521
1292
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1522
1293
  }
1523
- if (data.trustAnchors !== undefined && data.trustAnchors !== null) {
1294
+ if (data.trustAnchors != null) {
1524
1295
  contents.trustAnchors = deserializeAws_restJson1TrustAnchorDetails(data.trustAnchors, context);
1525
1296
  }
1526
- return Promise.resolve(contents);
1297
+ return contents;
1527
1298
  };
1528
1299
  exports.deserializeAws_restJson1ListTrustAnchorsCommand = deserializeAws_restJson1ListTrustAnchorsCommand;
1529
1300
  const deserializeAws_restJson1ListTrustAnchorsCommandError = async (output, context) => {
@@ -1531,7 +1302,6 @@ const deserializeAws_restJson1ListTrustAnchorsCommandError = async (output, cont
1531
1302
  ...output,
1532
1303
  body: await parseBody(output.body, context),
1533
1304
  };
1534
- let response;
1535
1305
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1536
1306
  switch (errorCode) {
1537
1307
  case "AccessDeniedException":
@@ -1542,25 +1312,23 @@ const deserializeAws_restJson1ListTrustAnchorsCommandError = async (output, cont
1542
1312
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1543
1313
  default:
1544
1314
  const parsedBody = parsedOutput.body;
1545
- const $metadata = deserializeMetadata(output);
1546
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1547
- response = new RolesAnywhereServiceException_1.RolesAnywhereServiceException({
1548
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1549
- $fault: "client",
1550
- $metadata,
1315
+ (0, smithy_client_1.throwDefaultError)({
1316
+ output,
1317
+ parsedBody,
1318
+ exceptionCtor: RolesAnywhereServiceException_1.RolesAnywhereServiceException,
1319
+ errorCode,
1551
1320
  });
1552
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1553
1321
  }
1554
1322
  };
1555
1323
  const deserializeAws_restJson1TagResourceCommand = async (output, context) => {
1556
1324
  if (output.statusCode !== 201 && output.statusCode >= 300) {
1557
1325
  return deserializeAws_restJson1TagResourceCommandError(output, context);
1558
1326
  }
1559
- const contents = {
1327
+ const contents = map({
1560
1328
  $metadata: deserializeMetadata(output),
1561
- };
1329
+ });
1562
1330
  await collectBody(output.body, context);
1563
- return Promise.resolve(contents);
1331
+ return contents;
1564
1332
  };
1565
1333
  exports.deserializeAws_restJson1TagResourceCommand = deserializeAws_restJson1TagResourceCommand;
1566
1334
  const deserializeAws_restJson1TagResourceCommandError = async (output, context) => {
@@ -1568,7 +1336,6 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
1568
1336
  ...output,
1569
1337
  body: await parseBody(output.body, context),
1570
1338
  };
1571
- let response;
1572
1339
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1573
1340
  switch (errorCode) {
1574
1341
  case "AccessDeniedException":
@@ -1585,25 +1352,23 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
1585
1352
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1586
1353
  default:
1587
1354
  const parsedBody = parsedOutput.body;
1588
- const $metadata = deserializeMetadata(output);
1589
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1590
- response = new RolesAnywhereServiceException_1.RolesAnywhereServiceException({
1591
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1592
- $fault: "client",
1593
- $metadata,
1355
+ (0, smithy_client_1.throwDefaultError)({
1356
+ output,
1357
+ parsedBody,
1358
+ exceptionCtor: RolesAnywhereServiceException_1.RolesAnywhereServiceException,
1359
+ errorCode,
1594
1360
  });
1595
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1596
1361
  }
1597
1362
  };
1598
1363
  const deserializeAws_restJson1UntagResourceCommand = async (output, context) => {
1599
1364
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1600
1365
  return deserializeAws_restJson1UntagResourceCommandError(output, context);
1601
1366
  }
1602
- const contents = {
1367
+ const contents = map({
1603
1368
  $metadata: deserializeMetadata(output),
1604
- };
1369
+ });
1605
1370
  await collectBody(output.body, context);
1606
- return Promise.resolve(contents);
1371
+ return contents;
1607
1372
  };
1608
1373
  exports.deserializeAws_restJson1UntagResourceCommand = deserializeAws_restJson1UntagResourceCommand;
1609
1374
  const deserializeAws_restJson1UntagResourceCommandError = async (output, context) => {
@@ -1611,7 +1376,6 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
1611
1376
  ...output,
1612
1377
  body: await parseBody(output.body, context),
1613
1378
  };
1614
- let response;
1615
1379
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1616
1380
  switch (errorCode) {
1617
1381
  case "AccessDeniedException":
@@ -1625,29 +1389,26 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
1625
1389
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1626
1390
  default:
1627
1391
  const parsedBody = parsedOutput.body;
1628
- const $metadata = deserializeMetadata(output);
1629
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1630
- response = new RolesAnywhereServiceException_1.RolesAnywhereServiceException({
1631
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1632
- $fault: "client",
1633
- $metadata,
1392
+ (0, smithy_client_1.throwDefaultError)({
1393
+ output,
1394
+ parsedBody,
1395
+ exceptionCtor: RolesAnywhereServiceException_1.RolesAnywhereServiceException,
1396
+ errorCode,
1634
1397
  });
1635
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1636
1398
  }
1637
1399
  };
1638
1400
  const deserializeAws_restJson1UpdateCrlCommand = async (output, context) => {
1639
1401
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1640
1402
  return deserializeAws_restJson1UpdateCrlCommandError(output, context);
1641
1403
  }
1642
- const contents = {
1404
+ const contents = map({
1643
1405
  $metadata: deserializeMetadata(output),
1644
- crl: undefined,
1645
- };
1406
+ });
1646
1407
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1647
- if (data.crl !== undefined && data.crl !== null) {
1408
+ if (data.crl != null) {
1648
1409
  contents.crl = deserializeAws_restJson1CrlDetail(data.crl, context);
1649
1410
  }
1650
- return Promise.resolve(contents);
1411
+ return contents;
1651
1412
  };
1652
1413
  exports.deserializeAws_restJson1UpdateCrlCommand = deserializeAws_restJson1UpdateCrlCommand;
1653
1414
  const deserializeAws_restJson1UpdateCrlCommandError = async (output, context) => {
@@ -1655,7 +1416,6 @@ const deserializeAws_restJson1UpdateCrlCommandError = async (output, context) =>
1655
1416
  ...output,
1656
1417
  body: await parseBody(output.body, context),
1657
1418
  };
1658
- let response;
1659
1419
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1660
1420
  switch (errorCode) {
1661
1421
  case "AccessDeniedException":
@@ -1669,29 +1429,26 @@ const deserializeAws_restJson1UpdateCrlCommandError = async (output, context) =>
1669
1429
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1670
1430
  default:
1671
1431
  const parsedBody = parsedOutput.body;
1672
- const $metadata = deserializeMetadata(output);
1673
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1674
- response = new RolesAnywhereServiceException_1.RolesAnywhereServiceException({
1675
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1676
- $fault: "client",
1677
- $metadata,
1432
+ (0, smithy_client_1.throwDefaultError)({
1433
+ output,
1434
+ parsedBody,
1435
+ exceptionCtor: RolesAnywhereServiceException_1.RolesAnywhereServiceException,
1436
+ errorCode,
1678
1437
  });
1679
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1680
1438
  }
1681
1439
  };
1682
1440
  const deserializeAws_restJson1UpdateProfileCommand = async (output, context) => {
1683
1441
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1684
1442
  return deserializeAws_restJson1UpdateProfileCommandError(output, context);
1685
1443
  }
1686
- const contents = {
1444
+ const contents = map({
1687
1445
  $metadata: deserializeMetadata(output),
1688
- profile: undefined,
1689
- };
1446
+ });
1690
1447
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1691
- if (data.profile !== undefined && data.profile !== null) {
1448
+ if (data.profile != null) {
1692
1449
  contents.profile = deserializeAws_restJson1ProfileDetail(data.profile, context);
1693
1450
  }
1694
- return Promise.resolve(contents);
1451
+ return contents;
1695
1452
  };
1696
1453
  exports.deserializeAws_restJson1UpdateProfileCommand = deserializeAws_restJson1UpdateProfileCommand;
1697
1454
  const deserializeAws_restJson1UpdateProfileCommandError = async (output, context) => {
@@ -1699,7 +1456,6 @@ const deserializeAws_restJson1UpdateProfileCommandError = async (output, context
1699
1456
  ...output,
1700
1457
  body: await parseBody(output.body, context),
1701
1458
  };
1702
- let response;
1703
1459
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1704
1460
  switch (errorCode) {
1705
1461
  case "AccessDeniedException":
@@ -1713,29 +1469,26 @@ const deserializeAws_restJson1UpdateProfileCommandError = async (output, context
1713
1469
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1714
1470
  default:
1715
1471
  const parsedBody = parsedOutput.body;
1716
- const $metadata = deserializeMetadata(output);
1717
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1718
- response = new RolesAnywhereServiceException_1.RolesAnywhereServiceException({
1719
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1720
- $fault: "client",
1721
- $metadata,
1472
+ (0, smithy_client_1.throwDefaultError)({
1473
+ output,
1474
+ parsedBody,
1475
+ exceptionCtor: RolesAnywhereServiceException_1.RolesAnywhereServiceException,
1476
+ errorCode,
1722
1477
  });
1723
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1724
1478
  }
1725
1479
  };
1726
1480
  const deserializeAws_restJson1UpdateTrustAnchorCommand = async (output, context) => {
1727
1481
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1728
1482
  return deserializeAws_restJson1UpdateTrustAnchorCommandError(output, context);
1729
1483
  }
1730
- const contents = {
1484
+ const contents = map({
1731
1485
  $metadata: deserializeMetadata(output),
1732
- trustAnchor: undefined,
1733
- };
1486
+ });
1734
1487
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1735
- if (data.trustAnchor !== undefined && data.trustAnchor !== null) {
1488
+ if (data.trustAnchor != null) {
1736
1489
  contents.trustAnchor = deserializeAws_restJson1TrustAnchorDetail(data.trustAnchor, context);
1737
1490
  }
1738
- return Promise.resolve(contents);
1491
+ return contents;
1739
1492
  };
1740
1493
  exports.deserializeAws_restJson1UpdateTrustAnchorCommand = deserializeAws_restJson1UpdateTrustAnchorCommand;
1741
1494
  const deserializeAws_restJson1UpdateTrustAnchorCommandError = async (output, context) => {
@@ -1743,7 +1496,6 @@ const deserializeAws_restJson1UpdateTrustAnchorCommandError = async (output, con
1743
1496
  ...output,
1744
1497
  body: await parseBody(output.body, context),
1745
1498
  };
1746
- let response;
1747
1499
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1748
1500
  switch (errorCode) {
1749
1501
  case "AccessDeniedException":
@@ -1757,20 +1509,19 @@ const deserializeAws_restJson1UpdateTrustAnchorCommandError = async (output, con
1757
1509
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1758
1510
  default:
1759
1511
  const parsedBody = parsedOutput.body;
1760
- const $metadata = deserializeMetadata(output);
1761
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1762
- response = new RolesAnywhereServiceException_1.RolesAnywhereServiceException({
1763
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1764
- $fault: "client",
1765
- $metadata,
1512
+ (0, smithy_client_1.throwDefaultError)({
1513
+ output,
1514
+ parsedBody,
1515
+ exceptionCtor: RolesAnywhereServiceException_1.RolesAnywhereServiceException,
1516
+ errorCode,
1766
1517
  });
1767
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1768
1518
  }
1769
1519
  };
1520
+ const map = smithy_client_1.map;
1770
1521
  const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutput, context) => {
1771
- const contents = {};
1522
+ const contents = map({});
1772
1523
  const data = parsedOutput.body;
1773
- if (data.message !== undefined && data.message !== null) {
1524
+ if (data.message != null) {
1774
1525
  contents.message = (0, smithy_client_1.expectString)(data.message);
1775
1526
  }
1776
1527
  const exception = new models_0_1.AccessDeniedException({
@@ -1780,9 +1531,9 @@ const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutpu
1780
1531
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1781
1532
  };
1782
1533
  const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
1783
- const contents = {};
1534
+ const contents = map({});
1784
1535
  const data = parsedOutput.body;
1785
- if (data.message !== undefined && data.message !== null) {
1536
+ if (data.message != null) {
1786
1537
  contents.message = (0, smithy_client_1.expectString)(data.message);
1787
1538
  }
1788
1539
  const exception = new models_0_1.ResourceNotFoundException({
@@ -1792,9 +1543,9 @@ const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedO
1792
1543
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1793
1544
  };
1794
1545
  const deserializeAws_restJson1TooManyTagsExceptionResponse = async (parsedOutput, context) => {
1795
- const contents = {};
1546
+ const contents = map({});
1796
1547
  const data = parsedOutput.body;
1797
- if (data.message !== undefined && data.message !== null) {
1548
+ if (data.message != null) {
1798
1549
  contents.message = (0, smithy_client_1.expectString)(data.message);
1799
1550
  }
1800
1551
  const exception = new models_0_1.TooManyTagsException({
@@ -1804,9 +1555,9 @@ const deserializeAws_restJson1TooManyTagsExceptionResponse = async (parsedOutput
1804
1555
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1805
1556
  };
1806
1557
  const deserializeAws_restJson1ValidationExceptionResponse = async (parsedOutput, context) => {
1807
- const contents = {};
1558
+ const contents = map({});
1808
1559
  const data = parsedOutput.body;
1809
- if (data.message !== undefined && data.message !== null) {
1560
+ if (data.message != null) {
1810
1561
  contents.message = (0, smithy_client_1.expectString)(data.message);
1811
1562
  }
1812
1563
  const exception = new models_0_1.ValidationException({
@@ -1819,9 +1570,6 @@ const serializeAws_restJson1ManagedPolicyList = (input, context) => {
1819
1570
  return input
1820
1571
  .filter((e) => e != null)
1821
1572
  .map((entry) => {
1822
- if (entry === null) {
1823
- return null;
1824
- }
1825
1573
  return entry;
1826
1574
  });
1827
1575
  };
@@ -1829,9 +1577,6 @@ const serializeAws_restJson1RoleArnList = (input, context) => {
1829
1577
  return input
1830
1578
  .filter((e) => e != null)
1831
1579
  .map((entry) => {
1832
- if (entry === null) {
1833
- return null;
1834
- }
1835
1580
  return entry;
1836
1581
  });
1837
1582
  };
@@ -1858,9 +1603,6 @@ const serializeAws_restJson1TagKeyList = (input, context) => {
1858
1603
  return input
1859
1604
  .filter((e) => e != null)
1860
1605
  .map((entry) => {
1861
- if (entry === null) {
1862
- return null;
1863
- }
1864
1606
  return entry;
1865
1607
  });
1866
1608
  };
@@ -1868,9 +1610,6 @@ const serializeAws_restJson1TagList = (input, context) => {
1868
1610
  return input
1869
1611
  .filter((e) => e != null)
1870
1612
  .map((entry) => {
1871
- if (entry === null) {
1872
- return null;
1873
- }
1874
1613
  return serializeAws_restJson1Tag(entry, context);
1875
1614
  });
1876
1615
  };