Skip to content

Commit f6e55ea

Browse files
committed
fix: support arguments for EventBridge when query language is JSONata
1 parent a755b0c commit f6e55ea

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

lib/deploy/stepFunctions/compileIamRole.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,8 +595,9 @@ function getBedrockPermissions(state) {
595595

596596
function getEventBridgePermissions(state) {
597597
const eventBuses = new Set();
598+
const entries = getParameterOrArgument(state, 'Entries');
598599

599-
for (const entry of state.Parameters.Entries) {
600+
for (const entry of entries) {
600601
eventBuses.add(entry.EventBusName || 'default');
601602
}
602603

lib/deploy/stepFunctions/compileIamRole.test.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4182,21 +4182,22 @@ describe('#compileIamRole', () => {
41824182
]);
41834183
});
41844184

4185-
it('should give event bridge putEvents permissions', () => {
4185+
itParam('should give event bridge putEvents permissions: ${value}', ['JSONPath', 'JSONata'], (queryLanguage) => {
41864186
const genStateMachine = id => ({
41874187
id,
41884188
definition: {
4189+
QueryLanguage: queryLanguage,
41894190
StartAt: 'A',
41904191
States: {
41914192
A: {
41924193
Type: 'Task',
41934194
Resource: 'arn:aws:states:::events:putEvents',
4194-
Parameters: {
4195+
...getParamsOrArgs(queryLanguage, {
41954196
Entries: [{
41964197
Source: 'source',
41974198
DetailType: 'DetailType',
41984199
}],
4199-
},
4200+
}),
42004201
End: true,
42014202
},
42024203
},
@@ -4224,16 +4225,17 @@ describe('#compileIamRole', () => {
42244225
}]);
42254226
});
42264227

4227-
it('should give event bridge putEvents multiple permissions', () => {
4228+
itParam('should give event bridge putEvents multiple permissions: ${value}', ['JSONPath', 'JSONata'], (queryLanguage) => {
42284229
const genStateMachine = id => ({
42294230
id,
42304231
definition: {
4232+
QueryLanguage: queryLanguage,
42314233
StartAt: 'A',
42324234
States: {
42334235
A: {
42344236
Type: 'Task',
42354237
Resource: 'arn:aws:states:::events:putEvents',
4236-
Parameters: {
4238+
...getParamsOrArgs(queryLanguage, {
42374239
Entries: [
42384240
{
42394241
Source: 'source',
@@ -4246,7 +4248,7 @@ describe('#compileIamRole', () => {
42464248
EventBusName: 'custom',
42474249
},
42484250
],
4249-
},
4251+
}),
42504252
End: true,
42514253
},
42524254
},

0 commit comments

Comments
 (0)