-
Notifications
You must be signed in to change notification settings - Fork 192
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
Eliminate SDK client generics #1132
Conversation
A new doc preview is ready to view. |
A new generated diff is ready to view.
|
A new doc preview is ready to view. |
A new generated diff 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! This is huge IMO.
@@ -125,7 +129,7 @@ class PaginatorGenerator private constructor( | |||
builder: #{Builder} | |||
} | |||
|
|||
impl${generics.inst} ${paginatorName}${generics.inst} where #{bounds:W} { | |||
impl${generics.inst} ${paginatorName}${generics.inst} #{bounds:W} { |
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.
nit: small inconsistency that one includes the where
and the other does not
/** Bounds for generated `send()` functions */ | ||
override fun sendBounds(input: Symbol, output: Symbol, error: RuntimeType): Writable = writable { } |
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'm really surprised this compiles! It generates fn send(...) where { body }
. Probably worth including the where
in the bounds just so we generate a slightly more normal looking code
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.
Wow, good catch! I'm also surprised 😅
.connector(#{DynConnector}::new(conn)) | ||
.middleware(#{DynMiddleware}::new(#{Middleware}::new())); |
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.
we could consider sticking these types into the client generics for a little DRY
but not sure if it's worth it
CHANGELOG.next.toml
Outdated
|
||
[[aws-sdk-rust]] | ||
message = """ | ||
`Client` no longer has generics, and now uses `DynConnector` and `DynMiddleware` to allow for connector/middleware customization. |
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.
can you update the changelog message to clarify that this is all generated service clients? Might also be worth calling out that this simplifies the code and docs.
The only other call out might be custom retry policies? Not sure.
LGTM! |
A new doc preview is ready to view. |
A new generated diff is ready to view.
|
1129b1b
to
be12ae2
Compare
A new doc preview is ready to view. |
A new generated diff is ready to view.
|
```rust | ||
fn some_function(conn: DynConnector) -> Result<()> { | ||
// ... | ||
} | ||
``` |
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 felt a great disturbance in the Force, as if millions of
voiceswhere
clauses suddenly cried out in terror and were suddenly silenced. I fear somethingterribleawesome has happened.
A new doc preview is ready to view. |
A new generated diff is ready to view.
|
Motivation and Context
The motivation here is to simplify implementation of waiters by reducing the amount of generic bounds required to implement them. The connector and middleware can still be customized since they are dynamic.
Checklist
CHANGELOG.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.