@aws-sdk/client-cost-and-usage-report-service 3.312.0 → 3.316.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,67 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CostAndUsageReportService = void 0;
4
+ const smithy_client_1 = require("@aws-sdk/smithy-client");
4
5
  const DeleteReportDefinitionCommand_1 = require("./commands/DeleteReportDefinitionCommand");
5
6
  const DescribeReportDefinitionsCommand_1 = require("./commands/DescribeReportDefinitionsCommand");
6
7
  const ModifyReportDefinitionCommand_1 = require("./commands/ModifyReportDefinitionCommand");
7
8
  const PutReportDefinitionCommand_1 = require("./commands/PutReportDefinitionCommand");
8
9
  const CostAndUsageReportServiceClient_1 = require("./CostAndUsageReportServiceClient");
10
+ const commands = {
11
+ DeleteReportDefinitionCommand: DeleteReportDefinitionCommand_1.DeleteReportDefinitionCommand,
12
+ DescribeReportDefinitionsCommand: DescribeReportDefinitionsCommand_1.DescribeReportDefinitionsCommand,
13
+ ModifyReportDefinitionCommand: ModifyReportDefinitionCommand_1.ModifyReportDefinitionCommand,
14
+ PutReportDefinitionCommand: PutReportDefinitionCommand_1.PutReportDefinitionCommand,
15
+ };
9
16
  class CostAndUsageReportService extends CostAndUsageReportServiceClient_1.CostAndUsageReportServiceClient {
10
- deleteReportDefinition(args, optionsOrCb, cb) {
11
- const command = new DeleteReportDefinitionCommand_1.DeleteReportDefinitionCommand(args);
12
- if (typeof optionsOrCb === "function") {
13
- this.send(command, optionsOrCb);
14
- }
15
- else if (typeof cb === "function") {
16
- if (typeof optionsOrCb !== "object")
17
- throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
18
- this.send(command, optionsOrCb || {}, cb);
19
- }
20
- else {
21
- return this.send(command, optionsOrCb);
22
- }
23
- }
24
- describeReportDefinitions(args, optionsOrCb, cb) {
25
- const command = new DescribeReportDefinitionsCommand_1.DescribeReportDefinitionsCommand(args);
26
- if (typeof optionsOrCb === "function") {
27
- this.send(command, optionsOrCb);
28
- }
29
- else if (typeof cb === "function") {
30
- if (typeof optionsOrCb !== "object")
31
- throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
32
- this.send(command, optionsOrCb || {}, cb);
33
- }
34
- else {
35
- return this.send(command, optionsOrCb);
36
- }
37
- }
38
- modifyReportDefinition(args, optionsOrCb, cb) {
39
- const command = new ModifyReportDefinitionCommand_1.ModifyReportDefinitionCommand(args);
40
- if (typeof optionsOrCb === "function") {
41
- this.send(command, optionsOrCb);
42
- }
43
- else if (typeof cb === "function") {
44
- if (typeof optionsOrCb !== "object")
45
- throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
46
- this.send(command, optionsOrCb || {}, cb);
47
- }
48
- else {
49
- return this.send(command, optionsOrCb);
50
- }
51
- }
52
- putReportDefinition(args, optionsOrCb, cb) {
53
- const command = new PutReportDefinitionCommand_1.PutReportDefinitionCommand(args);
54
- if (typeof optionsOrCb === "function") {
55
- this.send(command, optionsOrCb);
56
- }
57
- else if (typeof cb === "function") {
58
- if (typeof optionsOrCb !== "object")
59
- throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
60
- this.send(command, optionsOrCb || {}, cb);
61
- }
62
- else {
63
- return this.send(command, optionsOrCb);
64
- }
65
- }
66
17
  }
67
18
  exports.CostAndUsageReportService = CostAndUsageReportService;
19
+ (0, smithy_client_1.createAggregatedClient)(commands, CostAndUsageReportService);
@@ -8,28 +8,28 @@ const models_0_1 = require("../models/models_0");
8
8
  const se_DeleteReportDefinitionCommand = async (input, context) => {
9
9
  const headers = sharedHeaders("DeleteReportDefinition");
10
10
  let body;
11
- body = JSON.stringify(se_DeleteReportDefinitionRequest(input, context));
11
+ body = JSON.stringify((0, smithy_client_1._json)(input));
12
12
  return buildHttpRpcRequest(context, headers, "/", undefined, body);
13
13
  };
14
14
  exports.se_DeleteReportDefinitionCommand = se_DeleteReportDefinitionCommand;
15
15
  const se_DescribeReportDefinitionsCommand = async (input, context) => {
16
16
  const headers = sharedHeaders("DescribeReportDefinitions");
17
17
  let body;
18
- body = JSON.stringify(se_DescribeReportDefinitionsRequest(input, context));
18
+ body = JSON.stringify((0, smithy_client_1._json)(input));
19
19
  return buildHttpRpcRequest(context, headers, "/", undefined, body);
20
20
  };
21
21
  exports.se_DescribeReportDefinitionsCommand = se_DescribeReportDefinitionsCommand;
22
22
  const se_ModifyReportDefinitionCommand = async (input, context) => {
23
23
  const headers = sharedHeaders("ModifyReportDefinition");
24
24
  let body;
25
- body = JSON.stringify(se_ModifyReportDefinitionRequest(input, context));
25
+ body = JSON.stringify((0, smithy_client_1._json)(input));
26
26
  return buildHttpRpcRequest(context, headers, "/", undefined, body);
27
27
  };
28
28
  exports.se_ModifyReportDefinitionCommand = se_ModifyReportDefinitionCommand;
29
29
  const se_PutReportDefinitionCommand = async (input, context) => {
30
30
  const headers = sharedHeaders("PutReportDefinition");
31
31
  let body;
32
- body = JSON.stringify(se_PutReportDefinitionRequest(input, context));
32
+ body = JSON.stringify((0, smithy_client_1._json)(input));
33
33
  return buildHttpRpcRequest(context, headers, "/", undefined, body);
34
34
  };
35
35
  exports.se_PutReportDefinitionCommand = se_PutReportDefinitionCommand;
@@ -39,12 +39,12 @@ const de_DeleteReportDefinitionCommand = async (output, context) => {
39
39
  }
40
40
  const data = await parseBody(output.body, context);
41
41
  let contents = {};
42
- contents = de_DeleteReportDefinitionResponse(data, context);
42
+ contents = (0, smithy_client_1._json)(data);
43
43
  const response = {
44
44
  $metadata: deserializeMetadata(output),
45
45
  ...contents,
46
46
  };
47
- return Promise.resolve(response);
47
+ return response;
48
48
  };
49
49
  exports.de_DeleteReportDefinitionCommand = de_DeleteReportDefinitionCommand;
50
50
  const de_DeleteReportDefinitionCommandError = async (output, context) => {
@@ -62,10 +62,9 @@ const de_DeleteReportDefinitionCommandError = async (output, context) => {
62
62
  throw await de_ValidationExceptionRes(parsedOutput, context);
63
63
  default:
64
64
  const parsedBody = parsedOutput.body;
65
- (0, smithy_client_1.throwDefaultError)({
65
+ return throwDefaultError({
66
66
  output,
67
67
  parsedBody,
68
- exceptionCtor: CostAndUsageReportServiceServiceException_1.CostAndUsageReportServiceServiceException,
69
68
  errorCode,
70
69
  });
71
70
  }
@@ -76,12 +75,12 @@ const de_DescribeReportDefinitionsCommand = async (output, context) => {
76
75
  }
77
76
  const data = await parseBody(output.body, context);
78
77
  let contents = {};
79
- contents = de_DescribeReportDefinitionsResponse(data, context);
78
+ contents = (0, smithy_client_1._json)(data);
80
79
  const response = {
81
80
  $metadata: deserializeMetadata(output),
82
81
  ...contents,
83
82
  };
84
- return Promise.resolve(response);
83
+ return response;
85
84
  };
86
85
  exports.de_DescribeReportDefinitionsCommand = de_DescribeReportDefinitionsCommand;
87
86
  const de_DescribeReportDefinitionsCommandError = async (output, context) => {
@@ -96,10 +95,9 @@ const de_DescribeReportDefinitionsCommandError = async (output, context) => {
96
95
  throw await de_InternalErrorExceptionRes(parsedOutput, context);
97
96
  default:
98
97
  const parsedBody = parsedOutput.body;
99
- (0, smithy_client_1.throwDefaultError)({
98
+ return throwDefaultError({
100
99
  output,
101
100
  parsedBody,
102
- exceptionCtor: CostAndUsageReportServiceServiceException_1.CostAndUsageReportServiceServiceException,
103
101
  errorCode,
104
102
  });
105
103
  }
@@ -110,12 +108,12 @@ const de_ModifyReportDefinitionCommand = async (output, context) => {
110
108
  }
111
109
  const data = await parseBody(output.body, context);
112
110
  let contents = {};
113
- contents = de_ModifyReportDefinitionResponse(data, context);
111
+ contents = (0, smithy_client_1._json)(data);
114
112
  const response = {
115
113
  $metadata: deserializeMetadata(output),
116
114
  ...contents,
117
115
  };
118
- return Promise.resolve(response);
116
+ return response;
119
117
  };
120
118
  exports.de_ModifyReportDefinitionCommand = de_ModifyReportDefinitionCommand;
121
119
  const de_ModifyReportDefinitionCommandError = async (output, context) => {
@@ -133,10 +131,9 @@ const de_ModifyReportDefinitionCommandError = async (output, context) => {
133
131
  throw await de_ValidationExceptionRes(parsedOutput, context);
134
132
  default:
135
133
  const parsedBody = parsedOutput.body;
136
- (0, smithy_client_1.throwDefaultError)({
134
+ return throwDefaultError({
137
135
  output,
138
136
  parsedBody,
139
- exceptionCtor: CostAndUsageReportServiceServiceException_1.CostAndUsageReportServiceServiceException,
140
137
  errorCode,
141
138
  });
142
139
  }
@@ -147,12 +144,12 @@ const de_PutReportDefinitionCommand = async (output, context) => {
147
144
  }
148
145
  const data = await parseBody(output.body, context);
149
146
  let contents = {};
150
- contents = de_PutReportDefinitionResponse(data, context);
147
+ contents = (0, smithy_client_1._json)(data);
151
148
  const response = {
152
149
  $metadata: deserializeMetadata(output),
153
150
  ...contents,
154
151
  };
155
- return Promise.resolve(response);
152
+ return response;
156
153
  };
157
154
  exports.de_PutReportDefinitionCommand = de_PutReportDefinitionCommand;
158
155
  const de_PutReportDefinitionCommandError = async (output, context) => {
@@ -176,17 +173,16 @@ const de_PutReportDefinitionCommandError = async (output, context) => {
176
173
  throw await de_ValidationExceptionRes(parsedOutput, context);
177
174
  default:
178
175
  const parsedBody = parsedOutput.body;
179
- (0, smithy_client_1.throwDefaultError)({
176
+ return throwDefaultError({
180
177
  output,
181
178
  parsedBody,
182
- exceptionCtor: CostAndUsageReportServiceServiceException_1.CostAndUsageReportServiceServiceException,
183
179
  errorCode,
184
180
  });
185
181
  }
186
182
  };
187
183
  const de_DuplicateReportNameExceptionRes = async (parsedOutput, context) => {
188
184
  const body = parsedOutput.body;
189
- const deserialized = de_DuplicateReportNameException(body, context);
185
+ const deserialized = (0, smithy_client_1._json)(body);
190
186
  const exception = new models_0_1.DuplicateReportNameException({
191
187
  $metadata: deserializeMetadata(parsedOutput),
192
188
  ...deserialized,
@@ -195,7 +191,7 @@ const de_DuplicateReportNameExceptionRes = async (parsedOutput, context) => {
195
191
  };
196
192
  const de_InternalErrorExceptionRes = async (parsedOutput, context) => {
197
193
  const body = parsedOutput.body;
198
- const deserialized = de_InternalErrorException(body, context);
194
+ const deserialized = (0, smithy_client_1._json)(body);
199
195
  const exception = new models_0_1.InternalErrorException({
200
196
  $metadata: deserializeMetadata(parsedOutput),
201
197
  ...deserialized,
@@ -204,7 +200,7 @@ const de_InternalErrorExceptionRes = async (parsedOutput, context) => {
204
200
  };
205
201
  const de_ReportLimitReachedExceptionRes = async (parsedOutput, context) => {
206
202
  const body = parsedOutput.body;
207
- const deserialized = de_ReportLimitReachedException(body, context);
203
+ const deserialized = (0, smithy_client_1._json)(body);
208
204
  const exception = new models_0_1.ReportLimitReachedException({
209
205
  $metadata: deserializeMetadata(parsedOutput),
210
206
  ...deserialized,
@@ -213,157 +209,13 @@ const de_ReportLimitReachedExceptionRes = async (parsedOutput, context) => {
213
209
  };
214
210
  const de_ValidationExceptionRes = async (parsedOutput, context) => {
215
211
  const body = parsedOutput.body;
216
- const deserialized = de_ValidationException(body, context);
212
+ const deserialized = (0, smithy_client_1._json)(body);
217
213
  const exception = new models_0_1.ValidationException({
218
214
  $metadata: deserializeMetadata(parsedOutput),
219
215
  ...deserialized,
220
216
  });
221
217
  return (0, smithy_client_1.decorateServiceException)(exception, body);
222
218
  };
223
- const se_AdditionalArtifactList = (input, context) => {
224
- return input
225
- .filter((e) => e != null)
226
- .map((entry) => {
227
- return entry;
228
- });
229
- };
230
- const se_DeleteReportDefinitionRequest = (input, context) => {
231
- return {
232
- ...(input.ReportName != null && { ReportName: input.ReportName }),
233
- };
234
- };
235
- const se_DescribeReportDefinitionsRequest = (input, context) => {
236
- return {
237
- ...(input.MaxResults != null && { MaxResults: input.MaxResults }),
238
- ...(input.NextToken != null && { NextToken: input.NextToken }),
239
- };
240
- };
241
- const se_ModifyReportDefinitionRequest = (input, context) => {
242
- return {
243
- ...(input.ReportDefinition != null && { ReportDefinition: se_ReportDefinition(input.ReportDefinition, context) }),
244
- ...(input.ReportName != null && { ReportName: input.ReportName }),
245
- };
246
- };
247
- const se_PutReportDefinitionRequest = (input, context) => {
248
- return {
249
- ...(input.ReportDefinition != null && { ReportDefinition: se_ReportDefinition(input.ReportDefinition, context) }),
250
- };
251
- };
252
- const se_ReportDefinition = (input, context) => {
253
- return {
254
- ...(input.AdditionalArtifacts != null && {
255
- AdditionalArtifacts: se_AdditionalArtifactList(input.AdditionalArtifacts, context),
256
- }),
257
- ...(input.AdditionalSchemaElements != null && {
258
- AdditionalSchemaElements: se_SchemaElementList(input.AdditionalSchemaElements, context),
259
- }),
260
- ...(input.BillingViewArn != null && { BillingViewArn: input.BillingViewArn }),
261
- ...(input.Compression != null && { Compression: input.Compression }),
262
- ...(input.Format != null && { Format: input.Format }),
263
- ...(input.RefreshClosedReports != null && { RefreshClosedReports: input.RefreshClosedReports }),
264
- ...(input.ReportName != null && { ReportName: input.ReportName }),
265
- ...(input.ReportVersioning != null && { ReportVersioning: input.ReportVersioning }),
266
- ...(input.S3Bucket != null && { S3Bucket: input.S3Bucket }),
267
- ...(input.S3Prefix != null && { S3Prefix: input.S3Prefix }),
268
- ...(input.S3Region != null && { S3Region: input.S3Region }),
269
- ...(input.TimeUnit != null && { TimeUnit: input.TimeUnit }),
270
- };
271
- };
272
- const se_SchemaElementList = (input, context) => {
273
- return input
274
- .filter((e) => e != null)
275
- .map((entry) => {
276
- return entry;
277
- });
278
- };
279
- const de_AdditionalArtifactList = (output, context) => {
280
- const retVal = (output || [])
281
- .filter((e) => e != null)
282
- .map((entry) => {
283
- if (entry === null) {
284
- return null;
285
- }
286
- return (0, smithy_client_1.expectString)(entry);
287
- });
288
- return retVal;
289
- };
290
- const de_DeleteReportDefinitionResponse = (output, context) => {
291
- return {
292
- ResponseMessage: (0, smithy_client_1.expectString)(output.ResponseMessage),
293
- };
294
- };
295
- const de_DescribeReportDefinitionsResponse = (output, context) => {
296
- return {
297
- NextToken: (0, smithy_client_1.expectString)(output.NextToken),
298
- ReportDefinitions: output.ReportDefinitions != null ? de_ReportDefinitionList(output.ReportDefinitions, context) : undefined,
299
- };
300
- };
301
- const de_DuplicateReportNameException = (output, context) => {
302
- return {
303
- Message: (0, smithy_client_1.expectString)(output.Message),
304
- };
305
- };
306
- const de_InternalErrorException = (output, context) => {
307
- return {
308
- Message: (0, smithy_client_1.expectString)(output.Message),
309
- };
310
- };
311
- const de_ModifyReportDefinitionResponse = (output, context) => {
312
- return {};
313
- };
314
- const de_PutReportDefinitionResponse = (output, context) => {
315
- return {};
316
- };
317
- const de_ReportDefinition = (output, context) => {
318
- return {
319
- AdditionalArtifacts: output.AdditionalArtifacts != null ? de_AdditionalArtifactList(output.AdditionalArtifacts, context) : undefined,
320
- AdditionalSchemaElements: output.AdditionalSchemaElements != null
321
- ? de_SchemaElementList(output.AdditionalSchemaElements, context)
322
- : undefined,
323
- BillingViewArn: (0, smithy_client_1.expectString)(output.BillingViewArn),
324
- Compression: (0, smithy_client_1.expectString)(output.Compression),
325
- Format: (0, smithy_client_1.expectString)(output.Format),
326
- RefreshClosedReports: (0, smithy_client_1.expectBoolean)(output.RefreshClosedReports),
327
- ReportName: (0, smithy_client_1.expectString)(output.ReportName),
328
- ReportVersioning: (0, smithy_client_1.expectString)(output.ReportVersioning),
329
- S3Bucket: (0, smithy_client_1.expectString)(output.S3Bucket),
330
- S3Prefix: (0, smithy_client_1.expectString)(output.S3Prefix),
331
- S3Region: (0, smithy_client_1.expectString)(output.S3Region),
332
- TimeUnit: (0, smithy_client_1.expectString)(output.TimeUnit),
333
- };
334
- };
335
- const de_ReportDefinitionList = (output, context) => {
336
- const retVal = (output || [])
337
- .filter((e) => e != null)
338
- .map((entry) => {
339
- if (entry === null) {
340
- return null;
341
- }
342
- return de_ReportDefinition(entry, context);
343
- });
344
- return retVal;
345
- };
346
- const de_ReportLimitReachedException = (output, context) => {
347
- return {
348
- Message: (0, smithy_client_1.expectString)(output.Message),
349
- };
350
- };
351
- const de_SchemaElementList = (output, context) => {
352
- const retVal = (output || [])
353
- .filter((e) => e != null)
354
- .map((entry) => {
355
- if (entry === null) {
356
- return null;
357
- }
358
- return (0, smithy_client_1.expectString)(entry);
359
- });
360
- return retVal;
361
- };
362
- const de_ValidationException = (output, context) => {
363
- return {
364
- Message: (0, smithy_client_1.expectString)(output.Message),
365
- };
366
- };
367
219
  const deserializeMetadata = (output) => ({
368
220
  httpStatusCode: output.statusCode,
369
221
  requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
@@ -377,6 +229,7 @@ const collectBody = (streamBody = new Uint8Array(), context) => {
377
229
  return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
378
230
  };
379
231
  const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
232
+ const throwDefaultError = (0, smithy_client_1.withBaseException)(CostAndUsageReportServiceServiceException_1.CostAndUsageReportServiceServiceException);
380
233
  const buildHttpRpcRequest = async (context, headers, path, resolvedHostname, body) => {
381
234
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
382
235
  const contents = {
@@ -1,63 +1,15 @@
1
+ import { createAggregatedClient } from "@aws-sdk/smithy-client";
1
2
  import { DeleteReportDefinitionCommand, } from "./commands/DeleteReportDefinitionCommand";
2
3
  import { DescribeReportDefinitionsCommand, } from "./commands/DescribeReportDefinitionsCommand";
3
4
  import { ModifyReportDefinitionCommand, } from "./commands/ModifyReportDefinitionCommand";
4
5
  import { PutReportDefinitionCommand, } from "./commands/PutReportDefinitionCommand";
5
- import { CostAndUsageReportServiceClient } from "./CostAndUsageReportServiceClient";
6
+ import { CostAndUsageReportServiceClient, } from "./CostAndUsageReportServiceClient";
7
+ const commands = {
8
+ DeleteReportDefinitionCommand,
9
+ DescribeReportDefinitionsCommand,
10
+ ModifyReportDefinitionCommand,
11
+ PutReportDefinitionCommand,
12
+ };
6
13
  export class CostAndUsageReportService extends CostAndUsageReportServiceClient {
7
- deleteReportDefinition(args, optionsOrCb, cb) {
8
- const command = new DeleteReportDefinitionCommand(args);
9
- if (typeof optionsOrCb === "function") {
10
- this.send(command, optionsOrCb);
11
- }
12
- else if (typeof cb === "function") {
13
- if (typeof optionsOrCb !== "object")
14
- throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
15
- this.send(command, optionsOrCb || {}, cb);
16
- }
17
- else {
18
- return this.send(command, optionsOrCb);
19
- }
20
- }
21
- describeReportDefinitions(args, optionsOrCb, cb) {
22
- const command = new DescribeReportDefinitionsCommand(args);
23
- if (typeof optionsOrCb === "function") {
24
- this.send(command, optionsOrCb);
25
- }
26
- else if (typeof cb === "function") {
27
- if (typeof optionsOrCb !== "object")
28
- throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
29
- this.send(command, optionsOrCb || {}, cb);
30
- }
31
- else {
32
- return this.send(command, optionsOrCb);
33
- }
34
- }
35
- modifyReportDefinition(args, optionsOrCb, cb) {
36
- const command = new ModifyReportDefinitionCommand(args);
37
- if (typeof optionsOrCb === "function") {
38
- this.send(command, optionsOrCb);
39
- }
40
- else if (typeof cb === "function") {
41
- if (typeof optionsOrCb !== "object")
42
- throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
43
- this.send(command, optionsOrCb || {}, cb);
44
- }
45
- else {
46
- return this.send(command, optionsOrCb);
47
- }
48
- }
49
- putReportDefinition(args, optionsOrCb, cb) {
50
- const command = new PutReportDefinitionCommand(args);
51
- if (typeof optionsOrCb === "function") {
52
- this.send(command, optionsOrCb);
53
- }
54
- else if (typeof cb === "function") {
55
- if (typeof optionsOrCb !== "object")
56
- throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
57
- this.send(command, optionsOrCb || {}, cb);
58
- }
59
- else {
60
- return this.send(command, optionsOrCb);
61
- }
62
- }
63
14
  }
15
+ createAggregatedClient(commands, CostAndUsageReportService);
@@ -1,29 +1,29 @@
1
1
  import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http";
2
- import { decorateServiceException as __decorateServiceException, expectBoolean as __expectBoolean, expectString as __expectString, throwDefaultError, } from "@aws-sdk/smithy-client";
2
+ import { _json, decorateServiceException as __decorateServiceException, withBaseException, } from "@aws-sdk/smithy-client";
3
3
  import { CostAndUsageReportServiceServiceException as __BaseException } from "../models/CostAndUsageReportServiceServiceException";
4
4
  import { DuplicateReportNameException, InternalErrorException, ReportLimitReachedException, ValidationException, } from "../models/models_0";
5
5
  export const se_DeleteReportDefinitionCommand = async (input, context) => {
6
6
  const headers = sharedHeaders("DeleteReportDefinition");
7
7
  let body;
8
- body = JSON.stringify(se_DeleteReportDefinitionRequest(input, context));
8
+ body = JSON.stringify(_json(input));
9
9
  return buildHttpRpcRequest(context, headers, "/", undefined, body);
10
10
  };
11
11
  export const se_DescribeReportDefinitionsCommand = async (input, context) => {
12
12
  const headers = sharedHeaders("DescribeReportDefinitions");
13
13
  let body;
14
- body = JSON.stringify(se_DescribeReportDefinitionsRequest(input, context));
14
+ body = JSON.stringify(_json(input));
15
15
  return buildHttpRpcRequest(context, headers, "/", undefined, body);
16
16
  };
17
17
  export const se_ModifyReportDefinitionCommand = async (input, context) => {
18
18
  const headers = sharedHeaders("ModifyReportDefinition");
19
19
  let body;
20
- body = JSON.stringify(se_ModifyReportDefinitionRequest(input, context));
20
+ body = JSON.stringify(_json(input));
21
21
  return buildHttpRpcRequest(context, headers, "/", undefined, body);
22
22
  };
23
23
  export const se_PutReportDefinitionCommand = async (input, context) => {
24
24
  const headers = sharedHeaders("PutReportDefinition");
25
25
  let body;
26
- body = JSON.stringify(se_PutReportDefinitionRequest(input, context));
26
+ body = JSON.stringify(_json(input));
27
27
  return buildHttpRpcRequest(context, headers, "/", undefined, body);
28
28
  };
29
29
  export const de_DeleteReportDefinitionCommand = async (output, context) => {
@@ -32,12 +32,12 @@ export const de_DeleteReportDefinitionCommand = async (output, context) => {
32
32
  }
33
33
  const data = await parseBody(output.body, context);
34
34
  let contents = {};
35
- contents = de_DeleteReportDefinitionResponse(data, context);
35
+ contents = _json(data);
36
36
  const response = {
37
37
  $metadata: deserializeMetadata(output),
38
38
  ...contents,
39
39
  };
40
- return Promise.resolve(response);
40
+ return response;
41
41
  };
42
42
  const de_DeleteReportDefinitionCommandError = async (output, context) => {
43
43
  const parsedOutput = {
@@ -54,10 +54,9 @@ const de_DeleteReportDefinitionCommandError = async (output, context) => {
54
54
  throw await de_ValidationExceptionRes(parsedOutput, context);
55
55
  default:
56
56
  const parsedBody = parsedOutput.body;
57
- throwDefaultError({
57
+ return throwDefaultError({
58
58
  output,
59
59
  parsedBody,
60
- exceptionCtor: __BaseException,
61
60
  errorCode,
62
61
  });
63
62
  }
@@ -68,12 +67,12 @@ export const de_DescribeReportDefinitionsCommand = async (output, context) => {
68
67
  }
69
68
  const data = await parseBody(output.body, context);
70
69
  let contents = {};
71
- contents = de_DescribeReportDefinitionsResponse(data, context);
70
+ contents = _json(data);
72
71
  const response = {
73
72
  $metadata: deserializeMetadata(output),
74
73
  ...contents,
75
74
  };
76
- return Promise.resolve(response);
75
+ return response;
77
76
  };
78
77
  const de_DescribeReportDefinitionsCommandError = async (output, context) => {
79
78
  const parsedOutput = {
@@ -87,10 +86,9 @@ const de_DescribeReportDefinitionsCommandError = async (output, context) => {
87
86
  throw await de_InternalErrorExceptionRes(parsedOutput, context);
88
87
  default:
89
88
  const parsedBody = parsedOutput.body;
90
- throwDefaultError({
89
+ return throwDefaultError({
91
90
  output,
92
91
  parsedBody,
93
- exceptionCtor: __BaseException,
94
92
  errorCode,
95
93
  });
96
94
  }
@@ -101,12 +99,12 @@ export const de_ModifyReportDefinitionCommand = async (output, context) => {
101
99
  }
102
100
  const data = await parseBody(output.body, context);
103
101
  let contents = {};
104
- contents = de_ModifyReportDefinitionResponse(data, context);
102
+ contents = _json(data);
105
103
  const response = {
106
104
  $metadata: deserializeMetadata(output),
107
105
  ...contents,
108
106
  };
109
- return Promise.resolve(response);
107
+ return response;
110
108
  };
111
109
  const de_ModifyReportDefinitionCommandError = async (output, context) => {
112
110
  const parsedOutput = {
@@ -123,10 +121,9 @@ const de_ModifyReportDefinitionCommandError = async (output, context) => {
123
121
  throw await de_ValidationExceptionRes(parsedOutput, context);
124
122
  default:
125
123
  const parsedBody = parsedOutput.body;
126
- throwDefaultError({
124
+ return throwDefaultError({
127
125
  output,
128
126
  parsedBody,
129
- exceptionCtor: __BaseException,
130
127
  errorCode,
131
128
  });
132
129
  }
@@ -137,12 +134,12 @@ export const de_PutReportDefinitionCommand = async (output, context) => {
137
134
  }
138
135
  const data = await parseBody(output.body, context);
139
136
  let contents = {};
140
- contents = de_PutReportDefinitionResponse(data, context);
137
+ contents = _json(data);
141
138
  const response = {
142
139
  $metadata: deserializeMetadata(output),
143
140
  ...contents,
144
141
  };
145
- return Promise.resolve(response);
142
+ return response;
146
143
  };
147
144
  const de_PutReportDefinitionCommandError = async (output, context) => {
148
145
  const parsedOutput = {
@@ -165,17 +162,16 @@ const de_PutReportDefinitionCommandError = async (output, context) => {
165
162
  throw await de_ValidationExceptionRes(parsedOutput, context);
166
163
  default:
167
164
  const parsedBody = parsedOutput.body;
168
- throwDefaultError({
165
+ return throwDefaultError({
169
166
  output,
170
167
  parsedBody,
171
- exceptionCtor: __BaseException,
172
168
  errorCode,
173
169
  });
174
170
  }
175
171
  };
176
172
  const de_DuplicateReportNameExceptionRes = async (parsedOutput, context) => {
177
173
  const body = parsedOutput.body;
178
- const deserialized = de_DuplicateReportNameException(body, context);
174
+ const deserialized = _json(body);
179
175
  const exception = new DuplicateReportNameException({
180
176
  $metadata: deserializeMetadata(parsedOutput),
181
177
  ...deserialized,
@@ -184,7 +180,7 @@ const de_DuplicateReportNameExceptionRes = async (parsedOutput, context) => {
184
180
  };
185
181
  const de_InternalErrorExceptionRes = async (parsedOutput, context) => {
186
182
  const body = parsedOutput.body;
187
- const deserialized = de_InternalErrorException(body, context);
183
+ const deserialized = _json(body);
188
184
  const exception = new InternalErrorException({
189
185
  $metadata: deserializeMetadata(parsedOutput),
190
186
  ...deserialized,
@@ -193,7 +189,7 @@ const de_InternalErrorExceptionRes = async (parsedOutput, context) => {
193
189
  };
194
190
  const de_ReportLimitReachedExceptionRes = async (parsedOutput, context) => {
195
191
  const body = parsedOutput.body;
196
- const deserialized = de_ReportLimitReachedException(body, context);
192
+ const deserialized = _json(body);
197
193
  const exception = new ReportLimitReachedException({
198
194
  $metadata: deserializeMetadata(parsedOutput),
199
195
  ...deserialized,
@@ -202,157 +198,13 @@ const de_ReportLimitReachedExceptionRes = async (parsedOutput, context) => {
202
198
  };
203
199
  const de_ValidationExceptionRes = async (parsedOutput, context) => {
204
200
  const body = parsedOutput.body;
205
- const deserialized = de_ValidationException(body, context);
201
+ const deserialized = _json(body);
206
202
  const exception = new ValidationException({
207
203
  $metadata: deserializeMetadata(parsedOutput),
208
204
  ...deserialized,
209
205
  });
210
206
  return __decorateServiceException(exception, body);
211
207
  };
212
- const se_AdditionalArtifactList = (input, context) => {
213
- return input
214
- .filter((e) => e != null)
215
- .map((entry) => {
216
- return entry;
217
- });
218
- };
219
- const se_DeleteReportDefinitionRequest = (input, context) => {
220
- return {
221
- ...(input.ReportName != null && { ReportName: input.ReportName }),
222
- };
223
- };
224
- const se_DescribeReportDefinitionsRequest = (input, context) => {
225
- return {
226
- ...(input.MaxResults != null && { MaxResults: input.MaxResults }),
227
- ...(input.NextToken != null && { NextToken: input.NextToken }),
228
- };
229
- };
230
- const se_ModifyReportDefinitionRequest = (input, context) => {
231
- return {
232
- ...(input.ReportDefinition != null && { ReportDefinition: se_ReportDefinition(input.ReportDefinition, context) }),
233
- ...(input.ReportName != null && { ReportName: input.ReportName }),
234
- };
235
- };
236
- const se_PutReportDefinitionRequest = (input, context) => {
237
- return {
238
- ...(input.ReportDefinition != null && { ReportDefinition: se_ReportDefinition(input.ReportDefinition, context) }),
239
- };
240
- };
241
- const se_ReportDefinition = (input, context) => {
242
- return {
243
- ...(input.AdditionalArtifacts != null && {
244
- AdditionalArtifacts: se_AdditionalArtifactList(input.AdditionalArtifacts, context),
245
- }),
246
- ...(input.AdditionalSchemaElements != null && {
247
- AdditionalSchemaElements: se_SchemaElementList(input.AdditionalSchemaElements, context),
248
- }),
249
- ...(input.BillingViewArn != null && { BillingViewArn: input.BillingViewArn }),
250
- ...(input.Compression != null && { Compression: input.Compression }),
251
- ...(input.Format != null && { Format: input.Format }),
252
- ...(input.RefreshClosedReports != null && { RefreshClosedReports: input.RefreshClosedReports }),
253
- ...(input.ReportName != null && { ReportName: input.ReportName }),
254
- ...(input.ReportVersioning != null && { ReportVersioning: input.ReportVersioning }),
255
- ...(input.S3Bucket != null && { S3Bucket: input.S3Bucket }),
256
- ...(input.S3Prefix != null && { S3Prefix: input.S3Prefix }),
257
- ...(input.S3Region != null && { S3Region: input.S3Region }),
258
- ...(input.TimeUnit != null && { TimeUnit: input.TimeUnit }),
259
- };
260
- };
261
- const se_SchemaElementList = (input, context) => {
262
- return input
263
- .filter((e) => e != null)
264
- .map((entry) => {
265
- return entry;
266
- });
267
- };
268
- const de_AdditionalArtifactList = (output, context) => {
269
- const retVal = (output || [])
270
- .filter((e) => e != null)
271
- .map((entry) => {
272
- if (entry === null) {
273
- return null;
274
- }
275
- return __expectString(entry);
276
- });
277
- return retVal;
278
- };
279
- const de_DeleteReportDefinitionResponse = (output, context) => {
280
- return {
281
- ResponseMessage: __expectString(output.ResponseMessage),
282
- };
283
- };
284
- const de_DescribeReportDefinitionsResponse = (output, context) => {
285
- return {
286
- NextToken: __expectString(output.NextToken),
287
- ReportDefinitions: output.ReportDefinitions != null ? de_ReportDefinitionList(output.ReportDefinitions, context) : undefined,
288
- };
289
- };
290
- const de_DuplicateReportNameException = (output, context) => {
291
- return {
292
- Message: __expectString(output.Message),
293
- };
294
- };
295
- const de_InternalErrorException = (output, context) => {
296
- return {
297
- Message: __expectString(output.Message),
298
- };
299
- };
300
- const de_ModifyReportDefinitionResponse = (output, context) => {
301
- return {};
302
- };
303
- const de_PutReportDefinitionResponse = (output, context) => {
304
- return {};
305
- };
306
- const de_ReportDefinition = (output, context) => {
307
- return {
308
- AdditionalArtifacts: output.AdditionalArtifacts != null ? de_AdditionalArtifactList(output.AdditionalArtifacts, context) : undefined,
309
- AdditionalSchemaElements: output.AdditionalSchemaElements != null
310
- ? de_SchemaElementList(output.AdditionalSchemaElements, context)
311
- : undefined,
312
- BillingViewArn: __expectString(output.BillingViewArn),
313
- Compression: __expectString(output.Compression),
314
- Format: __expectString(output.Format),
315
- RefreshClosedReports: __expectBoolean(output.RefreshClosedReports),
316
- ReportName: __expectString(output.ReportName),
317
- ReportVersioning: __expectString(output.ReportVersioning),
318
- S3Bucket: __expectString(output.S3Bucket),
319
- S3Prefix: __expectString(output.S3Prefix),
320
- S3Region: __expectString(output.S3Region),
321
- TimeUnit: __expectString(output.TimeUnit),
322
- };
323
- };
324
- const de_ReportDefinitionList = (output, context) => {
325
- const retVal = (output || [])
326
- .filter((e) => e != null)
327
- .map((entry) => {
328
- if (entry === null) {
329
- return null;
330
- }
331
- return de_ReportDefinition(entry, context);
332
- });
333
- return retVal;
334
- };
335
- const de_ReportLimitReachedException = (output, context) => {
336
- return {
337
- Message: __expectString(output.Message),
338
- };
339
- };
340
- const de_SchemaElementList = (output, context) => {
341
- const retVal = (output || [])
342
- .filter((e) => e != null)
343
- .map((entry) => {
344
- if (entry === null) {
345
- return null;
346
- }
347
- return __expectString(entry);
348
- });
349
- return retVal;
350
- };
351
- const de_ValidationException = (output, context) => {
352
- return {
353
- Message: __expectString(output.Message),
354
- };
355
- };
356
208
  const deserializeMetadata = (output) => ({
357
209
  httpStatusCode: output.statusCode,
358
210
  requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
@@ -366,6 +218,7 @@ const collectBody = (streamBody = new Uint8Array(), context) => {
366
218
  return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
367
219
  };
368
220
  const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
221
+ const throwDefaultError = withBaseException(__BaseException);
369
222
  const buildHttpRpcRequest = async (context, headers, path, resolvedHostname, body) => {
370
223
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
371
224
  const contents = {
@@ -4,6 +4,32 @@ import { DescribeReportDefinitionsCommandInput, DescribeReportDefinitionsCommand
4
4
  import { ModifyReportDefinitionCommandInput, ModifyReportDefinitionCommandOutput } from "./commands/ModifyReportDefinitionCommand";
5
5
  import { PutReportDefinitionCommandInput, PutReportDefinitionCommandOutput } from "./commands/PutReportDefinitionCommand";
6
6
  import { CostAndUsageReportServiceClient } from "./CostAndUsageReportServiceClient";
7
+ export interface CostAndUsageReportService {
8
+ /**
9
+ * @see {@link DeleteReportDefinitionCommand}
10
+ */
11
+ deleteReportDefinition(args: DeleteReportDefinitionCommandInput, options?: __HttpHandlerOptions): Promise<DeleteReportDefinitionCommandOutput>;
12
+ deleteReportDefinition(args: DeleteReportDefinitionCommandInput, cb: (err: any, data?: DeleteReportDefinitionCommandOutput) => void): void;
13
+ deleteReportDefinition(args: DeleteReportDefinitionCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: DeleteReportDefinitionCommandOutput) => void): void;
14
+ /**
15
+ * @see {@link DescribeReportDefinitionsCommand}
16
+ */
17
+ describeReportDefinitions(args: DescribeReportDefinitionsCommandInput, options?: __HttpHandlerOptions): Promise<DescribeReportDefinitionsCommandOutput>;
18
+ describeReportDefinitions(args: DescribeReportDefinitionsCommandInput, cb: (err: any, data?: DescribeReportDefinitionsCommandOutput) => void): void;
19
+ describeReportDefinitions(args: DescribeReportDefinitionsCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: DescribeReportDefinitionsCommandOutput) => void): void;
20
+ /**
21
+ * @see {@link ModifyReportDefinitionCommand}
22
+ */
23
+ modifyReportDefinition(args: ModifyReportDefinitionCommandInput, options?: __HttpHandlerOptions): Promise<ModifyReportDefinitionCommandOutput>;
24
+ modifyReportDefinition(args: ModifyReportDefinitionCommandInput, cb: (err: any, data?: ModifyReportDefinitionCommandOutput) => void): void;
25
+ modifyReportDefinition(args: ModifyReportDefinitionCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: ModifyReportDefinitionCommandOutput) => void): void;
26
+ /**
27
+ * @see {@link PutReportDefinitionCommand}
28
+ */
29
+ putReportDefinition(args: PutReportDefinitionCommandInput, options?: __HttpHandlerOptions): Promise<PutReportDefinitionCommandOutput>;
30
+ putReportDefinition(args: PutReportDefinitionCommandInput, cb: (err: any, data?: PutReportDefinitionCommandOutput) => void): void;
31
+ putReportDefinition(args: PutReportDefinitionCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: PutReportDefinitionCommandOutput) => void): void;
32
+ }
7
33
  /**
8
34
  * @public
9
35
  * <p>The AWS Cost and Usage Report API enables you to programmatically create, query, and delete
@@ -25,33 +51,5 @@ import { CostAndUsageReportServiceClient } from "./CostAndUsageReportServiceClie
25
51
  * </li>
26
52
  * </ul>
27
53
  */
28
- export declare class CostAndUsageReportService extends CostAndUsageReportServiceClient {
29
- /**
30
- * @public
31
- * <p>Deletes the specified report.</p>
32
- */
33
- deleteReportDefinition(args: DeleteReportDefinitionCommandInput, options?: __HttpHandlerOptions): Promise<DeleteReportDefinitionCommandOutput>;
34
- deleteReportDefinition(args: DeleteReportDefinitionCommandInput, cb: (err: any, data?: DeleteReportDefinitionCommandOutput) => void): void;
35
- deleteReportDefinition(args: DeleteReportDefinitionCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: DeleteReportDefinitionCommandOutput) => void): void;
36
- /**
37
- * @public
38
- * <p>Lists the AWS Cost and Usage reports available to this account.</p>
39
- */
40
- describeReportDefinitions(args: DescribeReportDefinitionsCommandInput, options?: __HttpHandlerOptions): Promise<DescribeReportDefinitionsCommandOutput>;
41
- describeReportDefinitions(args: DescribeReportDefinitionsCommandInput, cb: (err: any, data?: DescribeReportDefinitionsCommandOutput) => void): void;
42
- describeReportDefinitions(args: DescribeReportDefinitionsCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: DescribeReportDefinitionsCommandOutput) => void): void;
43
- /**
44
- * @public
45
- * <p>Allows you to programatically update your report preferences.</p>
46
- */
47
- modifyReportDefinition(args: ModifyReportDefinitionCommandInput, options?: __HttpHandlerOptions): Promise<ModifyReportDefinitionCommandOutput>;
48
- modifyReportDefinition(args: ModifyReportDefinitionCommandInput, cb: (err: any, data?: ModifyReportDefinitionCommandOutput) => void): void;
49
- modifyReportDefinition(args: ModifyReportDefinitionCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: ModifyReportDefinitionCommandOutput) => void): void;
50
- /**
51
- * @public
52
- * <p>Creates a new report using the description that you provide.</p>
53
- */
54
- putReportDefinition(args: PutReportDefinitionCommandInput, options?: __HttpHandlerOptions): Promise<PutReportDefinitionCommandOutput>;
55
- putReportDefinition(args: PutReportDefinitionCommandInput, cb: (err: any, data?: PutReportDefinitionCommandOutput) => void): void;
56
- putReportDefinition(args: PutReportDefinitionCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: PutReportDefinitionCommandOutput) => void): void;
54
+ export declare class CostAndUsageReportService extends CostAndUsageReportServiceClient implements CostAndUsageReportService {
57
55
  }
@@ -16,7 +16,7 @@ import {
16
16
  PutReportDefinitionCommandOutput,
17
17
  } from "./commands/PutReportDefinitionCommand";
18
18
  import { CostAndUsageReportServiceClient } from "./CostAndUsageReportServiceClient";
19
- export declare class CostAndUsageReportService extends CostAndUsageReportServiceClient {
19
+ export interface CostAndUsageReportService {
20
20
  deleteReportDefinition(
21
21
  args: DeleteReportDefinitionCommandInput,
22
22
  options?: __HttpHandlerOptions
@@ -70,3 +70,6 @@ export declare class CostAndUsageReportService extends CostAndUsageReportService
70
70
  cb: (err: any, data?: PutReportDefinitionCommandOutput) => void
71
71
  ): void;
72
72
  }
73
+ export declare class CostAndUsageReportService
74
+ extends CostAndUsageReportServiceClient
75
+ implements CostAndUsageReportService {}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aws-sdk/client-cost-and-usage-report-service",
3
3
  "description": "AWS SDK for JavaScript Cost And Usage Report Service Client for Node.js, Browser and React Native",
4
- "version": "3.312.0",
4
+ "version": "3.316.0",
5
5
  "scripts": {
6
6
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
7
7
  "build:cjs": "tsc -p tsconfig.cjs.json",
@@ -21,9 +21,9 @@
21
21
  "dependencies": {
22
22
  "@aws-crypto/sha256-browser": "3.0.0",
23
23
  "@aws-crypto/sha256-js": "3.0.0",
24
- "@aws-sdk/client-sts": "3.312.0",
24
+ "@aws-sdk/client-sts": "3.316.0",
25
25
  "@aws-sdk/config-resolver": "3.310.0",
26
- "@aws-sdk/credential-provider-node": "3.310.0",
26
+ "@aws-sdk/credential-provider-node": "3.316.0",
27
27
  "@aws-sdk/fetch-http-handler": "3.310.0",
28
28
  "@aws-sdk/hash-node": "3.310.0",
29
29
  "@aws-sdk/invalid-dependency": "3.310.0",
@@ -40,14 +40,14 @@
40
40
  "@aws-sdk/node-config-provider": "3.310.0",
41
41
  "@aws-sdk/node-http-handler": "3.310.0",
42
42
  "@aws-sdk/protocol-http": "3.310.0",
43
- "@aws-sdk/smithy-client": "3.310.0",
43
+ "@aws-sdk/smithy-client": "3.316.0",
44
44
  "@aws-sdk/types": "3.310.0",
45
45
  "@aws-sdk/url-parser": "3.310.0",
46
46
  "@aws-sdk/util-base64": "3.310.0",
47
47
  "@aws-sdk/util-body-length-browser": "3.310.0",
48
48
  "@aws-sdk/util-body-length-node": "3.310.0",
49
- "@aws-sdk/util-defaults-mode-browser": "3.310.0",
50
- "@aws-sdk/util-defaults-mode-node": "3.310.0",
49
+ "@aws-sdk/util-defaults-mode-browser": "3.316.0",
50
+ "@aws-sdk/util-defaults-mode-node": "3.316.0",
51
51
  "@aws-sdk/util-endpoints": "3.310.0",
52
52
  "@aws-sdk/util-retry": "3.310.0",
53
53
  "@aws-sdk/util-user-agent-browser": "3.310.0",