Interface ApiGatewayProps

All Superinterfaces:
software.amazon.jsii.JsiiSerializable, TargetBaseProps
All Known Implementing Classes:
ApiGatewayProps.Jsii$Proxy

@Generated(value="jsii-pacmak/1.103.1 (build bef2dea)", date="2024-10-05T03:43:43.706Z") @Stability(Stable) public interface ApiGatewayProps extends software.amazon.jsii.JsiiSerializable, TargetBaseProps
Customize the API Gateway Event Target.

Example:

 import software.amazon.awscdk.services.apigateway.*;
 import software.amazon.awscdk.services.lambda.*;
 Rule rule = Rule.Builder.create(this, "Rule")
         .schedule(Schedule.rate(Duration.minutes(1)))
         .build();
 Function fn = Function.Builder.create(this, "MyFunc")
         .handler("index.handler")
         .runtime(Runtime.NODEJS_LATEST)
         .code(Code.fromInline("exports.handler = e => {}"))
         .build();
 LambdaRestApi restApi = LambdaRestApi.Builder.create(this, "MyRestAPI").handler(fn).build();
 Queue dlq = new Queue(this, "DeadLetterQueue");
 rule.addTarget(
 ApiGateway.Builder.create(restApi)
         .path("/*/test")
         .method("GET")
         .stage("prod")
         .pathParameterValues(List.of("path-value"))
         .headerParameters(Map.of(
                 "Header1", "header1"))
         .queryStringParameters(Map.of(
                 "QueryParam1", "query-param-1"))
         .deadLetterQueue(dlq)
         .build());
 
  • Method Details

    • getEventRole

      @Stability(Stable) @Nullable default IRole getEventRole()
      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

    • getHeaderParameters

      @Stability(Stable) @Nullable default Map<String,String> getHeaderParameters()
      The headers to be set when requesting API.

      Default: no header parameters

    • getMethod

      @Stability(Stable) @Nullable default String getMethod()
      The method for api resource invoked by the rule.

      Default: '*' that treated as ANY

    • getPath

      @Stability(Stable) @Nullable default String getPath()
      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: '/'

    • getPathParameterValues

      @Stability(Stable) @Nullable default List<String> getPathParameterValues()
      The path parameter values to be used to populate to wildcards("*") of requesting api path.

      Default: no path parameters

    • getPostBody

      @Stability(Stable) @Nullable default RuleTargetInput getPostBody()
      This will be the post request body send to the API.

      Default: the entire EventBridge event

    • getQueryStringParameters

      @Stability(Stable) @Nullable default Map<String,String> getQueryStringParameters()
      The query parameters to be set when requesting API.

      Default: no querystring parameters

    • getStage

      @Stability(Stable) @Nullable default String getStage()
      The deploy stage of api gateway invoked by the rule.

      Default: the value of deploymentStage.stageName of target api gateway.

    • builder

      @Stability(Stable) static ApiGatewayProps.Builder builder()
      Returns:
      a ApiGatewayProps.Builder of ApiGatewayProps