Interface CfnApi.CorsProperty

All Superinterfaces:
software.amazon.jsii.JsiiSerializable
All Known Implementing Classes:
CfnApi.CorsProperty.Jsii$Proxy
Enclosing class:
CfnApi

@Stability(Stable) public static interface CfnApi.CorsProperty extends software.amazon.jsii.JsiiSerializable
The Cors property specifies a CORS configuration for an API.

Supported only for HTTP APIs. See Configuring CORS for more information.

Example:

 // The code below shows an example of how to instantiate this type.
 // The values are placeholders you should change.
 import software.amazon.awscdk.services.apigatewayv2.*;
 CorsProperty corsProperty = CorsProperty.builder()
         .allowCredentials(false)
         .allowHeaders(List.of("allowHeaders"))
         .allowMethods(List.of("allowMethods"))
         .allowOrigins(List.of("allowOrigins"))
         .exposeHeaders(List.of("exposeHeaders"))
         .maxAge(123)
         .build();
 
  • Method Details

    • getAllowCredentials

      @Stability(Stable) @Nullable default Object getAllowCredentials()
      Specifies whether credentials are included in the CORS request.

      Supported only for HTTP APIs.

    • getAllowHeaders

      @Stability(Stable) @Nullable default List<String> getAllowHeaders()
      Represents a collection of allowed headers.

      Supported only for HTTP APIs.

    • getAllowMethods

      @Stability(Stable) @Nullable default List<String> getAllowMethods()
      Represents a collection of allowed HTTP methods.

      Supported only for HTTP APIs.

    • getAllowOrigins

      @Stability(Stable) @Nullable default List<String> getAllowOrigins()
      Represents a collection of allowed origins.

      Supported only for HTTP APIs.

    • getExposeHeaders

      @Stability(Stable) @Nullable default List<String> getExposeHeaders()
      Represents a collection of exposed headers.

      Supported only for HTTP APIs.

    • getMaxAge

      @Stability(Stable) @Nullable default Number getMaxAge()
      The number of seconds that the browser should cache preflight request results.

      Supported only for HTTP APIs.

    • builder

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