Class RestApiBase
- All Implemented Interfaces:
IConstruct
,IDependable
,IResource
,IRestApi
,software.amazon.jsii.JsiiSerializable
,software.constructs.IConstruct
- Direct Known Subclasses:
RestApi
,SpecRestApi
Example:
import software.amazon.awscdk.services.route53.*; import software.amazon.awscdk.services.route53.targets.*; RestApi api; Object hostedZoneForExampleCom; ARecord.Builder.create(this, "CustomDomainAliasRecord") .zone(hostedZoneForExampleCom) .target(RecordTarget.fromAlias(new ApiGateway(api))) .build();
-
Nested Class Summary
Nested classes/interfaces inherited from class software.constructs.Construct
software.constructs.Construct.Builder
Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode
Nested classes/interfaces inherited from interface software.amazon.awscdk.core.IConstruct
IConstruct.Jsii$Default
Nested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$Default
Nested classes/interfaces inherited from interface software.amazon.awscdk.core.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.addApiKey
(String id, ApiKeyOptions options) Add an ApiKey.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 void
configureCloudWatchRole
(CfnRestApi apiResource) Deprecated.This method will be made internal.protected void
Deprecated.This method will be made internal.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 ('/').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.core.Resource
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isResource
Methods inherited from class software.amazon.awscdk.core.Construct
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validate
Methods inherited from class software.constructs.Construct
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.amazon.awscdk.core.IConstruct
getNode
Methods inherited from interface software.amazon.awscdk.core.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.- Parameters:
id
- This parameter is required.options
-
-
addApiKey
Add an ApiKey.- 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.
-
configureCloudWatchRole
@Stability(Deprecated) @Deprecated protected void configureCloudWatchRole(@NotNull CfnRestApi apiResource) Deprecated.This method will be made internal. No replacement- Parameters:
apiResource
- This parameter is required.
-
configureDeployment
@Stability(Deprecated) @Deprecated protected void configureDeployment(@NotNull RestApiBaseProps props) Deprecated.This method will be made internal. No replacement- Parameters:
props
- This parameter is required.
-
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
. -
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.
-
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
-