Table of Contents

Class ResourceBase

Namespace
Amazon.CDK.AWS.APIGateway
Assembly
Amazon.CDK.AWS.APIGateway.dll
public abstract class ResourceBase : Resource, IResource, IResource, IConstruct, IConstruct, IDependable
Inheritance
ResourceBase
Implements
IResource
IConstruct
IConstruct
IDependable
Derived

Constructors

ResourceBase(Construct, string)

protected ResourceBase(Construct scope, string id)

Parameters

scope Construct
id string

Properties

Api

The rest API that this resource is part of.

public abstract IRestApi Api { get; }

Property Value

IRestApi

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 abstract ICorsOptions? DefaultCorsPreflightOptions { get; }

Property Value

ICorsOptions

DefaultIntegration

An integration to use as a default for all methods created within this API unless an integration is specified.

public abstract Integration? DefaultIntegration { get; }

Property Value

Integration

DefaultMethodOptions

Method options to use as a default for all methods created within this API unless custom options are specified.

public abstract IMethodOptions? DefaultMethodOptions { get; }

Property Value

IMethodOptions

ParentResource

The parent of this resource or undefined for the root resource.

public abstract IResource? ParentResource { get; }

Property Value

IResource

Path

The full path of this resource.

public abstract string Path { get; }

Property Value

string

ResourceId

The ID of the resource.

public abstract string ResourceId { get; }

Property Value

string

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.")]
public abstract RestApi RestApi { get; }

Property Value

RestApi

Remarks

Stability: Deprecated

Url

[Obsolete("- Throws error in some use cases that have been enabled since this deprecation notice. Use `RestApi.urlForPath()` instead.")]
public virtual string Url { get; }

Property Value

string

Remarks

Stability: Deprecated

Methods

AddCorsPreflight(ICorsOptions)

Adds an OPTIONS method to this resource which responds to Cross-Origin Resource Sharing (CORS) preflight requests.

public virtual Method AddCorsPreflight(ICorsOptions options)

Parameters

options ICorsOptions

Returns

Method

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.

public virtual Method AddMethod(string httpMethod, Integration? integration = null, IMethodOptions? options = null)

Parameters

httpMethod string
integration Integration
options IMethodOptions

Returns

Method

AddProxy(IProxyResourceOptions?)

Adds a greedy proxy resource ("{proxy+}") and an ANY method to this route.

public virtual ProxyResource AddProxy(IProxyResourceOptions? options = null)

Parameters

options IProxyResourceOptions

Returns

ProxyResource

AddResource(string, IResourceOptions?)

Defines a new child resource where this resource is the parent.

public virtual Resource AddResource(string pathPart, IResourceOptions? options = null)

Parameters

pathPart string
options IResourceOptions

Returns

Resource

GetResource(string)

Retrieves a child resource by path part.

public virtual IResource? GetResource(string pathPart)

Parameters

pathPart string

Returns

IResource

ResourceForPath(string)

Gets or create all resources leading up to the specified path.

public virtual Resource ResourceForPath(string path)

Parameters

path string

Returns

Resource

Remarks