Class Resource
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.Resource
software.amazon.awscdk.services.apigateway.ResourceBase
software.amazon.awscdk.services.apigateway.Resource
- All Implemented Interfaces:
IResource,IResource,IResourceRef,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct,software.constructs.IDependable
- Direct Known Subclasses:
ProxyResource
@Generated(value="jsii-pacmak/1.116.0 (build 0eddcff)",
date="2025-10-24T13:34:30.368Z")
@Stability(Stable)
public class Resource
extends ResourceBase
Example:
LambdaIntegration booksBackend;
RestApi api = RestApi.Builder.create(this, "books")
.defaultIntegration(booksBackend)
.build();
Resource books = api.root.addResource("books");
books.addMethod("GET"); // integrated with `booksBackend`
books.addMethod("POST"); // integrated with `booksBackend`
Resource book = books.addResource("{book_id}");
book.addMethod("GET");
-
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.apigateway.IResource
IResource.Jsii$Default -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedResource(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedResource(software.amazon.jsii.JsiiObjectRef objRef) Resource(software.constructs.Construct scope, String id, ResourceProps props) -
Method Summary
Modifier and TypeMethodDescriptionstatic IResourcefromResourceAttributes(software.constructs.Construct scope, String id, ResourceAttributes attrs) Import an existing resource.getApi()The rest API that this resource is part of.Default options for CORS preflight OPTIONS method.An integration to use as a default for all methods created within this API unless an integration is specified.Method options to use as a default for all methods created within this API unless custom options are specified.The parent of this resource or undefined for the root resource.getPath()The full path of this resource.The ID of the resource.Methods inherited from class software.amazon.awscdk.services.apigateway.ResourceBase
addCorsPreflight, addMethod, addMethod, addMethod, addProxy, addProxy, addResource, addResource, getResource, getResourceRef, resourceForPathMethods 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, getEnv, getStackMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
PROPERTY_INJECTION_ID
Uniquely identifies this class.
-
-
Constructor Details
-
Resource
protected Resource(software.amazon.jsii.JsiiObjectRef objRef) -
Resource
protected Resource(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
Resource
@Stability(Stable) public Resource(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull ResourceProps props) - Parameters:
scope- This parameter is required.id- This parameter is required.props- This parameter is required.
-
-
Method Details
-
fromResourceAttributes
@Stability(Stable) @NotNull public static IResource fromResourceAttributes(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull ResourceAttributes attrs) Import an existing resource.- Parameters:
scope- This parameter is required.id- This parameter is required.attrs- This parameter is required.
-
getApi
The rest API that this resource is part of.The reason we need the RestApi object itself and not just the ID is because the model is being tracked by the top-level RestApi object for the purpose of calculating it's hash to determine the ID of the deployment. This allows us to automatically update the deployment when the model of the REST API changes.
- Specified by:
getApiin interfaceIResource- Specified by:
getApiin classResourceBase
-
getPath
The full path of this resource.- Specified by:
getPathin interfaceIResource- Specified by:
getPathin classResourceBase
-
getResourceId
The ID of the resource.- Specified by:
getResourceIdin interfaceIResource- Specified by:
getResourceIdin classResourceBase
-
getDefaultCorsPreflightOptions
Default options for CORS preflight OPTIONS method.- Specified by:
getDefaultCorsPreflightOptionsin interfaceIResource- Specified by:
getDefaultCorsPreflightOptionsin classResourceBase
-
getDefaultIntegration
An integration to use as a default for all methods created within this API unless an integration is specified.- Specified by:
getDefaultIntegrationin interfaceIResource- Specified by:
getDefaultIntegrationin classResourceBase
-
getDefaultMethodOptions
Method options to use as a default for all methods created within this API unless custom options are specified.- Specified by:
getDefaultMethodOptionsin interfaceIResource- Specified by:
getDefaultMethodOptionsin classResourceBase
-
getParentResource
The parent of this resource or undefined for the root resource.- Specified by:
getParentResourcein interfaceIResource- Specified by:
getParentResourcein classResourceBase
-