All I am trying to do is to create a reusable ambda component where I can pass parameters to the class so that the Lambda can do different things, based on input param.
I am using CDK in python to deploy the stack. I would like to create a parallel stepfunction, where I can pass the same lambda using different param/payload so they can be branches.
I am running the following code:
from aws_cdk import (
# Duration,
Stack,
# aws_sqs as sqs,
aws_stepfunctions as _stepfunctions,
aws_stepfunctions_tasks as _stepfunctions_tasks,
aws_lambda as _lambda,
)
from constructs import Construct
class LambdaJob(_stepfunctions.StateMachineFragment):
def __init__(self, parent, id, *, jobTypeParam):
super().__init__(parent, id)
existingFunc = _lambda.Function.from_function_arn(self, "ExistingLambdaFunc", function_arn="arn:aws:lambda:us-east-1:95842$$$$$:function:dummyFunction")
lambda_invoked = _stepfunctions_tasks.LambdaInvoke(self, "someID", lambda_function=existingFunc)
wait_10_seconds = _stepfunctions.Wait(self, "Wait for 10 seconds",
time=_stepfunctions.WaitTime.duration(Duration.seconds(10))
)
self.start_state = wait_10_seconds
class StepfunctionsClasStack(Stack):
def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
super().__init__(scope, construct_id, **kwargs)
test_lambda_1 = LambdaJob(self, "Quick")
#state_machine = _stepfunctions.StateMachine(self, "TestStateMachine",
# definition=LambdaJob(self, "Quick"),
# # role=marketo_role
# )
However i keep getting the following error:
TypeError: Can't instantiate abstract class LambdaJob with abstract methods end_states, start_state
Any thoughts on what I am doing wrong ? Thanks