Experimental
@aws-cdk/aws-pipes-targets-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.
ApiGatewayTarget Class
An EventBridge Pipes target that sends messages to an EventBridge API destination.
Example
ts
declare const sourceQueue: sqs.Queue;
const fn = new lambda.Function( this, 'MyFunc', {
handler: 'index.handler',
runtime: lambda.Runtime.NODEJS_LATEST,
code: lambda.Code.fromInline( 'exports.handler = e => {}' ),
});
const restApi = new api.LambdaRestApi( this, 'MyRestAPI', { handler: fn } );
const apiTarget = new targets.ApiGatewayTarget(restApi);
const pipe = new pipes.Pipe(this, 'Pipe', {
source: new SqsSource(sourceQueue),
target: apiTarget,
});
python
# source_queue: sqs.Queue
fn = lambda_.Function(self, "MyFunc",
handler="index.handler",
runtime=lambda_.Runtime.NODEJS_LATEST,
code=lambda_.Code.from_inline("exports.handler = e => {}")
)
rest_api = api.LambdaRestApi(self, "MyRestAPI", handler=fn)
api_target = targets.ApiGatewayTarget(rest_api)
pipe = pipes.Pipe(self, "Pipe",
source=SqsSource(source_queue),
target=api_target
)
java
Queue sourceQueue;
Function fn = Function.Builder.create(this, "MyFunc")
.handler("index.handler")
.runtime(Runtime.NODEJS_LATEST)
.code(Code.fromInline("exports.handler = e => {}"))
.build();
LambdaRestApi restApi = LambdaRestApi.Builder.create(this, "MyRestAPI").handler(fn).build();
ApiGatewayTarget apiTarget = new ApiGatewayTarget(restApi);
Pipe pipe = Pipe.Builder.create(this, "Pipe")
.source(new SqsSource(sourceQueue))
.target(apiTarget)
.build();
csharp
// Install: dotnet add package Amazon.CDK.AWS.Pipes.Targets.Alpha
Queue sourceQueue;
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 apiTarget = new ApiGatewayTarget(restApi);
var pipe = new Pipe(this, "Pipe", new PipeProps {
Source = new SqsSource(sourceQueue),
Target = apiTarget
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdkpipestargetsalpha/v2
var sourceQueue Queue
fn := lambda.NewFunction(this, jsii.String("MyFunc"), &FunctionProps{
Handler: jsii.String("index.handler"),
Runtime: lambda.Runtime_NODEJS_LATEST(),
Code: lambda.Code_FromInline(jsii.String("exports.handler = e => {}")),
})
restApi := api.NewLambdaRestApi(this, jsii.String("MyRestAPI"), &LambdaRestApiProps{
Handler: fn,
})
apiTarget := targets.NewApiGatewayTarget(restApi)
pipe := pipes.NewPipe(this, jsii.String("Pipe"), &PipeProps{
Source: awscdkpipessourcesalpha.NewSqsSource(sourceQueue),
Target: apiTarget,
})
Initializer
ts
new ApiGatewayTarget(restApi: IRestApi, parameters?: ApiGatewayTargetParameters)
python
ApiGatewayTarget(rest_api: IRestApi, parameters: typing.Optional[ApiGatewayTargetParameters] = None)
java
new ApiGatewayTarget(IRestApi restApi, ApiGatewayTargetParameters parameters)
csharp
new ApiGatewayTarget(IRestApi restApi, ApiGatewayTargetParameters? parameters = null)
go
NewApiGatewayTarget(RestApi IRestApi, Parameters ApiGatewayTargetParameters)
Properties
The ARN of the target resource.
Methods
bind(pipe: IPipe): TargetConfigdef bind(self, pipe: IPipe) -> TargetConfigpublic TargetConfig bind(IPipe pipe)public TargetConfig Bind(IPipe pipe)func Bind(Pipe IPipe) TargetConfig#Bind this target to a pipe.