-
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(scheduler-targets): SqsSendMessage Target #27774
Conversation
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.
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
if (props.messageGroupId.length < 1 || props.messageGroupId.length > 128 ) { | ||
throw new Error(`messageGroupId length must be between 1 and 128, got ${props.messageGroupId.length}`); | ||
} |
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.
} else if (queue.fifo) { | ||
throw new Error('messageGroupId must be specified if the target is a FIFO queue'); | ||
} |
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.
Contains the message group ID to use when the target is a FIFO queue.
if (!(queue.node.defaultChild as sqs.CfnQueue).contentBasedDeduplication) { | ||
throw new Error('contentBasedDeduplication must be true if the target is a FIFO queue'); | ||
} |
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.
If you specify an Amazon SQS FIFO queue as a target, the queue must have content-based deduplication enabled.
if (!queue.fifo) { | ||
throw new Error('target must be a FIFO queue if messageGroupId is specified'); | ||
} |
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.
CFn occurs a following error when the queue is not FIFO queue if messageGroupId is specified. So added this validation.
ROLLBACK_COMPLETE: Resource handler returned message: "Invalid request provided: Parameters MessageGroupId not valid for the target.
For some reason this PR doesn't seem to have a |
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 links to documentation are super helpful! Thanks! The tests also seem to cover the cases well.
I do have two small thoughts I wanted to ask about though.
throw new Error(`Cannot grant permission to execution role in account ${this.props.role.env.account} to invoke target ${Names.nodeUniqueId(this.queue.node)} in account ${this.queue.env.account}. Both the target and the execution role must be in the same account.`); | ||
} | ||
|
||
this.queue.grant(role, 'sqs:SendMessage'); |
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.
this.queue.grant(role, 'sqs:SendMessage'); | |
this.queue.grantSendMessages(role); |
Would this be better? It handles the case where the queue uses KMS encryption and grants a few other permissions. But I'm not sure that's necessary for this case?
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.
Certainly, I'll leave it at that.
if (props.messageGroupId.length < 1 || props.messageGroupId.length > 128 ) { | ||
throw new Error(`messageGroupId length must be between 1 and 128, got ${props.messageGroupId.length}`); | ||
} |
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 don't think tokens ever get this long but maybe:
if (props.messageGroupId.length < 1 || props.messageGroupId.length > 128 ) { | |
throw new Error(`messageGroupId length must be between 1 and 128, got ${props.messageGroupId.length}`); | |
} | |
if (!Token.isUnresolved(props.messageGroupId) && (props.messageGroupId.length < 1 || props.messageGroupId.length > 128)) { | |
throw new Error(`messageGroupId length must be between 1 and 128, got ${props.messageGroupId.length}`); | |
} |
https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.Token.html#static-iswbrunresolvedobj
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.
Yes, I'll do that just in case.
Thanks for your review! I changed, so please review again. |
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.
Thank you!
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 for contributing!
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). |
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). |
Pull request has been modified.
Pull request has been modified.
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 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). |
This PR adds
SqsSendMessage
Target for EventBridge Scheduler.Closes #27458.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license