ApiDestination

class aws_cdk.aws_events_targets.ApiDestination(api_destination, *, event=None, event_role=None, header_parameters=None, path_parameter_values=None, query_string_parameters=None, dead_letter_queue=None, max_event_age=None, retry_attempts=None)

Bases: object

Use an API Destination rule target.

ExampleMetadata:

infused

Example:

connection = events.Connection(self, "Connection",
    authorization=events.Authorization.api_key("x-api-key", SecretValue.secrets_manager("ApiSecretName")),
    description="Connection with API Key x-api-key"
)

destination = events.ApiDestination(self, "Destination",
    connection=connection,
    endpoint="https://example.com",
    description="Calling example.com with API key x-api-key"
)

rule = events.Rule(self, "Rule",
    schedule=events.Schedule.rate(Duration.minutes(1)),
    targets=[targets.ApiDestination(destination)]
)
Parameters:
  • api_destination (IApiDestination) –

  • event (Optional[RuleTargetInput]) – The event to send. Default: - the entire EventBridge event

  • event_role (Optional[IRole]) – The role to assume before invoking the target. Default: - a new role will be created

  • header_parameters (Optional[Mapping[str, str]]) – Additional headers sent to the API Destination. These are merged with headers specified on the Connection, with the headers on the Connection taking precedence. You can only specify secret values on the Connection. Default: - none

  • path_parameter_values (Optional[Sequence[str]]) – Path parameters to insert in place of path wildcards (*). If the API destination has a wilcard in the path, these path parts will be inserted in that place. Default: - none

  • query_string_parameters (Optional[Mapping[str, str]]) – Additional query string parameters sent to the API Destination. These are merged with headers specified on the Connection, with the headers on the Connection taking precedence. You can only specify secret values on the Connection. Default: - none

  • dead_letter_queue (Optional[IQueue]) – The SQS queue to be used as deadLetterQueue. Check out the considerations for using a dead-letter queue. The events not successfully delivered are automatically retried for a specified period of time, depending on the retry policy of the target. If an event is not delivered before all retry attempts are exhausted, it will be sent to the dead letter queue. Default: - no dead-letter queue

  • max_event_age (Optional[Duration]) – The maximum age of a request that Lambda sends to a function for processing. Minimum value of 60. Maximum value of 86400. Default: Duration.hours(24)

  • retry_attempts (Union[int, float, None]) – The maximum number of times to retry when the function returns an error. Minimum value of 0. Maximum value of 185. Default: 185

Methods

bind(_rule, _id=None)

Returns a RuleTarget that can be used to trigger API destinations from an EventBridge event.

Parameters:
  • _rule (IRule) –

  • _id (Optional[str]) –

Return type:

RuleTargetConfig