awscdkpipestargetsalpha

package module
v2.142.1-alpha.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 17, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

README

Amazon EventBridge Pipes Targets Construct Library

---

The APIs of higher level constructs in this module are experimental and under active development. They are subject to non-backward compatible changes or removal in any future version. These are not subject to the Semantic Versioning model and breaking changes will be announced in the release notes. This means that while you may use them, you may need to update your source code when upgrading to a newer version of this package.


EventBridge Pipes Targets let you create a target for a EventBridge Pipe.

For more details see the service documentation:

Documentation

Targets

Pipe targets are the end point of a EventBridge Pipe.

The following targets are supported:

  1. targets.SqsTarget: Send event source to a Queue
  2. targets.SfnStateMachine: Invoke a State Machine from an event source
Amazon SQS

A SQS message queue can be used as a target for a pipe. Messages will be pushed to the queue.

var sourceQueue queue
var targetQueue queue


pipeTarget := targets.NewSqsTarget(targetQueue)

pipe := pipes.NewPipe(this, jsii.String("Pipe"), &PipeProps{
	Source: NewSomeSource(sourceQueue),
	Target: pipeTarget,
})

The target input can be transformed:

var sourceQueue queue
var targetQueue queue


pipeTarget := targets.NewSqsTarget(targetQueue, &SqsTargetParameters{
	InputTransformation: pipes.InputTransformation_FromObject(map[string]interface{}{
		"SomeKey": pipes.DynamicInput_fromEventPath(jsii.String("$.body")),
	}),
})

pipe := pipes.NewPipe(this, jsii.String("Pipe"), &PipeProps{
	Source: NewSomeSource(sourceQueue),
	Target: pipeTarget,
})
AWS Step Functions State Machine

A State Machine can be used as a target for a pipe. The State Machine will be invoked with the (enriched/filtered) source payload.

var sourceQueue queue
var targetStateMachine iStateMachine


pipeTarget := targets.NewSfnStateMachine(targetStateMachine, &SfnStateMachineParameters{
})

pipe := pipes.NewPipe(this, jsii.String("Pipe"), &PipeProps{
	Source: NewSomeSource(sourceQueue),
	Target: pipeTarget,
})

Specifying the Invocation Type when the target State Machine is invoked:

var sourceQueue queue
var targetStateMachine iStateMachine


pipeTarget := targets.NewSfnStateMachine(targetStateMachine, &SfnStateMachineParameters{
	InvocationType: targets.StateMachineInvocationType_FIRE_AND_FORGET,
})

pipe := pipes.NewPipe(this, jsii.String("Pipe"), &PipeProps{
	Source: NewSomeSource(sourceQueue),
	Target: pipeTarget,
})

The input to the target State Machine can be transformed:

var sourceQueue queue
var targetStateMachine iStateMachine


pipeTarget := targets.NewSfnStateMachine(targetStateMachine, &SfnStateMachineParameters{
	InputTransformation: pipes.InputTransformation_FromObject(map[string]interface{}{
		"body": jsii.String("<$.body>"),
	}),
	InvocationType: targets.StateMachineInvocationType_FIRE_AND_FORGET,
})

pipe := pipes.NewPipe(this, jsii.String("Pipe"), &PipeProps{
	Source: NewSomeSource(sourceQueue),
	Target: pipeTarget,
})

Documentation

Overview

The CDK Construct Library for Amazon EventBridge Pipes Targets

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSfnStateMachine_Override

func NewSfnStateMachine_Override(s SfnStateMachine, stateMachine awsstepfunctions.IStateMachine, parameters *SfnStateMachineParameters)

Experimental.

func NewSqsTarget_Override

func NewSqsTarget_Override(s SqsTarget, queue awssqs.IQueue, parameters *SqsTargetParameters)

Experimental.

Types

type SfnStateMachine

type SfnStateMachine interface {
	awscdkpipesalpha.ITarget
	// The ARN of the target resource.
	// Experimental.
	TargetArn() *string
	// Bind this target to a pipe.
	// Experimental.
	Bind(pipe awscdkpipesalpha.IPipe) *awscdkpipesalpha.TargetConfig
	// Grant the pipe role to push to the target.
	// Experimental.
	GrantPush(grantee awsiam.IRole)
}

An EventBridge Pipes target that sends messages to an AWS Step Functions State Machine.

Example:

var sourceQueue queue
var targetStateMachine iStateMachine

pipeTarget := targets.NewSfnStateMachine(targetStateMachine, &SfnStateMachineParameters{
	InvocationType: targets.StateMachineInvocationType_FIRE_AND_FORGET,
})

pipe := pipes.NewPipe(this, jsii.String("Pipe"), &PipeProps{
	Source: NewSomeSource(sourceQueue),
	Target: pipeTarget,
})

Experimental.

func NewSfnStateMachine

func NewSfnStateMachine(stateMachine awsstepfunctions.IStateMachine, parameters *SfnStateMachineParameters) SfnStateMachine

Experimental.

type SfnStateMachineParameters

type SfnStateMachineParameters struct {
	// The input transformation to apply to the message before sending it to the target.
	// See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-pipes-pipe-pipetargetparameters.html#cfn-pipes-pipe-pipetargetparameters-inputtemplate
	//
	// Default: none.
	//
	// Experimental.
	InputTransformation awscdkpipesalpha.IInputTransformation `field:"optional" json:"inputTransformation" yaml:"inputTransformation"`
	// Specify whether to invoke the State Machine synchronously (`REQUEST_RESPONSE`) or asynchronously (`FIRE_AND_FORGET`).
	// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-pipes-pipe-pipetargetsqsqueueparameters.html#cfn-pipes-pipe-pipetargetsqsqueueparameters-messagededuplicationid
	//
	// Default: StateMachineInvocationType.FIRE_AND_FORGET
	//
	// Experimental.
	InvocationType StateMachineInvocationType `field:"optional" json:"invocationType" yaml:"invocationType"`
}

Parameters for the SfnStateMachine target.

Example:

var sourceQueue queue
var targetStateMachine iStateMachine

pipeTarget := targets.NewSfnStateMachine(targetStateMachine, &SfnStateMachineParameters{
	InvocationType: targets.StateMachineInvocationType_FIRE_AND_FORGET,
})

pipe := pipes.NewPipe(this, jsii.String("Pipe"), &PipeProps{
	Source: NewSomeSource(sourceQueue),
	Target: pipeTarget,
})

Experimental.

type SqsTarget

type SqsTarget interface {
	awscdkpipesalpha.ITarget
	// The ARN of the target resource.
	// Experimental.
	TargetArn() *string
	// Bind this target to a pipe.
	// Experimental.
	Bind(pipe awscdkpipesalpha.IPipe) *awscdkpipesalpha.TargetConfig
	// Grant the pipe role to push to the target.
	// Experimental.
	GrantPush(grantee awsiam.IRole)
}

A EventBridge Pipes target that sends messages to an SQS queue.

Example:

var sourceQueue queue
var targetQueue queue

pipeTarget := targets.NewSqsTarget(targetQueue)

pipe := pipes.NewPipe(this, jsii.String("Pipe"), &PipeProps{
	Source: NewSomeSource(sourceQueue),
	Target: pipeTarget,
})

Experimental.

func NewSqsTarget

func NewSqsTarget(queue awssqs.IQueue, parameters *SqsTargetParameters) SqsTarget

Experimental.

type SqsTargetParameters

type SqsTargetParameters struct {
	// The input transformation to apply to the message before sending it to the target.
	// See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-pipes-pipe-pipetargetparameters.html#cfn-pipes-pipe-pipetargetparameters-inputtemplate
	//
	// Default: none.
	//
	// Experimental.
	InputTransformation awscdkpipesalpha.IInputTransformation `field:"optional" json:"inputTransformation" yaml:"inputTransformation"`
	// This parameter applies only to FIFO (first-in-first-out) queues.
	//
	// The token used for deduplication of sent messages.
	// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-pipes-pipe-pipetargetsqsqueueparameters.html#cfn-pipes-pipe-pipetargetsqsqueueparameters-messagededuplicationid
	//
	// Default: none.
	//
	// Experimental.
	MessageDeduplicationId *string `field:"optional" json:"messageDeduplicationId" yaml:"messageDeduplicationId"`
	// The FIFO message group ID to use as the target.
	// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-pipes-pipe-pipetargetsqsqueueparameters.html#cfn-pipes-pipe-pipetargetsqsqueueparameters-messagegroupid
	//
	// Default: none.
	//
	// Experimental.
	MessageGroupId *string `field:"optional" json:"messageGroupId" yaml:"messageGroupId"`
}

SQS target properties.

Example:

var sourceQueue queue
var targetQueue queue

pipeTarget := targets.NewSqsTarget(targetQueue, &SqsTargetParameters{
	InputTransformation: pipes.InputTransformation_FromObject(map[string]interface{}{
		"SomeKey": pipes.DynamicInput_fromEventPath(jsii.String("$.body")),
	}),
})

pipe := pipes.NewPipe(this, jsii.String("Pipe"), &PipeProps{
	Source: NewSomeSource(sourceQueue),
	Target: pipeTarget,
})

Experimental.

type StateMachineInvocationType

type StateMachineInvocationType string

InvocationType for invoking the State Machine.

Example:

var sourceQueue queue
var targetStateMachine iStateMachine

pipeTarget := targets.NewSfnStateMachine(targetStateMachine, &SfnStateMachineParameters{
	InvocationType: targets.StateMachineInvocationType_FIRE_AND_FORGET,
})

pipe := pipes.NewPipe(this, jsii.String("Pipe"), &PipeProps{
	Source: NewSomeSource(sourceQueue),
	Target: pipeTarget,
})

See: https://docs.aws.amazon.com/eventbridge/latest/pipes-reference/API_PipeTargetStateMachineParameters.html

Experimental.

const (
	// Invoke StepFunction asynchronously (`StartExecution`).
	//
	// See https://docs.aws.amazon.com/step-functions/latest/apireference/API_StartExecution.html for more details.
	// Experimental.
	StateMachineInvocationType_FIRE_AND_FORGET StateMachineInvocationType = "FIRE_AND_FORGET"
	// Invoke StepFunction synchronously (`StartSyncExecution`) and wait for the execution to complete.
	//
	// See https://docs.aws.amazon.com/step-functions/latest/apireference/API_StartSyncExecution.html for more details.
	// Experimental.
	StateMachineInvocationType_REQUEST_RESPONSE StateMachineInvocationType = "REQUEST_RESPONSE"
)

Directories

Path Synopsis
Package jsii contains the functionaility needed for jsii packages to initialize their dependencies and themselves.
Package jsii contains the functionaility needed for jsii packages to initialize their dependencies and themselves.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL