ApiGatewayProps
- class aws_cdk.aws_events_targets.ApiGatewayProps(*, dead_letter_queue=None, max_event_age=None, retry_attempts=None, event_role=None, header_parameters=None, method=None, path=None, path_parameter_values=None, post_body=None, query_string_parameters=None, stage=None)
 Bases:
TargetBasePropsCustomize the API Gateway Event Target.
- Parameters:
 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 queuemax_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: 185event_role (
Optional[IRole]) – The role to assume before invoking the target (i.e., the pipeline) when the given rule is triggered. Default: - a new role will be createdheader_parameters (
Optional[Mapping[str,str]]) – The headers to be set when requesting API. Default: no header parametersmethod (
Optional[str]) – The method for api resource invoked by the rule. Default: ‘*’ that treated as ANYpath (
Optional[str]) – The api resource invoked by the rule. We can use wildcards(‘*’) to specify the path. In that case, an equal number of real values must be specified for pathParameterValues. Default: ‘/’path_parameter_values (
Optional[Sequence[str]]) – The path parameter values to be used to populate to wildcards(“*”) of requesting api path. Default: no path parameterspost_body (
Optional[RuleTargetInput]) – This will be the post request body send to the API. Default: the entire EventBridge eventquery_string_parameters (
Optional[Mapping[str,str]]) – The query parameters to be set when requesting API. Default: no querystring parametersstage (
Optional[str]) – The deploy stage of api gateway invoked by the rule. Default: the value of deploymentStage.stageName of target api gateway.
- ExampleMetadata:
 infused
Example:
import aws_cdk.aws_apigateway as api import aws_cdk.aws_lambda as lambda_ rule = events.Rule(self, "Rule", schedule=events.Schedule.rate(Duration.minutes(1)) ) fn = lambda_.Function(self, "MyFunc", handler="index.handler", runtime=lambda_.Runtime.NODEJS_LATEST, code=lambda_.Code.from_inline("exports.handler = e => {}") ) rest_api = api.LambdaRestApi(self, "MyRestAPI", handler=fn) dlq = sqs.Queue(self, "DeadLetterQueue") rule.add_target( targets.ApiGateway(rest_api, path="/*/test", method="GET", stage="prod", path_parameter_values=["path-value"], header_parameters={ "Header1": "header1" }, query_string_parameters={ "QueryParam1": "query-param-1" }, dead_letter_queue=dlq ))
Attributes
- dead_letter_queue
 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
- event_role
 The role to assume before invoking the target (i.e., the pipeline) when the given rule is triggered.
- Default:
 a new role will be created
- header_parameters
 The headers to be set when requesting API.
- Default:
 no header parameters
- max_event_age
 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)
- method
 The method for api resource invoked by the rule.
- Default:
 ‘*’ that treated as ANY
- path
 The api resource invoked by the rule.
We can use wildcards(‘*’) to specify the path. In that case, an equal number of real values must be specified for pathParameterValues.
- Default:
 ‘/’
- path_parameter_values
 The path parameter values to be used to populate to wildcards(“*”) of requesting api path.
- Default:
 no path parameters
- post_body
 This will be the post request body send to the API.
- Default:
 the entire EventBridge event
- query_string_parameters
 The query parameters to be set when requesting API.
- Default:
 no querystring parameters
- retry_attempts
 The maximum number of times to retry when the function returns an error.
Minimum value of 0. Maximum value of 185.
- Default:
 185
- stage
 The deploy stage of api gateway invoked by the rule.
- Default:
 the value of deploymentStage.stageName of target api gateway.