-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
state machine : Dynamic passing of bucket and key to distributed map #29409
Comments
Thank you for the feature request. We welcome and appreciate your PR for this. |
I faced the same issue and still wanted to use the I came up with a dirty, hacky workaround and extended the export interface ExtendedS3CsvItemReaderProps extends sfn.S3CsvItemReaderProps {
readonly "key.$"?: string;
}
class ExtendedS3CsvItemReader extends sfn.S3CsvItemReader {
readonly dynamicKey: string | undefined;
constructor(props: ExtendedS3CsvItemReaderProps) {
super(props);
this.dynamicKey = props["key.$"];
}
public render() {
const rendered = super.render();
if (this.dynamicKey) {
// ignores the provided `key` and uses `key.$` instead
rendered.Parameters = {
Bucket: rendered.Parameters.Bucket,
"Key.$": this.dynamicKey,
};
}
return rendered;
}
} You can use it just like the existing I may dig deeper and provide a PR (with a polished implementation of course 😜). |
Assigned this issue to @ChakshuGupta13, I will try to review your PR by end of this month. If I don't, feel free to ping me directly. |
FYI: We can still currently utilise dynamic parameters except
This code snippet produces following cdk.out template:
|
Comments on closed issues and PRs are hard for our team to see. |
1 similar comment
Comments on closed issues and PRs are hard for our team to see. |
Describe the feature
Currently there is no means of passing a bucket and key dynamically to a distributed Map state using CDK. This functionality is available in the states language using JSONPath along the lines of
"ItemReader": {
"Resource": "arn:aws:states:::s3:getObject",
"ReaderConfig": {
"InputType": "JSON"
},
"Parameters": {
"Bucket.$": "$.Payload.bucket",
"Key.$": "$.Payload.key"
}
}
Use Case
I want to define my state machine using CDK rather than the states language
Proposed Solution
Create an IItemReader that can take a string in place of a bucket.
Other Information
No response
Acknowledgements
CDK version used
2.128.0
Environment details (OS name and version, etc.)
MacOs Sonoma
The text was updated successfully, but these errors were encountered: