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): ScheduleGroup #26196

Merged
merged 10 commits into from Jul 24, 2023
Merged

Conversation

filletofish
Copy link
Contributor

@filletofish filletofish commented Jul 2, 2023

This PR contains implementation of ScheduleGroup.

A Schedule is the main resource in Amazon EventBridge Scheduler, this PR adds ScheduleGroup which can be used to group Schedules and on which Schedule depends.

Every AWS account comes with a default group for schedules. Customers can also create a custom groups to organise schedules that share a common purpose or belong to the same environment.

Schedule has a property group that determines what group is the schedule associated with.

To be able to test adding schedules to the group I have added property group to private class Schedule and used Lazy functionality to be able to update group of the schedule dynamically.

Implementation is based on RFC: https://github.com/aws/aws-cdk-rfcs/blob/master/text/0474-event-bridge-scheduler-l2.md

Advances #23394


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

@github-actions github-actions bot added the beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK label Jul 2, 2023
@aws-cdk-automation aws-cdk-automation requested a review from a team July 2, 2023 18:58
@github-actions github-actions bot added the p2 label Jul 2, 2023
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.

A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed add Clarification Request to a comment.

@gitpod-io
Copy link

gitpod-io bot commented Jul 2, 2023

/**
* Grant list and get schedule permissions for schedules in this group to the given principal
*/
grantReadSchedules(identity: iam.IGrantable): iam.Grant;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Compared to RFC I have updated the method names for granting permissions. From grantRead to grantReadSchedules - to be more precise that the method grants permissions to manage schedules in the group, not the permissions for the group itself.

There are IAM permissions for the schedules and for the groups.

@filletofish filletofish marked this pull request as ready for review July 2, 2023 19:31
resourceName: this.physicalName,
});
this.groupName = this.physicalName;
}
Copy link
Contributor

@Jacco Jacco Jul 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a call to applyRemovalPolicy is missing here? This means the removalPolicy from the props will not be emitted to CloudFormation. (+ that needs a test)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I have actually missed that.

@default RemovalPolicy.RETAIN

Are we sure that we want the default to be RETAIN?

@kaizencc kaizencc added the pr-linter/exempt-integ-test The PR linter will not require integ test changes label Jul 5, 2023
@aws-cdk-automation aws-cdk-automation dismissed their stale review July 5, 2023 13:40

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

Plus this commit fixes access modifiers for methods
in group.ts
@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Jul 6, 2023
Copy link
Contributor

@kaizencc kaizencc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @filletofish and @Jacco for the great start. have a few api questions but nothing major

packages/@aws-cdk/aws-scheduler-alpha/lib/group.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-scheduler-alpha/lib/group.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-scheduler-alpha/lib/group.ts Outdated Show resolved Hide resolved
@kaizencc kaizencc self-assigned this Jul 6, 2023
@kaizencc kaizencc changed the title feat(schedule): ScheduleGroup feat(scheduler): ScheduleGroup Jul 6, 2023
@aws-cdk-automation aws-cdk-automation removed the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Jul 6, 2023
- Remove addSchedules method
- Update readme
- Apply removal policy
@mergify mergify bot dismissed kaizencc’s stale review July 13, 2023 20:13

Pull request has been modified.

@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Jul 13, 2023
packages/@aws-cdk/aws-scheduler-alpha/README.md Outdated Show resolved Hide resolved
TODO: Group is not yet implemented. See section in [L2 Event Bridge Scheduler RFC](https://github.com/aws/aws-cdk-rfcs/blob/master/text/0474-event-bridge-scheduler-l2.md)
Your AWS account comes with a default scheduler group. You can access default group in CDK with:

```text
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these examples can be in ts now? Since they should be fully implemented right. Then you will also have to double check with yarn rosetta:extract --strict or else the PR build may fail :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated now, good catch

packages/@aws-cdk/aws-scheduler-alpha/README.md Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-scheduler-alpha/README.md Outdated Show resolved Hide resolved
kaizencc
kaizencc previously approved these changes Jul 22, 2023
@mergify
Copy link
Contributor

mergify bot commented Jul 22, 2023

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot dismissed kaizencc’s stale review July 24, 2023 14:27

Pull request has been modified.

@mergify
Copy link
Contributor

mergify bot commented Jul 24, 2023

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: b792f76
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@mergify mergify bot merged commit 27dc8ff into aws:main Jul 24, 2023
6 checks passed
@mergify
Copy link
Contributor

mergify bot commented Jul 24, 2023

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

bmoffatt pushed a commit to bmoffatt/aws-cdk that referenced this pull request Jul 29, 2023
This PR contains implementation of ScheduleGroup. 

A Schedule is the main resource in Amazon EventBridge Scheduler, this PR adds ScheduleGroup which can be used to group Schedules and on which Schedule depends.

Every AWS account comes with a default group for schedules. Customers can also create a custom groups to organise schedules that share a common purpose or belong to the same environment. 

Schedule has a property `group` that determines what group is the schedule associated with.

To be able to test adding schedules to the group I have added property `group` to private class `Schedule` and used `Lazy` functionality to be able to update `group` of the schedule dynamically. 

Implementation is based on RFC: https://github.com/aws/aws-cdk-rfcs/blob/master/text/0474-event-bridge-scheduler-l2.md

Advances aws#23394

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK p2 pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. pr-linter/exempt-integ-test The PR linter will not require integ test changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants