-
Notifications
You must be signed in to change notification settings - Fork 24
Generate Regional endpoints #394
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
Conversation
… just renders endpoint_parameter construction
nateprewitt
left a comment
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.
Two minor comments, otherwise looks good!
packages/smithy-aws-core/src/smithy_aws_core/endpoints/standard_regional.py
Outdated
Show resolved
Hide resolved
| endpoint = await config.endpoint_resolver.resolve_endpoint( | ||
| StaticEndpointParams(uri=config.endpoint_uri) | ||
| ) | ||
| context.endpointsGenerator().renderEndpointParameterConstruction(context, writer); |
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.
This is a prime use case for a CodeSection. You would create a section like this called EndpointParamSection or something like that with the necessary context, and then a PythonIntegration would return a CodeInterceptor in its interceptors method.
Then here you'd have something like:
writer.pushState(new EndpointParamsSection(context));
// Default implementation. Interceptors can be blow it away.
writer.write("""
endpoint_parameters = StaticEndpointParams(uri=config.endpoint_uri)
""");
writer.popState();You can then get rid of the EndpointsGenerator entirely.
smithy-python doesn't use sections or interceptors much currently, but it should.
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.
For an implementation of an approach using CodeSections and CodeInterceptor see: #407
|
I prefer option 2 |
Description of changes:
Adds a hook for integrations to register an endpoints generator that is responsible for generating client configuration and resolution logic.
Adds an Aws Standard Regional Endpoints generation path that adds region to client config and generates logic to use a simple pattern based regional endpoint resolver.
The generic hook for endpoint generation can be used in the future to implement Endpoints2.0 both generically or in Aws flavors (specifically accounting for AWS builtins / std lib functions).
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.