GetUsageTotalsCommand

Retrieves (queries) aggregated usage data for an account.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { Macie2Client, GetUsageTotalsCommand } from "@aws-sdk/client-macie2"; // ES Modules import
// const { Macie2Client, GetUsageTotalsCommand } = require("@aws-sdk/client-macie2"); // CommonJS import
const client = new Macie2Client(config);
const input = { // GetUsageTotalsRequest
  timeRange: "STRING_VALUE",
};
const command = new GetUsageTotalsCommand(input);
const response = await client.send(command);
// { // GetUsageTotalsResponse
//   timeRange: "MONTH_TO_DATE" || "PAST_30_DAYS",
//   usageTotals: [ // __listOfUsageTotal
//     { // UsageTotal
//       currency: "USD",
//       estimatedCost: "STRING_VALUE",
//       type: "DATA_INVENTORY_EVALUATION" || "SENSITIVE_DATA_DISCOVERY" || "AUTOMATED_SENSITIVE_DATA_DISCOVERY" || "AUTOMATED_OBJECT_MONITORING",
//     },
//   ],
// };

GetUsageTotalsCommand Input

See GetUsageTotalsCommandInput for more details

Parameter
Type
Description
timeRange
string | undefined

The inclusive time period to retrieve the data for. Valid values are: MONTH_TO_DATE, for the current calendar month to date; and, PAST_30_DAYS, for the preceding 30 days. If you don't specify a value for this parameter, Amazon Macie provides aggregated usage data for the preceding 30 days.

GetUsageTotalsCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
timeRange
TimeRange | undefined

The inclusive time period that the usage data applies to. Possible values are: MONTH_TO_DATE, for the current calendar month to date; and, PAST_30_DAYS, for the preceding 30 days.

usageTotals
UsageTotal[] | undefined

An array of objects that contains the results of the query. Each object contains the data for a specific usage metric.

Throws

Name
Fault
Details
AccessDeniedException
client

Provides information about an error that occurred due to insufficient access to a specified resource.

ConflictException
client

Provides information about an error that occurred due to a versioning conflict for a specified resource.

InternalServerException
server

Provides information about an error that occurred due to an unknown internal server error, exception, or failure.

ResourceNotFoundException
client

Provides information about an error that occurred because a specified resource wasn't found.

ServiceQuotaExceededException
client

Provides information about an error that occurred due to one or more service quotas for an account.

ThrottlingException
client

Provides information about an error that occurred because too many requests were sent during a certain amount of time.

ValidationException
client

Provides information about an error that occurred due to a syntax error in a request.

Macie2ServiceException
Base exception class for all service exceptions from Macie2 service.