Class HttpApi
- All Implemented Interfaces:
IEnvironmentAware,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 ClassesNested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.amazon.awscdk.services.apigatewayv2.IApi
IApi.Jsii$Default, IApi.Jsii$ProxyNested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.services.apigatewayv2.IHttpApi
IHttpApi.Jsii$Default, IHttpApi.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.IResource
IResource.Jsii$Default -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedHttpApi(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedHttpApi(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 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.Resource
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isOwnedResource, isResourceMethods inherited from class software.constructs.Construct
getNode, isConstruct, toStringMethods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface software.constructs.IConstruct
getNodeMethods inherited from interface software.amazon.awscdk.IEnvironmentAware
getEnvMethods inherited from interface software.amazon.awscdk.IResource
applyRemovalPolicy, getStackMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
PROPERTY_INJECTION_ID
Uniquely identifies this class.
-
-
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:
addVpcLinkin 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:
arnForExecuteApiin 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:
arnForExecuteApiin 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:
arnForExecuteApiin 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:
arnForExecuteApiin 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:
metricClientErrorin interfaceIHttpApi- Parameters:
props-
-
metricClientError
Metric for the number of client-side errors captured in a given period.- Specified by:
metricClientErrorin interfaceIHttpApi
-
metricCount
Metric for the total number API requests in a given period.- Specified by:
metricCountin interfaceIHttpApi- Parameters:
props-
-
metricCount
Metric for the total number API requests in a given period.- Specified by:
metricCountin interfaceIHttpApi
-
metricDataProcessed
Metric for the amount of data processed in bytes.- Specified by:
metricDataProcessedin interfaceIHttpApi- Parameters:
props-
-
metricDataProcessed
Metric for the amount of data processed in bytes.- Specified by:
metricDataProcessedin 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:
metricIntegrationLatencyin 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:
metricIntegrationLatencyin 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:
metricLatencyin 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:
metricLatencyin interfaceIHttpApi
-
metricServerError
Metric for the number of server-side errors captured in a given period.- Specified by:
metricServerErrorin interfaceIHttpApi- Parameters:
props-
-
metricServerError
Metric for the number of server-side errors captured in a given period.- Specified by:
metricServerErrorin interfaceIHttpApi
-
getApiEndpoint
Get the default endpoint for this API.- Specified by:
getApiEndpointin 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:
getDefaultAuthorizationScopesin interfaceIHttpApi
-
getDefaultAuthorizer
Default Authorizer applied to all routes in the gateway.- Specified by:
getDefaultAuthorizerin interfaceIHttpApi
-
getDefaultStage
The default stage of this API.- Specified by:
getDefaultStagein interfaceIHttpApi
-
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
undefinedifcreateDefaultStageis unset.
-