Skip to content

put_events

put_events(
    event_bus_arn: EventBusArn,
    entries: PutEventsRequestEntryList,
    *,
    config_overrides: Optional[EventBridgeV2ClientConfig] = None,
    deduplication_configuration: Optional[DeduplicationConfiguration] = None,
) -> PutEventsResponse

Publishes events to an event bus.

Parameters:

Raises:

  • AccessDeniedException –

    The caller does not have the permissions required to perform the operation. This error is also returned when the operation cannot use the AWS KMS key for the event bus.

  • InternalException –

    The request failed because of an internal service error. Retry the request.

  • InvalidInputException –

    A request parameter is missing or not valid.

  • ThrottlingException –

    The request was throttled because it exceeds a request rate limit. Retry the request with backoff.

  • InvalidStateException –

    The resource is not in a state that allows the operation. For example, an event bus that is still being created cannot accept events.

  • ResourceNotFoundException –

    The resource does not exist.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_eventbridgev2/_services/event_bridge_v2.py
def put_events(
    self,
    event_bus_arn: "capo_eventbridgev2.types.event_bus_arn.EventBusArn",
    entries: "capo_eventbridgev2.types.put_events_request_entry_list.PutEventsRequestEntryList",
    *,
    config_overrides: Optional[EventBridgeV2ClientConfig] = None,
    deduplication_configuration: Optional[
        "capo_eventbridgev2.types.deduplication_configuration.DeduplicationConfiguration"
    ] = None,
) -> "capo_eventbridgev2.types.put_events_response.PutEventsResponse":
    """Publishes events to an event bus.

    Args:
        deduplication_configuration: Request-level deduplication settings, applied to every entry in the batch.

    Raises:
        capo_eventbridgev2.errors.access_denied_exception.AccessDeniedException: The caller does not have the permissions required to perform the operation. This error is also returned when the operation cannot use the AWS KMS key for the event bus.
        capo_eventbridgev2.errors.internal_exception.InternalException: The request failed because of an internal service error. Retry the request.
        capo_eventbridgev2.errors.invalid_input_exception.InvalidInputException: A request parameter is missing or not valid.
        capo_eventbridgev2.errors.throttling_exception.ThrottlingException: The request was throttled because it exceeds a request rate limit. Retry the request with backoff.
        capo_eventbridgev2.errors.invalid_state_exception.InvalidStateException: The resource is not in a state that allows the operation. For example, an event bus that is still being created cannot accept events.
        capo_eventbridgev2.errors.resource_not_found_exception.ResourceNotFoundException: The resource does not exist.
        capo_eventbridgev2.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_eventbridgev2.types.put_events_request.PutEventsRequest]",
    ) -> OperationResponse[
        "capo_eventbridgev2.types.put_events_response.PutEventsResponse"
    ]:
        import capo_eventbridgev2._operations.aws_events_v2.put_events

        output, http_response = (
            capo_eventbridgev2._operations.aws_events_v2.put_events.put_events(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_eventbridgev2.types.put_events_request.PutEventsRequest",
    ) -> dict[str, Any]:
        import capo_eventbridgev2.types.put_events_request

        return capo_eventbridgev2.types.put_events_request.redact_sensitive(input_)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("PutEvents", redact_input=_redact_input)
    )
    input_: capo_eventbridgev2.types.put_events_request.PutEventsRequest = {
        "event_bus_arn": event_bus_arn,
        "entries": entries,
    }
    if deduplication_configuration is not None:
        input_["deduplication_configuration"] = deduplication_configuration

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