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