Skip to content

Commit beeb6fd

Browse files
committed
Add lambda_role to history.builder
Signed-off-by: Yves Bastide <yves@botify.com>
1 parent 6984b56 commit beeb6fd

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

swf/models/history/builder.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class History(swf.models.History):
4343
Helper class to build a history to simulate the execution of a workflow.
4444
4545
"""
46-
def __init__(self, workflow, input=None, tag_list=None):
46+
def __init__(self, workflow, input=None, tag_list=None, lambda_role=None):
4747
"""
4848
Bootstrap a history with the first events added by SWF.
4949
@@ -53,6 +53,8 @@ def __init__(self, workflow, input=None, tag_list=None):
5353
:type input: dict
5454
:param tag_list: string of tags (beware not a list)
5555
:type tag_list: str
56+
:param lambda_role: lambda role
57+
:type lambda_role: Optional[str]
5658
5759
"""
5860
self._workflow = workflow
@@ -72,6 +74,7 @@ def __init__(self, workflow, input=None, tag_list=None):
7274
"executionStartToCloseTimeout":
7375
workflow.execution_timeout,
7476
"input": json_dumps(input if input else {}),
77+
"lambdaRole": lambda_role,
7578
"workflowType": {
7679
"name": workflow.name,
7780
"version": workflow.version
@@ -370,7 +373,9 @@ def add_child_workflow_start_initiated(self,
370373
input=None,
371374
control=None,
372375
tag_list=None,
373-
task_start_to_close_timeout=0):
376+
task_start_to_close_timeout=0,
377+
lambda_role=None,
378+
):
374379
if control is None:
375380
control = {}
376381

@@ -384,6 +389,7 @@ def add_child_workflow_start_initiated(self,
384389
'decisionTaskCompletedEventId': 76,
385390
'executionStartToCloseTimeout': '432000',
386391
'input': json_dumps(input) if input is not None else '{}',
392+
'lambdaRole': lambda_role,
387393
'tagList': tag_list,
388394
'taskList': {'name': task_list},
389395
'taskStartToCloseTimeout': task_start_to_close_timeout,
@@ -588,13 +594,17 @@ def add_child_workflow(self,
588594
task_list=None,
589595
input=None,
590596
result=None,
591-
control=None):
597+
control=None,
598+
lambda_role=None,
599+
):
592600
self.add_child_workflow_start_initiated(
593601
workflow,
594602
workflow_id=workflow_id,
595603
task_list=task_list,
596604
input=input,
597-
control=control)
605+
control=control,
606+
lambda_role=lambda_role,
607+
)
598608

599609
if last_state not in CHILD_WORKFLOW_STATES:
600610
raise ValueError('last_state "{}" not supported for '

0 commit comments

Comments
 (0)