* Assert field-by-field equality in protocol tests
Protocol tests currently use `PartialEq`, but when we add streaming members, we can no longer compare equality synchronously & without
side effects. This diff removes `PartialEq` from output shapes (we may re add it later for non-streaming shapes) & instead asserts equality of each output member in turn.
* Cleaner version of body streaming, still some work to get it to work with tests
* Finalize protocol test support
* Add default to the operation parsers
* Add helper for isStreaming on member shapes
* Cleanups & add test
* allow upper case keys in rustTemplate
* Upgrade to Smithy 1.7
Two changes:
1. Add support for shape renaming. Since renaming doesn't apply to operations, errors, or resources, this was actually a fairly narrow change. I intentionally
maintained the ability to generate a model without a service shape, I expect at some point, some one will just want to make some Rust structs.
2. Add support for map-driven query params.
* Update APIGW model
* Fix bugs in httpParams implementation
* Cleanup logic and add one more test
* Fix StackOverflow in SdkBody Debug
An incorrect debug implementation lead to infinite recursion when printing `SdkBody` with the debug formatter
* CR Feedback
* Add ByteStream abstraction
Introduce `ByteStream`, a wrapper around SdkBody to provide easy-to-use abstractions around streaming binary data.
* Updates for CR feedback
- `data` is renamed to `collect`
- Added `into_inner` so that you can use it as a body directly if desired
- Removed unecessary impl for io::Error
- Added `From<SdkBody> for ByteStream
- Project to remove need for `Unpin` in `Inner`
- Forward relevant method in `Buf` implementation
- Use `try_next` in example
* Fix missed `data -> Collect`
* Show don't tell in examples
* Use SdkBody instead of hyper::Body
As part of the path to supporting streaming request & response bodies, we need to remove the need to have a generic request/response body. This commit hides hyper::Body inside of SdkBody & also introduces a dynamic alternative to enable supporting any HTTP Body implementation.
* Delete ResponseBody & Update usages
Now that SDK body has a visible "Bytes" variant, ResponseBody is no longer needed as a bridge to expose debug information about responses.
* Rename _cx => cx
When used over H/2, sending an empty data frame for a GET can trigger some problematic behavior in Hyper. Hyper should probably handle this, but this ensures that we will
not hit this behavior.
When sending data to API Gateway services, we are getting GOAWAY because this causes to send duplicate empty data frames.
* This is weird
* impl Error for Top Level Errors
* Disable 1.51 clippy lints. Not sure why they are showing up in this PR that hasn't bumped the rustc version
* clean impl display, top level errors send/sync
* Assert errors are send+sync
* Make futures Send
* restJson1 Header Deserialization Support
This adds support for the `@httpHeader` trait during request deserialization. This is facilitated via a `Read` abstraction which allows parsers to consume part of an input and return the remaining input. We use this to enable things like `HttpDates` which actually include commas to be parsed in a comma delimited fashion.
The internal libraries may eventually be refactored to reduce the amount of generics if it proves to be a compiler bottleneck.
* Add support for parsing request bodies
* Add response code parsing
* Lots of refactorings to restJson response parsing
* Fix some clippy lints
* Add document deserialization support and delete the failing tests
* Add new error handling (all RestJson protocol tests passing!)
* Add prefix headers parsing support
* Fix Rust Runtime clippy warnings
* Cleanup some more dead code / clippy fixes
* Update external functions to take HeaderMap instead of the value iterator
* Hard error on unreconized binding location
* Refactor parse function generation to be on-demand
* One more round of refactoring
* Few more cleanups
* restJson1 Header Deserialization Support
This adds support for the `@httpHeader` trait during request deserialization. This is facilitated via a `Read` abstraction which allows parsers to consume part of an input and return the remaining input. We use this to enable things like `HttpDates` which actually include commas to be parsed in a comma delimited fashion.
The internal libraries may eventually be refactored to reduce the amount of generics if it proves to be a compiler bottleneck.
* Add support for parsing request bodies
* Add response code parsing
* Lots of refactorings to restJson response parsing
* Fix some clippy lints
* Add document deserialization support and delete the failing tests
* Http Prefix Header Support
The impetus of this diff is adding support for HttpPrefix headers. This ended up leading to a bunch of other changes:
1. operation.build() now always returns a result to account for inability to construct HTTP requests from certain inputs
2. HeaderName/HeaderValue is now created eagerly to give a better error message
3. httpPrefixHeaders are supported
4. The Dynamo movies example now uses the fluent client.
* Disable clippy lint of extra wrap
* Fix example
* Delete some dead code
* Refactor errors to expose a kind & meta field separately
* More simplification of errors
* Simplify the retryable_error_kind implementation
* Error generator cleanups
* Fix aws-hyper feature issue
* Small test-util refactoring to improve debug output
* Enum Conn POC
* Make alias public
* Add docs, Debug impl, format
* Add comment delete dead code
* A couple of missing cargo-formats
* Cleanup, address CR feedback
* Derive clone instead of implementing it manually
* wip
* Generate Cargo.toml after lib rs, cleanup deps
* Move RecordingConnection into an extras crate
* Move generation code into extras crate
* Delete unused conn method
* Add todo about storing req/resps externally
* Add note about credential expiry
* Fix clippy lint
* Replace creds with fake creds
* Delete note about real credentials
* Give cargo fmt a hand
* EndpointResolver should be pub(crate)
* Switch internals of Region to be Cow
* Rename ProvideIdempotencyToken to MakeIdempotenyToken
* Make the config module public and rename ConfigBuilder to Builder
* Rename credentials to
* Fix missed use of Endpoint
* Ergonomics improvements & a working example
This diff adds several `pub use` statements to generated service crates to improve ergonomics, namely, this removes the need for customers to depend on internal crates like `aws-auth` when using the SDK. A few other minor bugs were also fixed on the path to getting a working example.
* Fix broken intra doc link
* Fix stale import
* Remove dead code
* Initial implementation of aws-hyper
Although this is expected to evolve, this initial implementation of aws-hyper supports endpoint, signing & response parsing middleware and is sufficient to drive basic AWS services.
A `TestConnection` helper is also provided. This enables end-to-end testing of clients by mocking out the connection with a vector of request/response pairs.
* Update test
* Add more docs, rename default to https
* Add rt tokio feature
* Fix hyper features
* wip
* Add SigV4 Signing Middleware
Utilizing `MapRequest` and the `Credentials` machinery, this diff adds SigV4SigningStage, a middleware stage that can sign `SigV4Requests`.
The signing behavior is driven by several fields that may be present in the property bag.
* Implement Tower Shims for SDK middleware
This commit implements 3 pieces of tower middleware:
1. A tower service supporting smithy_http::middleware::MapRequest
2. A tower service to dispatch operation::Request
3. A tower service to dispatch & parse the results of `operation::Operation`
* Fix clippy lints
* Go back to default debug implementation
* Check docs in rust-runtime test script
* Make Dispatch layer non-exhaustive
* Derive default for DispatchLayer
* Add credentials provider config & test
* Prepare to use `Features` during Operation Generation
* Fix sdk gradle build changes that were previously missed
* Utilize the credentials provider in the feature
* Update IdempotencyTokenProvider to be Send + Sync
* Add accessors for credential providers
* Fix build.gradle
* Update auth references to be aws-auth
* Update idempotency token test
* AWS Endpoint Middleware
This commit builds on the work of previous `Endpoint` work to incorporate AWS-specific endpoint abstractions.
* Delete dead code, add more docs
* CR Feedback: Rename Provide to Resolve
* Implement core Smithy endpoint support
This commit adds `Endpoint` to smithy-http & records our design decisions in `endpoint.md`. This provides support for the endpoint trait in Smithy. A design for endpoint discovery is proposed but is not currently implemented.
* Apply suggestions from code review
Co-authored-by: Lucio Franco <luciofranco14@gmail.com>
* More cleanups
Co-authored-by: Lucio Franco <luciofranco14@gmail.com>
* Fallback to a generic error representation for unmodeled errors
* DRY out some dependencies
* Fix name is instant_iso8601 resource
* Top level error shape improvements
This commit adds `code` and `message` as inherent methods to top level error shapes (eg. `ListTablesError`). If the error is unmodeled, it uses
downcasting to extract a message.
* Fix clippy warning
* Http Operation traits and structures
Initial implementation of `Operation` for HTTP based services and `ParseHttpResponse`. I'm also starting to collect design documentation in `design`, an mdBook intended to serve as a repository for public facing design documentation.
* Update rust-runtime/smithy-http/src/body.rs
Co-authored-by: Jonathan Esterhazy <jonathan.esterhazy@gmail.com>
* Add retry policy
* Fix doctest failures
* Update rust-runtime/smithy-http/src/operation.rs
Co-authored-by: Kerem Kat <keremkat@gmail.com>
* Update rust-runtime/smithy-http/src/operation.rs
Co-authored-by: Kerem Kat <keremkat@gmail.com>
* Update design/src/operation.md
Co-authored-by: Kerem Kat <keremkat@gmail.com>
* Update design/src/operation.md
Co-authored-by: Kerem Kat <keremkat@gmail.com>
* Update rust-runtime/smithy-http/src/response.rs
Co-authored-by: Kerem Kat <keremkat@gmail.com>
* Update design/src/operation.md
Co-authored-by: Kerem Kat <keremkat@gmail.com>
* Update design/src/operation.md
Co-authored-by: Kerem Kat <keremkat@gmail.com>
Co-authored-by: Jonathan Esterhazy <jonathan.esterhazy@gmail.com>
Co-authored-by: Kerem Kat <keremkat@gmail.com>
* Support Deserializing Boxes and HashMaps
* Extract SerializerBuilder to its own file & add some more comments
* Rename to CustomSerializerGenerator
* CR updates
* Add comment for container interface
* Update the comments with example generated code
* Customization Abstractions & Config Generation
A previous PR supported idempotency tokens with a hardcoded config implementation. This commit replaces it with the "real thing,"
supported by the `NamedSectionGenerator` abstraction. The intention idea is that sections can be typesafe, well documented, and evolve as compile
errors instead of silent failures.
Sections can also bring along state / generation context to allow for situation-specific customization. This API is still very experimental
and is expected to evolve as we continue to generate a fully customized DynamoDB client.
HttpProtocolGeneratorTest & integration tests provide complete test coverage—a unit test was also added to allow quicker iterations when adding customizations.
* Use typealias
* Fix missed merge conflicts, rename to member
This code replaces the hand-written deserializers that were used to serialize types like Instant & Blob with autogenerated code. A follow-on diff will do the same thing for serializers.
Once sufficiently developed (and if desired) this would allow us to completely remove our use of Serde-derived serializers with serializers & deserializers generated at codegen time.
* Support Deserializing Http Dates
Deserializing HTTP dates is made slightly more complex because Smithy actually supports a format _not_ outlined by the RFC where the HTTP date
uses fractional seconds. For this reason (as well as dropping the chrono dependency in the future), `httpdate` was forked and incorporated into smithy-types. At a later date, we _may_ consider inlining this dependency into the crates that actually need it.
As a side change, I'm starting to refactor the way that custom serialization works via new-types. This enables generating composable serializers
that are much easier to autogenerate.
This commit adds support for the idempotency token trait via a config. I'm not ready to build a generalized Config generator yet, so intead I'm injecting a static config via inlinable. A follow up diff will flesh out ServiceConfigGenerator to support adding more config sections as required by AWS.
* Dynamo IT & IO Layer v0
This diff adds 2 _extremely_ WIP components:
1. A basic IO layer that uses Hyper and a pure Rust signer. This will change significantly over the coming days.
2. A rudimentary Dynamo DB integration test that creates a table and verifies that it exists.
Neither of these is anywhere near final, but, rather, these are intended as a starting point for discussion.
* Fixup tests
* Add combined error generator
* Deterministic operation generation
* Test generator refactoring
* Fix test failure in inlineable
* Back out needless changes to Rust.kt and merge error types
* Add some docs
* Support the remaining fields on request protocol tests
Add support for remaining requirements and & make some small changes to support them.
* Satisfy rustfmt
* Refactor SymbolMetadataProvider into an abstract class
* Refactor meta to expectMeta
* Refactor SymbolMetadataProvider into an abstract class
* Refactor meta to expectMeta
* Add support for inline dependencies
* Implement Json Serializers!
* CR fixes
Every 6 weeks, a new version of Rust and Clippy comes out—we were upgrading implicitly which meant that our clippy (lint) checks started failing if they added new lints. This makes the Rust version explicit so we can upgrade and fix lints on our schedule.
* Add document types & other bug fixes to support AwsJson11
* Expand protocol tests for RestJson1.1 and AwsRestJson
This diff adds RestJson1 and AwsJson1.1 to the integration test suite. It uncovered a number of bugs, some of which I fixed inline and some I filed issues for and disabled the tests.
* Add another disabled test & cleaup
* Fix tests broken by changing URL encoding to encode ':'
* Copy-paste Aarons comment
* Fixup Rustfmt
* Setup pre-commit
* Run precommit hook across all files
* Increase scope of Protocol test generaton
Added support for the following fields in protocol tests:
- forbidQueryParams
- requireQueryParams
- headers
* Implement Instantiator
* Add support for dev-dependencies
* Pass the protocol in Protocol config
* Add initial protocol test generator
This commit adds an initial and very limited implementation of protocol test generation. Specifically,
it only asserts that the query string contains certain required parameters. We will update protocol test generation in concert with updates to the code generation features.
* Fixes from integration tests
* Add test of recursive maps, fix implementation of empty maps
* Add protocol test generator, pre-commit hooks
* Fix test
* Fix formatting
* Add inital CI workflow
* Run unit tests
* Run integration tests & ktlint
* Split job, set REPO_ROOT
* Update to satisfy new cargo clippy
* Upload an artifact
* Run runtime tests in CI
* Add missing test.sh
* Make script path indepdendent
* Run clippy on Rust runtime
* move artifact upload to the correct job
* Don't upload target
* Fix Rust code formatting
* Fix kotlin codestyle
* Fix merge issue
To support protocol tests, this commit adds `decode` to our base64 implementation. The implementation is validated against the base64 crate and stress-tested with proptest for correctness and crash-free-ness.
* Add new models to run integration tests against
* Add initial support for HTTP protocols
* Refactor protocol generation arguments
* Add more method comments
* Remove some dead code
* CR feedback