-
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-targets): add support for universal target #32341
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #32341 +/- ##
==========================================
- Coverage 78.46% 78.41% -0.06%
==========================================
Files 106 106
Lines 7208 7208
Branches 1323 1323
==========================================
- Hits 5656 5652 -4
- Misses 1364 1369 +5
+ Partials 188 187 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
|
…heduler-universal-target
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
/** | ||
* Send an event to an AWS EventBridge by AWS EventBridge Scheduler. | ||
*/ | ||
export class AwsApi extends ScheduleTargetBase implements IScheduleTarget { |
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.
A class name of Universal
might be nice to match the RFC and userguide:
https://github.com/aws/aws-cdk-rfcs/blob/main/text/0474-event-bridge-scheduler-l2.md
Universal target automatically create an IAM role if you do not specify your own IAM role. However, in comparison with templated targets, for universal targets you must grant the required IAM permissions yourself.
const target = new targets.Universal('sqs', 'CreateQueue', { input: input });
https://docs.aws.amazon.com/scheduler/latest/UserGuide/managing-targets-universal.html
A universal target is a customizable set of parameters that allow you to invoke a wider set of API operation for many AWS services.
actions: [this.props.iamAction ?? awsSdkToIamAction(this.props.service, this.props.action)], | ||
resources: this.props.iamResources ?? ['*'], |
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.
Are there any cases where more than one action is required?
For example: S3 put with KMS key.
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 may be cases where conditions
are also needed...?
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.
We can also pass an array of PolicyStatement
to props.
* You cannot use read-only API actions such as common GET operations. | ||
* For more information, see the {@link https://docs.aws.amazon.com/scheduler/latest/UserGuide/managing-targets-universal.html}. | ||
* | ||
* ALso, This must be in camelCase. |
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.
* ALso, This must be in camelCase. | |
* Also, This must be in camelCase. |
}); | ||
``` | ||
|
||
The `service` is must be in lower case and the `action` is must be in camelCase. |
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.
The `service` is must be in lower case and the `action` is must be in camelCase. | |
The `service` must be in lower case and the `action` is must be in camelCase. |
Issue # (if applicable)
Closes #32328
Reason for this change
EventBridge Scheduler has a mechanism called Universal Target that calls a wide range of AWS APIs.
Supporting this mechanism in L2 Construct will make it easier to configure EventBridge Scheduler.
https://docs.aws.amazon.com/scheduler/latest/UserGuide/managing-targets-universal.html
Description of changes
Added AwsAPI constructs targeting AWS APIs.
Users can execute any AWS API by passing service and action to Props.
According to the following documentation, the service must be lowercase, and the action must be camelCase, so that you can validate it.
arn:aws:scheduler:::aws-sdk:service:apiAction
https://docs.aws.amazon.com/scheduler/latest/UserGuide/managing-targets-universal.html#:~:text=schedule%20to%20target.-,Arn,-%E2%80%93%20The%20complete%20service
Description of how you validated changes
Added unit tests and integration tests.
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license