Class Resource
Inherited Members
Namespace: Amazon.CDK.AWS.APIGateway
Assembly: Amazon.CDK.AWS.APIGateway.dll
Syntax (csharp)
public class Resource : ResourceBase, IResource, IResource, IConstruct, IDependable
Syntax (vb)
Public Class Resource
Inherits ResourceBase
Implements IResource, IResource, IConstruct, IDependable
Remarks
ExampleMetadata: infused
Examples
LambdaIntegration booksBackend;
var api = new RestApi(this, "books", new RestApiProps {
DefaultIntegration = booksBackend
});
var books = api.Root.AddResource("books");
books.AddMethod("GET"); // integrated with `booksBackend`
books.AddMethod("POST"); // integrated with `booksBackend`
var book = books.AddResource("{book_id}");
book.AddMethod("GET");
Synopsis
Constructors
Resource(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
Resource(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
Resource(Construct, String, IResourceProps) |
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 RestApi associated with this Resource. |
Methods
FromResourceAttributes(Construct, String, IResourceAttributes) | Import an existing resource. |
Constructors
Resource(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected Resource(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
Resource(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected Resource(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
Resource(Construct, String, IResourceProps)
public Resource(Construct scope, string id, IResourceProps props)
Parameters
- scope Constructs.Construct
- id System.String
- props IResourceProps
Properties
Api
The rest API that this resource is part of.
public override IRestApi Api { get; }
Property Value
Overrides
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.
public override ICorsOptions DefaultCorsPreflightOptions { get; }
Property Value
Overrides
DefaultIntegration
An integration to use as a default for all methods created within this API unless an integration is specified.
public override Integration DefaultIntegration { get; }
Property Value
Overrides
DefaultMethodOptions
Method options to use as a default for all methods created within this API unless custom options are specified.
public override IMethodOptions DefaultMethodOptions { get; }
Property Value
Overrides
ParentResource
The parent of this resource or undefined for the root resource.
public override IResource ParentResource { get; }
Property Value
Overrides
Path
The full path of this resource.
public override string Path { get; }
Property Value
System.String
Overrides
ResourceId
The ID of the resource.
public override string ResourceId { get; }
Property Value
System.String
Overrides
RestApi
(deprecated) The RestApi associated with this Resource.
public override RestApi RestApi { get; }
Property Value
Overrides
Remarks
Stability: Deprecated
Methods
FromResourceAttributes(Construct, String, IResourceAttributes)
Import an existing resource.
public static IResource FromResourceAttributes(Construct scope, string id, IResourceAttributes attrs)
Parameters
- scope Constructs.Construct
- id System.String
- attrs IResourceAttributes
Returns