Commit Graph

612 Commits

Author SHA1 Message Date
John DiSanti 3cdf49e6cb
Improve client tracing spans (#2044)
* Emit spans for implementers of map request middleware traits
* Instrument dispatch with its own span
* Fix trace span hierarchy
* Partially flatten the middleware span hierarchy
* Make `MapRequest::name` required
* Add sub-spans to the `load_response` span
2022-12-07 23:06:16 +00:00
John DiSanti 31f1d35b62
Establish default max idle connections on default connectors (#2064) 2022-12-07 20:00:36 +00:00
Russell Cohen ddf1421be2
allow parse_url functions to be unused (#2071) 2022-12-07 19:15:57 +00:00
Russell Cohen 6beec943ab
Endpoints 2.0 Integration pre-work (#2063)
* Split endpoint resolution middleware into two parts & refactor endpoint generation

* Endpoints 2.0 Integration pre-work

This PR does a 3 bits of pre-work ahead of ep2 integration:
1. Split endpoint resolution into two separate middlewares:
  1. A smithy native middleware that applies URI and headers
  2. An AWS middleware that applies the auth schemes
2. Add vendorParams support to the ProtocolTestGenerator so that protocol tests can insert a region.
3. Simplify endpoint resolution logic by allowing `make_operation` to fail when an endpoint cannot be resolved.

* Back out previous change to insert endpoint directly into the bag

* backout changes to property bag

* Update changelog & add more docs

* Fix AWS test

* Fix test
2022-12-07 13:24:34 -05:00
82marbag 4eccaada5b
Implement FromParts for Option, Result (#2068)
* Implement FromParts for Option, Result

Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
2022-12-07 12:04:00 +00:00
John DiSanti 18fc6923c5
Remove client body callbacks (#2065) 2022-12-06 20:18:48 +00:00
82marbag 3ecefff7bb
Tracing output json (#2060)
* Tracing output json

Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
2022-12-06 12:04:58 +00:00
Harry Barber 17cb98c975
Unhide new service builder and deprecate the prior (#1886)
Co-authored-by: david-perez <d@vidp.dev>
2022-12-02 18:31:00 +00:00
Harry Barber 5073a25bdb
Various small corrections to server documentation (#2050)
* Link to super from Handler and OperationService

* Note that structure documentation is from model

* Don't refer to ZSTs in operation_shape.rs opener

* Re-export everything from service to root

* Add reference to root documentation on service

* Fix spelling of MissingOperationsError

* #[doc(hidden)] for opaque_future

* Rename from-parts.md to from_parts.md

* Fix Connected link

* Use S type parameter and service as variable name

* Remove MissingOperation dead code

* Remove Operation header from operation.rs

* Remove reference to closures

* Document ConnectInfo<T> .0

* Add BoxBody documentation

* Rephrase operation.rs documentation

* Reference PluginPipeline from PluginStack

* Move the BoxBody documentation

* Document Plugin associated types

* Add example implementation for Plugin

* Link to plugin module from Plugin

* Improve FromParts/FromRequest documentation

* Remove links to doc(hidden) RuntimeError

* Add link from Upgradable to operation module
2022-12-02 13:56:35 +00:00
Russell Cohen 84ed110fcb
Add Endpoint Resolver Implementation (#2030)
* Add Endpoint Resolver Implementation

This commit adds `EndpointDecorator`, standard libary + tests that can be used to add endpoints 2.0 to the AWS SDK.

It _does not_ actually wire these things up. We'll follow up with a PR that actually integrates everything.

* CR Feedback

* CR feedback II
2022-12-01 19:39:19 +00:00
Luca Palmieri 3652538cb8
The TODO comment should not be visible in the public docs. (#2045) 2022-12-01 12:30:59 +00:00
Harry Barber 9057bd1f61
Improve extractor errors (#2041)
Co-authored-by: Luca Palmieri <20745048+LukeMathWalker@users.noreply.github.com>
2022-11-30 18:03:59 +00:00
Harry Barber 97b9bb7664
Add lambda extractors (#2038) 2022-11-30 15:28:56 +00:00
Harry Barber b67f49284e
Restore `into_make_service_with_connect_info` module (#2039) 2022-11-30 13:01:43 +00:00
Luca Palmieri 3a9a42bb16
Introduce an `aws-lambda` feature. (#2035)
* Introduce an `aws-lambda` feature.

* Add CHANGELOG

* Use the new and shiny feature syntax to avoid creating an implicit `lambda_http` feature.

* Add `aws-lambda` feature to the Python server. Enable the `aws-lambda` feature in our example. Be explicit in providing an implementation of request rejection for Box<dyn Error>.

* Add an `aws-lambda` feature flag to the generated Python-specific crate. We enable it by default to make sure the Lambda method ends up visible in the final Python wrapper library.
2022-11-29 15:48:48 +00:00
Harry Barber 27020be342
Improve service documentation (#2020)
Co-authored-by: Luca Palmieri <20745048+LukeMathWalker@users.noreply.github.com>

* Add module documentation to `plugin.rs`.

* Remove reference to `FromRequest` in `FromParts`.

* Improve `Route` documentation.
2022-11-25 18:14:28 +00:00
Harry Barber 86fd8f595a
Collect extractors into `request` module (#2008) 2022-11-22 11:51:17 +00:00
82marbag b2d280fcac
Multiple FromParts in handlers (#1999)
* Multiple FromParts in handlers

Handlers can have up to 8 extensions:
```
pub async fn handler(
    input: input::Input,
    ext0: Extension<...>,
    ext1: Extension<...>,
    ext2: Extension<...>,
    ext3: Extension<...>,
    ext4: Extension<...>,
    ext5: Extension<...>,
    ext6: Extension<...>,
    ext7: Extension<...>,
) -> Result<output::Output, error::Error> { ... }
```

Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
Co-authored-by: Harry Barber <hlbarber@amazon.co.uk>
2022-11-18 12:16:36 +00:00
Harry Barber ed5cd6e3af
Improve `Plugin` toolkit (#2003)
Co-authored-by: Julian Antonielli <julianantonielli@gmail.com>
Co-authored-by: Luca Palmieri <20745048+LukeMathWalker@users.noreply.github.com>
2022-11-18 11:47:13 +00:00
John DiSanti 06c23f65cc
Improve `Endpoint` panic-safety and ergonomics (#1984)
- `Endpoint::set_endpoint` no longer panics when called on an endpoint
  without a scheme
- `Endpoint::mutable` and `Endpoint::immutable` now both return a result
  so that constructing an endpoint without a scheme is an error
- `Endpoint::mutable` and `Endpoint::immutable` both now take a string
  instead of a `Uri` as a convenience
- `Endpoint::mutable_uri` and `Endpoint::immutable_uri` were added
  to construct an endpoint directly from a `Uri`
2022-11-17 00:17:22 +00:00
John DiSanti 8ef985ec49
Improve error doc comments around logging errors (#1990) 2022-11-16 19:51:15 +00:00
Luca Palmieri 044ebeac6f
Implement RFC 23, Part 2 - Plugin pipeline (#1971)
* Implement RFC 23, with the exception of PluginBuilder

* Update documentation.

* Avoid star re-exports.

* Elide implementation details in `Upgradable`.

* Update wording in docs to avoid personal pronouns.

* Update `Upgradable`'s documentation.

* Template the service builder name.

* Template MissingOperationsError directly.

* Code-generate an array directly.

* Sketch out the implementation of `PluginPipeline`.
Remove `PluginExt`.
Add a public constructor for `FilterByOperationName`.

* Ask for a `PluginPipeline` as input for the generated builder.

* Rename `add` to `push`.

* Remove Pluggable.
Rename `composer` module to `pipeline`.

* Remove all mentions of `Pluggable` from docs and examples.

* Fix punctuation.

* Rename variable from `composer` to `pipeline` in doc examples.

* Add a free-standing function for filtering.

* Rename.

* Rename.

* Update design/src/server/anatomy.md

Co-authored-by: david-perez <d@vidp.dev>

* Use `rust` where we do not need templating.

* Remove unused variable.

* Add `expect` message to point users at our issue board in case a panic slips through.

* Typo.

* Update `expect` error message.

* Refactor the `for` loop in ``requestSpecMap` into an `associateWith` call.

* Remove unnecessary bound - since `new` is private, the condition is already enforced via `filter_by_operation_name`.

* Use `Self` in `new`.

* Rename `inner` to `into_inner`

* Rename `concat` to `append` to correctly mirror Vec's API terminology.

* Fix codegen to use renamed method.

* Cut down the public API surface to key methods for a sequence-like interface.

* Add a note about ordering.

* Add method docs.

* Add Default implementation.

* Fix new pokemon bin example.

* Fix new pokemon bin example.

* Fix code-generated builder.

* Fix unresolved symbolProvider.

* Assign the `expect` error message to a variable.

* Do not require a PluginPipeline as input to `builder_with_plugins`.

* Reverse plugin application order.

* Upgrade documentation.

* Add a test to verify that plugin layers are executed in registration order.

* Add license header.

* Update middleware.md

* Typo.

* Fix more builder() calls.

Co-authored-by: david-perez <d@vidp.dev>
2022-11-16 18:10:51 +00:00
Luca Palmieri f13bb260a7
Implement RFC23 - Evolve the new service builder API (#1954)
* Implement RFC 23, with the exception of PluginBuilder

* Update documentation.

* Elide implementation details in `Upgradable`.

* Update wording in docs to avoid personal pronouns.

* Update `Upgradable`'s documentation.

* Template the service builder name.

* Template MissingOperationsError directly.

* Code-generate an array directly.

* Update design/src/server/anatomy.md

Co-authored-by: david-perez <d@vidp.dev>

* Use `rust` where we do not need templating.

* Remove unused variable.

* Add `expect` message to point users at our issue board in case a panic slips through.

* Typo.

* Update `expect` error message.

* Refactor the `for` loop in ``requestSpecMap` into an `associateWith` call.

* Fix new pokemon bin example.

* Fix new pokemon bin example.

* Fix unresolved symbolProvider.

* Assign the `expect` error message to a variable.

* Omit additional generic parameters in Upgradable when it's first introduced.

Co-authored-by: david-perez <d@vidp.dev>
2022-11-16 12:32:43 +00:00
John DiSanti 9f0bc36fa7
Make `SdkError::into_service_error` infallible (#1974) 2022-11-16 02:17:44 +00:00
John DiSanti 8dfe5a1f70
Revamp errors in `aws-smithy-types-convert` and `aws-smithy-xml` (#1917) 2022-11-15 23:21:46 +00:00
John DiSanti e36d34692a
Revamp errors in `aws-smithy-types` (#1893) 2022-11-15 21:27:46 +00:00
John DiSanti 7b6d2d4b25
Revamp errors in `aws-smithy-json` (#1888) 2022-11-15 20:35:55 +00:00
John DiSanti fba88df3ee
Revamp errors in `aws-smithy-http` (#1884) 2022-11-15 19:18:26 +00:00
david-perez b43905eabc
Builders of builders (#1342)
This patchset, affectionately called "Builders of builders", lays the
groundwork for fully implementing [Constraint traits] in the server SDK
generator. [The RFC] illustrates what the end goal looks like, and is
recommended prerrequisite reading to understanding this cover letter.

This commit makes the sever deserializers work with _unconstrained_ types
during request parsing, and only after the entire request is parsed are
constraints enforced. Values for a constrained shape are stored in the
correspondingly unconstrained shape, and right before the operation input is
built, the values are constrained via a `TryFrom<UnconstrainedShape> for
ConstrainedShape` implementation that all unconstrained types enjoy. The
service owner only interacts with constrained types, the unconstrained ones are
`pub(crate)` and for use by the framework only.

In the case of structure shapes, the corresponding unconstrained shape is their
builders. This is what gives this commit its title: during request
deserialization, arbitrarily nested structures are parsed into _builders that
hold builders_. Builders keep track of whether their members are constrained or
not by storing its members in a `MaybeConstrained`
[Cow](https://doc.rust-lang.org/std/borrow/enum.Cow.html)-like `enum` type:

```rust
pub(crate) trait Constrained {
    type Unconstrained;
}

#[derive(Debug, Clone)]
pub(crate) enum MaybeConstrained<T: Constrained> {
    Constrained(T),
    Unconstrained(T::Unconstrained),
}
```

Consult the documentation for the generator in `ServerBuilderGenerator.kt` for
more implementation details and for the differences with the builder types the
server has been using, generated by `BuilderGenerator.kt`, which after this
commit are exclusively used by clients.

Other shape types, when they are constrained, get generated with their
correspondingly unconstrained counterparts. Their Rust types are essentially
wrapper newtypes, and similarly enjoy `TryFrom` converters to constrain them.
See the documentation in `UnconstrainedShapeSymbolProvider.kt` for details and
an example.

When constraints are not met, the converters raise _constraint violations_.
These are currently `enum`s holding the _first_ encountered violation.

When a shape is _transitively but not directly_ constrained, newtype wrappers
are also generated to hold the nested constrained values. To illustrate their
need, consider for example a list of `@length` strings. Upon request parsing,
the server deserializers need a way to hold a vector of unconstrained regular
`String`s, and a vector of the constrained newtyped `LengthString`s. The former
requirement is already satisfied by the generated unconstrained types, but for
the latter we need to generate an intermediate constrained
`ListUnconstrained(Vec<LengthString>)` newtype that will eventually be
unwrapped into the `Vec<LengthString>` the user is handed. This is the purpose
of the `PubCrate*` generators: consult the documentation in
`PubCrateConstrainedShapeSymbolProvider.kt`,
`PubCrateConstrainedCollectionGenerator.kt`, and
`PubCrateConstrainedMapGenerator.kt` for more details. As their name implies,
all of these types are `pub(crate)`, and the user never interacts with them.

For users that would not like their application code to make use of constrained
newtypes for their modeled constrained shapes, a `codegenConfig` setting
`publicConstrainedTypes` has been added. They opt out of these by setting it to
`false`, and use the inner types directly: the framework will still enforce
constraints upon request deserialization, but once execution enters an
application handler, the user is on their own to honor (or not) the modeled
constraints. No user interest has been expressed for this feature, but I expect
we will see demand for it. Moreover, it's a good stepping stone for users that
want their services to honor constraints, but are not ready to migrate their
application code to constrained newtypes. As for how it's implemented, several
parts of the codebase inspect the setting and toggle or tweak generators based
on its value. Perhaps the only detail worth mentioning in this commit message
is that the structure shape builder types are generated by a much simpler and
entirely different generator, in
`ServerBuilderGeneratorWithoutPublicConstrainedTypes.kt`. Note that this
builder _does not_ enforce constraints, except for `required` and `enum`, which
are always (and already) baked into the type system. When
`publicConstrainedTypes` is disabled, this is the builder that end users
interact with, while the one that enforces all constraints,
`ServerBuilderGenerator`, is now generated as `pub(crate)` and left for
exclusive use by the deserializers. See the relevant documentation for the
details and differences among the builder types.

As proof that these foundations are sound, this commit also implements the
`length` constraint trait on Smithy map and string shapes. Likewise, the
`required` and `enum` traits, which were already baked in the generated types
as non-`Option`al and `enum` Rust types, respectively, are now also treated
like the rest of constraint traits upon request deserialization. See the
documentation in `ConstrainedMapGenerator.kt` and
`ConstrainedStringGenerator.kt` for details.

The rest of the constraint traits and target shapes are left as an exercise to
the reader, but hopefully the reader has been convinced that all of them can be
enforced within this framework, paving the way for straightforward
implementations. The diff is already large as it is. Any reamining work is
being tracked in #1401; this and other issues are referenced in the code as
TODOs.

So as to not give users the impression that the server SDK plugin _fully_
honors constraints as per the Smithy specification, a validator in
`ValidateUnsupportedConstraintsAreNotUsed.kt` has been added. This traverses
the model and detects yet-unsupported parts of the spec, aborting code
generation and printing informative warnings referencing the relevant tracking
issues. This is a regression in that models that used constraint traits
previously built fine (even though the constraint traits were silently not
being honored), and now they will break. To unblock generation of these models,
this commit adds another `codegenConfig` setting,
`ignoreUnsupportedConstraints`, that users can opt into.

Closes #1714.

Testing
-------

Several Kotlin unit test classes exercising the finer details of the added
generators and symbol providers have been added. However, the best way to test
is to generate server SDKs from models making use of constraint traits. The
biggest assurances come from the newly added `constraints.smithy` model, an
"academic" service that _heavily_ exercises constraint traits. It's a
`restJson1` service that also tests binding of constrained shapes to different
parts of the HTTP message. Deeply nested hierarchies and recursive shapes are
also featured.

```sh
./gradlew -P modules='constraints' codegen-server-test:build
```

This model is _additionally_ generated in CI with the `publicConstrainedTypes`
setting disabled:

```sh
./gradlew -P modules='constraints_without_public_constrained_types' codegen-server-test:build
``````

Similarly, models using currently unsupported constraints are now being
generated with the `ignoreUnsupportedConstraints` setting enabled.

See `codegen-server-test/build.gradle.kts` for more details.

[Constraint traits]: https://awslabs.github.io/smithy/2.0/spec/constraint-traits.html
[The RFC]: https://github.com/awslabs/smithy-rs/pull/1199
2022-11-15 14:06:23 +00:00
82marbag a438b7c6eb
Service with ConnectInfo (#1955)
* Service with ConnectInfo

Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
2022-11-15 10:44:22 +00:00
Zelda Hessler 15f2fbb773
Feature: configurable connectors for AWS clients (#1918)
* feature: make HTTP connectors configurable

* add: test for HTTP connector configuration customization
add: impl<B> From<TestConnection<B>> for HttpConnector
add: impl From<CaptureRequestHandler> for HttpConnector
add: impl From<NeverConnector> for HttpConnector
add: impl From<ReplayingConnection> for HttpConnector

* add: to_vec method to AggregatedBytes
update: method param names of FluentClientGenerics.sendBounds to be more explicit
update: restructure s3/s3control tests to be uniform in structure

* update: CHANGELOG.next.toml
update: codegen `impl From<&SdkConfig> for Builder` to support HTTP connectors

* update: CHANGELOG entry references

* add: missing copyright header

* fix: clippy lint

* format: run cargo fmt

* format: run cargo fmt on aws_smithy_client::dvr modules

* format: run ktlintFormat

* refactor: use from_conf instead of from_conf_conn
remove: from_conf_conn

* update: impl From<SmithyConnector> for HttpConnector
remove: other From<T> for HttpConnector impls
update: HttpConnector config setter examples

* update: CHANGELOG.next.toml

* Update CHANGELOG.next.toml

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

* update: CHANGELOG.next.toml
remove: obsolete test
update: `ConfigLoader::http_connector` setter method

* Update CHANGELOG.next.toml

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

* Update CHANGELOG.next.toml

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

* Update CHANGELOG.next.toml

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

* Apply suggestions from code review

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

* update: aws_config::loader::ConfigLoader doc comments
update: CHANGELOG.next.toml examples

* fix: doc issues
add: reëxport aws_smithy_types::endpoint module to aws-config

* format: run rustfmt in the weird CI way to get it to actually format.

* fix: incorrect reëxport

* add: "aws_smithy_http::endpoint" to allowed external types for aws-config

* update: move `hyper-rustls` to deps so that it doesn't break exotic arch CI check

* remove: `hyper-rustls` dep because it's not actually needed

* fix: aws-types dep issue blocking exotic arch CI check

* fix: broken doc comment

Co-authored-by: John DiSanti <jdisanti@amazon.com>
2022-11-14 20:58:44 +00:00
82marbag 9abad1acf0
Do not use deprecated from_timestamp from chrono (#1980)
* Do not use deprecated from_timestamp from chrono

CI is failing because
[from_timestamp](https://docs.rs/chrono/latest/chrono/naive/struct.NaiveDateTime.html#method.from_timestamp)
is now deprecated.

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

* Update changelog

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

* Fix error

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

* Use with_ymd_and_hms

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

Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
2022-11-14 12:27:04 -05:00
John DiSanti 12f217b38f
Revamp errors in `aws-smithy-eventstream` (#1873) 2022-11-11 23:25:13 +00:00
John DiSanti 6aef53a0b3
Revamp errors in `aws-smithy-checksums` (#1850) 2022-11-11 22:29:36 +00:00
Russell Cohen 16d212e2b7
Smithy 1.26.2 upgrade / ensure that even empty lists are serialized (#1972)
* Ensure that even empty lists are serialized

* Add must_use annotation & unit test

* Add changelog entry

* Remove test from list of failing tests
2022-11-10 17:09:43 +00:00
Burak 4f76e35f2a
Python: map Python middlewares to Tower layers (#1871)
* Python: map Python middlewares to Tower layers

* Make middleware layer infallible

* Use message and status code from `PyMiddlewareException`

* Introduce `FuncMetadata` to represent some information about a Python function

* Improve middleware errors

* Add missing copyright headers

* Allow accessing and changing request body

* Allow changing response

* Add some documentation about moving data back-and-forth between Rust and Python

* Add `mypy` to Pokemon service and update typings and comments for middlewares

* Add or update comments on the important types

* Add Rust equivalent of `collections.abc.MutableMapping`

* Add `PyHeaderMap` to make `HeaderMap` accessible from Python

* Apply suggestions from code review

Co-authored-by: Luca Palmieri <20745048+LukeMathWalker@users.noreply.github.com>

* Improve logging

* Add `RichPyErr` to have a better output for `PyErr`s

* Better error messages for `PyMiddlewareError` variants

* Factor out repeating patterns in tests

* Preserve `__builtins__` in `globals` to fix tests in Python 3.7.10 (our CI version)

* Export `RichPyErr` to fix `cargo doc` error

* Apply suggestions from code review

Co-authored-by: Matteo Bigoi <1781140+crisidev@users.noreply.github.com>

* Add missing SPDX headers

* Document that `keys`, `values` and `items` on `PyMutableMapping` causes clones

Co-authored-by: Luca Palmieri <20745048+LukeMathWalker@users.noreply.github.com>
Co-authored-by: Matteo Bigoi <1781140+crisidev@users.noreply.github.com>
2022-11-10 16:22:43 +00:00
Julian Antonielli 1844660c61
Remove our `base64` implementation in favour of `base64-simd` (#1938)
* Replace our base64 implementation with one based on `base64-simd`

* Bump Rust MSRV to 1.62.1

* Unmark base64-related tests as failing

* Use `usize` for `base64::encoded_length`

* Run Rust 1.62.1 on CI

* Don't use external `base64_simd::Error` type in public interface

* Add initial criterion bench setup for base64

* Compare `base64_simd::encode` vs Smithy's `encode`

* Use string length for `BenchmarkId`

* Compare `base64_simd::decode` vs Smithy's `decode`

* Compare `base64_simd::encoded_length` vs Smithy's `encoded_length`
2022-11-09 12:08:17 +00:00
John DiSanti 9a6de1f533
Create `DisplayErrorContext` and use it in tracing statements (#1848)
* Add `DisplayErrorContext` to `aws-smithy-types`
* Apply `DisplayErrorContext` to all tracing statements
2022-11-04 21:09:15 +00:00
John DiSanti e2e0d93545
Fix retry config doc comments and remove re-export (#1935) 2022-11-04 00:09:10 +00:00
Harry Barber a026f6f6d6
Add FromParts documentation (#1930) 2022-11-01 18:04:39 +00:00
ysaito1001 f0b7f55bf5
Fix cargo audit issue on chrono (#1907)
* Avoid the chrono crate depending on the time crate

This commit is in response to RUSTSEC-2020-0071 where there is a
potential segfault in the time crate. The aws-smithy-types-convert
crate now disables the default features of the chrono crate so that
it will not depend on the time crate.

* Depend on lambda_http without RUSTSEC-2020-0071

This commit updates the version of lambda_http used by aws-smithy-http-server
and aws-smithy-http-server-python to 0.7.0. The prior version 0.6.0 of
lambda_http used the chrono crate in a way that exposed a security issue
described in RUSTSEC-2020-0071. By switching to 0.7.0 of lambda_http, those
two crates do not exhibit vulnerabilities as reported by cargo audit.

* Bump minor version of lambda_http in pokemon-service

This commit updates the version of `lambda_http` used by `pokemon-service`
from 0.6.0 to 0.7.0. This is in sync with the fact that both
`aws-smithy-http-server` and `aws-smithy-http-server-python` now depend
on 0.7.0 of `lambda_http`. Failing to do so would cause `pokemon-service`
to fail to compile due to an error at `lambda_http::run(handler)` in the
main function of the `pokemon-service-lambda` binary:
the trait `Service<lambda_http::http::Request<lambda_http::Body>>` is not
implemented for `LambdaHandler<aws_smithy_http_server::routing::Router>`

* Depend on lambda-http 0.7.1

This commit updates the version of `lambda_http` from 0.7.0 to 0.7.1 in
the crates within the top-level `rust-runtime` workspace. These updates
are needed to solve the issue described in awslabs/aws-lambda-rust-runtime#556

* Update CHANGELOG.next.toml

* Address https://github.com/awslabs/smithy-rs/pull/1907\#pullrequestreview-1161609833

Co-authored-by: Saito <awsaito@c889f3b5ddc4.ant.amazon.com>
Co-authored-by: Zelda Hessler <zhessler@amazon.com>
2022-10-31 20:06:09 +00:00
Zelda Hessler 4c852b1d0b
Add operation metadata to property bag just before sending request through middleware (#1920)
* update: add operation metadata to property bag during `make_operation`
add: test ensuring metadata is added to property bag
add: CHANGELOG.next.toml entry

* update: use new strategy for op metadata insertion
update: a new strategy requires a new test
update: CHANGELOG.next.toml

* format: run cargo fmt
2022-10-28 15:30:41 -05:00
Russell Cohen fc57e13cad
Update changelog and use you task::spawn helper (#1915) 2022-10-27 15:09:18 +00:00
david-perez f92855f6e0
Bump `wrk-api-bench` to v0.0.8 (#1908)
The current version is vulnerable. See
https://github.com/crisidev/wrk-api-bench-rs/pull/1.
2022-10-27 14:13:37 +00:00
Russell Cohen 16e34a5dec
Fix FnStream generator polling to prevent poll-after-ready (#1903)
Co-authored-by: Zelda Hessler <zhessler@amazon.com>
2022-10-26 17:32:24 +00:00
david-perez fb631b4f4c
Export `Router` from `aws-smithy-http-server` crate root again (#1910)
This reverts unintentional breakage introduced in
`aws-smithy-http-server` v0.51.0.
2022-10-26 17:09:05 +02:00
82marbag 50e85724b4
Route::new in upgrade (#1891)
* Route::new in upgrade

Move the creation of Routes in Upgradable to have a cleaner sequence of
constraints in ServiceBuilder::build

Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
2022-10-26 09:44:37 +00:00
ysaito1001 b4f294c277
Replace bool with enum for a function parameter of label::fmt_string (#1875)
* Replace bool with enum in label::fmt_string

This commit addresses code smell where the said function takes a bool
to decide whether it percent-encodes the UTF-8 encoding of the given
string. For clarity, we define an enum EncodingStrategy so that we
can see the callers' intent at the call sites by reading the variant
names rather than true/false.

* Update CHANGELOG.next.toml

* Update CHANGELOG.next.toml

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

* Make test use updated function signature of fmt_string

This commit modifies a call site for the updated function signature of
`aws_smithy_http:🏷️:fmt_string`, otherwise the test would fail to
compile, leading to a failure in CI.

Co-authored-by: Saito <awsaito@c889f3b5ddc4.ant.amazon.com>
Co-authored-by: John DiSanti <jdisanti@amazon.com>
Co-authored-by: Zelda Hessler <zhessler@amazon.com>
2022-10-25 20:39:28 +00:00
Matteo Bigoi 7e666dab8b
Support PowerPC architecture for sigv4 signature (#1847)
* Use hmac and sha2 instead of ring on powerpc

* Enable aws-sig-auth in CI

* Update CHANGELOG

* Run tests against exotic platforms

* Run tests only against aws rust runtime

* PowerPC 32 and 64 bit should be fully testable now

* Maybe this time build and test will work

* Add licence header to hmac.rs

* Properly use finalized_fixed

* Revert leftover

* Temporary disable crc32c test on powerpc

* Temporary disable system_time_conversion_test on 32bit CPUs

* Disable other 3 tests on 32bit

* Temporarily disable last test

* Update CHANGELOG and document TODOs with issues

* Run aws-smithy-client tests in CI with crosscompiled local openssl

* Simplify CI script

* Use correct curl options

* Use the right OS for i686

* Looks like I finally foung the right os type for i686

* Add `tcp` feature to `hyper` to get tests compiling.

* Enable verbose logging to debug CI failure in cross.

* Use pre-built openSSL on i686

* Fix empty spaces.

* Set environment variables based on matrix.target

* Remove all usages of `ring` from `aws-sigv4`. It ensures broader platform compatibility and higher performance.

* Update changelog entries.

* Remove redundant dev dependencies.

Co-authored-by: Luca Palmieri <20745048+LukeMathWalker@users.noreply.github.com>
2022-10-25 17:05:55 +00:00
Harry Barber c18b1a0ab7
Add middleware documentation (#1844)
* Tweak plugin.rs documentation

* Add middleware.md
2022-10-25 12:21:20 +00:00
John DiSanti 03b83473ff
Pin `derive_arbitrary` version (#1887) 2022-10-21 09:40:28 -05:00
Zelda Hessler b4f0b28b5c
update: aws-smithy-xml "xmlparser" dep to v0.13.5 (#1880)
rename: aws-smithy-xml test with misleading name
Co-authored-by: dvc94ch <david@craven.ch>
2022-10-19 18:45:31 +00:00
Julian Antonielli 007f1bfc7c
Use pin-utils crate instead of vendoring pin_mut (#1862) 2022-10-19 10:28:56 +01:00
Burak c5dae879a5
Python: Migrate to new service builder (#1846)
* Python: Migrate to new service builder

* Fix orderings of imports
2022-10-17 15:52:37 +01:00
Harry Barber 55d16b1131
Make protocol ZSTs match shape ID names (#1858) 2022-10-17 14:00:43 +00:00
Luca Palmieri 18d969e160
Upgrade to Rust 1.62.0 (#1825)
* Run clippy --fix for Rust 1.62.0 and format the resulting code

* Run clippy --fix on all targets

* Run clippy --fix with all features enabled

* Avoid extra allocation

* Use more idiomatic assert

* Ignore noisy lint

* Update pyo3 and pyo3-asyncio to 0.17.0

* Implement Eq on aws-smithy-checksums::Error

* Implement Eq on Protocol

* Replace conditionals with range-containment

* Implement Eq on types in aws-smithy-types

* Implement Eq on types in aws-smithy-http-server-python

* Implement Eq on types in aws-smithy-eventstream

* Implement Eq on types in aws-smithy-xml

* Implement Eq on aws-sigv4

* Update CI to use Rust 1.62.0

* Add Eq for generated types that implement PartialEq

* Allow clippy::needless_return in generated code

* Remove unnecessary reborrow in http_serde

* Remove unnecessary borrow in operation_deser

* Add CHANGELOG entries

* Revert "Add Eq for generated types that implement PartialEq"

This reverts commit 5169bd95aa.

* Update pyo3 and pyo3-asyncio in generated code for python server

* Allow clippy::derive_partial_eq_without_eq on structs and builders

* Run clippy on tools

* Fix accidental move in generated code

* Revert "Allow clippy::derive_partial_eq_without_eq on structs and builders"

This reverts commit 068c63ca20.

* Fix another accidental move in generated code

* Undo unwanted change to model

* Re-add reborrow in HttpBindingGenerator

* Fix clippy::format-push-string in changelogger

* Fix more uses of str.push_str(&format!(...))

* Remove unnecessary parenthesis

* Run ktlint

* Update aws/rust-runtime/aws-http/src/content_encoding.rs

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

* Update aws/rust-runtime/aws-http/src/content_encoding.rs

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

* Ignore doctest for non-exported macro

Rust 1.62 introduced a breaking change where doctests for non-exported
macros are now run by default. These don't compile because the macro
can't be imported in it.
See https://github.com/rust-lang/rust/issues/97030 for more info.

* Run cargo fmt

* Use $crate instead of crate in macro

* Revert "Implement Eq on types in aws-smithy-types"

This reverts commit c45a6b5a56.

* Revert "Implement Eq on types in aws-smithy-eventstream"

This reverts commit 78f4b07344.

* Revert "Implement Eq on types in aws-smithy-xml"

This reverts commit 590f01af73.

* Revert "Implement Eq on aws-sigv4"

This reverts commit d78bb62124.

* Revert "Implement Eq on types in aws-smithy-http-server-python"

This reverts commit f2cd901884.

* Revert "Implement Eq on aws-smithy-checksums::Error"

This reverts commit 5da170405e.

Co-authored-by: Julian Antonielli <julianantonielli@gmail.com>
Co-authored-by: John DiSanti <jdisanti@amazon.com>
2022-10-17 09:32:12 +01:00
Harry Barber d879da1f14
Add PluginExt extension trait and FilterByOperationName plugin (#1837)
* Make Operation fields public

* Split into modules and add FilterByOperationName
2022-10-11 22:54:24 +00:00
Harry Barber bf3fbc2e1d
Add "Anatomy of a Service" documentation (#1782)
* Rust documentation improvements

* Add "Anatomy of a Service" documentation
2022-10-11 18:40:49 +00:00
Burak eb6ffe3520
Lambda support for Python servers (#1807)
* Allow running Python servers with Lambda handler

* Fix doctests

* Add `Running servers on AWS Lambda` section to docs

* Remove empty spaces from `README` to make linter happy

* Rename `run_lambda_server` to `run_lambda_handler`

* Add more comments to example `Dockerfile`

* Fix capitalization of logs

* Preserve original formatting of `PythonApplicationGenerator.kt`
2022-10-11 12:03:44 +01:00
Luca Palmieri b547045a5a
Add a new CI job to check that smithy-rs compiles on 32bit Linux-based targets (#1812)
* Replace AtomicU64 with AtomicUsize to prevent compilation issues on 32 bits platforms.

* Make sure that Rust tests compile on MacOS.

* Add CHANGELOG next entry.

* Add a new CI job to check that smithy-rs compiles on 32bit Linux-based targets.

* No trailing commas pretty please.

* Point cross at the manifest explicitly.

* Skip crates with a Python dependency. Exercise all features.

* Install required dependencies.

* Do not fail fast, we want to see the result on all platforms.

* Set paths for both commands.

* Openssl must be installed inside the cross Docker container, not on the host machine.

* Fix connector setup if `rustls` feature is not enabled.

* Restrict feature set on powerpc.

* Pass openssl env variables to the cross Docker container

* Split in two commands.

* Enable debug level logs.

* Remove openssl feature (temporarily).

* Raise verbosity.

* Trigger CI

* `native-tls`, here we go again.

* Clean up.

* Trigger CI

* Trigger CI

* Add pkg-config.

* Change include path to include arch

* Trigger CI

* Allow workflow_dispatch on ci-pr to enable triggering this CI workflow from the GitHub web interface.

* Trigger CI? Why are you doing this to me GitHub?

* Trigger CI? Are you alive GitHub?

* Fix env variables for openssl

* Use features only for rust-runtime crates.

* Check all feature combinations for aws-smithy-client

* Dry-up env variables.

* A rogue `echo` was missing

* Feature-gate doc tests based on the features they require.

* Put .github folder under shared ownership.

* Fix docs.

* Fix feature selection for doctest.

* We are using methods that are only available if rustls is enabled - adjust feature gates accordingly.

* Remove workflow dispatch trigger.
2022-10-10 17:50:37 +00:00
Harry Barber 78022d69ef
Remove Protocol enum (#1829)
* Remove Protocol enum

* Update Python implementation
2022-10-10 14:29:37 +01:00
Luca Palmieri 1b2b42d6ae
Support 32bits targets (#1811)
* Replace AtomicU64 with AtomicUsize to prevent compilation issues on 32 bits platforms.

* Make sure that Rust tests compile on MacOS.

* Add CHANGELOG next entry.
2022-10-06 10:17:47 +01:00
david-perez 4ba6063f25
Move all binaries in the Pokémon service example under `src/bin` (#1788)
We're currently being inconsistent in that only the TLS example is under
`src/bin`, but the other two are under `src/`.
2022-10-05 11:49:06 +00:00
Burak 7fb7e177d0
Simplify Python Pokemon service (#1773)
* Simplify Python Pokemon service

* Use `threading.Lock` instead of `multiprocessing.Lock`

Co-authored-by: Matteo Bigoi <1781140+crisidev@users.noreply.github.com>

* Explain why we need to pass `force=True`

* Add comment about synchronization of `Context` class

Co-authored-by: Matteo Bigoi <1781140+crisidev@users.noreply.github.com>
2022-10-03 15:03:17 +01:00
kastolars 4cfac14d49
Getters added to ConfigImpl (#1761) 2022-09-29 16:43:07 +00:00
Harry Barber dcfb85578e
Add Instrumentation documentation (#1772)
* Add documentation covering instrumentation approaches for Smithy Rust.

* Tweak the logging in the Pokemon service to better exemplify instrumentation.
    * Remove `TraceLayer` which violates sensitivity contract.
    * Switch to [Pretty](https://docs.rs/tracing-subscriber/latest/tracing_subscriber/fmt/format/struct.Pretty.html) logs to better showcase the outputs.

* Update [Logging in the Presence of Sensitive Data](https://github.com/awslabs/smithy-rs/pull/1536) checklist.
* Rename `logging` module to `instrumentation` to improve coherence across struct names and documentation.
2022-09-28 12:57:48 +01:00
John DiSanti 8e0b440437
Improve timeout config ergonomics and add SDK default timeouts (#1740)
* Overhaul timeout configuration
* Improve resiliency re-exports
* Refactor Smithy client retry config handling in builder
* Remove non-standard timeout env vars and profile keys
* Break operation customization codegen into its own file
* Move operation customization into a submodule
* Improve operation customization re-exports
* Add integration tests for read and connect timeouts
* Fix connector timeout config in the Smithy `Client` builder
* Rename `HttpSettings` to `ConnectorSettings`
2022-09-27 01:15:23 +00:00
Harry Barber 42a84576ac
Vend tracing instrumentation as a Plugin (#1738)
* Add InstrumentLayer and InstrumentPlugin

* Add Sensitivity codegen
2022-09-26 19:33:41 +01:00
Harry Barber 004eb68793
Updates and fixes to HttpSensitivityGenerator (#1755)
* Simplify sensitivity detection logic by assuming bindings only exist at top level input/output.

* Fix greedy label logic - they can now exist alongside of normal labels.

* Fix `httpPrefixHeader` false positive.

* Export `RequestFmt` and `ResponseFmt` types alongside the closures.

* More extensive use of `Writable` to improve readability.
2022-09-26 16:33:57 +01:00
Harry Barber 9405f00014
Cleanup pokemon.smithy (#1763)
* Remove Operation suffix

* Remove reuse of @output

* Add full-stops

* Rename to {Verb}{Qualifier}{Noun}

* Symlink pokemon operations

Co-authored-by: Matteo Bigoi <1781140+crisidev@users.noreply.github.com>
2022-09-23 17:37:32 +00:00
Matteo Bigoi e5c8cf3061
[Python] Allow to run pure Python request middlewares inside a Tower service (#1734)
## Motivation and Context
* Customers want to be able to implement simple middleware directly in Python. This PR aims to add the initial support for it.
* Improve the idiomatic experience of logging by exposing a handler compatible with Python's standard library `logging` module.

## Description
### Middleware
A middleware is defined as a sync or async Python function that can return multiple values, following these rules:

* Middleware not returning will let the execution continue without changing the original request.
* Middleware returning a modified Request will update the original request before continuing the execution.
* Middleware returning a Response will immediately terminate the request handling and return the response constructed from Python.
* Middleware raising MiddlewareException will immediately terminate the request handling and return a protocol specific error, with the option of setting the HTTP return code.
* Middleware raising any other exception will immediately terminate the request handling and return a protocol specific error, with HTTP status code 500.

Middlewares are registered into the Python application and executed in order of registration.

Example:

from sdk import App
from sdk.middleware import Request, MiddlewareException

app = App()

@app.request_middleware
def inject_header(request: Request):
    request.set_header("x-amzn-answer", "42")
    return request

@app.request_middleare
def check_header(request: Request):
    if request.get_header("x-amzn-answer") != "42":
        raise MiddlewareException("Wrong answer", 404)

@app.request_middleware
def dump_headers(request: Request):
    logging.debug(f"Request headers after middlewares: {request.headers()}")

**NOTE: this PR only adds support for request middlewares, which are executed before the operation handler. Response middlewares, executed after the operation are tracked here: https://github.com/awslabs/smithy-rs/issues/1754.**

### Logging
To improve the idiomatic experience, now logging need to be configured from the Python side by using the standard `logging` module. This allows customers to opt-out of our `tracing` based logging implementation and use their own and logging level is now driven by Python.

import logging
from sdk.logging import TracingHandler

logging.basicConfig(level=logging.INFO, handlers=[TracingHandler.handle()])

Signed-off-by: Bigo <1781140+crisidev@users.noreply.github.com>
Co-authored-by: Burak <burakvar@amazon.co.uk>
2022-09-22 18:01:48 +00:00
82marbag 43e3e29840
Expand protocol layouts (#1753)
Split runtime protocols layout

Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
2022-09-22 09:10:51 +00:00
Nicolas Farrier ff13b087fe
Run `cargo clippy` when building the Pokémon Service (#1742) 2022-09-21 11:26:02 +00:00
Vojtech Kral b02f9ade3c
aws-smithy-http-tower: Lower log level of two info logs (#1735) 2022-09-19 17:40:26 +00:00
82marbag 0313a3c7b8
Allow third-party devs to write custom plugins for service builders (#1736)
* Allow custom layers to every operation

Third-party developers can add custom functions to a service builder,
through a `BuilderModifier`.
These functionalities are applied to every operation of that service.

An example of a builder modifier can be found in
rust-runtime/aws-smithy-http-server/examples/pokemon-service/lib.rs

Signed-off-by: Harry Barber <hlbarber@amazon.co.uk>
Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
Co-authored-by: Harry Barber <hlbarber@amazon.co.uk>
2022-09-16 08:53:54 +00:00
John DiSanti e6177b3dc2
Fix native Smithy client retry and retry response errors (#1717)
* Fix retry for native Smithy clients
* Treat `SdkError::ResponseError` as a retryable transient failure
* Rename `ClassifyResponse` to `ClassifyRetry`
* Rename 'policy' to 'classifier' in AWS SDK public API
* Rename `AwsResponseClassifier` to `AwsResponseRetryClassifier`

Co-authored-by: Zelda Hessler <zhessler@amazon.com>
2022-09-14 20:36:17 +00:00
82marbag f324240b27
Unsupported content type (#1723)
Add validation for the Content-Type header and pass (remove from the failing
list) the relevant protocol tests

Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
2022-09-13 18:18:34 +00:00
Harry Barber fd94858db8
Add new service builder codegen (#1693)
* Add `ServerProtocol` interface to allow for server side protocol specific methods.

* Make public the structs merged in https://github.com/awslabs/smithy-rs/pull/1679.

* Add `ServerOperationGenerator`, which generates a ZST and implements `OperationShape` on it.

* Add `ServerServiceGeneratorV2`, which generates the service newtype around a router and a service builder.

* Add `hidden` argument to `RustModule` which allows modules to be marked with `#[doc(hidden)]`.

* Add `BuildModifier` trait to provide a common interface for extending service builders.

* Add `Upgradable` trait to simplifying bounds when upgrading from an `Operation` to a HTTP service.

* Add `FromRequest`, `FromParts`, and `IntoResponse` implementations.

* Make `RoutingService` accept general body types `B` for the inner services `http::Response<B>`.

* Use new service builder in protocol tests.
2022-09-12 14:27:41 +01:00
Harry Barber e0083877a0
Escape routing regex in path segment literals (#1719)
* Add unsanitary_path test

* Escape literals
2022-09-08 14:54:18 +00:00
John DiSanti 96e9f61fee
Establish the `codegen-core` module (#1697)
* Create the `codegen-core` module
* Move the `Version` class into `codegen-core`
* Rename `codegen` to `codegen-client`
* Rename `codegen-test` to `codegen-client-test`
* Move shared test models to common location
* Fix Smithy validation errors in `misc.smithy`
2022-09-07 09:31:46 -07:00
Zelda Hessler 50d88a5bf5
Feature: Customizable Operations (#1647)
feature: customizable operations
update: CHANGELOG.next.toml
update: RFC0017
update: add IntelliJ idea folder to .gitignore
add: GenericsGenerator with tests and docs
add: rustTypeParameters helper fn with tests and docs
add: RetryPolicy optional arg to FluentClientGenerator
move: FluentClientGenerator into its own file
2022-09-02 17:47:25 -05:00
Russell Cohen 373d866aa4
Bump minimum regex version (#1684) 2022-09-02 04:42:16 +00:00
John DiSanti 353d81c539
Improve manual config experience for SDK retries and timeouts (#1603)
* Remove `Default` implementation from `RetryConfig`
* Add use case integration tests
* Panic when retries/timeouts are enabled without a `sleep_impl`
* Combine the sleep, retry, and timeout customizations
* Add `sleep_impl` validation to the Smithy client builder
2022-09-01 17:12:06 +00:00
John DiSanti 31c5a91a25
Upgrade min versions of tokio, tracing-subscriber, and criterion (#1662)
* Upgrade minimum Tokio version to 1.8.4

This addresses RUSTSEC-2021-0072 and RUSTSEC-2021-0124.
The SDK, runtime crates, and server are set to the minimum secure
version of Tokio to allow a larger range of versions to be used by
consumers of those libraries. The tools and the Python server are
both set to the latest Tokio version since they are not intended
to be consumed as a libraries.

* Upgrade `tracing-subscriber` to 0.3.15

* Upgrade `criterion` to 0.3.6

This addresses RUSTSEC-2021-0093 by upgrading `criterion`, which
upgrades `rayon`, which upgrades `crossbeam-deque`.
2022-08-31 21:19:04 +00:00
Harry Barber 66f96a542a
Add new service builder machinery (#1679)
* Add protocol specific `FromRequest` and `FromParts`.

* Add `OperationShape` trait to model Smithy operations.

* Add `Handler` and `OperationService` traits.

* Add `Upgrade` `Service` and `UpgradeLayer` `Layer`.
2022-08-31 14:39:27 +00:00
Russell Cohen 6e96137ca7
Add partition function (#1682) 2022-08-30 18:18:27 +00:00
John DiSanti 2bcf4da6b8
Fix CI by pinning version of `arbitrary` (#1681) 2022-08-30 09:13:45 -05:00
Russell Cohen 0ea576fc4e
Endpoints 2.0 Standard Library functions (#1667)
* Endpoints 2.0 Standard Library functions

* Endpoints Standard Library Cleanups
2022-08-29 16:05:26 +00:00
Weihang Lo df077c9787
Use `tokio::sync::Mutex` to make lock get across yield point (#1677) 2022-08-26 18:12:32 +00:00
Harry Barber 778539f452
Add protocol specific routers (#1666)
* Add protocol specific routers

* Replace internals of `Router` with protocol specific routers
2022-08-26 17:53:34 +01:00
Zelda Hessler a65b1aaa8d
Update MSRV to 1.61.0 (#1672) 2022-08-25 15:43:35 -07:00
Matteo Bigoi 6b356c4859
Reference issue for unsupported media type (#1664) 2022-08-24 10:54:11 +00:00
Russell Cohen fc1e1799da
Refactor endpoints to be Smithy-native (#1641)
* Refactor endpoints to be Smithy-native

* Add test to DynamoDb

* Fix clippy

* Fix some clippy errors and update changelog
2022-08-23 19:19:16 +00:00
Harry Barber 613da81594
Use . delimiter in OperationExtension (#1651)
* Change OperationExtension to require "."

* Switch codegeneration to use "."
2022-08-23 10:20:59 +00:00
82marbag 9bfd1b2c0a
Forbid inf/nan in epochs (#1650)
* Forbid inf/nan in epochs

Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
2022-08-22 20:36:50 +00:00
Matteo Bigoi 5455c4e9cc
Fix bug in coroutine scheduling. Add ByteStream implementation and simplify Python symbol visitor. (#1633)
* Fix bug in coroutine scheduling. Add ByteStream implementation and simplify Python symbol visitor.

* Bug in coroutine scheduling:

In the previous iteration, the runtime crate aws-smithy-http-server-python
was exposing the python application implementation as a struct, which
was wrapped by the codegenerated App to allow to dynamically building
the router.

This caused scheduling of coroutines (handlers prefixed with async def)
to block becuse we were passing the Python eventloop of the parent
process that was stored pre-fork().

This commit changes the runtime PyApp to become a trait, allowing us to
dynamically build the router post-fork() and with the right event loop.

This change also allowed us to remove a bunch of unnecessary Arc(s).

* Add ByteStream implementation

Implementation of a ByteStream type for Python that can be roughly used like this:

let b = await ByteStream.from_path("file.txt")
async for chunk in b:
    print(chunk)

Implement futures_core::stream::Stream for Python ByteStream wrapper.

The BytesStream implementation in python can now use a sync Mutex from
parking_lot because we are now using pyo3_asyncio::tokio::local_future_into_py()
to read a chunk, which supports !Send futures.

This allows to simply forward the implementation of Stream (poll_next()
and size_hint()) directly to our inner SDK ByteStream.

* Simplify Python symbol visitor

Inherit from Symbol visitor and override just what is needed to swap Python complex
types.

Signed-off-by: Bigo <1781140+crisidev@users.noreply.github.com>
2022-08-19 19:09:10 +01:00
david-perez 7e7d571845
Refactor converters to numeric types for `aws_smithy_types::Number` (#1274)
Currently, conversions from `aws_smithy_types::Number` into numeric Rust
types (`{i,u}{8, 16, 32, 64}` and `f{32, 64}`) are always lossy, because
they use the `as` Rust keyword to cast into the target type. This means
that clients and servers are accepting lossy data: for example, if an
operation is modeled to take in a 32-bit integer as input, and a client
incorrectly sends an integer number that does not fit in 32 bits, the
server will silently accept the truncated input. There are malformed
request protocol tests that verify that servers must reject these
requests.

This commit removes the lossy `to_*` methods on `Number` and instead
implements `TryFrom<$typ> for Number` for the target numeric type
`$typ`. These converters will attempt their best to perform the
conversion safely, and fail if it is lossy.

The code-generated JSON parsers will now fail with
`aws_smithy_json::deserialize::ErrorReason::InvalidNumber` if the number
in the JSON document cannot be converted into the modeled integer type
without losing precision. For floating point target types, lossy
conversions are still performed, via `Number::to_f32_lossy` and
`Number::to_f64_lossy`.
2022-08-19 11:42:14 +00:00
Hugo Bastien 9ee45bfd44
feat: support for server `lambda_http::Request` (#1551)
Co-authored-by: david-perez <d@vidp.dev>
2022-08-19 10:13:07 +00:00
82marbag b98b160799
Allow `*` in ACCEPT header (#1646)
Allow `*` in ACCEPT header

Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
2022-08-18 17:20:59 +00:00
Burak 86539f2b08
Add TLS support to Pokemon server (#1634)
* Add TLS support to Pokemon server

* Add missing copyright header to TLS module

* Handle connection errors

* Move TLS example to own binary

* Update comments according to reviews

* Move rewrite base url middleware to its own function
2022-08-18 12:32:07 +01:00
Harry Barber 48a85316a4
Make OperationExtension hold a &'static str for the absolute shape ID (#1631) 2022-08-11 22:56:27 +00:00
John DiSanti cbbbec4a48
Check external types for runtime and SDK crates in CI (#1625)
* Rename `cargo-api-linter` to `cargo-check-external-types`
* Run `cargo-check-external-types` on Smithy client/shared runtime crates
* Run `cargo-check-external-types` on SDK runtime crates
* Fix bug in determining crate name
* Run `cargo-check-external-types` on generated SDK crates
2022-08-10 18:33:43 -07:00
Zelda Hessler 70a621930f
update: add 10ms margin of error to timeout duration assertion (#1594)
* update: add 10ms margin of error to timeout duration assertion

* update: assert_elapsed macro with customizable margin of error.
2022-08-09 14:32:55 -07:00
John DiSanti 462aef6394
Fix SDK integration tests in local dev and add CI step to verify (#1600) 2022-08-08 16:29:22 -07:00
82marbag 458eeb63b9
Health check in Pokemon service (#1608)
Health check operation in Pokemon service

Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
2022-08-03 18:22:00 +01:00
Harry Barber ed2a866c8e
Add server side HTTP logging layer (#1550)
* Add `MakeFmt` trait which modifies `Display`/`Debug` implementations.

* Add `http` wrappers which modify the `Debug` and `Display` implementations based on closures marking sensitivity. Each wrapper has an associated `MakeFmt` impl.

* Add `InstrumentOperation` [tower::Service](https://docs.rs/tower/latest/tower/trait.Service.html) which logs requests and responses. Accepts a `MakeFmt` for each potentially sensitive component of the request/response.

* Add [ServerHttpSensitivityGenerator.kt](https://github.com/awslabs/smithy-rs/compare/harryb/add-logging?expand=1#diff-a7ad7f28d152bba6f2a63f3bde498582d91c8f7ab9c2de0c7f4494d6fd1c02ff) which generates marker closures from models.

* Apply `InstrumentationOperation` to the `OperationHandler` using `MakeFmt`s using the marker closures.

Co-authored-by: Matteo Bigoi <1781140+crisidev@users.noreply.github.com>
2022-08-02 21:32:03 +00:00
Matteo Bigoi 000e8b0db7
Allow to build and test on MacOX M1/x86 chips (#1609)
* Allow to build and test on MacOX M1 chips

* Add MacOS linker config

* Fall back to standard event loop if uvloop is not available
2022-08-01 23:27:51 +00:00
david-perez 430f4bf8b4
Make `Content-Type` check in `ServerHttpBoundProtocolGenerator` protocol-agnostic (#1605)
The `Content-Type` check of the incoming request in
`ServerHttpBoundProtocolGenerator` is performed by comparing against the
configured protocol directly within the class.

Delegating to the protocol enables the implementation of protocols in
decorators loaded from the classpath in other projects outside
smithy-rs.

This commit makes the `ServerHttpBoundProtocolGenerator`
protocol-agnostic by looking up the expected incoming request
`Content-Type` header from the protocol implementation directly. To this
end, the macro-generated `check_<protocol>_content_type` functions from
the `aws-smithy-http-server` runtime have been replaced with a single
general `check_content_type` function that takes in the expected mime
type.
2022-08-01 10:27:51 +02:00
John DiSanti 5fb56c8446
Set minimum `hyper` version to `0.14.12` (#1602) 2022-07-29 09:01:06 -05:00
Harry Barber 0fb5ccb814
Remove excess cargo test passes from additional-ci (#1595)
* Use --exclude-all-features in additional-ci

* Remove excess cargo test --all-features

* Improve powerset echo
2022-07-28 20:40:49 +00:00
Zelda Hessler 3d53e7405d
update: `From<hyper::Body>` for `ByteStream` now delegates to `SdkBody::from` (#1585)
* update: From<hyper::Body> for ByteStream now delegates to SdkBody::from
* add: comments to SdkBody inner enum variants
2022-07-27 20:14:36 +00:00
Zelda Hessler c7949be857
Add/alternative runtime tests (#1575)
* add: alternative runtime tests
2022-07-27 10:34:01 -05:00
david-perez d952ccd8f3
Fix `codegen-server` and `codegen-server:python` projects when crate name contains hyphens (#1581)
Rust crate names are allowed to contain hyphens, while Rust identifiers
are not [0]. However, the Rust and Python server projects are currently
broken because we use the user-provided crate name verbatim
(`moduleName` in `settings`) in places where Rust expects valid
identifiers:

* The Rust server's generated operation registry Rust docs use the crate
  name verbatim in import statements.
* The Python server uses the crate name verbatim to generate a shared
  library, but library target names in `Cargo.toml` cannot contain
  hyphens.

We never caught this bug because we don't generate any crates with
hyphens in their names.

This commit:

* fixes the above usages of verbatim crate names where identifiers are
  expected by calling `toSnakeCase()`,
* modifies the unit test for the server's operation registry generator
  to generate a crate with hyphens in its name,
* changes the Pokémon service server SDK crate names from
  `pokemon_service_sdk` to `pokemon-service-server-sdk`, so that we
  exercise generation of a crate with hyphens in its name, and to better
  convey that the generated SDK is server-specific; and
* changes the Pokémon service client SDK crate name from
  `pokemon_service_client` to `pokemon-service-client`, and changes the
  Pokémon service crate name itself from `pokemon_service` to
  `pokemon-service`, for symmetry.

[0]: https://doc.rust-lang.org/reference/identifiers.html
2022-07-27 15:27:15 +02: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
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
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 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
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 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
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
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
Harry Barber 8dd03fdf7f
Add getter methods to OperationExtension (#1466)
* Add `OperationExtension::namespace` and `OperationExtension::operation_name`.
2022-06-29 11:38:07 +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
J.R. Hill a183204493
Add Japanese flavor text to the example pokemon service (#1480) 2022-06-28 12:37:30 +02:00
david-perez ae2a74b598
Non-functional miscellaneous improvements (#1445)
This commit contains non-functional (i.e. mostly stylistic, small
refactors, documentation and consistency) improvements that I've batched
and rolled up while working on #1342.

* Make `extraDependencies` from `InlineDependency` class private
* Miscellaneous improvements to `RustTypes.kt`
* Remove dead code from `RuntimeTypes.kt`
* Style change in `RuntimeTypes.kt`
* Miscellaneous improvements to `SymbolVisitor.kt`
* Miscellaneous improvements to `BuilderGenerator.kt`
    - Make it consistent with the `ServerBuilderGenerator` from #1342.
* Miscellaneous improvements to `TestHelpers.kt`
* Add docs to `headers_for_prefix` function
    - I keep rereading the implementation to see what this returns; it's
      not intuitive from the function name.
2022-06-27 18:19:19 +02:00
david-perez 9f470718f7
Fix server routing matching URIs with prefixes (#1484)
We are incorrectly matching URIs to the spec when the URI has a prefix
that is not in the spec.

This is because when generating the regex describing the spec, we're not
using the `^` anchor to match from the beginning of the text.

Fixes #1483.
2022-06-22 14:06:19 +02:00
david-perez 5d6d8843cd
Split `CodegenContext` and children (#1473)
This commit splits each of:

* `CodegenContext`,
* `RustSettings`; and
* `CodegenConfig`

into two variants: one for the `rust-codegen` client plugin and another
for the `rust-server-codegen` plugin.

(`CodegenConfig` is a property of `RustSettings`, which is a property of
`CodegenContext`; they constitute pervasive read-only global data that
gets passed around to the code generators).

This allows each plugin to evolve separately, defining different
settings and passing around a tailor-made code-generation context.

Client-specific generators should now use:

* `ClientCodegenContext`,
* `ClientRustSettings`; and
* `ClientCodegenConfig`.

Likewise, server-specific generators should now use:

* `ServerCodegenContext`,
* `ServerRustSettings`; and
* `ServerCodegenConfig`.

This is a more robust and maintainable approach than the current one,
where both generator types have to read possibly null values (because
they don't make sense for a client/server target), and plugins have to
populate settings that are not relevant for the crate they're
generating. For example, the server plugin has to populate and pass
around the settings `renameExceptions`, `includeFluentClient` and
`addMessageToErrors` even though it never uses them and don't make sense
for it.

As of writing these client and server specific classes are very similar,
but in the future they will evolve in separate ways (for example, #1342
will add symbol providers for constrained shapes that only make sense in
a server code-generation context).

Common properties have not been duplicated however. Instead, utilizing
inheritance, code-generation context that is common to _all_ plugins can
be placed in:

* `CoreCodegenContext`,
* `CoreRustSettings`; and
* `CoreCodegenConfig`.

This way, generators that are shared by both client and server can take
in `CoreCodegenContext`. If they need to tweak the code they generate in
small and self-contained places, they can utilize the `CodegenTarget`
flag-like enum to disambiguate, like they have always been doing.

Note this change also makes `RustDecorator`s be targeted for clients or
servers, by making them generic over the code-generation context. When
loading the decorators from the classpath and combining them into one in
the executed smithy-rs plugin, all of them need to either target clients
or target servers. This makes sense: after all, all of the decorators
that conform the AWS Rust SDK are client-specific.

Closes #828.
2022-06-21 19:12:31 +00:00
Russell Cohen 1446681c0a
Add support for retrying individual call timeouts (#1478)
When timeout support was added initially, the resulting error `SdkError::TimeoutError` was never added to the retry policy which prevented these errors from being retried. This was a bug—This commit rectifies the and adds two integration-level tests that ensure that timeouts are properly retried.
2022-06-21 17:37:04 +00:00
david-perez 5af3b106a0
Remove `#[doc(hidden)]` from `aws_smithy_http_server::body::BoxBody` (#1453)
And from the `boxed` body function.

These are necessary if users need to implement middleware
(`tower::Layer`s) that use the request's body.
2022-06-17 13:44:58 +00:00
Zelda Hessler 04eeb4ff13
update: simplify and fix a latent issue with bytestream's streaming impl (#1461)
update: print helpful panic message for users on 32bit systems that try to stream large bodies
update: CHANGELOG.next.toml
2022-06-15 20:18:20 +00:00
Matteo Bigoi 8e84ee2eff
Codegenerate StructureShape, BlobShape, application, server and Python runtime (#1403)
We are introducing code-generation for Python bindings of StructureShape, BlobShape, EnumShape, OperationShape.

This PR also add a runtime server implementation to support serving Python business logic directly and with an idiomatic experience.

Co-authored-by: david-perez <d@vidp.dev>
2022-06-14 16:16:35 +00:00
John DiSanti 66ff2bd0e7
Pin the `clap` version used to prevent future deprecation warnings (#1464)
Co-authored-by: Matteo Bigoi <1781140+crisidev@users.noreply.github.com>
2022-06-14 09:29:35 -05:00
John DiSanti 3c1b71f3b9
Fix deprecation warnings in `aws-smithy-http-server` examples (#1462) 2022-06-13 12:55:33 -07:00
82marbag c78c67e3fe
Comply with content types for the accept header (#1424)
* Verify accept header for payloads with `@mediaType`

Comply with content-types as described in the documentation [0]

[0] https://awslabs.github.io/smithy/1.0/spec/aws/aws-restjson1-protocol.html#content-type

Signed-off-by: Daniele Ahmed <ahmeddan@amazon.com>
2022-06-13 09:17:02 +00:00
Chris Morin b7506ec2e5
Fix typo in documentation (#1455) 2022-06-12 20:28:31 -04:00
Harry Barber 1875448dbb
Use Vec for route resolution when number of routes <15 (#1429)
* Add `TinyMap` collection, which is a map backed by either `Vec` or `HashMap` depending on the number of entries.

* Replace `HashMap` with  `TinyMap` for `Routes::AwsJson10` and `Routes::AwsJson11`.
2022-06-07 10:58:19 +01:00
Harry Barber c503debb4b
Remove usage of percent_decode_str for decoding query string key-value pairs (#1417)
* Use `form_urlencoding::parse` over `serde_urlencoded::from_str`, this removes our dependency on `serde_urlencoded`.

* Remove `percent_encoding::percent_decode_str` where possible.

* Contract `generateParsePercentEncodedStrFn` and its children into one function and make it optionally apply percent encoding.

* Add `impl From<std::convert::Infallible> for RequestRejection` to remove codegen branch.
2022-05-30 10:56:50 +01:00
Kyle Thomson fe582a8d68
Add local publish configuration to rust-runtime (#1415)
* Add local publish configuration to rust-runtime

* Removing unnecessary `maven` plugin
2022-05-26 17:04:27 +00:00
82marbag 35989d2fec
Unknown enum variants removed from server (#1398)
The server must have the most up to date variants and the unknown enum
variant should not be used. Clients are generated with it because they
might not have the most recent model and the server might return
an unknown variant to them.

Closes #1187

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

Co-authored-by: Daniele Ahmed <ahmeddan@amazon.de>
Co-authored-by: david-perez <d@vidp.dev>
Co-authored-by: Matteo Bigoi <1781140+crisidev@users.noreply.github.com>
2022-05-23 20:16:23 +01:00
Matteo Bigoi ebabb98745
Implement Python runtime crate and shared socket (#1399)
* Add the Python runtime crate `aws-smithy-http-server-python`
* Implement SharedSocket support.
* Implement logging to tracing support.
2022-05-20 17:08:57 +00:00
Zelda Hessler 75d50dd157
feature: conversion method for `ByteStream` into `AsyncRead` implementor (#1391)
* feature: conversion method for ByteStream into AsyncRead implementor
add: impl From<byte_stream::Error> for std::io::Error
add: CHANGELOG.next.toml entries

* fix: unused dep

* add: docs
2022-05-16 22:34:54 +00:00
david-perez fb5e235446
Register Gradle tasks instead of eagerly creating them (#1374)
Using `.register()` avoids creating possibly unnecessary tasks.
2022-05-11 19:51:14 +02:00
82marbag 003b1db6e7
Remove axum-core dependency (#1368)
This change removes the dependency on axum-core and brings in the
relevant resources we are using from that crate.

Issue: #1170

Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
2022-05-11 13:02:59 +01:00
Zelda Hessler 34369e2dc0
Update `FsBuilder`-based `ByteStreams` to support file offsets (#1361)
* add: offset setter to FsBuilder
remove: file_size setter from FsBuilder
add: length setter to FsBuilder
add: test for ByteStream w/ offset
add: test for ByteStream w/ length less than file size
update: path_based_bytestreams_with_builder test

* add: test ensuring offset and length work correctly together
add: test ensuring that no data is returned when offset is greater than file size
add: test ensuring that nothing breaks if length to read is larger than file size

* add: chunking test
add: CHANGELOG.next.toml entry
refactor: new code based on PR comments

* remove: unused use statement

* refactor: length API

* update: prefer unwrap() to returning error in tests

* update: prefer unwrap() to returning error in tests
add: test for Length::Exact behavior

* update: error if offset is greater than file length

* fix: test to work with new offset error

* update: error test to be more specific
2022-05-10 21:41:24 +00:00
Russell Cohen c8fe6e2adf
Fix several minimal version bugs and add it to CI (#1365)
* Fix several minimal version bugs and add it to CI

* Fix docker image

Co-authored-by: Zelda Hessler <zhessler@amazon.com>
2022-05-09 17:14:14 +00:00
John DiSanti a0539e20b0
Fix `SPDX-License-Identifier` in header comments (#1377)
* Fix misc whitespace with pre-commit

* Revise copyright check in `sdk-lints`

* Fix `SPDX-License-Identifier` in header comments
2022-05-09 09:50:46 -05:00
Matteo Bigoi f312de343e
Add Pokemon service cmdline arguments using clap. (#1371)
* Add command line arguments for server and port. Default the bind address to localhost
* Update rust-runtime/aws-smithy-http-server/examples/pokemon_service/src/main.rs
* Remove tracing::instrument as we should create the spans inside the code generated code

Co-authored-by: david-perez <d@vidp.dev>
2022-05-06 17:53:38 +00:00
John DiSanti 3aab82749b
Add a debug log entry for retries (#1352) 2022-05-02 18:02:09 +00:00
Zelda Hessler 1372754f42
add: callback trait proposed in rfc#0012 (#1329)
* add: callback trait proposed in rfc#0012
add: callback setting API to ByteStream
add: callback setting API to SdkBody
add: callback tests for streaming and buffered data
add: private callback fns for calculating checksums
udpate: pub methods on private struct `Inner` to be private
update: changelog
remove: Sync bound from SdkBody test "sdk_body_is_send()"
add: fn to merge `HeaderMap`s by appending
add: tests for new functionality

* add: Sync bound to callbacks
refactor: poll_trailers method
update: split out checksum callbacks into their own module
formatting: use throwaway let binding instead of allow unused variable

* add: license file to new crate
add: readme file to new crate

* add: missing anchor to Cargo.toml

* rename: aws-smithy-checksum-callbacks to aws-smithy-checksums
add: two more append_merge_header_maps tests
update: make append_merge_header_maps pub(crate)
remove: check for non-existent log line

* remove: doc test for private fn

* update: checksum callback struct names
2022-04-21 12:51:01 -05:00
Tanguy Le Barzic 3073a0a2d1
Allow to specify a read buffer initial capacity when creating ByteStream from a file (#1238)
* Allow to specify a read buffer initial capacity when creating ByteStream from a file

The behaviour of the existing ByteStream::from_file / ByteStream::from_path is unchanged (using a default buffer capacity of 4k, which corresponds to Tokio's ReaderStream default buffer capacity). Using higher buffer sizes can result in a large reduction in CPU during S3 uploads, at the cost of memory increase.

* Rename len to file_size

This makes the distinction with the buffer size clearer

* Use a builder to specify advanced options to create a ByteStream

* Improved comments

* Specify the unit to use for PathBodyBuilder.with_file_size

* Improved comments following review

* Rename PathBodyBuilder to FsBuilder

* Renaming in FsBuilder

- renames `with_buffer_size` to `buffer_size`
- renames `with_file_size` to `file_size`
- renames `byte_stream` to `build`

* Make PathBody private

* Updated API for FsBuilder

* Document panic behavior of ByteStream::build

* Document ByteStream::read_from

* Move ByteStream::read_from

No functional change

* Update rust-runtime/aws-smithy-http/src/byte_stream.rs

a -> an

Co-authored-by: Russell Cohen <russell.r.cohen@gmail.com>
Co-authored-by: Russell Cohen <rcoh@amazon.com>
2022-04-21 14:37:17 +00:00
Matteo Bigoi 2931c9e1e6
Initial awsJson 1.0 and 1.1 server implementation (#1279)
To support these new protocols, we also changed the runtime Router definition as for both awsJson 1.0 and 1.1, every request MUST be sent to the root URL (/) using the HTTP "POST" method.

The runtime Router now supports explicitly all the available protocols.

There are still some protocol tests failing for awsJson 1.0 and 1.1. The failure are caused by the missing implementation of @endpoint trait and date parsing. Protocol tests for these 2 protocols are heavily biased towards Responses. Before announcing support for awsJson 1.0 and 1.1, we should increase the protocol tests coverage.

Signed-off-by: Bigo <1781140+crisidev@users.noreply.github.com>
Co-authored-by: david-perez <d@vidp.dev>
2022-04-19 16:41:03 +00:00
Zelda Hessler 52b808ec13
update: MSRV from 1.56.1 to 1.58.1 (#1325)
* update: MSRV from 1.56.1 to 1.58.1

* update: CHANGELOG.next.toml
fix: cdk rust issues

* Update CHANGELOG.next.toml

* Update CHANGELOG.next.toml
2022-04-15 14:01:18 -05:00
Russell Cohen fa69a0bf79
two small docs typos in bytestream (#1321) 2022-04-14 11:21:52 +00:00
Nikhil Benesch b7a8eb5824
Add endpoint resolver to SdkConfig (#1300)
* Add endpoint resolver to SdkConfig

This commit adds an `endpoint_resolver` field to SdkConfig, which flows
through to the `endpoint_resolver` field on each individual service
configuration. To avoid a circular dependency between the aws-types
crate and the aws-endpoint crate, the `AwsEndpoint` type and its
dependencies are moved from the aws-endpoint crate to the aws-types
crate, then rexported in aws-endpoint.

Fix aws-labs/aws-sdk-rust#396.

* impl From<'static str> for signing service and signing region

* Code generate for the static string implementation

* Add EndpointResolver to aws_config

* Add docs and adapt test

* Fix test

* Fix endpoint config customizations test to remove dead code

* Re-add `.set_endpoint`

* Remove print and update changelog

Co-authored-by: Russell Cohen <rcoh@amazon.com>
2022-04-12 17:51:50 +00:00
david-perez 71e2a6d9e1
Remove `impl_extension_new_and_deref` macro from `aws-smithy-http-server` (#1290)
This macro is used only once in the codebase.
2022-04-08 12:30:45 +02:00
John DiSanti fc6af2071f
Combine PR bot messages into one (#1299) 2022-04-07 09:53:18 -07:00
Russell Cohen 6bbc776d67
Smithy async docs (#1278)
* Add lints to aws-smithy-async

* Write some event stream docs, and enable lints

* Codegen docs

* Fix one missing doc

* Compile fixes

* remove accidentally added code

* Update codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/SymbolVisitor.kt

* Update response headers docs
2022-04-05 16:17:00 +00:00
Nikhil Benesch 3aa1e36b6f
aws-smithy-query: bump to urlencoding v2.1 (#1301)
* aws-smithy-query: bump to urlencoding v2.1

* Add changelog entry for urlencoding update

Co-authored-by: Russell Cohen <rcoh@amazon.com>
2022-04-04 15:05:18 -07:00
david-perez 70de093507
Enable "TODOs" lint for server code (#1292)
Stale TODOs have been removed and new tracking issues have been cut to
provide context to the others.
2022-04-04 20:21:54 +02:00
John DiSanti 63b1de1a93
Update pinned nightly to fix `cargo udeps` checks (#1285)
* Update pinned nightly to fix `cargo udeps` checks

* Update `api-linter` to work on `nightly-2022-03-29`

* Make it possible to test tool modifications in a pull request
2022-03-31 09:30:04 -07:00
John DiSanti 6fa7b36812
Use Docker build image in CI (#1255)
Establishes a Docker build image with build tools precompiled into it to improve CI time and reduce GitHub Actions workflow configuration. Also makes it possible to run the exact CI workflows in local development.
2022-03-28 11:05:08 -07:00
Zelda Hessler b2c989630f
Update to Rust Edition 2021 (#1268)
* update: set rust edition to 2021
update: strict param of intoCrate to set clippy to set #![deny(clippy::all)]

* add: changelog entry
2022-03-22 21:29:04 +00:00
david-perez f627311b48
Improve Pokémon Service `Makefile` (#1264)
* Improve Pokémon Service `Makefile`

* Code-generate only the Pokémon Service SDK (as opposed to all targets
  in the `codegen-server-test` subproject like we do currently).
* Add `run` target to run the service.
* Add `doc-open` target to generate and open Rustdoc documentation.
* Bring back client generation

Co-authored-by: Matteo Bigoi <1781140+crisidev@users.noreply.github.com>
2022-03-18 16:28:38 +00:00
Zelda Hessler 3eaddcf738
Add default list of http versions to request property bag (#1258)
* add: default list of http versions
add: type alias for list of http versions
add: decorator to add desired http versions to property bag
fix: gradle warning for argument "model"
update: CHANGELOG

* fix: clippy lint

* update: use more accurate name for test RustCodegenDecorators
rename: HttpVersionListGenerator.kt to HttpVersionListCustomization.kt
update: HttpVersionListCustomization to grab versions from models when possible
fix: various docs issues reported by IDE
add: new "Extras" section to ServiceConfig
update: code broke by "Extras" change
add: tests for http version sniffing
2022-03-17 08:09:01 -05:00
david-perez c059491a32
Fix docs for `aws_smithy_types::Number` converters (#1252)
Current docs: https://docs.rs/aws-smithy-types/0.38.0/aws_smithy_types/enum.Number.html

I learnt this trick from https://stackoverflow.com/a/43353854.
2022-03-14 22:40:44 +01:00
Zelda Hessler 107194f106
Timeouts refactor (#1246)
* rename: in aws_smithy_types, timeout::TimeoutConfig is now timeout::Config
update: timeout::Config now wraps 3 config structs (Http, Tcp, Api)
update: aws_config timeout setting to work with timeout::Config changes
update: providers to work with new timeout config structure
update: codegen to work with new timeout config structure
update: CHANGELOG.next.toml

* add: missing copyright header

* update: impl From instead of Into for timeout conf
fix: clippy lints

* fix: service config codegen for timeouts

* fix: broken doc tests

* fix: bad doc link

* update: transfer aws_types::Config changes to new aws_types::SdkConfig

* fix: two outdated doc tests

* Apply suggestions from code review

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

* undo: doc change for timeout env vars
refactor: move parse_str_as_timeout to aws_config and privatize it
update: aws_config code for parse_str_as_timeout
move
remove: comments from private struct members
update: comments for pub struct methods

Co-authored-by: John DiSanti <jdisanti@amazon.com>
2022-03-11 11:35:13 -06:00
Matteo Bigoi b01f6d1b36
Try to play a little with benchmark params to increase reliability by decreasing contention (#1247) 2022-03-11 13:10:31 +00:00
david-perez 4afa8a3c80
Revamp error system (#1233)
This commit rewrites the server's error system so that it can render
accurate protocol-specific HTTP responses adhering to the malformed
requests protocol tests' expectations. It also makes 400+ of the tests
relating to request deserialization pass.

Previously, we were rendering the `SmithyRejection` type in our HTTP responses
directly as we desired. However, AWS protocols' errors are not as granular:
many different request deserialization failure causes are conflated and
signaled to clients under a single `SerializationException` in the response.
This commit introduces a new concept, the `RuntimeEror` type, which groups
rejections and renders the responses that these protocols expect. Rejection
types now become an internal detail of the framework that only serve for us
maintainers to keep track and inventory all possible error causes in great
detail.

Extension types have also been renamed to better reflect their purpose.

For more information about this patch, read the added documentation to the
`rejection`, `extension`, and `runtime_error` modules.
2022-03-11 13:39:27 +01:00
Russell Cohen 2fd7edbe07
Update README.md (#1245)
Co-authored-by: Matteo Bigoi <1781140+crisidev@users.noreply.github.com>
2022-03-10 14:41:33 +00:00
Matteo Bigoi 11a5691a4a
Add benchmark deviation calculation from origin/main to current PR (#1230)
This PR introduce a benchmarking tool that is run as part of the GitHub actions to allow to spot performance regressions in the server implementation.

The "deviation" between the last and current benchmark is posted as a message in the pull request.

I want to let this run for a little so we can figure out if GitHub action capacity can give us consistent results, otherwise we will have to move this to some capacity we own.

Co-authored-by: david-perez <d@vidp.dev>
2022-03-08 17:42:26 +00:00
John DiSanti d823f61156
Update pinned nightly and rustdoc format version (#1236) 2022-03-04 11:28:31 -08:00
Zelda Hessler e42aa10ac3
Update: impl `Clone` for `DynMiddleware` (#1226)
* update: make DynMiddleware cloneable
rename: BoxCloneLayer to ArcCloneLayer
update: make ArcCloneLayer cloneable

* update: CHANGELOG.next.toml
2022-02-25 10:58:41 -06:00
Matteo Bigoi bbe82cd283
Add initial implementation of a Server example (#1222)
We are adding this example service in the aws-smithy-http-server folder to showcase the SSDK and to be able soon to run benchmarks against this example.

This change includes a new model for the Pokémon Service and all the necessary infrastructure to code generate the client and server SKDs and make them available to the runtime implementation.

A basic README has also been added with instructions on how to build, run and test the service.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
2022-02-25 14:19:05 +00:00
John DiSanti 4f183f71fe
Pin nightly to `2022-02-22` to fix CI (#1221) 2022-02-24 09:33:15 -06:00
John DiSanti 801808061a
Make `rustls` and `native_tls` client builder helpers dyn (#1217)
* Make `rustls` and `native_tls` client builder helpers dyn

* Update changelog
2022-02-23 10:58:10 -08:00
John DiSanti e1099324e1
Replenish cross-request retry allowance on successful response (#1197)
* Replenish cross-request retry allowance on successful response

* Update changelog

* Rename `NotRetryable` to `UnretryableFailure` and fix credential retry classifiers

* Incorporate feedback
2022-02-22 12:58:24 -08:00
John DiSanti 375e0b2b82
Hide external buffer types used by `primitive::Encoder` in aws-smithy-types (#1209)
* Fix exit status in `api-linter`

* Run `api-linter` against `aws-smithy-types` in CI

* Hide external buffer types used by `primitive::Encoder`

* Unpin nightly in CI

* Make `Encoder` a struct and split out an inner enum

* Update changelog
2022-02-22 20:05:02 +00:00
John DiSanti 72de0c69d9
Implement tool to identify external types used in public APIs (#1172)
* Implement tool to identify external types used in public APIs

* Allow specifying which nightly to use

* Move `visitor::is_allowed_type` into `Config`

* Add doc comments

* Use `tracing_attributes::instrument`

* Rename `RefType` to `ErrorLocation`

* Add ability to output a Markdown table

* Allow customization of crate features in analysis

* Work around rustdoc ICE in `aws-smithy-json`

* Integrate with cargo

* Add a readme

* Fix some comments

* Rename `ContextStack` to `Path`

* Verify rustdoc output format version

* Improve error message
2022-02-18 15:17:20 -08:00
david-perez 7b244a401c
Enclose some types in backticks in `aws-smithy-json` docs (#1203)
* Enclose some types in backticks in `aws-smithy-json` docs

* Fix docs link
2022-02-18 14:38:08 -05:00
david-perez 171d76fcfb
Add support for `httpPayload` in server responses (#1158)
Note that with this change, payload serializers now return `Vec<u8>` or
`ByteStream` instead of always `SdkBody`, since the server does not use
`SdkBody`. The caller then needs to convert the byte slab into the
appropriate HTTP body type. To this end, `HttpBoundProtocolBodyGenerator`
has been extracted into its own file and renamed to
`HttpBoundProtocolPayloadGenerator`.

This commit also makes the body types exports from
`aws-smithy-http-server` `#[doc(hidden)]`, since they should only be
used by generated code, and exports all of them from `body.rs` instead
of `lib.rs`.

Comments have been added where appropriate to document which serializers
are called by the client / server and how their use differs.
2022-02-14 15:17:18 +01:00
Zelda Hessler a1f065272b
HTTP Connectors Refactor pt.1 - Laying the groundwork (#1144)
* refactor: HttpSettings, HttpConnection location
update: replace timeout::Settings with TimeoutConfig
add: HttpConnector to aws_types::Config and Builder
refactor: divide default_provider.rs modules into separate files

* add: missing copyright headers

* add: missing http_connector accessor to Config

* remove: unused import

* update: undo changes to aws_config::connector module
remove: impl Default for HttpConnector

* update: CHANGELOG.next.toml
2022-02-04 20:17:31 +00:00
Guy Margalit f76bc159bf
Server streaming body (#1023)
Add support for server blob streaming requests and responses

Data is streamed over the HTTP body.

Signed-off-by: Guy Margalit <guymguym@gmail.com>
Co-authored-by: david-perez <d@vidp.dev>
2022-02-03 19:26:22 +01:00
John DiSanti 4b8381b22c
Remove unused test scripts and update readme (#1136) 2022-02-01 18:15:20 -08:00
david-perez d48c234796
`rust-server-codegen`: add `ResponseExtensions` to non-fallible operations (#1072)
`rust-server-codegen`: add `ResponseExtensions` to non-fallible operations

This commit also renames `RequestExtensions` to `ResponseExtensions`,
since we add this extension type only to HTTP responses. It also makes
its members private.

Closes #1063.
2022-01-28 13:33:59 +01:00
david-perez 8676219e43
Set server response headers (#1086)
This commit adds support for the `httpHeaders` and `httpPrefixHeaders`
when applied to error shapes and operation output shapes to the server
implementation.

The presence of response headers is now asserted against in server
protocol tests.

Functions that set headers in requests that were used by the client have
been refactored into `HttpBindingGenerator.kt`, since they are useful
for the server to set headers in responses.

This commit also makes error shapes be serialized in JSON responses with
a `__type` field in the body, in favor of setting the `X-Amzn-Errortype`
header, as recommended by the specs of all AWS protocols.

This commit also removes the generation of operation structs for the
server in `ProtocolGenerator.kt`, since they are not useful for the
server implementation.

Closes #1071 #1075.
2022-01-27 19:22:13 +01:00
Russell Cohen a411bc3b34
Endpoint docs & aws-config spans (#1087)
* Add more details to custom endpoint docs

* Cleanup aws-config spans

* Cleanup aws-config spans

* Cleanups & update changelog
2022-01-25 21:16:42 +00:00
John DiSanti 79c1ec1361
Improve publisher tool (#1104)
* Display crate version numbers in publish summary

* Add additional validations to `fix-manifests` sub-command

* Update `yank` sub-command to take a repository location

* Incorporate feedback

* Fix `aws-smithy-http-server` version number

* Make tag check more functional
2022-01-21 22:21:16 +00:00
david-perez dbd17e3440
`aws-smithy-http-server`: upgrade to `tower-http` 0.2.1 (#1105)
`tower-http` versions 0.1.0 to 0.2.0 have been yanked, see
https://github.com/rustsec/advisory-db/pull/1159.
2022-01-21 15:48:09 +00:00
Guy Margalit dbbacf0398
Fix #1011 - Server allows empty query (#1096)
Signed-off-by: Guy Margalit <guymguym@gmail.com>
2022-01-20 13:26:34 +01:00
david-perez 844422b3bc
`aws-smithy-http-server`: remove S3-like URI pattern conflict avoidance test (#1070)
The previous commit introduced a failing test because CI doesn't have
Rust tests as a blocking step and auto-merge was enabled.

With the two operations:

1. `ListBuckets` with URI pattern `/`; and
2. `ListObjects` with URI pattern `/{bucket}`,

the test wants to route the request `/` to the first operation. However,
in #1029 we started allowing empty path segments. Since `ListBuckets`
has more weight than `ListObjects`, the request matches against it,
binding `""` to the `bucket` label.
2022-01-13 12:26:46 +00:00
david-perez 5a07828ebd
`aws-smithy-http-server`: implement basic URI pattern conflict disambiguation (#1036)
This commit implements basic URI pattern conflict disambiguation when
routing incoming requests to service operations.

It does this by introducing a measure of how "important" a `RequestSpec`
is. The more specific a `RequestSpec` is, the higher it ranks in
importance. Specificity is measured by the number of segments plus the
number of query string literals in its URI pattern, so
`/{Bucket}/{Key}?query` is more specific than `/{Bucket}/{Key}`, which
is more specific than `/{Bucket}`, which is more specific than `/`.

Why do we need this?

Note that:

1. the Smithy spec does not define how servers should route incoming
   requests in the case of pattern conflicts; and
2. the Smithy spec even outright rejects conflicting patterns that can
   be easily disambiguated e.g. `/{a}` and `/{label}/b` cannot coexist.

We can't to anything about (2) since the Smithy CLI will refuse to build
a model with those kind of conflicts. However, the Smithy CLI does allow
_other_ conflicting patterns to coexist, e.g. `/` and `/{label}`. We
therefore have to take a stance on (1), since if we route arbitrarily we
render basic usage impossible (see issue #1009).

So this ranking of routes implements some basic pattern conflict
disambiguation with some common sense. It's also the same behavior that
the TypeScript sSDK is implementing [0].

This commit also:

* makes the `future` module private,
* hides documentation for the `request_spec` module; and
* makes some fields from some structs in the `request_spec` module
  private and adds constructors.

Closes #1009.

[1]: d263078b81/smithy-typescript-ssdk-libs/server-common/src/httpbinding/mux.ts (L59).
2022-01-13 11:26:19 +00:00
John DiSanti c25c24d0f9
Upgrade Smithy to 1.16.1 (#1053) 2022-01-12 15:35:40 -08:00
david-perez 611ebb646f
`aws-smithy-http-server`: don't ignore empty path segments when routing (#1029)
In #996 [0], we realized that we were ignoring empty URI path segments
when doing label extraction. It turns out we are also ignoring them when
doing routing, as the TypeScript sSDK currently does [1], from which the
initial implementation was copied.

However, a discussion with the Smithy team in awslabs/smithy#1024 [2]
revealed that we _must not_ ignore empty URI path segments when routing
or doing label extraction, since empty strings (`""`) should be assigned
to the labels in those segments.

This commit fixes the behavior so that we don't ignore empty path
segments _when doing routing_. #996 will take care of fixing the behavior
when doing label extraction.

[0]: https://github.com/awslabs/smithy-rs/pull/996#discussion_r772624998
[1]: d263078b81/smithy-typescript-ssdk-libs/server-common/src/httpbinding/mux.ts (L78)
[2]: https://github.com/awslabs/smithy/issues/1024
2022-01-12 14:07:25 +00:00
Russell Cohen 00bc624a87
Add Support for SSO (#1051)
* Add Support for SSO

This commit adds support for the SSO credential provider, which enables the aws-config to support using SSO when specified in `~/.aws/config`.

* Rename & add test of configuration failure

* Add SSO to the smoke test list

* CR improvements

- Improve error messages
- zeroize token
- add track_caller to improve test failure error messages

* Apply suggestions from code review

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

* Update changelogs

Co-authored-by: John DiSanti <jdisanti@amazon.com>
2022-01-11 13:42:11 -05:00
Zelda Hessler 5a1990791d
update: insecure deps (#1039)
* update: insecure deps
add: extra context to timeout test failure

* Update aws/rust-runtime/aws-config/Cargo.toml

* update: tracing-subscriber dependents
remove: tracing-subscriber fmt feature (it's default)

* update: tracing-subscriber dependents
remove: tracing-subscriber fmt feature (it's default)

* update: hyper dependents to be less specific
2022-01-06 09:02:55 -06:00
Russell Cohen a77c5ca2a9
Add support for Paginators (#1006)
* Add Support for Paginators

This commit adds pagination support for both clients. It does this via the `FnStream` abstraction which combines a rendezvous-channel with a closure to produce a stream. When the stream is polled, the underlying closure is polled to advance the computation which then pushes data into the channel.

Two paginators are generated:
1. `.paginate()` which produces a stream of `Result<Page, Err>`
2. `.paginate().items()` which produces a stream of `Result<Item, Err>` where items are flattened from the individual pages. This uses `TryFlatMap` to support conveniently generating a flat page iterator.

In addition, docs are generated to point customers towards the paginators.

* Add RFC, more tests

* backout unrelated changes

* Fix paginators for glacier

* Fix clippy error

* Add test for paginators that point to maps & fix apigateway paginator

* Fix docs

* remove extraeneous println

* Fix DynamoDB examples

* Disallow paginating operations with the idempotency token trait

* Apply suggestions from code review

misc typos / cleanups

Co-authored-by: Zelda Hessler <zhessler@amazon.com>

* CR feedback

* Fix typo

* Update changelog

* Apply suggestions from code review

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

* CR feedback round 1

* Rename paginate to into_paginator()

* update pr bot comment

Co-authored-by: Zelda Hessler <zhessler@amazon.com>
Co-authored-by: John DiSanti <jdisanti@amazon.com>
2022-01-05 17:46:57 +00:00
82marbag e935fbc762
Implement httpLabel with nom (#996)
Move to `nom` to implement httpLabel instead of using regexes.

Issue: #938

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

Co-authored-by: david-perez <d@vidp.dev>
2022-01-05 12:46:45 +01:00
Nikhil Benesch 363e434106
Upgrade to itoa v1.0 (#1024) 2022-01-03 10:24:10 -05:00
Jacco Kulman 9708aa8307
Clone-able structs (#985)
* Clone-able structs

* Change log entry

* Update CHANGELOG.next.toml

Co-authored-by: Russell Cohen <russell.r.cohen@gmail.com>

* Added two Clone directives and integration test

Co-authored-by: Russell Cohen <russell.r.cohen@gmail.com>
Co-authored-by: Russell Cohen <rcoh@amazon.com>
2021-12-30 11:15:01 -05:00
Russell Cohen cbd61ab1ff
Add recursion detection middleware to the default middleware stack (#1003)
* Add recursion detection middleware to the default middleware stack

Side refactorings:
- move AWS retry logic into its own module
- small update to protocol test to make it a little easier to use

* fixups

* Fix clippy

* Add more tests and comments
2021-12-27 18:04:10 +00:00
Javier Cano 56cf68a85d
Add flush to ByteStream code example in docs (#1005)
In the examples on how to copy a ByterStream to a file flush
is not called explicitly. A user copying this code may hit
some race condition as the flush will happen asynchronously.
This deviates from the std file implementation that flushes on drop
and may be confusing if not explicitly stated in the example.
2021-12-23 09:56:25 -05:00
david-perez 22f222d995
`rust-server-codegen`: don't return 200 status code with rejections (#1000)
Rejections themselves implement `IntoResponse` and set their status
code on it.

Co-authored-by: Matteo Bigoi <1781140+crisidev@users.noreply.github.com>
2021-12-22 14:09:40 +00:00
Russell Cohen 9f1ef3d408
More work on cleaning up TODOs (#997)
* wip

* wip

* Refactor lint tool

* Add a lint to validate that TODOs have context

* cleanup lint some more

* fix codegen failure & remove unused arguments
2021-12-21 11:22:43 -05:00
Russell Cohen bc316a0b81
Improve configurability of connectors (#984)
* Make connectors configurable in aws-config & add ca-certs example

* Cleanup cargo.toml

* fix native tls example

* Cleanup comments

* Fix native_tls & cleanup aws-config features

* add test

* add rt-tokio feature to crates to pull in aws-smithy-http
2021-12-17 12:43:17 -05:00
John DiSanti 17818ca7e5
Produce two publishable bundles in CI (#986)
* Move the publisher tool from `aws-sdk-rust`

* Add `rust-runtime:assemble` target to generate a publishable bundle

* Run `fix-manifests` on assemble output

* Produce publish-ready Smithy runtime bundle during CI

* Allow publish from any arbitrary directory

* Add safe-guard to prevent accidental publish from local dev

* Fix unit test target

* Incorporate feedback

* Add `buildSrc` tests and publisher tool to CI
2021-12-16 13:27:21 -08:00
Guy Margalit 341194e2f9
[Server] codegen-server support for restXml (S3) (#983)
Signed-off-by: Guy Margalit <guymguym@gmail.com>

Co-authored-by: Matteo Bigoi <1781140+crisidev@users.noreply.github.com>
2021-12-16 18:21:01 +00:00
Russell Cohen 2e7ed94351
Fix numerous todos & attach them to issues (#973)
* Fix numerous todos & attach them to issues

* Update changelog

* remove unused import in sigv4
2021-12-16 16:27:47 +00:00
John DiSanti 6325c8a277
Move additional-ci step into SDK smoke test (#961)
* Move additional-ci step into SDK smoke test

* Add `cargo hack` test to `aws-config` and make it pass

* Fix warning introduced by merge

* Incorporate feedback

* Fix native-tls example
2021-12-15 18:40:51 -08:00
Russell Cohen 5ece12393b
Fix bytestream docs so that they compile without all-features (#981) 2021-12-15 20:10:04 +00:00
Matteo Bigoi 64ccdccccf
Use a single struct to represent the RequestExtension (#978) 2021-12-15 13:57:04 +00:00
david-perez b9eebd9322
`rust-server-codegen`: add support for `httpQuery` and `httpQueryParams` traits (#971)
Closes #937.
2021-12-14 19:56:52 +01:00
Zelda Hessler e63b827ada
Fix query string signing bug (#965)
* update: use shared encoder definition when encoding url paths, query strings
add: query string writer test
add: changelog entry for bugfix

* format: test file

* fix: integration test
add: ", ^, `, \, (space), {, }, and | to list of chars to percent encode

* add: tracing and tracing-subscriber dep to generated integration tests

* add: canonical req query param test
remove: obsolete LABEL_SET ascii set

* fix: outdated aws-hyper import
2021-12-14 10:12:45 -06:00
Matteo Bigoi 05ffd071a4
[Server] Set http extensions for Request / Response (#963) 2021-12-13 20:02:50 +00:00
Zelda Hessler 979c703424
add: example showing how to use native-tls (#946)
* add: native-tls example and test
update: aws-config to correctly separate the native-tls and rustls features for its dependencies
fix: native-tls feature gate typo
update: prefix unused id field with an underscore

* update: CHANGELOG.next.toml

* remove: unnecessary aws-sdk-sts feature deps from aws-config

* remove: obsolete dep features
2021-12-09 21:23:51 +00:00
Matteo Bigoi 34f43d96cf
Migrate from axum to axum-core (#945)
Migrate to axum-core. 
Remove pin-project in favor of pin-project-lite. 
Remove CloneBoxedService in favor of tower util upstream type.
Update codegen to use axum-core and pin-project-lite.
Use inlinable for server handler definition.
2021-12-09 17:41:35 +00:00
Russell Cohen fe0b125dd7
Fix label & query URI encoding (#953)
* Fix label & query URI encoding

https://github.com/awslabs/aws-sdk-rust/issues/331 demonstrated that we were failing to properly encode characters for URI path components and query components in several situation. This:
- Fixes the specific bugs
- Adds proptests (run locally with 16K cases) to verify that this is the complete set.
- Adds an S3-specific protocol test that targets this issue

* Make the test a bit stronger

* Update changelog
2021-12-09 11:57:05 -05:00
John DiSanti 3b54f12443
Reorganize CI and add per-crate CI checks (#942)
* Add ability to have per-crate CI checks

* Split SDK CI into a separate workflow file

* Combine SDK tests into one matrix job

* Rename the codegen diff workflow

* Combine codegen tests into one matrix job
2021-12-08 15:43:13 -08:00
Zelda Hessler b5f53bed35
remove: default features from runtime crates (#935)
* remove: default features from runtime crates
update: tests and examples broken by default feature change
update: code generation broken by default feature change
fix: follow lint suggestion to lowercase variable names

* update: CHANGELOG.next.toml

* fix: add missing feature
fix: typo
formatting: sort imports

* update: make SDK changelog less worrying for SDK users not depending on a runtime crate
update: undo default feature change for SDK
fix: tests broken by default feature change
fix: examples broken by default feature change

* remove: empty defaults
add: doc w/ feature grid to aws-smithy-client
add: doc w/ feature grid to aws-smithy-http

* add: upgrade helper table to changelog
undo: bad formatting
formatting: add backticks to feature names in doc table

* remove: bytestream-util feature usage where possible
formatting: update CHANGELOG.next.toml

* remove: the client feature from generated SDKs
rename: feature "bytestream-util" to "rt-tokio"
update: mark "tower" dep as non-optional in SDKs
docs: update aws-smithy-http docs and README.md

* Update CHANGELOG.next.toml

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

* Update rust-runtime/aws-smithy-http/README.md

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

* revert: aws-sigv4 changes
update: CHANGELOG.next.toml
remove: rt-tokio dep feature for aws-smithy-async usage in aws-types

* fix: don't gate entire byte_stream module on rt-tokio feature
fix: typos

* remove: rt-tokio feature from SDKs generated with EventStreamSymbolProvider.kt
fix: incorrect doc comment

Co-authored-by: John DiSanti <jdisanti@amazon.com>
2021-12-08 16:57:12 +00:00
Russell Cohen 4073ebab5c
Fix several bugs associated with retry/sleep (#940)
* Fix several bugs associated with retry/sleep

The sleep implementation was late-bound but early loaded in retry which created a large surface area for bugs & meant that we emitted a lot of spurious warnings. This commit:
- Removes more kruft from aws-hyper and deals with the consequences
- Cleans up the way that HTTP clients are generated
- Passes in sleep to each incarnation of the retry controller to work around issues caused by late-binding vs. early binding sleep.

* first round of cleanups

* delete unused import

* Update integration tests

* Fix examples

* Fix aws-smithy-client docs

* Clippy fix

* fix flaky test

* Fix  which relies on tokio/io
2021-12-08 11:29:25 -05:00
John DiSanti eea27bb3d3
Add CI job to check for unused dependencies (#936)
* Add CI job to check for unused dependencies

* Fix unused dependency in `aws-smithy-types-convert`
2021-12-07 22:01:03 +00:00
John DiSanti 3bf906fe09
Improve log messaging around missing sleep implementation (#907)
* Improve missing sleep warning

* Update changelog

Co-authored-by: Russell Cohen <rcoh@amazon.com>
2021-12-07 13:43:52 -08:00
Matteo Bigoi d293ab34f9
Fix errors discovered with RestJson protocol tests (#926)
This PR fixes some errors discovered running the protocol tests for RestJson. It allows to fully build the RestJson protocol tests model, but it doesn't still generate proper tests (IE cargo test will fail) since we still haven't implemented parts for the protocol, like httpQuery trait.

The main problem discovered and fixed is that we were generating JSON deserializers for input structures without a JSON body (for traits like httpQuery that we still do not support). This was causing the in memory deduplication to get confused and the only visible effect was some clippy warning around mutable builders that shouldn't have been mutable. Without the protocol tests this would not surface since the ebs and simple model do not exercise that specific code path in the codegen.

Signed-off-by: Bigo <1781140+crisidev@users.noreply.github.com>
2021-12-07 13:47:19 +00:00
Russell Cohen 8136ba4a01
Use provided sleep_impl in aws-smithy-client::retry (#923)
* Use provided sleep_impl in aws-smithy-client::retry

Previously, aws_smithy_client was hard coded to use tokio::sleep. This change:
- threads the sleep implementation into the retry controller
- moves the integration test out of aws-hyper and into aws-smithy-client
- takes a first pass at fixing the cargo featres (cargo hack --feature-powerset passes now)

* cleanups

* several test fixups

* Use tristate to conditionally log

* Update changelog
2021-12-06 16:49:13 +00:00
Russell Cohen c22ec5812d
Add license header checker & missing headers (#917)
* Add license header checker & missing headers

Adds a license check pre-commit hook + adds license checking to CI

* Update tools/sdk-lints/src/copyright.rs

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

Co-authored-by: John DiSanti <jdisanti@amazon.com>
2021-12-02 13:39:30 +00:00
Russell Cohen 4f1c8af604
remove extraeneous pub use (#915) 2021-12-01 22:34:19 +00:00
Russell Cohen 1f71c35713
Docs licenses (#909)
* CR feedback

* Correct warning
2021-12-01 13:01:53 -05:00
Russell Cohen cc82edf173
docs.rs metadata & license linter & fixes (#904)
* Lint & fix docs.rs + LICENSEs

* Clippy fixups

* Update changelogs

* Fix reverse condition & make repo_root lazy_static

* Update copyright
2021-12-01 12:26:47 +01:00
Russell Cohen 35de48a214
Add a few READMEs + linter script (#899)
* Add a few READMEs + linter script

* Add initial linter script

* Add CI job

* Apply suggestions from code review

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

* Add README fix command

* Add newline in footer

* Add footer support to generator

* Also run fixes in CI

* Add note about smithy-types

* cleanups to scripts and READMEs

Co-authored-by: John DiSanti <jdisanti@amazon.com>
2021-11-30 14:37:42 -05:00
david-perez 4dc36bb1fc
Improve documentation for the `aws-smithy-http-server` crate (#901)
The changes are mostly stylistic. The only important change is that the
`routing` module and `Router::into_make_service` method have been made
doc-public, because users need to call `into_make_service` to feed the
returned `MakeService` to their `hyper` server.
2021-11-30 14:14:36 +01:00
Matteo Bigoi bc14ac7752
Support for share state in Server codegen (#894)
Signed-off-by: Bigo <1781140+crisidev@users.noreply.github.com>
Co-authored-by: david-perez <d@vidp.dev>
2021-11-29 11:41:00 +00:00
Zelda Hessler 692bf94ba3
Feature: add TimeoutError variant to SdkError (#886)
* feature: add TimeoutError variant to SdkError
add: TimeoutError variant to ImdsError
update: tests broken by new variant

* update: changelogs

* add: new inner timeout error RequestTimeoutError
update: tests broken by new inner error
rename: aws_smithy_client::hyper_ext::TimeoutError to HttpTimeoutError
add: missing dep to integration test

* revert: IMDS error change
update: content for HttpTimeoutError
fix: clippy lint

* add: back the source method to HttpTimeoutError
update: connector timeout tests
remove: TODO
2021-11-23 16:26:31 +00:00
Russell Cohen 32a09ecda6
set appropriate minimum httpbody version (#883)
* set appropriate minimum httpbody version

* Update changelogs

* changelog

* HTTP Body version in generated code

Co-authored-by: Zelda Hessler <zhessler@amazon.com>
2021-11-22 11:16:55 -05:00
John DiSanti a46e4899cc
Discourage use of hardcoded credentials (#875)
* Add missing documentation to `aws-types`

* Discourage use of hardcoded credentials

* Update the changelog

* Fix doc comments

* Fix the changelog
2021-11-20 01:57:15 +00:00
Zelda Hessler a9a691b6b4
Feature: Fine-grained Timeout Configuration (#831)
* add: TimeoutConfig
add: provider to fetch timeout from profile
add: provider to fetch timeout from environment
add: default provider for TimeoutConfigs
update: aws_config::Config to support timeout conf
update: rustdoc lint

* add: TimeoutConfigBuilder::merge_with test

* update: changelogs

* add: timeout_config to client and builder
add: generic timeout service
add: non-working timeout layer

* add: timeout layer/service with configurable duration
add: test that ensures timeout service works

* fix: eliminate useless clones

* feature: Kotlin decorator for TimeoutConfig
add: tests for timeout-related codegen
update: incorrect package path in RetryConfigDecorator.kt
fix: outdated aws-config timeout config code

* remove: link to struct in external crate
fix: outdated doc test
fix: add missing import to doc test
fix: copypaste error in doc test
update: outdated lint name

* update: comment on Builder::timeout_config panics
add: test ensuring timeouts can't be infinite
update: use a floating point number in a timeout doc
update: message for failed profile load to mention that profile will be skipped
remove: commented out code
update: attempt to make difference between api_call_timeout and api_call_attempt_timeout clearer
update: outdated doc comments
update: TimeoutConfigError descriptions

* formatting: arrange imports in aws_smithy_client lib.rs
add: todo for improving timeout error categorization

* update: var parsers to work without needless allocations
update: improve example for default timeout config provider
update: improve example for default retry config provider
fix: unhelpful doc comment for TimeoutLayerFuture<T>
remove: outdated TODO

* fix: various typos in docs
add: PR links to changelogs
format: doc references to structs to look nicer
add: note about expected form and unit of timeout config data
update: expand ProfileFileTimeoutConfigProvider example

* fix: relocate provider config tests to the correct package/directory
remove: unimplemented timeouts from `Settings`

* add: S3 integration test for timeouts
update: re-enable TimeoutLayers
add: "list_of_set_timeouts" logging helper to TimeoutConfig
refactor: the way TimeoutService handles futures so that it can work better with no timeout set
add: helper structs to make creating timeout services easier

* update: split timeout_config example into multiple lines

* fix: Clippy lints

* fix: outdated test

* fix: more clippy lints

* fix: typo
add: TimeoutConfig example

* Update CHANGELOG.md

Co-authored-by: Russell Cohen <rcoh@amazon.com>

* Update aws/rust-runtime/aws-config/src/default_provider.rs

Co-authored-by: Russell Cohen <rcoh@amazon.com>

* Update aws/rust-runtime/aws-config/src/default_provider.rs

Co-authored-by: Russell Cohen <rcoh@amazon.com>

* Update aws/rust-runtime/aws-config/src/default_provider.rs

Co-authored-by: Russell Cohen <rcoh@amazon.com>

* Update aws/rust-runtime/aws-config/src/default_provider.rs

Co-authored-by: Russell Cohen <rcoh@amazon.com>

* Update aws/rust-runtime/aws-config/src/default_provider.rs

Co-authored-by: Russell Cohen <rcoh@amazon.com>

* Update aws/rust-runtime/aws-config/src/default_provider.rs

Co-authored-by: Russell Cohen <rcoh@amazon.com>

* feature: user-configurable AsyncSleep impls
update: fallback to sleep impl that sleeps forever instead of sleep impl being optional

* Update rust-runtime/aws-smithy-types/src/timeout.rs

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

* update: changelogs
format: SleepImplDecorator.kt
update: TimeoutConfig doc
remove: list_of_set_timeouts in favor of Debug impl for TimeoutConfig

* Apply suggestions from code review

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

* fix: broken macro doc test by ignoring it
fix: outdated struct ref in doc
fix: outdated generated doc

* fix: mode broken doc tests

* fix: broken doc test

* attempt to fix CI-only doc test error

* add: moduleUseName method to CodegenContext
remove: pub use reexports from timeout and sleep impl decorators
add: pub use reexports to aws_config for timeout and retry configs
undo: default_sleep_impl changes
attempt to add tokio time feature to S3 integration test

* Update timeout.rs

* Apply suggestions from code review

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

* refactor: consolidate timeout parsing logic
rename: `RetryConfigBuilder::merge_with` to `RetryConfigBuilder::take_unset_from`
refactor: move timeout parsing tests to timeouts.rs
add: entry to SDK changelog noting the renaming
remove: redundant feature from s3 integration test Cargo.toml
update: various setters added by this PR to have the same form as our preexisting setters
add: extra info to the warning emitted when ConfigLoader calls default_async_sleep and gets None

* fix: tests broken when implementing suggestions

* update: doc hide sleep_impl for aws_types::Config
remove: leftover comment

Co-authored-by: Russell Cohen <rcoh@amazon.com>
Co-authored-by: John DiSanti <jdisanti@amazon.com>
2021-11-19 21:16:24 +00:00
Russell Cohen cab7de3faf
Add / fix smithy-client docs (#855)
* Add / fix smithy-client docs

* Rework hyper impls to be a regular public module instead of pub use

* clarify comments, fix changelog

* cleanup code in docs

* Add doc linking

* Update rust-runtime/aws-smithy-client/src/hyper_ext.rs

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

* fix changelog

* SDK changelog docs

Co-authored-by: John DiSanti <jdisanti@amazon.com>
2021-11-19 20:41:25 +00:00
Matteo Bigoi 6e312389fa
Better handling of documentation for Router (#872) 2021-11-18 16:11:13 +00:00
Matteo Bigoi 8293b67719
Allow to wrap routes with Tower Layers (#869) 2021-11-18 14:26:13 +00:00
david-perez 7fabbb74c6
Add server operation registry and router (#850)
This commit adds two things:

1. A runtime router implementing `tower`'s
   [`Service`](https://docs.rs/tower-service/0.3.1/tower_service/trait.Service.html)
   that adheres to [Smithy's `http` trait
   specification](https://awslabs.github.io/smithy/1.0/spec/core/http-traits.html#http-trait),
   that is linear in the number of registered routes.
2. A code-generated "operation registry" that allows service
   implementers to provide Rust functions and declare them as the
   handlers for their service's operations.

The framework will receive HTTP requests from the server and route them
to the corresponding operation handler.
2021-11-16 18:30:08 +01:00
Matteo Bigoi d742a699e5
Implement FromRequest / ToResponse traits for inputs/outputs/errors. (#839)
* Implement FromRequest / ToResponse traits for inputs/outputs/errors
* Update server runtime to expose needed functionalities
* Remove temporary traits from server runtime
* Update CODEOWNERS
2021-11-12 16:27:36 +00:00
John DiSanti 72eae556ae
Relegate `chrono` to an optional feature in a new conversion crate (#849)
* Refactor Instant to use `time` instead of `chrono`
* Rename methods on Instant to have a consistent naming scheme.
* Remove built-in Instant conversions.
* Remove `chrono` from `aws-sigv4`
* Re-export `Instant` from service crates
* Implement `aws-smithy-types-convert`
* Rename `Instant` to `DateTime`
* Make date-time formatting operations fallible
* Add initial changelog entries
* Update changelog
* Make DateTime to SystemTime conversion fallible
* Incorporate review feedback
* Fix merge issues
* Fix examples
* Fix doc comments
* Fix unused import warning when using `convert-chrono` feature exclusively
2021-11-11 16:01:30 -08:00
Zelda Hessler 3fe5efced6
update: Ensure service stack is Send + Sync (#851)
* update: ensure RetryHandler is send + sync
update: ensure service stack is send + sync

* Update rust-runtime/aws-smithy-client/src/lib.rs

Co-authored-by: John DiSanti <jdisanti@amazon.com>
2021-11-10 22:49:26 +00:00
Matteo Bigoi d215bb0815
Update MSRV to 1.54.0 (#844) 2021-11-10 12:51:31 +00:00
John DiSanti 4a1261f9db
Fix bug in epoch second parsing and improve tests (#834)
* Implement time format/parse test suite generator

* Run generated test suite against `aws-smithy-types`

* Fix minor difference with test suite HTTP date formatting

* Fix bugs discovered in epoch seconds parsing

* Reduce allocations in epoch seconds formatting

* Update changelogs

* Improve test data format

* Remove unsafe from epoch-seconds parsing and increase test coverage

* Add fuzz test suite for date-time parsing to `aws-smithy-types`
2021-11-04 22:33:09 +00:00
Russell Cohen c8a940be89
Unknown variants (#818)
* Add symbol provider support for renaming union variants

* Generate errors when serializing unknown variants in JSON

* Add support for serializing Unknown variants in XML

* Support optionally generating the unknown variant

* Add support for parsing unknown JSON variants

* Add unknown union support to XML

* fixup tests & clippy

* backup changes to mk-generated

* Support the unknown variant for event streams

* fix compilation warning

* fix awsquery serializer tests

* Remove conversion & lint supression

* Remove unused custom attributes

* remove some more pointless conversions

* Fix test indentation

* CR feedback

* Update Changelogs

* Remove usages of toPascalCase

* Fix eventstream error message

* Fix braces in server codegen

* Fix doublequoted string issue
2021-11-04 14:54:05 +00:00
Matteo Bigoi 1fa0ecfcce
Runtime and client codegen support for improved server protocol dispatcher (#822)
* Runtime and client codegen support for improved server protocol dispatcher

Implement Rust runtime defining the traits used by the server to build operations
parsers/serializers:
  * ParseHttpRequest
  * SerializeHttpResponse
  * SerializeHttpError

Refactor ProtocolSupport to allow server configurations:
  * requestDeserialization (bool)
  * requestBodyDeserialization (bool)
  * responseSerialization(bool)
  * errorSerialization(bool)

Change visibility of HttpBoundProtocolGenerator methods to allow to use
them in the server generator

Co-authored-by: Russell Cohen <rcoh@amazon.com>
Co-authored-by: david-perez <d@vidp.dev>
2021-11-02 18:24:35 +00:00
Russell Cohen bd37a9c640
Add check for incomplete_message from Hyper (#815)
Co-authored-by: Zelda Hessler <zelda.hessler@pm.me>
2021-10-27 14:45:35 -04:00
Zelda Hessler 1586d0b0c4
fix: various typos (#813)
* fix: various typos

* undo: model spellchecking

* revert: bad change to model docs
2021-10-27 18:21:06 +00:00
Zelda Hessler 2757fcbbf7
fix: sigv4 now correctly trims spaces (#799)
* fix: sigv4 now correctly trims spaces
add: test for space trimming
add: s3 signing integration test
add: lambda signing integration test

* update: lambda signing test to skip lines that cause an InvalidSignatureException

* add: tests for trim_all
add: missing LICENSE for BLNS

* fix: outdated use statements

* fix: clippy err

* add: missing dep to dynamodb bench
update: ignore naughty strings tests that require real aws connection
fix: s3 naughty strings metadata signing test

* update: move blns to work with our testing process
remove: circular dep aws-config from integration testing crates
update: comment out tests not runnable by CI
format: run cargo fmt

* update: signature snapshot
update: hide lambda tests from integration runner

* update: SDK Changelog

* add: proptest for normalize_header_value
add: proptest for trim_all
update: convert trimming to work on byte slices instead of strings
update: update trimming test to use byte slices

* fix: overly permissive whitespace check
update: test_trim_all_ignores_other_forms_of_whitespace to be more robust
update: use indexes over iterators in an attempt to appease the optimizer
update: test_s3_signer_with_naughty_string_metadata expected signature

* update: test_signer expected signature
2021-10-26 15:10:06 -05:00