@aws-sdk/client-cost-optimization-hub 3.490.0 → 3.495.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.
@@ -1,830 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.de_UpdatePreferencesCommand = exports.de_UpdateEnrollmentStatusCommand = exports.de_ListRecommendationSummariesCommand = exports.de_ListRecommendationsCommand = exports.de_ListEnrollmentStatusesCommand = exports.de_GetRecommendationCommand = exports.de_GetPreferencesCommand = exports.se_UpdatePreferencesCommand = exports.se_UpdateEnrollmentStatusCommand = exports.se_ListRecommendationSummariesCommand = exports.se_ListRecommendationsCommand = exports.se_ListEnrollmentStatusesCommand = exports.se_GetRecommendationCommand = exports.se_GetPreferencesCommand = void 0;
4
- const core_1 = require("@aws-sdk/core");
5
- const protocol_http_1 = require("@smithy/protocol-http");
6
- const smithy_client_1 = require("@smithy/smithy-client");
7
- const CostOptimizationHubServiceException_1 = require("../models/CostOptimizationHubServiceException");
8
- const models_0_1 = require("../models/models_0");
9
- const se_GetPreferencesCommand = async (input, context) => {
10
- const headers = sharedHeaders("GetPreferences");
11
- let body;
12
- body = JSON.stringify((0, smithy_client_1._json)(input));
13
- return buildHttpRpcRequest(context, headers, "/", undefined, body);
14
- };
15
- exports.se_GetPreferencesCommand = se_GetPreferencesCommand;
16
- const se_GetRecommendationCommand = async (input, context) => {
17
- const headers = sharedHeaders("GetRecommendation");
18
- let body;
19
- body = JSON.stringify((0, smithy_client_1._json)(input));
20
- return buildHttpRpcRequest(context, headers, "/", undefined, body);
21
- };
22
- exports.se_GetRecommendationCommand = se_GetRecommendationCommand;
23
- const se_ListEnrollmentStatusesCommand = async (input, context) => {
24
- const headers = sharedHeaders("ListEnrollmentStatuses");
25
- let body;
26
- body = JSON.stringify((0, smithy_client_1._json)(input));
27
- return buildHttpRpcRequest(context, headers, "/", undefined, body);
28
- };
29
- exports.se_ListEnrollmentStatusesCommand = se_ListEnrollmentStatusesCommand;
30
- const se_ListRecommendationsCommand = async (input, context) => {
31
- const headers = sharedHeaders("ListRecommendations");
32
- let body;
33
- body = JSON.stringify((0, smithy_client_1._json)(input));
34
- return buildHttpRpcRequest(context, headers, "/", undefined, body);
35
- };
36
- exports.se_ListRecommendationsCommand = se_ListRecommendationsCommand;
37
- const se_ListRecommendationSummariesCommand = async (input, context) => {
38
- const headers = sharedHeaders("ListRecommendationSummaries");
39
- let body;
40
- body = JSON.stringify((0, smithy_client_1._json)(input));
41
- return buildHttpRpcRequest(context, headers, "/", undefined, body);
42
- };
43
- exports.se_ListRecommendationSummariesCommand = se_ListRecommendationSummariesCommand;
44
- const se_UpdateEnrollmentStatusCommand = async (input, context) => {
45
- const headers = sharedHeaders("UpdateEnrollmentStatus");
46
- let body;
47
- body = JSON.stringify((0, smithy_client_1._json)(input));
48
- return buildHttpRpcRequest(context, headers, "/", undefined, body);
49
- };
50
- exports.se_UpdateEnrollmentStatusCommand = se_UpdateEnrollmentStatusCommand;
51
- const se_UpdatePreferencesCommand = async (input, context) => {
52
- const headers = sharedHeaders("UpdatePreferences");
53
- let body;
54
- body = JSON.stringify((0, smithy_client_1._json)(input));
55
- return buildHttpRpcRequest(context, headers, "/", undefined, body);
56
- };
57
- exports.se_UpdatePreferencesCommand = se_UpdatePreferencesCommand;
58
- const de_GetPreferencesCommand = async (output, context) => {
59
- if (output.statusCode >= 300) {
60
- return de_GetPreferencesCommandError(output, context);
61
- }
62
- const data = await parseBody(output.body, context);
63
- let contents = {};
64
- contents = (0, smithy_client_1._json)(data);
65
- const response = {
66
- $metadata: deserializeMetadata(output),
67
- ...contents,
68
- };
69
- return response;
70
- };
71
- exports.de_GetPreferencesCommand = de_GetPreferencesCommand;
72
- const de_GetPreferencesCommandError = async (output, context) => {
73
- const parsedOutput = {
74
- ...output,
75
- body: await parseErrorBody(output.body, context),
76
- };
77
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
78
- switch (errorCode) {
79
- case "AccessDeniedException":
80
- case "com.amazonaws.costoptimizationhub#AccessDeniedException":
81
- throw await de_AccessDeniedExceptionRes(parsedOutput, context);
82
- case "InternalServerException":
83
- case "com.amazonaws.costoptimizationhub#InternalServerException":
84
- throw await de_InternalServerExceptionRes(parsedOutput, context);
85
- case "ThrottlingException":
86
- case "com.amazonaws.costoptimizationhub#ThrottlingException":
87
- throw await de_ThrottlingExceptionRes(parsedOutput, context);
88
- case "ValidationException":
89
- case "com.amazonaws.costoptimizationhub#ValidationException":
90
- throw await de_ValidationExceptionRes(parsedOutput, context);
91
- default:
92
- const parsedBody = parsedOutput.body;
93
- return throwDefaultError({
94
- output,
95
- parsedBody,
96
- errorCode,
97
- });
98
- }
99
- };
100
- const de_GetRecommendationCommand = async (output, context) => {
101
- if (output.statusCode >= 300) {
102
- return de_GetRecommendationCommandError(output, context);
103
- }
104
- const data = await parseBody(output.body, context);
105
- let contents = {};
106
- contents = de_GetRecommendationResponse(data, context);
107
- const response = {
108
- $metadata: deserializeMetadata(output),
109
- ...contents,
110
- };
111
- return response;
112
- };
113
- exports.de_GetRecommendationCommand = de_GetRecommendationCommand;
114
- const de_GetRecommendationCommandError = async (output, context) => {
115
- const parsedOutput = {
116
- ...output,
117
- body: await parseErrorBody(output.body, context),
118
- };
119
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
120
- switch (errorCode) {
121
- case "AccessDeniedException":
122
- case "com.amazonaws.costoptimizationhub#AccessDeniedException":
123
- throw await de_AccessDeniedExceptionRes(parsedOutput, context);
124
- case "InternalServerException":
125
- case "com.amazonaws.costoptimizationhub#InternalServerException":
126
- throw await de_InternalServerExceptionRes(parsedOutput, context);
127
- case "ResourceNotFoundException":
128
- case "com.amazonaws.costoptimizationhub#ResourceNotFoundException":
129
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
130
- case "ThrottlingException":
131
- case "com.amazonaws.costoptimizationhub#ThrottlingException":
132
- throw await de_ThrottlingExceptionRes(parsedOutput, context);
133
- case "ValidationException":
134
- case "com.amazonaws.costoptimizationhub#ValidationException":
135
- throw await de_ValidationExceptionRes(parsedOutput, context);
136
- default:
137
- const parsedBody = parsedOutput.body;
138
- return throwDefaultError({
139
- output,
140
- parsedBody,
141
- errorCode,
142
- });
143
- }
144
- };
145
- const de_ListEnrollmentStatusesCommand = async (output, context) => {
146
- if (output.statusCode >= 300) {
147
- return de_ListEnrollmentStatusesCommandError(output, context);
148
- }
149
- const data = await parseBody(output.body, context);
150
- let contents = {};
151
- contents = de_ListEnrollmentStatusesResponse(data, context);
152
- const response = {
153
- $metadata: deserializeMetadata(output),
154
- ...contents,
155
- };
156
- return response;
157
- };
158
- exports.de_ListEnrollmentStatusesCommand = de_ListEnrollmentStatusesCommand;
159
- const de_ListEnrollmentStatusesCommandError = async (output, context) => {
160
- const parsedOutput = {
161
- ...output,
162
- body: await parseErrorBody(output.body, context),
163
- };
164
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
165
- switch (errorCode) {
166
- case "AccessDeniedException":
167
- case "com.amazonaws.costoptimizationhub#AccessDeniedException":
168
- throw await de_AccessDeniedExceptionRes(parsedOutput, context);
169
- case "InternalServerException":
170
- case "com.amazonaws.costoptimizationhub#InternalServerException":
171
- throw await de_InternalServerExceptionRes(parsedOutput, context);
172
- case "ThrottlingException":
173
- case "com.amazonaws.costoptimizationhub#ThrottlingException":
174
- throw await de_ThrottlingExceptionRes(parsedOutput, context);
175
- case "ValidationException":
176
- case "com.amazonaws.costoptimizationhub#ValidationException":
177
- throw await de_ValidationExceptionRes(parsedOutput, context);
178
- default:
179
- const parsedBody = parsedOutput.body;
180
- return throwDefaultError({
181
- output,
182
- parsedBody,
183
- errorCode,
184
- });
185
- }
186
- };
187
- const de_ListRecommendationsCommand = async (output, context) => {
188
- if (output.statusCode >= 300) {
189
- return de_ListRecommendationsCommandError(output, context);
190
- }
191
- const data = await parseBody(output.body, context);
192
- let contents = {};
193
- contents = de_ListRecommendationsResponse(data, context);
194
- const response = {
195
- $metadata: deserializeMetadata(output),
196
- ...contents,
197
- };
198
- return response;
199
- };
200
- exports.de_ListRecommendationsCommand = de_ListRecommendationsCommand;
201
- const de_ListRecommendationsCommandError = async (output, context) => {
202
- const parsedOutput = {
203
- ...output,
204
- body: await parseErrorBody(output.body, context),
205
- };
206
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
207
- switch (errorCode) {
208
- case "AccessDeniedException":
209
- case "com.amazonaws.costoptimizationhub#AccessDeniedException":
210
- throw await de_AccessDeniedExceptionRes(parsedOutput, context);
211
- case "InternalServerException":
212
- case "com.amazonaws.costoptimizationhub#InternalServerException":
213
- throw await de_InternalServerExceptionRes(parsedOutput, context);
214
- case "ThrottlingException":
215
- case "com.amazonaws.costoptimizationhub#ThrottlingException":
216
- throw await de_ThrottlingExceptionRes(parsedOutput, context);
217
- case "ValidationException":
218
- case "com.amazonaws.costoptimizationhub#ValidationException":
219
- throw await de_ValidationExceptionRes(parsedOutput, context);
220
- default:
221
- const parsedBody = parsedOutput.body;
222
- return throwDefaultError({
223
- output,
224
- parsedBody,
225
- errorCode,
226
- });
227
- }
228
- };
229
- const de_ListRecommendationSummariesCommand = async (output, context) => {
230
- if (output.statusCode >= 300) {
231
- return de_ListRecommendationSummariesCommandError(output, context);
232
- }
233
- const data = await parseBody(output.body, context);
234
- let contents = {};
235
- contents = de_ListRecommendationSummariesResponse(data, context);
236
- const response = {
237
- $metadata: deserializeMetadata(output),
238
- ...contents,
239
- };
240
- return response;
241
- };
242
- exports.de_ListRecommendationSummariesCommand = de_ListRecommendationSummariesCommand;
243
- const de_ListRecommendationSummariesCommandError = async (output, context) => {
244
- const parsedOutput = {
245
- ...output,
246
- body: await parseErrorBody(output.body, context),
247
- };
248
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
249
- switch (errorCode) {
250
- case "AccessDeniedException":
251
- case "com.amazonaws.costoptimizationhub#AccessDeniedException":
252
- throw await de_AccessDeniedExceptionRes(parsedOutput, context);
253
- case "InternalServerException":
254
- case "com.amazonaws.costoptimizationhub#InternalServerException":
255
- throw await de_InternalServerExceptionRes(parsedOutput, context);
256
- case "ThrottlingException":
257
- case "com.amazonaws.costoptimizationhub#ThrottlingException":
258
- throw await de_ThrottlingExceptionRes(parsedOutput, context);
259
- case "ValidationException":
260
- case "com.amazonaws.costoptimizationhub#ValidationException":
261
- throw await de_ValidationExceptionRes(parsedOutput, context);
262
- default:
263
- const parsedBody = parsedOutput.body;
264
- return throwDefaultError({
265
- output,
266
- parsedBody,
267
- errorCode,
268
- });
269
- }
270
- };
271
- const de_UpdateEnrollmentStatusCommand = async (output, context) => {
272
- if (output.statusCode >= 300) {
273
- return de_UpdateEnrollmentStatusCommandError(output, context);
274
- }
275
- const data = await parseBody(output.body, context);
276
- let contents = {};
277
- contents = (0, smithy_client_1._json)(data);
278
- const response = {
279
- $metadata: deserializeMetadata(output),
280
- ...contents,
281
- };
282
- return response;
283
- };
284
- exports.de_UpdateEnrollmentStatusCommand = de_UpdateEnrollmentStatusCommand;
285
- const de_UpdateEnrollmentStatusCommandError = async (output, context) => {
286
- const parsedOutput = {
287
- ...output,
288
- body: await parseErrorBody(output.body, context),
289
- };
290
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
291
- switch (errorCode) {
292
- case "AccessDeniedException":
293
- case "com.amazonaws.costoptimizationhub#AccessDeniedException":
294
- throw await de_AccessDeniedExceptionRes(parsedOutput, context);
295
- case "InternalServerException":
296
- case "com.amazonaws.costoptimizationhub#InternalServerException":
297
- throw await de_InternalServerExceptionRes(parsedOutput, context);
298
- case "ThrottlingException":
299
- case "com.amazonaws.costoptimizationhub#ThrottlingException":
300
- throw await de_ThrottlingExceptionRes(parsedOutput, context);
301
- case "ValidationException":
302
- case "com.amazonaws.costoptimizationhub#ValidationException":
303
- throw await de_ValidationExceptionRes(parsedOutput, context);
304
- default:
305
- const parsedBody = parsedOutput.body;
306
- return throwDefaultError({
307
- output,
308
- parsedBody,
309
- errorCode,
310
- });
311
- }
312
- };
313
- const de_UpdatePreferencesCommand = async (output, context) => {
314
- if (output.statusCode >= 300) {
315
- return de_UpdatePreferencesCommandError(output, context);
316
- }
317
- const data = await parseBody(output.body, context);
318
- let contents = {};
319
- contents = (0, smithy_client_1._json)(data);
320
- const response = {
321
- $metadata: deserializeMetadata(output),
322
- ...contents,
323
- };
324
- return response;
325
- };
326
- exports.de_UpdatePreferencesCommand = de_UpdatePreferencesCommand;
327
- const de_UpdatePreferencesCommandError = async (output, context) => {
328
- const parsedOutput = {
329
- ...output,
330
- body: await parseErrorBody(output.body, context),
331
- };
332
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
333
- switch (errorCode) {
334
- case "AccessDeniedException":
335
- case "com.amazonaws.costoptimizationhub#AccessDeniedException":
336
- throw await de_AccessDeniedExceptionRes(parsedOutput, context);
337
- case "InternalServerException":
338
- case "com.amazonaws.costoptimizationhub#InternalServerException":
339
- throw await de_InternalServerExceptionRes(parsedOutput, context);
340
- case "ThrottlingException":
341
- case "com.amazonaws.costoptimizationhub#ThrottlingException":
342
- throw await de_ThrottlingExceptionRes(parsedOutput, context);
343
- case "ValidationException":
344
- case "com.amazonaws.costoptimizationhub#ValidationException":
345
- throw await de_ValidationExceptionRes(parsedOutput, context);
346
- default:
347
- const parsedBody = parsedOutput.body;
348
- return throwDefaultError({
349
- output,
350
- parsedBody,
351
- errorCode,
352
- });
353
- }
354
- };
355
- const de_AccessDeniedExceptionRes = async (parsedOutput, context) => {
356
- const body = parsedOutput.body;
357
- const deserialized = (0, smithy_client_1._json)(body);
358
- const exception = new models_0_1.AccessDeniedException({
359
- $metadata: deserializeMetadata(parsedOutput),
360
- ...deserialized,
361
- });
362
- return (0, smithy_client_1.decorateServiceException)(exception, body);
363
- };
364
- const de_InternalServerExceptionRes = async (parsedOutput, context) => {
365
- const body = parsedOutput.body;
366
- const deserialized = (0, smithy_client_1._json)(body);
367
- const exception = new models_0_1.InternalServerException({
368
- $metadata: deserializeMetadata(parsedOutput),
369
- ...deserialized,
370
- });
371
- return (0, smithy_client_1.decorateServiceException)(exception, body);
372
- };
373
- const de_ResourceNotFoundExceptionRes = async (parsedOutput, context) => {
374
- const body = parsedOutput.body;
375
- const deserialized = (0, smithy_client_1._json)(body);
376
- const exception = new models_0_1.ResourceNotFoundException({
377
- $metadata: deserializeMetadata(parsedOutput),
378
- ...deserialized,
379
- });
380
- return (0, smithy_client_1.decorateServiceException)(exception, body);
381
- };
382
- const de_ThrottlingExceptionRes = async (parsedOutput, context) => {
383
- const body = parsedOutput.body;
384
- const deserialized = (0, smithy_client_1._json)(body);
385
- const exception = new models_0_1.ThrottlingException({
386
- $metadata: deserializeMetadata(parsedOutput),
387
- ...deserialized,
388
- });
389
- return (0, smithy_client_1.decorateServiceException)(exception, body);
390
- };
391
- const de_ValidationExceptionRes = async (parsedOutput, context) => {
392
- const body = parsedOutput.body;
393
- const deserialized = (0, smithy_client_1._json)(body);
394
- const exception = new models_0_1.ValidationException({
395
- $metadata: deserializeMetadata(parsedOutput),
396
- ...deserialized,
397
- });
398
- return (0, smithy_client_1.decorateServiceException)(exception, body);
399
- };
400
- const de_AccountEnrollmentStatus = (output, context) => {
401
- return (0, smithy_client_1.take)(output, {
402
- accountId: smithy_client_1.expectString,
403
- createdTimestamp: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))),
404
- lastUpdatedTimestamp: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))),
405
- status: smithy_client_1.expectString,
406
- });
407
- };
408
- const de_AccountEnrollmentStatuses = (output, context) => {
409
- const retVal = (output || [])
410
- .filter((e) => e != null)
411
- .map((entry) => {
412
- return de_AccountEnrollmentStatus(entry, context);
413
- });
414
- return retVal;
415
- };
416
- const de_BlockStoragePerformanceConfiguration = (output, context) => {
417
- return (0, smithy_client_1.take)(output, {
418
- iops: smithy_client_1.limitedParseDouble,
419
- throughput: smithy_client_1.limitedParseDouble,
420
- });
421
- };
422
- const de_ComputeConfiguration = (output, context) => {
423
- return (0, smithy_client_1.take)(output, {
424
- architecture: smithy_client_1.expectString,
425
- memorySizeInMB: smithy_client_1.expectInt32,
426
- platform: smithy_client_1.expectString,
427
- vCpu: smithy_client_1.limitedParseDouble,
428
- });
429
- };
430
- const de_ComputeSavingsPlans = (output, context) => {
431
- return (0, smithy_client_1.take)(output, {
432
- configuration: smithy_client_1._json,
433
- costCalculation: (_) => de_SavingsPlansCostCalculation(_, context),
434
- });
435
- };
436
- const de_EbsVolume = (output, context) => {
437
- return (0, smithy_client_1.take)(output, {
438
- configuration: (_) => de_EbsVolumeConfiguration(_, context),
439
- costCalculation: (_) => de_ResourceCostCalculation(_, context),
440
- });
441
- };
442
- const de_EbsVolumeConfiguration = (output, context) => {
443
- return (0, smithy_client_1.take)(output, {
444
- attachmentState: smithy_client_1.expectString,
445
- performance: (_) => de_BlockStoragePerformanceConfiguration(_, context),
446
- storage: (_) => de_StorageConfiguration(_, context),
447
- });
448
- };
449
- const de_Ec2AutoScalingGroup = (output, context) => {
450
- return (0, smithy_client_1.take)(output, {
451
- configuration: smithy_client_1._json,
452
- costCalculation: (_) => de_ResourceCostCalculation(_, context),
453
- });
454
- };
455
- const de_Ec2Instance = (output, context) => {
456
- return (0, smithy_client_1.take)(output, {
457
- configuration: smithy_client_1._json,
458
- costCalculation: (_) => de_ResourceCostCalculation(_, context),
459
- });
460
- };
461
- const de_Ec2InstanceSavingsPlans = (output, context) => {
462
- return (0, smithy_client_1.take)(output, {
463
- configuration: smithy_client_1._json,
464
- costCalculation: (_) => de_SavingsPlansCostCalculation(_, context),
465
- });
466
- };
467
- const de_Ec2ReservedInstances = (output, context) => {
468
- return (0, smithy_client_1.take)(output, {
469
- configuration: smithy_client_1._json,
470
- costCalculation: (_) => de_ReservedInstancesCostCalculation(_, context),
471
- });
472
- };
473
- const de_EcsService = (output, context) => {
474
- return (0, smithy_client_1.take)(output, {
475
- configuration: (_) => de_EcsServiceConfiguration(_, context),
476
- costCalculation: (_) => de_ResourceCostCalculation(_, context),
477
- });
478
- };
479
- const de_EcsServiceConfiguration = (output, context) => {
480
- return (0, smithy_client_1.take)(output, {
481
- compute: (_) => de_ComputeConfiguration(_, context),
482
- });
483
- };
484
- const de_ElastiCacheReservedInstances = (output, context) => {
485
- return (0, smithy_client_1.take)(output, {
486
- configuration: smithy_client_1._json,
487
- costCalculation: (_) => de_ReservedInstancesCostCalculation(_, context),
488
- });
489
- };
490
- const de_EstimatedDiscounts = (output, context) => {
491
- return (0, smithy_client_1.take)(output, {
492
- otherDiscount: smithy_client_1.limitedParseDouble,
493
- reservedInstancesDiscount: smithy_client_1.limitedParseDouble,
494
- savingsPlansDiscount: smithy_client_1.limitedParseDouble,
495
- });
496
- };
497
- const de_GetRecommendationResponse = (output, context) => {
498
- return (0, smithy_client_1.take)(output, {
499
- accountId: smithy_client_1.expectString,
500
- actionType: smithy_client_1.expectString,
501
- costCalculationLookbackPeriodInDays: smithy_client_1.expectInt32,
502
- currencyCode: smithy_client_1.expectString,
503
- currentResourceDetails: (_) => de_ResourceDetails((0, core_1.awsExpectUnion)(_), context),
504
- currentResourceType: smithy_client_1.expectString,
505
- estimatedMonthlyCost: smithy_client_1.limitedParseDouble,
506
- estimatedMonthlySavings: smithy_client_1.limitedParseDouble,
507
- estimatedSavingsOverCostCalculationLookbackPeriod: smithy_client_1.limitedParseDouble,
508
- estimatedSavingsPercentage: smithy_client_1.limitedParseDouble,
509
- implementationEffort: smithy_client_1.expectString,
510
- lastRefreshTimestamp: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))),
511
- recommendationId: smithy_client_1.expectString,
512
- recommendationLookbackPeriodInDays: smithy_client_1.expectInt32,
513
- recommendedResourceDetails: (_) => de_ResourceDetails((0, core_1.awsExpectUnion)(_), context),
514
- recommendedResourceType: smithy_client_1.expectString,
515
- region: smithy_client_1.expectString,
516
- resourceArn: smithy_client_1.expectString,
517
- resourceId: smithy_client_1.expectString,
518
- restartNeeded: smithy_client_1.expectBoolean,
519
- rollbackPossible: smithy_client_1.expectBoolean,
520
- source: smithy_client_1.expectString,
521
- tags: smithy_client_1._json,
522
- });
523
- };
524
- const de_LambdaFunction = (output, context) => {
525
- return (0, smithy_client_1.take)(output, {
526
- configuration: (_) => de_LambdaFunctionConfiguration(_, context),
527
- costCalculation: (_) => de_ResourceCostCalculation(_, context),
528
- });
529
- };
530
- const de_LambdaFunctionConfiguration = (output, context) => {
531
- return (0, smithy_client_1.take)(output, {
532
- compute: (_) => de_ComputeConfiguration(_, context),
533
- });
534
- };
535
- const de_ListEnrollmentStatusesResponse = (output, context) => {
536
- return (0, smithy_client_1.take)(output, {
537
- items: (_) => de_AccountEnrollmentStatuses(_, context),
538
- nextToken: smithy_client_1.expectString,
539
- });
540
- };
541
- const de_ListRecommendationsResponse = (output, context) => {
542
- return (0, smithy_client_1.take)(output, {
543
- items: (_) => de_RecommendationList(_, context),
544
- nextToken: smithy_client_1.expectString,
545
- });
546
- };
547
- const de_ListRecommendationSummariesResponse = (output, context) => {
548
- return (0, smithy_client_1.take)(output, {
549
- currencyCode: smithy_client_1.expectString,
550
- estimatedTotalDedupedSavings: smithy_client_1.limitedParseDouble,
551
- groupBy: smithy_client_1.expectString,
552
- items: (_) => de_RecommendationSummariesList(_, context),
553
- nextToken: smithy_client_1.expectString,
554
- });
555
- };
556
- const de_OpenSearchReservedInstances = (output, context) => {
557
- return (0, smithy_client_1.take)(output, {
558
- configuration: smithy_client_1._json,
559
- costCalculation: (_) => de_ReservedInstancesCostCalculation(_, context),
560
- });
561
- };
562
- const de_RdsReservedInstances = (output, context) => {
563
- return (0, smithy_client_1.take)(output, {
564
- configuration: smithy_client_1._json,
565
- costCalculation: (_) => de_ReservedInstancesCostCalculation(_, context),
566
- });
567
- };
568
- const de_Recommendation = (output, context) => {
569
- return (0, smithy_client_1.take)(output, {
570
- accountId: smithy_client_1.expectString,
571
- actionType: smithy_client_1.expectString,
572
- currencyCode: smithy_client_1.expectString,
573
- currentResourceSummary: smithy_client_1.expectString,
574
- currentResourceType: smithy_client_1.expectString,
575
- estimatedMonthlyCost: smithy_client_1.limitedParseDouble,
576
- estimatedMonthlySavings: smithy_client_1.limitedParseDouble,
577
- estimatedSavingsPercentage: smithy_client_1.limitedParseDouble,
578
- implementationEffort: smithy_client_1.expectString,
579
- lastRefreshTimestamp: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))),
580
- recommendationId: smithy_client_1.expectString,
581
- recommendationLookbackPeriodInDays: smithy_client_1.expectInt32,
582
- recommendedResourceSummary: smithy_client_1.expectString,
583
- recommendedResourceType: smithy_client_1.expectString,
584
- region: smithy_client_1.expectString,
585
- resourceArn: smithy_client_1.expectString,
586
- resourceId: smithy_client_1.expectString,
587
- restartNeeded: smithy_client_1.expectBoolean,
588
- rollbackPossible: smithy_client_1.expectBoolean,
589
- source: smithy_client_1.expectString,
590
- tags: smithy_client_1._json,
591
- });
592
- };
593
- const de_RecommendationList = (output, context) => {
594
- const retVal = (output || [])
595
- .filter((e) => e != null)
596
- .map((entry) => {
597
- return de_Recommendation(entry, context);
598
- });
599
- return retVal;
600
- };
601
- const de_RecommendationSummariesList = (output, context) => {
602
- const retVal = (output || [])
603
- .filter((e) => e != null)
604
- .map((entry) => {
605
- return de_RecommendationSummary(entry, context);
606
- });
607
- return retVal;
608
- };
609
- const de_RecommendationSummary = (output, context) => {
610
- return (0, smithy_client_1.take)(output, {
611
- estimatedMonthlySavings: smithy_client_1.limitedParseDouble,
612
- group: smithy_client_1.expectString,
613
- recommendationCount: smithy_client_1.expectInt32,
614
- });
615
- };
616
- const de_RedshiftReservedInstances = (output, context) => {
617
- return (0, smithy_client_1.take)(output, {
618
- configuration: smithy_client_1._json,
619
- costCalculation: (_) => de_ReservedInstancesCostCalculation(_, context),
620
- });
621
- };
622
- const de_ReservedInstancesCostCalculation = (output, context) => {
623
- return (0, smithy_client_1.take)(output, {
624
- pricing: (_) => de_ReservedInstancesPricing(_, context),
625
- });
626
- };
627
- const de_ReservedInstancesPricing = (output, context) => {
628
- return (0, smithy_client_1.take)(output, {
629
- estimatedMonthlyAmortizedReservationCost: smithy_client_1.limitedParseDouble,
630
- estimatedOnDemandCost: smithy_client_1.limitedParseDouble,
631
- monthlyReservationEligibleCost: smithy_client_1.limitedParseDouble,
632
- savingsPercentage: smithy_client_1.limitedParseDouble,
633
- });
634
- };
635
- const de_ResourceCostCalculation = (output, context) => {
636
- return (0, smithy_client_1.take)(output, {
637
- pricing: (_) => de_ResourcePricing(_, context),
638
- usages: (_) => de_UsageList(_, context),
639
- });
640
- };
641
- const de_ResourceDetails = (output, context) => {
642
- if (output.computeSavingsPlans != null) {
643
- return {
644
- computeSavingsPlans: de_ComputeSavingsPlans(output.computeSavingsPlans, context),
645
- };
646
- }
647
- if (output.ebsVolume != null) {
648
- return {
649
- ebsVolume: de_EbsVolume(output.ebsVolume, context),
650
- };
651
- }
652
- if (output.ec2AutoScalingGroup != null) {
653
- return {
654
- ec2AutoScalingGroup: de_Ec2AutoScalingGroup(output.ec2AutoScalingGroup, context),
655
- };
656
- }
657
- if (output.ec2Instance != null) {
658
- return {
659
- ec2Instance: de_Ec2Instance(output.ec2Instance, context),
660
- };
661
- }
662
- if (output.ec2InstanceSavingsPlans != null) {
663
- return {
664
- ec2InstanceSavingsPlans: de_Ec2InstanceSavingsPlans(output.ec2InstanceSavingsPlans, context),
665
- };
666
- }
667
- if (output.ec2ReservedInstances != null) {
668
- return {
669
- ec2ReservedInstances: de_Ec2ReservedInstances(output.ec2ReservedInstances, context),
670
- };
671
- }
672
- if (output.ecsService != null) {
673
- return {
674
- ecsService: de_EcsService(output.ecsService, context),
675
- };
676
- }
677
- if (output.elastiCacheReservedInstances != null) {
678
- return {
679
- elastiCacheReservedInstances: de_ElastiCacheReservedInstances(output.elastiCacheReservedInstances, context),
680
- };
681
- }
682
- if (output.lambdaFunction != null) {
683
- return {
684
- lambdaFunction: de_LambdaFunction(output.lambdaFunction, context),
685
- };
686
- }
687
- if (output.openSearchReservedInstances != null) {
688
- return {
689
- openSearchReservedInstances: de_OpenSearchReservedInstances(output.openSearchReservedInstances, context),
690
- };
691
- }
692
- if (output.rdsReservedInstances != null) {
693
- return {
694
- rdsReservedInstances: de_RdsReservedInstances(output.rdsReservedInstances, context),
695
- };
696
- }
697
- if (output.redshiftReservedInstances != null) {
698
- return {
699
- redshiftReservedInstances: de_RedshiftReservedInstances(output.redshiftReservedInstances, context),
700
- };
701
- }
702
- if (output.sageMakerSavingsPlans != null) {
703
- return {
704
- sageMakerSavingsPlans: de_SageMakerSavingsPlans(output.sageMakerSavingsPlans, context),
705
- };
706
- }
707
- return { $unknown: Object.entries(output)[0] };
708
- };
709
- const de_ResourcePricing = (output, context) => {
710
- return (0, smithy_client_1.take)(output, {
711
- estimatedCostAfterDiscounts: smithy_client_1.limitedParseDouble,
712
- estimatedCostBeforeDiscounts: smithy_client_1.limitedParseDouble,
713
- estimatedDiscounts: (_) => de_EstimatedDiscounts(_, context),
714
- estimatedNetUnusedAmortizedCommitments: smithy_client_1.limitedParseDouble,
715
- });
716
- };
717
- const de_SageMakerSavingsPlans = (output, context) => {
718
- return (0, smithy_client_1.take)(output, {
719
- configuration: smithy_client_1._json,
720
- costCalculation: (_) => de_SavingsPlansCostCalculation(_, context),
721
- });
722
- };
723
- const de_SavingsPlansCostCalculation = (output, context) => {
724
- return (0, smithy_client_1.take)(output, {
725
- pricing: (_) => de_SavingsPlansPricing(_, context),
726
- });
727
- };
728
- const de_SavingsPlansPricing = (output, context) => {
729
- return (0, smithy_client_1.take)(output, {
730
- estimatedMonthlyCommitment: smithy_client_1.limitedParseDouble,
731
- estimatedOnDemandCost: smithy_client_1.limitedParseDouble,
732
- monthlySavingsPlansEligibleCost: smithy_client_1.limitedParseDouble,
733
- savingsPercentage: smithy_client_1.limitedParseDouble,
734
- });
735
- };
736
- const de_StorageConfiguration = (output, context) => {
737
- return (0, smithy_client_1.take)(output, {
738
- sizeInGb: smithy_client_1.limitedParseDouble,
739
- type: smithy_client_1.expectString,
740
- });
741
- };
742
- const de_Usage = (output, context) => {
743
- return (0, smithy_client_1.take)(output, {
744
- operation: smithy_client_1.expectString,
745
- productCode: smithy_client_1.expectString,
746
- unit: smithy_client_1.expectString,
747
- usageAmount: smithy_client_1.limitedParseDouble,
748
- usageType: smithy_client_1.expectString,
749
- });
750
- };
751
- const de_UsageList = (output, context) => {
752
- const retVal = (output || [])
753
- .filter((e) => e != null)
754
- .map((entry) => {
755
- return de_Usage(entry, context);
756
- });
757
- return retVal;
758
- };
759
- const deserializeMetadata = (output) => ({
760
- httpStatusCode: output.statusCode,
761
- requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
762
- extendedRequestId: output.headers["x-amz-id-2"],
763
- cfId: output.headers["x-amz-cf-id"],
764
- });
765
- const collectBodyString = (streamBody, context) => (0, smithy_client_1.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body));
766
- const throwDefaultError = (0, smithy_client_1.withBaseException)(CostOptimizationHubServiceException_1.CostOptimizationHubServiceException);
767
- const buildHttpRpcRequest = async (context, headers, path, resolvedHostname, body) => {
768
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
769
- const contents = {
770
- protocol,
771
- hostname,
772
- port,
773
- method: "POST",
774
- path: basePath.endsWith("/") ? basePath.slice(0, -1) + path : basePath + path,
775
- headers,
776
- };
777
- if (resolvedHostname !== undefined) {
778
- contents.hostname = resolvedHostname;
779
- }
780
- if (body !== undefined) {
781
- contents.body = body;
782
- }
783
- return new protocol_http_1.HttpRequest(contents);
784
- };
785
- function sharedHeaders(operation) {
786
- return {
787
- "content-type": "application/x-amz-json-1.0",
788
- "x-amz-target": `CostOptimizationHubService.${operation}`,
789
- };
790
- }
791
- const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
792
- if (encoded.length) {
793
- return JSON.parse(encoded);
794
- }
795
- return {};
796
- });
797
- const parseErrorBody = async (errorBody, context) => {
798
- const value = await parseBody(errorBody, context);
799
- value.message = value.message ?? value.Message;
800
- return value;
801
- };
802
- const loadRestJsonErrorCode = (output, data) => {
803
- const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
804
- const sanitizeErrorCode = (rawValue) => {
805
- let cleanValue = rawValue;
806
- if (typeof cleanValue === "number") {
807
- cleanValue = cleanValue.toString();
808
- }
809
- if (cleanValue.indexOf(",") >= 0) {
810
- cleanValue = cleanValue.split(",")[0];
811
- }
812
- if (cleanValue.indexOf(":") >= 0) {
813
- cleanValue = cleanValue.split(":")[0];
814
- }
815
- if (cleanValue.indexOf("#") >= 0) {
816
- cleanValue = cleanValue.split("#")[1];
817
- }
818
- return cleanValue;
819
- };
820
- const headerKey = findKey(output.headers, "x-amzn-errortype");
821
- if (headerKey !== undefined) {
822
- return sanitizeErrorCode(output.headers[headerKey]);
823
- }
824
- if (data.code !== undefined) {
825
- return sanitizeErrorCode(data.code);
826
- }
827
- if (data["__type"] !== undefined) {
828
- return sanitizeErrorCode(data["__type"]);
829
- }
830
- };
1
+ module.exports = require("../index.js");