Class RestApiBase
Base implementation that are common to various implementations of IRestApi.
Inherited Members
Namespace: Amazon.CDK.AWS.APIGateway
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public abstract class RestApiBase : Resource, IRestApi, IResource
Syntax (vb)
Public MustInherit Class RestApiBase
Inherits Resource
Implements IRestApi, IResource
Remarks
ExampleMetadata: infused
Examples
RestApi api;
new Distribution(this, "Distribution", new DistributionProps {
DefaultBehavior = new BehaviorOptions { Origin = new RestApiOrigin(api) }
});
Synopsis
Constructors
RestApiBase(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
RestApiBase(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
RestApiBase(Construct, String, IRestApiBaseProps) |
Properties
CloudWatchAccount | |
DeploymentStage | API Gateway stage that points to the latest deployment (if defined). |
DomainName | The first domain name mapped to this API, if defined through the |
LatestDeployment | API Gateway deployment that represents the latest changes of the API. |
RestApiId | The ID of this API Gateway RestApi. |
RestApiName | A human friendly name for this Rest API. |
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
AddApiKey(String, IApiKeyOptions) | Add an ApiKey to the deploymentStage. |
AddDomainName(String, IDomainNameOptions) | Defines an API Gateway domain name and maps it to this API. |
AddGatewayResponse(String, IGatewayResponseOptions) | Adds a new gateway response. |
AddUsagePlan(String, IUsagePlanProps) | Adds a usage plan. |
ArnForExecuteApi(String, String, String) | Gets the "execute-api" ARN. |
Metric(String, IMetricOptions) | Returns the given named metric for this API. |
MetricCacheHitCount(IMetricOptions) | Metric for the number of requests served from the API cache in a given period. |
MetricCacheMissCount(IMetricOptions) | Metric for the number of requests served from the backend in a given period, when API caching is enabled. |
MetricClientError(IMetricOptions) | Metric for the number of client-side errors captured in a given period. |
MetricCount(IMetricOptions) | Metric for the total number API requests in a given period. |
MetricIntegrationLatency(IMetricOptions) | Metric for the time between when API Gateway relays a request to the backend and when it receives a response from the backend. |
MetricLatency(IMetricOptions) | The time between when API Gateway receives a request from a client and when it returns a response to the client. |
MetricServerError(IMetricOptions) | Metric for the number of server-side errors captured in a given period. |
UrlForPath(String) | Returns the URL for an HTTP path. |
Constructors
RestApiBase(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected RestApiBase(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
RestApiBase(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected RestApiBase(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
RestApiBase(Construct, String, IRestApiBaseProps)
protected RestApiBase(Construct scope, string id, IRestApiBaseProps props = null)
Parameters
- scope Constructs.Construct
- id System.String
- props IRestApiBaseProps
Properties
CloudWatchAccount
DeploymentStage
API Gateway stage that points to the latest deployment (if defined).
public virtual Stage DeploymentStage { get; set; }
Property Value
Remarks
If deploy
is disabled, you will need to explicitly assign this value in order to
set up integrations.
DomainName
The first domain name mapped to this API, if defined through the domainName
configuration prop, or added via addDomainName
.
public virtual DomainName_ DomainName { get; }
Property Value
LatestDeployment
API Gateway deployment that represents the latest changes of the API.
public virtual Deployment LatestDeployment { get; }
Property Value
Remarks
This resource will be automatically updated every time the REST API model changes.
This will be undefined if deploy
is false.
RestApiId
The ID of this API Gateway RestApi.
public abstract string RestApiId { get; }
Property Value
System.String
RestApiName
A human friendly name for this Rest API.
public virtual string RestApiName { get; }
Property Value
System.String
Remarks
Note that this is different from restApiId
.
Attribute: true
RestApiRootResourceId
The resource ID of the root resource.
public abstract string RestApiRootResourceId { get; }
Property Value
System.String
Remarks
Attribute: true
Root
Represents the root resource of this API endpoint ('/').
public abstract IResource Root { get; }
Property Value
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
AddApiKey(String, IApiKeyOptions)
Add an ApiKey to the deploymentStage.
public virtual IApiKey AddApiKey(string id, IApiKeyOptions options = null)
Parameters
- id System.String
- options IApiKeyOptions
Returns
AddDomainName(String, IDomainNameOptions)
Defines an API Gateway domain name and maps it to this API.
public virtual DomainName_ AddDomainName(string id, IDomainNameOptions options)
Parameters
- id System.String
The construct id.
- options IDomainNameOptions
custom domain options.
Returns
AddGatewayResponse(String, IGatewayResponseOptions)
Adds a new gateway response.
public virtual GatewayResponse AddGatewayResponse(string id, IGatewayResponseOptions options)
Parameters
- id System.String
- options IGatewayResponseOptions
Returns
AddUsagePlan(String, IUsagePlanProps)
Adds a usage plan.
public virtual UsagePlan AddUsagePlan(string id, IUsagePlanProps props = null)
Parameters
- id System.String
- props IUsagePlanProps
Returns
ArnForExecuteApi(String, String, String)
Gets the "execute-api" ARN.
public virtual string ArnForExecuteApi(string method = null, string path = null, string stage = null)
Parameters
- method System.String
- path System.String
- stage System.String
Returns
System.String
Metric(String, IMetricOptions)
Returns the given named metric for this API.
public virtual Metric Metric(string metricName, IMetricOptions props = null)
Parameters
- metricName System.String
- props IMetricOptions
Returns
MetricCacheHitCount(IMetricOptions)
Metric for the number of requests served from the API cache in a given period.
public virtual Metric MetricCacheHitCount(IMetricOptions props = null)
Parameters
- props IMetricOptions
Returns
Remarks
Default: sum over 5 minutes
MetricCacheMissCount(IMetricOptions)
Metric for the number of requests served from the backend in a given period, when API caching is enabled.
public virtual Metric MetricCacheMissCount(IMetricOptions props = null)
Parameters
- props IMetricOptions
Returns
Remarks
Default: sum over 5 minutes
MetricClientError(IMetricOptions)
Metric for the number of client-side errors captured in a given period.
public virtual Metric MetricClientError(IMetricOptions props = null)
Parameters
- props IMetricOptions
Returns
Remarks
Default: sum over 5 minutes
MetricCount(IMetricOptions)
Metric for the total number API requests in a given period.
public virtual Metric MetricCount(IMetricOptions props = null)
Parameters
- props IMetricOptions
Returns
Remarks
Default: sample count over 5 minutes
MetricIntegrationLatency(IMetricOptions)
Metric for the time between when API Gateway relays a request to the backend and when it receives a response from the backend.
public virtual Metric MetricIntegrationLatency(IMetricOptions props = null)
Parameters
- props IMetricOptions
Returns
Remarks
Default: average over 5 minutes.
MetricLatency(IMetricOptions)
The time between when API Gateway receives a request from a client and when it returns a response to the client.
public virtual Metric MetricLatency(IMetricOptions props = null)
Parameters
- props IMetricOptions
Returns
Remarks
The latency includes the integration latency and other API Gateway overhead.
Default: average over 5 minutes.
MetricServerError(IMetricOptions)
Metric for the number of server-side errors captured in a given period.
public virtual Metric MetricServerError(IMetricOptions props = null)
Parameters
- props IMetricOptions
Returns
Remarks
Default: sum over 5 minutes
UrlForPath(String)
Returns the URL for an HTTP path.
public virtual string UrlForPath(string path = null)
Parameters
- path System.String
Returns
System.String
Remarks
Fails if deploymentStage
is not set either by deploy
or explicitly.