diff --git a/src/enrichments/StepFunctionEnrichment.ts b/src/enrichments/StepFunctionEnrichment.ts new file mode 100644 index 0000000..7983b3b --- /dev/null +++ b/src/enrichments/StepFunctionEnrichment.ts @@ -0,0 +1,27 @@ +import { IRole } from 'aws-cdk-lib/aws-iam'; +import { CfnPipe } from 'aws-cdk-lib/aws-pipes'; +import { IStateMachine } from 'aws-cdk-lib/aws-stepfunctions'; +import { IPipeEnrichment } from '../PipeEnrichment'; +import { IInputTransformation } from '../PipeInputTransformation'; + +export interface IStepFunctionEnrichmentProps { + inputTransformation?: IInputTransformation; +} + +export class StepFunctionEnrichment implements IPipeEnrichment { + private stepFunction: IStateMachine; + public readonly enrichmentArn: string; + public readonly enrichmentParameters: CfnPipe.PipeEnrichmentParametersProperty; + + constructor(stepFunction: IStateMachine, props?: IStepFunctionEnrichmentProps) { + this.stepFunction = stepFunction; + this.enrichmentArn = stepFunction.stateMachineArn; + this.enrichmentParameters = { + inputTemplate: props?.inputTransformation?.inputTemplate, + }; + } + + grantInvoke(grantee: IRole): void { + this.stepFunction.grantExecution(grantee); + } +} \ No newline at end of file