Skip to content

Commit

Permalink
feat(client-cost-and-usage-report-service): This release adds support…
Browse files Browse the repository at this point in the history
… for tagging and customers can now tag report definitions. Additionally, ReportStatus is now added to report definition to show when the last delivered time stamp and if it succeeded or not.
  • Loading branch information
awstools committed Nov 10, 2023
1 parent b4b5fdd commit 1f24b22
Show file tree
Hide file tree
Showing 15 changed files with 1,421 additions and 90 deletions.
56 changes: 40 additions & 16 deletions clients/client-cost-and-usage-report-service/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@

AWS SDK for JavaScript CostAndUsageReportService Client for Node.js, Browser and React Native.

<p>The AWS Cost and Usage Report API enables you to programmatically create, query, and delete
AWS Cost and Usage report definitions.</p>
<p>AWS Cost and Usage reports track the monthly AWS costs and usage
associated with your AWS account.
<p>You can use the Amazon Web Services Cost and Usage Report API to programmatically create, query, and delete
Amazon Web Services Cost and Usage Report definitions.</p>
<p>Amazon Web Services Cost and Usage Report track the monthly Amazon Web Services costs and usage
associated with your Amazon Web Services account.

The report contains line items for each unique combination of AWS product,
usage type, and operation that your AWS account uses.
The report contains line items for each unique combination of Amazon Web Services product,
usage type, and operation that your Amazon Web Services account uses.

You can configure the AWS Cost and Usage report to show only the data that you want, using the
AWS Cost and Usage API.</p>
You can configure the Amazon Web Services Cost and Usage Report to show only the data that you want, using the
Amazon Web Services Cost and Usage Report API.</p>

<p>Service Endpoint</p>
<p>The AWS Cost and Usage Report API provides the following endpoint:</p>
<p>The Amazon Web Services Cost and Usage Report API provides the following endpoint:</p>
<ul>
<li>
<p>cur.us-east-1.amazonaws.com</p>
Expand All @@ -40,21 +40,21 @@ using your favorite package manager:

The AWS SDK is modulized by clients and commands.
To send a request, you only need to import the `CostAndUsageReportServiceClient` and
the commands you need, for example `DescribeReportDefinitionsCommand`:
the commands you need, for example `ListTagsForResourceCommand`:

```js
// ES5 example
const {
CostAndUsageReportServiceClient,
DescribeReportDefinitionsCommand,
ListTagsForResourceCommand,
} = require("@aws-sdk/client-cost-and-usage-report-service");
```

```ts
// ES6+ example
import {
CostAndUsageReportServiceClient,
DescribeReportDefinitionsCommand,
ListTagsForResourceCommand,
} from "@aws-sdk/client-cost-and-usage-report-service";
```

Expand All @@ -74,7 +74,7 @@ const client = new CostAndUsageReportServiceClient({ region: "REGION" });
const params = {
/** input parameters */
};
const command = new DescribeReportDefinitionsCommand(params);
const command = new ListTagsForResourceCommand(params);
```

#### Async/await
Expand Down Expand Up @@ -153,15 +153,15 @@ const client = new AWS.CostAndUsageReportService({ region: "REGION" });

// async/await.
try {
const data = await client.describeReportDefinitions(params);
const data = await client.listTagsForResource(params);
// process data.
} catch (error) {
// error handling.
}

// Promises.
client
.describeReportDefinitions(params)
.listTagsForResource(params)
.then((data) => {
// process data.
})
Expand All @@ -170,7 +170,7 @@ client
});

// callbacks.
client.describeReportDefinitions(params, (err, data) => {
client.listTagsForResource(params, (err, data) => {
// process err and data.
});
```
Expand Down Expand Up @@ -241,6 +241,14 @@ DescribeReportDefinitions

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-cost-and-usage-report-service/classes/describereportdefinitionscommand.html) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-cost-and-usage-report-service/interfaces/describereportdefinitionscommandinput.html) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-cost-and-usage-report-service/interfaces/describereportdefinitionscommandoutput.html)

</details>
<details>
<summary>
ListTagsForResource
</summary>

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-cost-and-usage-report-service/classes/listtagsforresourcecommand.html) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-cost-and-usage-report-service/interfaces/listtagsforresourcecommandinput.html) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-cost-and-usage-report-service/interfaces/listtagsforresourcecommandoutput.html)

</details>
<details>
<summary>
Expand All @@ -258,3 +266,19 @@ PutReportDefinition
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-cost-and-usage-report-service/classes/putreportdefinitioncommand.html) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-cost-and-usage-report-service/interfaces/putreportdefinitioncommandinput.html) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-cost-and-usage-report-service/interfaces/putreportdefinitioncommandoutput.html)

</details>
<details>
<summary>
TagResource
</summary>

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-cost-and-usage-report-service/classes/tagresourcecommand.html) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-cost-and-usage-report-service/interfaces/tagresourcecommandinput.html) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-cost-and-usage-report-service/interfaces/tagresourcecommandoutput.html)

</details>
<details>
<summary>
UntagResource
</summary>

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-cost-and-usage-report-service/classes/untagresourcecommand.html) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-cost-and-usage-report-service/interfaces/untagresourcecommandinput.html) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-cost-and-usage-report-service/interfaces/untagresourcecommandoutput.html)

</details>
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ import {
DescribeReportDefinitionsCommandInput,
DescribeReportDefinitionsCommandOutput,
} from "./commands/DescribeReportDefinitionsCommand";
import {
ListTagsForResourceCommand,
ListTagsForResourceCommandInput,
ListTagsForResourceCommandOutput,
} from "./commands/ListTagsForResourceCommand";
import {
ModifyReportDefinitionCommand,
ModifyReportDefinitionCommandInput,
Expand All @@ -22,6 +27,12 @@ import {
PutReportDefinitionCommandInput,
PutReportDefinitionCommandOutput,
} from "./commands/PutReportDefinitionCommand";
import { TagResourceCommand, TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand";
import {
UntagResourceCommand,
UntagResourceCommandInput,
UntagResourceCommandOutput,
} from "./commands/UntagResourceCommand";
import {
CostAndUsageReportServiceClient,
CostAndUsageReportServiceClientConfig,
Expand All @@ -30,8 +41,11 @@ import {
const commands = {
DeleteReportDefinitionCommand,
DescribeReportDefinitionsCommand,
ListTagsForResourceCommand,
ModifyReportDefinitionCommand,
PutReportDefinitionCommand,
TagResourceCommand,
UntagResourceCommand,
};

export interface CostAndUsageReportService {
Expand Down Expand Up @@ -69,6 +83,23 @@ export interface CostAndUsageReportService {
cb: (err: any, data?: DescribeReportDefinitionsCommandOutput) => void
): void;

/**
* @see {@link ListTagsForResourceCommand}
*/
listTagsForResource(
args: ListTagsForResourceCommandInput,
options?: __HttpHandlerOptions
): Promise<ListTagsForResourceCommandOutput>;
listTagsForResource(
args: ListTagsForResourceCommandInput,
cb: (err: any, data?: ListTagsForResourceCommandOutput) => void
): void;
listTagsForResource(
args: ListTagsForResourceCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: ListTagsForResourceCommandOutput) => void
): void;

/**
* @see {@link ModifyReportDefinitionCommand}
*/
Expand Down Expand Up @@ -102,23 +133,44 @@ export interface CostAndUsageReportService {
options: __HttpHandlerOptions,
cb: (err: any, data?: PutReportDefinitionCommandOutput) => void
): void;

/**
* @see {@link TagResourceCommand}
*/
tagResource(args: TagResourceCommandInput, options?: __HttpHandlerOptions): Promise<TagResourceCommandOutput>;
tagResource(args: TagResourceCommandInput, cb: (err: any, data?: TagResourceCommandOutput) => void): void;
tagResource(
args: TagResourceCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: TagResourceCommandOutput) => void
): void;

/**
* @see {@link UntagResourceCommand}
*/
untagResource(args: UntagResourceCommandInput, options?: __HttpHandlerOptions): Promise<UntagResourceCommandOutput>;
untagResource(args: UntagResourceCommandInput, cb: (err: any, data?: UntagResourceCommandOutput) => void): void;
untagResource(
args: UntagResourceCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: UntagResourceCommandOutput) => void
): void;
}

/**
* @public
* <p>The AWS Cost and Usage Report API enables you to programmatically create, query, and delete
* AWS Cost and Usage report definitions.</p>
* <p>AWS Cost and Usage reports track the monthly AWS costs and usage
* associated with your AWS account.
*
* The report contains line items for each unique combination of AWS product,
* usage type, and operation that your AWS account uses.
* <p>You can use the Amazon Web Services Cost and Usage Report API to programmatically create, query, and delete
* Amazon Web Services Cost and Usage Report definitions.</p>
* <p>Amazon Web Services Cost and Usage Report track the monthly Amazon Web Services costs and usage
* associated with your Amazon Web Services account.
*
* You can configure the AWS Cost and Usage report to show only the data that you want, using the
* AWS Cost and Usage API.</p>
* The report contains line items for each unique combination of Amazon Web Services product,
* usage type, and operation that your Amazon Web Services account uses.
*
* You can configure the Amazon Web Services Cost and Usage Report to show only the data that you want, using the
* Amazon Web Services Cost and Usage Report API.</p>
* <p>Service Endpoint</p>
* <p>The AWS Cost and Usage Report API provides the following endpoint:</p>
* <p>The Amazon Web Services Cost and Usage Report API provides the following endpoint:</p>
* <ul>
* <li>
* <p>cur.us-east-1.amazonaws.com</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ import {
DescribeReportDefinitionsCommandInput,
DescribeReportDefinitionsCommandOutput,
} from "./commands/DescribeReportDefinitionsCommand";
import {
ListTagsForResourceCommandInput,
ListTagsForResourceCommandOutput,
} from "./commands/ListTagsForResourceCommand";
import {
ModifyReportDefinitionCommandInput,
ModifyReportDefinitionCommandOutput,
Expand All @@ -66,6 +70,8 @@ import {
PutReportDefinitionCommandInput,
PutReportDefinitionCommandOutput,
} from "./commands/PutReportDefinitionCommand";
import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand";
import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand";
import {
ClientInputEndpointParameters,
ClientResolvedEndpointParameters,
Expand All @@ -83,17 +89,23 @@ export { __Client };
export type ServiceInputTypes =
| DeleteReportDefinitionCommandInput
| DescribeReportDefinitionsCommandInput
| ListTagsForResourceCommandInput
| ModifyReportDefinitionCommandInput
| PutReportDefinitionCommandInput;
| PutReportDefinitionCommandInput
| TagResourceCommandInput
| UntagResourceCommandInput;

/**
* @public
*/
export type ServiceOutputTypes =
| DeleteReportDefinitionCommandOutput
| DescribeReportDefinitionsCommandOutput
| ListTagsForResourceCommandOutput
| ModifyReportDefinitionCommandOutput
| PutReportDefinitionCommandOutput;
| PutReportDefinitionCommandOutput
| TagResourceCommandOutput
| UntagResourceCommandOutput;

/**
* @public
Expand Down Expand Up @@ -268,19 +280,18 @@ export interface CostAndUsageReportServiceClientResolvedConfig

/**
* @public
* <p>The AWS Cost and Usage Report API enables you to programmatically create, query, and delete
* AWS Cost and Usage report definitions.</p>
* <p>AWS Cost and Usage reports track the monthly AWS costs and usage
* associated with your AWS account.
*
* The report contains line items for each unique combination of AWS product,
* usage type, and operation that your AWS account uses.
* <p>You can use the Amazon Web Services Cost and Usage Report API to programmatically create, query, and delete
* Amazon Web Services Cost and Usage Report definitions.</p>
* <p>Amazon Web Services Cost and Usage Report track the monthly Amazon Web Services costs and usage
* associated with your Amazon Web Services account.
*
* You can configure the AWS Cost and Usage report to show only the data that you want, using the
* AWS Cost and Usage API.</p>
* The report contains line items for each unique combination of Amazon Web Services product,
* usage type, and operation that your Amazon Web Services account uses.
*
* You can configure the Amazon Web Services Cost and Usage Report to show only the data that you want, using the
* Amazon Web Services Cost and Usage Report API.</p>
* <p>Service Endpoint</p>
* <p>The AWS Cost and Usage Report API provides the following endpoint:</p>
* <p>The Amazon Web Services Cost and Usage Report API provides the following endpoint:</p>
* <ul>
* <li>
* <p>cur.us-east-1.amazonaws.com</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,16 @@ export interface DeleteReportDefinitionCommandOutput extends DeleteReportDefinit

/**
* @public
* <p>Deletes the specified report.</p>
* <p>Deletes the specified report. Any tags associated with the report are also
* deleted.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
* import { CostAndUsageReportServiceClient, DeleteReportDefinitionCommand } from "@aws-sdk/client-cost-and-usage-report-service"; // ES Modules import
* // const { CostAndUsageReportServiceClient, DeleteReportDefinitionCommand } = require("@aws-sdk/client-cost-and-usage-report-service"); // CommonJS import
* const client = new CostAndUsageReportServiceClient(config);
* const input = { // DeleteReportDefinitionRequest
* ReportName: "STRING_VALUE",
* ReportName: "STRING_VALUE", // required
* };
* const command = new DeleteReportDefinitionCommand(input);
* const response = await client.send(command);
Expand All @@ -69,7 +70,7 @@ export interface DeleteReportDefinitionCommandOutput extends DeleteReportDefinit
* <p>An error on the server occurred during the processing of your request. Try again later.</p>
*
* @throws {@link ValidationException} (client fault)
* <p>The input fails to satisfy the constraints specified by an AWS service.</p>
* <p>The input fails to satisfy the constraints specified by an Amazon Web Services service.</p>
*
* @throws {@link CostAndUsageReportServiceServiceException}
* <p>Base exception class for all service exceptions from CostAndUsageReportService service.</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export interface DescribeReportDefinitionsCommandOutput extends DescribeReportDe

/**
* @public
* <p>Lists the AWS Cost and Usage reports available to this account.</p>
* <p>Lists the Amazon Web Services Cost and Usage Report available to this account.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
Expand All @@ -62,7 +62,7 @@ export interface DescribeReportDefinitionsCommandOutput extends DescribeReportDe
* // Format: "textORcsv" || "Parquet", // required
* // Compression: "ZIP" || "GZIP" || "Parquet", // required
* // AdditionalSchemaElements: [ // SchemaElementList // required
* // "RESOURCES" || "SPLIT_COST_ALLOCATION_DATA",
* // "RESOURCES" || "SPLIT_COST_ALLOCATION_DATA" || "MANUAL_DISCOUNT_COMPATIBILITY",
* // ],
* // S3Bucket: "STRING_VALUE", // required
* // S3Prefix: "STRING_VALUE", // required
Expand All @@ -73,6 +73,10 @@ export interface DescribeReportDefinitionsCommandOutput extends DescribeReportDe
* // RefreshClosedReports: true || false,
* // ReportVersioning: "CREATE_NEW_REPORT" || "OVERWRITE_REPORT",
* // BillingViewArn: "STRING_VALUE",
* // ReportStatus: { // ReportStatus
* // lastDelivery: "STRING_VALUE",
* // lastStatus: "SUCCESS" || "ERROR_PERMISSIONS" || "ERROR_NO_BUCKET",
* // },
* // },
* // ],
* // NextToken: "STRING_VALUE",
Expand Down
Loading

0 comments on commit 1f24b22

Please sign in to comment.