Tests the filter pattern of a metric filter against a sample of log event messages. You can use this operation to validate the correctness of a metric filter pattern.
Parameters:
Raises:
Source code in docs_src/capo_cloudwatch_logs/_services/cloud_watch_logs.py
| def test_metric_filter(
self,
filter_pattern: "capo_cloudwatch_logs.types.filter_pattern.FilterPattern",
log_event_messages: "capo_cloudwatch_logs.types.test_event_messages.TestEventMessages",
*,
config_overrides: Optional[CloudWatchLogsClientConfig] = None,
) -> "capo_cloudwatch_logs.types.test_metric_filter_response.TestMetricFilterResponse":
"""<p>Tests the filter pattern of a metric filter against a sample of log event messages. You can use this operation to validate the correctness of a metric filter pattern.</p>
Args:
log_event_messages: <p>The log event messages to test.</p>
Raises:
capo_cloudwatch_logs.errors.invalid_parameter_exception.InvalidParameterException: <p>A parameter is specified incorrectly.</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.test_metric_filter_request.TestMetricFilterRequest]",
) -> OperationResponse[
"capo_cloudwatch_logs.types.test_metric_filter_response.TestMetricFilterResponse"
]:
import capo_cloudwatch_logs._operations.logs_20140328.test_metric_filter
output, http_response = (
capo_cloudwatch_logs._operations.logs_20140328.test_metric_filter.test_metric_filter(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("TestMetricFilter")
)
input_: capo_cloudwatch_logs.types.test_metric_filter_request.TestMetricFilterRequest = {
"filter_pattern": filter_pattern,
"log_event_messages": log_event_messages,
}
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|