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

fixed and improved region detection within queue url #403

Merged
merged 2 commits into from
Apr 12, 2021

Conversation

bwagner5
Copy link
Contributor

@bwagner5 bwagner5 commented Apr 9, 2021

Issue #, if available:
#390

Description of changes:

  • Fix issue with SQS queue-url region detection

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

@bwagner5 bwagner5 requested a review from haugenj April 9, 2021 19:15
}
}
}
return ""
Copy link
Contributor

Choose a reason for hiding this comment

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

will this lead to an error?

Copy link
Contributor

Choose a reason for hiding this comment

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

if they do end up changing the queue urls or something, maybe we should at least log here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added a debug log

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh and to answer the first question, yes it will lead to an aws sdk error that the region is undefined

Copy link
Contributor

@haugenj haugenj left a comment

Choose a reason for hiding this comment

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

👍

func getRegionFromQueueURL(queueURL string) string {
for _, partition := range endpoints.DefaultPartitions() {
for regionID := range partition.Regions() {
if strings.Contains(queueURL, regionID) {
Copy link
Contributor

Choose a reason for hiding this comment

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

it's not likely; but if someone named their queue us-west-2 when it was actually in e.g. ap-southeast-1 then this could have a false positive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants