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

feat(scheduler): validate schedule name length #31200

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update some wording
  • Loading branch information
LaurenceWarne committed Aug 30, 2024
commit a59e40f9f5532cdf34e588107ad2bdfd321f4c9d
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-scheduler-alpha/lib/schedule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ export class Schedule extends Resource implements ISchedule {

this.validateTimeFrame(props.start, props.end);
if (props.scheduleName && !Token.isUnresolved(props.scheduleName) && props.scheduleName.length > 64) {
throw new Error(`schedule name '${props.scheduleName}' exceeds 64 characters in length`);
throw new Error(`scheduleName cannot be longer than 64 characters, got: ${props.scheduleName.length}`);
}

const resource = new CfnSchedule(this, 'Resource', {
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-scheduler-alpha/test/schedule.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,15 +215,15 @@ describe('Schedule', () => {
}).toThrow('The provided duration must be between 1 minute and 1440 minutes, got 0');
});

test('throw error when schedule name exceeds 64', () => {
test('throw error when scheduleName exceeds 64 characters', () => {
const name = 'an-extremely-unnecessarily-long-name-exceeding-64-characters-in-length';
expect(() => {
new Schedule(stack, 'TestSchedule', {
schedule: expr,
target: new SomeLambdaTarget(func, role),
scheduleName: name,
});
}).toThrow(`schedule name '${name}' exceeds 64 characters in length`);
}).toThrow(`scheduleName cannot be longer than 64 characters, got: ${name.length}`);
});
});
});
Loading