Skip to content

Commit

Permalink
minor nits and template update
Browse files Browse the repository at this point in the history
  • Loading branch information
lpizzinidev committed Dec 9, 2023
1 parent a707b97 commit 3f76159
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,15 @@ export class RotationSchedule extends Resource {
let automaticallyAfterDays: number | undefined;
let scheduleExpression: string | undefined;
if (props.automaticallyAfter) {
if (props.automaticallyAfter.toMilliseconds() > 0) {
if (props.automaticallyAfter.toMilliseconds() < Duration.hours(4).toMilliseconds()) {
const automaticallyAfterMillis = props.automaticallyAfter.toMilliseconds();
if (automaticallyAfterMillis > 0) {
if (automaticallyAfterMillis < Duration.hours(4).toMilliseconds()) {
throw new Error(`automaticallyAfter must not be smaller than 4 hours, got ${props.automaticallyAfter.toHours()} hours`);
}
if (props.automaticallyAfter.toMilliseconds() > Duration.days(1000).toMilliseconds()) {
if (automaticallyAfterMillis > Duration.days(1000).toMilliseconds()) {
throw new Error(`automaticallyAfter must not be greater than 1000 days, got ${props.automaticallyAfter.toDays()} days`);
}
if (props.automaticallyAfter.toHours() > 23) {
if (props.automaticallyAfter.toHours() >= 24) {
automaticallyAfterDays = props.automaticallyAfter.toDays();
} else {
scheduleExpression = Schedule.rate(props.automaticallyAfter).expressionString;
Expand Down

0 comments on commit 3f76159

Please sign in to comment.