-
Notifications
You must be signed in to change notification settings - Fork 4k
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): start and end time for schedule construct #28306
Changes from 12 commits
8acc52a
883ba81
a8c0232
ac47212
cece795
029d40b
ac5c8d2
16d0f02
8cc2d91
e6c41fa
e17d2b6
e037852
53bba92
380f428
a56f918
2f12a18
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -138,6 +138,21 @@ new Schedule(this, 'Schedule', { | |
}); | ||
``` | ||
|
||
### Configuring a start and end time of the Schedule | ||
|
||
If you choose a recurring schedule, you can set the start and end time of the Schedule by specifying the startDate and endDate. | ||
These values must follow the ISO 8601 format (`yyyy-MM-ddTHH:mm:ss.SSSZ`). | ||
|
||
```ts | ||
declare const target: targets.LambdaInvoke; | ||
|
||
new Schedule(this, 'Schedule', { | ||
schedule: ScheduleExpression.rate(cdk.Duration.hours(12)), | ||
target: target, | ||
startDate: '2023-01-01T00:00:00.000Z', | ||
endDate: '2023-02-01T00:00:00.000Z', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we standardized on using the How do you feel about that? I think that's the best course of action here as it allows for more types of inputs, but feel free to push back. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the comment! Using the Date type to allow for a variety of user inputs is certainly appealing. By typing these values as string representation in the ISO 8601 format, we could mitigate these inconsistencies and ensure more predictable behavior across different environments. This is just my personal opinion and I would love to get feedback from the CDK team. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CFN accepts https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, However, I would like to change these properties to use Date type, since this problem does not occur if the user passes a string with timezone at initialization, and this is not a CDK problem but a JavaScript Date class specification problem. |
||
}); | ||
``` | ||
|
||
## Scheduler Targets | ||
|
||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would also prefer the props to be just named
start
andend
, orstartTime
/endTime
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In CFn, it is StartDate and EndDate, so I shortened it to start and end.