Skip to content

create_event_bus

create_event_bus(
    name: EventBusName,
    *,
    config_overrides: Optional[EventBridgeV2ClientConfig] = None,
    description: Optional[Description] = None,
    encryption_configuration: Optional[EncryptionConfiguration] = None,
    storage_configuration: Optional[StorageConfiguration] = None,
    tags: Optional[TagMap] = None,
    client_token: Optional[ClientToken] = None,
) -> CreateEventBusResponse

Creates an event bus. Provisioning is asynchronous: the bus is returned in the CREATING state and transitions to ACTIVE when ready (see the EventBusActive waiter). Retries carrying the same ClientToken are idempotent.

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.

  • ConcurrentModificationException –

    Another change to the resource is already in progress. Retry the request.

  • IdempotentParameterMismatchException –

    The request reuses the client token of an earlier request with different parameters. Use a new client token, or resend the earlier request unchanged.

  • 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.

  • LimitExceededException –

    The request would exceed a service quota for the account.

  • ResourceAlreadyExistsException –

    A resource with the same name already exists.

  • 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 create_event_bus(
    self,
    name: "capo_eventbridgev2.types.event_bus_name.EventBusName",
    *,
    config_overrides: Optional[EventBridgeV2ClientConfig] = None,
    description: Optional[
        "capo_eventbridgev2.types.description.Description"
    ] = None,
    encryption_configuration: Optional[
        "capo_eventbridgev2.types.encryption_configuration.EncryptionConfiguration"
    ] = None,
    storage_configuration: Optional[
        "capo_eventbridgev2.types.storage_configuration.StorageConfiguration"
    ] = None,
    tags: Optional["capo_eventbridgev2.types.tag_map.TagMap"] = None,
    client_token: Optional[
        "capo_eventbridgev2.types.client_token.ClientToken"
    ] = None,
) -> "capo_eventbridgev2.types.create_event_bus_response.CreateEventBusResponse":
    """Creates an event bus. Provisioning is asynchronous: the bus is returned in the CREATING state and transitions to ACTIVE when ready (see the EventBusActive waiter). Retries carrying the same ClientToken are idempotent.

    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.concurrent_modification_exception.ConcurrentModificationException: Another change to the resource is already in progress. Retry the request.
        capo_eventbridgev2.errors.idempotent_parameter_mismatch_exception.IdempotentParameterMismatchException: The request reuses the client token of an earlier request with different parameters. Use a new client token, or resend the earlier request unchanged.
        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.limit_exceeded_exception.LimitExceededException: The request would exceed a service quota for the account.
        capo_eventbridgev2.errors.resource_already_exists_exception.ResourceAlreadyExistsException: A resource with the same name already exists.
        capo_eventbridgev2.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_eventbridgev2.types.create_event_bus_request.CreateEventBusRequest]",
    ) -> OperationResponse[
        "capo_eventbridgev2.types.create_event_bus_response.CreateEventBusResponse"
    ]:
        import capo_eventbridgev2._operations.aws_events_v2.create_event_bus

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateEventBus")
    )
    input_: capo_eventbridgev2.types.create_event_bus_request.CreateEventBusRequest = {
        "name": name
    }
    if description is not None:
        input_["description"] = description
    if encryption_configuration is not None:
        input_["encryption_configuration"] = encryption_configuration
    if storage_configuration is not None:
        input_["storage_configuration"] = storage_configuration
    if tags is not None:
        input_["tags"] = tags
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token

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