@aws-sdk/client-applicationcostprofiler 3.35.0 → 3.38.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 (125) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/dist-cjs/ApplicationCostProfiler.js +0 -9
  3. package/dist-cjs/ApplicationCostProfilerClient.js +0 -14
  4. package/dist-cjs/commands/DeleteReportDefinitionCommand.js +0 -26
  5. package/dist-cjs/commands/GetReportDefinitionCommand.js +0 -25
  6. package/dist-cjs/commands/ImportApplicationUsageCommand.js +0 -28
  7. package/dist-cjs/commands/ListReportDefinitionsCommand.js +0 -26
  8. package/dist-cjs/commands/PutReportDefinitionCommand.js +0 -25
  9. package/dist-cjs/commands/UpdateReportDefinitionCommand.js +0 -25
  10. package/dist-cjs/commands/index.js +9 -0
  11. package/dist-cjs/endpoints.js +1 -2
  12. package/dist-cjs/index.js +4 -11
  13. package/dist-cjs/models/index.js +0 -1
  14. package/dist-cjs/models/models_0.js +0 -61
  15. package/dist-cjs/pagination/Interfaces.js +0 -1
  16. package/dist-cjs/pagination/ListReportDefinitionsPaginator.js +0 -11
  17. package/dist-cjs/pagination/index.js +5 -0
  18. package/dist-cjs/protocols/Aws_restJson1.js +0 -6
  19. package/dist-cjs/runtimeConfig.browser.js +1 -6
  20. package/dist-cjs/runtimeConfig.js +2 -7
  21. package/dist-cjs/runtimeConfig.native.js +0 -4
  22. package/dist-cjs/runtimeConfig.shared.js +0 -4
  23. package/dist-es/ApplicationCostProfiler.js +0 -1
  24. package/dist-es/ApplicationCostProfilerClient.js +0 -1
  25. package/dist-es/commands/DeleteReportDefinitionCommand.js +0 -1
  26. package/dist-es/commands/GetReportDefinitionCommand.js +0 -1
  27. package/dist-es/commands/ImportApplicationUsageCommand.js +0 -1
  28. package/dist-es/commands/ListReportDefinitionsCommand.js +0 -1
  29. package/dist-es/commands/PutReportDefinitionCommand.js +0 -1
  30. package/dist-es/commands/UpdateReportDefinitionCommand.js +0 -1
  31. package/dist-es/commands/index.js +6 -0
  32. package/dist-es/endpoints.js +1 -2
  33. package/dist-es/index.js +4 -11
  34. package/dist-es/models/index.js +0 -1
  35. package/dist-es/models/models_0.js +0 -1
  36. package/dist-es/pagination/Interfaces.js +0 -1
  37. package/dist-es/pagination/ListReportDefinitionsPaginator.js +0 -1
  38. package/dist-es/pagination/index.js +2 -0
  39. package/dist-es/protocols/Aws_restJson1.js +0 -1
  40. package/dist-es/runtimeConfig.browser.js +1 -2
  41. package/dist-es/runtimeConfig.js +2 -3
  42. package/dist-es/runtimeConfig.native.js +0 -1
  43. package/dist-es/runtimeConfig.shared.js +0 -1
  44. package/dist-types/commands/index.d.ts +6 -0
  45. package/dist-types/index.d.ts +4 -10
  46. package/dist-types/pagination/index.d.ts +2 -0
  47. package/dist-types/runtimeConfig.browser.d.ts +3 -0
  48. package/dist-types/ts3.4/ApplicationCostProfiler.d.ts +7 -31
  49. package/dist-types/ts3.4/ApplicationCostProfilerClient.d.ts +24 -94
  50. package/dist-types/ts3.4/commands/DeleteReportDefinitionCommand.d.ts +2 -21
  51. package/dist-types/ts3.4/commands/GetReportDefinitionCommand.d.ts +2 -20
  52. package/dist-types/ts3.4/commands/ImportApplicationUsageCommand.d.ts +2 -23
  53. package/dist-types/ts3.4/commands/ListReportDefinitionsCommand.d.ts +2 -21
  54. package/dist-types/ts3.4/commands/PutReportDefinitionCommand.d.ts +2 -20
  55. package/dist-types/ts3.4/commands/UpdateReportDefinitionCommand.d.ts +2 -20
  56. package/dist-types/ts3.4/commands/index.d.ts +6 -0
  57. package/dist-types/ts3.4/index.d.ts +4 -10
  58. package/dist-types/ts3.4/models/models_0.d.ts +68 -211
  59. package/dist-types/ts3.4/pagination/index.d.ts +2 -0
  60. package/dist-types/ts3.4/runtimeConfig.browser.d.ts +2 -3
  61. package/dist-types/ts3.4/runtimeConfig.d.ts +1 -3
  62. package/dist-types/ts3.4/runtimeConfig.native.d.ts +1 -3
  63. package/dist-types/ts3.4/runtimeConfig.shared.d.ts +1 -3
  64. package/package.json +33 -30
  65. package/dist-cjs/ApplicationCostProfiler.js.map +0 -1
  66. package/dist-cjs/ApplicationCostProfilerClient.js.map +0 -1
  67. package/dist-cjs/commands/DeleteReportDefinitionCommand.js.map +0 -1
  68. package/dist-cjs/commands/GetReportDefinitionCommand.js.map +0 -1
  69. package/dist-cjs/commands/ImportApplicationUsageCommand.js.map +0 -1
  70. package/dist-cjs/commands/ListReportDefinitionsCommand.js.map +0 -1
  71. package/dist-cjs/commands/PutReportDefinitionCommand.js.map +0 -1
  72. package/dist-cjs/commands/UpdateReportDefinitionCommand.js.map +0 -1
  73. package/dist-cjs/endpoints.js.map +0 -1
  74. package/dist-cjs/index.js.map +0 -1
  75. package/dist-cjs/models/index.js.map +0 -1
  76. package/dist-cjs/models/models_0.js.map +0 -1
  77. package/dist-cjs/pagination/Interfaces.js.map +0 -1
  78. package/dist-cjs/pagination/ListReportDefinitionsPaginator.js.map +0 -1
  79. package/dist-cjs/protocols/Aws_restJson1.js.map +0 -1
  80. package/dist-cjs/runtimeConfig.browser.js.map +0 -1
  81. package/dist-cjs/runtimeConfig.js.map +0 -1
  82. package/dist-cjs/runtimeConfig.native.js.map +0 -1
  83. package/dist-cjs/runtimeConfig.shared.js.map +0 -1
  84. package/dist-es/ApplicationCostProfiler.js.map +0 -1
  85. package/dist-es/ApplicationCostProfilerClient.js.map +0 -1
  86. package/dist-es/commands/DeleteReportDefinitionCommand.js.map +0 -1
  87. package/dist-es/commands/GetReportDefinitionCommand.js.map +0 -1
  88. package/dist-es/commands/ImportApplicationUsageCommand.js.map +0 -1
  89. package/dist-es/commands/ListReportDefinitionsCommand.js.map +0 -1
  90. package/dist-es/commands/PutReportDefinitionCommand.js.map +0 -1
  91. package/dist-es/commands/UpdateReportDefinitionCommand.js.map +0 -1
  92. package/dist-es/endpoints.js.map +0 -1
  93. package/dist-es/index.js.map +0 -1
  94. package/dist-es/models/index.js.map +0 -1
  95. package/dist-es/models/models_0.js.map +0 -1
  96. package/dist-es/pagination/Interfaces.js.map +0 -1
  97. package/dist-es/pagination/ListReportDefinitionsPaginator.js.map +0 -1
  98. package/dist-es/protocols/Aws_restJson1.js.map +0 -1
  99. package/dist-es/runtimeConfig.browser.js.map +0 -1
  100. package/dist-es/runtimeConfig.js.map +0 -1
  101. package/dist-es/runtimeConfig.native.js.map +0 -1
  102. package/dist-es/runtimeConfig.shared.js.map +0 -1
  103. package/jest.config.js +0 -4
  104. package/src/ApplicationCostProfiler.ts +0 -240
  105. package/src/ApplicationCostProfilerClient.ts +0 -277
  106. package/src/commands/DeleteReportDefinitionCommand.ts +0 -100
  107. package/src/commands/GetReportDefinitionCommand.ts +0 -99
  108. package/src/commands/ImportApplicationUsageCommand.ts +0 -102
  109. package/src/commands/ListReportDefinitionsCommand.ts +0 -100
  110. package/src/commands/PutReportDefinitionCommand.ts +0 -99
  111. package/src/commands/UpdateReportDefinitionCommand.ts +0 -99
  112. package/src/endpoints.ts +0 -57
  113. package/src/index.ts +0 -11
  114. package/src/models/index.ts +0 -1
  115. package/src/models/models_0.ts +0 -490
  116. package/src/pagination/Interfaces.ts +0 -8
  117. package/src/pagination/ListReportDefinitionsPaginator.ts +0 -59
  118. package/src/protocols/Aws_restJson1.ts +0 -952
  119. package/src/runtimeConfig.browser.ts +0 -41
  120. package/src/runtimeConfig.native.ts +0 -17
  121. package/src/runtimeConfig.shared.ts +0 -17
  122. package/src/runtimeConfig.ts +0 -46
  123. package/tsconfig.es.json +0 -10
  124. package/tsconfig.json +0 -33
  125. package/tsconfig.types.json +0 -9
@@ -1,952 +0,0 @@
1
- import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
2
- import {
3
- expectNonNull as __expectNonNull,
4
- expectNumber as __expectNumber,
5
- expectObject as __expectObject,
6
- expectString as __expectString,
7
- extendedEncodeURIComponent as __extendedEncodeURIComponent,
8
- parseEpochTimestamp as __parseEpochTimestamp,
9
- } from "@aws-sdk/smithy-client";
10
- import {
11
- Endpoint as __Endpoint,
12
- MetadataBearer as __MetadataBearer,
13
- ResponseMetadata as __ResponseMetadata,
14
- SerdeContext as __SerdeContext,
15
- SmithyException as __SmithyException,
16
- } from "@aws-sdk/types";
17
-
18
- import {
19
- DeleteReportDefinitionCommandInput,
20
- DeleteReportDefinitionCommandOutput,
21
- } from "../commands/DeleteReportDefinitionCommand";
22
- import {
23
- GetReportDefinitionCommandInput,
24
- GetReportDefinitionCommandOutput,
25
- } from "../commands/GetReportDefinitionCommand";
26
- import {
27
- ImportApplicationUsageCommandInput,
28
- ImportApplicationUsageCommandOutput,
29
- } from "../commands/ImportApplicationUsageCommand";
30
- import {
31
- ListReportDefinitionsCommandInput,
32
- ListReportDefinitionsCommandOutput,
33
- } from "../commands/ListReportDefinitionsCommand";
34
- import {
35
- PutReportDefinitionCommandInput,
36
- PutReportDefinitionCommandOutput,
37
- } from "../commands/PutReportDefinitionCommand";
38
- import {
39
- UpdateReportDefinitionCommandInput,
40
- UpdateReportDefinitionCommandOutput,
41
- } from "../commands/UpdateReportDefinitionCommand";
42
- import {
43
- AccessDeniedException,
44
- InternalServerException,
45
- ReportDefinition,
46
- S3Location,
47
- ServiceQuotaExceededException,
48
- SourceS3Location,
49
- ThrottlingException,
50
- ValidationException,
51
- } from "../models/models_0";
52
-
53
- export const serializeAws_restJson1DeleteReportDefinitionCommand = async (
54
- input: DeleteReportDefinitionCommandInput,
55
- context: __SerdeContext
56
- ): Promise<__HttpRequest> => {
57
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
58
- const headers: any = {};
59
- let resolvedPath =
60
- `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/reportDefinition/{reportId}";
61
- if (input.reportId !== undefined) {
62
- const labelValue: string = input.reportId;
63
- if (labelValue.length <= 0) {
64
- throw new Error("Empty value provided for input HTTP label: reportId.");
65
- }
66
- resolvedPath = resolvedPath.replace("{reportId}", __extendedEncodeURIComponent(labelValue));
67
- } else {
68
- throw new Error("No value provided for input HTTP label: reportId.");
69
- }
70
- let body: any;
71
- return new __HttpRequest({
72
- protocol,
73
- hostname,
74
- port,
75
- method: "DELETE",
76
- headers,
77
- path: resolvedPath,
78
- body,
79
- });
80
- };
81
-
82
- export const serializeAws_restJson1GetReportDefinitionCommand = async (
83
- input: GetReportDefinitionCommandInput,
84
- context: __SerdeContext
85
- ): Promise<__HttpRequest> => {
86
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
87
- const headers: any = {};
88
- let resolvedPath =
89
- `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/reportDefinition/{reportId}";
90
- if (input.reportId !== undefined) {
91
- const labelValue: string = input.reportId;
92
- if (labelValue.length <= 0) {
93
- throw new Error("Empty value provided for input HTTP label: reportId.");
94
- }
95
- resolvedPath = resolvedPath.replace("{reportId}", __extendedEncodeURIComponent(labelValue));
96
- } else {
97
- throw new Error("No value provided for input HTTP label: reportId.");
98
- }
99
- let body: any;
100
- return new __HttpRequest({
101
- protocol,
102
- hostname,
103
- port,
104
- method: "GET",
105
- headers,
106
- path: resolvedPath,
107
- body,
108
- });
109
- };
110
-
111
- export const serializeAws_restJson1ImportApplicationUsageCommand = async (
112
- input: ImportApplicationUsageCommandInput,
113
- context: __SerdeContext
114
- ): Promise<__HttpRequest> => {
115
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
116
- const headers: any = {
117
- "content-type": "application/json",
118
- };
119
- const resolvedPath =
120
- `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/importApplicationUsage";
121
- let body: any;
122
- body = JSON.stringify({
123
- ...(input.sourceS3Location !== undefined &&
124
- input.sourceS3Location !== null && {
125
- sourceS3Location: serializeAws_restJson1SourceS3Location(input.sourceS3Location, context),
126
- }),
127
- });
128
- return new __HttpRequest({
129
- protocol,
130
- hostname,
131
- port,
132
- method: "POST",
133
- headers,
134
- path: resolvedPath,
135
- body,
136
- });
137
- };
138
-
139
- export const serializeAws_restJson1ListReportDefinitionsCommand = async (
140
- input: ListReportDefinitionsCommandInput,
141
- context: __SerdeContext
142
- ): Promise<__HttpRequest> => {
143
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
144
- const headers: any = {};
145
- const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/reportDefinition";
146
- const query: any = {
147
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
148
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
149
- };
150
- let body: any;
151
- return new __HttpRequest({
152
- protocol,
153
- hostname,
154
- port,
155
- method: "GET",
156
- headers,
157
- path: resolvedPath,
158
- query,
159
- body,
160
- });
161
- };
162
-
163
- export const serializeAws_restJson1PutReportDefinitionCommand = async (
164
- input: PutReportDefinitionCommandInput,
165
- context: __SerdeContext
166
- ): Promise<__HttpRequest> => {
167
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
168
- const headers: any = {
169
- "content-type": "application/json",
170
- };
171
- const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/reportDefinition";
172
- let body: any;
173
- body = JSON.stringify({
174
- ...(input.destinationS3Location !== undefined &&
175
- input.destinationS3Location !== null && {
176
- destinationS3Location: serializeAws_restJson1S3Location(input.destinationS3Location, context),
177
- }),
178
- ...(input.format !== undefined && input.format !== null && { format: input.format }),
179
- ...(input.reportDescription !== undefined &&
180
- input.reportDescription !== null && { reportDescription: input.reportDescription }),
181
- ...(input.reportFrequency !== undefined &&
182
- input.reportFrequency !== null && { reportFrequency: input.reportFrequency }),
183
- ...(input.reportId !== undefined && input.reportId !== null && { reportId: input.reportId }),
184
- });
185
- return new __HttpRequest({
186
- protocol,
187
- hostname,
188
- port,
189
- method: "POST",
190
- headers,
191
- path: resolvedPath,
192
- body,
193
- });
194
- };
195
-
196
- export const serializeAws_restJson1UpdateReportDefinitionCommand = async (
197
- input: UpdateReportDefinitionCommandInput,
198
- context: __SerdeContext
199
- ): Promise<__HttpRequest> => {
200
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
201
- const headers: any = {
202
- "content-type": "application/json",
203
- };
204
- let resolvedPath =
205
- `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/reportDefinition/{reportId}";
206
- if (input.reportId !== undefined) {
207
- const labelValue: string = input.reportId;
208
- if (labelValue.length <= 0) {
209
- throw new Error("Empty value provided for input HTTP label: reportId.");
210
- }
211
- resolvedPath = resolvedPath.replace("{reportId}", __extendedEncodeURIComponent(labelValue));
212
- } else {
213
- throw new Error("No value provided for input HTTP label: reportId.");
214
- }
215
- let body: any;
216
- body = JSON.stringify({
217
- ...(input.destinationS3Location !== undefined &&
218
- input.destinationS3Location !== null && {
219
- destinationS3Location: serializeAws_restJson1S3Location(input.destinationS3Location, context),
220
- }),
221
- ...(input.format !== undefined && input.format !== null && { format: input.format }),
222
- ...(input.reportDescription !== undefined &&
223
- input.reportDescription !== null && { reportDescription: input.reportDescription }),
224
- ...(input.reportFrequency !== undefined &&
225
- input.reportFrequency !== null && { reportFrequency: input.reportFrequency }),
226
- });
227
- return new __HttpRequest({
228
- protocol,
229
- hostname,
230
- port,
231
- method: "PUT",
232
- headers,
233
- path: resolvedPath,
234
- body,
235
- });
236
- };
237
-
238
- export const deserializeAws_restJson1DeleteReportDefinitionCommand = async (
239
- output: __HttpResponse,
240
- context: __SerdeContext
241
- ): Promise<DeleteReportDefinitionCommandOutput> => {
242
- if (output.statusCode !== 200 && output.statusCode >= 300) {
243
- return deserializeAws_restJson1DeleteReportDefinitionCommandError(output, context);
244
- }
245
- const contents: DeleteReportDefinitionCommandOutput = {
246
- $metadata: deserializeMetadata(output),
247
- reportId: undefined,
248
- };
249
- const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
250
- if (data.reportId !== undefined && data.reportId !== null) {
251
- contents.reportId = __expectString(data.reportId);
252
- }
253
- return Promise.resolve(contents);
254
- };
255
-
256
- const deserializeAws_restJson1DeleteReportDefinitionCommandError = async (
257
- output: __HttpResponse,
258
- context: __SerdeContext
259
- ): Promise<DeleteReportDefinitionCommandOutput> => {
260
- const parsedOutput: any = {
261
- ...output,
262
- body: await parseBody(output.body, context),
263
- };
264
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
265
- let errorCode = "UnknownError";
266
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
267
- switch (errorCode) {
268
- case "AccessDeniedException":
269
- case "com.amazonaws.applicationcostprofiler#AccessDeniedException":
270
- response = {
271
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
272
- name: errorCode,
273
- $metadata: deserializeMetadata(output),
274
- };
275
- break;
276
- case "InternalServerException":
277
- case "com.amazonaws.applicationcostprofiler#InternalServerException":
278
- response = {
279
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
280
- name: errorCode,
281
- $metadata: deserializeMetadata(output),
282
- };
283
- break;
284
- case "ThrottlingException":
285
- case "com.amazonaws.applicationcostprofiler#ThrottlingException":
286
- response = {
287
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
288
- name: errorCode,
289
- $metadata: deserializeMetadata(output),
290
- };
291
- break;
292
- case "ValidationException":
293
- case "com.amazonaws.applicationcostprofiler#ValidationException":
294
- response = {
295
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
296
- name: errorCode,
297
- $metadata: deserializeMetadata(output),
298
- };
299
- break;
300
- default:
301
- const parsedBody = parsedOutput.body;
302
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
303
- response = {
304
- ...parsedBody,
305
- name: `${errorCode}`,
306
- message: parsedBody.message || parsedBody.Message || errorCode,
307
- $fault: "client",
308
- $metadata: deserializeMetadata(output),
309
- } as any;
310
- }
311
- const message = response.message || response.Message || errorCode;
312
- response.message = message;
313
- delete response.Message;
314
- return Promise.reject(Object.assign(new Error(message), response));
315
- };
316
-
317
- export const deserializeAws_restJson1GetReportDefinitionCommand = async (
318
- output: __HttpResponse,
319
- context: __SerdeContext
320
- ): Promise<GetReportDefinitionCommandOutput> => {
321
- if (output.statusCode !== 200 && output.statusCode >= 300) {
322
- return deserializeAws_restJson1GetReportDefinitionCommandError(output, context);
323
- }
324
- const contents: GetReportDefinitionCommandOutput = {
325
- $metadata: deserializeMetadata(output),
326
- createdAt: undefined,
327
- destinationS3Location: undefined,
328
- format: undefined,
329
- lastUpdated: undefined,
330
- reportDescription: undefined,
331
- reportFrequency: undefined,
332
- reportId: undefined,
333
- };
334
- const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
335
- if (data.createdAt !== undefined && data.createdAt !== null) {
336
- contents.createdAt = __expectNonNull(__parseEpochTimestamp(__expectNumber(data.createdAt)));
337
- }
338
- if (data.destinationS3Location !== undefined && data.destinationS3Location !== null) {
339
- contents.destinationS3Location = deserializeAws_restJson1S3Location(data.destinationS3Location, context);
340
- }
341
- if (data.format !== undefined && data.format !== null) {
342
- contents.format = __expectString(data.format);
343
- }
344
- if (data.lastUpdated !== undefined && data.lastUpdated !== null) {
345
- contents.lastUpdated = __expectNonNull(__parseEpochTimestamp(__expectNumber(data.lastUpdated)));
346
- }
347
- if (data.reportDescription !== undefined && data.reportDescription !== null) {
348
- contents.reportDescription = __expectString(data.reportDescription);
349
- }
350
- if (data.reportFrequency !== undefined && data.reportFrequency !== null) {
351
- contents.reportFrequency = __expectString(data.reportFrequency);
352
- }
353
- if (data.reportId !== undefined && data.reportId !== null) {
354
- contents.reportId = __expectString(data.reportId);
355
- }
356
- return Promise.resolve(contents);
357
- };
358
-
359
- const deserializeAws_restJson1GetReportDefinitionCommandError = async (
360
- output: __HttpResponse,
361
- context: __SerdeContext
362
- ): Promise<GetReportDefinitionCommandOutput> => {
363
- const parsedOutput: any = {
364
- ...output,
365
- body: await parseBody(output.body, context),
366
- };
367
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
368
- let errorCode = "UnknownError";
369
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
370
- switch (errorCode) {
371
- case "AccessDeniedException":
372
- case "com.amazonaws.applicationcostprofiler#AccessDeniedException":
373
- response = {
374
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
375
- name: errorCode,
376
- $metadata: deserializeMetadata(output),
377
- };
378
- break;
379
- case "InternalServerException":
380
- case "com.amazonaws.applicationcostprofiler#InternalServerException":
381
- response = {
382
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
383
- name: errorCode,
384
- $metadata: deserializeMetadata(output),
385
- };
386
- break;
387
- case "ThrottlingException":
388
- case "com.amazonaws.applicationcostprofiler#ThrottlingException":
389
- response = {
390
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
391
- name: errorCode,
392
- $metadata: deserializeMetadata(output),
393
- };
394
- break;
395
- case "ValidationException":
396
- case "com.amazonaws.applicationcostprofiler#ValidationException":
397
- response = {
398
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
399
- name: errorCode,
400
- $metadata: deserializeMetadata(output),
401
- };
402
- break;
403
- default:
404
- const parsedBody = parsedOutput.body;
405
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
406
- response = {
407
- ...parsedBody,
408
- name: `${errorCode}`,
409
- message: parsedBody.message || parsedBody.Message || errorCode,
410
- $fault: "client",
411
- $metadata: deserializeMetadata(output),
412
- } as any;
413
- }
414
- const message = response.message || response.Message || errorCode;
415
- response.message = message;
416
- delete response.Message;
417
- return Promise.reject(Object.assign(new Error(message), response));
418
- };
419
-
420
- export const deserializeAws_restJson1ImportApplicationUsageCommand = async (
421
- output: __HttpResponse,
422
- context: __SerdeContext
423
- ): Promise<ImportApplicationUsageCommandOutput> => {
424
- if (output.statusCode !== 200 && output.statusCode >= 300) {
425
- return deserializeAws_restJson1ImportApplicationUsageCommandError(output, context);
426
- }
427
- const contents: ImportApplicationUsageCommandOutput = {
428
- $metadata: deserializeMetadata(output),
429
- importId: undefined,
430
- };
431
- const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
432
- if (data.importId !== undefined && data.importId !== null) {
433
- contents.importId = __expectString(data.importId);
434
- }
435
- return Promise.resolve(contents);
436
- };
437
-
438
- const deserializeAws_restJson1ImportApplicationUsageCommandError = async (
439
- output: __HttpResponse,
440
- context: __SerdeContext
441
- ): Promise<ImportApplicationUsageCommandOutput> => {
442
- const parsedOutput: any = {
443
- ...output,
444
- body: await parseBody(output.body, context),
445
- };
446
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
447
- let errorCode = "UnknownError";
448
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
449
- switch (errorCode) {
450
- case "AccessDeniedException":
451
- case "com.amazonaws.applicationcostprofiler#AccessDeniedException":
452
- response = {
453
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
454
- name: errorCode,
455
- $metadata: deserializeMetadata(output),
456
- };
457
- break;
458
- case "InternalServerException":
459
- case "com.amazonaws.applicationcostprofiler#InternalServerException":
460
- response = {
461
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
462
- name: errorCode,
463
- $metadata: deserializeMetadata(output),
464
- };
465
- break;
466
- case "ThrottlingException":
467
- case "com.amazonaws.applicationcostprofiler#ThrottlingException":
468
- response = {
469
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
470
- name: errorCode,
471
- $metadata: deserializeMetadata(output),
472
- };
473
- break;
474
- case "ValidationException":
475
- case "com.amazonaws.applicationcostprofiler#ValidationException":
476
- response = {
477
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
478
- name: errorCode,
479
- $metadata: deserializeMetadata(output),
480
- };
481
- break;
482
- default:
483
- const parsedBody = parsedOutput.body;
484
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
485
- response = {
486
- ...parsedBody,
487
- name: `${errorCode}`,
488
- message: parsedBody.message || parsedBody.Message || errorCode,
489
- $fault: "client",
490
- $metadata: deserializeMetadata(output),
491
- } as any;
492
- }
493
- const message = response.message || response.Message || errorCode;
494
- response.message = message;
495
- delete response.Message;
496
- return Promise.reject(Object.assign(new Error(message), response));
497
- };
498
-
499
- export const deserializeAws_restJson1ListReportDefinitionsCommand = async (
500
- output: __HttpResponse,
501
- context: __SerdeContext
502
- ): Promise<ListReportDefinitionsCommandOutput> => {
503
- if (output.statusCode !== 200 && output.statusCode >= 300) {
504
- return deserializeAws_restJson1ListReportDefinitionsCommandError(output, context);
505
- }
506
- const contents: ListReportDefinitionsCommandOutput = {
507
- $metadata: deserializeMetadata(output),
508
- nextToken: undefined,
509
- reportDefinitions: undefined,
510
- };
511
- const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
512
- if (data.nextToken !== undefined && data.nextToken !== null) {
513
- contents.nextToken = __expectString(data.nextToken);
514
- }
515
- if (data.reportDefinitions !== undefined && data.reportDefinitions !== null) {
516
- contents.reportDefinitions = deserializeAws_restJson1ReportDefinitionList(data.reportDefinitions, context);
517
- }
518
- return Promise.resolve(contents);
519
- };
520
-
521
- const deserializeAws_restJson1ListReportDefinitionsCommandError = async (
522
- output: __HttpResponse,
523
- context: __SerdeContext
524
- ): Promise<ListReportDefinitionsCommandOutput> => {
525
- const parsedOutput: any = {
526
- ...output,
527
- body: await parseBody(output.body, context),
528
- };
529
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
530
- let errorCode = "UnknownError";
531
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
532
- switch (errorCode) {
533
- case "AccessDeniedException":
534
- case "com.amazonaws.applicationcostprofiler#AccessDeniedException":
535
- response = {
536
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
537
- name: errorCode,
538
- $metadata: deserializeMetadata(output),
539
- };
540
- break;
541
- case "InternalServerException":
542
- case "com.amazonaws.applicationcostprofiler#InternalServerException":
543
- response = {
544
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
545
- name: errorCode,
546
- $metadata: deserializeMetadata(output),
547
- };
548
- break;
549
- case "ThrottlingException":
550
- case "com.amazonaws.applicationcostprofiler#ThrottlingException":
551
- response = {
552
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
553
- name: errorCode,
554
- $metadata: deserializeMetadata(output),
555
- };
556
- break;
557
- case "ValidationException":
558
- case "com.amazonaws.applicationcostprofiler#ValidationException":
559
- response = {
560
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
561
- name: errorCode,
562
- $metadata: deserializeMetadata(output),
563
- };
564
- break;
565
- default:
566
- const parsedBody = parsedOutput.body;
567
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
568
- response = {
569
- ...parsedBody,
570
- name: `${errorCode}`,
571
- message: parsedBody.message || parsedBody.Message || errorCode,
572
- $fault: "client",
573
- $metadata: deserializeMetadata(output),
574
- } as any;
575
- }
576
- const message = response.message || response.Message || errorCode;
577
- response.message = message;
578
- delete response.Message;
579
- return Promise.reject(Object.assign(new Error(message), response));
580
- };
581
-
582
- export const deserializeAws_restJson1PutReportDefinitionCommand = async (
583
- output: __HttpResponse,
584
- context: __SerdeContext
585
- ): Promise<PutReportDefinitionCommandOutput> => {
586
- if (output.statusCode !== 200 && output.statusCode >= 300) {
587
- return deserializeAws_restJson1PutReportDefinitionCommandError(output, context);
588
- }
589
- const contents: PutReportDefinitionCommandOutput = {
590
- $metadata: deserializeMetadata(output),
591
- reportId: undefined,
592
- };
593
- const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
594
- if (data.reportId !== undefined && data.reportId !== null) {
595
- contents.reportId = __expectString(data.reportId);
596
- }
597
- return Promise.resolve(contents);
598
- };
599
-
600
- const deserializeAws_restJson1PutReportDefinitionCommandError = async (
601
- output: __HttpResponse,
602
- context: __SerdeContext
603
- ): Promise<PutReportDefinitionCommandOutput> => {
604
- const parsedOutput: any = {
605
- ...output,
606
- body: await parseBody(output.body, context),
607
- };
608
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
609
- let errorCode = "UnknownError";
610
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
611
- switch (errorCode) {
612
- case "AccessDeniedException":
613
- case "com.amazonaws.applicationcostprofiler#AccessDeniedException":
614
- response = {
615
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
616
- name: errorCode,
617
- $metadata: deserializeMetadata(output),
618
- };
619
- break;
620
- case "InternalServerException":
621
- case "com.amazonaws.applicationcostprofiler#InternalServerException":
622
- response = {
623
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
624
- name: errorCode,
625
- $metadata: deserializeMetadata(output),
626
- };
627
- break;
628
- case "ServiceQuotaExceededException":
629
- case "com.amazonaws.applicationcostprofiler#ServiceQuotaExceededException":
630
- response = {
631
- ...(await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context)),
632
- name: errorCode,
633
- $metadata: deserializeMetadata(output),
634
- };
635
- break;
636
- case "ThrottlingException":
637
- case "com.amazonaws.applicationcostprofiler#ThrottlingException":
638
- response = {
639
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
640
- name: errorCode,
641
- $metadata: deserializeMetadata(output),
642
- };
643
- break;
644
- case "ValidationException":
645
- case "com.amazonaws.applicationcostprofiler#ValidationException":
646
- response = {
647
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
648
- name: errorCode,
649
- $metadata: deserializeMetadata(output),
650
- };
651
- break;
652
- default:
653
- const parsedBody = parsedOutput.body;
654
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
655
- response = {
656
- ...parsedBody,
657
- name: `${errorCode}`,
658
- message: parsedBody.message || parsedBody.Message || errorCode,
659
- $fault: "client",
660
- $metadata: deserializeMetadata(output),
661
- } as any;
662
- }
663
- const message = response.message || response.Message || errorCode;
664
- response.message = message;
665
- delete response.Message;
666
- return Promise.reject(Object.assign(new Error(message), response));
667
- };
668
-
669
- export const deserializeAws_restJson1UpdateReportDefinitionCommand = async (
670
- output: __HttpResponse,
671
- context: __SerdeContext
672
- ): Promise<UpdateReportDefinitionCommandOutput> => {
673
- if (output.statusCode !== 200 && output.statusCode >= 300) {
674
- return deserializeAws_restJson1UpdateReportDefinitionCommandError(output, context);
675
- }
676
- const contents: UpdateReportDefinitionCommandOutput = {
677
- $metadata: deserializeMetadata(output),
678
- reportId: undefined,
679
- };
680
- const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
681
- if (data.reportId !== undefined && data.reportId !== null) {
682
- contents.reportId = __expectString(data.reportId);
683
- }
684
- return Promise.resolve(contents);
685
- };
686
-
687
- const deserializeAws_restJson1UpdateReportDefinitionCommandError = async (
688
- output: __HttpResponse,
689
- context: __SerdeContext
690
- ): Promise<UpdateReportDefinitionCommandOutput> => {
691
- const parsedOutput: any = {
692
- ...output,
693
- body: await parseBody(output.body, context),
694
- };
695
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
696
- let errorCode = "UnknownError";
697
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
698
- switch (errorCode) {
699
- case "AccessDeniedException":
700
- case "com.amazonaws.applicationcostprofiler#AccessDeniedException":
701
- response = {
702
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
703
- name: errorCode,
704
- $metadata: deserializeMetadata(output),
705
- };
706
- break;
707
- case "InternalServerException":
708
- case "com.amazonaws.applicationcostprofiler#InternalServerException":
709
- response = {
710
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
711
- name: errorCode,
712
- $metadata: deserializeMetadata(output),
713
- };
714
- break;
715
- case "ThrottlingException":
716
- case "com.amazonaws.applicationcostprofiler#ThrottlingException":
717
- response = {
718
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
719
- name: errorCode,
720
- $metadata: deserializeMetadata(output),
721
- };
722
- break;
723
- case "ValidationException":
724
- case "com.amazonaws.applicationcostprofiler#ValidationException":
725
- response = {
726
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
727
- name: errorCode,
728
- $metadata: deserializeMetadata(output),
729
- };
730
- break;
731
- default:
732
- const parsedBody = parsedOutput.body;
733
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
734
- response = {
735
- ...parsedBody,
736
- name: `${errorCode}`,
737
- message: parsedBody.message || parsedBody.Message || errorCode,
738
- $fault: "client",
739
- $metadata: deserializeMetadata(output),
740
- } as any;
741
- }
742
- const message = response.message || response.Message || errorCode;
743
- response.message = message;
744
- delete response.Message;
745
- return Promise.reject(Object.assign(new Error(message), response));
746
- };
747
-
748
- const deserializeAws_restJson1AccessDeniedExceptionResponse = async (
749
- parsedOutput: any,
750
- context: __SerdeContext
751
- ): Promise<AccessDeniedException> => {
752
- const contents: AccessDeniedException = {
753
- name: "AccessDeniedException",
754
- $fault: "client",
755
- $metadata: deserializeMetadata(parsedOutput),
756
- message: undefined,
757
- };
758
- const data: any = parsedOutput.body;
759
- if (data.message !== undefined && data.message !== null) {
760
- contents.message = __expectString(data.message);
761
- }
762
- return contents;
763
- };
764
-
765
- const deserializeAws_restJson1InternalServerExceptionResponse = async (
766
- parsedOutput: any,
767
- context: __SerdeContext
768
- ): Promise<InternalServerException> => {
769
- const contents: InternalServerException = {
770
- name: "InternalServerException",
771
- $fault: "server",
772
- $metadata: deserializeMetadata(parsedOutput),
773
- message: undefined,
774
- };
775
- const data: any = parsedOutput.body;
776
- if (data.message !== undefined && data.message !== null) {
777
- contents.message = __expectString(data.message);
778
- }
779
- return contents;
780
- };
781
-
782
- const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (
783
- parsedOutput: any,
784
- context: __SerdeContext
785
- ): Promise<ServiceQuotaExceededException> => {
786
- const contents: ServiceQuotaExceededException = {
787
- name: "ServiceQuotaExceededException",
788
- $fault: "client",
789
- $metadata: deserializeMetadata(parsedOutput),
790
- message: undefined,
791
- };
792
- const data: any = parsedOutput.body;
793
- if (data.message !== undefined && data.message !== null) {
794
- contents.message = __expectString(data.message);
795
- }
796
- return contents;
797
- };
798
-
799
- const deserializeAws_restJson1ThrottlingExceptionResponse = async (
800
- parsedOutput: any,
801
- context: __SerdeContext
802
- ): Promise<ThrottlingException> => {
803
- const contents: ThrottlingException = {
804
- name: "ThrottlingException",
805
- $fault: "client",
806
- $metadata: deserializeMetadata(parsedOutput),
807
- message: undefined,
808
- };
809
- const data: any = parsedOutput.body;
810
- if (data.message !== undefined && data.message !== null) {
811
- contents.message = __expectString(data.message);
812
- }
813
- return contents;
814
- };
815
-
816
- const deserializeAws_restJson1ValidationExceptionResponse = async (
817
- parsedOutput: any,
818
- context: __SerdeContext
819
- ): Promise<ValidationException> => {
820
- const contents: ValidationException = {
821
- name: "ValidationException",
822
- $fault: "client",
823
- $metadata: deserializeMetadata(parsedOutput),
824
- message: undefined,
825
- };
826
- const data: any = parsedOutput.body;
827
- if (data.message !== undefined && data.message !== null) {
828
- contents.message = __expectString(data.message);
829
- }
830
- return contents;
831
- };
832
-
833
- const serializeAws_restJson1S3Location = (input: S3Location, context: __SerdeContext): any => {
834
- return {
835
- ...(input.bucket !== undefined && input.bucket !== null && { bucket: input.bucket }),
836
- ...(input.prefix !== undefined && input.prefix !== null && { prefix: input.prefix }),
837
- };
838
- };
839
-
840
- const serializeAws_restJson1SourceS3Location = (input: SourceS3Location, context: __SerdeContext): any => {
841
- return {
842
- ...(input.bucket !== undefined && input.bucket !== null && { bucket: input.bucket }),
843
- ...(input.key !== undefined && input.key !== null && { key: input.key }),
844
- ...(input.region !== undefined && input.region !== null && { region: input.region }),
845
- };
846
- };
847
-
848
- const deserializeAws_restJson1ReportDefinition = (output: any, context: __SerdeContext): ReportDefinition => {
849
- return {
850
- createdAt:
851
- output.createdAt !== undefined && output.createdAt !== null
852
- ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.createdAt)))
853
- : undefined,
854
- destinationS3Location:
855
- output.destinationS3Location !== undefined && output.destinationS3Location !== null
856
- ? deserializeAws_restJson1S3Location(output.destinationS3Location, context)
857
- : undefined,
858
- format: __expectString(output.format),
859
- lastUpdatedAt:
860
- output.lastUpdatedAt !== undefined && output.lastUpdatedAt !== null
861
- ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.lastUpdatedAt)))
862
- : undefined,
863
- reportDescription: __expectString(output.reportDescription),
864
- reportFrequency: __expectString(output.reportFrequency),
865
- reportId: __expectString(output.reportId),
866
- } as any;
867
- };
868
-
869
- const deserializeAws_restJson1ReportDefinitionList = (output: any, context: __SerdeContext): ReportDefinition[] => {
870
- return (output || [])
871
- .filter((e: any) => e != null)
872
- .map((entry: any) => {
873
- if (entry === null) {
874
- return null as any;
875
- }
876
- return deserializeAws_restJson1ReportDefinition(entry, context);
877
- });
878
- };
879
-
880
- const deserializeAws_restJson1S3Location = (output: any, context: __SerdeContext): S3Location => {
881
- return {
882
- bucket: __expectString(output.bucket),
883
- prefix: __expectString(output.prefix),
884
- } as any;
885
- };
886
-
887
- const deserializeMetadata = (output: __HttpResponse): __ResponseMetadata => ({
888
- httpStatusCode: output.statusCode,
889
- requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"],
890
- extendedRequestId: output.headers["x-amz-id-2"],
891
- cfId: output.headers["x-amz-cf-id"],
892
- });
893
-
894
- // Collect low-level response body stream to Uint8Array.
895
- const collectBody = (streamBody: any = new Uint8Array(), context: __SerdeContext): Promise<Uint8Array> => {
896
- if (streamBody instanceof Uint8Array) {
897
- return Promise.resolve(streamBody);
898
- }
899
- return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
900
- };
901
-
902
- // Encode Uint8Array data into string with utf-8.
903
- const collectBodyString = (streamBody: any, context: __SerdeContext): Promise<string> =>
904
- collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
905
-
906
- const isSerializableHeaderValue = (value: any): boolean =>
907
- value !== undefined &&
908
- value !== null &&
909
- value !== "" &&
910
- (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
911
- (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
912
-
913
- const parseBody = (streamBody: any, context: __SerdeContext): any =>
914
- collectBodyString(streamBody, context).then((encoded) => {
915
- if (encoded.length) {
916
- return JSON.parse(encoded);
917
- }
918
- return {};
919
- });
920
-
921
- /**
922
- * Load an error code for the aws.rest-json-1.1 protocol.
923
- */
924
- const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string => {
925
- const findKey = (object: any, key: string) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
926
-
927
- const sanitizeErrorCode = (rawValue: string): string => {
928
- let cleanValue = rawValue;
929
- if (cleanValue.indexOf(":") >= 0) {
930
- cleanValue = cleanValue.split(":")[0];
931
- }
932
- if (cleanValue.indexOf("#") >= 0) {
933
- cleanValue = cleanValue.split("#")[1];
934
- }
935
- return cleanValue;
936
- };
937
-
938
- const headerKey = findKey(output.headers, "x-amzn-errortype");
939
- if (headerKey !== undefined) {
940
- return sanitizeErrorCode(output.headers[headerKey]);
941
- }
942
-
943
- if (data.code !== undefined) {
944
- return sanitizeErrorCode(data.code);
945
- }
946
-
947
- if (data["__type"] !== undefined) {
948
- return sanitizeErrorCode(data["__type"]);
949
- }
950
-
951
- return "";
952
- };