Skip to content

create_event_bus async

create_event_bus(
    name: EventBusName,
    *,
    config_overrides: Optional[AsyncCloudWatchEventsClientConfig] = None,
    event_source_name: Optional[EventSourceName] = None,
    tags: Optional[TagList] = None,
) -> CreateEventBusResponse

Creates a new event bus within your account. This can be a custom event bus which you can use to receive events from your custom applications and services, or it can be a partner event bus which can be matched to a partner event source.

Parameters:

  • name (EventBusName) –

    The name of the new event bus.

    Event bus names cannot contain the / character. You can't use the name default for a custom event bus, as this name is already used for your account's default event bus.

    If this is a partner event bus, the name must exactly match the name of the partner event source that this event bus is matched to.

  • event_source_name (Optional[EventSourceName], default: None ) –

    If you are creating a partner event bus, this specifies the partner event source that the new event bus will be matched with.

  • tags (Optional[TagList], default: None ) –

    Tags to associate with the event bus.

Raises:

Source code in docs_src/capo_cloudwatch_events/_services/async_cloud_watch_events.py
async def create_event_bus(
    self,
    name: "capo_cloudwatch_events.types.event_bus_name.EventBusName",
    *,
    config_overrides: Optional[AsyncCloudWatchEventsClientConfig] = None,
    event_source_name: Optional[
        "capo_cloudwatch_events.types.event_source_name.EventSourceName"
    ] = None,
    tags: Optional["capo_cloudwatch_events.types.tag_list.TagList"] = None,
) -> (
    "capo_cloudwatch_events.types.create_event_bus_response.CreateEventBusResponse"
):
    """<p>Creates a new event bus within your account. This can be a custom event bus which you can use to receive events from your custom applications and services, or it can be a partner event bus which can be matched to a partner event source.</p>

    Args:
        name: <p>The name of the new event bus. </p> <p>Event bus names cannot contain the / character. You can't use the name <code>default</code> for a custom event bus, as this name is already used for your account's default event bus.</p> <p>If this is a partner event bus, the name must exactly match the name of the partner event source that this event bus is matched to.</p>
        event_source_name: <p>If you are creating a partner event bus, this specifies the partner event source that the new event bus will be matched with.</p>
        tags: <p>Tags to associate with the event bus.</p>

    Raises:
        capo_cloudwatch_events.errors.concurrent_modification_exception.ConcurrentModificationException: <p>There is concurrent modification on a rule, target, archive, or replay.</p>
        capo_cloudwatch_events.errors.internal_exception.InternalException: <p>This exception occurs due to unexpected causes.</p>
        capo_cloudwatch_events.errors.invalid_state_exception.InvalidStateException: <p>The specified state is not a valid state for an event source.</p>
        capo_cloudwatch_events.errors.limit_exceeded_exception.LimitExceededException: <p>The request failed because it attempted to create resource beyond the allowed service quota.</p>
        capo_cloudwatch_events.errors.operation_disabled_exception.OperationDisabledException: <p>The operation you are attempting is not available in this region.</p>
        capo_cloudwatch_events.errors.resource_already_exists_exception.ResourceAlreadyExistsException: <p>The resource you are trying to create already exists.</p>
        capo_cloudwatch_events.errors.resource_not_found_exception.ResourceNotFoundException: <p>An entity that you specified does not exist.</p>
        capo_cloudwatch_events.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_cloudwatch_events.types.create_event_bus_request.CreateEventBusRequest]",
    ) -> AsyncOperationResponse[
        "capo_cloudwatch_events.types.create_event_bus_response.CreateEventBusResponse"
    ]:
        import capo_cloudwatch_events._operations.aws_events.create_event_bus

        (
            output,
            http_response,
        ) = await capo_cloudwatch_events._operations.aws_events.create_event_bus.async_create_event_bus(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateEventBus")
    )
    input_: capo_cloudwatch_events.types.create_event_bus_request.CreateEventBusRequest = {
        "name": name
    }
    if event_source_name is not None:
        input_["event_source_name"] = event_source_name
    if tags is not None:
        input_["tags"] = tags

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output