-
Notifications
You must be signed in to change notification settings - Fork 193
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
Refactor endpoints to be Smithy-native #1641
Conversation
A new generated diff is ready to view.
A new doc preview is ready to view. |
A new generated diff is ready to view.
A new doc preview is ready to view. |
8836d0b
to
9a5fa97
Compare
A new generated diff is ready to view.
A new doc preview is ready to view. |
9a5fa97
to
543ecae
Compare
A new generated diff is ready to view.
A new doc preview is ready to view. |
543ecae
to
76385ae
Compare
A new generated diff is ready to view.
A new doc preview is ready to view. |
let aws_endpoint = self | ||
.0 | ||
.resolve_endpoint(params.region.as_ref().unwrap_or( | ||
/*EndpointError::message("no region in params")*/ |
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.
Leftover 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.
good catch, fixed
// unwrap safety: we just put it in the bag, we can take it out again. | ||
let endpoint = props | ||
.get::<aws_smithy_http::endpoint::Result>() | ||
.map(|res|res.as_ref().unwrap()).unwrap(); |
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.
Is leaving a comment like this preferable to using .expect()
?
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.
I did a cleaner version of this where I just replace the error with a leftover error
76385ae
to
e0a4a7e
Compare
A new generated diff is ready to view.
A new doc preview is ready to view. |
A new generated diff is ready to view.
A new doc preview is ready to view. |
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.
LGTM!
@@ -48,6 +92,28 @@ pub enum InvalidEndpoint { | |||
EndpointMustHaveAuthority, | |||
} | |||
|
|||
pub fn apply_endpoint(uri: &mut Uri, endpoint: &Uri, prefix: Option<&EndpointPrefix>) { |
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.
Needs documentation
if self.endpoint.url() == "" { | ||
panic!("URL was unset"); | ||
} |
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.
if self.endpoint.url() == "" { | |
panic!("URL was unset"); | |
} | |
assert!(self.endpoint.url() != "", "URL was unset"); |
A new generated diff is ready to view.
A new doc preview is ready to view. |
…-rs into endpoints-refactor-part-1
A new generated diff is ready to view.
A new doc preview is ready to view. |
A new generated diff is ready to view.
A new doc preview is ready to view. |
Motivation and Context
Description
This makes a 99% backwards compatible refactoring to:
aws_smithy_types::Endpoint
typeaws_smithy_http::endpoint::ResolveEndpoint
trait (tbd: this may move into aws_smithy_types)ResolveEndpoint
inside of<service>::Config
internally instead ofResolveAwsEndpoint
ResolveAwsEndpoint
againstResolveEndpoint
via a staticParams
struct (in the future, this will be code generated per-service).make_operation
to write the endpoint into the bag instead of writing the endpoint resolver into the bag & update the AWS middleware accordinglyTesting
Checklist
CHANGELOG.next.toml
if I made changes to the smithy-rs codegen or runtime cratesCHANGELOG.next.toml
if I made changes to the AWS SDK, generated SDK code, or SDK runtime cratesBy submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.