Skip to content

Commit 715a001

Browse files
author
awstools
committed
feat(client-cost-explorer): Adds support for backfill of cost allocation tags, with new StartCostAllocationTagBackfill and ListCostAllocationTagBackfillHistory API.
1 parent fe9f83d commit 715a001

File tree

11 files changed

+782
-0
lines changed

11 files changed

+782
-0
lines changed

clients/client-cost-explorer/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,14 @@ GetUsageForecast
433433

434434
[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/)
435435

436+
</details>
437+
<details>
438+
<summary>
439+
ListCostAllocationTagBackfillHistory
440+
</summary>
441+
442+
[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/)
443+
436444
</details>
437445
<details>
438446
<summary>
@@ -473,6 +481,14 @@ ProvideAnomalyFeedback
473481

474482
[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/)
475483

484+
</details>
485+
<details>
486+
<summary>
487+
StartCostAllocationTagBackfill
488+
</summary>
489+
490+
[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/)
491+
476492
</details>
477493
<details>
478494
<summary>

clients/client-cost-explorer/src/CostExplorer.ts

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,11 @@ import {
133133
GetUsageForecastCommandInput,
134134
GetUsageForecastCommandOutput,
135135
} from "./commands/GetUsageForecastCommand";
136+
import {
137+
ListCostAllocationTagBackfillHistoryCommand,
138+
ListCostAllocationTagBackfillHistoryCommandInput,
139+
ListCostAllocationTagBackfillHistoryCommandOutput,
140+
} from "./commands/ListCostAllocationTagBackfillHistoryCommand";
136141
import {
137142
ListCostAllocationTagsCommand,
138143
ListCostAllocationTagsCommandInput,
@@ -158,6 +163,11 @@ import {
158163
ProvideAnomalyFeedbackCommandInput,
159164
ProvideAnomalyFeedbackCommandOutput,
160165
} from "./commands/ProvideAnomalyFeedbackCommand";
166+
import {
167+
StartCostAllocationTagBackfillCommand,
168+
StartCostAllocationTagBackfillCommandInput,
169+
StartCostAllocationTagBackfillCommandOutput,
170+
} from "./commands/StartCostAllocationTagBackfillCommand";
161171
import {
162172
StartSavingsPlansPurchaseRecommendationGenerationCommand,
163173
StartSavingsPlansPurchaseRecommendationGenerationCommandInput,
@@ -219,11 +229,13 @@ const commands = {
219229
GetSavingsPlansUtilizationDetailsCommand,
220230
GetTagsCommand,
221231
GetUsageForecastCommand,
232+
ListCostAllocationTagBackfillHistoryCommand,
222233
ListCostAllocationTagsCommand,
223234
ListCostCategoryDefinitionsCommand,
224235
ListSavingsPlansPurchaseRecommendationGenerationCommand,
225236
ListTagsForResourceCommand,
226237
ProvideAnomalyFeedbackCommand,
238+
StartCostAllocationTagBackfillCommand,
227239
StartSavingsPlansPurchaseRecommendationGenerationCommand,
228240
TagResourceCommand,
229241
UntagResourceCommand,
@@ -677,6 +689,24 @@ export interface CostExplorer {
677689
cb: (err: any, data?: GetUsageForecastCommandOutput) => void
678690
): void;
679691

692+
/**
693+
* @see {@link ListCostAllocationTagBackfillHistoryCommand}
694+
*/
695+
listCostAllocationTagBackfillHistory(): Promise<ListCostAllocationTagBackfillHistoryCommandOutput>;
696+
listCostAllocationTagBackfillHistory(
697+
args: ListCostAllocationTagBackfillHistoryCommandInput,
698+
options?: __HttpHandlerOptions
699+
): Promise<ListCostAllocationTagBackfillHistoryCommandOutput>;
700+
listCostAllocationTagBackfillHistory(
701+
args: ListCostAllocationTagBackfillHistoryCommandInput,
702+
cb: (err: any, data?: ListCostAllocationTagBackfillHistoryCommandOutput) => void
703+
): void;
704+
listCostAllocationTagBackfillHistory(
705+
args: ListCostAllocationTagBackfillHistoryCommandInput,
706+
options: __HttpHandlerOptions,
707+
cb: (err: any, data?: ListCostAllocationTagBackfillHistoryCommandOutput) => void
708+
): void;
709+
680710
/**
681711
* @see {@link ListCostAllocationTagsCommand}
682712
*/
@@ -765,6 +795,23 @@ export interface CostExplorer {
765795
cb: (err: any, data?: ProvideAnomalyFeedbackCommandOutput) => void
766796
): void;
767797

798+
/**
799+
* @see {@link StartCostAllocationTagBackfillCommand}
800+
*/
801+
startCostAllocationTagBackfill(
802+
args: StartCostAllocationTagBackfillCommandInput,
803+
options?: __HttpHandlerOptions
804+
): Promise<StartCostAllocationTagBackfillCommandOutput>;
805+
startCostAllocationTagBackfill(
806+
args: StartCostAllocationTagBackfillCommandInput,
807+
cb: (err: any, data?: StartCostAllocationTagBackfillCommandOutput) => void
808+
): void;
809+
startCostAllocationTagBackfill(
810+
args: StartCostAllocationTagBackfillCommandInput,
811+
options: __HttpHandlerOptions,
812+
cb: (err: any, data?: StartCostAllocationTagBackfillCommandOutput) => void
813+
): void;
814+
768815
/**
769816
* @see {@link StartSavingsPlansPurchaseRecommendationGenerationCommand}
770817
*/

clients/client-cost-explorer/src/CostExplorerClient.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,10 @@ import {
137137
} from "./commands/GetSavingsPlansUtilizationDetailsCommand";
138138
import { GetTagsCommandInput, GetTagsCommandOutput } from "./commands/GetTagsCommand";
139139
import { GetUsageForecastCommandInput, GetUsageForecastCommandOutput } from "./commands/GetUsageForecastCommand";
140+
import {
141+
ListCostAllocationTagBackfillHistoryCommandInput,
142+
ListCostAllocationTagBackfillHistoryCommandOutput,
143+
} from "./commands/ListCostAllocationTagBackfillHistoryCommand";
140144
import {
141145
ListCostAllocationTagsCommandInput,
142146
ListCostAllocationTagsCommandOutput,
@@ -157,6 +161,10 @@ import {
157161
ProvideAnomalyFeedbackCommandInput,
158162
ProvideAnomalyFeedbackCommandOutput,
159163
} from "./commands/ProvideAnomalyFeedbackCommand";
164+
import {
165+
StartCostAllocationTagBackfillCommandInput,
166+
StartCostAllocationTagBackfillCommandOutput,
167+
} from "./commands/StartCostAllocationTagBackfillCommand";
160168
import {
161169
StartSavingsPlansPurchaseRecommendationGenerationCommandInput,
162170
StartSavingsPlansPurchaseRecommendationGenerationCommandOutput,
@@ -221,11 +229,13 @@ export type ServiceInputTypes =
221229
| GetSavingsPlansUtilizationDetailsCommandInput
222230
| GetTagsCommandInput
223231
| GetUsageForecastCommandInput
232+
| ListCostAllocationTagBackfillHistoryCommandInput
224233
| ListCostAllocationTagsCommandInput
225234
| ListCostCategoryDefinitionsCommandInput
226235
| ListSavingsPlansPurchaseRecommendationGenerationCommandInput
227236
| ListTagsForResourceCommandInput
228237
| ProvideAnomalyFeedbackCommandInput
238+
| StartCostAllocationTagBackfillCommandInput
229239
| StartSavingsPlansPurchaseRecommendationGenerationCommandInput
230240
| TagResourceCommandInput
231241
| UntagResourceCommandInput
@@ -265,11 +275,13 @@ export type ServiceOutputTypes =
265275
| GetSavingsPlansUtilizationDetailsCommandOutput
266276
| GetTagsCommandOutput
267277
| GetUsageForecastCommandOutput
278+
| ListCostAllocationTagBackfillHistoryCommandOutput
268279
| ListCostAllocationTagsCommandOutput
269280
| ListCostCategoryDefinitionsCommandOutput
270281
| ListSavingsPlansPurchaseRecommendationGenerationCommandOutput
271282
| ListTagsForResourceCommandOutput
272283
| ProvideAnomalyFeedbackCommandOutput
284+
| StartCostAllocationTagBackfillCommandOutput
273285
| StartSavingsPlansPurchaseRecommendationGenerationCommandOutput
274286
| TagResourceCommandOutput
275287
| UntagResourceCommandOutput
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
// smithy-typescript generated code
2+
import { getEndpointPlugin } from "@smithy/middleware-endpoint";
3+
import { getSerdePlugin } from "@smithy/middleware-serde";
4+
import { Command as $Command } from "@smithy/smithy-client";
5+
import { MetadataBearer as __MetadataBearer } from "@smithy/types";
6+
7+
import { CostExplorerClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../CostExplorerClient";
8+
import { commonParams } from "../endpoint/EndpointParameters";
9+
import {
10+
ListCostAllocationTagBackfillHistoryRequest,
11+
ListCostAllocationTagBackfillHistoryResponse,
12+
} from "../models/models_0";
13+
import {
14+
de_ListCostAllocationTagBackfillHistoryCommand,
15+
se_ListCostAllocationTagBackfillHistoryCommand,
16+
} from "../protocols/Aws_json1_1";
17+
18+
/**
19+
* @public
20+
*/
21+
export { __MetadataBearer, $Command };
22+
/**
23+
* @public
24+
*
25+
* The input for {@link ListCostAllocationTagBackfillHistoryCommand}.
26+
*/
27+
export interface ListCostAllocationTagBackfillHistoryCommandInput extends ListCostAllocationTagBackfillHistoryRequest {}
28+
/**
29+
* @public
30+
*
31+
* The output of {@link ListCostAllocationTagBackfillHistoryCommand}.
32+
*/
33+
export interface ListCostAllocationTagBackfillHistoryCommandOutput
34+
extends ListCostAllocationTagBackfillHistoryResponse,
35+
__MetadataBearer {}
36+
37+
/**
38+
* <p>
39+
* Retrieves a list of your historical cost allocation tag backfill requests.
40+
* </p>
41+
* @example
42+
* Use a bare-bones client and the command you need to make an API call.
43+
* ```javascript
44+
* import { CostExplorerClient, ListCostAllocationTagBackfillHistoryCommand } from "@aws-sdk/client-cost-explorer"; // ES Modules import
45+
* // const { CostExplorerClient, ListCostAllocationTagBackfillHistoryCommand } = require("@aws-sdk/client-cost-explorer"); // CommonJS import
46+
* const client = new CostExplorerClient(config);
47+
* const input = { // ListCostAllocationTagBackfillHistoryRequest
48+
* NextToken: "STRING_VALUE",
49+
* MaxResults: Number("int"),
50+
* };
51+
* const command = new ListCostAllocationTagBackfillHistoryCommand(input);
52+
* const response = await client.send(command);
53+
* // { // ListCostAllocationTagBackfillHistoryResponse
54+
* // BackfillRequests: [ // CostAllocationTagBackfillRequestList
55+
* // { // CostAllocationTagBackfillRequest
56+
* // BackfillFrom: "STRING_VALUE",
57+
* // RequestedAt: "STRING_VALUE",
58+
* // CompletedAt: "STRING_VALUE",
59+
* // BackfillStatus: "SUCCEEDED" || "PROCESSING" || "FAILED",
60+
* // LastUpdatedAt: "STRING_VALUE",
61+
* // },
62+
* // ],
63+
* // NextToken: "STRING_VALUE",
64+
* // };
65+
*
66+
* ```
67+
*
68+
* @param ListCostAllocationTagBackfillHistoryCommandInput - {@link ListCostAllocationTagBackfillHistoryCommandInput}
69+
* @returns {@link ListCostAllocationTagBackfillHistoryCommandOutput}
70+
* @see {@link ListCostAllocationTagBackfillHistoryCommandInput} for command's `input` shape.
71+
* @see {@link ListCostAllocationTagBackfillHistoryCommandOutput} for command's `response` shape.
72+
* @see {@link CostExplorerClientResolvedConfig | config} for CostExplorerClient's `config` shape.
73+
*
74+
* @throws {@link InvalidNextTokenException} (client fault)
75+
* <p>The pagination token is invalid. Try again without a pagination token.</p>
76+
*
77+
* @throws {@link LimitExceededException} (client fault)
78+
* <p>You made too many calls in a short period of time. Try again later.</p>
79+
*
80+
* @throws {@link CostExplorerServiceException}
81+
* <p>Base exception class for all service exceptions from CostExplorer service.</p>
82+
*
83+
* @public
84+
*/
85+
export class ListCostAllocationTagBackfillHistoryCommand extends $Command
86+
.classBuilder<
87+
ListCostAllocationTagBackfillHistoryCommandInput,
88+
ListCostAllocationTagBackfillHistoryCommandOutput,
89+
CostExplorerClientResolvedConfig,
90+
ServiceInputTypes,
91+
ServiceOutputTypes
92+
>()
93+
.ep({
94+
...commonParams,
95+
})
96+
.m(function (this: any, Command: any, cs: any, config: CostExplorerClientResolvedConfig, o: any) {
97+
return [
98+
getSerdePlugin(config, this.serialize, this.deserialize),
99+
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
100+
];
101+
})
102+
.s("AWSInsightsIndexService", "ListCostAllocationTagBackfillHistory", {})
103+
.n("CostExplorerClient", "ListCostAllocationTagBackfillHistoryCommand")
104+
.f(void 0, void 0)
105+
.ser(se_ListCostAllocationTagBackfillHistoryCommand)
106+
.de(de_ListCostAllocationTagBackfillHistoryCommand)
107+
.build() {}
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
// smithy-typescript generated code
2+
import { getEndpointPlugin } from "@smithy/middleware-endpoint";
3+
import { getSerdePlugin } from "@smithy/middleware-serde";
4+
import { Command as $Command } from "@smithy/smithy-client";
5+
import { MetadataBearer as __MetadataBearer } from "@smithy/types";
6+
7+
import { CostExplorerClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../CostExplorerClient";
8+
import { commonParams } from "../endpoint/EndpointParameters";
9+
import { StartCostAllocationTagBackfillRequest, StartCostAllocationTagBackfillResponse } from "../models/models_0";
10+
import {
11+
de_StartCostAllocationTagBackfillCommand,
12+
se_StartCostAllocationTagBackfillCommand,
13+
} from "../protocols/Aws_json1_1";
14+
15+
/**
16+
* @public
17+
*/
18+
export { __MetadataBearer, $Command };
19+
/**
20+
* @public
21+
*
22+
* The input for {@link StartCostAllocationTagBackfillCommand}.
23+
*/
24+
export interface StartCostAllocationTagBackfillCommandInput extends StartCostAllocationTagBackfillRequest {}
25+
/**
26+
* @public
27+
*
28+
* The output of {@link StartCostAllocationTagBackfillCommand}.
29+
*/
30+
export interface StartCostAllocationTagBackfillCommandOutput
31+
extends StartCostAllocationTagBackfillResponse,
32+
__MetadataBearer {}
33+
34+
/**
35+
* <p>
36+
* 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>
37+
* <p>You can request a backfill once every 24 hours.
38+
* </p>
39+
* @example
40+
* Use a bare-bones client and the command you need to make an API call.
41+
* ```javascript
42+
* import { CostExplorerClient, StartCostAllocationTagBackfillCommand } from "@aws-sdk/client-cost-explorer"; // ES Modules import
43+
* // const { CostExplorerClient, StartCostAllocationTagBackfillCommand } = require("@aws-sdk/client-cost-explorer"); // CommonJS import
44+
* const client = new CostExplorerClient(config);
45+
* const input = { // StartCostAllocationTagBackfillRequest
46+
* BackfillFrom: "STRING_VALUE", // required
47+
* };
48+
* const command = new StartCostAllocationTagBackfillCommand(input);
49+
* const response = await client.send(command);
50+
* // { // StartCostAllocationTagBackfillResponse
51+
* // BackfillRequest: { // CostAllocationTagBackfillRequest
52+
* // BackfillFrom: "STRING_VALUE",
53+
* // RequestedAt: "STRING_VALUE",
54+
* // CompletedAt: "STRING_VALUE",
55+
* // BackfillStatus: "SUCCEEDED" || "PROCESSING" || "FAILED",
56+
* // LastUpdatedAt: "STRING_VALUE",
57+
* // },
58+
* // };
59+
*
60+
* ```
61+
*
62+
* @param StartCostAllocationTagBackfillCommandInput - {@link StartCostAllocationTagBackfillCommandInput}
63+
* @returns {@link StartCostAllocationTagBackfillCommandOutput}
64+
* @see {@link StartCostAllocationTagBackfillCommandInput} for command's `input` shape.
65+
* @see {@link StartCostAllocationTagBackfillCommandOutput} for command's `response` shape.
66+
* @see {@link CostExplorerClientResolvedConfig | config} for CostExplorerClient's `config` shape.
67+
*
68+
* @throws {@link BackfillLimitExceededException} (client fault)
69+
* <p>
70+
* A request to backfill is already in progress. Once the previous request is complete, you can create another request.
71+
* </p>
72+
*
73+
* @throws {@link LimitExceededException} (client fault)
74+
* <p>You made too many calls in a short period of time. Try again later.</p>
75+
*
76+
* @throws {@link CostExplorerServiceException}
77+
* <p>Base exception class for all service exceptions from CostExplorer service.</p>
78+
*
79+
* @public
80+
*/
81+
export class StartCostAllocationTagBackfillCommand extends $Command
82+
.classBuilder<
83+
StartCostAllocationTagBackfillCommandInput,
84+
StartCostAllocationTagBackfillCommandOutput,
85+
CostExplorerClientResolvedConfig,
86+
ServiceInputTypes,
87+
ServiceOutputTypes
88+
>()
89+
.ep({
90+
...commonParams,
91+
})
92+
.m(function (this: any, Command: any, cs: any, config: CostExplorerClientResolvedConfig, o: any) {
93+
return [
94+
getSerdePlugin(config, this.serialize, this.deserialize),
95+
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
96+
];
97+
})
98+
.s("AWSInsightsIndexService", "StartCostAllocationTagBackfill", {})
99+
.n("CostExplorerClient", "StartCostAllocationTagBackfillCommand")
100+
.f(void 0, void 0)
101+
.ser(se_StartCostAllocationTagBackfillCommand)
102+
.de(de_StartCostAllocationTagBackfillCommand)
103+
.build() {}

clients/client-cost-explorer/src/commands/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@ export * from "./GetSavingsPlansUtilizationCommand";
2626
export * from "./GetSavingsPlansUtilizationDetailsCommand";
2727
export * from "./GetTagsCommand";
2828
export * from "./GetUsageForecastCommand";
29+
export * from "./ListCostAllocationTagBackfillHistoryCommand";
2930
export * from "./ListCostAllocationTagsCommand";
3031
export * from "./ListCostCategoryDefinitionsCommand";
3132
export * from "./ListSavingsPlansPurchaseRecommendationGenerationCommand";
3233
export * from "./ListTagsForResourceCommand";
3334
export * from "./ProvideAnomalyFeedbackCommand";
35+
export * from "./StartCostAllocationTagBackfillCommand";
3436
export * from "./StartSavingsPlansPurchaseRecommendationGenerationCommand";
3537
export * from "./TagResourceCommand";
3638
export * from "./UntagResourceCommand";

0 commit comments

Comments
 (0)