Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(aws-events-targets): fix StepFunctions doc & tests role usage #19178

Merged
merged 9 commits into from
Mar 8, 2022
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-events-targets/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,13 @@ const role = new iam.Role(this, 'Role', {
assumedBy: new iam.ServicePrincipal('events.amazonaws.com'),
});
const stateMachine = new sfn.StateMachine(this, 'SM', {
definition: new sfn.Wait(this, 'Hello', { time: sfn.WaitTime.duration(cdk.Duration.seconds(10)) }),
role,
definition: new sfn.Wait(this, 'Hello', { time: sfn.WaitTime.duration(cdk.Duration.seconds(10)) })
});

rule.addTarget(new targets.SfnStateMachine(stateMachine, {
input: events.RuleTargetInput.fromObject({ SomeParam: 'SomeValue' }),
deadLetterQueue: dlq,
role: role
}));
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@ test('Existing role can be used for State machine Rule target', () => {
});
const stateMachine = new sfn.StateMachine(stack, 'SM', {
definition: new sfn.Wait(stack, 'Hello', { time: sfn.WaitTime.duration(cdk.Duration.seconds(10)) }),
role,
});

// WHEN
rule.addTarget(new targets.SfnStateMachine(stateMachine, {
input: events.RuleTargetInput.fromObject({ SomeParam: 'SomeValue' }),
role: role,
}));

// THEN
Expand Down Expand Up @@ -125,13 +125,13 @@ test('specifying retry policy', () => {
});
const stateMachine = new sfn.StateMachine(stack, 'SM', {
definition: new sfn.Wait(stack, 'Hello', { time: sfn.WaitTime.duration(cdk.Duration.seconds(10)) }),
role,
});

rule.addTarget(new targets.SfnStateMachine(stateMachine, {
input: events.RuleTargetInput.fromObject({ SomeParam: 'SomeValue' }),
maxEventAge: cdk.Duration.hours(2),
retryAttempts: 2,
role: role,
}));

// THEN
Expand All @@ -151,7 +151,7 @@ test('specifying retry policy', () => {
},
RoleArn: {
'Fn::GetAtt': [
'SMEventsRoleB320A902',
'Role1ABCC5F0',
'Arn',
],
},
Expand All @@ -176,13 +176,13 @@ test('use a Dead Letter Queue for the rule target', () => {
});
const stateMachine = new sfn.StateMachine(stack, 'SM', {
definition: new sfn.Wait(stack, 'Hello', { time: sfn.WaitTime.duration(cdk.Duration.seconds(10)) }),
role,
});

// WHEN
rule.addTarget(new targets.SfnStateMachine(stateMachine, {
input: events.RuleTargetInput.fromObject({ SomeParam: 'SomeValue' }),
deadLetterQueue: dlq,
role: role,
}));

// the Permission resource should be in the event stack
Expand All @@ -206,7 +206,7 @@ test('use a Dead Letter Queue for the rule target', () => {
Input: '{"SomeParam":"SomeValue"}',
RoleArn: {
'Fn::GetAtt': [
'SMEventsRoleB320A902',
'Role1ABCC5F0',
'Arn',
],
},
Expand Down