Retrieves estimated usage records for hourly granularity or resource-level data at daily + * granularity.
+ * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { CostExplorerClient, GetApproximateUsageRecordsCommand } from "@aws-sdk/client-cost-explorer"; // ES Modules import + * // const { CostExplorerClient, GetApproximateUsageRecordsCommand } = require("@aws-sdk/client-cost-explorer"); // CommonJS import + * const client = new CostExplorerClient(config); + * const input = { // GetApproximateUsageRecordsRequest + * Granularity: "DAILY" || "MONTHLY" || "HOURLY", // required + * Services: [ // UsageServices + * "STRING_VALUE", + * ], + * ApproximationDimension: "SERVICE" || "RESOURCE", // required + * }; + * const command = new GetApproximateUsageRecordsCommand(input); + * const response = await client.send(command); + * // { // GetApproximateUsageRecordsResponse + * // Services: { // ApproximateUsageRecordsPerService + * // "The requested data is unavailable.
+ * + * @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.
+ * + */ +export class GetApproximateUsageRecordsCommand extends $Command + .classBuilder< + GetApproximateUsageRecordsCommandInput, + GetApproximateUsageRecordsCommandOutput, + 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", "GetApproximateUsageRecords", {}) + .n("CostExplorerClient", "GetApproximateUsageRecordsCommand") + .f(void 0, void 0) + .ser(se_GetApproximateUsageRecordsCommand) + .de(de_GetApproximateUsageRecordsCommand) + .build() {} diff --git a/clients/client-cost-explorer/src/commands/index.ts b/clients/client-cost-explorer/src/commands/index.ts index 515381259310a..19e42ec79e8c2 100644 --- a/clients/client-cost-explorer/src/commands/index.ts +++ b/clients/client-cost-explorer/src/commands/index.ts @@ -9,6 +9,7 @@ export * from "./DescribeCostCategoryDefinitionCommand"; export * from "./GetAnomaliesCommand"; export * from "./GetAnomalyMonitorsCommand"; export * from "./GetAnomalySubscriptionsCommand"; +export * from "./GetApproximateUsageRecordsCommand"; export * from "./GetCostAndUsageCommand"; export * from "./GetCostAndUsageWithResourcesCommand"; export * from "./GetCostCategoriesCommand"; diff --git a/clients/client-cost-explorer/src/models/models_0.ts b/clients/client-cost-explorer/src/models/models_0.ts index ad38b5d5f2bb6..79d40a0f4ebc6 100644 --- a/clients/client-cost-explorer/src/models/models_0.ts +++ b/clients/client-cost-explorer/src/models/models_0.ts @@ -482,6 +482,20 @@ export interface Subscriber { Status?: SubscriberStatus; } +/** + * @public + * @enum + */ +export const ApproximationDimension = { + RESOURCE: "RESOURCE", + SERVICE: "SERVICE", +} as const; + +/** + * @public + */ +export type ApproximationDimension = (typeof ApproximationDimension)[keyof typeof ApproximationDimension]; + /** * @public *The tag structure that contains a tag key and value.
@@ -1129,28 +1143,6 @@ export interface GetAnomalySubscriptionsRequest { MaxResults?: number; } -/** - * @public - *The requested report expired. Update the date interval and try again.
- */ -export class BillExpirationException extends __BaseException { - readonly name: "BillExpirationException" = "BillExpirationException"; - readonly $fault: "client" = "client"; - Message?: string; - /** - * @internal - */ - constructor(opts: __ExceptionOptionTypeThe requested data is unavailable.
@@ -1188,38 +1180,30 @@ export const Granularity = { */ export type Granularity = (typeof Granularity)[keyof typeof Granularity]; -/** - * @public - * @enum - */ -export const GroupDefinitionType = { - COST_CATEGORY: "COST_CATEGORY", - DIMENSION: "DIMENSION", - TAG: "TAG", -} as const; - /** * @public */ -export type GroupDefinitionType = (typeof GroupDefinitionType)[keyof typeof GroupDefinitionType]; +export interface GetApproximateUsageRecordsRequest { + /** + * @public + *How granular you want the data to be. You can enable data at hourly or daily + * granularity.
+ */ + Granularity: Granularity | undefined; -/** - * @public - *Represents a group when you specify a group by criteria or in the response to a query - * with a specific grouping.
- */ -export interface GroupDefinition { /** * @public - *The string that represents the type of group.
+ *The service metadata for the service or services you want to query. If not specified, all + * elements are returned.
*/ - Type?: GroupDefinitionType; + Services?: string[]; /** * @public - *The string that represents a key for a specified group.
+ *The service to evaluate for the usage records. You can choose resource-level data at daily + * granularity, or hourly granularity with or without resource-level data.
*/ - Key?: string; + ApproximationDimension: ApproximationDimension | undefined; } /** @@ -1245,6 +1229,85 @@ export interface DateInterval { End: string | undefined; } +/** + * @public + */ +export interface GetApproximateUsageRecordsResponse { + /** + * @public + *The service metadata for the service or services in the response.
+ */ + Services?: RecordThe total number of usage records for all services in the services list.
+ */ + TotalRecords?: number; + + /** + * @public + *The lookback period that's used for the estimation.
+ */ + LookbackPeriod?: DateInterval; +} + +/** + * @public + *The requested report expired. Update the date interval and try again.
+ */ +export class BillExpirationException extends __BaseException { + readonly name: "BillExpirationException" = "BillExpirationException"; + readonly $fault: "client" = "client"; + Message?: string; + /** + * @internal + */ + constructor(opts: __ExceptionOptionTypeRepresents a group when you specify a group by criteria or in the response to a query + * with a specific grouping.
+ */ +export interface GroupDefinition { + /** + * @public + *The string that represents the type of group.
+ */ + Type?: GroupDefinitionType; + + /** + * @public + *The string that represents a key for a specified group.
+ */ + Key?: string; +} + /** * @public *The metadata of a specific type that you can use to filter and group your results. You
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 9c95c974b134c..2acf67157f34a 100644
--- a/clients/client-cost-explorer/src/protocols/Aws_json1_1.ts
+++ b/clients/client-cost-explorer/src/protocols/Aws_json1_1.ts
@@ -52,6 +52,10 @@ import {
GetAnomalySubscriptionsCommandInput,
GetAnomalySubscriptionsCommandOutput,
} from "../commands/GetAnomalySubscriptionsCommand";
+import {
+ GetApproximateUsageRecordsCommandInput,
+ GetApproximateUsageRecordsCommandOutput,
+} from "../commands/GetApproximateUsageRecordsCommand";
import { GetCostAndUsageCommandInput, GetCostAndUsageCommandOutput } from "../commands/GetCostAndUsageCommand";
import {
GetCostAndUsageWithResourcesCommandInput,
@@ -175,6 +179,7 @@ import {
GetAnomalyMonitorsResponse,
GetAnomalySubscriptionsRequest,
GetAnomalySubscriptionsResponse,
+ GetApproximateUsageRecordsRequest,
GetCostAndUsageRequest,
GetCostAndUsageWithResourcesRequest,
GetCostCategoriesRequest,
@@ -355,6 +360,19 @@ export const se_GetAnomalySubscriptionsCommand = async (
return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
+/**
+ * serializeAws_json1_1GetApproximateUsageRecordsCommand
+ */
+export const se_GetApproximateUsageRecordsCommand = async (
+ input: GetApproximateUsageRecordsCommandInput,
+ context: __SerdeContext
+): Promise<__HttpRequest> => {
+ const headers: __HeaderBag = sharedHeaders("GetApproximateUsageRecords");
+ let body: any;
+ body = JSON.stringify(_json(input));
+ return buildHttpRpcRequest(context, headers, "/", undefined, body);
+};
+
/**
* serializeAws_json1_1GetCostAndUsageCommand
*/
@@ -919,6 +937,26 @@ export const de_GetAnomalySubscriptionsCommand = async (
return response;
};
+/**
+ * deserializeAws_json1_1GetApproximateUsageRecordsCommand
+ */
+export const de_GetApproximateUsageRecordsCommand = async (
+ output: __HttpResponse,
+ context: __SerdeContext
+): Promise Retrieves estimated usage records for hourly granularity or resource-level data at daily\n granularity. How granular you want the data to be. You can enable data at hourly or daily\n granularity. The service metadata for the service or services you want to query. If not specified, all\n elements are returned. The service to evaluate for the usage records. You can choose resource-level data at daily\n granularity, or hourly granularity with or without resource-level data. The service metadata for the service or services in the response. The total number of usage records for all services in the services list. The lookback period that's used for the estimation.