Class RestApiBase
- All Implemented Interfaces:
IResource
,IRestApi
,software.amazon.jsii.JsiiSerializable
,software.constructs.IConstruct
,software.constructs.IDependable
- Direct Known Subclasses:
RestApi
,SpecRestApi
Example:
RestApi api; Distribution.Builder.create(this, "Distribution") .defaultBehavior(BehaviorOptions.builder().origin(new RestApiOrigin(api)).build()) .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.constructs.IConstruct
software.constructs.IConstruct.Jsii$Default
Nested classes/interfaces inherited from interface software.amazon.awscdk.IResource
IResource.Jsii$Default
Nested classes/interfaces inherited from interface software.amazon.awscdk.services.apigateway.IRestApi
IRestApi.Jsii$Default
-
Constructor Summary
ModifierConstructorDescriptionprotected
RestApiBase
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
RestApiBase
(software.amazon.jsii.JsiiObjectRef objRef) protected
RestApiBase
(software.constructs.Construct scope, String id) protected
RestApiBase
(software.constructs.Construct scope, String id, RestApiBaseProps props) -
Method Summary
Modifier and TypeMethodDescriptionAdd an ApiKey to the deploymentStage.addApiKey
(String id, ApiKeyOptions options) Add an ApiKey to the deploymentStage.addDomainName
(String id, DomainNameOptions options) Defines an API Gateway domain name and maps it to this API.addGatewayResponse
(String id, GatewayResponseOptions options) Adds a new gateway response.addUsagePlan
(String id) Adds a usage plan.addUsagePlan
(String id, UsagePlanProps props) Adds a usage plan.Gets the "execute-api" ARN.arnForExecuteApi
(String method) Gets the "execute-api" ARN.arnForExecuteApi
(String method, String path) Gets the "execute-api" ARN.arnForExecuteApi
(String method, String path, String stage) Gets the "execute-api" ARN.protected CfnAccount
API Gateway stage that points to the latest deployment (if defined).The first domain name mapped to this API, if defined through thedomainName
configuration prop, or added viaaddDomainName
.API Gateway deployment that represents the latest changes of the API.abstract String
The ID of this API Gateway RestApi.A human friendly name for this Rest API.abstract String
The resource ID of the root resource.abstract IResource
getRoot()
Represents the root resource of this API endpoint ('/').getUrl()
The deployed root URL of this REST API.Returns the given named metric for this API.metric
(String metricName, MetricOptions props) Returns the given named metric for this API.Metric for the number of requests served from the API cache in a given period.metricCacheHitCount
(MetricOptions props) Metric for the number of requests served from the API cache in a given period.Metric for the number of requests served from the backend in a given period, when API caching is enabled.Metric for the number of requests served from the backend in a given period, when API caching is enabled.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 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.protected void
setCloudWatchAccount
(CfnAccount value) void
setDeploymentStage
(Stage value) API Gateway stage that points to the latest deployment (if defined).Returns the URL for an HTTP path.urlForPath
(String path) Returns the URL for an HTTP path.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
-
RestApiBase
protected RestApiBase(software.amazon.jsii.JsiiObjectRef objRef) -
RestApiBase
protected RestApiBase(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
RestApiBase
@Stability(Stable) protected RestApiBase(@NotNull software.constructs.Construct scope, @NotNull String id, @Nullable RestApiBaseProps props) - Parameters:
scope
- This parameter is required.id
- This parameter is required.props
-
-
RestApiBase
@Stability(Stable) protected RestApiBase(@NotNull software.constructs.Construct scope, @NotNull String id) - Parameters:
scope
- This parameter is required.id
- This parameter is required.
-
-
Method Details
-
addApiKey
@Stability(Stable) @NotNull public IApiKey addApiKey(@NotNull String id, @Nullable ApiKeyOptions options) Add an ApiKey to the deploymentStage.- Parameters:
id
- This parameter is required.options
-
-
addApiKey
Add an ApiKey to the deploymentStage.- Parameters:
id
- This parameter is required.
-
addDomainName
@Stability(Stable) @NotNull public DomainName addDomainName(@NotNull String id, @NotNull DomainNameOptions options) Defines an API Gateway domain name and maps it to this API.- Parameters:
id
- The construct id. This parameter is required.options
- custom domain options. This parameter is required.
-
addGatewayResponse
@Stability(Stable) @NotNull public GatewayResponse addGatewayResponse(@NotNull String id, @NotNull GatewayResponseOptions options) Adds a new gateway response.- Parameters:
id
- This parameter is required.options
- This parameter is required.
-
addUsagePlan
@Stability(Stable) @NotNull public UsagePlan addUsagePlan(@NotNull String id, @Nullable UsagePlanProps props) Adds a usage plan.- Parameters:
id
- This parameter is required.props
-
-
addUsagePlan
Adds a usage plan.- Parameters:
id
- This parameter is required.
-
arnForExecuteApi
@Stability(Stable) @NotNull public String arnForExecuteApi(@Nullable String method, @Nullable String path, @Nullable String stage) Gets the "execute-api" ARN.- Specified by:
arnForExecuteApi
in interfaceIRestApi
- Parameters:
method
-path
-stage
-- Returns:
- The "execute-api" ARN.
-
arnForExecuteApi
@Stability(Stable) @NotNull public String arnForExecuteApi(@Nullable String method, @Nullable String path) Gets the "execute-api" ARN.- Specified by:
arnForExecuteApi
in interfaceIRestApi
- Parameters:
method
-path
-- Returns:
- The "execute-api" ARN.
-
arnForExecuteApi
Gets the "execute-api" ARN.- Specified by:
arnForExecuteApi
in interfaceIRestApi
- Parameters:
method
-- Returns:
- The "execute-api" ARN.
-
arnForExecuteApi
Gets the "execute-api" ARN.- Specified by:
arnForExecuteApi
in interfaceIRestApi
- Returns:
- The "execute-api" ARN.
-
metric
@Stability(Stable) @NotNull public Metric metric(@NotNull String metricName, @Nullable MetricOptions props) Returns the given named metric for this API.- Parameters:
metricName
- This parameter is required.props
-
-
metric
Returns the given named metric for this API.- Parameters:
metricName
- This parameter is required.
-
metricCacheHitCount
Metric for the number of requests served from the API cache in a given period.Default: sum over 5 minutes
- Parameters:
props
-
-
metricCacheHitCount
Metric for the number of requests served from the API cache in a given period.Default: sum over 5 minutes
-
metricCacheMissCount
Metric for the number of requests served from the backend in a given period, when API caching is enabled.Default: sum over 5 minutes
- Parameters:
props
-
-
metricCacheMissCount
Metric for the number of requests served from the backend in a given period, when API caching is enabled.Default: sum over 5 minutes
-
metricClientError
Metric for the number of client-side errors captured in a given period.Default: sum over 5 minutes
- Parameters:
props
-
-
metricClientError
Metric for the number of client-side errors captured in a given period.Default: sum over 5 minutes
-
metricCount
Metric for the total number API requests in a given period.Default: sample count over 5 minutes
- Parameters:
props
-
-
metricCount
Metric for the total number API requests in a given period.Default: sample count over 5 minutes
-
metricIntegrationLatency
Metric for the time between when API Gateway relays a request to the backend and when it receives a response from the backend.Default: average over 5 minutes.
- 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.Default: average over 5 minutes.
-
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.
Default: average over 5 minutes.
- 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.
Default: average over 5 minutes.
-
metricServerError
Metric for the number of server-side errors captured in a given period.Default: sum over 5 minutes
- Parameters:
props
-
-
metricServerError
Metric for the number of server-side errors captured in a given period.Default: sum over 5 minutes
-
urlForPath
Returns the URL for an HTTP path.Fails if
deploymentStage
is not set either bydeploy
or explicitly.- Parameters:
path
-
-
urlForPath
Returns the URL for an HTTP path.Fails if
deploymentStage
is not set either bydeploy
or explicitly. -
getRestApiId
The ID of this API Gateway RestApi.- Specified by:
getRestApiId
in interfaceIRestApi
-
getRestApiName
A human friendly name for this Rest API.Note that this is different from
restApiId
.- Specified by:
getRestApiName
in interfaceIRestApi
-
getRestApiRootResourceId
The resource ID of the root resource.- Specified by:
getRestApiRootResourceId
in interfaceIRestApi
-
getRoot
Represents the root resource of this API endpoint ('/').Resources and Methods are added to this resource.
-
getUrl
The deployed root URL of this REST API. -
getDomainName
The first domain name mapped to this API, if defined through thedomainName
configuration prop, or added viaaddDomainName
. -
getLatestDeployment
API Gateway deployment that represents the latest changes of the API.This resource will be automatically updated every time the REST API model changes. This will be undefined if
deploy
is false.- Specified by:
getLatestDeployment
in interfaceIRestApi
-
getDeploymentStage
API Gateway stage that points to the latest deployment (if defined).If
deploy
is disabled, you will need to explicitly assign this value in order to set up integrations.- Specified by:
getDeploymentStage
in interfaceIRestApi
-
setDeploymentStage
API Gateway stage that points to the latest deployment (if defined).If
deploy
is disabled, you will need to explicitly assign this value in order to set up integrations.- Specified by:
setDeploymentStage
in interfaceIRestApi
-
getCloudWatchAccount
-
setCloudWatchAccount
-