From 1ae4bcdc13838fa07d722632e6be196b1c6ebc88 Mon Sep 17 00:00:00 2001 From: Raphael Manke Date: Sat, 1 Apr 2023 10:10:30 +0200 Subject: [PATCH] feat(enrichment): Add StepFunction enrichment --- src/enrichments/StepFunctionEnrichment.ts | 27 +++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/enrichments/StepFunctionEnrichment.ts 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