> **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.
# DynamicInput

Dynamic variables that can be used in the input transformation.

Implements: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html)
Obtainable from: DynamicInput.enrichmentArn, DynamicInput.event, DynamicInput.eventIngestionTime, DynamicInput.eventJson, DynamicInput.fromEventPath, DynamicInput.pipeArn, DynamicInput.pipeName, DynamicInput.sourceArn, DynamicInput.targetArn

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

## Example

TypeScript:

```ts
declare const sourceQueue: sqs.Queue;
declare const targetQueue: sqs.Queue;

const targetInputTransformation = pipes.InputTransformation.fromObject({
  staticField: 'static value',
  dynamicField: pipes.DynamicInput.fromEventPath('$.body.payload'),
  pipeVariable: pipes.DynamicInput.pipeName,
});

const pipe = new pipes.Pipe(this, 'Pipe', {
  pipeName: 'MyPipe',
  source: new SqsSource(sourceQueue),
  target: new SqsTarget(targetQueue, {
    inputTransformation: targetInputTransformation,
  }),
});
```

Python:

```python
# source_queue: sqs.Queue
# target_queue: sqs.Queue

target_input_transformation = pipes.InputTransformation.from_object({
    "static_field": "static value",
    "dynamic_field": pipes.DynamicInput.from_event_path("$.body.payload"),
    "pipe_variable": pipes.DynamicInput.pipe_name
})

pipe = pipes.Pipe(self, "Pipe",
    pipe_name="MyPipe",
    source=SqsSource(source_queue),
    target=SqsTarget(target_queue,
        input_transformation=target_input_transformation
    )
)
```

Java:

```java
Queue sourceQueue;
Queue targetQueue;

InputTransformation targetInputTransformation = InputTransformation.fromObject(Map.of(
        "staticField", "static value",
        "dynamicField", DynamicInput.fromEventPath("$.body.payload"),
        "pipeVariable", DynamicInput.getPipeName()));

Pipe pipe = Pipe.Builder.create(this, "Pipe")
        .pipeName("MyPipe")
        .source(new SqsSource(sourceQueue))
        .target(SqsTarget.Builder.create(targetQueue)
                .inputTransformation(targetInputTransformation)
                .build())
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.AWS.Pipes.Alpha
Queue sourceQueue;
Queue targetQueue;

var targetInputTransformation = InputTransformation.FromObject(new Dictionary<string, object> {
    { "staticField", "static value" },
    { "dynamicField", DynamicInput.FromEventPath("$.body.payload") },
    { "pipeVariable", DynamicInput.PipeName }
});

var pipe = new Pipe(this, "Pipe", new PipeProps {
    PipeName = "MyPipe",
    Source = new SqsSource(sourceQueue),
    Target = new SqsTarget(targetQueue, new SqsTargetParameters {
        InputTransformation = targetInputTransformation
    })
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdkpipesalpha/v2
var sourceQueue Queue
var targetQueue Queue

targetInputTransformation := pipes.inputTransformation_FromObject(map[string]interface{}{
	"staticField": jsii.String("static value"),
	"dynamicField": pipes.DynamicInput_fromEventPath(jsii.String("$.body.payload")),
	"pipeVariable": pipes.DynamicInput_pipeName(),
})

pipe := pipes.NewPipe(this, jsii.String("Pipe"), &PipeProps{
	PipeName: jsii.String("MyPipe"),
	Source: awscdkpipessourcesalpha.NewSqsSource(sourceQueue),
	Target: awscdkpipestargetsalpha.NewSqsTarget(targetQueue, &SqsTargetParameters{
		InputTransformation: targetInputTransformation,
	}),
})
```

## Properties

- `creationStack`: string[] — The creation stack of this resolvable which will be appended to errors thrown during resolution.

  This may return an array with a single informational element indicating how
  to get this property populated, if it was skipped for performance reasons.

- `displayHint`: string — Human readable display hint about the event pattern.

- `enrichmentArn`: [DynamicInput](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-pipes-alpha.DynamicInput.html) (static) — The ARN of the enrichment of the pipe.

- `event`: [DynamicInput](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-pipes-alpha.DynamicInput.html) (static) — The event as received by the input transformer.

- `eventIngestionTime`: [DynamicInput](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-pipes-alpha.DynamicInput.html) (static) — The time at which the event was received by the input transformer.

  This is an ISO 8601 timestamp. This time is different for the enrichment input transformer and the target input transformer, depending on when the enrichment completed processing the event.

- `eventJson`: [DynamicInput](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-pipes-alpha.DynamicInput.html) (static) — The same as aws.pipes.event, but the variable only has a value if the original payload, either from the source or returned by the enrichment, is JSON. If the pipe has an encoded field, such as the Amazon SQS body field or the Kinesis data, those fields are decoded and turned into valid JSON. Because it isn't escaped, the variable can only be used as a value for a JSON field. For more information, see Implicit body data parsing.

- `pipeArn`: [DynamicInput](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-pipes-alpha.DynamicInput.html) (static) — The Amazon Resource Name (ARN) of the pipe.

- `pipeName`: [DynamicInput](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-pipes-alpha.DynamicInput.html) (static) — The name of the pipe.

- `sourceArn`: [DynamicInput](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-pipes-alpha.DynamicInput.html) (static) — The ARN of the event source of the pipe.

- `targetArn`: [DynamicInput](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-pipes-alpha.DynamicInput.html) (static) — The ARN of the target of the pipe.

## Methods

- `fromEventPath(path: string): DynamicInput // chainable` (static) — Value from the event payload at jsonPath.

- `resolve(_context: IResolveContext): any` — Produce the Token's value at resolution time.

- `toJSON(): string` — Return a JSON representation of a dynamic input.

- `toString(): string` — Return a string representation of a dynamic input.
