Skip to content

Commit

Permalink
feat(client-cost-explorer): Adds support for backfill of cost allocat…
Browse files Browse the repository at this point in the history
…ion tags, with new StartCostAllocationTagBackfill and ListCostAllocationTagBackfillHistory API.
  • Loading branch information
awstools committed Mar 26, 2024
1 parent fe9f83d commit 715a001
Show file tree
Hide file tree
Showing 11 changed files with 782 additions and 0 deletions.
16 changes: 16 additions & 0 deletions clients/client-cost-explorer/README.md
Expand Up @@ -433,6 +433,14 @@ GetUsageForecast

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/cost-explorer/command/GetUsageForecastCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-cost-explorer/Interface/GetUsageForecastCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-cost-explorer/Interface/GetUsageForecastCommandOutput/)

</details>
<details>
<summary>
ListCostAllocationTagBackfillHistory
</summary>

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/cost-explorer/command/ListCostAllocationTagBackfillHistoryCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-cost-explorer/Interface/ListCostAllocationTagBackfillHistoryCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-cost-explorer/Interface/ListCostAllocationTagBackfillHistoryCommandOutput/)

</details>
<details>
<summary>
Expand Down Expand Up @@ -473,6 +481,14 @@ ProvideAnomalyFeedback

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/cost-explorer/command/ProvideAnomalyFeedbackCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-cost-explorer/Interface/ProvideAnomalyFeedbackCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-cost-explorer/Interface/ProvideAnomalyFeedbackCommandOutput/)

</details>
<details>
<summary>
StartCostAllocationTagBackfill
</summary>

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/cost-explorer/command/StartCostAllocationTagBackfillCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-cost-explorer/Interface/StartCostAllocationTagBackfillCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-cost-explorer/Interface/StartCostAllocationTagBackfillCommandOutput/)

</details>
<details>
<summary>
Expand Down
47 changes: 47 additions & 0 deletions clients/client-cost-explorer/src/CostExplorer.ts
Expand Up @@ -133,6 +133,11 @@ import {
GetUsageForecastCommandInput,
GetUsageForecastCommandOutput,
} from "./commands/GetUsageForecastCommand";
import {
ListCostAllocationTagBackfillHistoryCommand,
ListCostAllocationTagBackfillHistoryCommandInput,
ListCostAllocationTagBackfillHistoryCommandOutput,
} from "./commands/ListCostAllocationTagBackfillHistoryCommand";
import {
ListCostAllocationTagsCommand,
ListCostAllocationTagsCommandInput,
Expand All @@ -158,6 +163,11 @@ import {
ProvideAnomalyFeedbackCommandInput,
ProvideAnomalyFeedbackCommandOutput,
} from "./commands/ProvideAnomalyFeedbackCommand";
import {
StartCostAllocationTagBackfillCommand,
StartCostAllocationTagBackfillCommandInput,
StartCostAllocationTagBackfillCommandOutput,
} from "./commands/StartCostAllocationTagBackfillCommand";
import {
StartSavingsPlansPurchaseRecommendationGenerationCommand,
StartSavingsPlansPurchaseRecommendationGenerationCommandInput,
Expand Down Expand Up @@ -219,11 +229,13 @@ const commands = {
GetSavingsPlansUtilizationDetailsCommand,
GetTagsCommand,
GetUsageForecastCommand,
ListCostAllocationTagBackfillHistoryCommand,
ListCostAllocationTagsCommand,
ListCostCategoryDefinitionsCommand,
ListSavingsPlansPurchaseRecommendationGenerationCommand,
ListTagsForResourceCommand,
ProvideAnomalyFeedbackCommand,
StartCostAllocationTagBackfillCommand,
StartSavingsPlansPurchaseRecommendationGenerationCommand,
TagResourceCommand,
UntagResourceCommand,
Expand Down Expand Up @@ -677,6 +689,24 @@ export interface CostExplorer {
cb: (err: any, data?: GetUsageForecastCommandOutput) => void
): void;

/**
* @see {@link ListCostAllocationTagBackfillHistoryCommand}
*/
listCostAllocationTagBackfillHistory(): Promise<ListCostAllocationTagBackfillHistoryCommandOutput>;
listCostAllocationTagBackfillHistory(
args: ListCostAllocationTagBackfillHistoryCommandInput,
options?: __HttpHandlerOptions
): Promise<ListCostAllocationTagBackfillHistoryCommandOutput>;
listCostAllocationTagBackfillHistory(
args: ListCostAllocationTagBackfillHistoryCommandInput,
cb: (err: any, data?: ListCostAllocationTagBackfillHistoryCommandOutput) => void
): void;
listCostAllocationTagBackfillHistory(
args: ListCostAllocationTagBackfillHistoryCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: ListCostAllocationTagBackfillHistoryCommandOutput) => void
): void;

/**
* @see {@link ListCostAllocationTagsCommand}
*/
Expand Down Expand Up @@ -765,6 +795,23 @@ export interface CostExplorer {
cb: (err: any, data?: ProvideAnomalyFeedbackCommandOutput) => void
): void;

/**
* @see {@link StartCostAllocationTagBackfillCommand}
*/
startCostAllocationTagBackfill(
args: StartCostAllocationTagBackfillCommandInput,
options?: __HttpHandlerOptions
): Promise<StartCostAllocationTagBackfillCommandOutput>;
startCostAllocationTagBackfill(
args: StartCostAllocationTagBackfillCommandInput,
cb: (err: any, data?: StartCostAllocationTagBackfillCommandOutput) => void
): void;
startCostAllocationTagBackfill(
args: StartCostAllocationTagBackfillCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: StartCostAllocationTagBackfillCommandOutput) => void
): void;

/**
* @see {@link StartSavingsPlansPurchaseRecommendationGenerationCommand}
*/
Expand Down
12 changes: 12 additions & 0 deletions clients/client-cost-explorer/src/CostExplorerClient.ts
Expand Up @@ -137,6 +137,10 @@ import {
} from "./commands/GetSavingsPlansUtilizationDetailsCommand";
import { GetTagsCommandInput, GetTagsCommandOutput } from "./commands/GetTagsCommand";
import { GetUsageForecastCommandInput, GetUsageForecastCommandOutput } from "./commands/GetUsageForecastCommand";
import {
ListCostAllocationTagBackfillHistoryCommandInput,
ListCostAllocationTagBackfillHistoryCommandOutput,
} from "./commands/ListCostAllocationTagBackfillHistoryCommand";
import {
ListCostAllocationTagsCommandInput,
ListCostAllocationTagsCommandOutput,
Expand All @@ -157,6 +161,10 @@ import {
ProvideAnomalyFeedbackCommandInput,
ProvideAnomalyFeedbackCommandOutput,
} from "./commands/ProvideAnomalyFeedbackCommand";
import {
StartCostAllocationTagBackfillCommandInput,
StartCostAllocationTagBackfillCommandOutput,
} from "./commands/StartCostAllocationTagBackfillCommand";
import {
StartSavingsPlansPurchaseRecommendationGenerationCommandInput,
StartSavingsPlansPurchaseRecommendationGenerationCommandOutput,
Expand Down Expand Up @@ -221,11 +229,13 @@ export type ServiceInputTypes =
| GetSavingsPlansUtilizationDetailsCommandInput
| GetTagsCommandInput
| GetUsageForecastCommandInput
| ListCostAllocationTagBackfillHistoryCommandInput
| ListCostAllocationTagsCommandInput
| ListCostCategoryDefinitionsCommandInput
| ListSavingsPlansPurchaseRecommendationGenerationCommandInput
| ListTagsForResourceCommandInput
| ProvideAnomalyFeedbackCommandInput
| StartCostAllocationTagBackfillCommandInput
| StartSavingsPlansPurchaseRecommendationGenerationCommandInput
| TagResourceCommandInput
| UntagResourceCommandInput
Expand Down Expand Up @@ -265,11 +275,13 @@ export type ServiceOutputTypes =
| GetSavingsPlansUtilizationDetailsCommandOutput
| GetTagsCommandOutput
| GetUsageForecastCommandOutput
| ListCostAllocationTagBackfillHistoryCommandOutput
| ListCostAllocationTagsCommandOutput
| ListCostCategoryDefinitionsCommandOutput
| ListSavingsPlansPurchaseRecommendationGenerationCommandOutput
| ListTagsForResourceCommandOutput
| ProvideAnomalyFeedbackCommandOutput
| StartCostAllocationTagBackfillCommandOutput
| StartSavingsPlansPurchaseRecommendationGenerationCommandOutput
| TagResourceCommandOutput
| UntagResourceCommandOutput
Expand Down
@@ -0,0 +1,107 @@
// smithy-typescript generated code
import { getEndpointPlugin } from "@smithy/middleware-endpoint";
import { getSerdePlugin } from "@smithy/middleware-serde";
import { Command as $Command } from "@smithy/smithy-client";
import { MetadataBearer as __MetadataBearer } from "@smithy/types";

import { CostExplorerClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../CostExplorerClient";
import { commonParams } from "../endpoint/EndpointParameters";
import {
ListCostAllocationTagBackfillHistoryRequest,
ListCostAllocationTagBackfillHistoryResponse,
} from "../models/models_0";
import {
de_ListCostAllocationTagBackfillHistoryCommand,
se_ListCostAllocationTagBackfillHistoryCommand,
} from "../protocols/Aws_json1_1";

/**
* @public
*/
export { __MetadataBearer, $Command };
/**
* @public
*
* The input for {@link ListCostAllocationTagBackfillHistoryCommand}.
*/
export interface ListCostAllocationTagBackfillHistoryCommandInput extends ListCostAllocationTagBackfillHistoryRequest {}
/**
* @public
*
* The output of {@link ListCostAllocationTagBackfillHistoryCommand}.
*/
export interface ListCostAllocationTagBackfillHistoryCommandOutput
extends ListCostAllocationTagBackfillHistoryResponse,
__MetadataBearer {}

/**
* <p>
* Retrieves a list of your historical cost allocation tag backfill requests.
* </p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
* import { CostExplorerClient, ListCostAllocationTagBackfillHistoryCommand } from "@aws-sdk/client-cost-explorer"; // ES Modules import
* // const { CostExplorerClient, ListCostAllocationTagBackfillHistoryCommand } = require("@aws-sdk/client-cost-explorer"); // CommonJS import
* const client = new CostExplorerClient(config);
* const input = { // ListCostAllocationTagBackfillHistoryRequest
* NextToken: "STRING_VALUE",
* MaxResults: Number("int"),
* };
* const command = new ListCostAllocationTagBackfillHistoryCommand(input);
* const response = await client.send(command);
* // { // ListCostAllocationTagBackfillHistoryResponse
* // BackfillRequests: [ // CostAllocationTagBackfillRequestList
* // { // CostAllocationTagBackfillRequest
* // BackfillFrom: "STRING_VALUE",
* // RequestedAt: "STRING_VALUE",
* // CompletedAt: "STRING_VALUE",
* // BackfillStatus: "SUCCEEDED" || "PROCESSING" || "FAILED",
* // LastUpdatedAt: "STRING_VALUE",
* // },
* // ],
* // NextToken: "STRING_VALUE",
* // };
*
* ```
*
* @param ListCostAllocationTagBackfillHistoryCommandInput - {@link ListCostAllocationTagBackfillHistoryCommandInput}
* @returns {@link ListCostAllocationTagBackfillHistoryCommandOutput}
* @see {@link ListCostAllocationTagBackfillHistoryCommandInput} for command's `input` shape.
* @see {@link ListCostAllocationTagBackfillHistoryCommandOutput} for command's `response` shape.
* @see {@link CostExplorerClientResolvedConfig | config} for CostExplorerClient's `config` shape.
*
* @throws {@link InvalidNextTokenException} (client fault)
* <p>The pagination token is invalid. Try again without a pagination token.</p>
*
* @throws {@link LimitExceededException} (client fault)
* <p>You made too many calls in a short period of time. Try again later.</p>
*
* @throws {@link CostExplorerServiceException}
* <p>Base exception class for all service exceptions from CostExplorer service.</p>
*
* @public
*/
export class ListCostAllocationTagBackfillHistoryCommand extends $Command
.classBuilder<
ListCostAllocationTagBackfillHistoryCommandInput,
ListCostAllocationTagBackfillHistoryCommandOutput,
CostExplorerClientResolvedConfig,
ServiceInputTypes,
ServiceOutputTypes
>()
.ep({
...commonParams,
})
.m(function (this: any, Command: any, cs: any, config: CostExplorerClientResolvedConfig, o: any) {
return [
getSerdePlugin(config, this.serialize, this.deserialize),
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
];
})
.s("AWSInsightsIndexService", "ListCostAllocationTagBackfillHistory", {})
.n("CostExplorerClient", "ListCostAllocationTagBackfillHistoryCommand")
.f(void 0, void 0)
.ser(se_ListCostAllocationTagBackfillHistoryCommand)
.de(de_ListCostAllocationTagBackfillHistoryCommand)
.build() {}
@@ -0,0 +1,103 @@
// smithy-typescript generated code
import { getEndpointPlugin } from "@smithy/middleware-endpoint";
import { getSerdePlugin } from "@smithy/middleware-serde";
import { Command as $Command } from "@smithy/smithy-client";
import { MetadataBearer as __MetadataBearer } from "@smithy/types";

import { CostExplorerClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../CostExplorerClient";
import { commonParams } from "../endpoint/EndpointParameters";
import { StartCostAllocationTagBackfillRequest, StartCostAllocationTagBackfillResponse } from "../models/models_0";
import {
de_StartCostAllocationTagBackfillCommand,
se_StartCostAllocationTagBackfillCommand,
} from "../protocols/Aws_json1_1";

/**
* @public
*/
export { __MetadataBearer, $Command };
/**
* @public
*
* The input for {@link StartCostAllocationTagBackfillCommand}.
*/
export interface StartCostAllocationTagBackfillCommandInput extends StartCostAllocationTagBackfillRequest {}
/**
* @public
*
* The output of {@link StartCostAllocationTagBackfillCommand}.
*/
export interface StartCostAllocationTagBackfillCommandOutput
extends StartCostAllocationTagBackfillResponse,
__MetadataBearer {}

/**
* <p>
* Request a cost allocation tag backfill. This will backfill the activation status (either <code>active</code> or <code>inactive</code>) for all tag keys from <code>para:BackfillFrom</code> up to the when this request is made.</p>
* <p>You can request a backfill once every 24 hours.
* </p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
* import { CostExplorerClient, StartCostAllocationTagBackfillCommand } from "@aws-sdk/client-cost-explorer"; // ES Modules import
* // const { CostExplorerClient, StartCostAllocationTagBackfillCommand } = require("@aws-sdk/client-cost-explorer"); // CommonJS import
* const client = new CostExplorerClient(config);
* const input = { // StartCostAllocationTagBackfillRequest
* BackfillFrom: "STRING_VALUE", // required
* };
* const command = new StartCostAllocationTagBackfillCommand(input);
* const response = await client.send(command);
* // { // StartCostAllocationTagBackfillResponse
* // BackfillRequest: { // CostAllocationTagBackfillRequest
* // BackfillFrom: "STRING_VALUE",
* // RequestedAt: "STRING_VALUE",
* // CompletedAt: "STRING_VALUE",
* // BackfillStatus: "SUCCEEDED" || "PROCESSING" || "FAILED",
* // LastUpdatedAt: "STRING_VALUE",
* // },
* // };
*
* ```
*
* @param StartCostAllocationTagBackfillCommandInput - {@link StartCostAllocationTagBackfillCommandInput}
* @returns {@link StartCostAllocationTagBackfillCommandOutput}
* @see {@link StartCostAllocationTagBackfillCommandInput} for command's `input` shape.
* @see {@link StartCostAllocationTagBackfillCommandOutput} for command's `response` shape.
* @see {@link CostExplorerClientResolvedConfig | config} for CostExplorerClient's `config` shape.
*
* @throws {@link BackfillLimitExceededException} (client fault)
* <p>
* A request to backfill is already in progress. Once the previous request is complete, you can create another request.
* </p>
*
* @throws {@link LimitExceededException} (client fault)
* <p>You made too many calls in a short period of time. Try again later.</p>
*
* @throws {@link CostExplorerServiceException}
* <p>Base exception class for all service exceptions from CostExplorer service.</p>
*
* @public
*/
export class StartCostAllocationTagBackfillCommand extends $Command
.classBuilder<
StartCostAllocationTagBackfillCommandInput,
StartCostAllocationTagBackfillCommandOutput,
CostExplorerClientResolvedConfig,
ServiceInputTypes,
ServiceOutputTypes
>()
.ep({
...commonParams,
})
.m(function (this: any, Command: any, cs: any, config: CostExplorerClientResolvedConfig, o: any) {
return [
getSerdePlugin(config, this.serialize, this.deserialize),
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
];
})
.s("AWSInsightsIndexService", "StartCostAllocationTagBackfill", {})
.n("CostExplorerClient", "StartCostAllocationTagBackfillCommand")
.f(void 0, void 0)
.ser(se_StartCostAllocationTagBackfillCommand)
.de(de_StartCostAllocationTagBackfillCommand)
.build() {}
2 changes: 2 additions & 0 deletions clients/client-cost-explorer/src/commands/index.ts
Expand Up @@ -26,11 +26,13 @@ export * from "./GetSavingsPlansUtilizationCommand";
export * from "./GetSavingsPlansUtilizationDetailsCommand";
export * from "./GetTagsCommand";
export * from "./GetUsageForecastCommand";
export * from "./ListCostAllocationTagBackfillHistoryCommand";
export * from "./ListCostAllocationTagsCommand";
export * from "./ListCostCategoryDefinitionsCommand";
export * from "./ListSavingsPlansPurchaseRecommendationGenerationCommand";
export * from "./ListTagsForResourceCommand";
export * from "./ProvideAnomalyFeedbackCommand";
export * from "./StartCostAllocationTagBackfillCommand";
export * from "./StartSavingsPlansPurchaseRecommendationGenerationCommand";
export * from "./TagResourceCommand";
export * from "./UntagResourceCommand";
Expand Down

0 comments on commit 715a001

Please sign in to comment.