getAnomalies method

Future<GetAnomaliesResponse> getAnomalies({
  1. required AnomalyDateInterval dateInterval,
  2. AnomalyFeedbackType? feedback,
  3. int? maxResults,
  4. String? monitorArn,
  5. String? nextPageToken,
  6. TotalImpactFilter? totalImpact,
})

Retrieves all of the cost anomalies detected on your account, during the time period specified by the DateInterval object.

May throw LimitExceededException. May throw InvalidNextTokenException.

Parameter dateInterval : Assigns the start and end dates for retrieving cost anomalies. The returned anomaly object will have an AnomalyEndDate in the specified time range.

Parameter feedback : Filters anomaly results by the feedback field on the anomaly object.

Parameter maxResults : The number of entries a paginated response contains.

Parameter monitorArn : Retrieves all of the cost anomalies detected for a specific cost anomaly monitor Amazon Resource Name (ARN).

Parameter nextPageToken : The token to retrieve the next set of results. AWS provides the token when the response from a previous call has more results than the maximum page size.

Parameter totalImpact : Filters anomaly results by the total impact field on the anomaly object. For example, you can filter anomalies GREATER_THAN 200.00 to retrieve anomalies, with an estimated dollar impact greater than 200.

Implementation

Future<GetAnomaliesResponse> getAnomalies({
  required AnomalyDateInterval dateInterval,
  AnomalyFeedbackType? feedback,
  int? maxResults,
  String? monitorArn,
  String? nextPageToken,
  TotalImpactFilter? totalImpact,
}) async {
  ArgumentError.checkNotNull(dateInterval, 'dateInterval');
  _s.validateStringLength(
    'monitorArn',
    monitorArn,
    0,
    1024,
  );
  _s.validateStringLength(
    'nextPageToken',
    nextPageToken,
    0,
    8192,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSInsightsIndexService.GetAnomalies'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'DateInterval': dateInterval,
      if (feedback != null) 'Feedback': feedback.toValue(),
      if (maxResults != null) 'MaxResults': maxResults,
      if (monitorArn != null) 'MonitorArn': monitorArn,
      if (nextPageToken != null) 'NextPageToken': nextPageToken,
      if (totalImpact != null) 'TotalImpact': totalImpact,
    },
  );

  return GetAnomaliesResponse.fromJson(jsonResponse.body);
}