-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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(ses): grant
methods to IEmailIdentity
#29084
Conversation
Also introduce an abstract base class to avoid duplication between imported email identities.
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 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.
grant
methods to IEmailIdentity
grant
methods to IEmailIdentity
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.
Thanks @karaken12, this looks good!
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
Great, thanks! I can still add an integration test if you want? |
It made sense to do so, and adding the `@attribute` fixes a lint error.
Pull request has been modified.
This matches built in AWS policies, such as AmazonCognitoIdpEmailServiceRolePolicy.
Updated an integration test (as the bot requested!), corrected a documentation error, and updated the list of actions in the |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
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). |
### Issue Closes #29083 ### Reason for this change When granting send email access to a lambda the grant needs to be constructed manually, including constructing the ARN for the identity. e.g. ``` Grant.addToPrincipal({ grantee, actions: ["ses:SendEmail"], resourceArns: [ this.stack.formatArn({ service: 'ses', resource: 'identity', resourceName: 'test@example.com', }), ], scope: this }) ``` This is dissimilar to other constructs, which generally expose a grant method and one or more convenience methods for particularly relevant groups of actions. ### Description of changes Added `grant` and `grantSendEmail` to `IEmailIdentity`, and added a common abstract class, `BaseEmailIdentity` with the relevant grant code. This is to avoid code duplication between the full `EmailIdentity` and the `Import` class. ### Description of how you validated changes Tests added for grants on both new and imported email identities, and a test to validate the `grantSendEmail` method. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Issue
Closes #29083
Reason for this change
When granting send email access to a lambda the grant needs to be constructed manually, including constructing the ARN for the identity. e.g.
This is dissimilar to other constructs, which generally expose a grant method and one or more convenience methods for particularly relevant groups of actions.
Description of changes
Added
grant
andgrantSendEmail
toIEmailIdentity
, and added a common abstract class,BaseEmailIdentity
with the relevant grant code. This is to avoid code duplication between the fullEmailIdentity
and theImport
class.Description of how you validated changes
Tests added for grants on both new and imported email identities, and a test to validate the
grantSendEmail
method.Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license