Skip to content

create_endpoint async

create_endpoint(
    name: EndpointName,
    routing_config: RoutingConfig,
    event_buses: EndpointEventBusList,
    *,
    config_overrides: Optional[AsyncEventBridgeClientConfig] = None,
    description: Optional[EndpointDescription] = None,
    replication_config: Optional[ReplicationConfig] = None,
    role_arn: Optional[IamRoleArn] = None,
) -> CreateEndpointResponse

Creates a global endpoint. Global endpoints improve your application's availability by making it regional-fault tolerant. To do this, you define a primary and secondary Region with event buses in each Region. You also create a Amazon Route 53 health check that will tell EventBridge to route events to the secondary Region when an "unhealthy" state is encountered and events will be routed back to the primary Region when the health check reports a "healthy" state.

Parameters:

  • name (EndpointName) –

    The name of the global endpoint. For example, "Name":"us-east-2-custom_bus_A-endpoint".

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

    A description of the global endpoint.

  • routing_config (RoutingConfig) –

    Configure the routing policy, including the health check and secondary Region..

  • replication_config (Optional[ReplicationConfig], default: None ) –

    Enable or disable event replication. The default state is ENABLED which means you must supply a RoleArn. If you don't have a RoleArn or you don't want event replication enabled, set the state to DISABLED.

  • event_buses (EndpointEventBusList) –

    Define the event buses used.

    The names of the event buses must be identical in each Region.

  • role_arn (Optional[IamRoleArn], default: None ) –

    The ARN of the role used for replication.

Raises:

Source code in docs_src/capo_eventbridge/_services/async_event_bridge.py
async def create_endpoint(
    self,
    name: "capo_eventbridge.types.endpoint_name.EndpointName",
    routing_config: "capo_eventbridge.types.routing_config.RoutingConfig",
    event_buses: "capo_eventbridge.types.endpoint_event_bus_list.EndpointEventBusList",
    *,
    config_overrides: Optional[AsyncEventBridgeClientConfig] = None,
    description: Optional[
        "capo_eventbridge.types.endpoint_description.EndpointDescription"
    ] = None,
    replication_config: Optional[
        "capo_eventbridge.types.replication_config.ReplicationConfig"
    ] = None,
    role_arn: Optional["capo_eventbridge.types.iam_role_arn.IamRoleArn"] = None,
) -> "capo_eventbridge.types.create_endpoint_response.CreateEndpointResponse":
    """<p>Creates a global endpoint. Global endpoints improve your application's availability by making it regional-fault tolerant. To do this, you define a primary and secondary Region with event buses in each Region. You also create a Amazon Route 53 health check that will tell EventBridge to route events to the secondary Region when an "unhealthy" state is encountered and events will be routed back to the primary Region when the health check reports a "healthy" state.</p>

    Args:
        name: <p>The name of the global endpoint. For example, <code>"Name":"us-east-2-custom_bus_A-endpoint"</code>.</p>
        description: <p>A description of the global endpoint.</p>
        routing_config: <p>Configure the routing policy, including the health check and secondary Region..</p>
        replication_config: <p>Enable or disable event replication. The default state is <code>ENABLED</code> which means you must supply a <code>RoleArn</code>. If you don't have a <code>RoleArn</code> or you don't want event replication enabled, set the state to <code>DISABLED</code>.</p>
        event_buses: <p>Define the event buses used. </p> <important> <p>The names of the event buses must be identical in each Region.</p> </important>
        role_arn: <p>The ARN of the role used for replication.</p>

    Raises:
        capo_eventbridge.errors.internal_exception.InternalException: <p>This exception occurs due to unexpected causes.</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.resource_already_exists_exception.ResourceAlreadyExistsException: <p>The resource you are trying to create already exists.</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_endpoint_request.CreateEndpointRequest]",
    ) -> AsyncOperationResponse[
        "capo_eventbridge.types.create_endpoint_response.CreateEndpointResponse"
    ]:
        import capo_eventbridge._operations.aws_events.create_endpoint

        (
            output,
            http_response,
        ) = await capo_eventbridge._operations.aws_events.create_endpoint.async_create_endpoint(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateEndpoint")
    )
    input_: capo_eventbridge.types.create_endpoint_request.CreateEndpointRequest = {
        "name": name,
        "routing_config": routing_config,
        "event_buses": event_buses,
    }
    if description is not None:
        input_["description"] = description
    if replication_config is not None:
        input_["replication_config"] = replication_config
    if role_arn is not None:
        input_["role_arn"] = role_arn

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