Tests whether the specified event pattern matches the provided event.
Most services in Amazon Web Services treat : or / as the same character in Amazon Resource Names (ARNs). However, EventBridge uses an exact match in event patterns and rules. Be sure to use the correct ARN characters when creating event patterns so that they match the ARN syntax in the event you want to match.
Parameters:
-
event_pattern
(EventPattern)
–
-
event
(String)
–
The event, in JSON format, to test against the event pattern. The JSON must follow the format specified in Amazon Web Services Events, and the following fields are mandatory:
-
id
-
account
-
source
-
time
-
region
-
resources
-
detail-type
Raises:
Source code in docs_src/capo_eventbridge/_services/async_event_bridge.py
| async def test_event_pattern(
self,
event_pattern: "capo_eventbridge.types.event_pattern.EventPattern",
event: "capo_eventbridge.types.string.String",
*,
config_overrides: Optional[AsyncEventBridgeClientConfig] = None,
) -> "capo_eventbridge.types.test_event_pattern_response.TestEventPatternResponse":
"""<p>Tests whether the specified event pattern matches the provided event.</p> <p>Most services in Amazon Web Services treat : or / as the same character in Amazon Resource Names (ARNs). However, EventBridge uses an exact match in event patterns and rules. Be sure to use the correct ARN characters when creating event patterns so that they match the ARN syntax in the event you want to match.</p>
Args:
event_pattern: <p>The event pattern. For more information, see <a href="https://docs.aws.amazon.com/eventbridge/latest/userguide/eventbridge-and-event-patterns.html">Events and Event Patterns</a> in the <i> <i>Amazon EventBridge User Guide</i> </i>.</p>
event: <p>The event, in JSON format, to test against the event pattern. The JSON must follow the format specified in <a href="https://docs.aws.amazon.com/eventbridge/latest/userguide/aws-events.html">Amazon Web Services Events</a>, and the following fields are mandatory:</p> <ul> <li> <p> <code>id</code> </p> </li> <li> <p> <code>account</code> </p> </li> <li> <p> <code>source</code> </p> </li> <li> <p> <code>time</code> </p> </li> <li> <p> <code>region</code> </p> </li> <li> <p> <code>resources</code> </p> </li> <li> <p> <code>detail-type</code> </p> </li> </ul>
Raises:
capo_eventbridge.errors.internal_exception.InternalException: <p>This exception occurs due to unexpected causes.</p>
capo_eventbridge.errors.invalid_event_pattern_exception.InvalidEventPatternException: <p>The event pattern is not valid.</p>
capo_eventbridge.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_eventbridge.types.test_event_pattern_request.TestEventPatternRequest]",
) -> AsyncOperationResponse[
"capo_eventbridge.types.test_event_pattern_response.TestEventPatternResponse"
]:
import capo_eventbridge._operations.aws_events.test_event_pattern
(
output,
http_response,
) = await capo_eventbridge._operations.aws_events.test_event_pattern.async_test_event_pattern(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("TestEventPattern")
)
input_: capo_eventbridge.types.test_event_pattern_request.TestEventPatternRequest = {
"event_pattern": event_pattern,
"event": event,
}
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|