Class Resource
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.core.Construct
software.amazon.awscdk.core.Resource
software.amazon.awscdk.services.apigateway.ResourceBase
software.amazon.awscdk.services.apigateway.Resource
- All Implemented Interfaces:
IConstruct
,IDependable
,IResource
,IResource
,software.amazon.jsii.JsiiSerializable
,software.constructs.IConstruct
- Direct Known Subclasses:
ProxyResource
@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)",
date="2023-06-19T16:30:45.062Z")
@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.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.IResource
IResource.Jsii$Default
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Resource
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
Resource
(software.amazon.jsii.JsiiObjectRef objRef) Resource
(software.constructs.Construct scope, String id, ResourceProps props) -
Method Summary
Modifier and TypeMethodDescriptionstatic IResource
fromResourceAttributes
(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.Deprecated.Methods inherited from class software.amazon.awscdk.services.apigateway.ResourceBase
addCorsPreflight, addMethod, addMethod, addMethod, addProxy, addProxy, addResource, addResource, getResource, getUrl, resourceForPath
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
-
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:
getApi
in interfaceIResource
- Specified by:
getApi
in classResourceBase
-
getPath
The full path of this resource.- Specified by:
getPath
in interfaceIResource
- Specified by:
getPath
in classResourceBase
-
getResourceId
The ID of the resource.- Specified by:
getResourceId
in interfaceIResource
- Specified by:
getResourceId
in classResourceBase
-
getRestApi
Deprecated.- Throws an error if this Resource is not associated with an instance of
RestApi
. Useapi
instead.
(deprecated) The RestApi associated with this Resource.- Specified by:
getRestApi
in interfaceIResource
- Specified by:
getRestApi
in classResourceBase
- Throws an error if this Resource is not associated with an instance of
-
getDefaultCorsPreflightOptions
Default options for CORS preflight OPTIONS method.- Specified by:
getDefaultCorsPreflightOptions
in interfaceIResource
- Specified by:
getDefaultCorsPreflightOptions
in classResourceBase
-
getDefaultIntegration
An integration to use as a default for all methods created within this API unless an integration is specified.- Specified by:
getDefaultIntegration
in interfaceIResource
- Specified by:
getDefaultIntegration
in classResourceBase
-
getDefaultMethodOptions
Method options to use as a default for all methods created within this API unless custom options are specified.- Specified by:
getDefaultMethodOptions
in interfaceIResource
- Specified by:
getDefaultMethodOptions
in classResourceBase
-
getParentResource
The parent of this resource or undefined for the root resource.- Specified by:
getParentResource
in interfaceIResource
- Specified by:
getParentResource
in classResourceBase
-
RestApi
.