java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.core.Construct
software.amazon.awscdk.core.Resource
software.amazon.awscdk.services.apigatewayv2.HttpApi
All Implemented Interfaces:
IConstruct, IDependable, IResource, IApi, IHttpApi, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:30:43.247Z") @Stability(Experimental) public class HttpApi extends Resource implements IHttpApi, IApi
(experimental) Create a new API Gateway HTTP API endpoint.

Example:

 import software.amazon.awscdk.services.apigatewayv2.integrations.HttpLambdaIntegration;
 Function booksDefaultFn;
 HttpLambdaIntegration booksIntegration = new HttpLambdaIntegration("BooksIntegration", booksDefaultFn);
 HttpApi httpApi = new HttpApi(this, "HttpApi");
 httpApi.addRoutes(AddRoutesOptions.builder()
         .path("/books")
         .methods(List.of(HttpMethod.GET))
         .integration(booksIntegration)
         .build());
 
  • Constructor Details

    • HttpApi

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

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

      @Stability(Experimental) public HttpApi(@NotNull software.constructs.Construct scope, @NotNull String id, @Nullable HttpApiProps props)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      props -
    • HttpApi

      @Stability(Experimental) public HttpApi(@NotNull software.constructs.Construct scope, @NotNull String id)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
  • Method Details

    • fromHttpApiAttributes

      @Stability(Experimental) @NotNull public static IHttpApi fromHttpApiAttributes(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull HttpApiAttributes attrs)
      (experimental) Import an existing HTTP API into this CDK app.

      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      attrs - This parameter is required.
    • addRoutes

      @Stability(Experimental) @NotNull public List<HttpRoute> addRoutes(@NotNull AddRoutesOptions options)
      (experimental) Add multiple routes that uses the same configuration.

      The routes all go to the same path, but for different methods.

      Parameters:
      options - This parameter is required.
    • addStage

      @Stability(Experimental) @NotNull public HttpStage addStage(@NotNull String id, @NotNull HttpStageOptions options)
      (experimental) Add a new stage.

      Parameters:
      id - This parameter is required.
      options - This parameter is required.
    • addVpcLink

      @Stability(Experimental) @NotNull public VpcLink addVpcLink(@NotNull VpcLinkProps options)
      (experimental) Add a new VpcLink.

      Specified by:
      addVpcLink in interface IHttpApi
      Parameters:
      options - This parameter is required.
    • metric

      @Stability(Experimental) @NotNull public Metric metric(@NotNull String metricName, @Nullable MetricOptions props)
      (experimental) Return the given named metric for this Api Gateway.

      Specified by:
      metric in interface IApi
      Parameters:
      metricName - This parameter is required.
      props -
    • metric

      @Stability(Experimental) @NotNull public Metric metric(@NotNull String metricName)
      (experimental) Return the given named metric for this Api Gateway.

      Specified by:
      metric in interface IApi
      Parameters:
      metricName - This parameter is required.
    • metricClientError

      @Stability(Experimental) @NotNull public Metric metricClientError(@Nullable MetricOptions props)
      (experimental) Metric for the number of client-side errors captured in a given period.

      Specified by:
      metricClientError in interface IHttpApi
      Parameters:
      props -
    • metricClientError

      @Stability(Experimental) @NotNull public Metric metricClientError()
      (experimental) Metric for the number of client-side errors captured in a given period.
      Specified by:
      metricClientError in interface IHttpApi
    • metricCount

      @Stability(Experimental) @NotNull public Metric metricCount(@Nullable MetricOptions props)
      (experimental) Metric for the total number API requests in a given period.

      Specified by:
      metricCount in interface IHttpApi
      Parameters:
      props -
    • metricCount

      @Stability(Experimental) @NotNull public Metric metricCount()
      (experimental) Metric for the total number API requests in a given period.
      Specified by:
      metricCount in interface IHttpApi
    • metricDataProcessed

      @Stability(Experimental) @NotNull public Metric metricDataProcessed(@Nullable MetricOptions props)
      (experimental) Metric for the amount of data processed in bytes.

      Specified by:
      metricDataProcessed in interface IHttpApi
      Parameters:
      props -
    • metricDataProcessed

      @Stability(Experimental) @NotNull public Metric metricDataProcessed()
      (experimental) Metric for the amount of data processed in bytes.
      Specified by:
      metricDataProcessed in interface IHttpApi
    • metricIntegrationLatency

      @Stability(Experimental) @NotNull public Metric metricIntegrationLatency(@Nullable MetricOptions props)
      (experimental) Metric for the time between when API Gateway relays a request to the backend and when it receives a response from the backend.

      Specified by:
      metricIntegrationLatency in interface IHttpApi
      Parameters:
      props -
    • metricIntegrationLatency

      @Stability(Experimental) @NotNull public Metric metricIntegrationLatency()
      (experimental) Metric for the time between when API Gateway relays a request to the backend and when it receives a response from the backend.
      Specified by:
      metricIntegrationLatency in interface IHttpApi
    • metricLatency

      @Stability(Experimental) @NotNull public Metric metricLatency(@Nullable MetricOptions props)
      (experimental) The time between when API Gateway receives a request from a client and when it returns a response to the client.

      The latency includes the integration latency and other API Gateway overhead.

      Specified by:
      metricLatency in interface IHttpApi
      Parameters:
      props -
    • metricLatency

      @Stability(Experimental) @NotNull public Metric metricLatency()
      (experimental) The time between when API Gateway receives a request from a client and when it returns a response to the client.

      The latency includes the integration latency and other API Gateway overhead.

      Specified by:
      metricLatency in interface IHttpApi
    • metricServerError

      @Stability(Experimental) @NotNull public Metric metricServerError(@Nullable MetricOptions props)
      (experimental) Metric for the number of server-side errors captured in a given period.

      Specified by:
      metricServerError in interface IHttpApi
      Parameters:
      props -
    • metricServerError

      @Stability(Experimental) @NotNull public Metric metricServerError()
      (experimental) Metric for the number of server-side errors captured in a given period.
      Specified by:
      metricServerError in interface IHttpApi
    • getApiEndpoint

      @Stability(Experimental) @NotNull public String getApiEndpoint()
      (experimental) Get the default endpoint for this API.
      Specified by:
      getApiEndpoint in interface IApi
    • getApiId

      @Stability(Experimental) @NotNull public String getApiId()
      (experimental) The identifier of this API Gateway API.
      Specified by:
      getApiId in interface IApi
    • getHttpApiId

      @Stability(Experimental) @NotNull public String getHttpApiId()
      (experimental) The identifier of this API Gateway HTTP API.
      Specified by:
      getHttpApiId in interface IHttpApi
    • getDefaultStage

      @Stability(Experimental) @Nullable public IHttpStage getDefaultStage()
      (experimental) The default stage of this API.
    • getDisableExecuteApiEndpoint

      @Stability(Experimental) @Nullable public Boolean getDisableExecuteApiEndpoint()
      (experimental) Specifies whether clients can invoke this HTTP API by using the default execute-api endpoint.
    • getHttpApiName

      @Stability(Experimental) @Nullable public String getHttpApiName()
      (experimental) A human friendly name for this HTTP API.

      Note that this is different from httpApiId.

    • getUrl

      @Stability(Experimental) @Nullable public String getUrl()
      (experimental) Get the URL to the default stage of this API.

      Returns undefined if createDefaultStage is unset.