> **Experimental**
>
> `@aws-cdk/aws-pipes-alpha` is an [**experimental**](https://docs.aws.amazon.com/cdk/api/stability.html) (alpha) package: its API may change in any release, without a major version bump.
# InputTransformation

Transform or replace the input event payload.

Implements: [IInputTransformation](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-pipes-alpha.IInputTransformation.html)
Obtainable from: InputTransformation.fromEventPath, InputTransformation.fromObject, InputTransformation.fromText

- Stability: [Experimental](https://docs.aws.amazon.com/cdk/api/stability.html)
- Source: [`lib/inputTransformation.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/@aws-cdk/aws-pipes-alpha/lib/inputTransformation.ts#L36)

## Example

TypeScript:

```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:

```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:

```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();
```

C# / .NET:

```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
});
```

Golang:

```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): InputTransformationConfig` — Bind the input transformation to the pipe and returns the inputTemplate string.

- `fromEventPath(jsonPathExpression: string): InputTransformation // chainable` (static) — Creates an InputTransformation from a jsonPath expression of the input event.

- `fromObject(inputTemplate: { [key: string]: any }): InputTransformation // chainable` (static) — Creates an InputTransformation from a pipe variable.

- `fromText(inputTemplate: string): InputTransformation // chainable` (static) — Creates an InputTransformation from a string.
