Class ApiGateway
Use an API Gateway REST APIs as a target for Amazon EventBridge rules.
Inheritance
System.Object
ApiGateway
Implements
Namespace: Amazon.CDK.AWS.Events.Targets
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class ApiGateway : DeputyBase, IRuleTarget
Syntax (vb)
Public Class ApiGateway
Inherits DeputyBase
Implements IRuleTarget
Remarks
ExampleMetadata: infused
Examples
using Amazon.CDK.AWS.APIGateway;
using Amazon.CDK.AWS.Lambda;
var rule = new Rule(this, "Rule", new RuleProps {
Schedule = Schedule.Rate(Duration.Minutes(1))
});
var fn = new Function(this, "MyFunc", new FunctionProps {
Handler = "index.handler",
Runtime = Runtime.NODEJS_LATEST,
Code = Code.FromInline("exports.handler = e => {}")
});
var restApi = new LambdaRestApi(this, "MyRestAPI", new LambdaRestApiProps { Handler = fn });
var dlq = new Queue(this, "DeadLetterQueue");
rule.AddTarget(
new ApiGateway(restApi, new ApiGatewayProps {
Path = "/*/test",
Method = "GET",
Stage = "prod",
PathParameterValues = new [] { "path-value" },
HeaderParameters = new Dictionary<string, string> {
{ "Header1", "header1" }
},
QueryStringParameters = new Dictionary<string, string> {
{ "QueryParam1", "query-param-1" }
},
DeadLetterQueue = dlq
}));
Synopsis
Constructors
ApiGateway(IRestApi, IApiGatewayProps) | |
ApiGateway(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
ApiGateway(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
Properties
IRestApi | Returns the target IRestApi. |
RestApi |
Methods
Bind(IRule, String) | Returns a RuleTarget that can be used to trigger this API Gateway REST APIs as a result from an EventBridge event. |
Constructors
ApiGateway(IRestApi, IApiGatewayProps)
public ApiGateway(IRestApi restApi, IApiGatewayProps props = null)
Parameters
- restApi IRestApi
- IRestApi implementation to use as event target.
- props IApiGatewayProps
- Properties to configure the APIGateway target.
ApiGateway(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected ApiGateway(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
ApiGateway(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected ApiGateway(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
Properties
IRestApi
RestApi
Methods
Bind(IRule, String)
Returns a RuleTarget that can be used to trigger this API Gateway REST APIs as a result from an EventBridge event.
public virtual IRuleTargetConfig Bind(IRule rule, string id = null)
Parameters
- rule IRule
- id System.String
Returns