Interface IResource
- Namespace
- Amazon.CDK.AWS.APIGateway
- Assembly
- Amazon.CDK.AWS.APIGateway.dll
public interface IResource : IResource, IConstruct, IConstruct, IDependable
Properties
Api
The rest API that this resource is part of.
IRestApi Api { get; }
Property Value
Remarks
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.
DefaultCorsPreflightOptions
Default options for CORS preflight OPTIONS method.
ICorsOptions? DefaultCorsPreflightOptions { get; }
Property Value
DefaultIntegration
An integration to use as a default for all methods created within this API unless an integration is specified.
Integration? DefaultIntegration { get; }
Property Value
DefaultMethodOptions
Method options to use as a default for all methods created within this API unless custom options are specified.
IMethodOptions? DefaultMethodOptions { get; }
Property Value
ParentResource
The parent of this resource or undefined for the root resource.
IResource? ParentResource { get; }
Property Value
Path
The full path of this resource.
string Path { get; }
Property Value
ResourceId
The ID of the resource.
string ResourceId { get; }
Property Value
Remarks
Attribute: true
RestApi
(deprecated) The rest API that this resource is part of.
[Obsolete("- Throws an error if this Resource is not associated with an instance of `RestApi`. Use `api` instead.")]
RestApi RestApi { get; }
Property Value
Remarks
Stability: Deprecated
Methods
AddCorsPreflight(ICorsOptions)
Adds an OPTIONS method to this resource which responds to Cross-Origin Resource Sharing (CORS) preflight requests.
Method AddCorsPreflight(ICorsOptions options)
Parameters
options
ICorsOptionsCORS options.
Returns
- Method
a
Method
object
Remarks
Cross-Origin Resource Sharing (CORS) is a mechanism that uses additional HTTP headers to tell browsers to give a web application running at one origin, access to selected resources from a different origin. A web application executes a cross-origin HTTP request when it requests a resource that has a different origin (domain, protocol, or port) from its own.
AddMethod(string, Integration?, IMethodOptions?)
Defines a new method for this resource.
Method AddMethod(string httpMethod, Integration? target = null, IMethodOptions? options = null)
Parameters
httpMethod
stringThe HTTP method.
target
IntegrationThe target backend integration for this method.
options
IMethodOptionsMethod options, such as authentication.
Returns
- Method
The newly created
Method
object.
AddProxy(IProxyResourceOptions?)
Adds a greedy proxy resource ("{proxy+}") and an ANY method to this route.
ProxyResource AddProxy(IProxyResourceOptions? options = null)
Parameters
options
IProxyResourceOptionsDefault integration and method options.
Returns
AddResource(string, IResourceOptions?)
Defines a new child resource where this resource is the parent.
Resource AddResource(string pathPart, IResourceOptions? options = null)
Parameters
pathPart
stringThe path part for the child resource.
options
IResourceOptionsResource options.
Returns
- Resource
A Resource object
GetResource(string)
Retrieves a child resource by path part.
IResource? GetResource(string pathPart)
Parameters
pathPart
stringThe path part of the child resource.
Returns
- IResource
the child resource or undefined if not found
ResourceForPath(string)
Gets or create all resources leading up to the specified path.
Resource ResourceForPath(string path)
Parameters
path
stringThe relative path.
Returns
- Resource
a new or existing resource.