Derive endpoint DNS suffixes from botocore partition data instead of hardcoding
.amazonaws.com, so data/control/gateway endpoints resolve to amazonaws.com.cn in
cn-north-1 / cn-northwest-1. Commercial partitions are unchanged.
- _utils/endpoints.py: partition-aware DNS suffix via a cached public botocore
EndpointResolver; warns (rather than silently falling back) on unknown
regions; exposes known_partitions()
- runtime/utils.py: is_valid_partition backed by botocore's partition list
- runtime/a2a.py: build_runtime_url derives the suffix (region-based contract)
- payments/{client,manager}.py, config_bundle/client.py, batch runner: resolve
endpoints natively (partition-correct) while still honouring the
BEDROCK_AGENTCORE_{CP,DP}_ENDPOINT override via conditional endpoint_url
- .pre-commit-config.yaml: pygrep hook forbidding a hardcoded .amazonaws.com
suffix immediately after an interpolated value
- tests: CN endpoint-builder + aws-cn ARN coverage; override on/off cases
Summary
Regionalizes the SDK for AWS China (
aws-cn). Endpoint DNS suffixes are derived from botocore partition data instead of a hardcoded.amazonaws.com, so data/control/gateway endpoints resolve toamazonaws.com.cnincn-north-1/cn-northwest-1. Commercial partitions are unchanged.Changes
_utils/endpoints.py: partition-aware DNS suffix via a cached public botocoreEndpointResolver; warns (rather than silently falling back) on unknown regions; addsknown_partitions()runtime/utils.py:is_valid_partitionbacked by botocore's partition listruntime/a2a.py:build_runtime_urlderives the suffix (region-based contract)payments/{client,manager}.py,config_bundle/client.py, batch runner: resolve endpoints natively (partition-correct) while still honouring theBEDROCK_AGENTCORE_{CP,DP}_ENDPOINToverride via conditionalendpoint_url.pre-commit-config.yaml: pygrep hook forbidding a hardcoded.amazonaws.comsuffix right after an interpolated valueaws-cnARN coverage; override on/off casesTesting
test_region_validation,runtime/test_utils,config_bundle,unit/runtime); ruff + pre-commit hook clean.InvokeAgentRuntime→200, tools (browser + code-interpreter) CP+DP, gateway CP + MCP-URL, identity CP; all endpoints*.amazonaws.com.cn.