Repository navigation
Conversation
3ebacff to
4c6d80c
Compare
|
|
||
| if signing is not None: | ||
| option, scheme, identity = signing | ||
| signer_properties = scheme.signer_properties( |
There was a problem hiding this comment.
I think we’re missing the resolved endpoint’s auth properties here. It looks like signingRegion, signingName, and disableDoubleEncoding never get merged into the signer properties
| for (OperationShape operation : TopDownIndex.of(model).getContainedOperations(service)) { | ||
| var http = operation.getTrait(HttpTrait.class); | ||
| if (http.isPresent() && placesBucket(model, operation, http.get())) { | ||
| var uri = http.get().getUri().toString().substring(BUCKET_LABEL.length()); |
There was a problem hiding this comment.
could we avoid removing /{Bucket} from the operation model unconditionally? Ideally static/custom resolvers retain the modeled path
jonathan343
left a comment
There was a problem hiding this comment.
Thanks @arandito! I mostly have questions for now. Still processing all these changes
| use_dualstack_endpoint: bool | None = None | ||
| """Whether to use dual-stack.""" | ||
|
|
||
| use_fips_endpoint: bool | None = None | ||
| """Whether to use FIPS-compliant regional endpoint.""" |
There was a problem hiding this comment.
nit - I think our descriptions can be improved a bit here to be more helpful
| ), | ||
| "root": 2, | ||
| "nodeCount": 14, | ||
| "nodes": "/////wAAAAH/////AAAAAAAAAA0AAAADAAAAAQAAAAQF9eEMAAAAAgAAAAUF9eEMAAAAAwAAAAgAAAAGAAAABAAAAAcF9eELAAAABQX14QkF9eEKAAAABAAAAAsAAAAJAAAABgAAAAoF9eEIAAAABwX14QYF9eEHAAAABQAAAAwF9eEFAAAABgX14QQF9eEFAAAAAwX14QEAAAAOAAAABAX14QIF9eED", |
There was a problem hiding this comment.
Investigating myself, but asking incase I forget
Why isn't this reflected in the endpoints.py file? Do we do some conversion into a different format?
There was a problem hiding this comment.
The trait stores nodes as a base64 string (spec) and EndpointBddGenerator decodes them to plain ints in endpoints.py to avoid doing it at runtime. For example, /////wAAAAH///// decodes to -1, 1, -1.
| ] | ||
|
|
||
| dependencies = [ | ||
| "smithy_aws_core~=0.12.0", |
There was a problem hiding this comment.
Why did this change here and not in the other places?
Edit: Oh is it because the old endpoint resolver was the only thing it was pulling in? And the others still pull in this dependency for other things like protocols?
| new BuiltInField("use_dualstack_endpoint", null), | ||
| // The SDKs and Tools Reference Guide default. | ||
| "AWS::Auth::AccountIdEndpointMode", | ||
| new BuiltInField("account_id_endpoint_mode", "preferred")); |
There was a problem hiding this comment.
Is this value validated anywhere. We should only be allowing preferred, disabled, or required. We also need to treat it as disabled when the request isn't signed.
| ContextParamTrait.ID, // endpoint parameter plans read these at runtime | ||
| StaticContextParamsTrait.ID, | ||
| OperationContextParamsTrait.ID, |
There was a problem hiding this comment.
I don't see these being pulled in in the protocol test clients we have generated in this repo. Was this tested E2E with a service that does use them?
| @@ -0,0 +1,476 @@ | |||
| # Endpoint Resolution | |||
There was a problem hiding this comment.
can you format this w/ npx prettier or something? Main thing for readability is the long lines for me
| @@ -0,0 +1,4 @@ | |||
| { | |||
| "type": "breaking", | |||
| "description": "Removed `AsyncStandardRegionalEndpointsResolver` and its `smithy_aws_core.aio.endpoints` package, along with `smithy_aws_core.endpoints.RegionalEndpointConfig` and `REGIONAL_ENDPOINT_CONFIG`. Generated AWS clients now resolve endpoints from the service's endpoint rules with `smithy_core.aio.endpoints.AsyncBddEndpointResolver` and `smithy_aws_core.endpoints.AWS_RULES_EXTENSION`." | |||
There was a problem hiding this comment.
and its
smithy_aws_core.aio.endpointspackage
Do you mean module?
| auth_schemes=MappingProxyType( | ||
| { | ||
| "sigv4": SigV4Trait.id, | ||
| "sigv4a": ShapeID("aws.auth#sigv4a"), |
There was a problem hiding this comment.
What happens when we see sigv4a and don't support it?
| @@ -0,0 +1,4 @@ | |||
| { | |||
| "type": "breaking", | |||
| "description": "Added the required `auth_schemes` attribute to the `smithy_core.interfaces.Endpoint` protocol. Custom endpoint types that don't subclass `smithy_core.endpoints.Endpoint` must add it." | |||
There was a problem hiding this comment.
Why is this required now?
|
|
||
| __version__ = "0.1.0" | ||
| __all__ = ("ConformanceError", "deep_equal", "verify_models", "xml_equal") | ||
| __all__ = ( |
There was a problem hiding this comment.
Do you know what caused this formatting change?
Description
This PR replaces the regional endpoint resolver that generated AWS clients us today with endpoint resolution from each service's endpoint rules. See
designs/endpoints.mdfor the full design.smithy.rules#endpointBddtrait into aBDDconstant of plain data in the_private/endpoints.py, and configs now defaultendpoint_resolvertoAsyncBddEndpointResolverfor async clients.smithy-coreadds one rules engine and standard library that evaluate this data for every Smithy-based service. Endpoint parameters are bound from the config, the operation input, and thecontextParam,staticContextParams, andoperationContextParamstraits.smithy-aws-coreaddsAWS_RULES_EXTENSIONwith theaws.*rules functions, the AWS built-ins, and partition data, and removesAsyncStandardRegionalEndpointsResolver.use_fips_endpoint,use_dualstack_endpoint,account_id_endpoint_mode, and a field for eachclientContextParamsentry, when the service's rules declare them.endpointTestscases intotests/test_endpoints.pyin the client package. Every case is resolved with its parameters through the client's resolver and cases with operation inputs run through the client as well. This ensures parameter binding works correctly.Sync/Async Split
BddEndpointResolverdefines the resolution logic as sync code andAsyncBddEndpointResolverwraps it for async clients. The async endpoint resolver protocol follows the SRA's recommendation that endpoint resolution be async, so it doesn't assume how an endpoint is resolved and keeps our interfaces flexible. For example, users may need to define a custom endpoint resolver that makes network calls. There are also AWS services (Timestream) that define aDescribeEndpointsAPI for the endpoint discovery feature.Note
Follow-up PRs will stack on top of this one for:
Testing
make test-unit- 3376 passed, 7 skipped.aws-sdk-pythonclients plus S3 and EC2 and ran their endpoint tests: 2,257 passed, 38 skipped, 5 xfailed. The skipped client cases set AWS::S3::UseGlobalEndpoint or AWS::STS::UseGlobalEndpoint, which have no config field (legacy config options we will not support). The expected failures are S3 WriteGetObjectResponse cases that need host labels.Performance
An uncached resolution is 4-13x faster than boto3 and a cache hit takes about 1 µs. Mean time per uncached call in µs, on m7i.xlarge with CPython 3.14:
Full standardized benchmark results are in the appendix in
designs/endpoints.md.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.