Skip to content
v2.274.0

Experimental

@aws-cdk/aws-pipes-sources-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.

SqsSource Class ​

A source that reads from an SQS queue.

Example ​

ts
declare const sourceQueue: sqs.Queue;
declare const dest: events.ApiDestination;

const apiTarget = new targets.ApiDestinationTarget(dest, {
  inputTransformation: pipes.InputTransformation.fromObject({ body: "👀" }),
});

const pipe = new pipes.Pipe(this, 'Pipe', {
    source: new SqsSource(sourceQueue),
    target: apiTarget,
});
python
# source_queue: sqs.Queue
# dest: events.ApiDestination


api_target = targets.ApiDestinationTarget(dest,
    input_transformation=pipes.InputTransformation.from_object({"body": "👀"})
)

pipe = pipes.Pipe(self, "Pipe",
    source=SqsSource(source_queue),
    target=api_target
)
java
Queue sourceQueue;
ApiDestination dest;


ApiDestinationTarget apiTarget = ApiDestinationTarget.Builder.create(dest)
        .inputTransformation(InputTransformation.fromObject(Map.of("body", "👀")))
        .build();

Pipe pipe = Pipe.Builder.create(this, "Pipe")
        .source(new SqsSource(sourceQueue))
        .target(apiTarget)
        .build();
csharp
// Install: dotnet add package Amazon.CDK.AWS.Pipes.Sources.Alpha
Queue sourceQueue;
ApiDestination dest;


var apiTarget = new ApiDestinationTarget(dest, new ApiDestinationTargetParameters {
    InputTransformation = InputTransformation.FromObject(new Dictionary<string, object> { { "body", "👀" } })
});

var pipe = new Pipe(this, "Pipe", new PipeProps {
    Source = new SqsSource(sourceQueue),
    Target = apiTarget
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdkpipessourcesalpha/v2
var sourceQueue Queue
var dest ApiDestination


apiTarget := targets.NewApiDestinationTarget(dest, &ApiDestinationTargetParameters{
	InputTransformation: pipes.InputTransformation_FromObject(map[string]interface{}{
		"body": jsii.String("👀"),
	}),
})

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

Initializer ​

ts
new SqsSource(queue: IQueue, parameters?: SqsSourceParameters)
python
SqsSource(queue: IQueue, parameters: typing.Optional[SqsSourceParameters] = None)
java
new SqsSource(IQueue queue, SqsSourceParameters parameters)
csharp
new SqsSource(IQueue queue, SqsSourceParameters? parameters = null)
go
NewSqsSource(Queue IQueue, Parameters SqsSourceParameters)

Properties ​

sourceArnstringsource_arnstrsourceArnStringSourceArnstringSourceArn*stringrequired#
The ARN of the source resource.

Methods ​

bind(_pipe: IPipe): SourceConfigdef bind(self, _pipe: IPipe) -> SourceConfigpublic SourceConfig bind(IPipe _pipe)public SourceConfig Bind(IPipe _pipe)func Bind(_pipe IPipe) SourceConfig#
Bind the source to a pipe.
grantRead(grantee: IRole): voiddef grant_read(self, grantee: IRole) -> Nonepublic void grantRead(IRole grantee)public void GrantRead(IRole grantee)func GrantRead(Grantee IRole)#
Grant the pipe role read access to the source.