java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
All Implemented Interfaces:
IInspectable, ITaggable, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.97.0 (build 729de35)", date="2024-04-18T17:54:11.982Z") @Stability(Stable) public class CfnApi extends CfnResource implements IInspectable, ITaggable
The AWS::ApiGatewayV2::Api resource creates an API.

WebSocket APIs and HTTP APIs are supported. For more information about WebSocket APIs, see About WebSocket APIs in API Gateway in the API Gateway Developer Guide . For more information about HTTP APIs, see HTTP APIs in the API Gateway Developer Guide.

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.*;
 Object body;
 CfnApi cfnApi = CfnApi.Builder.create(this, "MyCfnApi")
         .apiKeySelectionExpression("apiKeySelectionExpression")
         .basePath("basePath")
         .body(body)
         .bodyS3Location(BodyS3LocationProperty.builder()
                 .bucket("bucket")
                 .etag("etag")
                 .key("key")
                 .version("version")
                 .build())
         .corsConfiguration(CorsProperty.builder()
                 .allowCredentials(false)
                 .allowHeaders(List.of("allowHeaders"))
                 .allowMethods(List.of("allowMethods"))
                 .allowOrigins(List.of("allowOrigins"))
                 .exposeHeaders(List.of("exposeHeaders"))
                 .maxAge(123)
                 .build())
         .credentialsArn("credentialsArn")
         .description("description")
         .disableExecuteApiEndpoint(false)
         .disableSchemaValidation(false)
         .failOnWarnings(false)
         .name("name")
         .protocolType("protocolType")
         .routeKey("routeKey")
         .routeSelectionExpression("routeSelectionExpression")
         .tags(Map.of(
                 "tagsKey", "tags"))
         .target("target")
         .version("version")
         .build();
 

See Also:
  • Field Details

    • CFN_RESOURCE_TYPE_NAME

      @Stability(Stable) public static final String CFN_RESOURCE_TYPE_NAME
      The CloudFormation resource type name for this resource class.
  • Constructor Details

    • CfnApi

      protected CfnApi(software.amazon.jsii.JsiiObjectRef objRef)
    • CfnApi

      protected CfnApi(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • CfnApi

      @Stability(Stable) public CfnApi(@NotNull software.constructs.Construct scope, @NotNull String id, @Nullable CfnApiProps props)
      Parameters:
      scope - Scope in which this resource is defined. This parameter is required.
      id - Construct identifier for this resource (unique in its scope). This parameter is required.
      props - Resource properties.
    • CfnApi

      @Stability(Stable) public CfnApi(@NotNull software.constructs.Construct scope, @NotNull String id)
      Parameters:
      scope - Scope in which this resource is defined. This parameter is required.
      id - Construct identifier for this resource (unique in its scope). This parameter is required.
  • Method Details

    • inspect

      @Stability(Stable) public void inspect(@NotNull TreeInspector inspector)
      Examines the CloudFormation resource and discloses attributes.

      Specified by:
      inspect in interface IInspectable
      Parameters:
      inspector - tree inspector to collect and process attributes. This parameter is required.
    • renderProperties

      @Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String,Object> props)
      Overrides:
      renderProperties in class CfnResource
      Parameters:
      props - This parameter is required.
    • getAttrApiEndpoint

      @Stability(Stable) @NotNull public String getAttrApiEndpoint()
      The default endpoint for an API.

      For example: https://abcdef.execute-api.us-west-2.amazonaws.com .

    • getAttrApiId

      @Stability(Stable) @NotNull public String getAttrApiId()
      The API identifier.
    • getCfnProperties

      @Stability(Stable) @NotNull protected Map<String,Object> getCfnProperties()
      Overrides:
      getCfnProperties in class CfnResource
    • getTags

      @Stability(Stable) @NotNull public TagManager getTags()
      Tag Manager which manages the tags for this resource.
      Specified by:
      getTags in interface ITaggable
    • getApiKeySelectionExpression

      @Stability(Stable) @Nullable public String getApiKeySelectionExpression()
      An API key selection expression.
    • setApiKeySelectionExpression

      @Stability(Stable) public void setApiKeySelectionExpression(@Nullable String value)
      An API key selection expression.
    • getBasePath

      @Stability(Stable) @Nullable public String getBasePath()
      Specifies how to interpret the base path of the API during import.
    • setBasePath

      @Stability(Stable) public void setBasePath(@Nullable String value)
      Specifies how to interpret the base path of the API during import.
    • getBody

      @Stability(Stable) @Nullable public Object getBody()
      The OpenAPI definition.
    • setBody

      @Stability(Stable) public void setBody(@Nullable Object value)
      The OpenAPI definition.
    • getBodyS3Location

      @Stability(Stable) @Nullable public Object getBodyS3Location()
      The S3 location of an OpenAPI definition.
    • setBodyS3Location

      @Stability(Stable) public void setBodyS3Location(@Nullable IResolvable value)
      The S3 location of an OpenAPI definition.
    • setBodyS3Location

      @Stability(Stable) public void setBodyS3Location(@Nullable CfnApi.BodyS3LocationProperty value)
      The S3 location of an OpenAPI definition.
    • getCorsConfiguration

      @Stability(Stable) @Nullable public Object getCorsConfiguration()
      A CORS configuration.
    • setCorsConfiguration

      @Stability(Stable) public void setCorsConfiguration(@Nullable IResolvable value)
      A CORS configuration.
    • setCorsConfiguration

      @Stability(Stable) public void setCorsConfiguration(@Nullable CfnApi.CorsProperty value)
      A CORS configuration.
    • getCredentialsArn

      @Stability(Stable) @Nullable public String getCredentialsArn()
      This property is part of quick create.
    • setCredentialsArn

      @Stability(Stable) public void setCredentialsArn(@Nullable String value)
      This property is part of quick create.
    • getDescription

      @Stability(Stable) @Nullable public String getDescription()
      The description of the API.
    • setDescription

      @Stability(Stable) public void setDescription(@Nullable String value)
      The description of the API.
    • getDisableExecuteApiEndpoint

      @Stability(Stable) @Nullable public Object getDisableExecuteApiEndpoint()
      Specifies whether clients can invoke your API by using the default execute-api endpoint.
    • setDisableExecuteApiEndpoint

      @Stability(Stable) public void setDisableExecuteApiEndpoint(@Nullable Boolean value)
      Specifies whether clients can invoke your API by using the default execute-api endpoint.
    • setDisableExecuteApiEndpoint

      @Stability(Stable) public void setDisableExecuteApiEndpoint(@Nullable IResolvable value)
      Specifies whether clients can invoke your API by using the default execute-api endpoint.
    • getDisableSchemaValidation

      @Stability(Stable) @Nullable public Object getDisableSchemaValidation()
      Avoid validating models when creating a deployment.
    • setDisableSchemaValidation

      @Stability(Stable) public void setDisableSchemaValidation(@Nullable Boolean value)
      Avoid validating models when creating a deployment.
    • setDisableSchemaValidation

      @Stability(Stable) public void setDisableSchemaValidation(@Nullable IResolvable value)
      Avoid validating models when creating a deployment.
    • getFailOnWarnings

      @Stability(Stable) @Nullable public Object getFailOnWarnings()
      Specifies whether to rollback the API creation when a warning is encountered.
    • setFailOnWarnings

      @Stability(Stable) public void setFailOnWarnings(@Nullable Boolean value)
      Specifies whether to rollback the API creation when a warning is encountered.
    • setFailOnWarnings

      @Stability(Stable) public void setFailOnWarnings(@Nullable IResolvable value)
      Specifies whether to rollback the API creation when a warning is encountered.
    • getName

      @Stability(Stable) @Nullable public String getName()
      The name of the API.
    • setName

      @Stability(Stable) public void setName(@Nullable String value)
      The name of the API.
    • getProtocolType

      @Stability(Stable) @Nullable public String getProtocolType()
      The API protocol.
    • setProtocolType

      @Stability(Stable) public void setProtocolType(@Nullable String value)
      The API protocol.
    • getRouteKey

      @Stability(Stable) @Nullable public String getRouteKey()
      This property is part of quick create.
    • setRouteKey

      @Stability(Stable) public void setRouteKey(@Nullable String value)
      This property is part of quick create.
    • getRouteSelectionExpression

      @Stability(Stable) @Nullable public String getRouteSelectionExpression()
      The route selection expression for the API.
    • setRouteSelectionExpression

      @Stability(Stable) public void setRouteSelectionExpression(@Nullable String value)
      The route selection expression for the API.
    • getTagsRaw

      @Stability(Stable) @Nullable public Map<String,String> getTagsRaw()
      The collection of tags.
    • setTagsRaw

      @Stability(Stable) public void setTagsRaw(@Nullable Map<String,String> value)
      The collection of tags.
    • getTarget

      @Stability(Stable) @Nullable public String getTarget()
      This property is part of quick create.
    • setTarget

      @Stability(Stable) public void setTarget(@Nullable String value)
      This property is part of quick create.
    • getVersion

      @Stability(Stable) @Nullable public String getVersion()
      A version identifier for the API.
    • setVersion

      @Stability(Stable) public void setVersion(@Nullable String value)
      A version identifier for the API.