Show / Hide Table of Contents

Class RestApi

Represents a REST API in Amazon API Gateway.

Inheritance
System.Object
Resource
RestApiBase
RestApi
LambdaRestApi
StepFunctionsRestApi
Implements
IRestApi
IResource
Constructs.IConstruct
Constructs.IDependable
Inherited Members
RestApiBase.AddApiKey(String, IApiKeyOptions)
RestApiBase.AddDomainName(String, IDomainNameOptions)
RestApiBase.AddGatewayResponse(String, IGatewayResponseOptions)
RestApiBase.AddUsagePlan(String, IUsagePlanProps)
RestApiBase.ArnForExecuteApi(String, String, String)
RestApiBase.Metric(String, IMetricOptions)
RestApiBase.MetricCacheHitCount(IMetricOptions)
RestApiBase.MetricCacheMissCount(IMetricOptions)
RestApiBase.MetricClientError(IMetricOptions)
RestApiBase.MetricCount(IMetricOptions)
RestApiBase.MetricIntegrationLatency(IMetricOptions)
RestApiBase.MetricLatency(IMetricOptions)
RestApiBase.MetricServerError(IMetricOptions)
RestApiBase.UrlForPath(String)
RestApiBase.RestApiName
RestApiBase.DomainName
RestApiBase.LatestDeployment
RestApiBase.DeploymentStage
RestApiBase.CloudWatchAccount
Resource.IsOwnedResource(IConstruct)
Resource.IsResource(IConstruct)
Resource.ApplyRemovalPolicy(RemovalPolicy)
Resource.GeneratePhysicalName()
Resource.GetResourceArnAttribute(String, IArnComponents)
Resource.GetResourceNameAttribute(String)
Resource.Env
Resource.PhysicalName
Resource.Stack
Namespace: Amazon.CDK.AWS.APIGateway
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class RestApi : RestApiBase, IRestApi, IResource
Syntax (vb)
Public Class RestApi
    Inherits RestApiBase
    Implements IRestApi, IResource
Remarks

Use addResource and addMethod to configure the API model.

By default, the API will automatically be deployed and accessible from a public endpoint.

ExampleMetadata: infused

Examples
var stateMachine = new StateMachine(this, "MyStateMachine", new StateMachineProps {
    StateMachineType = StateMachineType.EXPRESS,
    Definition = Chain.Start(new Pass(this, "Pass"))
});

var api = new RestApi(this, "Api", new RestApiProps {
    RestApiName = "MyApi"
});
api.Root.AddMethod("GET", StepFunctionsIntegration.StartExecution(stateMachine));

Synopsis

Constructors

RestApi(ByRefValue)

Used by jsii to construct an instance of this class from a Javascript-owned object reference

RestApi(DeputyBase.DeputyProps)

Used by jsii to construct an instance of this class from DeputyProps

RestApi(Construct, String, IRestApiProps)

Properties

Methods

The list of methods bound to this RestApi.

RestApiId

The ID of this API Gateway RestApi.

RestApiRootResourceId

The resource ID of the root resource.

Root

Represents the root resource of this API endpoint ('/').

Url

The deployed root URL of this REST API.

Methods

AddModel(String, IModelOptions)

Adds a new model.

AddRequestValidator(String, IRequestValidatorOptions)

Adds a new request validator.

FromRestApiAttributes(Construct, String, IRestApiAttributes)

Import an existing RestApi that can be configured with additional Methods and Resources.

FromRestApiId(Construct, String, String)

Import an existing RestApi.

Constructors

RestApi(ByRefValue)

Used by jsii to construct an instance of this class from a Javascript-owned object reference

protected RestApi(ByRefValue reference)
Parameters
reference Amazon.JSII.Runtime.Deputy.ByRefValue

The Javascript-owned object reference

RestApi(DeputyBase.DeputyProps)

Used by jsii to construct an instance of this class from DeputyProps

protected RestApi(DeputyBase.DeputyProps props)
Parameters
props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps

The deputy props

RestApi(Construct, String, IRestApiProps)

public RestApi(Construct scope, string id, IRestApiProps props = null)
Parameters
scope Constructs.Construct
id System.String
props IRestApiProps

Properties

Methods

The list of methods bound to this RestApi.

public virtual Method[] Methods { get; }
Property Value

Method[]

RestApiId

The ID of this API Gateway RestApi.

public override string RestApiId { get; }
Property Value

System.String

Overrides
RestApiBase.RestApiId

RestApiRootResourceId

The resource ID of the root resource.

public override string RestApiRootResourceId { get; }
Property Value

System.String

Overrides
RestApiBase.RestApiRootResourceId

Root

Represents the root resource of this API endpoint ('/').

public override IResource Root { get; }
Property Value

IResource

Overrides
RestApiBase.Root
Remarks

Resources and Methods are added to this resource.

Url

The deployed root URL of this REST API.

public virtual string Url { get; }
Property Value

System.String

Methods

AddModel(String, IModelOptions)

Adds a new model.

public virtual Model AddModel(string id, IModelOptions props)
Parameters
id System.String
props IModelOptions
Returns

Model

AddRequestValidator(String, IRequestValidatorOptions)

Adds a new request validator.

public virtual RequestValidator AddRequestValidator(string id, IRequestValidatorOptions props)
Parameters
id System.String
props IRequestValidatorOptions
Returns

RequestValidator

FromRestApiAttributes(Construct, String, IRestApiAttributes)

Import an existing RestApi that can be configured with additional Methods and Resources.

public static IRestApi FromRestApiAttributes(Construct scope, string id, IRestApiAttributes attrs)
Parameters
scope Constructs.Construct
id System.String
attrs IRestApiAttributes
Returns

IRestApi

FromRestApiId(Construct, String, String)

Import an existing RestApi.

public static IRestApi FromRestApiId(Construct scope, string id, string restApiId)
Parameters
scope Constructs.Construct
id System.String
restApiId System.String
Returns

IRestApi

Implements

IRestApi
IResource
Constructs.IConstruct
Constructs.IDependable
Back to top Generated by DocFX