Skip to content

create_api_destination

create_api_destination(
    name: ApiDestinationName,
    connection_arn: ConnectionArn,
    invocation_endpoint: HttpsEndpoint,
    http_method: ApiDestinationHttpMethod,
    *,
    config_overrides: Optional[EventBridgeClientConfig] = None,
    description: Optional[ApiDestinationDescription] = None,
    invocation_rate_limit_per_second: Optional[
        ApiDestinationInvocationRateLimitPerSecond
    ] = None,
) -> CreateApiDestinationResponse

Creates an API destination, which is an HTTP invocation endpoint configured as a target for events.

API destinations do not support private destinations, such as interface VPC endpoints.

For more information, see API destinations in the EventBridge User Guide.

Parameters:

  • name (ApiDestinationName) –

    The name for the API destination to create.

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

    A description for the API destination to create.

  • connection_arn (ConnectionArn) –

    The ARN of the connection to use for the API destination. The destination endpoint must support the authorization type specified for the connection.

  • invocation_endpoint (HttpsEndpoint) –

    The URL to the HTTP invocation endpoint for the API destination.

  • http_method (ApiDestinationHttpMethod) –

    The method to use for the request to the HTTP invocation endpoint.

  • invocation_rate_limit_per_second (Optional[ApiDestinationInvocationRateLimitPerSecond], default: None ) –

    The maximum number of requests per second to send to the HTTP invocation endpoint.

Raises:

Source code in docs_src/capo_eventbridge/_services/event_bridge.py
def create_api_destination(
    self,
    name: "capo_eventbridge.types.api_destination_name.ApiDestinationName",
    connection_arn: "capo_eventbridge.types.connection_arn.ConnectionArn",
    invocation_endpoint: "capo_eventbridge.types.https_endpoint.HttpsEndpoint",
    http_method: "capo_eventbridge.types.api_destination_http_method.ApiDestinationHttpMethod",
    *,
    config_overrides: Optional[EventBridgeClientConfig] = None,
    description: Optional[
        "capo_eventbridge.types.api_destination_description.ApiDestinationDescription"
    ] = None,
    invocation_rate_limit_per_second: Optional[
        "capo_eventbridge.types.api_destination_invocation_rate_limit_per_second.ApiDestinationInvocationRateLimitPerSecond"
    ] = None,
) -> "capo_eventbridge.types.create_api_destination_response.CreateApiDestinationResponse":
    """<p>Creates an API destination, which is an HTTP invocation endpoint configured as a target for events.</p> <p>API destinations do not support private destinations, such as interface VPC endpoints.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-api-destinations.html">API destinations</a> in the <i>EventBridge User Guide</i>.</p>

    Args:
        name: <p>The name for the API destination to create.</p>
        description: <p>A description for the API destination to create.</p>
        connection_arn: <p>The ARN of the connection to use for the API destination. The destination endpoint must support the authorization type specified for the connection.</p>
        invocation_endpoint: <p>The URL to the HTTP invocation endpoint for the API destination.</p>
        http_method: <p>The method to use for the request to the HTTP invocation endpoint.</p>
        invocation_rate_limit_per_second: <p>The maximum number of requests per second to send to the HTTP invocation endpoint.</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.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.
    """

    def _handler(
        req: "OperationRequest[capo_eventbridge.types.create_api_destination_request.CreateApiDestinationRequest]",
    ) -> OperationResponse[
        "capo_eventbridge.types.create_api_destination_response.CreateApiDestinationResponse"
    ]:
        import capo_eventbridge._operations.aws_events.create_api_destination

        output, http_response = (
            capo_eventbridge._operations.aws_events.create_api_destination.create_api_destination(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateApiDestination")
    )
    input_: capo_eventbridge.types.create_api_destination_request.CreateApiDestinationRequest = {
        "name": name,
        "connection_arn": connection_arn,
        "invocation_endpoint": invocation_endpoint,
        "http_method": http_method,
    }
    if description is not None:
        input_["description"] = description
    if invocation_rate_limit_per_second is not None:
        input_["invocation_rate_limit_per_second"] = (
            invocation_rate_limit_per_second
        )

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