From 715a00104c6af1449ae4a0765863143e26d1c047 Mon Sep 17 00:00:00 2001 From: awstools Date: Tue, 26 Mar 2024 18:22:15 +0000 Subject: [PATCH] feat(client-cost-explorer): Adds support for backfill of cost allocation tags, with new StartCostAllocationTagBackfill and ListCostAllocationTagBackfillHistory API. --- clients/client-cost-explorer/README.md | 16 ++ .../client-cost-explorer/src/CostExplorer.ts | 47 ++++ .../src/CostExplorerClient.ts | 12 + ...CostAllocationTagBackfillHistoryCommand.ts | 107 +++++++++ .../StartCostAllocationTagBackfillCommand.ts | 103 +++++++++ .../src/commands/index.ts | 2 + .../src/models/models_0.ts | 154 +++++++++++++ ...stAllocationTagBackfillHistoryPaginator.ts | 24 ++ .../src/pagination/index.ts | 1 + .../src/protocols/Aws_json1_1.ts | 110 ++++++++++ .../sdk-codegen/aws-models/cost-explorer.json | 206 ++++++++++++++++++ 11 files changed, 782 insertions(+) create mode 100644 clients/client-cost-explorer/src/commands/ListCostAllocationTagBackfillHistoryCommand.ts create mode 100644 clients/client-cost-explorer/src/commands/StartCostAllocationTagBackfillCommand.ts create mode 100644 clients/client-cost-explorer/src/pagination/ListCostAllocationTagBackfillHistoryPaginator.ts diff --git a/clients/client-cost-explorer/README.md b/clients/client-cost-explorer/README.md index 0318f0239b94..de92382926d0 100644 --- a/clients/client-cost-explorer/README.md +++ b/clients/client-cost-explorer/README.md @@ -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/) + +
+ +ListCostAllocationTagBackfillHistory + + +[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/) +
@@ -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/) +
+
+ +StartCostAllocationTagBackfill + + +[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/) +
diff --git a/clients/client-cost-explorer/src/CostExplorer.ts b/clients/client-cost-explorer/src/CostExplorer.ts index 5a1fa6ae9b6d..fc6d94835afc 100644 --- a/clients/client-cost-explorer/src/CostExplorer.ts +++ b/clients/client-cost-explorer/src/CostExplorer.ts @@ -133,6 +133,11 @@ import { GetUsageForecastCommandInput, GetUsageForecastCommandOutput, } from "./commands/GetUsageForecastCommand"; +import { + ListCostAllocationTagBackfillHistoryCommand, + ListCostAllocationTagBackfillHistoryCommandInput, + ListCostAllocationTagBackfillHistoryCommandOutput, +} from "./commands/ListCostAllocationTagBackfillHistoryCommand"; import { ListCostAllocationTagsCommand, ListCostAllocationTagsCommandInput, @@ -158,6 +163,11 @@ import { ProvideAnomalyFeedbackCommandInput, ProvideAnomalyFeedbackCommandOutput, } from "./commands/ProvideAnomalyFeedbackCommand"; +import { + StartCostAllocationTagBackfillCommand, + StartCostAllocationTagBackfillCommandInput, + StartCostAllocationTagBackfillCommandOutput, +} from "./commands/StartCostAllocationTagBackfillCommand"; import { StartSavingsPlansPurchaseRecommendationGenerationCommand, StartSavingsPlansPurchaseRecommendationGenerationCommandInput, @@ -219,11 +229,13 @@ const commands = { GetSavingsPlansUtilizationDetailsCommand, GetTagsCommand, GetUsageForecastCommand, + ListCostAllocationTagBackfillHistoryCommand, ListCostAllocationTagsCommand, ListCostCategoryDefinitionsCommand, ListSavingsPlansPurchaseRecommendationGenerationCommand, ListTagsForResourceCommand, ProvideAnomalyFeedbackCommand, + StartCostAllocationTagBackfillCommand, StartSavingsPlansPurchaseRecommendationGenerationCommand, TagResourceCommand, UntagResourceCommand, @@ -677,6 +689,24 @@ export interface CostExplorer { cb: (err: any, data?: GetUsageForecastCommandOutput) => void ): void; + /** + * @see {@link ListCostAllocationTagBackfillHistoryCommand} + */ + listCostAllocationTagBackfillHistory(): Promise; + listCostAllocationTagBackfillHistory( + args: ListCostAllocationTagBackfillHistoryCommandInput, + options?: __HttpHandlerOptions + ): Promise; + 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} */ @@ -765,6 +795,23 @@ export interface CostExplorer { cb: (err: any, data?: ProvideAnomalyFeedbackCommandOutput) => void ): void; + /** + * @see {@link StartCostAllocationTagBackfillCommand} + */ + startCostAllocationTagBackfill( + args: StartCostAllocationTagBackfillCommandInput, + options?: __HttpHandlerOptions + ): Promise; + 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} */ diff --git a/clients/client-cost-explorer/src/CostExplorerClient.ts b/clients/client-cost-explorer/src/CostExplorerClient.ts index 1bd0370ccb6c..8bcc0e808e69 100644 --- a/clients/client-cost-explorer/src/CostExplorerClient.ts +++ b/clients/client-cost-explorer/src/CostExplorerClient.ts @@ -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, @@ -157,6 +161,10 @@ import { ProvideAnomalyFeedbackCommandInput, ProvideAnomalyFeedbackCommandOutput, } from "./commands/ProvideAnomalyFeedbackCommand"; +import { + StartCostAllocationTagBackfillCommandInput, + StartCostAllocationTagBackfillCommandOutput, +} from "./commands/StartCostAllocationTagBackfillCommand"; import { StartSavingsPlansPurchaseRecommendationGenerationCommandInput, StartSavingsPlansPurchaseRecommendationGenerationCommandOutput, @@ -221,11 +229,13 @@ export type ServiceInputTypes = | GetSavingsPlansUtilizationDetailsCommandInput | GetTagsCommandInput | GetUsageForecastCommandInput + | ListCostAllocationTagBackfillHistoryCommandInput | ListCostAllocationTagsCommandInput | ListCostCategoryDefinitionsCommandInput | ListSavingsPlansPurchaseRecommendationGenerationCommandInput | ListTagsForResourceCommandInput | ProvideAnomalyFeedbackCommandInput + | StartCostAllocationTagBackfillCommandInput | StartSavingsPlansPurchaseRecommendationGenerationCommandInput | TagResourceCommandInput | UntagResourceCommandInput @@ -265,11 +275,13 @@ export type ServiceOutputTypes = | GetSavingsPlansUtilizationDetailsCommandOutput | GetTagsCommandOutput | GetUsageForecastCommandOutput + | ListCostAllocationTagBackfillHistoryCommandOutput | ListCostAllocationTagsCommandOutput | ListCostCategoryDefinitionsCommandOutput | ListSavingsPlansPurchaseRecommendationGenerationCommandOutput | ListTagsForResourceCommandOutput | ProvideAnomalyFeedbackCommandOutput + | StartCostAllocationTagBackfillCommandOutput | StartSavingsPlansPurchaseRecommendationGenerationCommandOutput | TagResourceCommandOutput | UntagResourceCommandOutput diff --git a/clients/client-cost-explorer/src/commands/ListCostAllocationTagBackfillHistoryCommand.ts b/clients/client-cost-explorer/src/commands/ListCostAllocationTagBackfillHistoryCommand.ts new file mode 100644 index 000000000000..a4d1c1057eb9 --- /dev/null +++ b/clients/client-cost-explorer/src/commands/ListCostAllocationTagBackfillHistoryCommand.ts @@ -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 {} + +/** + *

+ * Retrieves a list of your historical cost allocation tag backfill requests. + *

+ * @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) + *

The pagination token is invalid. Try again without a pagination token.

+ * + * @throws {@link LimitExceededException} (client fault) + *

You made too many calls in a short period of time. Try again later.

+ * + * @throws {@link CostExplorerServiceException} + *

Base exception class for all service exceptions from CostExplorer service.

+ * + * @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() {} diff --git a/clients/client-cost-explorer/src/commands/StartCostAllocationTagBackfillCommand.ts b/clients/client-cost-explorer/src/commands/StartCostAllocationTagBackfillCommand.ts new file mode 100644 index 000000000000..e97a439b1028 --- /dev/null +++ b/clients/client-cost-explorer/src/commands/StartCostAllocationTagBackfillCommand.ts @@ -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 {} + +/** + *

+ * Request a cost allocation tag backfill. This will backfill the activation status (either active or inactive) for all tag keys from para:BackfillFrom up to the when this request is made.

+ *

You can request a backfill once every 24 hours. + *

+ * @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) + *

+ * A request to backfill is already in progress. Once the previous request is complete, you can create another request. + *

+ * + * @throws {@link LimitExceededException} (client fault) + *

You made too many calls in a short period of time. Try again later.

+ * + * @throws {@link CostExplorerServiceException} + *

Base exception class for all service exceptions from CostExplorer service.

+ * + * @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() {} diff --git a/clients/client-cost-explorer/src/commands/index.ts b/clients/client-cost-explorer/src/commands/index.ts index 19e42ec79e8c..ee24a26d04d0 100644 --- a/clients/client-cost-explorer/src/commands/index.ts +++ b/clients/client-cost-explorer/src/commands/index.ts @@ -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"; diff --git a/clients/client-cost-explorer/src/models/models_0.ts b/clients/client-cost-explorer/src/models/models_0.ts index 722bcbdc0ce5..d6d10694e343 100644 --- a/clients/client-cost-explorer/src/models/models_0.ts +++ b/clients/client-cost-explorer/src/models/models_0.ts @@ -4473,6 +4473,111 @@ export class UnresolvableUsageUnitException extends __BaseException { } } +/** + * @public + */ +export interface ListCostAllocationTagBackfillHistoryRequest { + /** + *

+ * The token to retrieve the next set of results. Amazon Web Services provides the token when the response from a previous call has more results than the maximum page size. + *

+ * @public + */ + NextToken?: string; + + /** + *

+ * The maximum number of objects that are returned for this request. + *

+ * @public + */ + MaxResults?: number; +} + +/** + * @public + * @enum + */ +export const CostAllocationTagBackfillStatus = { + FAILED: "FAILED", + PROCESSING: "PROCESSING", + SUCCEEDED: "SUCCEEDED", +} as const; + +/** + * @public + */ +export type CostAllocationTagBackfillStatus = + (typeof CostAllocationTagBackfillStatus)[keyof typeof CostAllocationTagBackfillStatus]; + +/** + *

+ * The cost allocation tag backfill request structure that contains metadata and details of a certain backfill.

+ * @public + */ +export interface CostAllocationTagBackfillRequest { + /** + *

+ * The date the backfill starts from. + *

+ * @public + */ + BackfillFrom?: string; + + /** + *

+ * The time when the backfill was requested. + *

+ * @public + */ + RequestedAt?: string; + + /** + *

+ * The backfill completion time. + *

+ * @public + */ + CompletedAt?: string; + + /** + *

+ * The status of the cost allocation tag backfill request. + *

+ * @public + */ + BackfillStatus?: CostAllocationTagBackfillStatus; + + /** + *

+ * The time when the backfill status was last updated. + *

+ * @public + */ + LastUpdatedAt?: string; +} + +/** + * @public + */ +export interface ListCostAllocationTagBackfillHistoryResponse { + /** + *

+ * The list of historical cost allocation tag backfill requests. + *

+ * @public + */ + BackfillRequests?: CostAllocationTagBackfillRequest[]; + + /** + *

+ * The token to retrieve the next set of results. Amazon Web Services provides the token when the response from a previous call has more results than the maximum page size. + *

+ * @public + */ + NextToken?: string; +} + /** * @public * @enum @@ -4854,6 +4959,55 @@ export interface ProvideAnomalyFeedbackResponse { AnomalyId: string | undefined; } +/** + *

+ * A request to backfill is already in progress. Once the previous request is complete, you can create another request. + *

+ * @public + */ +export class BackfillLimitExceededException extends __BaseException { + readonly name: "BackfillLimitExceededException" = "BackfillLimitExceededException"; + readonly $fault: "client" = "client"; + Message?: string; + /** + * @internal + */ + constructor(opts: __ExceptionOptionType) { + super({ + name: "BackfillLimitExceededException", + $fault: "client", + ...opts, + }); + Object.setPrototypeOf(this, BackfillLimitExceededException.prototype); + this.Message = opts.Message; + } +} + +/** + * @public + */ +export interface StartCostAllocationTagBackfillRequest { + /** + *

+ * The date you want the backfill to start from. The date can only be a first day of the month (a billing start date). Dates can't precede the previous twelve months, or in the future.

+ * @public + */ + BackfillFrom: string | undefined; +} + +/** + * @public + */ +export interface StartCostAllocationTagBackfillResponse { + /** + *

+ * An object containing detailed metadata of your new backfill request. + *

+ * @public + */ + BackfillRequest?: CostAllocationTagBackfillRequest; +} + /** *

A request to generate a recommendation is already in progress.

* @public diff --git a/clients/client-cost-explorer/src/pagination/ListCostAllocationTagBackfillHistoryPaginator.ts b/clients/client-cost-explorer/src/pagination/ListCostAllocationTagBackfillHistoryPaginator.ts new file mode 100644 index 000000000000..706a7a459f5f --- /dev/null +++ b/clients/client-cost-explorer/src/pagination/ListCostAllocationTagBackfillHistoryPaginator.ts @@ -0,0 +1,24 @@ +// smithy-typescript generated code +import { createPaginator } from "@smithy/core"; +import { Paginator } from "@smithy/types"; + +import { + ListCostAllocationTagBackfillHistoryCommand, + ListCostAllocationTagBackfillHistoryCommandInput, + ListCostAllocationTagBackfillHistoryCommandOutput, +} from "../commands/ListCostAllocationTagBackfillHistoryCommand"; +import { CostExplorerClient } from "../CostExplorerClient"; +import { CostExplorerPaginationConfiguration } from "./Interfaces"; + +/** + * @public + */ +export const paginateListCostAllocationTagBackfillHistory: ( + config: CostExplorerPaginationConfiguration, + input: ListCostAllocationTagBackfillHistoryCommandInput, + ...rest: any[] +) => Paginator = createPaginator< + CostExplorerPaginationConfiguration, + ListCostAllocationTagBackfillHistoryCommandInput, + ListCostAllocationTagBackfillHistoryCommandOutput +>(CostExplorerClient, ListCostAllocationTagBackfillHistoryCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-cost-explorer/src/pagination/index.ts b/clients/client-cost-explorer/src/pagination/index.ts index 2ec93d8ad6df..f776ef146e96 100644 --- a/clients/client-cost-explorer/src/pagination/index.ts +++ b/clients/client-cost-explorer/src/pagination/index.ts @@ -3,5 +3,6 @@ export * from "./GetSavingsPlansCoveragePaginator"; export * from "./GetSavingsPlansUtilizationDetailsPaginator"; // smithy-typescript generated code export * from "./Interfaces"; +export * from "./ListCostAllocationTagBackfillHistoryPaginator"; export * from "./ListCostAllocationTagsPaginator"; export * from "./ListCostCategoryDefinitionsPaginator"; diff --git a/clients/client-cost-explorer/src/protocols/Aws_json1_1.ts b/clients/client-cost-explorer/src/protocols/Aws_json1_1.ts index 11768585eabb..1ab886b64d0e 100644 --- a/clients/client-cost-explorer/src/protocols/Aws_json1_1.ts +++ b/clients/client-cost-explorer/src/protocols/Aws_json1_1.ts @@ -103,6 +103,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, @@ -123,6 +127,10 @@ import { ProvideAnomalyFeedbackCommandInput, ProvideAnomalyFeedbackCommandOutput, } from "../commands/ProvideAnomalyFeedbackCommand"; +import { + StartCostAllocationTagBackfillCommandInput, + StartCostAllocationTagBackfillCommandOutput, +} from "../commands/StartCostAllocationTagBackfillCommand"; import { StartSavingsPlansPurchaseRecommendationGenerationCommandInput, StartSavingsPlansPurchaseRecommendationGenerationCommandOutput, @@ -152,6 +160,7 @@ import { AnomalyMonitor, AnomalyScore, AnomalySubscription, + BackfillLimitExceededException, BillExpirationException, CostAllocationTagStatusEntry, CostCategory, @@ -201,6 +210,7 @@ import { Impact, InvalidNextTokenException, LimitExceededException, + ListCostAllocationTagBackfillHistoryRequest, ListCostAllocationTagsRequest, ListCostCategoryDefinitionsRequest, ListSavingsPlansPurchaseRecommendationGenerationRequest, @@ -215,6 +225,7 @@ import { ServiceQuotaExceededException, ServiceSpecification, SortDefinition, + StartCostAllocationTagBackfillRequest, StartSavingsPlansPurchaseRecommendationGenerationRequest, Subscriber, TagResourceRequest, @@ -582,6 +593,19 @@ export const se_GetUsageForecastCommand = async ( return buildHttpRpcRequest(context, headers, "/", undefined, body); }; +/** + * serializeAws_json1_1ListCostAllocationTagBackfillHistoryCommand + */ +export const se_ListCostAllocationTagBackfillHistoryCommand = async ( + input: ListCostAllocationTagBackfillHistoryCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = sharedHeaders("ListCostAllocationTagBackfillHistory"); + let body: any; + body = JSON.stringify(_json(input)); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + /** * serializeAws_json1_1ListCostAllocationTagsCommand */ @@ -647,6 +671,19 @@ export const se_ProvideAnomalyFeedbackCommand = async ( return buildHttpRpcRequest(context, headers, "/", undefined, body); }; +/** + * serializeAws_json1_1StartCostAllocationTagBackfillCommand + */ +export const se_StartCostAllocationTagBackfillCommand = async ( + input: StartCostAllocationTagBackfillCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = sharedHeaders("StartCostAllocationTagBackfill"); + let body: any; + body = JSON.stringify(_json(input)); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + /** * serializeAws_json1_1StartSavingsPlansPurchaseRecommendationGenerationCommand */ @@ -1278,6 +1315,26 @@ export const de_GetUsageForecastCommand = async ( return response; }; +/** + * deserializeAws_json1_1ListCostAllocationTagBackfillHistoryCommand + */ +export const de_ListCostAllocationTagBackfillHistoryCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); + } + const data: any = await parseBody(output.body, context); + let contents: any = {}; + contents = _json(data); + const response: ListCostAllocationTagBackfillHistoryCommandOutput = { + $metadata: deserializeMetadata(output), + ...contents, + }; + return response; +}; + /** * deserializeAws_json1_1ListCostAllocationTagsCommand */ @@ -1378,6 +1435,26 @@ export const de_ProvideAnomalyFeedbackCommand = async ( return response; }; +/** + * deserializeAws_json1_1StartCostAllocationTagBackfillCommand + */ +export const de_StartCostAllocationTagBackfillCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); + } + const data: any = await parseBody(output.body, context); + let contents: any = {}; + contents = _json(data); + const response: StartCostAllocationTagBackfillCommandOutput = { + $metadata: deserializeMetadata(output), + ...contents, + }; + return response; +}; + /** * deserializeAws_json1_1StartSavingsPlansPurchaseRecommendationGenerationCommand */ @@ -1558,6 +1635,9 @@ const de_CommandError = async (output: __HttpResponse, context: __SerdeContext): case "UnresolvableUsageUnitException": case "com.amazonaws.costexplorer#UnresolvableUsageUnitException": throw await de_UnresolvableUsageUnitExceptionRes(parsedOutput, context); + case "BackfillLimitExceededException": + case "com.amazonaws.costexplorer#BackfillLimitExceededException": + throw await de_BackfillLimitExceededExceptionRes(parsedOutput, context); case "GenerationExistsException": case "com.amazonaws.costexplorer#GenerationExistsException": throw await de_GenerationExistsExceptionRes(parsedOutput, context); @@ -1574,6 +1654,22 @@ const de_CommandError = async (output: __HttpResponse, context: __SerdeContext): } }; +/** + * deserializeAws_json1_1BackfillLimitExceededExceptionRes + */ +const de_BackfillLimitExceededExceptionRes = async ( + parsedOutput: any, + context: __SerdeContext +): Promise => { + const body = parsedOutput.body; + const deserialized: any = _json(body); + const exception = new BackfillLimitExceededException({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized, + }); + return __decorateServiceException(exception, body); +}; + /** * deserializeAws_json1_1BillExpirationExceptionRes */ @@ -2187,6 +2283,8 @@ const se_GetUsageForecastRequest = (input: GetUsageForecastRequest, context: __S // se_GroupDefinitions omitted. +// se_ListCostAllocationTagBackfillHistoryRequest omitted. + // se_ListCostAllocationTagsRequest omitted. // se_ListCostCategoryDefinitionsRequest omitted. @@ -2221,6 +2319,8 @@ const se_GetUsageForecastRequest = (input: GetUsageForecastRequest, context: __S // se_SortDefinitions omitted. +// se_StartCostAllocationTagBackfillRequest omitted. + // se_StartSavingsPlansPurchaseRecommendationGenerationRequest omitted. // se_Subscriber omitted. @@ -2384,10 +2484,16 @@ const de_AnomalySubscriptions = (output: any, context: __SerdeContext): AnomalyS // de_Attributes omitted. +// de_BackfillLimitExceededException omitted. + // de_BillExpirationException omitted. // de_CostAllocationTag omitted. +// de_CostAllocationTagBackfillRequest omitted. + +// de_CostAllocationTagBackfillRequestList omitted. + // de_CostAllocationTagList omitted. /** @@ -2654,6 +2760,8 @@ const de_Impact = (output: any, context: __SerdeContext): Impact => { // de_LimitExceededException omitted. +// de_ListCostAllocationTagBackfillHistoryResponse omitted. + // de_ListCostAllocationTagsResponse omitted. // de_ListCostCategoryDefinitionsResponse omitted. @@ -2780,6 +2888,8 @@ const de_Impact = (output: any, context: __SerdeContext): Impact => { // de_ServiceSpecification omitted. +// de_StartCostAllocationTagBackfillResponse omitted. + // de_StartSavingsPlansPurchaseRecommendationGenerationResponse omitted. // de_Subscriber omitted. diff --git a/codegen/sdk-codegen/aws-models/cost-explorer.json b/codegen/sdk-codegen/aws-models/cost-explorer.json index 4da77e0a8a4b..cb0a3489054f 100644 --- a/codegen/sdk-codegen/aws-models/cost-explorer.json +++ b/codegen/sdk-codegen/aws-models/cost-explorer.json @@ -114,6 +114,9 @@ { "target": "com.amazonaws.costexplorer#GetUsageForecast" }, + { + "target": "com.amazonaws.costexplorer#ListCostAllocationTagBackfillHistory" + }, { "target": "com.amazonaws.costexplorer#ListCostAllocationTags" }, @@ -129,6 +132,9 @@ { "target": "com.amazonaws.costexplorer#ProvideAnomalyFeedback" }, + { + "target": "com.amazonaws.costexplorer#StartCostAllocationTagBackfill" + }, { "target": "com.amazonaws.costexplorer#StartSavingsPlansPurchaseRecommendationGeneration" }, @@ -1334,6 +1340,19 @@ "target": "com.amazonaws.costexplorer#AttributeValue" } }, + "com.amazonaws.costexplorer#BackfillLimitExceededException": { + "type": "structure", + "members": { + "Message": { + "target": "com.amazonaws.costexplorer#ErrorMessage" + } + }, + "traits": { + "smithy.api#documentation": "

\n A request to backfill is already in progress. Once the previous request is complete, you can create another request.\n

", + "smithy.api#error": "client", + "smithy.api#httpError": 400 + } + }, "com.amazonaws.costexplorer#BillExpirationException": { "type": "structure", "members": { @@ -1410,6 +1429,79 @@ "smithy.api#documentation": "

The cost allocation tag structure. This includes detailed metadata for the\n CostAllocationTag object.

" } }, + "com.amazonaws.costexplorer#CostAllocationTagBackfillRequest": { + "type": "structure", + "members": { + "BackfillFrom": { + "target": "com.amazonaws.costexplorer#ZonedDateTime", + "traits": { + "smithy.api#documentation": "

\n The date the backfill starts from.\n

" + } + }, + "RequestedAt": { + "target": "com.amazonaws.costexplorer#ZonedDateTime", + "traits": { + "smithy.api#documentation": "

\n The time when the backfill was requested.\n

" + } + }, + "CompletedAt": { + "target": "com.amazonaws.costexplorer#ZonedDateTime", + "traits": { + "smithy.api#documentation": "

\n The backfill completion time.\n

" + } + }, + "BackfillStatus": { + "target": "com.amazonaws.costexplorer#CostAllocationTagBackfillStatus", + "traits": { + "smithy.api#documentation": "

\n The status of the cost allocation tag backfill request.\n

" + } + }, + "LastUpdatedAt": { + "target": "com.amazonaws.costexplorer#ZonedDateTime", + "traits": { + "smithy.api#documentation": "

\n The time when the backfill status was last updated.\n

" + } + } + }, + "traits": { + "smithy.api#documentation": "

\n The cost allocation tag backfill request structure that contains metadata and details of a certain backfill.

" + } + }, + "com.amazonaws.costexplorer#CostAllocationTagBackfillRequestList": { + "type": "list", + "member": { + "target": "com.amazonaws.costexplorer#CostAllocationTagBackfillRequest" + }, + "traits": { + "smithy.api#length": { + "min": 0, + "max": 1000 + } + } + }, + "com.amazonaws.costexplorer#CostAllocationTagBackfillStatus": { + "type": "enum", + "members": { + "SUCCEEDED": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "SUCCEEDED" + } + }, + "PROCESSING": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "PROCESSING" + } + }, + "FAILED": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "FAILED" + } + } + } + }, "com.amazonaws.costexplorer#CostAllocationTagKeyList": { "type": "list", "member": { @@ -5660,6 +5752,71 @@ "smithy.api#error": "client" } }, + "com.amazonaws.costexplorer#ListCostAllocationTagBackfillHistory": { + "type": "operation", + "input": { + "target": "com.amazonaws.costexplorer#ListCostAllocationTagBackfillHistoryRequest" + }, + "output": { + "target": "com.amazonaws.costexplorer#ListCostAllocationTagBackfillHistoryResponse" + }, + "errors": [ + { + "target": "com.amazonaws.costexplorer#InvalidNextTokenException" + }, + { + "target": "com.amazonaws.costexplorer#LimitExceededException" + } + ], + "traits": { + "smithy.api#documentation": "

\n Retrieves a list of your historical cost allocation tag backfill requests.\n

", + "smithy.api#paginated": { + "inputToken": "NextToken", + "outputToken": "NextToken", + "pageSize": "MaxResults" + } + } + }, + "com.amazonaws.costexplorer#ListCostAllocationTagBackfillHistoryRequest": { + "type": "structure", + "members": { + "NextToken": { + "target": "com.amazonaws.costexplorer#NextPageToken", + "traits": { + "smithy.api#documentation": "

\n The token to retrieve the next set of results. Amazon Web Services provides the token when the response from a previous call has more results than the maximum page size.\n

" + } + }, + "MaxResults": { + "target": "com.amazonaws.costexplorer#CostAllocationTagsMaxResults", + "traits": { + "smithy.api#documentation": "

\n The maximum number of objects that are returned for this request.\n

" + } + } + }, + "traits": { + "smithy.api#input": {} + } + }, + "com.amazonaws.costexplorer#ListCostAllocationTagBackfillHistoryResponse": { + "type": "structure", + "members": { + "BackfillRequests": { + "target": "com.amazonaws.costexplorer#CostAllocationTagBackfillRequestList", + "traits": { + "smithy.api#documentation": "

\n The list of historical cost allocation tag backfill requests.\n

" + } + }, + "NextToken": { + "target": "com.amazonaws.costexplorer#NextPageToken", + "traits": { + "smithy.api#documentation": "

\n The token to retrieve the next set of results. Amazon Web Services provides the token when the response from a previous call has more results than the maximum page size.\n

" + } + } + }, + "traits": { + "smithy.api#output": {} + } + }, "com.amazonaws.costexplorer#ListCostAllocationTags": { "type": "operation", "input": { @@ -8322,6 +8479,55 @@ } } }, + "com.amazonaws.costexplorer#StartCostAllocationTagBackfill": { + "type": "operation", + "input": { + "target": "com.amazonaws.costexplorer#StartCostAllocationTagBackfillRequest" + }, + "output": { + "target": "com.amazonaws.costexplorer#StartCostAllocationTagBackfillResponse" + }, + "errors": [ + { + "target": "com.amazonaws.costexplorer#BackfillLimitExceededException" + }, + { + "target": "com.amazonaws.costexplorer#LimitExceededException" + } + ], + "traits": { + "smithy.api#documentation": "

\n Request a cost allocation tag backfill. This will backfill the activation status (either active or inactive) for all tag keys from para:BackfillFrom up to the when this request is made.

\n

You can request a backfill once every 24 hours.\n

" + } + }, + "com.amazonaws.costexplorer#StartCostAllocationTagBackfillRequest": { + "type": "structure", + "members": { + "BackfillFrom": { + "target": "com.amazonaws.costexplorer#ZonedDateTime", + "traits": { + "smithy.api#documentation": "

\n The date you want the backfill to start from. The date can only be a first day of the month (a billing start date). Dates can't precede the previous twelve months, or in the future.

", + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#input": {} + } + }, + "com.amazonaws.costexplorer#StartCostAllocationTagBackfillResponse": { + "type": "structure", + "members": { + "BackfillRequest": { + "target": "com.amazonaws.costexplorer#CostAllocationTagBackfillRequest", + "traits": { + "smithy.api#documentation": "

\n An object containing detailed metadata of your new backfill request.\n

" + } + } + }, + "traits": { + "smithy.api#output": {} + } + }, "com.amazonaws.costexplorer#StartSavingsPlansPurchaseRecommendationGeneration": { "type": "operation", "input": {