## Checklist
<!--- If a checkbox below is not applicable, then please DELETE it
rather than leaving it unchecked -->
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the
smithy-rs codegen or runtime crates
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the AWS
SDK, generated SDK code, or SDK runtime crates
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
Runtime plugins need to be able to wrap components configured in other
runtime components. For example, one runtime plugin should be able to
wrap the HTTP connector configured in another runtime plugin.
This PR makes this possible by:
- Introducing the ability to order runtime plugins within the
service/operation plugin "levels".
- Adding an argument to `RuntimePlugin::runtime_components` so that
implementations can reference components configured by previous plugins.
The `order` function has three separate order values: `Defaults`,
`Overrides`, and `NestedComponents`. The `Defaults` order is currently
unused, but will be used later when we refactor how defaults in config
work. Everything defaults to `Overrides` since most runtime plugins will
want to be in this slot. The `NestedComponents` order is specifically
for runtime plugins that want to create nested components, and runs at
the very end.
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
**Will be merged to `smithy-rs-release-0.56.x` branch**
Addresses https://github.com/awslabs/aws-sdk-rust/issues/872
## Motivation and Context
With the introduction of the orchestrator, the core functions that live
in `aws-smithy-runtime/src/client/orchestrator.rs` were annotated by
`#instrument`. By default this emits logs at the `INFO` level, which
caused our customer to see the excessive amount of logging after
switching to the latest SDK creates `0.29`.
## Description
This PR reduces the log level to `DEBUG` wherever we use `#instrument`
throughout the file.
## Testing
No new tests have been added as part of this PR. [An
enhancement](https://github.com/awslabs/smithy-rs/issues/2932) has been
filed to check logging volume.
Here is a quick check that all instances in the file specify `trace`:
```
✗ rg "instrument"
src/client/orchestrator.rs
34:use tracing::{debug, debug_span, instrument, trace, Instrument};
160: .instrument(debug_span!("invoke", service = %service_name, operation = %operation_name))
167:#[instrument(skip_all, level = "debug")]
186:#[instrument(skip_all, level = "debug")]
319:#[instrument(skip_all, level = "debug")]
389: .instrument(debug_span!("read_body"))
398: .instrument(debug_span!("deserialization"))
407:#[instrument(skip_all, level = "debug")]
419:#[instrument(skip_all, level = "debug")]
```
## Checklist
<!--- If a checkbox below is not applicable, then please DELETE it
rather than leaving it unchecked -->
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the
smithy-rs codegen or runtime crates
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the AWS
SDK, generated SDK code, or SDK runtime crates
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
---------
Co-authored-by: ysaito1001 <awsaito@amazon.com>
This PR replaces the access_key, secret_key, and session token fields of
signing params with the Orchestrator's `Identity` type.
## Checklist
<!--- If a checkbox below is not applicable, then please DELETE it
rather than leaving it unchecked -->
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the
smithy-rs codegen or runtime crates
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the AWS
SDK, generated SDK code, or SDK runtime crates
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
Part of the SigV4a update. I split this out to making review simpler.
## Checklist
<!--- If a checkbox below is not applicable, then please DELETE it
rather than leaving it unchecked -->
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the
smithy-rs codegen or runtime crates
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the AWS
SDK, generated SDK code, or SDK runtime crates
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
## Motivation and Context
Removes the public http dependency from the aws-sigv4 crate to avoid
compatibility issues with http = 1.0 and to support the http refactor
## Description
- Changes `SignableRequest::new` to remove the direct exposure of HTTP
types
- Assorted test refactorings as a result
- Update calling code
## Testing
IT/UT
## Checklist
TODO: changelog
<!--- If a checkbox below is not applicable, then please DELETE it
rather than leaving it unchecked -->
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the
smithy-rs codegen or runtime crates
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the AWS
SDK, generated SDK code, or SDK runtime crates
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
Previously the docs said `Vec<String>` when the method actually accepted
`String`, similarly for HashMap.
## Motivation and Context
- https://github.com/awslabs/aws-sdk-rust/issues/825
## Description
Fix the generator to be aware of Vec/Hashmap methods
## Testing
- UT
- [x] audit codegen diff
## Checklist
<!--- If a checkbox below is not applicable, then please DELETE it
rather than leaving it unchecked -->
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the AWS
SDK, generated SDK code, or SDK runtime crates
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
## Motivation and Context
This PR implements a short-term solution for aws-sdk-rust#864 while a
long-term solution is worked out.
## Testing
- Tested manually against S3.
- Added DVR tests.
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
Re-export `RuntimeComponents`, and for generic clients,
`RuntimeComponentsBuilder`, so that a direct dependency on
`aws-smithy-runtime-api` isn't required to implement custom interceptors
or runtime plugins.
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
## Motivation and Context
Clients using separate connectors is mostly confusing and troublesome
for customers.
## Description
Change the behavior of `ConfigLoader::http_connector` to set both the
client & credential provider HTTP connector.
**Note**: It is still possible to separate control clients for the
credential provider. Because `HttpConnector` is used, the timeout
settings can still be late-bound.
## Testing
Unit tests.
## Checklist
<!--- If a checkbox below is not applicable, then please DELETE it
rather than leaving it unchecked -->
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the
smithy-rs codegen or runtime crates
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the AWS
SDK, generated SDK code, or SDK runtime crates
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
## Motivation and Context
- #2087
test-util pulled in Hyper but that's not strictly necessary
## Description
Split out wiremock as it's own features and do some other cleanup.
## Testing
CI
## Checklist
<!--- If a checkbox below is not applicable, then please DELETE it
rather than leaving it unchecked -->
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the
smithy-rs codegen or runtime crates
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the AWS
SDK, generated SDK code, or SDK runtime crates
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
## Motivation and Context
When `TimeSource` was created, we didn't carefully track down all the
places and left a bit of existing implementation to limit the scope of
the change.
## Description
This removes the public (doc hidden) Testing code from
aws-credential-types and our other test time sources instead.
## Testing
- IT/UT
## Checklist
<!--- If a checkbox below is not applicable, then please DELETE it
rather than leaving it unchecked -->
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the
smithy-rs codegen or runtime crates
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the AWS
SDK, generated SDK code, or SDK runtime crates
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
---------
Co-authored-by: John DiSanti <jdisanti@amazon.com>
This essentially reverts the behavior introduced in #1982.
The rationale for that change:
> [...] since some existing clients rely on it to deserialize the error
shape
> and fail if only the shape name is present
no longer holds. Since serializing only the shape name is a SHOULD in
the spec, it's best that we honor it.
## Checklist
<!--- If a checkbox below is not applicable, then please DELETE it
rather than leaving it unchecked -->
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the
smithy-rs codegen or runtime crates
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
The current module location is misleading, since you never want to run
the layer as a plugin: plugins always run after routing, and the health
check should be enacted before routing. Examples have been corrected,
and a test has been added.
## Checklist
<!--- If a checkbox below is not applicable, then please DELETE it
rather than leaving it unchecked -->
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the
smithy-rs codegen or runtime crates
- [ ] I have updated `CHANGELOG.next.toml` if I made changes to the AWS
SDK, generated SDK code, or SDK runtime crates
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
## Motivation and Context
The field name is being changed, but we need to maintain support for
customers already using this feature
## Description
<!--- Describe your changes in detail -->
## Testing
- existing tests
## Checklist
<!--- If a checkbox below is not applicable, then please DELETE it
rather than leaving it unchecked -->
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the
smithy-rs codegen or runtime crates
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the AWS
SDK, generated SDK code, or SDK runtime crates
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
## Motivation and Context
Removes `#[doc(hidden)]` from struct fields.
## Testing
- [ ] Passed tests in CI
## Checklist
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the
smithy-rs codegen or runtime crates
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
---------
Co-authored-by: ysaito1001 <awsaito@amazon.com>
## Motivation and Context
Addresses item 8 in #2413
## Description
This PR removes the third party types as follows:
- removes `SegmentedBuf` from public API in `aws-smithy-http` (used when
the feature `event-stream` was enabled)
## Testing
- [x] Passed tests in CI
## Checklist
<!--- If a checkbox below is not applicable, then please DELETE it
rather than leaving it unchecked -->
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the
smithy-rs codegen or runtime crates
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
---------
Co-authored-by: ysaito1001 <awsaito@amazon.com>
This PR fixes Timestream in the orchestrator implementation.
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
## Motivation and Context
Addresses item 1, 3, and 9 in #2413
## Description
This PR removes the third party types as follows:
- removes `InvalidHeaderValue` from public API in `aws-http`
- removes `SendError` from public API in `aws-smithy-async`
- removes `xmlparser` from public API in `aws-smithy-xml`
Those types were exposed to public APIs primarily due to the
implementation of traits, e.g. `From` and `Iterator`. Those
implementations are used internally (such as XML deserialization and
converting an error type) so we should be able to hide them within
crates.
## Testing
- [x] Passed tests in CI
## Checklist
<!--- If a checkbox below is not applicable, then please DELETE it
rather than leaving it unchecked -->
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the
smithy-rs codegen or runtime crates
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the AWS
SDK, generated SDK code, or SDK runtime crates
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
---------
Co-authored-by: ysaito1001 <awsaito@amazon.com>
## Motivation and Context
Addresses https://github.com/awslabs/smithy-rs/issues/2767
This fixes an issue for users who write endpoint tests that rely on an
operation and service shape from different namespaces.
## Description
Instead of assuming operation namespace matches service namespace,
## Testing
`./gradlew :aws:sdk-codegen:test`
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
---------
Co-authored-by: Zelda Hessler <zhessler@amazon.com>
So far, servers have tacitly worked with the notion that plugins come in
two flavors: "HTTP plugins" and "model plugins":
- A HTTP plugin acts on the HTTP request before it is deserialized, and
acts on the HTTP response after it is serialized.
- A model plugin acts on the modeled operation input after it is
deserialized, and acts on the modeled operation output or the modeled
operation error before it is serialized.
However, this notion was never reified in the type system. Thus, users
who pass in a model plugin where a HTTP plugin is expected or
viceversa in several APIs:
```rust
let pipeline = PluginPipeline::new().push(http_plugin).push(model_plugin);
let app = SimpleService::builder_with_plugins(http_plugins, IdentityPlugin)
.post_operation(handler)
/* ... */
.build()
.unwrap();
```
would get the typical Tower service compilation errors, which can get
very confusing:
```
error[E0631]: type mismatch in function arguments
--> simple/rust-server-codegen/src/main.rs:47:6
|
15 | fn new_svc<S, Ext>(inner: S) -> model_plugin::PostOperationService<S, Ext> {
| -------------------------------------------------------------------------- found signature defined here
...
47 | .post_operation(post_operation)
| ^^^^^^^^^^^^^^ expected due to this
|
= note: expected function signature `fn(Upgrade<RestJson1, (PostOperationInput, _), PostOperationService<aws_smithy_http_server::operation::IntoService<simple::operation_shape::PostOperation, _>, _>>) -> _`
found function signature `fn(aws_smithy_http_server::operation::IntoService<simple::operation_shape::PostOperation, _>) -> _`
= note: required for `LayerFn<fn(aws_smithy_http_server::operation::IntoService<..., ...>) -> ... {new_svc::<..., ...>}>` to implement `Layer<Upgrade<RestJson1, (PostOperationInput, _), PostOperationService<aws_smithy_http_server::operation::IntoService<simple::operation_shape::PostOperation, _>, _>>>`
= note: the full type name has been written to '/local/home/davidpz/workplace/smithy-ws/src/SmithyRsSource/target/debug/deps/simple-6577f9f79749ceb9.long-type-4938700695428041031.txt'
```
This commit introduces the `HttpPlugin` and `ModelPlugin` marker traits,
allowing plugins to be marked as an HTTP plugin, a model plugin, or
both. It also removes the primary way of concatenating plugins,
`PluginPipeline`, in favor of `HttpPlugins` and `ModelPlugins`, which
eagerly check that whenever a plugin is `push`ed, it is of the expected
type. The generated service type in the server SDKs'
`builder_with_plugins` constructor now takes an `HttpPlugin` as its
first parameter, and a `ModelPlugin` as its second parameter.
I think this change perhaps goes counter to the generally accepted
wisdom that trait bounds in Rust should be enforced "at the latest
possible moment", that is, only when the behavior encoded in the trait
implementation is relied upon in the code (citation needed).
However, the result is that exposing the concepts of HTTP plugin and
model plugin in the type system makes for code that is easier to reason
about, and produces more helpful compiler error messages.
Documentation about the plugin system has been expanded, particularly on
how to implement model plugins.
## Checklist
<!--- If a checkbox below is not applicable, then please DELETE it
rather than leaving it unchecked -->
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the
smithy-rs codegen or runtime crates
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
## Motivation and Context
When customers add x-ray headers to requests, the SigV4 signer should
exclude them, or the generated canonical signature will not match the
remote service's, since many services being called are written with
non-rust SDKs that automatically exclude these common headers.
The Rust SDK should exclude a similar set of headers to the other
popular AWS SDKs. While this is not uniform across the SDKs, a minimal
set should be excluded and others should be considered to be excluded in
future PRs.
## Description
* Expands the set of headers excluded from canonical request calculation
to include "x-amzn-trace-id" and "authorization" (since authorization
will be added as a part of this process).
## Testing
* Added headers to exclusion test & validated with `cargo test`
* `./gradlew :aws:sdk:test`
## Checklist
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the AWS
SDK, generated SDK code, or SDK runtime crates
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
---------
Co-authored-by: Sam Bartlett <sbartl@amazon.com>
Co-authored-by: Zelda Hessler <zhessler@amazon.com>
This allows testing, as well as making decisions while creating
builders. The references are not mutable, so these props remain read
only keeping the Builder invariants.
## Motivation and Context
<!--- Why is this change required? What problem does it solve? -->
Some operations are built up using various logic (for instance, choosing
an S3 bucket based on a logged in user). It is a lot of overhead to test
at the mock level, and the Debug formatting is typically not stable.
<!--- If it fixes an open issue, please link to the issue here -->
Closes#2791
## Description
<!--- Describe your changes in detail -->
1. Add `get_foo(&self) -> &Option<Foo>` to Builders
2. Add `as_input(&self) -> &OperationInputBuilder` to Fluent Builders
3. Add `get_foo(&self) -> &Option<Foo>` to FluentBuilder which delegates
to Builders
## Testing
<!--- Please describe in detail how you tested your changes -->
Included unit tests, as well as [proof of concept
tests](017e8a2e40)
<!--- Include details of your testing environment, and the tests you ran
to -->
<!--- see how your change affects other areas of the code, etc. -->
## Checklist
<!--- If a checkbox below is not applicable, then please DELETE it
rather than leaving it unchecked -->
- [X] I have updated `CHANGELOG.next.toml` if I made changes to the
smithy-rs codegen or runtime crates
- [X] I have updated `CHANGELOG.next.toml` if I made changes to the AWS
SDK, generated SDK code, or SDK runtime crates
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
---------
Co-authored-by: John DiSanti <jdisanti@amazon.com>
## Motivation and Context
<!--- Why is this change required? What problem does it solve? -->
<!--- If it fixes an open issue, please link to the issue here -->
Avoid intermediate vec allocations in `AggregatedBytes::to_vec`.
## Description
<!--- Describe your changes in detail -->
Calling `slice::to_vec` on every segment is wasteful, the segments can
be just flattened into an iterator over `u8`s and collected directly.
Also makes the code a bit simpler.
## Testing
<!--- Please describe in detail how you tested your changes -->
<!--- Include details of your testing environment, and the tests you ran
to -->
<!--- see how your change affects other areas of the code, etc. -->
## Checklist
<!--- If a checkbox below is not applicable, then please DELETE it
rather than leaving it unchecked -->
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the
smithy-rs codegen or runtime crates
- [ ] I have updated `CHANGELOG.next.toml` if I made changes to the AWS
SDK, generated SDK code, or SDK runtime crates
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
---------
Co-authored-by: 82marbag <69267416+82marbag@users.noreply.github.com>
## Motivation and Context
Incorporates suggestion made in
https://github.com/awslabs/smithy-rs/pull/2762#discussion_r1231462878
## Description
This PR renames `make_token` to `idempotency_token_provider` for clarity
wherever it is referred to in the fields and API in service configs and
their builders.
## Testing
Existing tests in CI
## Checklist
<!--- If a checkbox below is not applicable, then please DELETE it
rather than leaving it unchecked -->
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the
smithy-rs codegen or runtime crates
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the AWS
SDK, generated SDK code, or SDK runtime crates
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
---------
Co-authored-by: Yuki Saito <awsaito@amazon.com>
## Motivation and Context
Closes https://github.com/awslabs/smithy-rs/issues/1839
Currently, `Plugin` is parameterized by protocol and operation. To
improve symmetry, extensibility and uniformity we switch this to be
parameterized by service instead. The protocol can still be recovered
via the `type Protocol` associated type on `ServiceShape`.
## Description
- Add `ServiceShape` trait, encoding the properties of a Smithy service.
- Change `Plugin<Protocol, Operation, S>` to `Plugin<Service, Operation,
S>`.
- Add `FilterByOperation` and `filter_by_operation` `Plugin`s.
## Motivation and Context
This is a child PR of https://github.com/awslabs/smithy-rs/pull/2615.
## Description
- Adds `send_with` method to Fluent Builder.
## Prerequisite PRs
You can merge this first too reduce diffs.
- https://github.com/awslabs/smithy-rs/pull/2651
## Testing
NA
## Checklist
NA
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
---------
Co-authored-by: John DiSanti <johndisanti@gmail.com>
Co-authored-by: John DiSanti <jdisanti@amazon.com>
## Motivation and Context
This PR upgrades the MSRV to 1.68.2.
## Checklist
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the
smithy-rs codegen or runtime crates
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the AWS
SDK, generated SDK code, or SDK runtime crates
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
---------
Co-authored-by: Zelda Hessler <zhessler@amazon.com>
Co-authored-by: 82marbag <69267416+82marbag@users.noreply.github.com>
## Motivation and Context
Hides `Arc<dyn ResolveEndpoint>` from public API.
## Description
This PR replaces the occurrences of `Arc<dyn ResolveEndpoint>` with
`SharedEndpointResolver` to not expose bare `Arc`s in the public API.
## Testing
- [x] Passed tests in CI
## Checklist
<!--- If a checkbox below is not applicable, then please DELETE it
rather than leaving it unchecked -->
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the
smithy-rs codegen or runtime crates
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
---------
Co-authored-by: Yuki Saito <awsaito@amazon.com>
See https://github.com/awslabs/smithy-rs/issues/2634
## Checklist
<!--- If a checkbox below is not applicable, then please DELETE it
rather than leaving it unchecked -->
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the
smithy-rs codegen or runtime crates
- [ ] I have updated `CHANGELOG.next.toml` if I made changes to the AWS
SDK, generated SDK code, or SDK runtime crates
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
---------
Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
Co-authored-by: Harry Barber <106155934+hlbarber@users.noreply.github.com>
## Motivation and Context
Add `SharedAsyncSleep` wrapping `Arc<dyn AsyncSleep>` and update call
sites of `Arc<dyn AsyncSleep>` to use `SharedAsyncSleep`
## Description
Public APIs that take/return a trait object for `AsyncSleep` have been
using `Arc<dyn AsyncSleep>` in the codebase. This has a downside of
exposing a bare `Arc`, making it difficult to change the APIs in the
future without breaking backwards compatibility. This PR adds a newtype
wrapper `SharedAsyncSleep` that hides `Arc<dyn AsyncSleep>` to alleviate
the said issue (the idiom of having `SharedXXX` has been seen in the
codebase, e.g. `SharedTimeSource`, `SharedCredentialsProvider`, and so
on).
## Testing
- [x] Passed tests in CI
## Checklist
<!--- If a checkbox below is not applicable, then please DELETE it
rather than leaving it unchecked -->
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the
smithy-rs codegen or runtime crates
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the AWS
SDK, generated SDK code, or SDK runtime crates
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
---------
Co-authored-by: Yuki Saito <awsaito@amazon.com>
Co-authored-by: John DiSanti <jdisanti@amazon.com>
TODO:
- [x] docs
- [x] integration test (canary even?)
- [x] customize README for timestream
## Motivation and Context
- #613
- https://github.com/awslabs/aws-sdk-rust/issues/114
## Description
This adds support for TSW and TSQ by adding endpoint discovery as a
customization. This is made much simpler by the fact that endpoint
discovery for these services **has no parameters** which means that
there is no complexity from caching the returned endpoint.
Customers call `.enable_endpoint_discovery()` on the client to create a
version of the client with endpoint discovery enabled. This returns a
new client and a Reloader from which customers must spawn the reload
task if they want endpoint discovery to rerun.
## Testing
<!--- Please describe in detail how you tested your changes -->
<!--- Include details of your testing environment, and the tests you ran
to -->
<!--- see how your change affects other areas of the code, etc. -->
## Checklist
<!--- If a checkbox below is not applicable, then please DELETE it
rather than leaving it unchecked -->
- [ ] I have updated `CHANGELOG.next.toml` if I made changes to the
smithy-rs codegen or runtime crates
- [ ] I have updated `CHANGELOG.next.toml` if I made changes to the AWS
SDK, generated SDK code, or SDK runtime crates
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
## Motivation and Context
- #2262
- #2087
- #2707
This adds `TimeSource` in SDK and service configs so we can effectively
control time when executing requests with the SDK at the client level.
_note:_ the breaking change is in a trait implementation of a struct
we're going to delete, not a real breaking change
## Description
- Add `SharedTimeSource` and use it in SdkConfig / `aws-config` /
<service>::Config
- Wire up the signer and other uses of `SystemTime::now()` that I could
find
- track down broken tests
## Testing
- [x] various unit tests that all still pass
## Checklist
<!--- If a checkbox below is not applicable, then please DELETE it
rather than leaving it unchecked -->
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the
smithy-rs codegen or runtime crates
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the AWS
SDK, generated SDK code, or SDK runtime crates
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
## Motivation and Context
15th operation was being dropped when iterator was being read into a
TinyMap
## Description
The 15th operation was being dropped when the if statement was caught
because the operation had been popped of the iterator but hadn't been
added to the vec of operations before the two iterators were being
chained and collected into a
## Testing
Added unit tests that reproduced the issue and verified that the issue
is fixed
## Checklist
<!--- If a checkbox below is not applicable, then please DELETE it
rather than leaving it unchecked -->
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the
smithy-rs codegen or runtime crates
- [ ] I have updated `CHANGELOG.next.toml` if I made changes to the AWS
SDK, generated SDK code, or SDK runtime crates
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
---------
Co-authored-by: david-perez <d@vidp.dev>
Co-authored-by: Fahad Zubair <fahadzubair@gmail.com>
Now that constraint traits are supported in server SDKs (with some
corner case caveats, see #1401), this flag will almost always be useless
for those early adopters of constraint traits. It is thus convenient to
inform the user that they should remove it.
See
https://github.com/awslabs/smithy-rs/pull/2516#issuecomment-1490393056.
## Checklist
<!--- If a checkbox below is not applicable, then please DELETE it
rather than leaving it unchecked -->
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the
smithy-rs codegen or runtime crates
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
## Motivation and Context
<!--- Why is this change required? What problem does it solve? -->
I'm building an s3 server in rust and I need signature verification to
work from the server side when receiving requests. To do that the server
needs to generate a signature and then compare it to the one that the
client has already sent along. I believe that the sign module in
aws-sigv4 http_request contains the functions required to do that.
<!--- If it fixes an open issue, please link to the issue here -->
## Description
<!--- Describe your changes in detail -->
Exported the `SigningInstructions` struct in the sign module of
http_request for aws-sigv4.
## Testing
<!--- Please describe in detail how you tested your changes -->
<!--- Include details of your testing environment, and the tests you ran
to -->
<!--- see how your change affects other areas of the code, etc. -->
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
---------
Co-authored-by: Chris Holcombe <chholcombe@tesla.com>
Co-authored-by: John DiSanti <jdisanti@amazon.com>
## Motivation and Context
This PR gets event streams working in the client orchestrator
implementation, and depends on #2671.
The orchestrator's `TypeErasedBox` enforces a `Send + Sync` requirement
on inputs and outputs. For the most part, this isn't an issue since
almost all generated inputs/outputs are `Send + Sync`, but it turns out
the `EventStreamSender` wasn't `Sync` due to an omission of the `Sync`
bound. Thus, this PR is a breaking change, as it adds a `Sync`
requirement for anyone who passes a stream to an event stream operation.
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
## Motivation and Context
This PR creates a `DeferredSigner` implementation that allows for the
event stream message signer to be wired up by the signing implementation
later in the request lifecycle rather than by adding an event stream
signer method to the config.
Refactoring this brings the middleware client implementation closer to
how the orchestrator implementation will work, which unblocks the work
required to make event streams work in the orchestrator.
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
* Show how to plug a connector
* For TLS: keep rustls, only
## Checklist
<!--- If a checkbox below is not applicable, then please DELETE it
rather than leaving it unchecked -->
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the
smithy-rs codegen or runtime crates
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the AWS
SDK, generated SDK code, or SDK runtime crates
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
---------
Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
## Motivation and Context
This PR merges the changelog changes made by the release script from the
`smithy-rs-release-0.55.x` branch.
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
Co-authored-by: AWS SDK Rust Bot <aws-sdk-rust-primary@amazon.com>
## Motivation and Context
Related to https://github.com/awslabs/aws-sdk-rust/issues/809
## Description
It has been discovered that when `AssumeRoleProvider` is used, the Rust
SDK emits `credentials cache miss occurred` twice per request. The
reason why that log is shown twice is illustrated in the following
diagram:
![Screenshot 2023-05-19 at 4 10 20
PM](https://github.com/awslabs/smithy-rs/assets/15333866/c6cce018-c821-4b46-8d47-b414af7b4d1e)
One of the cache miss messages is due to the fact `AssumeRoleProvider`
internally uses an STS client, which, in turn, is wrapped by a
`LazyCredentialsCache` by default. However, that use of
`LazyCredentialsCache` is pointless because caching is already in effect
with the outermost `LazyCredentialsCache`.
This PR adds a new kind of `CredentialsCache`, `NoCredentialsCache`. As
its name suggests, it simplify delegates `provide_cached_credentials` to
the underlying provider's `provide_credentials` with no caching
functionality. We then update `SsoCredentialsProvider`,
`AssumeRoleProvider`, and `WebIdentityTokenCredentialsProvider` to use
`NoCredentialsCache` for their STS clients so the logs won't show
`credentials cache miss occurred` twice per request.
## Testing
- Added unit tests for `NoCredentialsCache`
- Updated unit test for `AssumeRoleProvider` to verify
`NoCredentialsCache` is used by default
## Checklist
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the AWS
SDK, generated SDK code, or SDK runtime crates
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
---------
Co-authored-by: Yuki Saito <awsaito@amazon.com>
## Motivation and Context
The current error if the SSO error message is not enabled is inscrutable
and doesn't point the customer towards the removed feature.
## Description
Fix the error message, add tests.
## Testing
tests
## Checklist
<!--- If a checkbox below is not applicable, then please DELETE it
rather than leaving it unchecked -->
- [ ] I have updated `CHANGELOG.next.toml` if I made changes to the
smithy-rs codegen or runtime crates
- [ ] I have updated `CHANGELOG.next.toml` if I made changes to the AWS
SDK, generated SDK code, or SDK runtime crates
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
## Motivation and Context
Operations named `Send` or `Sync` (and probably others) were colliding
with the types in the standard library prelude and causing compiler
errors. This PR adds tests that include all the type names from the Rust
prelude, and fixes the compiler errors they cause.
In the future, the `no_implicit_prelude` attribute can be added to
certain code generated modules to better enforce that there can't be
name collisions, but for now, the `tokio::test` macro doesn't compile
with that attribute enabled (and likely other macros from other
libraries).
## Checklist
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the
smithy-rs codegen or runtime crates
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
This reverts https://github.com/awslabs/smithy-rs/pull/2678.
It is a breaking change and it will be included in the next release.
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
See https://github.com/awslabs/smithy-rs/issues/2634
## Checklist
<!--- If a checkbox below is not applicable, then please DELETE it
rather than leaving it unchecked -->
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the
smithy-rs codegen or runtime crates
- [ ] I have updated `CHANGELOG.next.toml` if I made changes to the AWS
SDK, generated SDK code, or SDK runtime crates
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
---------
Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
## Motivation and Context
Fixes https://github.com/awslabs/smithy-rs/issues/2687
## Description
The implementation for IMDS static stability support introduced a bug
where returned credentials from IMDS are extended unconditionally, even
though the credentials are not stale. The amount by which credentials
are extended is randomized and it can incorrectly extend the expiry
beyond what's originally set. IMDS produces credentials that last 6
hours, and extending them by at most 25 minutes usually won't be an
issue but when other tools such as Kube2iam and AWSVault are used, the
expiry can be set much shorter than that, causing the issue to occur.
This PR will conditionally extend the credentials' expiry only when the
returned credentials have been expired with respect to the current wall
clock time. Also, the constant values have been adjusted according to
our internal spec.
## Testing
- Added a new unit test for the IMDS credentials provider
## Checklist
<!--- If a checkbox below is not applicable, then please DELETE it
rather than leaving it unchecked -->
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the AWS
SDK, generated SDK code, or SDK runtime crates
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
---------
Co-authored-by: Yuki Saito <awsaito@amazon.com>
This reverts commit 04db5e3572.
This is a breaking change that needs to wait to be merged in until the
next breaking release.
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
This patch also removes the unneeded dependency on `lambda_runtime` by
`aws-smithy-http-server-python`.
This patch also refactors `LambdaHandler`'s `convert_event` to avoid
cloning the URI path when not needed.
This is a breaking change. See #2676 why.
This patch also bumps `aws-smithy-http-server` dependency on `mime` to
0.3.4.
`cargo +nightly-2022-11-16 minimal-versions check --all-features`
otherwise
fails when using 0.3.0, because we require `impl fmt::Display for
mime::FromStrError`, which was first introduced in 0.3.4.
As to why `minimal-versions` is now picking `mime` 0.3.0 with this
patch, it's
because in `lambda_http` 0.7.3, they had [`mime =
"0.3.16"`](99dba64472/lambda-http/Cargo.toml (L35-L35)),
and in `lambda_http` 0.8.0, they've now relaxed that to [`mime =
"0.3"`](393d6447be/lambda-http/Cargo.toml (L36)).
## Checklist
<!--- If a checkbox below is not applicable, then please DELETE it
rather than leaving it unchecked -->
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the
smithy-rs codegen or runtime crates
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
## Motivation and Context
This PR adresses on [feedback from my previous
PR](https://github.com/awslabs/smithy-rs/pull/2653#pullrequestreview-1404515899).
## Description
- use `as_nanos` in `Ord` impl for `DateTime` instead of manual impl.
## Testing
- add proptest that checks that `Ord` impl matches RFC 3339 comparison.
## Checklist
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the
smithy-rs codegen or runtime crates
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
## Motivation and Context
This change will allow easy sorting or comparing anything that contains
a DateTime. My example is wanting to sort a list of S3 objects by last
modified.
This PR fixes#2406
## Description
It's a pretty small PR, it implements the `Ord` trait for `DateTime` by
comparing the `seconds` property of `self` and `other`, if they are
equal it compares the `subsec_nanos` properties instead.
The `PartialOrd` trait is implemented by calling the `Ord` trait.
## Testing
I added a unit test that compares a number of `DateTime` values with
different combinations of positive/zero/negative
`seconds`/`subsec_nanos`.
## Checklist
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the AWS
SDK, generated SDK code, or SDK runtime crates
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
## Motivation and Context
- it's hard to debug what properties are set, especially for layered
configuration
## Description
Add Debug Info for PropertyBag and Config bag:
```
PropertyBag { contents: ["aws_smithy_http::property_bag::test::test_extensions::MyType"] }
```
```
ConfigBag {
layers: [
Layer {
name: "c",
properties: [
"aws_smithy_runtime_api::config_bag::Value<aws_smithy_runtime_api::config_bag::test::layered_property_bag::Prop3>",
"aws_smithy_runtime_api::config_bag::Value<aws_smithy_runtime_api::config_bag::test::layered_property_bag::Prop4>",
],
},
Layer {
name: "b",
properties: [
"aws_smithy_runtime_api::config_bag::Value<aws_smithy_runtime_api::config_bag::test::layered_property_bag::Prop3>",
"aws_smithy_runtime_api::config_bag::Value<aws_smithy_runtime_api::config_bag::test::layered_property_bag::Prop2>",
],
},
Layer {
name: "a",
properties: [
"aws_smithy_runtime_api::config_bag::Value<aws_smithy_runtime_api::config_bag::test::layered_property_bag::Prop1>",
],
},
Layer {
name: "base",
properties: [],
},
],
}
```
There is still some work to do, but this is a start
## Testing
- [x] UT
## Checklist
<!--- If a checkbox below is not applicable, then please DELETE it
rather than leaving it unchecked -->
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the
smithy-rs codegen or runtime crates
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the AWS
SDK, generated SDK code, or SDK runtime crates
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
---------
Co-authored-by: John DiSanti <jdisanti@amazon.com>
## Motivation and Context
Removes changelog entries that have been released with `v0.55.2`
(https://github.com/awslabs/smithy-rs/pull/2623)
## Description
<!--- Describe your changes in detail -->
## Testing
<!--- Please describe in detail how you tested your changes -->
<!--- Include details of your testing environment, and the tests you ran
to -->
<!--- see how your change affects other areas of the code, etc. -->
## Checklist
<!--- If a checkbox below is not applicable, then please DELETE it
rather than leaving it unchecked -->
- [ ] I have updated `CHANGELOG.next.toml` if I made changes to the
smithy-rs codegen or runtime crates
- [ ] I have updated `CHANGELOG.next.toml` if I made changes to the AWS
SDK, generated SDK code, or SDK runtime crates
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
## Motivation and Context
Services often need the ability to report health status via health
checks (see [ALB Health
Checks](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/target-group-health-checks.html)).
This PR adds a simple layer that allows configuring your service to
respond to these health check requests.
## Description
Adds `AlbHealthCheckLayer`, and `AlbHealthCheckService`.
## Testing
Added this layer to the `pokemon-service` binary, and added an
integration test for it.
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
## Motivation and Context
- credentials providers may leak credentials in the HTTP body at the
debug level
## Description
This adds a test to aws-config that looks for leaked credentials in all
of our provider integration tests—since these test use AWS APIs under
the hood, this also serves to test AWS services in general.
To support this, `sensitive` was added to the ParseHttpResponse trait
and code was generated to take action based on this change.
- [x] Add environment variable to force logging of the body
- [x] consider if we want to suppress request body logging as well
## Testing
<!--- Please describe in detail how you tested your changes -->
<!--- Include details of your testing environment, and the tests you ran
to -->
<!--- see how your change affects other areas of the code, etc. -->
## Checklist
<!--- If a checkbox below is not applicable, then please DELETE it
rather than leaving it unchecked -->
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the
smithy-rs codegen or runtime crates
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the AWS
SDK, generated SDK code, or SDK runtime crates
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
---------
Co-authored-by: John DiSanti <jdisanti@amazon.com>
The issue is we're not changing the return type of the payload
deserializing function to be the unconstrained type (e.g. the builder in
case of an `@httpPayload`-bound structure shape) when the shape is
constrained.
Yet another example of why code-generating `constraints.smithy` (see
#2101)
is important.
Closes#2583.
## Testing
The added integration test operation fails to compile without this
patch.
## Checklist
<!--- If a checkbox below is not applicable, then please DELETE it
rather than leaving it unchecked -->
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the
smithy-rs codegen or runtime crates
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
Constrained shapes should always be able to `#[derive(Debug)]`.
Fixes#2582.
## Testing
The modified integration test fails without this patch applied.
## Checklist
<!--- If a checkbox below is not applicable, then please DELETE it
rather than leaving it unchecked -->
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the
smithy-rs codegen or runtime crates
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
Co-authored-by: Matteo Bigoi <1781140+crisidev@users.noreply.github.com>
## Motivation and Context
This is an attempt at fixing
https://github.com/awslabs/aws-sdk-rust/issues/784.
The service-level `Error` enum implements `std::error::Error` but does
not implement its `source()` method. This means that an error library
like `anyhow` or `eyre` won't be able to display the root cause of an
error, which is especially problematic for the `Unhandled` variant.
## Description
I modified `ServiceErrorGenerator` in the `codegen-client` crate and
replaced the line that output `impl std::error::Error for Error {}` with
an impl block that implements the `source()` method by delegating to the
inner error structure.
## Testing
I've added a simple unit test to `ServiceErrorGeneratorTest`.
## Checklist
<!--- If a checkbox below is not applicable, then please DELETE it
rather than leaving it unchecked -->
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the
smithy-rs codegen or runtime crates
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the AWS
SDK, generated SDK code, or SDK runtime crates
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
* Add more client crate re-exports
This commit adds two more client re-exports that were not included
in smithy-rs#2437:
- `aws_smithy_http::byte_stream::Length`
- `aws_smithy_types::date_time::Format`
* Remove re-export of `aws_smithy_http::byte_stream::Length`
This commit removes re-export of `aws_smithy_http::byte_stream::Length`
for now as it is a feature-gated type, which requires further consideration.
* CHANGELOG.next.toml
---------
Co-authored-by: Yuki Saito <awsaito@amazon.com>
* Add support for omitting session token in canonical request
* Add tests to cover session token exclusion in signed headers
* Remove redundant session token insertion
* Drop mut canonical_headers
* Skip adding x-amz-security-token to signed headers if excluded
* 📎
* cargofmt
* Update changelog
* Update CHANGELOG.next.toml
Co-authored-by: John DiSanti <johndisanti@gmail.com>
---------
Co-authored-by: Russell Cohen <rcoh@amazon.com>
Co-authored-by: John DiSanti <johndisanti@gmail.com>
* Add setter for `app_name` in `ConfigLoader`
This commit adds a setter for `app_name` in `ConfigLoader`. Prior to the
commit, the field was settable only from `SdkConfig` onward.
* Update CHANGELOG.next.toml
* 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 aws/rust-runtime/aws-config/src/lib.rs
Co-authored-by: John DiSanti <jdisanti@amazon.com>
* Make empty string an invalid AppName
This commit addresses https://github.com/awslabs/smithy-rs/pull/2513#discussion_r1153074370
---------
Co-authored-by: Yuki Saito <awsaito@amazon.com>
Co-authored-by: John DiSanti <jdisanti@amazon.com>
* feat(aws-config): define default feature for sso
* chore(aws): disable unused features
* chore(rust-runtime): disable unused features
* chore: add missing tokio fs feature
* chore: disable spawn blocking on wasm
* chore: fix sso feature
* chore: allow unused variables when not sso
* chore: remove unnecessary dependency filter for wasm
* chore: add integration test for wasm
* chore: ensure test-util feature is applied to dev dependencies
* chore: disable retry config
Co-authored-by: John DiSanti <johndisanti@gmail.com>
* chore: simplify features as suggested
* chore: no default features for aws types
* chore: rename credentials-sso feature
* Revert "chore: simplify features as suggested"
This reverts commit d8fcf4912f.
* chore: set right name in default features
* chore: create smithy client test util in runtime types
* Update aws/rust-runtime/aws-types/Cargo.toml
Co-authored-by: John DiSanti <johndisanti@gmail.com>
* Update aws/rust-runtime/aws-inlineable/Cargo.toml
Co-authored-by: John DiSanti <johndisanti@gmail.com>
* Update aws/rust-runtime/aws-config/src/profile/credentials/exec.rs
Co-authored-by: John DiSanti <johndisanti@gmail.com>
* Update aws/rust-runtime/aws-config/src/profile/credentials/exec.rs
Co-authored-by: John DiSanti <johndisanti@gmail.com>
* Update aws/rust-runtime/aws-config/src/profile/credentials/exec.rs
Co-authored-by: John DiSanti <johndisanti@gmail.com>
* Update aws/rust-runtime/aws-config/src/lib.rs
Co-authored-by: John DiSanti <johndisanti@gmail.com>
* chore: use hardcoded credentials feature
* chore: make wasm example for s3 instead
* chore: fix formatting
* chore: fix kotlin formatting
* chore: fix kotlin unit tests
* chore: use timeout config from smithy types
* chore: move tests into main file
* chore: add vscode setttings to target wasi by default
* chore: fix test-util feature for smithy client
* chore: separate adapter into own module
* chore: fix test with no default features
* Fix typo
* Update changelog
* Check compilation of `aws-config` against `wasm32` in CI
* Fix Dockerfile issue and use correct cargo-wasi command
* Small Dockerfile fix
* Add missing `tar` binary to Docker image
---------
Co-authored-by: Eduardo Rodrigues <eduardomourar@users.noreply.github.com>
Co-authored-by: John DiSanti <johndisanti@gmail.com>
Co-authored-by: John DiSanti <jdisanti@amazon.com>
Co-authored-by: Russell Cohen <rcoh@amazon.com>
* Add request ID to response headers
Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
* Add parsing test
Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
* Style
Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
* CHANGELOG
Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
* Fix import
Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
* Panic if ServerRequestIdProviderLayer is not present
Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
* Own value
Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
* Correct docs
Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
* Add order of layer to expect() message
Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
* Remove Box
Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
* Require order of request ID layers
Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
* Revert "Require order of request ID layers"
This reverts commit 147eef26d5f8972b810dc5994e57865a872e44b0.
* One layer to generate and inject the header
Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
* HeaderName for header name
Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
* CHANGELOG
Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
* Remove additional layer
Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
* Remove to_owned
Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
* Add tests, remove unnecessary clone
Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
* take() ResponsePackage instead
Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
* Update docs
Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
* Update docs
Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
* cargo fmt
Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
* Update CHANGELOG
Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
---------
Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
Co-authored-by: Daniele Ahmed <ahmeddan@amazon.de>
* Remove deprecated ResolveAwsEndpoint and related interfaces.
* update changelog with pointer
* Rename AwsEndpointDecorator to have a more appropriate name
* Allow endpoint resolver to be omitted
* Upgrade to Smithy 1.27.1
* Fix bugs exposed by 1.27.1
* Fix rules engine customization
* update rfc3339 parsing test
* refactor timestamp format & remove upstreamed test
* Update changelog
* rename test
* fix datetime parsing on server and clients
* fix up a few more failing tests
* precommit lints
* Fix bad merge
* Add Connection Poisoning to aws-smithy-client
* Fix doc links
* Remove required tokio dependency from aws-smithy-client
* Remove external type exposed
* Rename, re-add tokio dependency
* Change IP to 127.0.0.1 to attempt to fix windows
* Add dns::Name to external types
* Remove non_exhaustive not needed
* Add client target to changelog
* Enable the crate reorg for the SDK
* Fix `aws-config`
* Fix SDK integration tests
* Fix event stream error module bug
* Fix doc test imports
* Fix some tests
* Fix external type check
* Fix the canary for both versions
* Fix codegen crash for certain SDK models
* Fix some doc compilation failures
* Update the changelog
* Fix presigning test merge conflict
* Remove `toEnumVariantName` from `RustSymbolProvider`
The `toEnumVariantName` function existed on symbol provider to work
around enum definitions not being shapes. In the future when we refactor
to use `EnumShape` instead of `EnumTrait`, there will be `MemberShape`s
for each enum member. This change incrementally moves us to that future
by creating fake `MemberShape`s in the enum generator from the enum
definition.
* Fix escaping of `Self` in symbol providers
* Clean up an old hack
* Make `RustReservedWordsSymbolProvider` configurable
* Update changelog
* Incorporate feedback
* Add more client re-exports
This commit adds more client re-exports proposed in
https://github.com/awslabs/smithy-rs/issues/1759.
Specifically, it re-exports the following types:
- `aws_smithy_http::body::SdkBody`
- `aws_smithy_http::byte_stream::error::Error`
- `aws_smithy_http::operation::{Request, Response}`
* Update CHANGELOG.next.toml
---------
Co-authored-by: Yuki Saito <awsaito@amazon.com>
* Add Plugin impl for &Plugin
* Add bespoke Either implementation
* Use Either in FilterByOperationName
* Add CHANGELOG.next.toml
* Rename A and B to Left and Right
* Re-export Either
* Add support for the awsQueryCompatible trait
This commit adds support for the awsQueryCompatible trait. This allows
services already supporting custom error codes through the AWS Query
protocol with the awsQueryError trait to continue supporting them after
the services switch to the AWS JSON 1.0 protocol.
* Add copyright header
* Fix clippy warning for clippy::manual-map
* Update CHANGELOG.next.toml
* Update CHANGELOG.next.toml
* Update CHANGELOG.next.toml
* Remove unused variables from `errorScope`
This commit addresses https://github.com/awslabs/smithy-rs/pull/2398#discussion_r1114763528
* Reorder arguments for test verification
This commit addresses https://github.com/awslabs/smithy-rs/pull/2398#discussion_r1114766817
---------
Co-authored-by: Yuki Saito <awsaito@amazon.com>
* Constraint member types are refactored as standalone shapes.
* ModelModule to ServerRustModule.model
* Constraints are written to the correct module
* Code generates for non-public constrained types.
* Removed a comment
* Using ConcurrentHashmap just to be on the safe side
* Clippy warnings removed on constraints, k.into() if gated
* Wordings for some of the checks changed
* Test need to call rustCrate.renderInlineMemoryModules
* ktlintFormat related changes
* RustCrate need to be passed for server builder
* Param renamed in getParentAndInlineModuleForConstrainedMember
* pubCrate to publicConstrainedType rename
* PythonServer symbol builder needed to pass publicConstrainedTypes
* @required still remains on the member shape after transformation
* ConcurrentLinkedQueue used for root RustWriters
* runTestCase does not run the tests but just sets them up, hence has been renamed
* CHANGELOG added
---------
Co-authored-by: Fahad Zubair <fahadzub@amazon.com>
* Nested server structure member shapes targeting simple shapes with `@default`
Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
* Add changelog entry
Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
* Update CHANGELOG
Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
* Add unit test
Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
* Add integration test
Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
* Change method
Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
* Include comment to describe the test
Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
---------
Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
* update: use `enforce_http = false` when creating native-tls hyper connector
refactor: move smithy conns module to its own file
add: sanity tests ensuring we can make HTTP and HTTPS requests with the rustls and native-tls connectors
remove: `use crate::*` imports in favor of explicit imports
* update: CHANGELOG.next.toml
* add: feature gate to conns tests
* Make service name casing consistent
* Add naming-obstacle-course-casing.smithy
* Add missing import
* Relax obstacle course even further
* Better TODO
* Add CHANGELOG.next.toml
* Add `RequestId` trait
* Implement `RequestId` for generated AWS client errors
* Move `RustWriter.implBlock` out of `StructureGenerator`
* Create structure/builder customization hooks
* Customize `_request_id` into AWS outputs
* Set request ID on outputs
* Refactor SDK service decorators
* Refactor S3's extended request ID implementation
* Combine `Error` and `ErrorKind`
* Add test for service error conversion
* Move error generators into `codegen-client` and fix tests
* Re-export `ErrorMetadata`
* Add request IDs to trace logs
* Simplify some error trait handling
* Rename `ClientContextParamDecorator` to `ClientContextConfigCustomization`
* Add deprecated alias to guide customers through upgrading
* Rename the `ErrorMetadata` trait to `ProvideErrorMetadata`
* Rename `aws_smithy_types::Error` to `ErrorMetadata`
* Add jitter to `LazyCredentialsCache`
This commit adds jitter to `LazyCredentialsCache`. A jitter provides a
mechanism for randomizing the buffer time for credentials. This allows
credentials with the same expiry to expire at slightly different times,
thereby preventing thundering herds.
* Update CHANGELOG.next.toml
---------
Co-authored-by: Yuki Saito <awsaito@amazon.com>
* Enforce the same minimum TLS version (1.2) for both TLS backends
* Add CHANGELOG entry
* Add documentation for both `https` and `native_tls`.
* Remove unnecessary mut
* Do not alter Operation shape ID
* Add OperationExtensionExt test
* Add CHANGELOG.next.toml entry
* Apply suggestions from code review
Co-authored-by: Luca Palmieri <20745048+LukeMathWalker@users.noreply.github.com>
---------
Co-authored-by: Luca Palmieri <20745048+LukeMathWalker@users.noreply.github.com>
* Fix broken doc link to `Stream`
This commit fixes broken doc link to `Stream` in codegen clients. That
target is `tokio_stream::Stream`, which in turn is a re-export of
`futures_core::Stream`. Since we do not have a good way to link to the
re-export, we remove a hyper link and just put `Stream`.
* Update CHANGELOG.next.toml
---------
Co-authored-by: Yuki Saito <awsaito@amazon.com>
* Add static stability support to ImdsCredentialsProvider
This commit adds static stability support to `ImdsCredentialsProvider`.
Static stability refers to continued availability of a service in the
face of impaired dependencies. In case IMDS is not available, we still
allow requests to be dispatched with expired credentials. This, in turn,
allows the target service to makes the ultimate decision as to whether
requests sent are valid or not instead of the client SDK determining
their validity.
The way it is implemented is `ImdsCredentialsProvider` now stores a last
retrieved credentials which will later be served when IMDS is unreachable.
* Add tests to IMDS credentials provider
This commit adds tests to IMDS credentials providers for static stability
support. These tests are prescribed in https://github.com/awslabs/smithy-rs/issues/2117.
From an IMDS credentials provider' perspective, however, some of the tests
are considered to fall under the same equivalence class with others.
Therefore, a single test can cover multiple test cases.
* Update CHANGELOG.next.toml
* Update CHANGELOG.next.toml
Co-authored-by: John DiSanti <jdisanti@amazon.com>
---------
Co-authored-by: Yuki Saito <awsaito@amazon.com>
Co-authored-by: John DiSanti <jdisanti@amazon.com>
This commit adds support for the `@uniqueItems` trait on `list` shapes
in server SDKs. Requests with duplicate values for `list` shapes
constrained with `@uniqueItems` will be rejected by servers.
* Stop exposing `Arc` in `credentials_provider` builder methods
This commit rectifies the signature changes made to `credentials_provider`
builder methods in https://github.com/awslabs/smithy-rs/pull/2122.
The PR in question removed `SharedCredentialsProvider` and the builder
methods started taking `ProvideCredentials` in `Arc` instead. This causes
a problem for us to evolve the API in the future as the API forces the user
to be aware of the implementation detail that we use `Arc`.
* Update comments for `SharedCredentialsCache`
* Fix unresolved doc links to `ProvideCredentials`
This commit fixes unresolved doc links to `ProvideCredentials` in
`aws_credential_types::lazy_caching`.
* Update CHANGELOG.next.toml
Co-authored-by: Yuki Saito <awsaito@amazon.com>
In server SDKs, these traits can be implemented by any shape _except_ if
the shape's closure contains:
1. A `float`, `double`, or `document` shape: floating point types in
Rust do not implement `Eq`. Similarly, [`document` shapes] may
contain arbitrary JSON-like data containing floating point values.
2. A [@streaming] shape: all the streaming data would need to be
buffered first to compare it.
Additionally, the `Hash` trait cannot be implemented by shapes whose
closure contains:
1. A `map` shape: we render `map` shapes as `std::collections::HashMap`,
which _do not_ implement `Hash`. See
https://github.com/awslabs/smithy/issues/1567.
In **client SDKs, these traits cannot be derived on any code-generated
Rust types corresponding to Smithy shapes**, since e.g. adding new
optional members to a structure [is a backwards-compatible change], and
doing so alters the semantics of these traits.
However, this commit does implement these traits for the
`aws_smithy_types::date_time::DateTime` and `aws_smithy_types::Blob`
runtime types.
This change is necessary to efficiently implement the `@uniqueItems`
constraint trait in server SDKs.
[`Eq`]: https://doc.rust-lang.org/std/cmp/trait.Eq.html
[`Hash`]: https://doc.rust-lang.org/std/hash/trait.Hash.html
[`document` shapes]: https://smithy.io/2.0/spec/simple-types.html#document
[@streaming]: https://smithy.io/2.0/spec/streaming.html
[is a backwards-compatible change]: https://smithy.io/2.0/guides/evolving-models.html#updating-structures
* Add the `aws-credential-types` crate
This commit adds a new crate `aws-credential-types` to the `rust-runtime`
workspace. This lays the groundwork for being able to create a
`LazyCachingCredentialsProvider` outside the `aws-config` crate according
to the proposed solution in https://github.com/awslabs/smithy-rs/pull/2082.
We have moved the following into this new crate:
- Items in aws_types::credentials and and their dependencies
- Items in aws_config::meta::credentials and their dependencies
Finally, the crate comes with auxiliary files that are present in the
other crates in the `rust-runtime` workspace such as `external-types.toml`.
* Make `aws-types` depend on `aws-credential-types`
The credentials module has been moved from the `aws-types` crate to the
`aws-credential-types` crate. This leads to some of the items in the
`aws-types` crate adjusting their use statements to point to
`aws-credential-types`.
The `TimeSource` struct has also been moved to `aws-credential-types`
because it is used by `LazyCachingCredentialsProvider`. We have decided
to move it instead of duplicating it because `aws-config` was creating
a `TimeSource` from `aws-types` and then passing it to the builder for
`LazyCachingCredentialsProvider`. If we had duplicated the implementation
of `TimeSource` in `aws-credential-types`, two `TimeSource` implementations
would have been considered different types and the said use case in
`aws-config` would have been broken.
* Make `aws-config` depend on `aws-credential-types`
The `cache` module and modules in `meta::credentials` (except for `chain`)
have been moved to `aws-credential-types`. Again, the goal of restructuring
is to allow `LazyCachingCredentialsProvider` to be created outside the
`aws-config` crate. While doing so, we try not moving all the default
credential provider implementations.
* Make `aws-http` depend on `aws-credential-types`
This commit adjusts the use statements for the items that have been moved
from the `aws-types` crate to the `aws-credential-types` crate.
* Make `aws-inlineable` depend on `aws-credential-types`
This commit adjusts the use statements for the items that have been moved
from the `aws-types` crate to the `aws-credential-types` crate.
* Make `aws-sig-auth` depend on `aws-credential-types`
This commit adjusts the use statements for the items that have been moved
from the `aws-types` crate to the `aws-credential-types` crate.
* Emit `aws-credential-types` to the build directory
This commit adds `aws-credential-types` to AWS_SDK_RUNTIME so that
the build command `/gradlew :aws:sdk:assemble` can generate the crate
into sdk/build/aws-sdk.
* Make codegen aware of `aws-credential-types`
This commit allows the codegen to handle the `aws-credential-types` crate.
The items that have been moved from `aws-types` should now be prefixed with
`aws-credential-types` when generating fully qualified names.
* Make `dynamo-tests` depend on `aws-credential-types`
This commit adjusts the use statements for the items that have been moved
from the `aws-types` crate to the `aws-credential-types` crate.
* Make `s3-tests` depend on `aws-credential-types`
This commit adjusts the use statements for the items that have been moved
from the `aws-types` crate to the `aws-credential-types` crate.
* Make `s3control` depend on `aws-credential-types`
This commit adjusts the use statements for the items that have been moved
from the `aws-types` crate to the `aws-credential-types` crate.
* Update external-types.xml in rust-runtime crates
This commit fixes CI failures related to `cargo check-external-types`
in ec994be.
* Update the file permission on additional-ci
* Remove unused dependency from aws-credential-types
* Clean up features for aws-credential-types
This commit fixes a CI failure where the feature hardcoded-credentials
needed other features, aws-smithy-async/rt-tokio and tokio/rt, for the
test code to compile with --no-default-features.
* Update sdk-external-types.toml
* Update aws/rust-runtime/aws-credential-types/Cargo.toml
Co-authored-by: John DiSanti <jdisanti@amazon.com>
* Update aws/rust-runtime/aws-credential-types/README.md
Co-authored-by: John DiSanti <jdisanti@amazon.com>
* Update aws/rust-runtime/aws-credential-types/README.md
Co-authored-by: John DiSanti <jdisanti@amazon.com>
* Update aws/rust-runtime/aws-credential-types/additional-ci
Co-authored-by: John DiSanti <jdisanti@amazon.com>
* Update aws/rust-runtime/aws-credential-types/src/lib.rs
Co-authored-by: John DiSanti <jdisanti@amazon.com>
* Reduce re-exports from `aws-credential-types`
This commit reduces the number of re-exports from `aws-credential-types`.
The rationale here is that if we add more items to this crate later on,
we may get some name collisions in root. Since this crate is not used by
our customers directly, it is acceptable for items to take a bit of typing
to get to.
* Fix broken intra doc link
This commit fixes a broken intra doc link that went unnoticed because the
offending link was behind the feature `hardcoded-credentials`.
* Introduce type and trait for credential caching
This commit introduces the following items in the `aws-credential-types`
crate:
* CredentialsCache
* ProvideCachedCredentials
`CredentialsCache` is a struct a user will be interacting with when creating
a credentials cache; the user no longer creates a concrete credentials cache
directly, and instead it is taken care of by `CredentialsCache` behind the
scene.
`ProvideCachedCredentials` is a trait that will be implemented by concrete
credentials caches.
Furthermore, this commit renames the following structs according to the RFC
https://github.com/awslabs/smithy-rs/pull/1842:
* SharedCredentialsProvider -> SharedCredentialsCache
* LazyCachingCredentialsProvider -> LazyCredentialsCache
* Add `credentials_cache` to `SdkConfig` and to builder
This commit adds a new field `credentials_cache` to `SdkConfig`. It also
adds a new method `credentials_cache` to `sdk_config::Builder`. They
will help a `CredentialsCache` be threaded through from `ConfigLoader`
to a service specific client's `config::Builder`, which will be
implemented in a subsequent commit.
* Put `SharedCredentialsCache` into the property bag
This commit updates what goes into the property bag. Now that
`SharedCredentialsProvider` has been renamed to `SharedCredentialsCache`,
that's what goes into the property bag. Once a `SharedCredentialsCache`
is retrieved from the bag, credentials can be obtained by calling
`provide_cached_credentials`.
* Thread through `credentials_cache` to service client
This commit threads through `credentials_cache` to service client's
`Config` and its builder. The builder will be the single-sourced place
for creating a credentials cache.
* Update `aws-config` to use `CredentialsCache`
This commit updates `aws-config` to use `CredentialsCache`. Specifically,
* `ConfigLoader` now has `credentials_cache` to take `CredentialsCache`
* No more `LazyCachingCredentialsProvider` in `DefaultCredentialsChain`
* No more `LazyCachingCredentialsProvider` in `AssumeRoleProvider`
The second and third bullet points are a result of a credentials cache
being composed in a service client's `config::Builder` rather than
`DefaultCredentialsChain` or `AssumeRoleProvider` holding it as its field.
* Update sdk integration tests
This commit bulk updates the integration tests for SDK. Most updates
replace the previous `SharedCredentialsProvider::new` with `Arc::new`.
A more subtle but important change is to respect the `sleep_impl` field
within the build method of a Config builder, making sure to thread it
a default `LazyCredentialsCache` created within the build method. If we
missed this step, the default constructed `LazyCredentialsCache` would
later use the default Tokio sleep impl even during tests that exercise
different async runtime, causing them to fail.
* Update aws/rust-runtime/aws-credential-types/README.md
Co-authored-by: Zelda Hessler <zhessler@amazon.com>
* Rename variants of `aws_credential_types::time_source::Inner`
This commit addresses https://github.com/awslabs/smithy-rs/pull/2108#discussion_r1053637722
* Split the unit test for `time_source` into two
This commit addresses https://github.com/awslabs/smithy-rs/pull/2108#discussion_r1053638381
* Update CHANGELOG.next.toml
* Fix test failures in CI coming from `aws-inlineable`
This commit fixes test failures in CI coming from the integration test in
the `aws-inlineable` crate. Commit ea47572 should have included this
change.
* Update external-types TOML files
* Clean up offending use statements left after merging main
* Remove moved module wrongly brought in after merging main
* Remove `credentials_cache` from `Builder` for `DefaultCredentialsChain`
This commit removes a field `credentials_cache` from the `Builder` for
`DefaultCredentialsChain` as it no longer stores `LazyCredentialsCache`.
Furthermore, we have also removed methods on the builder that referred
to the field `credentials_cache`.
After this commit, certain use cases will be broken, i.e. when a user
sets timeout for loading credentials via `load_timeout` on the builder,
the configured timeout will be dropped on the floor because it will not
be threaded through the field `credentials_cache`. We will later provide
instructions for how to update those use cases with our new set of APIs.
* Remove `configure` from `LazyCredentialsCache` builder
This commit removes the `configure` method from the builder for
`LazyCredentialsCache`. We tried our best to keep it when we had moved
the builder from `aws-config` but had to modify the method signature to
destructure `ProviderCondig` to obtain the two fields out of it
(`ProviderConfig` lives in `aws-config` so cannot be passed to the builder
for `LazyCredentialsCache` which lives in `aws-credential-types`).
Given `configure` is technically meant for credentials providers, which
`LazyCredentialsCache` is not anymore, we might as well remove it and
accomplish the same effect by having customers use both `time_source` and
`set_sleep` on the builder instead.
* Update CHANGELOG.next.toml
* Update CHANGELOG.next.toml
* Use unwrap_or_else to simplify two assignments
This commit addresses https://github.com/awslabs/smithy-rs/pull/2122#discussion_r1056497419
* Add doc link to `CredentialsCache` to builder method
This commit addresses https://github.com/awslabs/smithy-rs/pull/2122#discussion_r1056500448.
In addition, it moves rustdoc for `LazyCredentialsCache` to `LazyBuilder`
as `LazyCredentialsCache` has been made `pub(crate)` from `pub` and
`LazyBuilder` is now a `pub` item instead.
* Make `CredentialsCache` configurable in `AssumeRoleProviderBuilder`
This commit addresses https://github.com/awslabs/smithy-rs/pull/2122#discussion_r1066400431.
It allows users to pass their `CredentialsCache` to the builder just as
they do in `SdkConfig`.
* Update CHANGELOG.next.toml
This commit addresses https://github.com/awslabs/smithy-rs/pull/2122#discussion_r1066400431.
Co-authored-by: Yuki Saito <awsaito@amazon.com>
Co-authored-by: John DiSanti <jdisanti@amazon.com>
Co-authored-by: Zelda Hessler <zhessler@amazon.com>
Turns out we've never supported them, neither directly constrained nor
with constrained members, because of a lack of tests. Yet another data
point to prioritize working on code-generating `constraints.smithy` (see
https://github.com/awslabs/smithy-rs/issues/2101).
The implementation is simple: we just need to call the symbol provider
on the member symbols instead of on the target symbols so we get
`Option<T>` list members / map values if applicable, and handle the
wrapper when converting between unconstrained and constrained types with
help from `match` and `Option<T>::map`.
* Draft PR to only parse configuration once
* Update docs & and add test
* Fix bug where cache was being cleared by mistake
* Add additional docs
* Apply suggestions from code review
Co-authored-by: Zelda Hessler <zhessler@amazon.com>
* Apply suggestions from code review
Co-authored-by: Zelda Hessler <zhessler@amazon.com>
* fix name of field
Co-authored-by: Zelda Hessler <zhessler@amazon.com>
* Add the `aws-credential-types` crate
This commit adds a new crate `aws-credential-types` to the `rust-runtime`
workspace. This lays the groundwork for being able to create a
`LazyCachingCredentialsProvider` outside the `aws-config` crate according
to the proposed solution in https://github.com/awslabs/smithy-rs/pull/2082.
We have moved the following into this new crate:
- Items in aws_types::credentials and and their dependencies
- Items in aws_config::meta::credentials and their dependencies
Finally, the crate comes with auxiliary files that are present in the
other crates in the `rust-runtime` workspace such as `external-types.toml`.
* Make `aws-types` depend on `aws-credential-types`
The credentials module has been moved from the `aws-types` crate to the
`aws-credential-types` crate. This leads to some of the items in the
`aws-types` crate adjusting their use statements to point to
`aws-credential-types`.
The `TimeSource` struct has also been moved to `aws-credential-types`
because it is used by `LazyCachingCredentialsProvider`. We have decided
to move it instead of duplicating it because `aws-config` was creating
a `TimeSource` from `aws-types` and then passing it to the builder for
`LazyCachingCredentialsProvider`. If we had duplicated the implementation
of `TimeSource` in `aws-credential-types`, two `TimeSource` implementations
would have been considered different types and the said use case in
`aws-config` would have been broken.
* Make `aws-config` depend on `aws-credential-types`
The `cache` module and modules in `meta::credentials` (except for `chain`)
have been moved to `aws-credential-types`. Again, the goal of restructuring
is to allow `LazyCachingCredentialsProvider` to be created outside the
`aws-config` crate. While doing so, we try not moving all the default
credential provider implementations.
* Make `aws-http` depend on `aws-credential-types`
This commit adjusts the use statements for the items that have been moved
from the `aws-types` crate to the `aws-credential-types` crate.
* Make `aws-inlineable` depend on `aws-credential-types`
This commit adjusts the use statements for the items that have been moved
from the `aws-types` crate to the `aws-credential-types` crate.
* Make `aws-sig-auth` depend on `aws-credential-types`
This commit adjusts the use statements for the items that have been moved
from the `aws-types` crate to the `aws-credential-types` crate.
* Emit `aws-credential-types` to the build directory
This commit adds `aws-credential-types` to AWS_SDK_RUNTIME so that
the build command `/gradlew :aws:sdk:assemble` can generate the crate
into sdk/build/aws-sdk.
* Make codegen aware of `aws-credential-types`
This commit allows the codegen to handle the `aws-credential-types` crate.
The items that have been moved from `aws-types` should now be prefixed with
`aws-credential-types` when generating fully qualified names.
* Make `dynamo-tests` depend on `aws-credential-types`
This commit adjusts the use statements for the items that have been moved
from the `aws-types` crate to the `aws-credential-types` crate.
* Make `s3-tests` depend on `aws-credential-types`
This commit adjusts the use statements for the items that have been moved
from the `aws-types` crate to the `aws-credential-types` crate.
* Make `s3control` depend on `aws-credential-types`
This commit adjusts the use statements for the items that have been moved
from the `aws-types` crate to the `aws-credential-types` crate.
* Update external-types.xml in rust-runtime crates
This commit fixes CI failures related to `cargo check-external-types`
in ec994be.
* Update the file permission on additional-ci
* Remove unused dependency from aws-credential-types
* Clean up features for aws-credential-types
This commit fixes a CI failure where the feature hardcoded-credentials
needed other features, aws-smithy-async/rt-tokio and tokio/rt, for the
test code to compile with --no-default-features.
* Update sdk-external-types.toml
* Update aws/rust-runtime/aws-credential-types/Cargo.toml
Co-authored-by: John DiSanti <jdisanti@amazon.com>
* Update aws/rust-runtime/aws-credential-types/README.md
Co-authored-by: John DiSanti <jdisanti@amazon.com>
* Update aws/rust-runtime/aws-credential-types/README.md
Co-authored-by: John DiSanti <jdisanti@amazon.com>
* Update aws/rust-runtime/aws-credential-types/additional-ci
Co-authored-by: John DiSanti <jdisanti@amazon.com>
* Update aws/rust-runtime/aws-credential-types/src/lib.rs
Co-authored-by: John DiSanti <jdisanti@amazon.com>
* Reduce re-exports from `aws-credential-types`
This commit reduces the number of re-exports from `aws-credential-types`.
The rationale here is that if we add more items to this crate later on,
we may get some name collisions in root. Since this crate is not used by
our customers directly, it is acceptable for items to take a bit of typing
to get to.
* Fix broken intra doc link
This commit fixes a broken intra doc link that went unnoticed because the
offending link was behind the feature `hardcoded-credentials`.
* Update aws/rust-runtime/aws-credential-types/README.md
Co-authored-by: Zelda Hessler <zhessler@amazon.com>
* Rename variants of `aws_credential_types::time_source::Inner`
This commit addresses https://github.com/awslabs/smithy-rs/pull/2108#discussion_r1053637722
* Split the unit test for `time_source` into two
This commit addresses https://github.com/awslabs/smithy-rs/pull/2108#discussion_r1053638381
* Update CHANGELOG.next.toml
Co-authored-by: Yuki Saito <awsaito@amazon.com>
Co-authored-by: John DiSanti <jdisanti@amazon.com>
Co-authored-by: Zelda Hessler <zhessler@amazon.com>
* wip
* Fix region decorator
* Update S3 tests to succeed
* Create 'endpoint_url' setters
* Fix SDK adhoc tests
* Fix endpoint tests
* Fix protocol test generator to have a stub endpoint resolver
* Fix some more tests
* Fix aws rust runtime tests
* Update generator to appease clippy
* CR feedback
* Fix compilation
* Fix tests
* Fix doc links
* Fix SDK integration tests
* Update changelog
* Fix s3 control by adding transformer
* Throw a specific exception if the service doesn't have ep rules
* Add codecatalyst to the list of custom services
* Fix `@length`-constrained collection shapes whose members are not constrained
The generated code these should have emitted was fixed in #2085 (it's
bug number 2), but code generation is still crashing because the call to
calculate the inner constraint violation symbol is performed _before_
checking that the collection's member can reach a constrained shape.
The test that #2085 added in `constraints.smithy`:
```smithy
@length(max: 69)
list LengthList {
member: ConB
}
```
was not exercising what it should have, since `ConB`, is its name hints
at, is a constrained structure shape.
* Add changelog entry
Co-authored-by: Julian Antonielli <julianantonielli@gmail.com>
This change creates `ClientCodegenDecorator` and
`ServerCodegenDecorator` in `codegen-client` and `codegen-server`
respectively to replace `RustCodegenDecorator`. Client/server
equivalents are created to replace `CombinedCodegenDecorator` as well.
This eliminates the need for the `supportsCodegenContext` method since
the decorator interface is no longer generic, so the `ServiceLoader` is
now powerful enough to differentiate.
The largest benefit, however, is that now clients and servers can have
separate customizations.
* 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
* Avoid explicitly emitting Unit type within Union
This commit addresses #1546. Previously, the Unit type in a Union was
rendered as an enum variant whose inner data was crate::model::Unit.
The way such a variant appears in Rust code feels a bit odd as it
usually does not carry inner data for `()`. We now render a Union
member of type Unit to an enum variant without inner data.
* Address test failures washed out in CI
This commit updates places that need to be aware of the Unit type attached
to a Union member. Those places will render the Union member in a way that
the generated Rust code does not include inner data of type Unit. It should
help pass `codegen-client-test:test` and `codegen-server-test:test`.
Further refactoring is required because each place we updated performs an
explicit if-else check for special casing, which we should avoid.
* Update codegen-core/src/test/kotlin/software/amazon/smithy/rust/codegen/core/smithy/generators/UnionGeneratorTest.kt
Co-authored-by: John DiSanti <jdisanti@amazon.com>
* Remove commented-out code
* Add a helper for comparing against ShapeId for Unit
This commit adds a helper for checking whether MemberShape targets the
ShapeId of the Unit type. The benefit of the helper is that each call
site does not have to construct a ShapeId for the Unit type every time
comparison is made.
* Move Unit type bifurcation logic to jsonObjectWriter
This commit moves the if-else expression hard-coded in the StructureShape
matching case within RustWriter.serializeMemberValue to jsonObjectWriter.
The previous approach of inlining the if-else expression out of
jsonObjectWriter to the StructureShape case and tailoring it to the call
site violated the DRY principle.
* Make QuerySerializerGenerator in sync with the change
This commit brings the Unit type related change we've made so far to
QuerySerializerGenerator. All tests in CI passed even without this
commit, but noticing how similar QuerySerializerGenerator is to
JsonSerializerGenerator, we should make the former in sync with the
latter.
* Update CHANGELOG.next.toml
* Refactor ofTypeUnit -> isTargetUnit
This commit addresses https://github.com/awslabs/smithy-rs/pull/1989#discussion_r1035372417.
The extension should be renamed to isTargetUnit and moved to Smithy.kt.
* Update codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/serialize/JsonSerializerGenerator.kt
Co-authored-by: John DiSanti <jdisanti@amazon.com>
* Simplify if-else in jsonObjectWriter
This commit addresses https://github.com/awslabs/smithy-rs/pull/1989#discussion_r1037651893
* Avoid the union member's reference name being empty
This commit addresses https://github.com/awslabs/smithy-rs/pull/1989#discussion_r1037654601
Even if member's reference name "inner" is present, it will not be an
issue when the member is the Unit type where the reference name "inner"
cannot be extracted. The reason is jsonObjectWriter won't render the
serialization function if the member is the Unit type.
That said, the same change in QuerySerializerGenerator may not be the
case so we'll run the tests in CI and see what breaks.
* Ensure Union with Unit target can be serialized
This commit updates serialization of a Union with a Unit target in
different types of serializers. We first updated protocol tests by
adding a new field of type Unit and some of them failed as expected.
We worked our way back from those failed tests and fixed the said
implementation for serialization accordingly.
* Ensure Union with Unit target can be parsed
This commit handles deserialization of a Union with a Unit target in
XmlBindingTraitParserGenerator. Prior to the commit, we already handled
the said deserialization correctly in JsonParserGenerator but missed it
in XmlBindingTraitParserGenerator. We added a new field of type Unit to
a Union in parser protocols tests, ran them, and worked our way back from
the failed tests.
* Ensure match arm for Unit works in custom Debug impl
This commit handles a use case that came up as a result of combining two
updates, implementing a custom Debug impl for a Union and avoid rendering
the Unit type in a Union. In the custom Debug impl, we now make sure that
if the target is of type Unit, we render the corresponding match arm
without the inner data. We add a new unit test in UnionGeneratorTest.
* Fix unused variables warnings in CI
This commit adds the #[allow(unused_variables)] annotation to a block of code
generated for a member being the Unit type. The annotation is put before we
call the handleOptional function so that it covers the whole block that the
function generates.
* Fix E0658 on unused_variables
This commit fixes an error where attributes on expressions are experimental.
It does so by rearranging code in a way that achieves the same effect but
without #[allow(unused_variables)] on an expression.
Co-authored-by: Yuki Saito <awsaito@amazon.com>
Co-authored-by: John DiSanti <jdisanti@amazon.com>
* 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
* Make enum forward-compatible
This commit implements the suggested approach described in
https://github.com/awslabs/smithy-rs/issues/627#issuecomment-995923092
The idea is that once the user writes a match expression against an enum
and assumes that an execution path comes to a particular match arm, we
should guarantee that when the user upgrades a version of SDK, the
execution path should come to the same match arm as before.
* Add unit test to ensure enums are forward-compatible
The test first mimics the user's interaction with the enum generated from
a model where the user writes a match expression on the enum, wishing to
hit the match arm corresponding to Variant3, which is not yet supported
by the model. The test then simulates a scenario where the user now has
access to the updated enum generated from the next version of the model
that does support Variant3.
The user's code should compile in both of the use cases.
* Generate rustdoc for enum's forward-compatibility
This commits generates rustdoc explaining to the users how they might
write a match expression against a generated enum so their code is
forward-compatible. While it is explained in
https://github.com/awslabs/smithy-rs/issues/627#issuecomment-995923092,
it can be helpful if the users can read it in rustdoc right below where
the enum's definition is shown.
* Make snippet in rustdoc text
This commit updates a rustdoc code snippet generated for an enum from
`rust,no_run` to `text`. We observed that the snippet fails to compile
in CI because the name of the enum was not fully qualified; code in
rustdoc is treated in a similar way that code in integration tests is
treated as being outside of a crate, but not part of the crate, which
means the name of the crate needs to be spelled out for a `use` statement
if we want to import the enum to the code in rustdoc. However, the name
of the crate is usually one-off, generated on the fly for testing, making
it not obvious to hard-code it or obtain it programmatically from within
Kotlin code.
* Suppress missing doc lint for UnknownVariantValue
This commit marks UnknownVariantValue as `#[allow(missing_docs)]` because
failing to do so will cause tests in CI to fail.
* Update codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/generators/EnumGenerator.kt
Co-authored-by: Russell Cohen <rcoh@amazon.com>
* Generate UnknownVariantValue via forInlineFun
This commit attempts to create UnknownVariantValue using
RuntimeType.forInlineFun. Prior to this commit, it was generated per enum
but that caused multiple definitions of UnknownVariantValue in a single
file as there can be multiple enums in the file.
By using RuntimeType.forInlineFun, we can generate a single UnknownVariantValue
per module and the enums within the module can refer to the same instance.
This commit, however, fails to pass the unit tests in EnumGeneratorTest.
The issue seems to be that a RustWriter used in the tests does not end up
calling the finalize method, failing to render inline functions.
* Replace "target == CodegenTarget.CLIENT" with a helper
This commit addresses https://github.com/awslabs/smithy-rs/pull/1945#discussion_r1014390811
but uses an existing helper CodegenTarget.renderUnknownVariant.
* Update EnumGeneratorTests to use TestWorkspace
This commit addresses failures for unit tests in EnumGeneratorTests.
Now that we use RuntimeType.forInlineFcn in EnumGenerator, we need
to ensure that the inline functions should be rendered to a Rust
source file during testing. RustWriter, used in EnumGeneratorTests
prior to this commit, was not capable of doing so. We thus update
EnumGeneratorTests to use TestWorkspace by which we ensure that the
inline functions are rendered during testing.
* Make sure to use the passed-in variable for shapeId
This commit fixes a copy-and-paste error introduced in 712c983. The
function should use the passed-in variable rather than the hard-coded
literal "test#SomeEnum".
* Address https://github.com/awslabs/smithy-rs/pull/1945\#discussion_r1014389852
* Update CHANGELOG.next.toml
* Update CHANGELOG.next.toml
This commit addresses https://github.com/awslabs/smithy-rs/pull/1945#discussion_r1017235315
* Avoid potential name collisions by UnknownVariantValue
This commit addresses https://github.com/awslabs/smithy-rs/pull/1945#discussion_r1017237745.
It changes the module in which the `UnknownVariantValue` is rendered.
Before the commit, it was emitted to the `model` module but that might cause
name collisions in the future when a Smithy model has a shape named
`UnknownVariantValue`. After this commit, we render it to the `types` module.
* Move re-exports from lib.rs to types.rs
This commit moves re-export statements in client crates from `lib.rs` to
`types.rs`. The motivation is that now that we render the struct
`UnknownVariantValue` in a separate file for the `types` module, we can
no longer have a `pub mod types {...}` block in `lib.rs` as it cannot
coexist with `pub mod types;`.
* Add docs on UnknownVariantValue
This commit adds public docs on `UnknownVariantValue`. Since it is
rendered in `types.rs`, the users may not find the `Unknown` variant
of an enum in the same file and may wonder what this struct is for when
seeing it in isolation.
* Update CHANGELOG.next.toml
This commit addresses https://github.com/awslabs/smithy-rs/pull/1945#discussion_r1020414459
* Update the module documentation for types
This commit updates rustdoc for the types module to reflect that fact
that the module now contains not only re-exports but also an auxiliary
struct `UnknownVariantValue`.
* Add extensions to run code block depending on the target
This commit introduces extensions on CodegenTarget that execute the block
of code depending on the target is for client or for server. These
extensions are intended to replace if-else expressions throughout the
codebase explicitly checking whether the target is for client or for server.
We do not update such if-else expressions all at once in this commit.
Rather, we are planning to make incremental changes to update them
opportunistically.
* Respect the sensitive trait on enums
This commit fixes#1745. It allows enums to respect the sensitive trait.
When annotated as such, an enum will not display its data and instead
will show the redacted text upon debug print.
* Update codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/generators/EnumGenerator.kt
Co-authored-by: John DiSanti <jdisanti@amazon.com>
* Move extensions into CodegenTarget as methods
This commit addresses https://github.com/awslabs/smithy-rs/pull/1945#discussion_r1021952411.
By moving extensions into the CodegenTarget enum, no separate import is
required to use them.
* Update codegen-core/src/test/kotlin/software/amazon/smithy/rust/codegen/core/smithy/generators/EnumGeneratorTest.kt
Co-authored-by: david-perez <d@vidp.dev>
* Update codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/generators/EnumGenerator.kt
Co-authored-by: david-perez <d@vidp.dev>
* Update codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/generators/EnumGenerator.kt
Co-authored-by: david-perez <d@vidp.dev>
* Update CHANGELOG.next.toml
* Configure the (in|ex)clusion of the Debug trait for containers per members' sensitive trait (#2029)
* Removes Debug for shape with sensitive trait
This commit centralizes a place where the codegen excludes the Debug
trait if a shape has the sensitive trait. Previously the exclusion was
handled locally in each shape, e.g. StructureGenerator and EnumGenerator.
However, that approach may overlook a certain shape we also need to treat
as such. We now handle the exclusion of the Debug trait in one place,
BaseSymbolMetadataProvider.
* Stop excluding the Debug trait locally
This commit updates EnumGenerator and StructureGenerator based on the
change made to BaseSymbolMetadataProvider in the previous commit.
Now that the exclusion of the Debug trait was centralized, those
classes in question no longer need to do so individually.
* Implement a custom Debug trait in BuilderGenerator
This commit implements a custom Debug trait in BuilderGenerator now that
the derived Debug trait is excluded from BaseSymbolMetadataProvider for
the structure container. The implementation of the custom Debug trait
pretty much follows that of StructureGenerator.
* Implement a custom Debug trait in UnionGenerator
This commit implements a custom Debug trait in BuilderGenerator now that
the derived Debug trait is excluded from BaseSymbolMetadataProvider for
the union container. The implementation of the custom Debug trait pretty
much follows that of EnumGenerator.
* Implement a custom Debug trait in ServerBuilderGenerator
This commit implements a custom Debug trait in ServerBuilderGenerator now
that the derived Debug trait is excluded from BaseSymbolMetadataProvider
for the structure container. The implementation of the custom Debug trait
pretty much follows that of StructureGenerator.
* Add the Copyright header
* Update CHANGELOG.next.toml
* Update Debug impl for UnionGenerator
This commit updates the implementation of a custom Debug trait impl for
UnionGenerator. Turns out that in a Union, a member target can be marked
as sensitive separately outside the Union. Therefore, the implementation
of a custom Debug trait has two cases depending on where the sensitive
trait appears, either it is applied to the whole Union or to a member
target.
* Peek at member sensitivity for Debug trait (in|ex)clusion
This commit addresses https://github.com/awslabs/smithy-rs/pull/2029#discussion_r1034205685.
With this change, structure shapes no longer need to exclude the Debug
trait unconditionally. The upshot is that we may be able to avoid a
custom Debug impl for a structure where the derived Debug will do, i.e.
when there is no sensitive trait either at a container level or at a
member level.
* Remove statement that does not seem to take effect
This commit addresses https://github.com/awslabs/smithy-rs/pull/2029#discussion_r1036288146
* Rename renderDebugImplForUnion -> renderFullyRedactedDebugImpl
This commit addresses https://github.com/awslabs/smithy-rs/pull/2029#discussion_r1036290722
* Rename renderDebugImplForUnionMemberWise -> renderDebugImpl
This commit addresses https://github.com/awslabs/smithy-rs/pull/2029#discussion_r1036291209
Co-authored-by: Yuki Saito <awsaito@amazon.com>
Co-authored-by: Saito <awsaito@c889f3b5ddc4.ant.amazon.com>
Co-authored-by: Russell Cohen <rcoh@amazon.com>
Co-authored-by: Yuki Saito <awsaito@amazon.com>
Co-authored-by: John DiSanti <jdisanti@amazon.com>
Co-authored-by: david-perez <d@vidp.dev>
* De-dupe multiple leading forward slashes in request
This commit fixes a bug reported in
https://github.com/awslabs/aws-sdk-rust/issues/661.
Note that this de-duping is not part of URI path normalization because it
must happen to a request for any service, including S3.
* Normalize URI paths for canonical requests
This commit enables URI path normalization in aws-sigv4. It follows
https://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html
to create the canonical URI that is part of the canonical request.
* Avoid using OS specific path separator
This commit updates the implementation of normalize_path_segment so that it
does not use an OS specific path separator, specifically "\\" on Windows and
always uses a forward slash "/". It addresses a test failure on Windows:
https://github.com/awslabs/smithy-rs/actions/runs/3518627877/jobs/5897764889.
* Fix the rustdoc::bare_urls warning from cargo doc
* Fix a typo Normalzie -> Normalize
* Limit de-duping multiple leading forward slashes to S3
This commit addresses https://github.com/awslabs/smithy-rs/pull/2018#issuecomment-1325283254.
There is a case where an empty string between leading double forward
slashes is meaningful so blindly de-duping them breaks the use case.
Therefore, handling multiple leading forward slashes in this manner
should be applied only to S3.
* Add an integration test per https://github.com/awslabs/aws-sdk-rust/issues/661
This commit adds an integration test verifying the special rule for URI
path normalization applies to S3. That is, leading forward slashes should
be de-deduped and normalizing URI paths as prescribed in RFC 3986 should
be ignored.
* Update CHANGELOG.next.toml
* Revert 87b749c
This commit reverts 87b749c, the reason being that we need to better
understand the requirement for de-duplicating leading forward slashes
in requests, i.e. do we even need to do it or if so where should we
perform the de-dupe operation?
* Revert naming of UriPathNormalizationMode variants
This commit reverts the naming of variants in UriPathNormalizationMode.
They were PerRfc3986 and ForS3, but they should be more generic like
Enabled and Disabled as we had before.
* Update CHANGELOG.next.toml
* Simplify integration test using capture_request
This commit simplifies the integration test normalize-uri-path for s3.
Previously, the test used ReplayingConnection but it was an overkill
to test something as simple as whether the generated request contained
the expected URI and signature.
* Update aws/rust-runtime/aws-sigv4/src/http_request/settings.rs
Co-authored-by: John DiSanti <jdisanti@amazon.com>
* Update aws/rust-runtime/aws-sigv4/src/http_request/settings.rs
Co-authored-by: John DiSanti <jdisanti@amazon.com>
* Update aws/rust-runtime/aws-sigv4/src/http_request/uri_path_normalization.rs
Co-authored-by: John DiSanti <jdisanti@amazon.com>
* Address review feedback on normalize_path_segment
This commit addresses the following code review feedback:
https://github.com/awslabs/smithy-rs/pull/2018#discussion_r1034192229https://github.com/awslabs/smithy-rs/pull/2018#discussion_r1034194621https://github.com/awslabs/smithy-rs/pull/2018#discussion_r1034195625
* Update CHANGELOG.next.toml
This commit addresses https://github.com/awslabs/smithy-rs/pull/2018#discussion_r1034198861
* Preallocate the Vec capacity for normalize_path_segment
This commit addresses https://github.com/awslabs/smithy-rs/pull/2018#discussion_r1034195625.
It counts the number of slashes to preallocate the capacity of a Vec used
in normalize_path_segment.
* Address https://github.com/awslabs/smithy-rs/pull/2018\#discussion_r1034188849
* Update aws/rust-runtime/aws-sigv4/src/http_request/settings.rs
Co-authored-by: John DiSanti <jdisanti@amazon.com>
* Update aws/rust-runtime/aws-sigv4/src/http_request/settings.rs
Co-authored-by: John DiSanti <jdisanti@amazon.com>
* Update aws/rust-runtime/aws-sigv4/src/http_request/settings.rs
Co-authored-by: John DiSanti <jdisanti@amazon.com>
Co-authored-by: Yuki Saito <awsaito@amazon.com>
Co-authored-by: John DiSanti <jdisanti@amazon.com>
* Refactor `ConstrainedMapGenerator` slightly
* Add `@length` list operation in `constraints.smithy`
* Add more setup required for rendering constraint `list`s
* Add initial draft of `ConstrainedCollectionGenerator`
* Add license header to `LengthTraitCommon`
* Add draft of collection constraint violation generation
Copy `MapCostraintViolationGenerator` into
`CollectionConstraintViolationGenerator` for now.
* Add `Visibility.toRustQualifier`
* Implement `CollectionConstraintViolationGenerator`
* Use `TraitInfo` on `CollectionConstraintViolationGenerator`
* Update docs on `ConstrainedCollectionGenerator`
* Improve formatting on rust code
* Don't generate `ConstraintViolation` enum twice
* Make symbol provider work with constrained lists
* Fix call to `ConstraintViolation::Member`
* Render constraint validation functions for lists
* Fix call to `usize::to_string`
* Use map json customisation for collections as well
* Update to use overhauled module system
* Add constraint traits check for collection shapes
* Remove test checking that `@length` is not used in `list`s
* Refactor use of `shape.isDirectlyConstrained`
* Fix failing `UnconstrainedCollectionGeneratorTest` test
* Fix test
* Actually fix the test
* Update changelog
* Fix `constrainedCollectionCheck`
* Add tests for `ConstrainedCollectionGenerator`
* Make tests work for when sets are implemented
* Remove mention of `set` in changelog
Co-authored-by: david-perez <d@vidp.dev>
* Fix styling in `constraints.smithy`
Co-authored-by: david-perez <d@vidp.dev>
* Use `check` instead of `assert`
* Grammar fix in comment about `Option<Box<_>>`
* Rename unsupported length data class for blobs
- `UnsupportedLengthTraitOnCollectionOrOnBlobShape` -> `UnsupportedLengthTraitOnBlobShape`
* Add TODO about `uniqueItems` not being implemented yet
* Change error message: `unconstrained` -> `not constrained`
* Add imports to fix docs
* Remove unused `modelsModuleWriter` parameter
* Use `filterIsInstance` and coalesce `filter + map`
* Add `check` in json customization
* Use `Set` instead of `List` for supported contraints
* Use `toMutableList` to avoid creating an extra list
* Add `@length` list to `ConA`
* Add `@httpQuery`-bound `@length` list example
* Add `@httpHeader`-bound `@length` list
* Fix `UnconstrainedCollectionGeneratorTest` test
* Fix rendering of constrained lists as header values
* Split very long line
* Add docs for `ConstraintViolation::Member` for lists
* Pass `length` variable name to `LengthTrait.rustCondition`
* Refactor long conditional
* Homogenise conditional
Co-authored-by: david-perez <d@vidp.dev>
* Group all override-related test cases together.
* Add @range examples for both byte and long in constraints.smithy.
* Implement @range for long and byte shapes.
* Update CHANGELOG
* Fix unit tests.
* Address comments
* Dry up further.
* 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.
* Extract a ConstrainedNumberGenerator from ConstrainedIntegerGenerator
* Update tests' expectations to assume that we support @range for short
* Add ShortShape to all the key places to get @range support
* Generalize generator tests.
* Add tests for the @range trait on short to our constraints.smithy model.
* Update changelog
* Fix type in constraints.smithy
* Draft of @range implementation for integer shapes
* Green tests.
* Fix serialization of constrained integers.
* Fix tagger to include Integer simple shapes.
Fix de/serialization codegen.
* Add range trait to the entry about constraint traits in our changelog.
* Bind a range-constrained integer to various HTTP parts to test our implementation.
* Rename ConstrainedIntGeneratorTest to ConstrainedIntegerGeneratorTest for consistency.
* Remove AsRef implementation.
* Fix constraints models.
* Fix conversion.
* Use ReturnSymbolToParse to dry up.
* Fix builder when constrained types should not be exposed.
* Add customisation to unwrap constrained integers.
* Getting closer - collections need to be handled differently to make everything fall into place.
* Refactor `renderHeaders`
* Fix constraints test.
* Fix ebs.
* Rename for clarity.
* Remove unnecessary From implementation.
* Rename `Size` variant to `Range`.
* Remove stray comments.
* Rename for clarity
* Rename for consistency
* Add test to guard against types for which we do not support range yet
* DRY up branches and the relevant tests.
* Fix header name.
* Fix serialization bug for default values in headers.
* Fix serialization issue for primitive headers.
* Remove SetOfRangeInteger
* Fix pubcrateconstrained unit test.
* Remove duplication
* Revert "Remove SetOfRangeInteger"
This reverts commit f37a560bd0.
* Reintroduce `SetOfRangeInteger`, but keep them commented out.
* Ignore leading whitespace.
* Update codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/generators/http/HttpBindingGenerator.kt
Co-authored-by: david-perez <d@vidp.dev>
* Update codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/parse/JsonParserGenerator.kt
Co-authored-by: david-perez <d@vidp.dev>
* Update codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/ValidateUnsupportedConstraints.kt
Co-authored-by: david-perez <d@vidp.dev>
* Update codegen-server/src/test/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ConstrainedIntegerGeneratorTest.kt
Co-authored-by: david-perez <d@vidp.dev>
* Unify with a single rustTemplate invocation.
* Rename `Type` to `NumberType`
* Update codegen-server/src/test/kotlin/software/amazon/smithy/rust/codegen/server/smithy/ConstrainedShapeSymbolProviderTest.kt
Co-authored-by: david-perez <d@vidp.dev>
* Formatting issue.
* Move and rename test helper.
* Dry up the logic for default serialization.
* Ooops, I swapped the two branches.
* Add a wrapper block
* Fix support detection.
* Fix CHANGELOG.
* Add (failing) protocol tests for @range on byte/integer/long.
* Fix validation message.
Fix test definitions.
* Mark some tests as expected to fail.
Rename service.
* Use ValueExpression everywhere for more granular control of the ownership component.
* Use the new enhanced module facilities
* Fixes.
* Fix formatting
* Remove unnecessary when.
* Update codegen-core/common-test-models/constraints.smithy
Co-authored-by: david-perez <d@vidp.dev>
* Remove unused shapes.
* Avoid mixing concerns in our test shapes for integer constraints.
* Reuse the trait info machinery
* Update stale comment
* Fix unused attribute.
* Update codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/serialize/JsonSerializerGenerator.kt
Co-authored-by: Zelda Hessler <zhessler@amazon.com>
* Avoid unnecessary bindings by manipulating the serialization context directly in the customisations.
* Avoid unnecessary bindings in header serialization by introducing and manipulating the header value serialization context directly in the customisations.
* Add code examples.
* Move `safeName` call into the if branch.
Co-authored-by: david-perez <d@vidp.dev>
Co-authored-by: Zelda Hessler <zhessler@amazon.com>
* Refactor `ConstrainedStringGenerator` to extract length checking
* Extract `TryFrom` rendering into its own function
* Extract `ConstraintViolation` definition to separate function
* Add pattern check mock for `@pattern` trait
* Add `regex` to list of server dependencies
* Use real regex check in `check_pattern`
* Add `@pattern` to traits that make `string` shapes directly constrained
* Remove unsupported validation for `@pattern` on strings
* Fix test cases in `ConstraintsTest`
* Remove test disallowing `@pattern` on strings
* Add first test case for `@pattern` on strings
* Fix codegen in `ConstraintViolation::as_validation_exception_field`
* Use `OnceCell` to store `@pattern`'s regex
* Tidy up `ConstrainedStringGenerator` to work with many constraints
* Rename `handleTrait` -> `fromTrait` and make it a static method
* Add docs for `ConstraintViolation` variants
* Fix unescaped slashes in regexes
* Quick hack to get tests compiling
* Fix `sensitive_string_display_implementation` test
* Use new fn name: `asType` -> `toType`
* Refactor `ConstrainedStringGenerator` to not pass in `constraints`
* Add `@pattern` test
* Use `Lazy` instead of `OnceCell`
* Store `&'static str` in `Pattern` error instead of `String`
* Move `TraitInfo` to the bottom
* Extract branches in `TraitInfo.fromTrait` into separate functions
* Add `PatternTrait.validationErrorMessage`
* Add more tests for `@pattern`
* Add entry to `CHANGELOG.next.toml`
* Fix a `@length` + `@pattern` test case
* Remove unused binding in `ConstrainedStringGeneratorTest`
* Remove calls to `trimIndent`
* Use raw Rust strings instead of `escapedPattern`
* Require `regex 1.5.5` instead of `1.7.0`
* Use `Writable`s in `TraitInfo`
* Use single `rust` call for `impl $name` block
* Move `supportedStringConstraintTraits` to `Constraints.kt`
* Fix error message mentioning wrong `ignoreUnsupportedConstraintTraits` key
* Fix usage of `:W` in `rustTemplate` and raw Rust strings
* Use shorthand form for `PatternTrait.validationErrorMessage`
* Fix protocol tests by adjusting the validation message
* Add uses of `@pattern` in `constraints.smithy` model
* Fix broken `RestJsonMalformedPatternReDOSString` test
* Move `TraitInfo` to its own module and separate string-specific details
* Update codegen-core/common-test-models/constraints.smithy
Co-authored-by: david-perez <d@vidp.dev>
* Fix nits in `constraints.smithy`
* Add license to `TraitInfo.kt`
* Make `StringTraitInfo.fromTrait` not return a nullable
* Remove overzealous formatting
* Add some padding to json in `fixRestJsonMalformedPatternReDOSString`
* Add `compile_regex` function for `@pattern` strings
* Add helpful error message when regexes fail to compile
* Add missing coverage in `constraints.smithy`
* Fix examples in `constraints.smithy`
* Fix failing test
* Combine writables in `ConstrainedStringGenerator`
* Fix uses of `Writable.join`
* Use `expect` over `unwrap_or_else`
* Use `once_cell::sync::Lazy` over `once_cell::sync::OnceCell`
Co-authored-by: david-perez <d@vidp.dev>
* Add const to generated enum values()
Enum values() functions return static arrays of static strings and could
be of compile time use. Make callable in const contexts.
* Add reference to PR in changelog next for const enum values()
* Correct changelog next target to all for const enum values()
Co-authored-by: Luca Palmieri <20745048+LukeMathWalker@users.noreply.github.com>
* fix: issues when sending multipart-upload-related operations with no upload ID by making upload ID required
add: Mandatory trait
add: S3 customization to make Upload Ids mandatory
* add: CHANGELOG.next.toml entry
* update: strategy for tagging shapes as mandatory
* remove: Mandatory trait
undo: S3Decorator changes
add: codegen to generate "else" branch after required query string serialization `if let Some` check
add: missing tokio feature to `TokioTest`
* update: mandatory-query-param.rs tests
* format: run cargo fmt
* update: return BuildError for missing required query params
update: required-query-params.rs tests
* formatting: make RustWriter.paramList more readable
fix: code broken by merge from `main`
* fix: handling of enum strings
* add: codegen tests for required query params
update: required enum query param codegen
add: smithy-rs CHANGELOG.next.toml entry
* fix: presigning.rs test
* fix: use `toType` instead of `asType`
fix: indentation in test
RestJson1 implementations can denote errors in responses in several
ways. New server-side protocol implementations MUST use a header field
named `X-Amzn-Errortype`.
Note that the spec says that implementations SHOULD strip the error
shape ID's namespace. However, our server implementation renders the
full shape ID (including namespace), since some existing clients rely on
it to deserialize the error shape and fail if only the shape name is
present. This is compliant with the spec, see
https://github.com/awslabs/smithy/pull/1493.
See https://github.com/awslabs/smithy/issues/1494 too.
- `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`
* Make enum forward-compatible
This commit implements the suggested approach described in
https://github.com/awslabs/smithy-rs/issues/627#issuecomment-995923092
The idea is that once the user writes a match expression against an enum
and assumes that an execution path comes to a particular match arm, we
should guarantee that when the user upgrades a version of SDK, the
execution path should come to the same match arm as before.
* Add unit test to ensure enums are forward-compatible
The test first mimics the user's interaction with the enum generated from
a model where the user writes a match expression on the enum, wishing to
hit the match arm corresponding to Variant3, which is not yet supported
by the model. The test then simulates a scenario where the user now has
access to the updated enum generated from the next version of the model
that does support Variant3.
The user's code should compile in both of the use cases.
* Generate rustdoc for enum's forward-compatibility
This commits generates rustdoc explaining to the users how they might
write a match expression against a generated enum so their code is
forward-compatible. While it is explained in
https://github.com/awslabs/smithy-rs/issues/627#issuecomment-995923092,
it can be helpful if the users can read it in rustdoc right below where
the enum's definition is shown.
* Make snippet in rustdoc text
This commit updates a rustdoc code snippet generated for an enum from
`rust,no_run` to `text`. We observed that the snippet fails to compile
in CI because the name of the enum was not fully qualified; code in
rustdoc is treated in a similar way that code in integration tests is
treated as being outside of a crate, but not part of the crate, which
means the name of the crate needs to be spelled out for a `use` statement
if we want to import the enum to the code in rustdoc. However, the name
of the crate is usually one-off, generated on the fly for testing, making
it not obvious to hard-code it or obtain it programmatically from within
Kotlin code.
* Suppress missing doc lint for UnknownVariantValue
This commit marks UnknownVariantValue as `#[allow(missing_docs)]` because
failing to do so will cause tests in CI to fail.
* Update codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/generators/EnumGenerator.kt
Co-authored-by: Russell Cohen <rcoh@amazon.com>
* Generate UnknownVariantValue via forInlineFun
This commit attempts to create UnknownVariantValue using
RuntimeType.forInlineFun. Prior to this commit, it was generated per enum
but that caused multiple definitions of UnknownVariantValue in a single
file as there can be multiple enums in the file.
By using RuntimeType.forInlineFun, we can generate a single UnknownVariantValue
per module and the enums within the module can refer to the same instance.
This commit, however, fails to pass the unit tests in EnumGeneratorTest.
The issue seems to be that a RustWriter used in the tests does not end up
calling the finalize method, failing to render inline functions.
* Replace "target == CodegenTarget.CLIENT" with a helper
This commit addresses https://github.com/awslabs/smithy-rs/pull/1945#discussion_r1014390811
but uses an existing helper CodegenTarget.renderUnknownVariant.
* Update EnumGeneratorTests to use TestWorkspace
This commit addresses failures for unit tests in EnumGeneratorTests.
Now that we use RuntimeType.forInlineFcn in EnumGenerator, we need
to ensure that the inline functions should be rendered to a Rust
source file during testing. RustWriter, used in EnumGeneratorTests
prior to this commit, was not capable of doing so. We thus update
EnumGeneratorTests to use TestWorkspace by which we ensure that the
inline functions are rendered during testing.
* Make sure to use the passed-in variable for shapeId
This commit fixes a copy-and-paste error introduced in 712c983. The
function should use the passed-in variable rather than the hard-coded
literal "test#SomeEnum".
* Address https://github.com/awslabs/smithy-rs/pull/1945\#discussion_r1014389852
* Update CHANGELOG.next.toml
* Update CHANGELOG.next.toml
This commit addresses https://github.com/awslabs/smithy-rs/pull/1945#discussion_r1017235315
* Avoid potential name collisions by UnknownVariantValue
This commit addresses https://github.com/awslabs/smithy-rs/pull/1945#discussion_r1017237745.
It changes the module in which the `UnknownVariantValue` is rendered.
Before the commit, it was emitted to the `model` module but that might cause
name collisions in the future when a Smithy model has a shape named
`UnknownVariantValue`. After this commit, we render it to the `types` module.
* Move re-exports from lib.rs to types.rs
This commit moves re-export statements in client crates from `lib.rs` to
`types.rs`. The motivation is that now that we render the struct
`UnknownVariantValue` in a separate file for the `types` module, we can
no longer have a `pub mod types {...}` block in `lib.rs` as it cannot
coexist with `pub mod types;`.
* Add docs on UnknownVariantValue
This commit adds public docs on `UnknownVariantValue`. Since it is
rendered in `types.rs`, the users may not find the `Unknown` variant
of an enum in the same file and may wonder what this struct is for when
seeing it in isolation.
* Update CHANGELOG.next.toml
This commit addresses https://github.com/awslabs/smithy-rs/pull/1945#discussion_r1020414459
* Update the module documentation for types
This commit updates rustdoc for the types module to reflect that fact
that the module now contains not only re-exports but also an auxiliary
struct `UnknownVariantValue`.
* Add extensions to run code block depending on the target
This commit introduces extensions on CodegenTarget that execute the block
of code depending on the target is for client or for server. These
extensions are intended to replace if-else expressions throughout the
codebase explicitly checking whether the target is for client or for server.
We do not update such if-else expressions all at once in this commit.
Rather, we are planning to make incremental changes to update them
opportunistically.
* Update codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/generators/EnumGenerator.kt
Co-authored-by: John DiSanti <jdisanti@amazon.com>
* Move extensions into CodegenTarget as methods
This commit addresses https://github.com/awslabs/smithy-rs/pull/1945#discussion_r1021952411.
By moving extensions into the CodegenTarget enum, no separate import is
required to use them.
Co-authored-by: Saito <awsaito@c889f3b5ddc4.ant.amazon.com>
Co-authored-by: Russell Cohen <rcoh@amazon.com>
Co-authored-by: Yuki Saito <awsaito@amazon.com>
Co-authored-by: John DiSanti <jdisanti@amazon.com>
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
* 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>
* 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>
* 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`
* Depend on criterion 0.4.0
This updates criterion from 0.3.6 to 0.4.0 to avoid RUSTSEC-2021-0127
where criterion 0.3.6 depends upon an unmaintained crate `serde_cbor`.
* Update CHANGELOG.next.toml
Co-authored-by: Saito <awsaito@c889f3b5ddc4.ant.amazon.com>
* 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>
* 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
* add: test ensuring streamed response will error if eof is received early
formatting: sort s3 integration test cargo toml deps
update: CHANGELOG.next.toml
* formatting: run cargo fmt
remove: commented out logging init
add: comment for CRLF check
update: read Ok(0) case to say note that it's unreachable and why that's the case
update: debug messages
* update: test to use OS-assigned port instead of 3000
* 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>
* 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>
* Add test for excluded headers list
This commit adds a test for the functionality added in #1381. Technically,
there was an existing test `presigning_header_exclusion` that exercised
the said functionality but it only covered the behavior partially, i.e.
only a case where the `excluded_headers` field in `SigningSettings`
contained just `user-agent`.
The new test will randomly add headers to `excluded_headers` and verify
the functionality works as expected.
* Update CHANGELOG.next.toml
* Update CHANGELOG.next.toml
Co-authored-by: John DiSanti <jdisanti@amazon.com>
Co-authored-by: Saito <awsaito@c889f3b5ddc4.ant.amazon.com>
Co-authored-by: John DiSanti <jdisanti@amazon.com>
* Fix panic occurred in formatting CanonicalRequest
This commit addresses panic in the case of formatting a CanonicalRequest
containing invalid UTF-8 in the header value.
The commit aims for the least disturbance to the codebase in order to
pass a given failing test in the PR. We want to quickly determine if
this low-cost approach addresses the problem before we commit ourselves
to start refactoring CanonicalRequest to have a special format function.
Fixes#711
* Update test_signing_utf8_headers to proptest
This commit converts test_signing_utf8_headers to a proptest. The
original test only specified hardcoded non-UTF8 bytes in a request
header. To ensure that `crate::http_request::sign` does not panic no
matter what valid byte sequence for HeaderValue is, the proptest covers
a wider range of inputs.
For consistency, the test has been moved from `canonical_request.rs` to
`sign.rs`.
* Add InvalidHeaderError to make the error explicit
This commit introduces an error type InvalidHeaderError to indicate that
we ran into a problem in handling a HeaderValue within CanonicalRequest.
The error type contains a source error such as Utf8Error so a diagnostic
message can be printed if needed.
* Remove InvalidHeaderError for error refactoring
This commit effectively reverts 739b32c. Knowing that we will be cleaning
up error types, having InvalidHeaderError is too narrow a solution and
does not add value to the codebase.
* Update CHANGELOG.next.toml
Co-authored-by: Russell Cohen <rcoh@amazon.com>
Co-authored-by: Saito <awsaito@c889f3b5ddc4.ant.amazon.com>
* 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>
* Use `Sensitive` wrapper in Debug impl for structures
* Fix using the wrong import path for `Sensitive`
* Use redactMemberIfNecessary
* Fix display implementation on errors to respect @sensitive trait
* Don't use Sensitive type just yet
* Add entry in changelog
* Improve redaction of sensitive error message
* Use correct flags in changelog
* Run ktlint
* Replace AtomicU64 with AtomicUsize to prevent compilation issues on 32 bits platforms.
* Make sure that Rust tests compile on MacOS.
* Add CHANGELOG next entry.
* Mark `operation_handler` module as private in the generated server code since it does not contain any public type.
Tune the visibility of the 'operation' module based on the rendering context
* Add changelog.next entry.
* Rename `operationModule` to `operation`.
* Ensure that `operation` is added to the list of public modules for the generated client.
* Remove DefaultModules from codegen-core
* Fix Python server.
* Expose TestDefaultPublicModules.
## 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>
* 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>
* remove: need for operation type aliasing
rename: FluentClientGenerics.sendBounds params to be more accurate
update: FlexibleClientGenerics.sendBounds impl for readability
update: type of FluentClientGenerator input param `retryPolicyType` to be `Any` with a default of `RustType.Unit`
update: PaginatorGenerator to take retryPolicy as an input
chore: fix some spelling and grammar issues
remove: redundant `nextTokenEmpty` function from PaginatorGenerator
* Update CHANGELOG.next.toml
Co-authored-by: John DiSanti <jdisanti@amazon.com>
* add: `writable` property to RustType that returns the type as a Writable
add: test for RustType writable
add: `writable` property to RuntimeType that returns the type as a Writable
update: FluentClientGenerator to take a writable for retry
* format: run formatter
Co-authored-by: John DiSanti <jdisanti@amazon.com>
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
* 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
* add: ability for certain operations to be exempt from XML body root checking
* add: XML body root checking exemption for com.amazonaws.s3#GetObjectAttributesOutput
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`.
* Support granular control of specifying runtime crate versions
**BREAKING**: after this PR, `in smity-build.json` the path
`rust-codegen.runtimeConfig.version` no longer exists. Instead, a new
field `versions` comes in. It's an object mapping a runtime crate name
to a version string. There is also a special key `DEFAULT`, which is
presetted as detected runtime version but open to override. Crates
without version specified would be set as the same version as which
associated to key `DEFAULT`.
Signed-off-by: Weihang Lo <weihanglo@users.noreply.github.com>
* Add codegen version to generated package metadata
* Update `CHANGELOG.next.toml`
* Remove unnecessary try-catch block from `smithyCodegenVersion`
* Add git commit hash to version
* Fix version filename
* Add tests for `Version`
* Store version in "$smithyRsVersion\n$gitCommitHash" format
* Make version parsing more strict
* Add helper for creating deprecated attribute
* `Attribute.Custom.deprecated` is the main logic for building up
`#[deprecated]` attribute
* `RustWriter.deprecatedShape` is the counterpart of `documentShape`,
but we do not going to generalize it as what `documentShape` does.
Deprecated is only for Rust code and probably won't be used in other
output language.
Signed-off-by: Weihang Lo <whlo@amazon.co.uk>
* Test `@deprecated` trait for RustWriter
* Support `@deprecated` trait for StructureGenerator
* Support `@deprecated` trait for UnionGenerator
Signed-off-by: Weihang Lo <whlo@amazon.co.uk>
* Support `@deprecated` trait for EnumGenerator
* Support `@deprecated` trait for TopLevelErrorGenerator
* Support `@deprecated` trait for CombinedErrorGenerator
* Support `@deprecated` trait for ServerCombinedErrorGenerator
* Support `@deprecated` trait for FluentClient
* Support `@deprecated` trait for BuilderGenerator
* Cleanup leftover in test
* Use `dq()` helper method instead of escaping by hands
Signed-off-by: Weihang Lo <whlo@amazon.co.uk>
* Leverage Kotlin null safety well
Signed-off-by: Weihang Lo <whlo@amazon.co.uk>
* Allow `deprecated` rustc lint rule
Signed-off-by: Weihang Lo <whlo@amazon.co.uk>
* Allow deprecated in unit tests
Signed-off-by: Weihang Lo <whlo@amazon.co.uk>
* Leverage kotlin null safety check again
Signed-off-by: Weihang Lo <whlo@amazon.co.uk>
* changelog: Support @deprecated trait
Signed-off-by: Weihang Lo <whlo@amazon.co.uk>
Co-authored-by: Matteo Bigoi <1781140+crisidev@users.noreply.github.com>
* 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>
* 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
* 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
* `aws-config`: Fix compilation error with `rustls` and `native-tls` disabled
The `ProviderConfig::with_tcp_connector` method uses
`aws_smithy_client::hyper_ext`, which only exists with the
`client-hyper` feature enabled. Add a feature enabling that, and enable
it by default.
Introducing this feature does not cause breakage, because aws-config
did not previously compile with `default-features = false` and neither
`rustls` nor `native-tls` enabled.
* CHANGELOG.next.toml: Update for aws-config compilation fix
* Fix doctest by adding feature gate
Co-authored-by: Russell Cohen <rcoh@amazon.com>
* Re-export aws_types::SdkConfig in aws_config
This way people that want to access that structure don't have to add aws_types.
Signed-off-by: David Calavera <david.calavera@gmail.com>
* Add entry about SdkConfig to the changelog
Co-authored-by: Russell Cohen <rcoh@amazon.com>
* add: support for unsigned aws-chunked content encoding
* add: aws-smithy-checksums to CrateSet.key
* refactor: API of AwsChunkedBodyOptions
update: AwsChunkedBody to note we only support single chunks
remove: unnecessary `Option`s
remove: overly smart total_length_of_trailers_in_bytes in trailers_as_aws_chunked_bytes
update: use "where"-style declaration for `impl<Inner> Body for AwsChunkedBody<Inner>`
add: helpful data to trace logging
add: trailer len double check in AwsChunkedBody::poll_data
add: test for trailer len double check
add: assert to size_hint
fix: incorrect body emitted when body is empty
add: test for empty encoded body
* Update CHANGELOG.next.toml
Co-authored-by: John DiSanti <jdisanti@amazon.com>
* update: CHANGELOG.next.toml message
* refactor: aws-chunked trailer encoding and size calculation
update: when aws-chunked formatting a `HeaderMap`, header names with multiple values will be written out one value per line
remove: unnecessary AwsChunkedBodyOptions::stream_length method
add: trace fields
refactor: make inserting the final body CRLF more explicit
add: test to ensure trailer encoding and trailer len calculation stay in sync
* udpate: emit error instead of panicking for incorrect trailer length
* add: test ensuring trailer serialization and length calculation stay in sync for empty HeaderMap
* update: avoid repeated allocations in trailers_as_aws_chunked_bytes
fix: don't convert to str before getting len of HeaderValue
* add: aws-chunked body test for inner bodies that emit intermittent chunks
add: double check that stream_length used to create an `AwsChunkedBody` is correct.
Co-authored-by: John DiSanti <jdisanti@amazon.com>
* Docker settings
add note on settings needed when using sdk inside docker container
* update changelog.next
* move to group relevant info
* mark code snippet as txt
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.