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 Summary
Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode
Nested classes/interfaces inherited from interface software.amazon.awscdk.services.apigatewayv2.IApi
IApi.Jsii$Default, IApi.Jsii$Proxy
Nested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$Default
Nested classes/interfaces inherited from interface software.amazon.awscdk.services.apigatewayv2.IHttpApi
IHttpApi.Jsii$Default, IHttpApi.Jsii$Proxy
Nested classes/interfaces inherited from interface software.amazon.awscdk.IResource
IResource.Jsii$Default
-
Constructor Summary
ModifierConstructorDescriptionprotected
HttpApi
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
HttpApi
(software.amazon.jsii.JsiiObjectRef objRef) HttpApi
(software.constructs.Construct scope, String id, HttpApiProps props) -
Method Summary
Modifier 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 IHttpApi
fromHttpApiAttributes
(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.Resource
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isOwnedResource, isResource
Methods inherited from class software.constructs.Construct
getNode, isConstruct, toString
Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface software.constructs.IConstruct
getNode
Methods inherited from interface software.amazon.awscdk.IResource
applyRemovalPolicy, getEnv, getStack
Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Constructor Details
-
HttpApi
protected HttpApi(software.amazon.jsii.JsiiObjectRef objRef) -
HttpApi
protected 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.
-
addRoutes
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(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.
-
addVpcLink
Add a new VpcLink.- Specified by:
addVpcLink
in interfaceIHttpApi
- 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:
arnForExecuteApi
in interfaceIHttpApi
- 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:
arnForExecuteApi
in interfaceIHttpApi
- Parameters:
method
-path
-
-
arnForExecuteApi
Get the "execute-api" ARN.When 'ANY' is passed to the method, an ARN with the method set to '*' is obtained.
- Specified by:
arnForExecuteApi
in interfaceIHttpApi
- Parameters:
method
-
-
arnForExecuteApi
Get the "execute-api" ARN.When 'ANY' is passed to the method, an ARN with the method set to '*' is obtained.
- Specified by:
arnForExecuteApi
in interfaceIHttpApi
-
metric
@Stability(Stable) @NotNull public Metric metric(@NotNull String metricName, @Nullable MetricOptions props) Return the given named metric for this Api Gateway. -
metric
Return the given named metric for this Api Gateway. -
metricClientError
Metric for the number of client-side errors captured in a given period.- Specified by:
metricClientError
in interfaceIHttpApi
- Parameters:
props
-
-
metricClientError
Metric for the number of client-side errors captured in a given period.- Specified by:
metricClientError
in interfaceIHttpApi
-
metricCount
Metric for the total number API requests in a given period.- Specified by:
metricCount
in interfaceIHttpApi
- Parameters:
props
-
-
metricCount
Metric for the total number API requests in a given period.- Specified by:
metricCount
in interfaceIHttpApi
-
metricDataProcessed
Metric for the amount of data processed in bytes.- Specified by:
metricDataProcessed
in interfaceIHttpApi
- Parameters:
props
-
-
metricDataProcessed
Metric for the amount of data processed in bytes.- Specified by:
metricDataProcessed
in interfaceIHttpApi
-
metricIntegrationLatency
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 interfaceIHttpApi
- Parameters:
props
-
-
metricIntegrationLatency
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 interfaceIHttpApi
-
metricLatency
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 interfaceIHttpApi
- Parameters:
props
-
-
metricLatency
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 interfaceIHttpApi
-
metricServerError
Metric for the number of server-side errors captured in a given period.- Specified by:
metricServerError
in interfaceIHttpApi
- Parameters:
props
-
-
metricServerError
Metric for the number of server-side errors captured in a given period.- Specified by:
metricServerError
in interfaceIHttpApi
-
getApiEndpoint
Get the default endpoint for this API.- Specified by:
getApiEndpoint
in interfaceIApi
-
getApiId
The identifier of this API Gateway API. -
getHttpApiId
The identifier of the HTTP API.- See Also:
-
getDefaultAuthorizationScopes
Default 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:
getDefaultAuthorizationScopes
in interfaceIHttpApi
-
getDefaultAuthorizer
Default Authorizer applied to all routes in the gateway.- Specified by:
getDefaultAuthorizer
in interfaceIHttpApi
-
getDefaultStage
The default stage of this API. -
getDisableExecuteApiEndpoint
Specifies whether clients can invoke this HTTP API by using the default execute-api endpoint. -
getHttpApiName
A human friendly name for this HTTP API.Note that this is different from
httpApiId
. -
getUrl
Get the URL to the default stage of this API.Returns
undefined
ifcreateDefaultStage
is unset.
-