Class HttpApi
- All Implemented Interfaces:
- IResource,- IApi,- IHttpApi,- software.amazon.jsii.JsiiSerializable,- software.constructs.IConstruct,- software.constructs.IDependable
Example:
 import software.amazon.awscdk.aws_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());
 - 
Nested Class SummaryNested ClassesNested classes/interfaces inherited from class software.amazon.jsii.JsiiObjectsoftware.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.amazon.awscdk.services.apigatewayv2.IApiIApi.Jsii$Default, IApi.Jsii$ProxyNested classes/interfaces inherited from interface software.constructs.IConstructsoftware.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.services.apigatewayv2.IHttpApiIHttpApi.Jsii$Default, IHttpApi.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.IResourceIResource.Jsii$Default
- 
Field SummaryFields
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedHttpApi(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedHttpApi(software.amazon.jsii.JsiiObjectRef objRef) HttpApi(software.constructs.Construct scope, String id, HttpApiProps props) 
- 
Method SummaryModifier and TypeMethodDescriptionaddRoutes(AddRoutesOptions options) Add multiple routes that uses the same configuration.addStage(String id, HttpStageOptions options) Add a new stage.addVpcLink(VpcLinkProps options) Add a new VpcLink.Get the "execute-api" ARN.arnForExecuteApi(String method) Get the "execute-api" ARN.arnForExecuteApi(String method, String path) Get the "execute-api" ARN.arnForExecuteApi(String method, String path, String stage) Get the "execute-api" ARN.static IHttpApifromHttpApiAttributes(software.constructs.Construct scope, String id, HttpApiAttributes attrs) Import an existing HTTP API into this CDK app.Get the default endpoint for this API.getApiId()The identifier of this API Gateway API.Default OIDC scopes attached to all routes in the gateway, unless explicitly configured on the route.Default Authorizer applied to all routes in the gateway.The default stage of this API.Specifies whether clients can invoke this HTTP API by using the default execute-api endpoint.The identifier of the HTTP API.A human friendly name for this HTTP API.getUrl()Get the URL to the default stage of this API.Return the given named metric for this Api Gateway.metric(String metricName, MetricOptions props) Return the given named metric for this Api Gateway.Metric for the number of client-side errors captured in a given period.metricClientError(MetricOptions props) Metric for the number of client-side errors captured in a given period.Metric for the total number API requests in a given period.metricCount(MetricOptions props) Metric for the total number API requests in a given period.Metric for the amount of data processed in bytes.metricDataProcessed(MetricOptions props) Metric for the amount of data processed in bytes.Metric for the time between when API Gateway relays a request to the backend and when it receives a response from the backend.Metric for the time between when API Gateway relays a request to the backend and when it receives a response from the backend.The time between when API Gateway receives a request from a client and when it returns a response to the client.metricLatency(MetricOptions props) The time between when API Gateway receives a request from a client and when it returns a response to the client.Metric for the number of server-side errors captured in a given period.metricServerError(MetricOptions props) Metric for the number of server-side errors captured in a given period.Methods inherited from class software.amazon.awscdk.ResourceapplyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isOwnedResource, isResourceMethods inherited from class software.constructs.ConstructgetNode, isConstruct, toStringMethods inherited from class software.amazon.jsii.JsiiObjectjsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface software.constructs.IConstructgetNodeMethods inherited from interface software.amazon.awscdk.IResourceapplyRemovalPolicy, getEnv, getStackMethods inherited from interface software.amazon.jsii.JsiiSerializable$jsii$toJson
- 
Field Details- 
PROPERTY_INJECTION_IDUniquely identifies this class.
 
- 
- 
Constructor Details- 
HttpApiprotected HttpApi(software.amazon.jsii.JsiiObjectRef objRef) 
- 
HttpApiprotected HttpApi(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) 
- 
HttpApi@Stability(Stable) 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- Parameters:
- scope- This parameter is required.
- id- This parameter is required.
 
 
- 
- 
Method Details- 
fromHttpApiAttributes@Stability(Stable) @NotNull public static IHttpApi fromHttpApiAttributes(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull HttpApiAttributes attrs) 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.
 
- 
addRoutesAdd 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(Stable) @NotNull public HttpStage addStage(@NotNull String id, @NotNull HttpStageOptions options) Add a new stage.- Parameters:
- id- This parameter is required.
- options- This parameter is required.
 
- 
addVpcLinkAdd a new VpcLink.- Specified by:
- addVpcLinkin interface- IHttpApi
- Parameters:
- options- This parameter is required.
 
- 
arnForExecuteApi@Stability(Stable) @NotNull public String arnForExecuteApi(@Nullable String method, @Nullable String path, @Nullable String stage) Get the "execute-api" ARN.When 'ANY' is passed to the method, an ARN with the method set to '*' is obtained. - Specified by:
- arnForExecuteApiin interface- IHttpApi
- Parameters:
- method-
- path-
- stage-
 
- 
arnForExecuteApi@Stability(Stable) @NotNull public String arnForExecuteApi(@Nullable String method, @Nullable String path) Get the "execute-api" ARN.When 'ANY' is passed to the method, an ARN with the method set to '*' is obtained. - Specified by:
- arnForExecuteApiin interface- IHttpApi
- Parameters:
- method-
- path-
 
- 
arnForExecuteApiGet the "execute-api" ARN.When 'ANY' is passed to the method, an ARN with the method set to '*' is obtained. - Specified by:
- arnForExecuteApiin interface- IHttpApi
- Parameters:
- method-
 
- 
arnForExecuteApiGet the "execute-api" ARN.When 'ANY' is passed to the method, an ARN with the method set to '*' is obtained. - Specified by:
- arnForExecuteApiin interface- IHttpApi
 
- 
metric@Stability(Stable) @NotNull public Metric metric(@NotNull String metricName, @Nullable MetricOptions props) Return the given named metric for this Api Gateway.
- 
metricReturn the given named metric for this Api Gateway.
- 
metricClientErrorMetric for the number of client-side errors captured in a given period.- Specified by:
- metricClientErrorin interface- IHttpApi
- Parameters:
- props-
 
- 
metricClientErrorMetric for the number of client-side errors captured in a given period.- Specified by:
- metricClientErrorin interface- IHttpApi
 
- 
metricCountMetric for the total number API requests in a given period.- Specified by:
- metricCountin interface- IHttpApi
- Parameters:
- props-
 
- 
metricCountMetric for the total number API requests in a given period.- Specified by:
- metricCountin interface- IHttpApi
 
- 
metricDataProcessedMetric for the amount of data processed in bytes.- Specified by:
- metricDataProcessedin interface- IHttpApi
- Parameters:
- props-
 
- 
metricDataProcessedMetric for the amount of data processed in bytes.- Specified by:
- metricDataProcessedin interface- IHttpApi
 
- 
metricIntegrationLatencyMetric for the time between when API Gateway relays a request to the backend and when it receives a response from the backend.- Specified by:
- metricIntegrationLatencyin interface- IHttpApi
- Parameters:
- props-
 
- 
metricIntegrationLatencyMetric for the time between when API Gateway relays a request to the backend and when it receives a response from the backend.- Specified by:
- metricIntegrationLatencyin interface- IHttpApi
 
- 
metricLatencyThe 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:
- metricLatencyin interface- IHttpApi
- Parameters:
- props-
 
- 
metricLatencyThe 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:
- metricLatencyin interface- IHttpApi
 
- 
metricServerErrorMetric for the number of server-side errors captured in a given period.- Specified by:
- metricServerErrorin interface- IHttpApi
- Parameters:
- props-
 
- 
metricServerErrorMetric for the number of server-side errors captured in a given period.- Specified by:
- metricServerErrorin interface- IHttpApi
 
- 
getApiEndpointGet the default endpoint for this API.- Specified by:
- getApiEndpointin interface- IApi
 
- 
getApiIdThe identifier of this API Gateway API.
- 
getHttpApiIdThe identifier of the HTTP API.- See Also:
 
- 
getDefaultAuthorizationScopesDefault OIDC scopes attached to all routes in the gateway, unless explicitly configured on the route.The scopes are used with a COGNITO_USER_POOLS authorizer to authorize the method invocation. - Specified by:
- getDefaultAuthorizationScopesin interface- IHttpApi
 
- 
getDefaultAuthorizerDefault Authorizer applied to all routes in the gateway.- Specified by:
- getDefaultAuthorizerin interface- IHttpApi
 
- 
getDefaultStageThe default stage of this API.- Specified by:
- getDefaultStagein interface- IHttpApi
 
- 
getDisableExecuteApiEndpointSpecifies whether clients can invoke this HTTP API by using the default execute-api endpoint.
- 
getHttpApiNameA human friendly name for this HTTP API.Note that this is different from httpApiId.
- 
getUrlGet the URL to the default stage of this API.Returns undefinedifcreateDefaultStageis unset.
 
-