@Generated(value="jsii-pacmak/1.74.0 (build 6d08790)", date="2023-03-14T16:25:33.454Z") public class Resource extends ResourceBase
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");
Modifier and Type | Class and Description |
---|---|
static class |
Resource.Builder
A fluent builder for
Resource . |
IResource.Jsii$Default
Modifier | Constructor and Description |
---|---|
protected |
Resource(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
Resource(software.amazon.jsii.JsiiObjectRef objRef) |
|
Resource(software.constructs.Construct scope,
java.lang.String id,
ResourceProps props) |
Modifier and Type | Method and Description |
---|---|
static IResource |
fromResourceAttributes(software.constructs.Construct scope,
java.lang.String id,
ResourceAttributes attrs)
Import an existing resource.
|
IRestApi |
getApi()
The rest API that this resource is part of.
|
CorsOptions |
getDefaultCorsPreflightOptions()
Default options for CORS preflight OPTIONS method.
|
Integration |
getDefaultIntegration()
An integration to use as a default for all methods created within this API unless an integration is specified.
|
MethodOptions |
getDefaultMethodOptions()
Method options to use as a default for all methods created within this API unless custom options are specified.
|
IResource |
getParentResource()
The parent of this resource or undefined for the root resource.
|
java.lang.String |
getPath()
The full path of this resource.
|
java.lang.String |
getResourceId()
The ID of the resource.
|
RestApi |
getRestApi()
Deprecated.
- Throws an error if this Resource is not associated with an instance of `RestApi`. Use `api` instead.
|
addCorsPreflight, addMethod, addMethod, addMethod, addProxy, addProxy, addResource, addResource, getResource, getUrl, resourceForPath
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isResource
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validate
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
applyRemovalPolicy, getEnv, getStack
getNode
protected Resource(software.amazon.jsii.JsiiObjectRef objRef)
protected Resource(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
public Resource(software.constructs.Construct scope, java.lang.String id, ResourceProps props)
scope
- This parameter is required.id
- This parameter is required.props
- This parameter is required.public static IResource fromResourceAttributes(software.constructs.Construct scope, java.lang.String id, ResourceAttributes attrs)
scope
- This parameter is required.id
- This parameter is required.attrs
- This parameter is required.public IRestApi getApi()
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.
getApi
in class ResourceBase
public java.lang.String getPath()
getPath
in class ResourceBase
public java.lang.String getResourceId()
getResourceId
in class ResourceBase
@Deprecated public RestApi getRestApi()
getRestApi
in class ResourceBase
public CorsOptions getDefaultCorsPreflightOptions()
getDefaultCorsPreflightOptions
in class ResourceBase
public Integration getDefaultIntegration()
getDefaultIntegration
in class ResourceBase
public MethodOptions getDefaultMethodOptions()
getDefaultMethodOptions
in class ResourceBase
public IResource getParentResource()
getParentResource
in class ResourceBase