Class SpecRestApi
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.Resource
software.amazon.awscdk.services.apigateway.RestApiBase
software.amazon.awscdk.services.apigateway.SpecRestApi
- All Implemented Interfaces:
IRestApiRef,IEnvironmentAware,IResource,IRestApi,IResourceWithPolicy,IResourceWithPolicyV2,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct,software.constructs.IDependable
@Generated(value="jsii-pacmak/1.120.0 (build 192dc88)",
date="2025-12-05T10:47:11.610Z")
@Stability(Stable)
public class SpecRestApi
extends RestApiBase
Represents a REST API in Amazon API Gateway, created with an OpenAPI specification.
Some properties normally accessible on
Example:
SpecRestApi api = SpecRestApi.Builder.create(this, "books-api")
.apiDefinition(ApiDefinition.fromAsset("path-to-file.json"))
.mode(RestApiMode.MERGE)
.build();
- See Also:
-
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.constructs.IConstruct
software.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.IResource
IResource.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.services.iam.IResourceWithPolicy
IResourceWithPolicy.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.services.apigateway.IRestApi
IRestApi.Jsii$Default -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedSpecRestApi(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedSpecRestApi(software.amazon.jsii.JsiiObjectRef objRef) SpecRestApi(software.constructs.Construct scope, String id, SpecRestApiProps props) -
Method Summary
Modifier and TypeMethodDescriptionaddToResourcePolicy(PolicyStatement statement) Adds a statement to the resource policy associated with this rest api.The ID of this API Gateway RestApi.The resource ID of the root resource.getRoot()Represents the root resource of this API endpoint ('/').Methods inherited from class software.amazon.awscdk.services.apigateway.RestApiBase
addApiKey, addApiKey, addDomainName, addGatewayResponse, addUsagePlan, addUsagePlan, arnForExecuteApi, arnForExecuteApi, arnForExecuteApi, arnForExecuteApi, getCloudWatchAccount, getDeploymentStage, getDomainName, getLatestDeployment, getResourcePolicy, getRestApiName, getRestApiRef, getUrl, grantInvokeFromVpcEndpointsOnly, metric, metric, metricCacheHitCount, metricCacheHitCount, metricCacheMissCount, metricCacheMissCount, metricClientError, metricClientError, metricCount, metricCount, metricIntegrationLatency, metricIntegrationLatency, metricLatency, metricLatency, metricServerError, metricServerError, setCloudWatchAccount, setDeploymentStage, setResourcePolicy, urlForPath, urlForPathMethods 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.amazon.awscdk.IResource
applyRemovalPolicy, getStackMethods inherited from interface software.amazon.awscdk.services.iam.IResourceWithPolicy
getEnvMethods inherited from interface software.amazon.awscdk.services.apigateway.IRestApi
getEnv, getNodeMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
PROPERTY_INJECTION_ID
Uniquely identifies this class.
-
-
Constructor Details
-
SpecRestApi
protected SpecRestApi(software.amazon.jsii.JsiiObjectRef objRef) -
SpecRestApi
protected SpecRestApi(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
SpecRestApi
@Stability(Stable) public SpecRestApi(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull SpecRestApiProps props) - Parameters:
scope- This parameter is required.id- This parameter is required.props- This parameter is required.
-
-
Method Details
-
addToResourcePolicy
@Stability(Stable) @NotNull public AddToResourcePolicyResult addToResourcePolicy(@NotNull PolicyStatement statement) Adds a statement to the resource policy associated with this rest api.A resource policy will be automatically created upon the first call to
addToResourcePolicy.Note that this does not work with imported rest api.
- Specified by:
addToResourcePolicyin interfaceIResourceWithPolicyV2- Specified by:
addToResourcePolicyin classRestApiBase- Parameters:
statement- The policy statement to add. This parameter is required.
-
getRestApiId
The ID of this API Gateway RestApi.- Specified by:
getRestApiIdin interfaceIRestApi- Specified by:
getRestApiIdin classRestApiBase
-
getRestApiRootResourceId
The resource ID of the root resource.- Specified by:
getRestApiRootResourceIdin interfaceIRestApi- Specified by:
getRestApiRootResourceIdin classRestApiBase
-
getRoot
Represents the root resource of this API endpoint ('/').Resources and Methods are added to this resource.
- Specified by:
getRootin interfaceIRestApi- Specified by:
getRootin classRestApiBase
-