Skip to content

list_anomalies

list_anomalies(
    *,
    config_overrides: Optional[CloudWatchLogsClientConfig] = None,
    anomaly_detector_arn: Optional[AnomalyDetectorArn] = None,
    suppression_state: Optional[SuppressionState] = None,
    limit: Optional[ListAnomaliesLimit] = None,
    next_token: Optional[NextToken] = None,
) -> ListAnomaliesResponse

Returns a list of anomalies that log anomaly detectors have found. For details about the structure format of each anomaly object that is returned, see the example in this section.

Parameters:

  • anomaly_detector_arn (Optional[AnomalyDetectorArn], default: None ) –

    Use this to optionally limit the results to only the anomalies found by a certain anomaly detector.

  • suppression_state (Optional[SuppressionState], default: None ) –

    You can specify this parameter if you want to the operation to return only anomalies that are currently either suppressed or unsuppressed.

  • limit (Optional[ListAnomaliesLimit], default: None ) –

    The maximum number of items to return. If you don't specify a value, the default maximum value of 50 items is used.

Raises:

Source code in docs_src/capo_cloudwatch_logs/_services/cloud_watch_logs.py
def list_anomalies(
    self,
    *,
    config_overrides: Optional[CloudWatchLogsClientConfig] = None,
    anomaly_detector_arn: Optional[
        "capo_cloudwatch_logs.types.anomaly_detector_arn.AnomalyDetectorArn"
    ] = None,
    suppression_state: Optional[
        "capo_cloudwatch_logs.types.suppression_state.SuppressionState"
    ] = None,
    limit: Optional[
        "capo_cloudwatch_logs.types.list_anomalies_limit.ListAnomaliesLimit"
    ] = None,
    next_token: Optional["capo_cloudwatch_logs.types.next_token.NextToken"] = None,
) -> "capo_cloudwatch_logs.types.list_anomalies_response.ListAnomaliesResponse":
    """<p>Returns a list of anomalies that log anomaly detectors have found. For details about the structure format of each anomaly object that is returned, see the example in this section.</p>

    Args:
        anomaly_detector_arn: <p>Use this to optionally limit the results to only the anomalies found by a certain anomaly detector.</p>
        suppression_state: <p>You can specify this parameter if you want to the operation to return only anomalies that are currently either suppressed or unsuppressed.</p>
        limit: <p>The maximum number of items to return. If you don't specify a value, the default maximum value of 50 items is used.</p>

    Raises:
        capo_cloudwatch_logs.errors.invalid_parameter_exception.InvalidParameterException: <p>A parameter is specified incorrectly.</p>
        capo_cloudwatch_logs.errors.operation_aborted_exception.OperationAbortedException: <p>Multiple concurrent requests to update the same resource were in conflict.</p>
        capo_cloudwatch_logs.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource does not exist.</p>
        capo_cloudwatch_logs.errors.service_unavailable_exception.ServiceUnavailableException: <p>The service cannot complete the request.</p>
        capo_cloudwatch_logs.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_cloudwatch_logs.types.list_anomalies_request.ListAnomaliesRequest]",
    ) -> OperationResponse[
        "capo_cloudwatch_logs.types.list_anomalies_response.ListAnomaliesResponse"
    ]:
        import capo_cloudwatch_logs._operations.logs_20140328.list_anomalies

        output, http_response = (
            capo_cloudwatch_logs._operations.logs_20140328.list_anomalies.list_anomalies(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListAnomalies")
    )
    input_: capo_cloudwatch_logs.types.list_anomalies_request.ListAnomaliesRequest = {}
    if anomaly_detector_arn is not None:
        input_["anomaly_detector_arn"] = anomaly_detector_arn
    if suppression_state is not None:
        input_["suppression_state"] = suppression_state
    if limit is not None:
        input_["limit"] = limit
    if next_token is not None:
        input_["next_token"] = next_token

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