Skip to content
v2.277.0

Experimental

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

InputTransformation Class ​

Transform or replace the input event payload.

Example ​

ts
declare const sourceQueue: sqs.Queue;
declare const targetTopic: sns.Topic;

const pipeTarget = new targets.SnsTarget(targetTopic,
    {
      inputTransformation: pipes.InputTransformation.fromObject(
        {
            "SomeKey": pipes.DynamicInput.fromEventPath('$.body')
        })
    }
);

const pipe = new pipes.Pipe(this, 'Pipe', {
    source: new SqsSource(sourceQueue),
    target: pipeTarget
});
python
# source_queue: sqs.Queue
# target_topic: sns.Topic


pipe_target = targets.SnsTarget(target_topic,
    input_transformation=pipes.InputTransformation.from_object({
        "SomeKey": pipes.DynamicInput.from_event_path("$.body")
    })
)

pipe = pipes.Pipe(self, "Pipe",
    source=SqsSource(source_queue),
    target=pipe_target
)
java
Queue sourceQueue;
Topic targetTopic;


SnsTarget pipeTarget = SnsTarget.Builder.create(targetTopic)
        .inputTransformation(InputTransformation.fromObject(Map.of(
                "SomeKey", DynamicInput.fromEventPath("$.body"))))
        .build();

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


var pipeTarget = new SnsTarget(targetTopic, new SnsTargetParameters {
    InputTransformation = InputTransformation.FromObject(new Dictionary<string, object> {
        { "SomeKey", DynamicInput.FromEventPath("$.body") }
    })
});

var pipe = new Pipe(this, "Pipe", new PipeProps {
    Source = new SqsSource(sourceQueue),
    Target = pipeTarget
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdkpipesalpha/v2
var sourceQueue Queue
var targetTopic Topic


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

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

Methods ​

bind(pipe: IPipe): InputTransformationConfigdef bind(self, pipe: IPipe) -> InputTransformationConfigpublic InputTransformationConfig bind(IPipe pipe)public InputTransformationConfig Bind(IPipe pipe)func Bind(Pipe IPipe) InputTransformationConfig#
Bind the input transformation to the pipe and returns the inputTemplate string.
fromEventPath(jsonPathExpression: string): InputTransformation // chainable@staticmethod def from_event_path(json_path_expression: str) -> InputTransformationpublic static InputTransformation fromEventPath(String jsonPathExpression)public static InputTransformation FromEventPath(string jsonPathExpression)func FromEventPath(JsonPathExpression *string) InputTransformationstatic#
Creates an InputTransformation from a jsonPath expression of the input event.
fromObject(inputTemplate: { [key: string]: any }): InputTransformation // chainable@staticmethod def from_object(input_template: typing.Mapping[str, Any]) -> InputTransformationpublic static InputTransformation fromObject(Map<String, Object> inputTemplate)public static InputTransformation FromObject(IDictionary<string, object> inputTemplate)func FromObject(InputTemplate *map[string]interface{}) InputTransformationstatic#
Creates an InputTransformation from a pipe variable.
fromText(inputTemplate: string): InputTransformation // chainable@staticmethod def from_text(input_template: str) -> InputTransformationpublic static InputTransformation fromText(String inputTemplate)public static InputTransformation FromText(string inputTemplate)func FromText(InputTemplate *string) InputTransformationstatic#
Creates an InputTransformation from a string.