Commit Graph

1143 Commits

Author SHA1 Message Date
Russell Cohen fa59140c62
Add User-Agent Support (#225)
* wip

* Capture build metadata

* Create a basic UA string

* Add to AwsHyper & add E2E test

* Add documentation to AwsUserAgent

* Fix doc compilation error

* Delete autogen test

* Fix unused import
2021-02-22 15:25:01 -05:00
Russell Cohen c84e404ac3
Add KMS example & fix bugs (#227)
* Add KMS example & fix bugs

* Set log to info & assert we got the right number of bytes back
2021-02-22 10:10:25 -05:00
Russell Cohen cf55bcab33
Add SigningService & SigningConfig during operation construction (#202)
* Add SigningService & SigningConfig during operation construction

This commit adds:
- SigV4SigningFeature during operation construction
- A `signing_service()` function to config objects to define a default signing service

These are both gated on the `aws.auth#sigV4` trait being present on the service

* Fix sig-auth missed changes

* Fix bad import
2021-02-19 08:24:41 -05:00
Russell Cohen 71c97a1335
Ergonomics improvements & a working example (#204)
* 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
2021-02-17 13:45:40 +00:00
Russell Cohen b60b30bba6
Initial implementation of aws-hyper (#201)
* 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
2021-02-16 13:32:32 -05:00
Russell Cohen 213b00f487
Add Gradle Task to generate SDK examples (#203)
* Add Gradle Task to generate SDK examples

* Rename base task
2021-02-16 11:46:57 -05:00
Russell Cohen 36f67c5f40
Add AwsEndpointResolver when constructing operations (#198)
* Add AwsEndpointResolver when constructing operations

This commit adds a customization for AWS-services to allow specifying an EndpointResolver, with a default fallback provided.

* Enforce no doc warnings, fix bug, add cargoCheck to CI
2021-02-15 17:35:51 -05:00
Russell Cohen e499bbd991
Bump Rust version (#199) 2021-02-15 12:56:02 -05:00
Russell Cohen cda6ed6123
Add regions to AWS config (#196)
* wip

* Regions in AWS Config

* Add region docs
2021-02-12 20:52:55 -05:00
Russell Cohen 27e00dd08f
SigV4 Signing Middleware (#193)
* 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.
2021-02-12 20:26:30 -05:00
Russell Cohen 5b4515c418
Implement Tower Shims for SDK middleware (#187)
* 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
2021-02-12 12:14:43 -05:00
Russell Cohen cb50262c93
Add CredentialsProvider to config (and related refactorings) (#182)
* 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
2021-02-11 10:48:53 -05:00
Russell Cohen 162d61b1d6
Add new services (#184)
* Add secrets manager & kinesis

* Add new service models

* Add KMS model
2021-02-10 17:58:47 -05:00
Russell Cohen 38f2b29006
AWS Endpoint Middleware (#188)
* 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
2021-02-10 07:50:07 -05:00
Russell Cohen 6da99699bb
Implement core Smithy endpoint support (#183)
* 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>
2021-02-08 10:16:16 -05:00
Russell Cohen 86fc5f25c9
Add middleware & update design docs (#175)
* Add middleware & update design docs

* Add missing design folder

* Improve MapRequest middleware example

* Vendor pin_utils::pin_mut

* Remove Debug body restrictions

* Modify error bound

* Remove redundant return
2021-02-02 12:42:15 -05:00
Russell Cohen ed7454ff0d
Generate smithy_http::Operation & Implement ParseResponse trait (#174)
* Generate smithy_http::Operation

* Implement ParseResponse trait for AwsJson services
2021-01-29 11:56:57 -05:00
Russell Cohen 61dadaeb01
Credentials Provider Initial Implementation (#179) 2021-01-28 10:39:05 -05:00
Russell Cohen ec0b06d1ad
Top level error shape improvements (#172)
* 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
2021-01-27 20:07:34 -05:00
Russell Cohen c9659093d4
Fallback to a generic error representation for unmodeled errors (#171)
* Fallback to a generic error representation for unmodeled errors

* DRY out some dependencies

* Fix name is instant_iso8601 resource
2021-01-27 18:14:42 -05:00
Russell Cohen edb395f6c7
Update README.md (#170)
* Update README.md

* Update README.md

* Update README.md

Co-authored-by: Kerem Kat <keremkat@gmail.com>

Co-authored-by: Kerem Kat <keremkat@gmail.com>
2021-01-26 12:30:42 -05:00
Russell Cohen 2ff12e6ac9
Http Operation traits and structures (#167)
* 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>
2021-01-25 08:56:55 -05:00
Russell Cohen 88ca4fedd8
[chore] Move AWS codegeneration into its own folder (#166)
This allows us to deliniate AWS runtime vs. Smithy runtime and will make a future separation easier
2021-01-19 15:23:07 -05:00
Russell Cohen 9b40b38dd9
Fix Enum Serialization (#160)
Named enums were being incorrectly serialized via the derive macro. This was causing the value of the enum to be disregarded. This change implements `Serialize` and `Deserialize` explicitly for enums.

Additionally, a new protocol test was added that avoid using sets–this allow it to be run without being flaky until #37 is fixed.
2021-01-15 15:15:38 -05:00
Russell Cohen cdb6334837
Fix generated query param serializers to omit 0-values (#156) 2021-01-14 13:02:37 -05:00
Russell Cohen f2f1e358b6
Add missing semicolon to generated URI label bindings (#104)
Co-authored-by: Richard Hernandez <riher@amazon.com>
2021-01-05 15:52:51 -08:00
Russell Cohen 41891fb690
First cut at SPI / AWS Customizations (#101)
* Add SPI capability to codegen

* Logging improvements

* Wire up aws-sdk-codegen for AWS-specific customizations

* Add AWS SDK codegen sources

* Drop dokka from aws-sdk-codegen
2021-01-04 16:49:04 -05:00
Russell Cohen 25deed8d9a
Remove all hand-written serializers (#100)
* 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
2021-01-01 08:32:36 -05:00
Russell Cohen c819930d0f
[chore] Upgrade to Rust 1.49.0 (#99) 2020-12-31 16:09:58 -05:00
Russell Cohen e1b881b6d8
Remove target from actions output (#98)
* Remove target from actions output

* Better artifact name

* take two for the correct artifact name

* fixup step names

* Take 3 on artifact name
2020-12-31 15:58:58 -05:00
Russell Cohen de4787f271
Update Dynamo Model & IT (#97) 2020-12-30 16:37:40 -05:00
Russell Cohen 56e9d9d528
Customization Abstractions & Config Generation (#96)
* 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
2020-12-30 10:34:29 -05:00
Russell Cohen 02d0db5d29
Generate deserializers dynamically for nested types (#95)
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.
2020-12-30 10:07:49 -05:00
Russell Cohen 5c0bfa4f1b
Generate Crate Documentation (#93)
* Generate Crate Documentation

This commit utilizes the documentation trait attached to the relevant service shape to generate crate-level documentation for services.

* Test fixes

* Don't upload integration test docs
2020-12-30 09:59:20 -05:00
Russell Cohen 883fc05795
Generate an AWS-SDK shaped artifact (#92)
* Generate an AWS-SDK shaped artifact

* Fix gradle dependency tree

* Rename artifact to 'sdk'

* Load SdkId from the service shape
2020-12-30 09:48:51 -05:00
Russell Cohen e2c766b11b
Add support for parsing IS08601 dates (#94) 2020-12-22 12:56:57 -05:00
Russell Cohen b6b75a7fe3
Support Deserializing Http Dates (#86)
* 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.
2020-12-22 11:00:41 -05:00
Russell Cohen e79ccb1422
Support Idempotency Token (#91)
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.
2020-12-18 12:45:31 -05:00
Russell Cohen 26ff8021b5
Refactor HttpProtocolTestGeneratorTest (#90)
As the ServiceGenerator grew more complex, it was becoming tedious to keep the hand-written operation in the HttpProtocolTestGenerator updated.

This diff replaces the hand-written operation with a custom protocol. To support this, rudimentary support for pluggable protocols was added to CodegenVisitor—eventually this will be driven by SPI.
2020-12-18 12:24:37 -05:00
Russell Cohen c0aa43c614
Update copyrights on every file (#89) 2020-12-17 13:45:48 -05:00
Russell Cohen c76113675a
Dynamo IT & IO Layer v0 (#84)
* 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
2020-12-14 23:24:47 -05:00
Russell Cohen eca86039a1
Upgrade Smithy & Kotlin to latest (#82)
* Upgrade to Kotlin 1.4

* Upgrade Smithy version, fix some deprecations
2020-12-14 10:58:04 -05:00
Russell Cohen fe6a56fc1d
Deserialize responses (#81)
* Deserialize responses

* Fix http version

* Fix test failures after merge
2020-12-11 20:44:50 -05:00
Russell Cohen a3d5f10e60
Add support for serializing document types (#75)
* Add support for serializing document types

* Delete unused conversion function

* Add test for NaN behavior

* Fix test flakiness
2020-12-11 17:21:45 -05:00
Russell Cohen 22f85e12ae
Test unification (#72)
* Refactor CargoTomlGenerator to use Toml4J

* Generate Cargo.toml with a TOML lib & create unified test machinery

I'm going to hold off porting all the tests to use the new machinery until the builder refactor lands to avoid heinous conflicts.

* Fixup bad merge
2020-12-11 17:03:31 -05:00
Russell Cohen 30502ebcd9
Refactor Operation shape builders (#68)
* Refactor structure builders out of StructureGenerator

* Refactor Operation Shape

This commit builds on the builder refactoring to introduce `Operation`s as the top level object that users interact with. This has a number of improvements:

1. The operations page in the documentation is now clean and includes exactly the operations that are available.
2. Builders for Input shapes now actually return an `Operation`. In a follow-up commit, the `build()` method on input shapes will be
updated to accept a service configuration object.
3. The split-impl block for operation shapes has been removed.
4. Docs for operation shapes are now the documentation for the operation and not for the input
5. This sets us up for having a top level operation onto which we can attach a `from_response(..)` method in a follow-up PR to implement response parsing.
2020-12-11 10:19:55 -05:00
Russell Cohen 63fcc795ff
Fix a number of hygiene issues around namespacing and reserved words (#78)
* Fix a number of hygiene issues around namespacing and reserved words

* Enable opting out of Exception => Error
2020-12-10 13:58:56 -05:00
Russell Cohen 0af416fcb2
Add response protocol test support (#73)
* Add response protocol test support

* CR improvements
2020-12-08 10:26:04 -05:00
Russell Cohen 48b4ef6a32
Generated Combined Error Shapes (#71)
* 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
2020-12-07 16:56:30 -05:00
Russell Cohen 075d40949a
Deterministic operation generation (#70) 2020-12-04 14:50:54 -05:00