Enum PassthroughBehavior

All Implemented Interfaces:
Serializable, Comparable<PassthroughBehavior>, java.lang.constant.Constable

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:30:45.024Z") @Stability(Stable) public enum PassthroughBehavior extends Enum<PassthroughBehavior>

 import path.*;
 import software.amazon.awscdk.services.lambda.*;
 import software.amazon.awscdk.core.App;
 import software.amazon.awscdk.core.Stack;
 import software.amazon.awscdk.services.apigateway.MockIntegration;
 import software.amazon.awscdk.services.apigateway.PassthroughBehavior;
 import software.amazon.awscdk.services.apigateway.RestApi;
 import software.amazon.awscdk.services.apigateway.RequestAuthorizer;
 import software.amazon.awscdk.services.apigateway.IdentitySource;
 // Against the RestApi endpoint from the stack output, run
 // `curl -s -o /dev/null -w "%{http_code}" <url>` should return 401
 // `curl -s -o /dev/null -w "%{http_code}" -H 'Authorization: deny' <url>?allow=yes` should return 403
 // `curl -s -o /dev/null -w "%{http_code}" -H 'Authorization: allow' <url>?allow=yes` should return 200
 App app = new App();
 Stack stack = new Stack(app, "RequestAuthorizerInteg");
 Function authorizerFn = Function.Builder.create(stack, "MyAuthorizerFunction")
         .code(AssetCode.fromAsset(join(__dirname, "integ.request-authorizer.handler")))
 RestApi restapi = new RestApi(stack, "MyRestApi");
 RequestAuthorizer authorizer = RequestAuthorizer.Builder.create(stack, "MyAuthorizer")
         .identitySources(List.of(IdentitySource.header("Authorization"), IdentitySource.queryString("allow")))
 restapi.root.addMethod("ANY", MockIntegration.Builder.create()
                 "application/json", "{ \"statusCode\": 200 }"))
         .build(), MethodOptions.builder()
  • Enum Constant Details


      @Stability(Stable) public static final PassthroughBehavior WHEN_NO_MATCH
      Passes the request body for unmapped content types through to the integration back end without transformation.
    • NEVER

      @Stability(Stable) public static final PassthroughBehavior NEVER
      Rejects unmapped content types with an HTTP 415 'Unsupported Media Type' response.

      @Stability(Stable) public static final PassthroughBehavior WHEN_NO_TEMPLATES
      Allows pass-through when the integration has NO content types mapped to templates.

      However if there is at least one content type defined, unmapped content types will be rejected with the same 415 response.

  • Method Details

    • values

      public static PassthroughBehavior[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static PassthroughBehavior valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      name - the name of the enum constant to be returned.
      the enum constant with the specified name
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null