Skip to content

Commit 5879178

Browse files
rix0rrrskinny85
authored andcommitted
fix(events): allow adding same target to rule multiple times (#3353)
As rule targets can have different input configurations adding the same target multiple times must be possible. Move rule target id generation to `aws-events` where it's easy to simply increment a counter. This id is passed as an argument to `bind()` for targets that need to know their given id (e.g. `EcsTask`). Add `permissionsNode` on `IFunction` to handle permission checks for both functions and singleton functions. Fixes #3173
1 parent 9ec57af commit 5879178

File tree

47 files changed

+186
-114
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+186
-114
lines changed

packages/@aws-cdk/aws-cloudtrail/test/test.cloudtrail.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,8 @@ export = {
200200
trail.onCloudTrailEvent('DoEvents', {
201201
target: {
202202
bind: () => ({
203+
id: '',
203204
arn: 'arn',
204-
id: 'myid'
205205
})
206206
}
207207
});
@@ -217,7 +217,7 @@ export = {
217217
Targets: [
218218
{
219219
Arn: "arn",
220-
Id: "myid"
220+
Id: "Target0"
221221
}
222222
]
223223
}));

packages/@aws-cdk/aws-codecommit/test/integ.codecommit-events.expected.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"Arn": {
3838
"Ref": "MyTopic86869434"
3939
},
40-
"Id": "MyTopic"
40+
"Id": "Target0"
4141
}
4242
]
4343
}
@@ -46,4 +46,4 @@
4646
"Type": "AWS::SNS::Topic"
4747
}
4848
}
49-
}
49+
}

packages/@aws-cdk/aws-codecommit/test/integ.codecommit-events.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ repo.onReferenceCreated('OnReferenceCreated', {
1616
target: {
1717
bind: () => ({
1818
arn: topic.topicArn,
19-
id: 'MyTopic'
19+
id: ''
2020
})
2121
}
2222
});

packages/@aws-cdk/aws-codepipeline-actions/test/integ.lambda-deployed-through-codepipeline.lit.expected.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1196,7 +1196,7 @@
11961196
]
11971197
]
11981198
},
1199-
"Id": "PipelineStackPipeline9DB740AF",
1199+
"Id": "Target0",
12001200
"RoleArn": {
12011201
"Fn::GetAtt": [
12021202
"PipelineEventsRole46BEEA7C",
@@ -1268,7 +1268,7 @@
12681268
]
12691269
]
12701270
},
1271-
"Id": "PipelineStackPipeline9DB740AF",
1271+
"Id": "Target0",
12721272
"RoleArn": {
12731273
"Fn::GetAtt": [
12741274
"PipelineEventsRole46BEEA7C",

packages/@aws-cdk/aws-codepipeline-actions/test/integ.lambda-pipeline.expected.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@
638638
]
639639
]
640640
},
641-
"Id": "awscdkcodepipelinelambdaPipeline87A4B3D3",
641+
"Id": "Target0",
642642
"RoleArn": {
643643
"Fn::GetAtt": [
644644
"PipelineEventsRole46BEEA7C",

packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-build-multiple-inputs-outputs.expected.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
]
6262
]
6363
},
64-
"Id": "awscdkcodepipelinecodebuildmultipleinputsoutputsPipeline314D3A85",
64+
"Id": "Target0",
6565
"RoleArn": {
6666
"Fn::GetAtt": [
6767
"PipelineEventsRole46BEEA7C",

packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-commit.expected.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
]
6262
]
6363
},
64-
"Id": "awscdkcodepipelinecodecommitPipelineF780CA18",
64+
"Id": "Target0",
6565
"RoleArn": {
6666
"Fn::GetAtt": [
6767
"PipelineEventsRole46BEEA7C",

packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecr-source.expected.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@
423423
]
424424
]
425425
},
426-
"Id": "awscdkcodepipelineecrsourceMyPipeline63CF3194",
426+
"Id": "Target0",
427427
"RoleArn": {
428428
"Fn::GetAtt": [
429429
"MyPipelineEventsRoleFAB99F32",

packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-events.expected.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@
510510
"Arn": {
511511
"Ref": "MyTopic86869434"
512512
},
513-
"Id": "awscdkpipelineeventtargetMyTopic8D32776A"
513+
"Id": "Target0"
514514
}
515515
]
516516
}
@@ -562,7 +562,7 @@
562562
"Arn": {
563563
"Ref": "MyTopic86869434"
564564
},
565-
"Id": "awscdkpipelineeventtargetMyTopic8D32776A"
565+
"Id": "Target0"
566566
}
567567
]
568568
}
@@ -671,7 +671,7 @@
671671
"Arn": {
672672
"Ref": "MyTopic86869434"
673673
},
674-
"Id": "awscdkpipelineeventtargetMyTopic8D32776A",
674+
"Id": "Target0",
675675
"InputTransformer": {
676676
"InputPathsMap": {
677677
"detail-pipeline": "$.detail.pipeline",

packages/@aws-cdk/aws-codepipeline-actions/test/test.pipeline.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ export = {
365365
"Arn": {
366366
"Ref": "TopicBFC7AF6E"
367367
},
368-
"Id": "Topic"
368+
"Id": "Target0"
369369
}
370370
]
371371
}));

0 commit comments

Comments
 (0)