-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Find the partition of a region #1715
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #1715 +/- ##
===========================================
- Coverage 92.42% 92.41% -0.02%
===========================================
Files 53 53
Lines 9872 9884 +12
===========================================
+ Hits 9124 9134 +10
- Misses 748 750 +2
Continue to review full report at Codecov.
|
@joguSD is this something that can be merged? This would be a pretty useful feature to have. |
If this is a useful feature that may be merged, I will invest some time in cleaning up the checks and rebasing. |
I would make use of this if it was merged as well. It seems pretty useful for ARN generation. |
+1ing this PR as well, this would be helpful for instances where the partition is necessary for certain functionality (e.g. determining console and signin URLs, which my tool depends on). |
Throwing another +1 into the mix. My tool, ElectricEye, relies on the partition a lot for creation resource ARNs and creating Security Hub findings. This would allow me to not have to hard-code partitions and create separate implementations per partition. |
This would be really useful for SAM as well. Is there a way we can get this merged @kyleknap or @stealthycoin? |
@nateprewitt or @joguSD might be better people to ask merge-ablity of the feature. |
Another +1! This is a useful method. What's blocking it? |
+1 for visibility! |
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.
Hey @jkinred, I think we've got the capacity to try to get this into an upcoming release. If you have a moment to rebase this onto the current develop branch and address the feedback, that would be very helpful. Otherwise, I'll look at building on this PR to get it ready for merging.
This commit implements the core functionality for a feature request against `boto3`. See boto/boto3#1868.
Codecov Report
@@ Coverage Diff @@
## develop #1715 +/- ##
========================================
Coverage 95.32% 95.33%
========================================
Files 59 59
Lines 11474 11484 +10
========================================
+ Hits 10938 10948 +10
Misses 536 536
Continue to review full report at Codecov.
|
Thanks @jkinred, I resolved the merge issues from the last rebase, updated the error name, and added some additional tests. I think we're ready for review now, I've tagged a couple more devs to give final sign off since I've added some changes. |
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.
Looks good. Just had a couple of comments.
botocore/regions.py
Outdated
@@ -142,6 +144,19 @@ def construct_endpoint(self, service_name, region_name=None, partition_name=None | |||
if result: | |||
return result | |||
|
|||
def get_partition_for_region(self, region_name): | |||
for partition in self._endpoint_data['partitions']: | |||
if region_name in partition['regions']: |
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 should probably see if we can reuse the _region_match
method.
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.
Cool, let me get that updated.
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.
Looks good! 🚢
This commit implements the core functionality for a feature request
against
boto3
.See boto/boto3#1868.
I implemented the method with a more verbose name. Happy to adjust if needed.