getInsightSelectors method

Future<GetInsightSelectorsResponse> getInsightSelectors({
  1. String? eventDataStore,
  2. String? trailName,
})

Describes the settings for the Insights event selectors that you configured for your trail or event data store. GetInsightSelectors shows if CloudTrail Insights logging is enabled and which Insights types are configured with corresponding event categories. If you run GetInsightSelectors on a trail or event data store that does not have Insights events enabled, the operation throws the exception InsightNotEnabledException

Specify either the EventDataStore parameter to get Insights event selectors for an event data store, or the TrailName parameter to the get Insights event selectors for a trail. You cannot specify these parameters together.

For more information, see Working with CloudTrail Insights in the CloudTrail User Guide.

May throw CloudTrailARNInvalidException. May throw InsightNotEnabledException. May throw InvalidParameterCombinationException. May throw InvalidParameterException. May throw InvalidTrailNameException. May throw NoManagementAccountSLRExistsException. May throw OperationNotPermittedException. May throw ThrottlingException. May throw TrailNotFoundException. May throw UnsupportedOperationException.

Parameter eventDataStore : Specifies the ARN (or ID suffix of the ARN) of the event data store for which you want to get Insights selectors.

You cannot use this parameter with the TrailName parameter.

Parameter trailName : Specifies the name of the trail or trail ARN. If you specify a trail name, the string must meet the following requirements:

  • Contain only ASCII letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), or dashes (-)
  • Start with a letter or number, and end with a letter or number
  • Be between 3 and 128 characters
  • Have no adjacent periods, underscores or dashes. Names like my-_namespace and my--namespace are not valid.
  • Not be in IP address format (for example, 192.168.5.4)
If you specify a trail ARN, it must be in the format:

arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail

You cannot use this parameter with the EventDataStore parameter.

Implementation

Future<GetInsightSelectorsResponse> getInsightSelectors({
  String? eventDataStore,
  String? trailName,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'CloudTrail_20131101.GetInsightSelectors'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (eventDataStore != null) 'EventDataStore': eventDataStore,
      if (trailName != null) 'TrailName': trailName,
    },
  );

  return GetInsightSelectorsResponse.fromJson(jsonResponse.body);
}