listInsightsData method
Returns Insights events generated on a trail that logs data events. You can list Insights events that occurred in a Region within the last 90 days.
ListInsightsData supports the following Dimensions for Insights events:
- Event ID
- Event name
- Event source
The rate of ListInsightsData requests is limited to two per second, per account, per Region. If this limit is exceeded, a throttling error occurs.
May throw InvalidParameterException.
May throw OperationNotPermittedException.
May throw UnsupportedOperationException.
Parameter dataType :
Specifies the category of events returned. To fetch Insights events,
specify InsightsEvents as the value of DataType
Parameter insightSource :
The Amazon Resource Name(ARN) of the trail for which you want to retrieve
Insights events.
Parameter dimensions :
Contains a map of dimensions. Currently the map can contain only one item.
Parameter endTime :
Specifies that only events that occur before or at the specified time are
returned. If the specified end time is before the specified start time, an
error is returned.
Parameter maxResults :
The number of events to return. Possible values are 1 through 50. The
default is 50.
Parameter nextToken :
The token to use to get the next page of results after a previous API
call. This token must be passed in with the same parameters that were
specified in the original call. For example, if the original call
specified a EventName as a dimension with PutObject as a
value, the call with NextToken should include those same parameters.
Parameter startTime :
Specifies that only events that occur after or at the specified time are
returned. If the specified start time is after the specified end time, an
error is returned.
Implementation
Future<ListInsightsDataResponse> listInsightsData({
required ListInsightsDataType dataType,
required String insightSource,
Map<ListInsightsDataDimensionKey, String>? dimensions,
DateTime? endTime,
int? maxResults,
String? nextToken,
DateTime? startTime,
}) async {
_s.validateNumRange(
'maxResults',
maxResults,
1,
50,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'CloudTrail_20131101.ListInsightsData'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'DataType': dataType.value,
'InsightSource': insightSource,
if (dimensions != null)
'Dimensions': dimensions.map((k, e) => MapEntry(k.value, e)),
if (endTime != null) 'EndTime': unixTimestampToJson(endTime),
if (maxResults != null) 'MaxResults': maxResults,
if (nextToken != null) 'NextToken': nextToken,
if (startTime != null) 'StartTime': unixTimestampToJson(startTime),
},
);
return ListInsightsDataResponse.fromJson(jsonResponse.body);
}