@aws-sdk/client-trustedadvisor 3.490.0 → 3.496.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.
Files changed (30) hide show
  1. package/dist-cjs/TrustedAdvisor.js +1 -31
  2. package/dist-cjs/TrustedAdvisorClient.js +1 -43
  3. package/dist-cjs/commands/GetOrganizationRecommendationCommand.js +1 -29
  4. package/dist-cjs/commands/GetRecommendationCommand.js +1 -29
  5. package/dist-cjs/commands/ListChecksCommand.js +1 -28
  6. package/dist-cjs/commands/ListOrganizationRecommendationAccountsCommand.js +1 -29
  7. package/dist-cjs/commands/ListOrganizationRecommendationResourcesCommand.js +1 -28
  8. package/dist-cjs/commands/ListOrganizationRecommendationsCommand.js +1 -28
  9. package/dist-cjs/commands/ListRecommendationResourcesCommand.js +1 -28
  10. package/dist-cjs/commands/ListRecommendationsCommand.js +1 -28
  11. package/dist-cjs/commands/UpdateOrganizationRecommendationLifecycleCommand.js +1 -29
  12. package/dist-cjs/commands/UpdateRecommendationLifecycleCommand.js +1 -29
  13. package/dist-cjs/commands/index.js +1 -13
  14. package/dist-cjs/endpoint/EndpointParameters.js +1 -18
  15. package/dist-cjs/extensionConfiguration.js +1 -2
  16. package/dist-cjs/index.js +1594 -11
  17. package/dist-cjs/models/TrustedAdvisorServiceException.js +1 -12
  18. package/dist-cjs/models/index.js +1 -4
  19. package/dist-cjs/models/models_0.js +1 -202
  20. package/dist-cjs/pagination/Interfaces.js +1 -2
  21. package/dist-cjs/pagination/ListChecksPaginator.js +1 -7
  22. package/dist-cjs/pagination/ListOrganizationRecommendationAccountsPaginator.js +1 -7
  23. package/dist-cjs/pagination/ListOrganizationRecommendationResourcesPaginator.js +1 -7
  24. package/dist-cjs/pagination/ListOrganizationRecommendationsPaginator.js +1 -7
  25. package/dist-cjs/pagination/ListRecommendationResourcesPaginator.js +1 -7
  26. package/dist-cjs/pagination/ListRecommendationsPaginator.js +1 -7
  27. package/dist-cjs/pagination/index.js +1 -10
  28. package/dist-cjs/protocols/Aws_restJson1.js +1 -953
  29. package/dist-cjs/runtimeExtensions.js +1 -22
  30. package/package.json +40 -40
@@ -1,953 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.de_UpdateRecommendationLifecycleCommand = exports.de_UpdateOrganizationRecommendationLifecycleCommand = exports.de_ListRecommendationsCommand = exports.de_ListRecommendationResourcesCommand = exports.de_ListOrganizationRecommendationsCommand = exports.de_ListOrganizationRecommendationResourcesCommand = exports.de_ListOrganizationRecommendationAccountsCommand = exports.de_ListChecksCommand = exports.de_GetRecommendationCommand = exports.de_GetOrganizationRecommendationCommand = exports.se_UpdateRecommendationLifecycleCommand = exports.se_UpdateOrganizationRecommendationLifecycleCommand = exports.se_ListRecommendationsCommand = exports.se_ListRecommendationResourcesCommand = exports.se_ListOrganizationRecommendationsCommand = exports.se_ListOrganizationRecommendationResourcesCommand = exports.se_ListOrganizationRecommendationAccountsCommand = exports.se_ListChecksCommand = exports.se_GetRecommendationCommand = exports.se_GetOrganizationRecommendationCommand = void 0;
4
- const core_1 = require("@smithy/core");
5
- const smithy_client_1 = require("@smithy/smithy-client");
6
- const models_0_1 = require("../models/models_0");
7
- const TrustedAdvisorServiceException_1 = require("../models/TrustedAdvisorServiceException");
8
- const se_GetOrganizationRecommendationCommand = async (input, context) => {
9
- const b = (0, core_1.requestBuilder)(input, context);
10
- const headers = {};
11
- b.bp("/v1/organization-recommendations/{organizationRecommendationIdentifier}");
12
- b.p("organizationRecommendationIdentifier", () => input.organizationRecommendationIdentifier, "{organizationRecommendationIdentifier}", false);
13
- let body;
14
- b.m("GET").h(headers).b(body);
15
- return b.build();
16
- };
17
- exports.se_GetOrganizationRecommendationCommand = se_GetOrganizationRecommendationCommand;
18
- const se_GetRecommendationCommand = async (input, context) => {
19
- const b = (0, core_1.requestBuilder)(input, context);
20
- const headers = {};
21
- b.bp("/v1/recommendations/{recommendationIdentifier}");
22
- b.p("recommendationIdentifier", () => input.recommendationIdentifier, "{recommendationIdentifier}", false);
23
- let body;
24
- b.m("GET").h(headers).b(body);
25
- return b.build();
26
- };
27
- exports.se_GetRecommendationCommand = se_GetRecommendationCommand;
28
- const se_ListChecksCommand = async (input, context) => {
29
- const b = (0, core_1.requestBuilder)(input, context);
30
- const headers = {};
31
- b.bp("/v1/checks");
32
- const query = (0, smithy_client_1.map)({
33
- [_nT]: [, input[_nT]],
34
- [_mR]: [() => input.maxResults !== void 0, () => input[_mR].toString()],
35
- [_p]: [, input[_p]],
36
- [_aS]: [, input[_aS]],
37
- [_s]: [, input[_s]],
38
- [_l]: [, input[_l]],
39
- });
40
- let body;
41
- b.m("GET").h(headers).q(query).b(body);
42
- return b.build();
43
- };
44
- exports.se_ListChecksCommand = se_ListChecksCommand;
45
- const se_ListOrganizationRecommendationAccountsCommand = async (input, context) => {
46
- const b = (0, core_1.requestBuilder)(input, context);
47
- const headers = {};
48
- b.bp("/v1/organization-recommendations/{organizationRecommendationIdentifier}/accounts");
49
- b.p("organizationRecommendationIdentifier", () => input.organizationRecommendationIdentifier, "{organizationRecommendationIdentifier}", false);
50
- const query = (0, smithy_client_1.map)({
51
- [_nT]: [, input[_nT]],
52
- [_mR]: [() => input.maxResults !== void 0, () => input[_mR].toString()],
53
- [_aAI]: [, input[_aAI]],
54
- });
55
- let body;
56
- b.m("GET").h(headers).q(query).b(body);
57
- return b.build();
58
- };
59
- exports.se_ListOrganizationRecommendationAccountsCommand = se_ListOrganizationRecommendationAccountsCommand;
60
- const se_ListOrganizationRecommendationResourcesCommand = async (input, context) => {
61
- const b = (0, core_1.requestBuilder)(input, context);
62
- const headers = {};
63
- b.bp("/v1/organization-recommendations/{organizationRecommendationIdentifier}/resources");
64
- b.p("organizationRecommendationIdentifier", () => input.organizationRecommendationIdentifier, "{organizationRecommendationIdentifier}", false);
65
- const query = (0, smithy_client_1.map)({
66
- [_nT]: [, input[_nT]],
67
- [_mR]: [() => input.maxResults !== void 0, () => input[_mR].toString()],
68
- [_st]: [, input[_st]],
69
- [_rC]: [, input[_rC]],
70
- [_aAI]: [, input[_aAI]],
71
- });
72
- let body;
73
- b.m("GET").h(headers).q(query).b(body);
74
- return b.build();
75
- };
76
- exports.se_ListOrganizationRecommendationResourcesCommand = se_ListOrganizationRecommendationResourcesCommand;
77
- const se_ListOrganizationRecommendationsCommand = async (input, context) => {
78
- const b = (0, core_1.requestBuilder)(input, context);
79
- const headers = {};
80
- b.bp("/v1/organization-recommendations");
81
- const query = (0, smithy_client_1.map)({
82
- [_nT]: [, input[_nT]],
83
- [_mR]: [() => input.maxResults !== void 0, () => input[_mR].toString()],
84
- [_t]: [, input[_t]],
85
- [_st]: [, input[_st]],
86
- [_p]: [, input[_p]],
87
- [_aS]: [, input[_aS]],
88
- [_s]: [, input[_s]],
89
- [_cI]: [, input[_cI]],
90
- [_aLUA]: [
91
- () => input.afterLastUpdatedAt !== void 0,
92
- () => (input[_aLUA].toISOString().split(".")[0] + "Z").toString(),
93
- ],
94
- [_bLUA]: [
95
- () => input.beforeLastUpdatedAt !== void 0,
96
- () => (input[_bLUA].toISOString().split(".")[0] + "Z").toString(),
97
- ],
98
- });
99
- let body;
100
- b.m("GET").h(headers).q(query).b(body);
101
- return b.build();
102
- };
103
- exports.se_ListOrganizationRecommendationsCommand = se_ListOrganizationRecommendationsCommand;
104
- const se_ListRecommendationResourcesCommand = async (input, context) => {
105
- const b = (0, core_1.requestBuilder)(input, context);
106
- const headers = {};
107
- b.bp("/v1/recommendations/{recommendationIdentifier}/resources");
108
- b.p("recommendationIdentifier", () => input.recommendationIdentifier, "{recommendationIdentifier}", false);
109
- const query = (0, smithy_client_1.map)({
110
- [_nT]: [, input[_nT]],
111
- [_mR]: [() => input.maxResults !== void 0, () => input[_mR].toString()],
112
- [_st]: [, input[_st]],
113
- [_rC]: [, input[_rC]],
114
- });
115
- let body;
116
- b.m("GET").h(headers).q(query).b(body);
117
- return b.build();
118
- };
119
- exports.se_ListRecommendationResourcesCommand = se_ListRecommendationResourcesCommand;
120
- const se_ListRecommendationsCommand = async (input, context) => {
121
- const b = (0, core_1.requestBuilder)(input, context);
122
- const headers = {};
123
- b.bp("/v1/recommendations");
124
- const query = (0, smithy_client_1.map)({
125
- [_nT]: [, input[_nT]],
126
- [_mR]: [() => input.maxResults !== void 0, () => input[_mR].toString()],
127
- [_t]: [, input[_t]],
128
- [_st]: [, input[_st]],
129
- [_p]: [, input[_p]],
130
- [_aS]: [, input[_aS]],
131
- [_s]: [, input[_s]],
132
- [_cI]: [, input[_cI]],
133
- [_aLUA]: [
134
- () => input.afterLastUpdatedAt !== void 0,
135
- () => (input[_aLUA].toISOString().split(".")[0] + "Z").toString(),
136
- ],
137
- [_bLUA]: [
138
- () => input.beforeLastUpdatedAt !== void 0,
139
- () => (input[_bLUA].toISOString().split(".")[0] + "Z").toString(),
140
- ],
141
- });
142
- let body;
143
- b.m("GET").h(headers).q(query).b(body);
144
- return b.build();
145
- };
146
- exports.se_ListRecommendationsCommand = se_ListRecommendationsCommand;
147
- const se_UpdateOrganizationRecommendationLifecycleCommand = async (input, context) => {
148
- const b = (0, core_1.requestBuilder)(input, context);
149
- const headers = {
150
- "content-type": "application/json",
151
- };
152
- b.bp("/v1/organization-recommendations/{organizationRecommendationIdentifier}/lifecycle");
153
- b.p("organizationRecommendationIdentifier", () => input.organizationRecommendationIdentifier, "{organizationRecommendationIdentifier}", false);
154
- let body;
155
- body = JSON.stringify((0, smithy_client_1.take)(input, {
156
- lifecycleStage: [],
157
- updateReason: [],
158
- updateReasonCode: [],
159
- }));
160
- b.m("PUT").h(headers).b(body);
161
- return b.build();
162
- };
163
- exports.se_UpdateOrganizationRecommendationLifecycleCommand = se_UpdateOrganizationRecommendationLifecycleCommand;
164
- const se_UpdateRecommendationLifecycleCommand = async (input, context) => {
165
- const b = (0, core_1.requestBuilder)(input, context);
166
- const headers = {
167
- "content-type": "application/json",
168
- };
169
- b.bp("/v1/recommendations/{recommendationIdentifier}/lifecycle");
170
- b.p("recommendationIdentifier", () => input.recommendationIdentifier, "{recommendationIdentifier}", false);
171
- let body;
172
- body = JSON.stringify((0, smithy_client_1.take)(input, {
173
- lifecycleStage: [],
174
- updateReason: [],
175
- updateReasonCode: [],
176
- }));
177
- b.m("PUT").h(headers).b(body);
178
- return b.build();
179
- };
180
- exports.se_UpdateRecommendationLifecycleCommand = se_UpdateRecommendationLifecycleCommand;
181
- const de_GetOrganizationRecommendationCommand = async (output, context) => {
182
- if (output.statusCode !== 200 && output.statusCode >= 300) {
183
- return de_GetOrganizationRecommendationCommandError(output, context);
184
- }
185
- const contents = (0, smithy_client_1.map)({
186
- $metadata: deserializeMetadata(output),
187
- });
188
- const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
189
- const doc = (0, smithy_client_1.take)(data, {
190
- organizationRecommendation: (_) => de_OrganizationRecommendation(_, context),
191
- });
192
- Object.assign(contents, doc);
193
- return contents;
194
- };
195
- exports.de_GetOrganizationRecommendationCommand = de_GetOrganizationRecommendationCommand;
196
- const de_GetOrganizationRecommendationCommandError = async (output, context) => {
197
- const parsedOutput = {
198
- ...output,
199
- body: await parseErrorBody(output.body, context),
200
- };
201
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
202
- switch (errorCode) {
203
- case "AccessDeniedException":
204
- case "com.amazonaws.trustedadvisor#AccessDeniedException":
205
- throw await de_AccessDeniedExceptionRes(parsedOutput, context);
206
- case "InternalServerException":
207
- case "com.amazonaws.trustedadvisor#InternalServerException":
208
- throw await de_InternalServerExceptionRes(parsedOutput, context);
209
- case "ResourceNotFoundException":
210
- case "com.amazonaws.trustedadvisor#ResourceNotFoundException":
211
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
212
- case "ThrottlingException":
213
- case "com.amazonaws.trustedadvisor#ThrottlingException":
214
- throw await de_ThrottlingExceptionRes(parsedOutput, context);
215
- case "ValidationException":
216
- case "com.amazonaws.trustedadvisor#ValidationException":
217
- throw await de_ValidationExceptionRes(parsedOutput, context);
218
- default:
219
- const parsedBody = parsedOutput.body;
220
- return throwDefaultError({
221
- output,
222
- parsedBody,
223
- errorCode,
224
- });
225
- }
226
- };
227
- const de_GetRecommendationCommand = async (output, context) => {
228
- if (output.statusCode !== 200 && output.statusCode >= 300) {
229
- return de_GetRecommendationCommandError(output, context);
230
- }
231
- const contents = (0, smithy_client_1.map)({
232
- $metadata: deserializeMetadata(output),
233
- });
234
- const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
235
- const doc = (0, smithy_client_1.take)(data, {
236
- recommendation: (_) => de_Recommendation(_, context),
237
- });
238
- Object.assign(contents, doc);
239
- return contents;
240
- };
241
- exports.de_GetRecommendationCommand = de_GetRecommendationCommand;
242
- const de_GetRecommendationCommandError = async (output, context) => {
243
- const parsedOutput = {
244
- ...output,
245
- body: await parseErrorBody(output.body, context),
246
- };
247
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
248
- switch (errorCode) {
249
- case "AccessDeniedException":
250
- case "com.amazonaws.trustedadvisor#AccessDeniedException":
251
- throw await de_AccessDeniedExceptionRes(parsedOutput, context);
252
- case "InternalServerException":
253
- case "com.amazonaws.trustedadvisor#InternalServerException":
254
- throw await de_InternalServerExceptionRes(parsedOutput, context);
255
- case "ResourceNotFoundException":
256
- case "com.amazonaws.trustedadvisor#ResourceNotFoundException":
257
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
258
- case "ThrottlingException":
259
- case "com.amazonaws.trustedadvisor#ThrottlingException":
260
- throw await de_ThrottlingExceptionRes(parsedOutput, context);
261
- case "ValidationException":
262
- case "com.amazonaws.trustedadvisor#ValidationException":
263
- throw await de_ValidationExceptionRes(parsedOutput, context);
264
- default:
265
- const parsedBody = parsedOutput.body;
266
- return throwDefaultError({
267
- output,
268
- parsedBody,
269
- errorCode,
270
- });
271
- }
272
- };
273
- const de_ListChecksCommand = async (output, context) => {
274
- if (output.statusCode !== 200 && output.statusCode >= 300) {
275
- return de_ListChecksCommandError(output, context);
276
- }
277
- const contents = (0, smithy_client_1.map)({
278
- $metadata: deserializeMetadata(output),
279
- });
280
- const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
281
- const doc = (0, smithy_client_1.take)(data, {
282
- checkSummaries: smithy_client_1._json,
283
- nextToken: smithy_client_1.expectString,
284
- });
285
- Object.assign(contents, doc);
286
- return contents;
287
- };
288
- exports.de_ListChecksCommand = de_ListChecksCommand;
289
- const de_ListChecksCommandError = async (output, context) => {
290
- const parsedOutput = {
291
- ...output,
292
- body: await parseErrorBody(output.body, context),
293
- };
294
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
295
- switch (errorCode) {
296
- case "AccessDeniedException":
297
- case "com.amazonaws.trustedadvisor#AccessDeniedException":
298
- throw await de_AccessDeniedExceptionRes(parsedOutput, context);
299
- case "InternalServerException":
300
- case "com.amazonaws.trustedadvisor#InternalServerException":
301
- throw await de_InternalServerExceptionRes(parsedOutput, context);
302
- case "ThrottlingException":
303
- case "com.amazonaws.trustedadvisor#ThrottlingException":
304
- throw await de_ThrottlingExceptionRes(parsedOutput, context);
305
- case "ValidationException":
306
- case "com.amazonaws.trustedadvisor#ValidationException":
307
- throw await de_ValidationExceptionRes(parsedOutput, context);
308
- default:
309
- const parsedBody = parsedOutput.body;
310
- return throwDefaultError({
311
- output,
312
- parsedBody,
313
- errorCode,
314
- });
315
- }
316
- };
317
- const de_ListOrganizationRecommendationAccountsCommand = async (output, context) => {
318
- if (output.statusCode !== 200 && output.statusCode >= 300) {
319
- return de_ListOrganizationRecommendationAccountsCommandError(output, context);
320
- }
321
- const contents = (0, smithy_client_1.map)({
322
- $metadata: deserializeMetadata(output),
323
- });
324
- const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
325
- const doc = (0, smithy_client_1.take)(data, {
326
- accountRecommendationLifecycleSummaries: (_) => de_AccountRecommendationLifecycleSummaryList(_, context),
327
- nextToken: smithy_client_1.expectString,
328
- });
329
- Object.assign(contents, doc);
330
- return contents;
331
- };
332
- exports.de_ListOrganizationRecommendationAccountsCommand = de_ListOrganizationRecommendationAccountsCommand;
333
- const de_ListOrganizationRecommendationAccountsCommandError = async (output, context) => {
334
- const parsedOutput = {
335
- ...output,
336
- body: await parseErrorBody(output.body, context),
337
- };
338
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
339
- switch (errorCode) {
340
- case "AccessDeniedException":
341
- case "com.amazonaws.trustedadvisor#AccessDeniedException":
342
- throw await de_AccessDeniedExceptionRes(parsedOutput, context);
343
- case "InternalServerException":
344
- case "com.amazonaws.trustedadvisor#InternalServerException":
345
- throw await de_InternalServerExceptionRes(parsedOutput, context);
346
- case "ResourceNotFoundException":
347
- case "com.amazonaws.trustedadvisor#ResourceNotFoundException":
348
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
349
- case "ThrottlingException":
350
- case "com.amazonaws.trustedadvisor#ThrottlingException":
351
- throw await de_ThrottlingExceptionRes(parsedOutput, context);
352
- case "ValidationException":
353
- case "com.amazonaws.trustedadvisor#ValidationException":
354
- throw await de_ValidationExceptionRes(parsedOutput, context);
355
- default:
356
- const parsedBody = parsedOutput.body;
357
- return throwDefaultError({
358
- output,
359
- parsedBody,
360
- errorCode,
361
- });
362
- }
363
- };
364
- const de_ListOrganizationRecommendationResourcesCommand = async (output, context) => {
365
- if (output.statusCode !== 200 && output.statusCode >= 300) {
366
- return de_ListOrganizationRecommendationResourcesCommandError(output, context);
367
- }
368
- const contents = (0, smithy_client_1.map)({
369
- $metadata: deserializeMetadata(output),
370
- });
371
- const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
372
- const doc = (0, smithy_client_1.take)(data, {
373
- nextToken: smithy_client_1.expectString,
374
- organizationRecommendationResourceSummaries: (_) => de_OrganizationRecommendationResourceSummaryList(_, context),
375
- });
376
- Object.assign(contents, doc);
377
- return contents;
378
- };
379
- exports.de_ListOrganizationRecommendationResourcesCommand = de_ListOrganizationRecommendationResourcesCommand;
380
- const de_ListOrganizationRecommendationResourcesCommandError = async (output, context) => {
381
- const parsedOutput = {
382
- ...output,
383
- body: await parseErrorBody(output.body, context),
384
- };
385
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
386
- switch (errorCode) {
387
- case "AccessDeniedException":
388
- case "com.amazonaws.trustedadvisor#AccessDeniedException":
389
- throw await de_AccessDeniedExceptionRes(parsedOutput, context);
390
- case "InternalServerException":
391
- case "com.amazonaws.trustedadvisor#InternalServerException":
392
- throw await de_InternalServerExceptionRes(parsedOutput, context);
393
- case "ResourceNotFoundException":
394
- case "com.amazonaws.trustedadvisor#ResourceNotFoundException":
395
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
396
- case "ThrottlingException":
397
- case "com.amazonaws.trustedadvisor#ThrottlingException":
398
- throw await de_ThrottlingExceptionRes(parsedOutput, context);
399
- case "ValidationException":
400
- case "com.amazonaws.trustedadvisor#ValidationException":
401
- throw await de_ValidationExceptionRes(parsedOutput, context);
402
- default:
403
- const parsedBody = parsedOutput.body;
404
- return throwDefaultError({
405
- output,
406
- parsedBody,
407
- errorCode,
408
- });
409
- }
410
- };
411
- const de_ListOrganizationRecommendationsCommand = async (output, context) => {
412
- if (output.statusCode !== 200 && output.statusCode >= 300) {
413
- return de_ListOrganizationRecommendationsCommandError(output, context);
414
- }
415
- const contents = (0, smithy_client_1.map)({
416
- $metadata: deserializeMetadata(output),
417
- });
418
- const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
419
- const doc = (0, smithy_client_1.take)(data, {
420
- nextToken: smithy_client_1.expectString,
421
- organizationRecommendationSummaries: (_) => de_OrganizationRecommendationSummaryList(_, context),
422
- });
423
- Object.assign(contents, doc);
424
- return contents;
425
- };
426
- exports.de_ListOrganizationRecommendationsCommand = de_ListOrganizationRecommendationsCommand;
427
- const de_ListOrganizationRecommendationsCommandError = async (output, context) => {
428
- const parsedOutput = {
429
- ...output,
430
- body: await parseErrorBody(output.body, context),
431
- };
432
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
433
- switch (errorCode) {
434
- case "AccessDeniedException":
435
- case "com.amazonaws.trustedadvisor#AccessDeniedException":
436
- throw await de_AccessDeniedExceptionRes(parsedOutput, context);
437
- case "InternalServerException":
438
- case "com.amazonaws.trustedadvisor#InternalServerException":
439
- throw await de_InternalServerExceptionRes(parsedOutput, context);
440
- case "ThrottlingException":
441
- case "com.amazonaws.trustedadvisor#ThrottlingException":
442
- throw await de_ThrottlingExceptionRes(parsedOutput, context);
443
- case "ValidationException":
444
- case "com.amazonaws.trustedadvisor#ValidationException":
445
- throw await de_ValidationExceptionRes(parsedOutput, context);
446
- default:
447
- const parsedBody = parsedOutput.body;
448
- return throwDefaultError({
449
- output,
450
- parsedBody,
451
- errorCode,
452
- });
453
- }
454
- };
455
- const de_ListRecommendationResourcesCommand = async (output, context) => {
456
- if (output.statusCode !== 200 && output.statusCode >= 300) {
457
- return de_ListRecommendationResourcesCommandError(output, context);
458
- }
459
- const contents = (0, smithy_client_1.map)({
460
- $metadata: deserializeMetadata(output),
461
- });
462
- const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
463
- const doc = (0, smithy_client_1.take)(data, {
464
- nextToken: smithy_client_1.expectString,
465
- recommendationResourceSummaries: (_) => de_RecommendationResourceSummaryList(_, context),
466
- });
467
- Object.assign(contents, doc);
468
- return contents;
469
- };
470
- exports.de_ListRecommendationResourcesCommand = de_ListRecommendationResourcesCommand;
471
- const de_ListRecommendationResourcesCommandError = async (output, context) => {
472
- const parsedOutput = {
473
- ...output,
474
- body: await parseErrorBody(output.body, context),
475
- };
476
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
477
- switch (errorCode) {
478
- case "AccessDeniedException":
479
- case "com.amazonaws.trustedadvisor#AccessDeniedException":
480
- throw await de_AccessDeniedExceptionRes(parsedOutput, context);
481
- case "InternalServerException":
482
- case "com.amazonaws.trustedadvisor#InternalServerException":
483
- throw await de_InternalServerExceptionRes(parsedOutput, context);
484
- case "ResourceNotFoundException":
485
- case "com.amazonaws.trustedadvisor#ResourceNotFoundException":
486
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
487
- case "ThrottlingException":
488
- case "com.amazonaws.trustedadvisor#ThrottlingException":
489
- throw await de_ThrottlingExceptionRes(parsedOutput, context);
490
- case "ValidationException":
491
- case "com.amazonaws.trustedadvisor#ValidationException":
492
- throw await de_ValidationExceptionRes(parsedOutput, context);
493
- default:
494
- const parsedBody = parsedOutput.body;
495
- return throwDefaultError({
496
- output,
497
- parsedBody,
498
- errorCode,
499
- });
500
- }
501
- };
502
- const de_ListRecommendationsCommand = async (output, context) => {
503
- if (output.statusCode !== 200 && output.statusCode >= 300) {
504
- return de_ListRecommendationsCommandError(output, context);
505
- }
506
- const contents = (0, smithy_client_1.map)({
507
- $metadata: deserializeMetadata(output),
508
- });
509
- const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
510
- const doc = (0, smithy_client_1.take)(data, {
511
- nextToken: smithy_client_1.expectString,
512
- recommendationSummaries: (_) => de_RecommendationSummaryList(_, context),
513
- });
514
- Object.assign(contents, doc);
515
- return contents;
516
- };
517
- exports.de_ListRecommendationsCommand = de_ListRecommendationsCommand;
518
- const de_ListRecommendationsCommandError = async (output, context) => {
519
- const parsedOutput = {
520
- ...output,
521
- body: await parseErrorBody(output.body, context),
522
- };
523
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
524
- switch (errorCode) {
525
- case "AccessDeniedException":
526
- case "com.amazonaws.trustedadvisor#AccessDeniedException":
527
- throw await de_AccessDeniedExceptionRes(parsedOutput, context);
528
- case "InternalServerException":
529
- case "com.amazonaws.trustedadvisor#InternalServerException":
530
- throw await de_InternalServerExceptionRes(parsedOutput, context);
531
- case "ThrottlingException":
532
- case "com.amazonaws.trustedadvisor#ThrottlingException":
533
- throw await de_ThrottlingExceptionRes(parsedOutput, context);
534
- case "ValidationException":
535
- case "com.amazonaws.trustedadvisor#ValidationException":
536
- throw await de_ValidationExceptionRes(parsedOutput, context);
537
- default:
538
- const parsedBody = parsedOutput.body;
539
- return throwDefaultError({
540
- output,
541
- parsedBody,
542
- errorCode,
543
- });
544
- }
545
- };
546
- const de_UpdateOrganizationRecommendationLifecycleCommand = async (output, context) => {
547
- if (output.statusCode !== 200 && output.statusCode >= 300) {
548
- return de_UpdateOrganizationRecommendationLifecycleCommandError(output, context);
549
- }
550
- const contents = (0, smithy_client_1.map)({
551
- $metadata: deserializeMetadata(output),
552
- });
553
- await (0, smithy_client_1.collectBody)(output.body, context);
554
- return contents;
555
- };
556
- exports.de_UpdateOrganizationRecommendationLifecycleCommand = de_UpdateOrganizationRecommendationLifecycleCommand;
557
- const de_UpdateOrganizationRecommendationLifecycleCommandError = async (output, context) => {
558
- const parsedOutput = {
559
- ...output,
560
- body: await parseErrorBody(output.body, context),
561
- };
562
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
563
- switch (errorCode) {
564
- case "AccessDeniedException":
565
- case "com.amazonaws.trustedadvisor#AccessDeniedException":
566
- throw await de_AccessDeniedExceptionRes(parsedOutput, context);
567
- case "ConflictException":
568
- case "com.amazonaws.trustedadvisor#ConflictException":
569
- throw await de_ConflictExceptionRes(parsedOutput, context);
570
- case "InternalServerException":
571
- case "com.amazonaws.trustedadvisor#InternalServerException":
572
- throw await de_InternalServerExceptionRes(parsedOutput, context);
573
- case "ResourceNotFoundException":
574
- case "com.amazonaws.trustedadvisor#ResourceNotFoundException":
575
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
576
- case "ThrottlingException":
577
- case "com.amazonaws.trustedadvisor#ThrottlingException":
578
- throw await de_ThrottlingExceptionRes(parsedOutput, context);
579
- case "ValidationException":
580
- case "com.amazonaws.trustedadvisor#ValidationException":
581
- throw await de_ValidationExceptionRes(parsedOutput, context);
582
- default:
583
- const parsedBody = parsedOutput.body;
584
- return throwDefaultError({
585
- output,
586
- parsedBody,
587
- errorCode,
588
- });
589
- }
590
- };
591
- const de_UpdateRecommendationLifecycleCommand = async (output, context) => {
592
- if (output.statusCode !== 200 && output.statusCode >= 300) {
593
- return de_UpdateRecommendationLifecycleCommandError(output, context);
594
- }
595
- const contents = (0, smithy_client_1.map)({
596
- $metadata: deserializeMetadata(output),
597
- });
598
- await (0, smithy_client_1.collectBody)(output.body, context);
599
- return contents;
600
- };
601
- exports.de_UpdateRecommendationLifecycleCommand = de_UpdateRecommendationLifecycleCommand;
602
- const de_UpdateRecommendationLifecycleCommandError = async (output, context) => {
603
- const parsedOutput = {
604
- ...output,
605
- body: await parseErrorBody(output.body, context),
606
- };
607
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
608
- switch (errorCode) {
609
- case "AccessDeniedException":
610
- case "com.amazonaws.trustedadvisor#AccessDeniedException":
611
- throw await de_AccessDeniedExceptionRes(parsedOutput, context);
612
- case "ConflictException":
613
- case "com.amazonaws.trustedadvisor#ConflictException":
614
- throw await de_ConflictExceptionRes(parsedOutput, context);
615
- case "InternalServerException":
616
- case "com.amazonaws.trustedadvisor#InternalServerException":
617
- throw await de_InternalServerExceptionRes(parsedOutput, context);
618
- case "ResourceNotFoundException":
619
- case "com.amazonaws.trustedadvisor#ResourceNotFoundException":
620
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
621
- case "ThrottlingException":
622
- case "com.amazonaws.trustedadvisor#ThrottlingException":
623
- throw await de_ThrottlingExceptionRes(parsedOutput, context);
624
- case "ValidationException":
625
- case "com.amazonaws.trustedadvisor#ValidationException":
626
- throw await de_ValidationExceptionRes(parsedOutput, context);
627
- default:
628
- const parsedBody = parsedOutput.body;
629
- return throwDefaultError({
630
- output,
631
- parsedBody,
632
- errorCode,
633
- });
634
- }
635
- };
636
- const throwDefaultError = (0, smithy_client_1.withBaseException)(TrustedAdvisorServiceException_1.TrustedAdvisorServiceException);
637
- const de_AccessDeniedExceptionRes = async (parsedOutput, context) => {
638
- const contents = (0, smithy_client_1.map)({});
639
- const data = parsedOutput.body;
640
- const doc = (0, smithy_client_1.take)(data, {
641
- message: smithy_client_1.expectString,
642
- });
643
- Object.assign(contents, doc);
644
- const exception = new models_0_1.AccessDeniedException({
645
- $metadata: deserializeMetadata(parsedOutput),
646
- ...contents,
647
- });
648
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
649
- };
650
- const de_ConflictExceptionRes = async (parsedOutput, context) => {
651
- const contents = (0, smithy_client_1.map)({});
652
- const data = parsedOutput.body;
653
- const doc = (0, smithy_client_1.take)(data, {
654
- message: smithy_client_1.expectString,
655
- });
656
- Object.assign(contents, doc);
657
- const exception = new models_0_1.ConflictException({
658
- $metadata: deserializeMetadata(parsedOutput),
659
- ...contents,
660
- });
661
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
662
- };
663
- const de_InternalServerExceptionRes = async (parsedOutput, context) => {
664
- const contents = (0, smithy_client_1.map)({});
665
- const data = parsedOutput.body;
666
- const doc = (0, smithy_client_1.take)(data, {
667
- message: smithy_client_1.expectString,
668
- });
669
- Object.assign(contents, doc);
670
- const exception = new models_0_1.InternalServerException({
671
- $metadata: deserializeMetadata(parsedOutput),
672
- ...contents,
673
- });
674
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
675
- };
676
- const de_ResourceNotFoundExceptionRes = async (parsedOutput, context) => {
677
- const contents = (0, smithy_client_1.map)({});
678
- const data = parsedOutput.body;
679
- const doc = (0, smithy_client_1.take)(data, {
680
- message: smithy_client_1.expectString,
681
- });
682
- Object.assign(contents, doc);
683
- const exception = new models_0_1.ResourceNotFoundException({
684
- $metadata: deserializeMetadata(parsedOutput),
685
- ...contents,
686
- });
687
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
688
- };
689
- const de_ThrottlingExceptionRes = async (parsedOutput, context) => {
690
- const contents = (0, smithy_client_1.map)({});
691
- const data = parsedOutput.body;
692
- const doc = (0, smithy_client_1.take)(data, {
693
- message: smithy_client_1.expectString,
694
- });
695
- Object.assign(contents, doc);
696
- const exception = new models_0_1.ThrottlingException({
697
- $metadata: deserializeMetadata(parsedOutput),
698
- ...contents,
699
- });
700
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
701
- };
702
- const de_ValidationExceptionRes = async (parsedOutput, context) => {
703
- const contents = (0, smithy_client_1.map)({});
704
- const data = parsedOutput.body;
705
- const doc = (0, smithy_client_1.take)(data, {
706
- message: smithy_client_1.expectString,
707
- });
708
- Object.assign(contents, doc);
709
- const exception = new models_0_1.ValidationException({
710
- $metadata: deserializeMetadata(parsedOutput),
711
- ...contents,
712
- });
713
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
714
- };
715
- const de_AccountRecommendationLifecycleSummary = (output, context) => {
716
- return (0, smithy_client_1.take)(output, {
717
- accountId: smithy_client_1.expectString,
718
- accountRecommendationArn: smithy_client_1.expectString,
719
- lastUpdatedAt: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTimeWithOffset)(_)),
720
- lifecycleStage: smithy_client_1.expectString,
721
- updateReason: smithy_client_1.expectString,
722
- updateReasonCode: smithy_client_1.expectString,
723
- updatedOnBehalfOf: smithy_client_1.expectString,
724
- updatedOnBehalfOfJobTitle: smithy_client_1.expectString,
725
- });
726
- };
727
- const de_AccountRecommendationLifecycleSummaryList = (output, context) => {
728
- const retVal = (output || [])
729
- .filter((e) => e != null)
730
- .map((entry) => {
731
- return de_AccountRecommendationLifecycleSummary(entry, context);
732
- });
733
- return retVal;
734
- };
735
- const de_OrganizationRecommendation = (output, context) => {
736
- return (0, smithy_client_1.take)(output, {
737
- arn: smithy_client_1.expectString,
738
- awsServices: smithy_client_1._json,
739
- checkArn: smithy_client_1.expectString,
740
- createdAt: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTimeWithOffset)(_)),
741
- createdBy: smithy_client_1.expectString,
742
- description: smithy_client_1.expectString,
743
- id: smithy_client_1.expectString,
744
- lastUpdatedAt: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTimeWithOffset)(_)),
745
- lifecycleStage: smithy_client_1.expectString,
746
- name: smithy_client_1.expectString,
747
- pillarSpecificAggregates: (_) => de_RecommendationPillarSpecificAggregates(_, context),
748
- pillars: smithy_client_1._json,
749
- resolvedAt: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTimeWithOffset)(_)),
750
- resourcesAggregates: smithy_client_1._json,
751
- source: smithy_client_1.expectString,
752
- status: smithy_client_1.expectString,
753
- type: smithy_client_1.expectString,
754
- updateReason: smithy_client_1.expectString,
755
- updateReasonCode: smithy_client_1.expectString,
756
- updatedOnBehalfOf: smithy_client_1.expectString,
757
- updatedOnBehalfOfJobTitle: smithy_client_1.expectString,
758
- });
759
- };
760
- const de_OrganizationRecommendationResourceSummary = (output, context) => {
761
- return (0, smithy_client_1.take)(output, {
762
- accountId: smithy_client_1.expectString,
763
- arn: smithy_client_1.expectString,
764
- awsResourceId: smithy_client_1.expectString,
765
- id: smithy_client_1.expectString,
766
- lastUpdatedAt: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTimeWithOffset)(_)),
767
- metadata: smithy_client_1._json,
768
- recommendationArn: smithy_client_1.expectString,
769
- regionCode: smithy_client_1.expectString,
770
- status: smithy_client_1.expectString,
771
- });
772
- };
773
- const de_OrganizationRecommendationResourceSummaryList = (output, context) => {
774
- const retVal = (output || [])
775
- .filter((e) => e != null)
776
- .map((entry) => {
777
- return de_OrganizationRecommendationResourceSummary(entry, context);
778
- });
779
- return retVal;
780
- };
781
- const de_OrganizationRecommendationSummary = (output, context) => {
782
- return (0, smithy_client_1.take)(output, {
783
- arn: smithy_client_1.expectString,
784
- awsServices: smithy_client_1._json,
785
- checkArn: smithy_client_1.expectString,
786
- createdAt: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTimeWithOffset)(_)),
787
- id: smithy_client_1.expectString,
788
- lastUpdatedAt: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTimeWithOffset)(_)),
789
- lifecycleStage: smithy_client_1.expectString,
790
- name: smithy_client_1.expectString,
791
- pillarSpecificAggregates: (_) => de_RecommendationPillarSpecificAggregates(_, context),
792
- pillars: smithy_client_1._json,
793
- resourcesAggregates: smithy_client_1._json,
794
- source: smithy_client_1.expectString,
795
- status: smithy_client_1.expectString,
796
- type: smithy_client_1.expectString,
797
- });
798
- };
799
- const de_OrganizationRecommendationSummaryList = (output, context) => {
800
- const retVal = (output || [])
801
- .filter((e) => e != null)
802
- .map((entry) => {
803
- return de_OrganizationRecommendationSummary(entry, context);
804
- });
805
- return retVal;
806
- };
807
- const de_Recommendation = (output, context) => {
808
- return (0, smithy_client_1.take)(output, {
809
- arn: smithy_client_1.expectString,
810
- awsServices: smithy_client_1._json,
811
- checkArn: smithy_client_1.expectString,
812
- createdAt: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTimeWithOffset)(_)),
813
- createdBy: smithy_client_1.expectString,
814
- description: smithy_client_1.expectString,
815
- id: smithy_client_1.expectString,
816
- lastUpdatedAt: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTimeWithOffset)(_)),
817
- lifecycleStage: smithy_client_1.expectString,
818
- name: smithy_client_1.expectString,
819
- pillarSpecificAggregates: (_) => de_RecommendationPillarSpecificAggregates(_, context),
820
- pillars: smithy_client_1._json,
821
- resolvedAt: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTimeWithOffset)(_)),
822
- resourcesAggregates: smithy_client_1._json,
823
- source: smithy_client_1.expectString,
824
- status: smithy_client_1.expectString,
825
- type: smithy_client_1.expectString,
826
- updateReason: smithy_client_1.expectString,
827
- updateReasonCode: smithy_client_1.expectString,
828
- updatedOnBehalfOf: smithy_client_1.expectString,
829
- updatedOnBehalfOfJobTitle: smithy_client_1.expectString,
830
- });
831
- };
832
- const de_RecommendationCostOptimizingAggregates = (output, context) => {
833
- return (0, smithy_client_1.take)(output, {
834
- estimatedMonthlySavings: smithy_client_1.limitedParseDouble,
835
- estimatedPercentMonthlySavings: smithy_client_1.limitedParseDouble,
836
- });
837
- };
838
- const de_RecommendationPillarSpecificAggregates = (output, context) => {
839
- return (0, smithy_client_1.take)(output, {
840
- costOptimizing: (_) => de_RecommendationCostOptimizingAggregates(_, context),
841
- });
842
- };
843
- const de_RecommendationResourceSummary = (output, context) => {
844
- return (0, smithy_client_1.take)(output, {
845
- arn: smithy_client_1.expectString,
846
- awsResourceId: smithy_client_1.expectString,
847
- id: smithy_client_1.expectString,
848
- lastUpdatedAt: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTimeWithOffset)(_)),
849
- metadata: smithy_client_1._json,
850
- recommendationArn: smithy_client_1.expectString,
851
- regionCode: smithy_client_1.expectString,
852
- status: smithy_client_1.expectString,
853
- });
854
- };
855
- const de_RecommendationResourceSummaryList = (output, context) => {
856
- const retVal = (output || [])
857
- .filter((e) => e != null)
858
- .map((entry) => {
859
- return de_RecommendationResourceSummary(entry, context);
860
- });
861
- return retVal;
862
- };
863
- const de_RecommendationSummary = (output, context) => {
864
- return (0, smithy_client_1.take)(output, {
865
- arn: smithy_client_1.expectString,
866
- awsServices: smithy_client_1._json,
867
- checkArn: smithy_client_1.expectString,
868
- createdAt: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTimeWithOffset)(_)),
869
- id: smithy_client_1.expectString,
870
- lastUpdatedAt: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTimeWithOffset)(_)),
871
- lifecycleStage: smithy_client_1.expectString,
872
- name: smithy_client_1.expectString,
873
- pillarSpecificAggregates: (_) => de_RecommendationPillarSpecificAggregates(_, context),
874
- pillars: smithy_client_1._json,
875
- resourcesAggregates: smithy_client_1._json,
876
- source: smithy_client_1.expectString,
877
- status: smithy_client_1.expectString,
878
- type: smithy_client_1.expectString,
879
- });
880
- };
881
- const de_RecommendationSummaryList = (output, context) => {
882
- const retVal = (output || [])
883
- .filter((e) => e != null)
884
- .map((entry) => {
885
- return de_RecommendationSummary(entry, context);
886
- });
887
- return retVal;
888
- };
889
- const deserializeMetadata = (output) => ({
890
- httpStatusCode: output.statusCode,
891
- requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
892
- extendedRequestId: output.headers["x-amz-id-2"],
893
- cfId: output.headers["x-amz-cf-id"],
894
- });
895
- const collectBodyString = (streamBody, context) => (0, smithy_client_1.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body));
896
- const isSerializableHeaderValue = (value) => value !== undefined &&
897
- value !== null &&
898
- value !== "" &&
899
- (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
900
- (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
901
- const _aAI = "affectedAccountId";
902
- const _aLUA = "afterLastUpdatedAt";
903
- const _aS = "awsService";
904
- const _bLUA = "beforeLastUpdatedAt";
905
- const _cI = "checkIdentifier";
906
- const _l = "language";
907
- const _mR = "maxResults";
908
- const _nT = "nextToken";
909
- const _p = "pillar";
910
- const _rC = "regionCode";
911
- const _s = "source";
912
- const _st = "status";
913
- const _t = "type";
914
- const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
915
- if (encoded.length) {
916
- return JSON.parse(encoded);
917
- }
918
- return {};
919
- });
920
- const parseErrorBody = async (errorBody, context) => {
921
- const value = await parseBody(errorBody, context);
922
- value.message = value.message ?? value.Message;
923
- return value;
924
- };
925
- const loadRestJsonErrorCode = (output, data) => {
926
- const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
927
- const sanitizeErrorCode = (rawValue) => {
928
- let cleanValue = rawValue;
929
- if (typeof cleanValue === "number") {
930
- cleanValue = cleanValue.toString();
931
- }
932
- if (cleanValue.indexOf(",") >= 0) {
933
- cleanValue = cleanValue.split(",")[0];
934
- }
935
- if (cleanValue.indexOf(":") >= 0) {
936
- cleanValue = cleanValue.split(":")[0];
937
- }
938
- if (cleanValue.indexOf("#") >= 0) {
939
- cleanValue = cleanValue.split("#")[1];
940
- }
941
- return cleanValue;
942
- };
943
- const headerKey = findKey(output.headers, "x-amzn-errortype");
944
- if (headerKey !== undefined) {
945
- return sanitizeErrorCode(output.headers[headerKey]);
946
- }
947
- if (data.code !== undefined) {
948
- return sanitizeErrorCode(data.code);
949
- }
950
- if (data["__type"] !== undefined) {
951
- return sanitizeErrorCode(data["__type"]);
952
- }
953
- };
1
+ module.exports = require("../index.js");