Skip to content

Commit

Permalink
feat(EventBridge Scheduler): enable passing input to target
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeffrey Mohler committed Oct 9, 2023
1 parent bd9363b commit 0f1dbbd
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/deploy/events/schedule/compileScheduledEvents.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ module.exports = {
"Target": {
"Arn": { "Ref": "${stateMachineLogicalId}" },
"RoleArn": ${roleArn}
${Input ? `,"Input": "${Input}"` : ''}
},
"FlexibleTimeWindow": {
"Mode": "OFF"
Expand Down
25 changes: 25 additions & 0 deletions lib/deploy/events/schedule/compileScheduledEvents.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,31 @@ describe('#httpValidate()', () => {
expect(serverlessStepFunctions.serverless.service.provider.compiledCloudFormationTemplate.Resources.FirstStepFunctionsSchedulerSchedule1.Properties.ScheduleExpressionTimezone).to.equal('Asia/Mumbai');
});

it('should define input when schedular and input are given', () => {
serverlessStepFunctions.serverless.service.stepFunctions = {
stateMachines: {
first: {
events: [
{
schedule: {
method: 'scheduler',
rate: 'cron(1 3 * * ? *)',
enabled: false,
timezone: 'Asia/Mumbai',
input: {
key: 'value',
},
},
},
],
},
},
};
serverlessStepFunctions.compileScheduledEvents();

expect(serverlessStepFunctions.serverless.service.provider.compiledCloudFormationTemplate.Resources.FirstStepFunctionsSchedulerSchedule1.Properties.Target.Input).to.equal('{"key":"value"}');
});

it('should accept timezone only if method is scheduler', () => {
serverlessStepFunctions.serverless.service.stepFunctions = {
stateMachines: {
Expand Down

0 comments on commit 0f1dbbd

Please sign in to comment.