Commit Graph

1143 Commits

Author SHA1 Message Date
Matteo Bigoi c7b97dcc02
Codegenerate Python application example and add explicit cast during JSON deserialization (#1520)
Co-authored-by: John DiSanti <jdisanti@amazon.com>
2022-07-26 15:53:42 +00:00
Zelda Hessler 2ad87c0eed
feature: support flexible checksums (#1561)
feature: support flexible checksums
update: s3 model
update: CHANGELOG.next.toml
2022-07-26 15:14:49 +00:00
John DiSanti 7d2a6595f7
Add client creation example to SDK crate READMEs (#1571) 2022-07-25 22:30:03 +00:00
John DiSanti 24f0749e93
Add support for removing crates from the SDK (#1567) 2022-07-25 21:20:17 +00:00
John DiSanti 9f446647ae
Clean up independent crate versioning migration (#1566) 2022-07-25 19:34:07 +00:00
82marbag 3610085af9
Support server event streams (#1479)
* Support server event streams
* Rename EventStreamInput to EventStreamSender
* Custom event stream errors
* EventStreamSender and Receiver are parametrized also on event stream error types
* Pokemon service model updated
* Pokemon server event handler
* Pokemon client to test event streams
* EventStreamDecorator to make optional using SigV4 signing
* Use forInlineFun for all errors

Closes: #1157

Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>

Co-authored-by: John DiSanti <jdisanti@amazon.com>
2022-07-25 13:24:06 -04:00
Harry Barber 5edd9d265d
RFC: Logging in the Presence of Sensitive Data (#1536) 2022-07-22 21:33:41 +01:00
Fahad Zubair f1af4435ec
aws-smithy-http-server crates to be published as part of release cycle (#1563)
Include aws-smithy-http-server and aws-smithy-http-server-python in the list of crates that are automatically published to crates.io on each release of smithy-rs.
2022-07-21 22:50:22 +01:00
82marbag 5ee95433d8
Update JAVA_HOME (#1564)
Recently CI is failing with

> ERROR: JAVA_HOME is set to an invalid directory: /usr/lib/jvm/jre-11-openjdk
> Please set the JAVA_HOME variable in your environment to match the
> location of your Java installation.

Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
2022-07-21 17:38:01 +00:00
82marbag 5f49f7cc75
forbid timezone in rfc3339 (#1521)
* forbid rfc3339 timezone

According to [0], "Date time as defined by the date-time production
in RFC3339 section 5.6 with no UTC offset..."

This commit makes the parsing compliant.

[0] https://awslabs.github.io/smithy/1.0/spec/core/protocol-traits.html#timestampformat-trait

Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
2022-07-21 15:11:08 +01:00
AWS SDK Rust Bot 700cee65ca Update changelog 2022-07-20 17:48:27 +00:00
John DiSanti 010a234832 Expose `sleep_impl` configuration in `SdkConfig` (#1556) 2022-07-20 09:42:28 -07:00
John DiSanti 1023c5035a Make `imds::Client` implement `Clone` (#1557) 2022-07-20 09:42:28 -07:00
John DiSanti d9ac9959de Don't warn about home dir expansion for default profile paths (#1558) 2022-07-20 09:42:28 -07:00
John DiSanti 32122ce285 Remove warning for valid IMDS provider use-case (#1559) 2022-07-20 09:42:28 -07:00
John DiSanti ba9756478b
Version bump runtime crates (#1555) 2022-07-19 21:19:25 +00:00
John DiSanti 6143d90197
Enable independent crate versioning for SDK crates (#1540)
* Update `hydrate-readmes` to take versions from `versions.toml`
* Add cleanup TODO comments to `changelogger`
* Update SDK readme template
* Split up `generate-version-manifest` subcommand
* Eliminate the `aws.sdk.version` property
* Fallback to model hash comparison if model metadata claims no changes
* Add `acquire-base-image` to `release.yml`
* Use empty model metadata for SDK generation in CI
* Fix the `aws-config` version number in SDK crate readmes
2022-07-19 12:27:45 -07:00
Zelda Hessler 298748a606
fix: misspelled name (#1554) 2022-07-19 17:21:19 +00:00
Fahad Zubair 9ede23b123
Server SDK CHANGELOG.md file is created separately by the changelogger tool (#1513)
The affected target of a change (client, server, all) is shown in CHANGELOG.md

The meta tag for a change log entry in CHANGELOG.next.toml supports adding the affected target, as an example:
[smithy-rs]
...
meta = { "breaking" = false, "tada" = false, "bug" = false, "target" = "server" }
...

Possible values for target: [client, server, all]
2022-07-19 11:41:52 +01:00
John DiSanti e4d8dca25b
RFC: Customizable client operations (#1545)
Co-authored-by: Zelda Hessler <zhessler@amazon.com>
2022-07-18 16:46:15 -07:00
Zelda Hessler b32395bfcc
Feature: checksum related body-wrappers (#1502)
* add: checksum related body-wrappers
add: tests for checksum related body-wrappers

* add: aws-smithy-checksums to CrateSet.key

* add: missing base64::encoded_length fn

* update: use the checksum digest trait's output_size method to get checksum size
add: proptest for base64 encoded length
remove: old base64 encoded length test
remove: incorrect leftover comments and comment quotes

* remove: unnecessary pin

* remove: use of clone during checksum finalization
refactor: checksum fns are no longer fallible
refactor: HttpChecksum is now responsible for reporting size correctly
fix: don't consider trailers as part of ChecksumBody size hint

* remove: Taken error state
update: prefer if-let to match
fix: incorrect is_end_stream impl
refactor: use default trait impl for HttpChecksum::header_value

* fix: clippy lint

* add: header value tests

* undo: accidental retry changes

* add: http-checksum-related errors

* refactor: break up and modularize body wrappers
update: docs
update: ChecksumValidatedBody::new now takes a Box<dyn HttpChecksum>

* fix: broken test

* refactor: rename checksum body structs to be differentiated only by their module
2022-07-18 12:51:10 -05:00
Zelda Hessler 70c6a02555
update: impl From<DynConnector> for HttpConnector (#1549)
update: CHANGELOG.next.toml
2022-07-18 15:33:48 +00:00
Zelda Hessler e6005fb191
Feature: make retry strategy exponential backoff multiplier configurable (#1548)
* feature: make retry strategy backoff configurable
update: smithy client to respect configurable backoff
update: CHANGELOG.next.toml

* fix: calculate_exponential_backoff

* update: make the backoff calculation simpler
update: default backoff multiplier to be 1 second to better match previous retry behavior

* update: retry builder backoff multiplier default

* rename: backoff_multiplier to initial_backoff
update: calculate_exponential_backoff tests for readability

* remove: copypasted code

* update: CHANGELOG.next.toml
2022-07-15 11:22:47 -05:00
Josh Triplett c6193bd31d
`aws-config`: Fix compilation error with `rustls` and `native-tls` disabled (#1533)
* `aws-config`: Fix compilation error with `rustls` and `native-tls` disabled

The `ProviderConfig::with_tcp_connector` method uses
`aws_smithy_client::hyper_ext`, which only exists with the
`client-hyper` feature enabled. Add a feature enabling that, and enable
it by default.

Introducing this feature does not cause breakage, because aws-config
did not previously compile with `default-features = false` and neither
`rustls` nor `native-tls` enabled.

* CHANGELOG.next.toml: Update for aws-config compilation fix

* Fix doctest by adding feature gate

Co-authored-by: Russell Cohen <rcoh@amazon.com>
2022-07-13 11:26:09 -05:00
John DiSanti c220b03a18
Use endpoint config from aws-sdk-rust (#1543) 2022-07-12 09:43:00 -07:00
Harry Barber bbdde4bbc4
Fix RustWriter debug mode (#1523)
Debug mode is useful for tracing the origin of generated code. Currently `./gradlew codegen-server-test:check` will fail with it enabled.

This is caused by the following `rustfmt` bug https://github.com/rust-lang/rustfmt/issues/5425 which causes valid rust code to break after `cargo fmt`. One instance of this pattern is generated by `withBlock("$memberName: self.$memberName", ",")` found [here](46984ab91d/codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/generators/BuilderGenerator.kt (L252)).

To prevent such code being generated we disallow debug comment being introduced when the line is just a single `,`.
2022-07-08 13:55:00 +01:00
david-perez 1338063cdb
Remove erroneous reference to the base `Symbol` when mapping Rust types (#1439)
`.addReference(this)` adds a reference to the `Symbol` on which
`.mapRustType` was called. This is correct only when `f` is a function
that _wraps_ its input `RustType`; for example, when `f` wraps it in a
`Box` or constructs a `Vec`. However, the code is incorrect for an
arbitrary `f`; for example, when `f` _swaps_ the type.
2022-07-07 18:23:08 +00:00
John DiSanti db43d7a22e
Fix SDK smoketest model set (#1537) 2022-07-07 10:11:22 -07:00
david-perez cd0563020a
Use the `SymbolProvider` and `Model` directly from the Smithy plugins (#1438)
Despite all the decorators and protocols that we have, there aren't any
`RustCodegenDecorator`s or `ProtocolGeneratorFactory`s that are
modifying the base symbol provider that the Smithy plugin provides. So
we can use directly the base symbol provider everywhere and remove the
methods from these interfaces to make the code a little bit simpler.

Likewise, there isn't a single `ProtocolGeneratorFactory` that
transforms the base model that the Smithy plugin provides.
2022-07-06 16:48:55 +00:00
David Calavera b1d50b5611
Re-export aws_types::SdkConfig in aws_config (#1457)
* Re-export aws_types::SdkConfig in aws_config

This way people that want to access that structure don't have to add aws_types.

Signed-off-by: David Calavera <david.calavera@gmail.com>

* Add entry about SdkConfig to the changelog

Co-authored-by: Russell Cohen <rcoh@amazon.com>
2022-07-06 00:05:30 +00:00
John DiSanti 090b57d158
Clean up after release decoupling (#1518)
* Retain only the smoke test AWS models
* Address release decoupling TODO comments
2022-07-05 18:02:46 +00:00
Zelda Hessler b77c66cbf7
Feature: add support for aws-chunked content encoding (#1501)
* add: support for unsigned aws-chunked content encoding

* add: aws-smithy-checksums to CrateSet.key

* refactor: API of AwsChunkedBodyOptions
update: AwsChunkedBody to note we only support single chunks
remove: unnecessary `Option`s
remove: overly smart total_length_of_trailers_in_bytes in trailers_as_aws_chunked_bytes
update: use "where"-style declaration for `impl<Inner> Body for AwsChunkedBody<Inner>`
add: helpful data to trace logging
add: trailer len double check in AwsChunkedBody::poll_data
add: test for trailer len double check
add: assert to size_hint
fix: incorrect body emitted when body is empty
add: test for empty encoded body

* Update CHANGELOG.next.toml

Co-authored-by: John DiSanti <jdisanti@amazon.com>

* update: CHANGELOG.next.toml message

* refactor: aws-chunked trailer encoding and size calculation
update: when aws-chunked formatting a `HeaderMap`, header names with multiple values will be written out one value per line
remove: unnecessary AwsChunkedBodyOptions::stream_length method
add: trace fields
refactor: make inserting the final body CRLF more explicit
add: test to ensure trailer encoding and trailer len calculation stay in sync

* udpate: emit error instead of panicking for incorrect trailer length

* add: test ensuring trailer serialization and length calculation stay in sync for empty HeaderMap

* update: avoid repeated allocations in trailers_as_aws_chunked_bytes
fix: don't convert to str before getting len of HeaderValue

* add: aws-chunked body test for inner bodies that emit intermittent chunks
add: double check that stream_length used to create an `AwsChunkedBody` is correct.

Co-authored-by: John DiSanti <jdisanti@amazon.com>
2022-07-05 11:36:14 -05:00
david-perez e751ed6965
Make `ServerOperationRegistryGenerator` protocol-agnostic (#1525)
`ServerOperationRegistryGenerator` is the only server generator that is
currently not protocol-agnostic, in the sense that it is the only
generator that contains protocol-specific logic, as opposed to
delegating to the `Protocol` interface like other generators do.

With this change, we should be good to implement a
`RustCodegenDecorator` loaded from the classpath that implements support
for any protocol, provided the decorator provides a class implementing
the `Protocol` interface.

This commit also contains some style changes that are making `ktlint`
fail. It seems like our `ktlint` config was recently broken and some
style violations slipped through the cracks in previous commits that
touched these files.
2022-07-05 15:05:55 +00:00
Harry Barber 12b4943e03
Remove FromRequest and IntoResponse trait (#1527)
`async fn` are currently not supported by Rust. To allow for such syntax today, the [async_trait](https://docs.rs/async-trait/latest/async_trait/) macro eagerly `Box::pin`s the `async` block. This incurs an unnecessary allocation.

One instance where `async_trait` is used is on the [FromRequest](https://docs.rs/axum/latest/axum/extract/trait.FromRequest.html) method (inherited from [axum](https://docs.rs/axum/latest/axum/)). The use case for `FromRequest` in `axum` does not exist in our case, it is therefore a candidate for removal.

While `IntoResponse` does not involve the same boxing as `FromRequest`, it also does not need to be a trait - and so we remove it for symmetry. 

* Remove `FromRequest` and replace it with a static method

* Remove `IntoResponse` and replace it with a static method
2022-07-04 15:47:48 +01:00
david-perez 3a7c60c3b1
Remove superfluous use of the `async_trait` macro (#1522)
The `IntoResponse` trait does not have any async functions.
2022-07-04 13:37:46 +02:00
John DiSanti 46984ab91d
Fix Docker build-image `cargo-udeps` build (#1519) 2022-06-30 12:49:23 -07:00
Matteo Bigoi 5312ff1132
Export a usable Python implementation via shared library (#1476)
This PR add several functionalities to the Python/Rust code-generation, making it usable for models that are not using Streaming and Union shapes.

    * Export codegenerated shapes as shared library that can be imported by the Python interpreter.
    * Add complete end-to-end testing running in CI.
    * Register signals and handle workers processes lifecycle.
    * Use a custom SymbolProvider to override non-primitive types that are exposed to Python.
    * Implement support for DateTime.
    * Cast Python exception into Rust error types.
    * End to end testing suite with a Rust client calling a real Python server.
2022-06-30 16:11:58 +00:00
david-perez eb1cb074cb
Generate Rust docs for the server's `OperationRegistry` (#1498)
Including a quickstart example for the service being generated that the
user can copy and paste.
2022-06-30 11:26:40 +00:00
John DiSanti a94b4b4e95
Add missing arg to release publish step (#1511) 2022-06-29 12:57:58 -07:00
Harry Barber 8dd03fdf7f
Add getter methods to OperationExtension (#1466)
* Add `OperationExtension::namespace` and `OperationExtension::operation_name`.
2022-06-29 11:38:07 +00:00
Harry Barber 5a5aa2f3d6
Set Content-Length header in server responses (#1423)
* Add `Content-Length` header to non-streaming server responses

* Add a `Content-Length` checks to the existing `httpResponseTests`
2022-06-29 10:40:41 +00:00
AWS SDK Rust Bot 334f6dd203 Update changelog 2022-06-28 23:05:33 +00:00
John DiSanti 5fc23464f6
Fix path to install `publisher` tool in release workflow (#1510) 2022-06-28 22:08:23 +00:00
Zelda Hessler 3f108165aa
Update: swap pin-project for pin-project-lite (#1503)
* update: swap pin-project for pin-project-lite
* remove: pin attribute from `aws_smithy_http::body::Inner::Once` enum variant
* remove: unnecessary usage of pin-project
* Update CHANGELOG.next.toml

Co-authored-by: John DiSanti <jdisanti@amazon.com>
2022-06-28 14:01:39 -05:00
John DiSanti 23ca395698
Version bump (#1509) 2022-06-28 16:36:30 +00:00
John DiSanti dc8f1743b1
Retry Gradle daemon startup failures in `sdk-sync` (#1504) 2022-06-28 08:32:34 -07:00
Matteo Bigoi 149b92b3f1
Fix simple model error 'This operation uses the GET method in the trait, but the member is sent as the payload' (#1507)
Signed-off-by: Bigo <1781140+crisidev@users.noreply.github.com>
2022-06-28 15:22:35 +01:00
Kyle Thomson ed04cbcfe8
Fix platform issue when determining module name from file (#1505) 2022-06-28 11:56:59 +00:00
J.R. Hill a183204493
Add Japanese flavor text to the example pokemon service (#1480) 2022-06-28 12:37:30 +02:00
Joseph Klix 424d736768
Docker hop limit (#1449)
* Docker settings

add note on settings needed when using sdk inside docker container

* update changelog.next

* move to group relevant info

* mark code snippet as txt
2022-06-27 17:07:23 -04:00