Skip to content

Conversation

@varungovinda
Copy link

Issue #, if available:

Description of changes: Using botocore to fecth partitions

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Copy link
Contributor

@AndrewAsseily AndrewAsseily left a comment

Choose a reason for hiding this comment

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

Thanks for this PR! We'll likely need to remove the forward-compatible test for cn-northwest-2 unless we reintroduce the old string prefix fallback behavior, since aws_partition should handle this but the current partitions data does not include that specific test case.

return "aws"
loader = Loader()
endpoints_data = loader.load_data('endpoints')
resolver = EndpointResolver(endpoints_data)
Copy link
Contributor

@AndrewAsseily AndrewAsseily Oct 29, 2025

Choose a reason for hiding this comment

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

I've been advised that we should prioritize using partitions.json over endpoints.json when possible. Rather than manually parsing partitions.json, we can leverage the existing aws_partition function from RuleSetStandardLibrary while still maintaining 'aws' as the default fallback:

from botocore.endpoint_provider import RuleSetStandardLibary

loader = Loader()
partitions_data = loader.load_data('partitions')
rule_lib = RuleSetStandardLibary(partitions_data)
partition_result = rule_lib.aws_partition(region.lower())
return partition_result['name']

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.

2 participants