Class HttpApi
Create a new API Gateway HTTP API endpoint.
Inherited Members
Namespace: Amazon.CDK.AWS.Apigatewayv2
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class HttpApi : Resource, IHttpApi, IApi, IResource
Syntax (vb)
Public Class HttpApi
Inherits Resource
Implements IHttpApi, IApi, IResource
Remarks
Resource: AWS::ApiGatewayV2::Api
ExampleMetadata: infused
Examples
using Amazon.CDK.AwsApigatewayv2Integrations;
Function booksDefaultFn;
var booksIntegration = new HttpLambdaIntegration("BooksIntegration", booksDefaultFn);
var httpApi = new HttpApi(this, "HttpApi");
httpApi.AddRoutes(new AddRoutesOptions {
Path = "/books",
Methods = new [] { HttpMethod.GET },
Integration = booksIntegration
});
Synopsis
Constructors
HttpApi(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
HttpApi(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
HttpApi(Construct, String, IHttpApiProps) |
Properties
ApiEndpoint | Get the default endpoint for this API. |
ApiId | The identifier of this API Gateway API. |
DefaultAuthorizationScopes | Default OIDC scopes attached to all routes in the gateway, unless explicitly configured on the route. |
DefaultAuthorizer | Default Authorizer applied to all routes in the gateway. |
DefaultStage | The default stage of this API. |
DisableExecuteApiEndpoint | Specifies whether clients can invoke this HTTP API by using the default execute-api endpoint. |
HttpApiId | The identifier of the HTTP API. |
HttpApiName | A human friendly name for this HTTP API. |
Url | Get the URL to the default stage of this API. |
Methods
AddRoutes(IAddRoutesOptions) | Add multiple routes that uses the same configuration. |
AddStage(String, IHttpStageOptions) | Add a new stage. |
AddVpcLink(IVpcLinkProps) | Add a new VpcLink. |
ArnForExecuteApi(String, String, String) | Get the "execute-api" ARN. |
FromHttpApiAttributes(Construct, String, IHttpApiAttributes) | Import an existing HTTP API into this CDK app. |
Metric(String, IMetricOptions) | Return the given named metric for this Api Gateway. |
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. |
MetricDataProcessed(IMetricOptions) | Metric for the amount of data processed in bytes. |
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. |
Constructors
HttpApi(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected HttpApi(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
HttpApi(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected HttpApi(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
HttpApi(Construct, String, IHttpApiProps)
public HttpApi(Construct scope, string id, IHttpApiProps props = null)
Parameters
- scope Constructs.Construct
- id System.String
- props IHttpApiProps
Properties
ApiEndpoint
Get the default endpoint for this API.
public virtual string ApiEndpoint { get; }
Property Value
System.String
ApiId
The identifier of this API Gateway API.
public virtual string ApiId { get; }
Property Value
System.String
DefaultAuthorizationScopes
Default OIDC scopes attached to all routes in the gateway, unless explicitly configured on the route.
public virtual string[] DefaultAuthorizationScopes { get; }
Property Value
System.String[]
Remarks
The scopes are used with a COGNITO_USER_POOLS authorizer to authorize the method invocation.
DefaultAuthorizer
Default Authorizer applied to all routes in the gateway.
public virtual IHttpRouteAuthorizer DefaultAuthorizer { get; }
Property Value
DefaultStage
The default stage of this API.
public virtual IHttpStage DefaultStage { get; }
Property Value
DisableExecuteApiEndpoint
Specifies whether clients can invoke this HTTP API by using the default execute-api endpoint.
public virtual Nullable<bool> DisableExecuteApiEndpoint { get; }
Property Value
System.Nullable<System.Boolean>
HttpApiId
The identifier of the HTTP API.
public virtual string HttpApiId { get; }
Property Value
System.String
Remarks
HttpApiName
A human friendly name for this HTTP API.
public virtual string HttpApiName { get; }
Property Value
System.String
Remarks
Note that this is different from httpApiId
.
Url
Get the URL to the default stage of this API.
public virtual string Url { get; }
Property Value
System.String
Remarks
Returns undefined
if createDefaultStage
is unset.
Methods
AddRoutes(IAddRoutesOptions)
Add multiple routes that uses the same configuration.
public virtual HttpRoute[] AddRoutes(IAddRoutesOptions options)
Parameters
- options IAddRoutesOptions
Returns
Remarks
The routes all go to the same path, but for different methods.
AddStage(String, IHttpStageOptions)
Add a new stage.
public virtual HttpStage AddStage(string id, IHttpStageOptions options)
Parameters
- id System.String
- options IHttpStageOptions
Returns
AddVpcLink(IVpcLinkProps)
Add a new VpcLink.
public virtual VpcLink AddVpcLink(IVpcLinkProps options)
Parameters
- options IVpcLinkProps
Returns
ArnForExecuteApi(String, String, String)
Get 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
Remarks
When 'ANY' is passed to the method, an ARN with the method set to '*' is obtained.
FromHttpApiAttributes(Construct, String, IHttpApiAttributes)
Import an existing HTTP API into this CDK app.
public static IHttpApi FromHttpApiAttributes(Construct scope, string id, IHttpApiAttributes attrs)
Parameters
- scope Constructs.Construct
- id System.String
- attrs IHttpApiAttributes
Returns
Metric(String, IMetricOptions)
Return the given named metric for this Api Gateway.
public virtual Metric Metric(string metricName, IMetricOptions props = null)
Parameters
- metricName System.String
- props IMetricOptions
Returns
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
MetricCount(IMetricOptions)
Metric for the total number API requests in a given period.
public virtual Metric MetricCount(IMetricOptions props = null)
Parameters
- props IMetricOptions
Returns
MetricDataProcessed(IMetricOptions)
Metric for the amount of data processed in bytes.
public virtual Metric MetricDataProcessed(IMetricOptions props = null)
Parameters
- props IMetricOptions
Returns
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
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.
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