Skip to content

get_anomalies

get_anomalies(
    date_interval: AnomalyDateInterval,
    *,
    config_overrides: Optional[CostExplorerClientConfig] = None,
    monitor_arn: Optional[GenericString] = None,
    feedback: Optional[AnomalyFeedbackType] = None,
    total_impact: Optional[TotalImpactFilter] = None,
    next_page_token: Optional[NextPageToken] = None,
    max_results: Optional[PageSize] = None,
) -> GetAnomaliesResponse

Retrieves all of the cost anomalies detected on your account during the time period that's specified by the DateInterval object. Anomalies are available for up to 90 days.

Parameters:

  • monitor_arn (Optional[GenericString], default: None ) –

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

  • date_interval (AnomalyDateInterval) –

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

  • feedback (Optional[AnomalyFeedbackType], default: None ) –

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

  • total_impact (Optional[TotalImpactFilter], default: None ) –

    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.

  • next_page_token (Optional[NextPageToken], default: None ) –

    The token to retrieve the next set of results. Amazon Web Services provides the token when the response from a previous call has more results than the maximum page size.

  • max_results (Optional[PageSize], default: None ) –

    The number of entries a paginated response contains.

Raises:

Source code in docs_src/capo_cost_explorer/_services/cost_explorer.py
def get_anomalies(
    self,
    date_interval: "capo_cost_explorer.types.anomaly_date_interval.AnomalyDateInterval",
    *,
    config_overrides: Optional[CostExplorerClientConfig] = None,
    monitor_arn: Optional[
        "capo_cost_explorer.types.generic_string.GenericString"
    ] = None,
    feedback: Optional[
        "capo_cost_explorer.types.anomaly_feedback_type.AnomalyFeedbackType"
    ] = None,
    total_impact: Optional[
        "capo_cost_explorer.types.total_impact_filter.TotalImpactFilter"
    ] = None,
    next_page_token: Optional[
        "capo_cost_explorer.types.next_page_token.NextPageToken"
    ] = None,
    max_results: Optional["capo_cost_explorer.types.page_size.PageSize"] = None,
) -> "capo_cost_explorer.types.get_anomalies_response.GetAnomaliesResponse":
    """<p>Retrieves all of the cost anomalies detected on your account during the time period that's specified by the <code>DateInterval</code> object. Anomalies are available for up to 90 days.</p>

    Args:
        monitor_arn: <p>Retrieves all of the cost anomalies detected for a specific cost anomaly monitor Amazon Resource Name (ARN). </p>
        date_interval: <p>Assigns the start and end dates for retrieving cost anomalies. The returned anomaly object will have an <code>AnomalyEndDate</code> in the specified time range. </p>
        feedback: <p>Filters anomaly results by the feedback field on the anomaly object. </p>
        total_impact: <p>Filters anomaly results by the total impact field on the anomaly object. For example, you can filter anomalies <code>GREATER_THAN 200.00</code> to retrieve anomalies, with an estimated dollar impact greater than 200. </p>
        next_page_token: <p>The token to retrieve the next set of results. Amazon Web Services provides the token when the response from a previous call has more results than the maximum page size. </p>
        max_results: <p>The number of entries a paginated response contains. </p>

    Raises:
        capo_cost_explorer.errors.invalid_next_token_exception.InvalidNextTokenException: <p>The pagination token is invalid. Try again without a pagination token.</p>
        capo_cost_explorer.errors.limit_exceeded_exception.LimitExceededException: <p>You made too many calls in a short period of time. Try again later.</p>
        capo_cost_explorer.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_cost_explorer.types.get_anomalies_request.GetAnomaliesRequest]",
    ) -> OperationResponse[
        "capo_cost_explorer.types.get_anomalies_response.GetAnomaliesResponse"
    ]:
        import capo_cost_explorer._operations.aws_insights_index_service.get_anomalies

        output, http_response = (
            capo_cost_explorer._operations.aws_insights_index_service.get_anomalies.get_anomalies(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetAnomalies")
    )
    input_: capo_cost_explorer.types.get_anomalies_request.GetAnomaliesRequest = {
        "date_interval": date_interval
    }
    if monitor_arn is not None:
        input_["monitor_arn"] = monitor_arn
    if feedback is not None:
        input_["feedback"] = feedback
    if total_impact is not None:
        input_["total_impact"] = total_impact
    if next_page_token is not None:
        input_["next_page_token"] = next_page_token
    if max_results is not None:
        input_["max_results"] = max_results

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output