getUsageStatistics method
- required String detectorId,
- required UsageCriteria usageCriteria,
- required UsageStatisticType usageStatisticType,
- int? maxResults,
- String? nextToken,
- String? unit,
Lists Amazon GuardDuty usage statistics over the last 30 days for the specified detector ID. For newly enabled detectors or data sources the cost returned will include only the usage so far under 30 days, this may differ from the cost metrics in the console, which projects usage over 30 days to provide a monthly cost estimate. For more information see Understanding How Usage Costs are Calculated.
May throw BadRequestException. May throw InternalServerErrorException.
Parameter detectorId
:
The ID of the detector that specifies the GuardDuty service whose usage
statistics you want to retrieve.
Parameter usageCriteria
:
Represents the criteria used for querying usage.
Parameter usageStatisticType
:
The type of usage statistics to retrieve.
Parameter maxResults
:
The maximum number of results to return in the response.
Parameter nextToken
:
A token to use for paginating results that are returned in the response.
Set the value of this parameter to null for the first request to a list
action. For subsequent calls, use the NextToken value returned from the
previous request to continue listing results after the first page.
Parameter unit
:
The currency unit you would like to view your usage statistics in. Current
valid values are USD.
Implementation
Future<GetUsageStatisticsResponse> getUsageStatistics({
required String detectorId,
required UsageCriteria usageCriteria,
required UsageStatisticType usageStatisticType,
int? maxResults,
String? nextToken,
String? unit,
}) async {
ArgumentError.checkNotNull(detectorId, 'detectorId');
_s.validateStringLength(
'detectorId',
detectorId,
1,
300,
isRequired: true,
);
ArgumentError.checkNotNull(usageCriteria, 'usageCriteria');
ArgumentError.checkNotNull(usageStatisticType, 'usageStatisticType');
_s.validateNumRange(
'maxResults',
maxResults,
1,
50,
);
final $payload = <String, dynamic>{
'usageCriteria': usageCriteria,
'usageStatisticsType': usageStatisticType.toValue(),
if (maxResults != null) 'maxResults': maxResults,
if (nextToken != null) 'nextToken': nextToken,
if (unit != null) 'unit': unit,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri:
'/detector/${Uri.encodeComponent(detectorId)}/usage/statistics',
exceptionFnMap: _exceptionFns,
);
return GetUsageStatisticsResponse.fromJson(response);
}