Skip to content

create_event_bus async

create_event_bus(
    name: EventBusName,
    *,
    config_overrides: Optional[AsyncEventBridgeClientConfig] = None,
    event_source_name: Optional[EventSourceName] = None,
    description: Optional[EventBusDescription] = None,
    kms_key_identifier: Optional[KmsKeyIdentifier] = None,
    dead_letter_config: Optional[DeadLetterConfig] = None,
    log_config: Optional[LogConfig] = 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.

    Custom event bus names can't contain the / character, but you can use the / character in partner event bus names. In addition, for partner event buses, the name must exactly match the name of the partner event source that this event bus is matched to.

    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.

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

  • description (Optional[EventBusDescription], default: None ) –

    The event bus description.

  • kms_key_identifier (Optional[KmsKeyIdentifier], default: None ) –

    The identifier of the KMS customer managed key for EventBridge to use, if you choose to use a customer managed key to encrypt events on this event bus. The identifier can be the key Amazon Resource Name (ARN), KeyId, key alias, or key alias ARN.

    If you do not specify a customer managed key identifier, EventBridge uses an Amazon Web Services owned key to encrypt events on the event bus.

    For more information, see Identify and view keys in the Key Management Service Developer Guide.

    Schema discovery is not supported for event buses encrypted using a customer managed key. EventBridge returns an error if:

    • You call CreateDiscoverer on an event bus set to use a customer managed key for encryption.

    • You call UpdatedEventBus to set a customer managed key on an event bus with schema discovery enabled.

    To enable schema discovery on an event bus, choose to use an Amazon Web Services owned key. For more information, see Encrypting events in the Amazon EventBridge User Guide.

    If you have specified that EventBridge use a customer managed key for encrypting the source event bus, we strongly recommend you also specify a customer managed key for any archives for the event bus as well.

    For more information, see Encrypting archives in the Amazon EventBridge User Guide.

  • log_config (Optional[LogConfig], default: None ) –

    The logging configuration settings for the event bus.

    For more information, see Configuring logs for event buses in the EventBridge User Guide.

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

    Tags to associate with the event bus.

Raises:

Source code in docs_src/capo_eventbridge/_services/async_event_bridge.py
async def create_event_bus(
    self,
    name: "capo_eventbridge.types.event_bus_name.EventBusName",
    *,
    config_overrides: Optional[AsyncEventBridgeClientConfig] = None,
    event_source_name: Optional[
        "capo_eventbridge.types.event_source_name.EventSourceName"
    ] = None,
    description: Optional[
        "capo_eventbridge.types.event_bus_description.EventBusDescription"
    ] = None,
    kms_key_identifier: Optional[
        "capo_eventbridge.types.kms_key_identifier.KmsKeyIdentifier"
    ] = None,
    dead_letter_config: Optional[
        "capo_eventbridge.types.dead_letter_config.DeadLetterConfig"
    ] = None,
    log_config: Optional["capo_eventbridge.types.log_config.LogConfig"] = None,
    tags: Optional["capo_eventbridge.types.tag_list.TagList"] = None,
) -> "capo_eventbridge.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>Custom event bus names can't contain the <code>/</code> character, but you can use the <code>/</code> character in partner event bus names. In addition, for partner event buses, the name must exactly match the name of the partner event source that this event bus is matched to.</p> <p>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>
        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>
        description: <p>The event bus description.</p>
        kms_key_identifier: <p>The identifier of the KMS customer managed key for EventBridge to use, if you choose to use a customer managed key to encrypt events on this event bus. The identifier can be the key Amazon Resource Name (ARN), KeyId, key alias, or key alias ARN.</p> <p>If you do not specify a customer managed key identifier, EventBridge uses an Amazon Web Services owned key to encrypt events on the event bus.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/viewing-keys.html">Identify and view keys</a> in the <i>Key Management Service Developer Guide</i>. </p> <note> <p>Schema discovery is not supported for event buses encrypted using a customer managed key. EventBridge returns an error if: </p> <ul> <li> <p>You call <code> <a href="https://docs.aws.amazon.com/eventbridge/latest/schema-reference/v1-discoverers.html#CreateDiscoverer">CreateDiscoverer</a> </code> on an event bus set to use a customer managed key for encryption.</p> </li> <li> <p>You call <code> <a href="https://docs.aws.amazon.com/eventbridge/latest/APIReference/API_UpdatedEventBus.html">UpdatedEventBus</a> </code> to set a customer managed key on an event bus with schema discovery enabled.</p> </li> </ul> <p>To enable schema discovery on an event bus, choose to use an Amazon Web Services owned key. For more information, see <a href="https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-encryption-event-bus-cmkey.html">Encrypting events</a> in the <i>Amazon EventBridge User Guide</i>.</p> </note> <important> <p>If you have specified that EventBridge use a customer managed key for encrypting the source event bus, we strongly recommend you also specify a customer managed key for any archives for the event bus as well. </p> <p>For more information, see <a href="https://docs.aws.amazon.com/eventbridge/latest/userguide/encryption-archives.html">Encrypting archives</a> in the <i>Amazon EventBridge User Guide</i>.</p> </important>
        log_config: <p>The logging configuration settings for the event bus.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-event-bus-logs.html">Configuring logs for event buses</a> in the <i>EventBridge User Guide</i>.</p>
        tags: <p>Tags to associate with the event bus.</p>

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

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

        (
            output,
            http_response,
        ) = await capo_eventbridge._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_eventbridge.types.create_event_bus_request.CreateEventBusRequest = {
        "name": name
    }
    if event_source_name is not None:
        input_["event_source_name"] = event_source_name
    if description is not None:
        input_["description"] = description
    if kms_key_identifier is not None:
        input_["kms_key_identifier"] = kms_key_identifier
    if dead_letter_config is not None:
        input_["dead_letter_config"] = dead_letter_config
    if log_config is not None:
        input_["log_config"] = log_config
    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