Interface IResource
Inherited Members
Namespace: Amazon.CDK.AWS.APIGateway
Assembly: Amazon.CDK.AWS.APIGateway.dll
Syntax (csharp)
public interface IResource : IResource, IConstruct, IDependable
Syntax (vb)
Public Interface IResource
Inherits IResource, IConstruct, IConstruct, IDependable
Synopsis
Properties
Api | The rest API that this resource is part of. |
DefaultCorsPreflightOptions | Default options for CORS preflight OPTIONS method. |
DefaultIntegration | An integration to use as a default for all methods created within this API unless an integration is specified. |
DefaultMethodOptions | Method options to use as a default for all methods created within this API unless custom options are specified. |
ParentResource | The parent of this resource or undefined for the root resource. |
Path | The full path of this resource. |
ResourceId | The ID of the resource. |
RestApi | (deprecated) The rest API that this resource is part of. |
Methods
AddCorsPreflight(ICorsOptions) | Adds an OPTIONS method to this resource which responds to Cross-Origin Resource Sharing (CORS) preflight requests. |
AddMethod(String, Integration, IMethodOptions) | Defines a new method for this resource. |
AddProxy(IProxyResourceOptions) | Adds a greedy proxy resource ("{proxy+}") and an ANY method to this route. |
AddResource(String, IResourceOptions) | Defines a new child resource where this resource is the parent. |
GetResource(String) | Retrieves a child resource by path part. |
ResourceForPath(String) | Gets or create all resources leading up to the specified path. |
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.
virtual 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.
virtual 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.
virtual IMethodOptions DefaultMethodOptions { get; }
Property Value
ParentResource
The parent of this resource or undefined for the root resource.
virtual IResource ParentResource { get; }
Property Value
Path
The full path of this resource.
string Path { get; }
Property Value
System.String
ResourceId
The ID of the resource.
string ResourceId { get; }
Property Value
System.String
Remarks
Attribute: true
RestApi
(deprecated) The rest API that this resource is part of.
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 ICorsOptions
CORS options.
Returns
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 System.String
The HTTP method.
- target Integration
The target backend integration for this method.
- options IMethodOptions
Method options, such as authentication.
Returns
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 IProxyResourceOptions
Default 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 System.String
The path part for the child resource.
- options IResourceOptions
Resource options.
Returns
A Resource object
GetResource(String)
Retrieves a child resource by path part.
IResource GetResource(string pathPart)
Parameters
- pathPart System.String
The path part of the child resource.
Returns
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 System.String
The relative path.
Returns
a new or existing resource.