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(core): schedule class #9250

Closed
wants to merge 2 commits into from
Closed

feat(core): schedule class #9250

wants to merge 2 commits into from

Conversation

kaizencc
Copy link
Contributor

@kaizencc kaizencc commented Jul 24, 2020

Issue:
Currently, application autoscaling, autoscaling, and events have their own schedule class that are very similar. They all support a subset of these static methods: at(moment), rate(duration), expression(expression), and cron(options). Because each resource has different ways of specifying its schedule class, this PR is not as simple as moving the class to core and removing duplicates.

Solution:
This PR moves the repetitive logic to core as a BaseSchedule class, with all methods protected. It is called a Base class because other resources that have a need for a schedule should extend this and expose the necessary methods. This way, one BaseSchedule class can support multiple similar renditions of the schedule property.

Note:

  • I did not add an explanation in the README because BaseSchedule should never need to be referenced by cdk users. This results in the PR Linter failure.
  • The cron option in autoscaling follows the UNIX format with 5 units (source). However, application autoscaling and events follows a slightly different format with 6 units (source). To accommodate both formats, I added an optional unix parameter to createCron that if set, will return a UNIX formatted cron expression.

Closes #8979


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@mergify
Copy link
Contributor

mergify bot commented Jul 24, 2020

Title does not follow the guidelines of Conventional Commits. Please adjust title before merge.

@kaizencc kaizencc requested review from a team and eladb July 24, 2020 20:43
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: f820b9b
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@eladb eladb changed the title feat(core): add schedule class to core feat(core): schedule class Jul 26, 2020
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Jul 31, 2020
@NetaNir
Copy link
Contributor

NetaNir commented Aug 3, 2020

Im closing this PR for now, as it will not be implemented as a part of the synthetics L2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution/core This is a PR that came from AWS.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[core] Move Schedule classes to core and remove duplicates
4 participants