searchInsights method

Future<SearchInsightsResponse> searchInsights({
  1. required StartTimeRange startTimeRange,
  2. required InsightType type,
  3. SearchInsightsFilters? filters,
  4. int? maxResults,
  5. String? nextToken,
})

Returns a list of insights in your Amazon Web Services account. You can specify which insights are returned by their start time, one or more statuses (ONGOING or CLOSED), one or more severities (LOW, MEDIUM, and HIGH), and type (REACTIVE or PROACTIVE).

Use the Filters parameter to specify status and severity search parameters. Use the Type parameter to specify REACTIVE or PROACTIVE in your search.

May throw AccessDeniedException. May throw InternalServerException. May throw ThrottlingException. May throw ValidationException.

Parameter startTimeRange : The start of the time range passed in. Returned insights occurred after this time.

Parameter type : The type of insights you are searching for (REACTIVE or PROACTIVE).

Parameter filters : A SearchInsightsFilters object that is used to set the severity and status filters on your insight search.

Parameter maxResults : The maximum number of results to return with a single call. To retrieve the remaining results, make another call with the returned nextToken value.

Parameter nextToken : The pagination token to use to retrieve the next page of results for this operation. If this value is null, it retrieves the first page.

Implementation

Future<SearchInsightsResponse> searchInsights({
  required StartTimeRange startTimeRange,
  required InsightType type,
  SearchInsightsFilters? filters,
  int? maxResults,
  String? nextToken,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    100,
  );
  final $payload = <String, dynamic>{
    'StartTimeRange': startTimeRange,
    'Type': type.value,
    if (filters != null) 'Filters': filters,
    if (maxResults != null) 'MaxResults': maxResults,
    if (nextToken != null) 'NextToken': nextToken,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/insights/search',
    exceptionFnMap: _exceptionFns,
  );
  return SearchInsightsResponse.fromJson(response);
}