Skip to content

Commit 8772ae7

Browse files
authored
Merge pull request #591 from jeffreydmohler/feat-eb-scheduler-input
feat(EventBridge Scheduler): Enable passing input to target
2 parents bd9363b + 0f1dbbd commit 8772ae7

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

lib/deploy/events/schedule/compileScheduledEvents.js

+1
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ module.exports = {
156156
"Target": {
157157
"Arn": { "Ref": "${stateMachineLogicalId}" },
158158
"RoleArn": ${roleArn}
159+
${Input ? `,"Input": "${Input}"` : ''}
159160
},
160161
"FlexibleTimeWindow": {
161162
"Mode": "OFF"

lib/deploy/events/schedule/compileScheduledEvents.test.js

+25
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,31 @@ describe('#httpValidate()', () => {
512512
expect(serverlessStepFunctions.serverless.service.provider.compiledCloudFormationTemplate.Resources.FirstStepFunctionsSchedulerSchedule1.Properties.ScheduleExpressionTimezone).to.equal('Asia/Mumbai');
513513
});
514514

515+
it('should define input when schedular and input are given', () => {
516+
serverlessStepFunctions.serverless.service.stepFunctions = {
517+
stateMachines: {
518+
first: {
519+
events: [
520+
{
521+
schedule: {
522+
method: 'scheduler',
523+
rate: 'cron(1 3 * * ? *)',
524+
enabled: false,
525+
timezone: 'Asia/Mumbai',
526+
input: {
527+
key: 'value',
528+
},
529+
},
530+
},
531+
],
532+
},
533+
},
534+
};
535+
serverlessStepFunctions.compileScheduledEvents();
536+
537+
expect(serverlessStepFunctions.serverless.service.provider.compiledCloudFormationTemplate.Resources.FirstStepFunctionsSchedulerSchedule1.Properties.Target.Input).to.equal('{"key":"value"}');
538+
});
539+
515540
it('should accept timezone only if method is scheduler', () => {
516541
serverlessStepFunctions.serverless.service.stepFunctions = {
517542
stateMachines: {

0 commit comments

Comments
 (0)