Commit Graph

548 Commits

Author SHA1 Message Date
Russell Cohen 426e77f073
Fix aws-sdk-rust#930 (PutSnapshotBlock) (#3126)
## Motivation and Context
A regression in 0.56 caused `X-Amz-Content-sha256` to be omitted when
the `UnsignedPayload` trait was present. This re-enables the old
behavior and fixes this operation.
<!--- Why is this change required? What problem does it solve? -->
<!--- If it fixes an open issue, please link to the issue here -->

## Description
Enable the `x-amz-content-sha256` header whenever the unsigned payload
trait is present.

Old code:
https://github.com/awslabs/smithy-rs/blob/smithy-rs-release-0.54.x/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/SigV4SigningDecorator.kt#L168

## Testing
- [x] Manual integration test
- [x] Modeled protocol test that ensures that header is set
<!--- 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._
2023-11-01 18:34:40 +00:00
Russell Cohen 8ad54551aa Merge branch 'smithy-rs-release-0.57.x' of github.com:awslabs/smithy-rs into merge-back 2023-11-01 12:57:42 -04:00
John DiSanti 1ae4d194cf
Upgrade ring to 0.17.5 (#3116)
Fixes #3112.

I opted to upgrade to the latest 0.17.5 in spite of the guidance in
[RFC-21](https://github.com/awslabs/smithy-rs/blob/main/design/src/rfcs/rfc0021_dependency_versions.md)
since this is a security critical dependency, and the maintainer has
aggressively yanked old versions in the past.

Note: ring 0.16 is still pulled in by rcgen as a dev dependency in
aws-smithy-http-server-python after these changes. The rcgen crate
hasn't upgraded yet.

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
2023-10-31 17:03:39 +00:00
AWS SDK Rust Bot 20a89c21ca Update changelog 2023-10-31 15:46:23 +00:00
david-perez 53dcff3ff0
Build services with a derived configuration object (#3095)
This is a pared-down version of #2809.

This is the code-generated version of the
david-perez/smithy-rs-service-config#2 POC.

This introduces a code-generated `PokemonServiceConfig` object which is
provided to the service builder constructor via
`PokemonService::builder(config: PokemonServiceConfig)`. This will
displace the
current `builder_without_plugins` and `builder_with_plugins`,
deprecating them.
We will eventually remove them.

The motivation is to have a single place where to register plugins and
layers.
Smithy traits can leverage this object to inject methods that can apply
plugins
and layers. For example, an `@authorization` trait implementer could
vend a
smithy-rs decorator that pre-applied an authorization plugin inside the
`${serviceName}Config` object, possibly exposing a method to pass in any
runtime arguments needed to configure the middleware.

## 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._
2023-10-30 16:25:04 +00:00
ysaito1001 cae35b7d05
Move `result` and `connection` from `aws-smithy-http` to `aws-smithy-runtime-api` (#3103)
## Motivation and Context
Implements #3092 

## Description
This PR moves the `connection` and `result` modules from
`aws-smithy-http` to `aws_smithy_runtime_api`. `SdkError` is primarily
used within the context of the orchestrator, hence
`aws_smithy_runtime_api` instead of `aws-smithy-types`.

Like the previous sibling PRs, type aliases for affected pub items are
left in `aws_smithy_http` for backwards compatibility. However, due to
lack of trait aliases, a trait `CreateUnhandledError` needs to be
consumed from `aws_smithy_runtime_api`.

This PR also updates existing places that consumed those moved types so
they now depend on `aws-smithy-runtime-api` to do so.

## Testing
Relied on the existing tests, which ensured no deprecated warnings of
using moved types from the old place were issued.

## 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._
2023-10-27 21:16:45 +00:00
ysaito1001 882ebaf7e0
Avoid making `FsBuilder` aware of http-body version at interface level (#3101)
## Motivation and Context
Follow up on #3088

## Description
This PR reverts `ByteStream::read_with_body_0_4_from`,
`ByteStream::from_path_body_0_4`, and `ByteStream::from_file_body_0_4`
to the old names since from a customers' point of view, `FsBuilder`
should not mention anything about an `http-body` version at the API
level.

`FsBuilder` is currently an opt-in feature (with `rt-tokio` enabled) and
we make it tied to `http-body-0-4-x` by requiring `rt-tokio` including a
dependency on `http-body` version 0.4.x.

## Testing
Relied on the existing 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._
2023-10-27 21:04:39 +00:00
ysaito1001 222155022e
Add more type aliases for types moved to the `aws-smithy-types` crate (#3091)
## Motivation and Context
https://github.com/awslabs/smithy-rs/pull/3076 missed type alias for
some types we moved to `aws-smithy-types`. This small PR will fix that.

## Testing
Relied on the 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

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
2023-10-25 21:23:15 +00:00
Russell Cohen 6ceabf8b24
Use tokio::process to allow timeouts to occur (#3052)
## Motivation and Context
The existing credentials provider was a DOS risk and didn't obey timeout
settings because it used `std::timeout::spawn` but relied on a
async-based timeout mechanism.

## Description
- Use `tokio::process` instead
- introduce new cargo feature

## Testing
- unit test

## 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._
2023-10-25 18:27:58 +00:00
ysaito1001 2a51e0bceb
Feature-gate public use of `http-body` and `hyper` within `aws-smithy-types` (#3088)
## Motivation and Context
Implements https://github.com/awslabs/smithy-rs/issues/3033

## Description
This PR hides behind cargo features the third-party types from
`http-body` and `hyper` crates that are used in`aws-smithy-types`'
public API. Customers need to opt-in by enabling a cargo feature
`http-body-0-4-x` in `aws-smithy-types` to create an `SdkBody` or
`ByteStream` using those third-party types. For more details, please see
[the upgrade
guide](https://github.com/awslabs/smithy-rs/discussions/3089).

As can been seen from code changes, to reduce the surface area where we
need to feature-gate things, we have fused the
`aws_smithy_types::body::Inner::Streaming` enum variant into
`aws_smithy_types::body::Inner::Dyn` variant, thereby removing
`SdkBody::from_dyn`.

## Testing
Relied on existing 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: Zelda Hessler <zhessler@amazon.com>
2023-10-25 16:45:22 +00:00
Russell Cohen 12bed905bb
Fix bug where Custom Auth Schemes were not respected (#3087)
## Motivation and Context
- Fixes #3034
## Description
Because AuthSchemeOptions were being registered at the operation level,
there was no way for them to be overridden by customer-provided runtime
plugins. This moves them into a separate plugin that is added at
Client/Default priority.

## Testing
- new unit test

## 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._
2023-10-24 16:15:23 +00:00
John DiSanti 40f466213b
Replace credentials cache with identity cache (#3077)
This PR replaces the credentials cache with the new identity cache, and
adds config validation via the `SharedConfigValidator` runtime component
and `ValidateConfig` trait.

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
2023-10-20 23:37:16 +00:00
ysaito1001 ed8763e5df
Re-point those using `ByteStream` and `SdkBody` to smithy-types (#3076)
# Motivation and Context
A follow-up on #3026

## Description
#3026 moved
- `aws_smithy_http::body::{BoxBody, Error, SdkBody}` to
`aws_smithy_types::body::{BoxBody, Error, SdkBody}`
- `aws_smithy_http::byte_stream::{AggregatedBytes, ByteStream,
error::Error}` to `aws_smithy_types::byte_stream::{AggregatedBytes,
ByteStream, error::Error}`

and also left "breadcrumbs", so that customers could still consume
updated types from `aws_smithy_http` after the move.

This PR turns breadcrumbs into deprecation messages (via
`#[deprecated(...)]`) and updates existing places that used to use moved
types from `aws_smithy_http` to directly depend on `aws_smithy_types`.

## Testing
Relied on 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._
2023-10-19 20:15:32 +00:00
ysaito1001 e447a22794
Re-point those using `BuildError` from smithy-http to smithy-types (#3070)
## Motivation and Context
Completes #3054 (a follow-up on #3032)

## Description
#3032 moved `BuildError` from `aws_smithy_http::operation::error` to
`aws_smithy_types::error::operation`. That PR also left "breadcrumbs",
so that customers could still consume `BuldError` from `aws_smithy_http`
after the move.

This PR turns breadcrumbs into deprecation messages (via
`#[deprecated(...)]`) and updates existing places that used to use moved
types from `aws_smithy_http` to `aws_smithy_types`.

## Testing
Relied on 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: Russell Cohen <rcoh@amazon.com>
2023-10-19 18:38:25 +00:00
Russell Cohen 12fa4d3963
Delete `aws_smithy_http::ResolveEndpoint` and point usages to service-specific trait (#3078)
## Motivation and Context
- Fixes https://github.com/awslabs/smithy-rs/issues/3043

As a follow up to #3072 this removes the old endpoint resolver
interfaces in favor of creating a per-service resolver trait.

This trait defines a `into_shared_resolver()` method which converts the
local trait into a global resolver that can be used with the
orchestrator.

## 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 -->
- [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._
2023-10-18 20:57:56 +00:00
Russell Cohen 6dceb8c074
Move default endpoint resolver into a runtime plugin (#3072)
## Motivation and Context
In preparation for inlining the old endpoint traits, I'm cleaning up the
endpoint resolver behavior.

## Description

1. The `Config` field of `service_runtime_plugin` was unused to I
deleted it
2. Store the endpoint resolver in `RuntimeComponents` instead of in
operation config. This allows a lot of complex logic around
`ConfigOverride` to be removed.
3. Move the default endpoint resolver into a runtime plugin.
4. Don't have a fallback implementation for `EndpointResolver`, allow
final construction of `RuntimeComponents` to fail
5. `ServiceRuntimePlugin` has been changed to `Defaults` so that it
doesn't overwrite settings set by the service config


## Testing
Well covered by existing UT / 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
- [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._
2023-10-17 19:41:25 +00:00
John DiSanti 068ad03975
Implement `SsoTokenProvider` (#2917)
This PR adds a `SsoTokenProvider` that loads session name cached SSO
tokens, and automatically refreshes them when possible. The
`SsoCredentialsProvider` is updated to use this new `SsoTokenProvider`
so that it is now compatible with the latest AWS CLI.

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
2023-10-16 23:34:51 +00:00
Russell Cohen 684605ae4e
Http updates (#3059)
## Motivation and Context
- [ ] Upgrade guidance
- [x] changelog

To allow seamless adoption of the incoming `http` crate, we're updating
our client crates to use an intermediate type.

## Description

Update _client_ code to use `HttpRequest`. Some internal code still uses
`http::Request` but those usages are limited.

## 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._
2023-10-14 00:57:14 +00:00
John DiSanti 63ce3f951e
Rename orchestrator traits to be verbs (#3065)
This PR makes the orchestrator traits more idiomatic by making them
verbs.

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
2023-10-13 18:49:54 +00:00
John DiSanti d293d1f762
Add lifetimes to async traits that take args by reference (#3061)
This PR adds lifetimes to the `IdentityResolver`, `DnsResolver` (renamed
to `ResolveDns`), and `EndpointResolver` traits so that lifetime
gymnastics aren't needed when implementing those traits. For example,
`IdentityResolver::resolve_identity` takes `&ConfigBag` as an argument,
which means you have to pull things out of the ConfigBag outside of any
returned async block in order for the compiler to be satisfied. This
change removes that consideration and makes implementing these traits a
lot easier.

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
2023-10-13 16:56:50 +00:00
ysaito1001 8439f2ae43
Move `aws_smithy_http::operation::error::BuildError` into `aws-smithy-types` (#3032)
## Motivation and Context
Takes care of the first part of
https://github.com/awslabs/smithy-rs/issues/3054 (the remaining part is
denoted as `TODO(runtimeCratesVersioningCleanup)` and until that's done
the issue will not be closed).

## Description
This PR moves from `aws-smithy-http::operation::error::{BuildError,
SerializationError}` to
`aws-smithy-types::error::operation::{BuildError, SerializationError}`.

Within the origin crate, we leave "breadcrumbs" (i.e. reexports) for
existing customers of the items above so they are not broken by the
move. The breadcrumps will be removed by the part two of the issue.

As part of the move, `aws_smithy_http::endpoint::EndpointPrefix::new`
now returns its `crate::endpoint::error::InvalidEndpointError` instead
of `crate::operation::error::BuildError` for two reasons:
- `BuildError` is now in a stable crate and for an `InvalidUri` variant
to be created, it needed to take a `http::uri::InvalidUri` from a
unstable crate, which we cannot expose in public API.
- The new error is more closely related to the endpoint business.

## Testing
Relied on the 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: John DiSanti <jdisanti@amazon.com>
2023-10-12 21:49:26 +00:00
John DiSanti 3b6f8867f6
New-type all the orchestrator futures (#3055)
This PR replaces the `Future` type-alias that was pointing to
`NowOrLater` with a new-type for each trait that returns a future.

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
2023-10-11 18:13:06 +00:00
Zelda Hessler 96a9f8441e
implement user-configurable retry classifiers (#2977)
[Read the RFC here](https://github.com/awslabs/smithy-rs/pull/3018)

## 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 -->
#2417

## Description
<!--- Describe your changes in detail -->
Exactly what it says on the tin. I have a related RFC to publish that
goes into more depth.

## 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. -->
I wrote an integration test that ensures a custom retry classifier can
be set and is called.

## 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._
2023-10-10 19:07:23 +00:00
Russell Cohen e61fb6f006
Update `toSnakeCase` to better handle plurals, version numbers, and other pathological cases (#3037)
## Motivation and Context
There are currently a lot of fields in the SDK that are clearly
converted to snake-case wrong:
<img width="738" alt="Screenshot 2023-10-09 at 12 00 43 PM"
src="https://github.com/awslabs/smithy-rs/assets/492903/796b5dac-ca26-4a55-b9da-b88a976251d5">
<img width="417" alt="Screenshot 2023-10-09 at 12 02 48 PM"
src="https://github.com/awslabs/smithy-rs/assets/492903/b091bf50-2e6b-4ada-b2f8-8c7158f18f7d">


## Description
- Author a new splitWords algorithm
- Add snapshot test
- Add lots of individual tests.

## Testing
- snapshot testing, compared with current behavior.

## 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._
2023-10-10 16:02:37 +00:00
John DiSanti 6b96c1d46e
Make `customize()` sync and infallible (#3039)
This PR addresses a TODO comment to make `customize()` sync and
fallible.

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
2023-10-09 20:51:54 +00:00
John DiSanti 08196ec893
Remove remaining middleware code (#3038)
This PR removes the remaining rust-runtime code to support middleware,
deprecates empty crates, and removes the remaining codegen references to
any of that code. In the interest of keeping code review easier, a
separate PR will finish addressing the remaining
`TODO(enableNewSmithyRuntime)` comments.

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
2023-10-09 17:13:22 +00:00
John DiSanti 26a914ece0
Replace `DynConnector` and `HttpConnector` with `HttpClient` (#3011)
This PR removes the last usages of `DynConnector` and `HttpConnector`
from the `aws_smithy_client` crate with their counterparts in
aws-smithy-runtime-api and aws-smithy-runtime. It also introduces
`HttpClient` to make HTTP connector selection a smoother process, and
adds a runtime plugin that configures a default `HttpClient` so that
`Config` doesn't have to do that.

The `DnsService` from aws-config is also moved into aws-smithy-runtime
and refactored to be consistent with the other configurable traits in
the orchestrator since it will likely be used in the future for more
than just the ECS credentials provider.

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
2023-10-06 17:32:35 +00:00
Zelda Hessler bb35688696
fix use_fips in provider config (#3007)
I'm not 100% that I fixed this in the right way. Feel free to set me
straight if that's the case.

## 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 -->
aws-sdk-rust#882

## Description
<!--- Describe your changes in detail -->
This change causes the`ProviderConfig` to respect both `use_fips` and
`use_dual_stack` when those settings are configured in a user's
environment or profile.

## 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. -->
I wrote two 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._

---------

Co-authored-by: John DiSanti <jdisanti@amazon.com>
2023-10-04 15:02:14 +00:00
Russell Cohen 5129c1f5f0
Remove ProviderConfig as the configuration source for AssumeRoleProvider (#3014)
## Motivation and Context
`AssumeRoleProvider` currently uses `ProviderConfig` as a source of
configuration, but that API is hard use and not intended for external
consumption.

This fixes the Assume Role issue but only for `AssumeRoleProvider`

## Description
Update the API (see changelog) to be more ergonomic and derive
configuration from `SdkConfig` instead.

## Testing
Existing tests + new 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._
2023-10-02 13:32:50 +00:00
John DiSanti d800d33e28
Use the orchestrator client for ECS and IMDS credentials in aws-config (#2997)
This ports the direct uses of the `aws_smithy_client::Client` in
aws_config to 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._
2023-09-29 01:07:49 +00:00
ysaito1001 33cd698f7f
Remove `futures_core::stream::Stream` from `aws_smithy_http::byte_stream::ByteStream` (#2983)
## Motivation and Context
Removes `futures_core::stream::Stream` from
`aws_smithy_http::byte_stream::ByteStream`

## Description
This PR is part of our ongoing effort,
https://github.com/awslabs/smithy-rs/issues/2413. We remove the
`futures_core::stream::Stream` trait from
`aws_smithy_http::byte_stream::ByteStream`. To continue support existing
places that relied upon `ByteStream` implementing the `Stream` trait, we
provide explicit `.next`, `.try_next`, and `.size_hints` methods on that
type. As part of it, a doc-hidden type `FuturesStreamCompatByteStream`,
which implements `Stream`, has been added to `aws_smithy_http` to cater
to those who need a type implementing `Stream` (see
[discussion](https://github.com/awslabs/smithy-rs/pull/2910#discussion_r1317112233)
why doc-hidden).

Another place we need to update is codegen responsible for rendering
stream payload serializer, and this affects the server. The regular
server and the python server have slightly different rendering
requirements, since the former uses
`aws_smithy_http::byte_stream::ByteStream` (that does _not_ implement
the `Stream` trait) and latter uses its own
[ByteStream](cb79a68e3c/rust-runtime/aws-smithy-http-server-python/src/types.rs (L343))
(that does implement `Stream`). We use
`ServerHttpBoundProtocolCustomization` to handle the difference:
`StreamPayloadSerializerCustomization` and
`PythonServerStreamPayloadSerializerCustomization`.

## Testing
No new behavior has been added, relied on the existing tests in CI.

## 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._
2023-09-28 19:47:05 +00:00
Zelda Hessler bc41828451
add Sigv4A support (#2939)
## Motivation

smithy-rs#1797

## Description

This PR adds Sigv4a support along with many tests that were ported from
the CRT Sigv4a project. **It does not include**:
- An E2E test. We should create one, but doing so requires us to set up
MRAP which is a good amount of work.
- A fuzz test. While I wrote and ran one on my machine, I found the fuzz
testing tool to be really difficult to use and it would take some work
to include fuzz testing in CI.

Additionally, test Sigv4a is annoying because Sigv4a signing is
non-deterministic. Because of this, the tests test signature generation
by first signing a request, and then by verifying that signature (_This
is how the CRT tests this feature_).

----

_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>
2023-09-28 17:50:33 +00:00
Russell Cohen aaf71c8311
Produce `&[T]` instead of `Option<&[T]>` for list fields (#2995)
## Motivation and Context
When the returned field is a list, there is _almost_ never a reason to
know if the returned value was null or `[]` — this addresses the 99%
case.

Before:
```rust
fn blah(&self) -> Option<&[T]> { self.blah.as_deref() }
```

After:
```rust
fn blah(&self) -> &[T] { self.blah.as_deref().unwrap_or_default() }
```

**note**: no impact on servers by default, see codegen diff.

## Description
Update accessors for lists.

## Testing
- [x] codegen diff audit (no server changes)
- [x] 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._
2023-09-28 16:00:20 +00:00
Fahad Zubair 3229089fba
Allow python middleware to set the URI of a request (#3002)
## Motivation and Context
Python middleware were unable to change the URI which makes it
impossible to change the route of an incoming request in Python.

## Description
URI has a #[setter] that Python side can use to change it.

## Testing
- Test has been added that ensures URI can be changed from python.
- If the URI is modified by a middleware in a local smithy-rs Python
server, a different route will be invoked.

## Checklist
- I've updated the changelog.next.toml

Co-authored-by: Fahad Zubair <fahadzub@amazon.com>
2023-09-28 15:05:08 +00:00
ysaito1001 75fc85f6ea
Remove `futures_core::stream::Stream` from `aws-smithy-async` (#2978)
## Motivation and Context
Removes `futures_core::stream::Stream` from the `aws-smithy-async`
crate.

## Description
This PR is part of our ongoing effort,
https://github.com/awslabs/smithy-rs/issues/2413. We remove the
`futures_core::stream::Stream` trait from the public API in the
`aws-smithy-async` crate. While doing so, we compensate
- `FnStream` by providing the explicit `.next` and `.collect` methods to
let the previously working code continue working.
- `TryFlatMap` by making it return a new-type wrapper `PaginationStream`
to hide `FnStream` from those who use paginators.

With this change, the latest canary no longer uses
`tokio_stream::StreamExt`, since the paginator does not work in terms of
the `Stream` trait. Furthermore, `aws-sdk-rust` has been more than [3
releases since
release-2023-01-26](https://github.com/awslabs/aws-sdk-rust/releases),
so the module `release-2023-01-26` has been removed from
`canary-lambda`.

## Testing
No new tests added, but made sure the existing tests keep working with
the change.

## 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._
2023-09-27 21:14:40 +00:00
Russell Cohen e9aa14e129
Generate better docs when fields are required (#2996)
## Motivation and Context
With required builders, builders return errors in more cases now. This
clearly indicates which fields that the service considers required.

## Description
Add more docs for required status.
<img width="1037" alt="Screenshot 2023-09-22 at 3 38 42 PM"
src="https://github.com/awslabs/smithy-rs/assets/492903/082b4950-7edd-4f25-9081-a3c9fe3f870a">
<img width="998" alt="Screenshot 2023-09-22 at 3 39 01 PM"
src="https://github.com/awslabs/smithy-rs/assets/492903/98acd359-5572-4e01-afba-7af5b0264d18">

## 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._
2023-09-25 15:15:04 +00:00
Ryan Schmitt 32655552c1
Omit fractional seconds from `http-date` format (#2989)
## Motivation and Context
Closes #2831.

## Description
Fractional seconds will still be accepted during parsing, but not
emitted during serialization.

## Testing
```
./gradlew codegen-core:check codegen-client:check codegen-server:check codegen-client-test:check codegen-server-test:check
```

## 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: Russell Cohen <rcoh@amazon.com>
2023-09-21 18:54:03 +00:00
Zelda Hessler 1331dc5443
add support for nullable struct members when generating AWS SDKs (#2916)
## 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 -->
smithy-rs#1767 aws-sdk-rust#536

## Description
<!--- Describe your changes in detail -->
This PR adds support for nullability i.e. much less unwraps will be
required when using the AWS SDK. For generic clients, this new behavior
can be enabled in codegen by setting `nullabilityCheckMode: "Client"` in
their codegen config:
```
      "plugins": {
        "rust-client-codegen": {
          "codegen": {
            "includeFluentClient": false,
            "nullabilityCheckMode": "CLIENT_CAREFUL"
          },
     }
```


## 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. -->
Ran 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._

---------

Co-authored-by: John DiSanti <jdisanti@amazon.com>
Co-authored-by: Russell Cohen <rcoh@amazon.com>
2023-09-21 17:20:51 +00:00
Russell Cohen 9b0e3cfd25
Source defaults from the model instead of implicitly (#2985)
## Motivation and Context
We weren't correctly computing defaults which lead to incorrect behavior
when coupled with nullability.

## Description
Minimal changeset to source defaults from the model. Other changes:
- Unify enum parsing across client and server to always use `from_str`
in protocol tests
- Extract `PrimitiveInstantiator` from `Instantiator` so it can be used
to instantiate defaults

## Testing
- regular codegen 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._
2023-09-19 13:56:48 +00:00
ysaito1001 0bd57fe312
Port redacting sensitive body to orchestrator (#2972)
## Motivation and Context
Fixes https://github.com/awslabs/smithy-rs/issues/2926

## Description
This PR ports logic implemented in
https://github.com/awslabs/smithy-rs/pull/2603. Thankfully, even though
we did not port this at the time of the orchestrator launch, the
orchestrator has not logged sensitive bodies because we have never
logged response bodies in the orchestrator code.

The code changes in this PR
- now logs response bodies in `try_attempt`
- ports the logic from the previous PR in question to the orchestrator,
via an interceptor

Now, when credentials providers in `aws_config` need to say "I want to
redact a response body"
([example](2c27834f90/aws/rust-runtime/aws-config/src/http_credential_provider.rs (L48)))
when middleware is gone, they can pass an interceptor
`SensitiveOutputInterceptor` to `Config` of whatever clients they are
using.

## Testing
Depends on the existing tests.

Without the logic ported over the orchestrator and by logging response
bodies unconditionally in `try_attempt`, we got the following failures.
After we've ported the logic, they now pass.
```
    default_provider::credentials::test::ecs_assume_role
    default_provider::credentials::test::imds_assume_role
    default_provider::credentials::test::sso_assume_role
    default_provider::credentials::test::web_identity_token_env
    default_provider::credentials::test::web_identity_token_profile
    default_provider::credentials::test::web_identity_token_source_profile
    profile::credentials::test::e2e_assume_role
    profile::credentials::test::region_override
    profile::credentials::test::retry_on_error
```


## 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>
Co-authored-by: John DiSanti <jdisanti@amazon.com>
2023-09-08 17:45:30 +00:00
John DiSanti e322a2d733
Port middleware connectors to the orchestrator (#2970)
This PR ports all the connectors from the `aws-smithy-client` crate into
`aws-smithy-runtime` implementing the new `HttpConnector` trait. The old
connectors are left in place for now, and follow up PRs will remove them
as well as revise the generated configs to take `HttpConnector` impls
rather than `DynConnector`.

----

_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>
2023-09-07 16:54:56 +00:00
ysaito1001 be9093c90d
Remove `once_cell` from public API (#2973)
## Motivation and Context
Addresses  7 in #2413 

## Description
This small PR removes uses of `once_cell` from public API. The
`http_versions` module in the `aws_smithy_http` crate was dead-code.

## Testing
Relies on 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: ysaito1001 <awsaito@amazon.com>
2023-09-06 03:07:26 +00:00
Russell Cohen 2c27834f90
Make required context parameters required (#2964)
## 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 -->
When a `@contextParam` is marked as required, we will enforce it on
inputs. Since these fields may influence endpoint, omitting them can
result in a different target being hit.

- #1668 
- aws-sdk-rust#873

## Description
<!--- Describe your changes in detail -->

## Testing
- [x] S3 Integration test

## 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._
2023-08-31 19:26:07 +00:00
John DiSanti c98d5febac
Fix codegen for unions with the `@httpPayload` trait (#2969)
This PR incorporates the new test cases in Smithy from
https://github.com/smithy-lang/smithy/pull/1908, and adds support to
`@restXml` and `@restJson1` for unions with the `@httpPayload` trait.
This resolves https://github.com/awslabs/smithy-rs/issues/1896.

This also fixes code generation for the latest `medicalimaging` SDK
model.

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
2023-08-31 16:43:02 +00:00
John DiSanti 33a1c48f91 Merge 'smithy-rs-release-0.56.x' into `main` 2023-08-30 10:17:48 -07:00
John DiSanti 1b6f0b8ad0
Add missing changelog entry (#2966)
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
2023-08-30 10:02:21 -07:00
Russell Cohen 2db1c34d5e
Allow <Error> to trigger error handling for S3 (#2958)
## Motivation and Context
- https://github.com/awslabs/aws-sdk-rust/issues/873

## Description
Add a customization for S3 so that if `<Error>` is the root element, we
trigger the error parsing flow

## Testing
- Added an integration test

## 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._
2023-08-30 14:27:06 +00:00
John DiSanti 9f3960799f
Add `@optionalAuth` to all S3 operations (#2955)
In #2907, I created an allow list of S3 operations to add
`@optionalAuth` to, but this turns out to be too restrictive, as seen in
https://github.com/awslabs/aws-sdk-rust/issues/878. This PR restores the
original middleware behavior of allowing optional auth for all S3
operations.

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
2023-08-29 21:55:21 +00:00
ysaito1001 cf95f4803a
Make `CustomizableOperation` `Send` and `Sync` (#2951)
## Motivation and Context
Fixes https://github.com/awslabs/smithy-rs/issues/2944

## Description
`CustomizableOperation` in the last two releases
([release-2023-08-01](https://github.com/awslabs/smithy-rs/releases/tag/release-2023-08-01)
and
[release-2023-08-22](https://github.com/awslabs/smithy-rs/releases/tag/release-2023-08-22))
broke backward-compatibility with respect to its auto traits.
Specifically, it ceased to be `Send` and `Sync` because the struct
contained a boxed trait object. This PR fix that issue, making
`CustomizableOperation` `Send` and `Sync` again.

## Testing
- Added a Kotlin unit test to verify `CustomizableOperation` is `Send`
and `Sync`.

## 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>
2023-08-29 16:22:21 -05:00
ysaito1001 997c9c85be
Cherry-picks updating MSRV to 1.70.0 from main to smithy-rs-release-0.56.x (#2959)
## Motivation and Context
Cherry picks MSRV 1.70.0 upgrade ([original
PR](https://github.com/awslabs/smithy-rs/pull/2948) merged to `main`)

## 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: Zelda Hessler <zhessler@amazon.com>
2023-08-29 20:35:24 +00:00
Zelda Hessler 778244f801
update MSRV to 1.70.0 (#2948)
## 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._
2023-08-24 19:51:06 +00:00
John DiSanti d934835fe9 Merge remote-tracking branch 'origin/smithy-rs-release-0.56.x' 2023-08-22 12:46:19 -07:00
AWS SDK Rust Bot 9f6e69fea2 Update changelog 2023-08-22 19:07:02 +00:00
John DiSanti 7ea0c8efd6
Add missing changelog entry (#2937)
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
2023-08-22 10:53:54 -07:00
John DiSanti 67830dccb5
Make it possible to nest runtime components (#2909)
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._
2023-08-22 00:17:04 +00:00
John DiSanti 737559cf9e Merge remote-tracking branch 'origin/smithy-rs-release-0.56.x' into jdisanti-fix-sdkerror-reexport 2023-08-18 12:05:24 -07:00
ysaito1001 c742b5f66c
Reduce amount of logging from #[instrument] (#2934)
**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>
2023-08-18 11:17:58 -07:00
Zelda Hessler 39c6476f31
Use `Identity` instead of `Credentials` in signing code (#2913)
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._
2023-08-18 14:51:03 +00:00
John DiSanti c4ba6ffd31 Update changelog 2023-08-17 18:36:11 -07:00
Zelda Hessler 200fb6196d
Rename `signing_service` to `signing_name` (#2911)
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._
2023-08-17 16:55:12 +00:00
Russell Cohen 2d61502221
Remove the public HTTP dependency from aws-sigv4 (#2921)
## 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._
2023-08-16 20:28:32 +00:00
Russell Cohen 17e78b68c7
Fix generated summary docs for convenience HashMap / Vec members (#2914)
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._
2023-08-14 16:17:39 +00:00
John DiSanti 0286b9fbea
Fix S3 optional auth (#2907)
## 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._
2023-08-10 22:18:03 +00:00
John DiSanti 791e8d4107
Re-export `RuntimeComponents` in generated clients (#2904)
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._
2023-08-07 15:04:59 +00:00
AWS SDK Rust Bot e78c60dbf1 Update changelog 2023-08-01 22:10:49 +00:00
Zelda Hessler d4a2308e94
update MSRV to 1.69.0 (#2893)
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
2023-08-01 19:37:59 +00:00
John DiSanti d2690e7ab1
Add orchestrator upgrade guides to changelog (#2888)
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
2023-07-28 18:02:24 +00:00
Russell Cohen 79be310546
Share HTTP connectors between providers and clients (#2876)
## 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._
2023-07-27 16:15:43 +00:00
Russell Cohen 8eeb21c490
Split test-util feature to allow test-util to be utilized in WASM (#2873)
## 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._
2023-07-27 15:52:12 +00:00
Russell Cohen 9a4156de04
Remove vestiges of the old TimeSource implementation & refactor (#2877)
## 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>
2023-07-26 23:51:36 +00:00
david-perez a5465b79a5
Render only shape name in server error responses (#2866)
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._
2023-07-25 12:03:21 +00:00
david-perez e060135e01
Move `alb_health_check` module out of the `plugin` module (#2865)
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._
2023-07-21 13:24:08 +00:00
Russell Cohen a57a719cfe
Add `sdk_ua_app_id` in addition to sdk-ua-app-id in profile file support (#2724)
## 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._
2023-07-20 20:33:13 +00:00
ysaito1001 27df48fcc0
Remove doc hidden from struct fields (#2854)
## 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>
2023-07-19 15:02:49 +00:00
ysaito1001 1ac59421a9
Remove third party types from public APIs Part 2 (#2848)
## 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>
2023-07-17 14:58:48 +00:00
John DiSanti 7d1d35c9f6
Fix Timestream in the orchestrator (#2846)
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._
2023-07-14 20:57:54 +00:00
ysaito1001 2999766595
Remove third party types from public APIs (#2845)
## 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>
2023-07-14 17:36:17 +00:00
Nate McMaster (AWS) 8abc946328
Update OperationInputTestDecorator to find operation shape by name (#2782)
## 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>
2023-07-10 14:56:56 +00:00
david-perez ddba46086a
Better distinguish model and HTTP plugins (#2827)
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._
2023-07-04 12:19:15 +00:00
Sam Bartlett 80de569d2b
Expand skipped headers for sigv4 canonical request signing to include x-amzn-trace-id and authorization headers. (#2815)
## 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>
2023-06-28 22:00:26 +00:00
David Souther e6293b2282
Add get_foo() -> &Option<Foo> accessors for builders and fluent builders. (#2792)
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>
2023-06-21 23:28:03 +00:00
Yotam Ofek 2987cbdd91
Optimize `AggregatedBytes::to_vec` (#2786)
## 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>
2023-06-20 09:10:57 +00:00
ysaito1001 9630892765
Rename `make_token` to `idempotency_token_provider` (#2783)
## 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>
2023-06-16 17:48:00 +00:00
Harry Barber b2bdcba57a
Parameterize `Plugin` by service rather than protocol (#2772)
## 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.
2023-06-15 21:37:24 +00:00
Harry Barber 07bd832a21
Relax bounds on `Scoped` (#2779)
## Motivation and Context

I accidentally added this bound, it is not only redundant but its
absence is one of the key benefits of this approach.
2023-06-15 13:30:54 +00:00
Thomas Cameron 1e2c03c9d1
Add send_with method to fluent builders (#2652)
## 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>
2023-06-14 17:32:22 +00:00
Harry Barber 988eb617fb
Add `Scoped` `Plugin` (#2759)
## Motivation and Context

The
[`FilterByOperationName`](https://docs.rs/aws-smithy-http-server/0.55.4/aws_smithy_http_server/plugin/struct.FilterByOperationName.html)
allows the customer to filter application of a plugin. However this is a
_runtime_ filter. A faster and type safe alternative would be a nice
option.

## Description

Add `Scoped` `Plugin` and `scope` macro.

---------

Co-authored-by: david-perez <d@vidp.dev>
2023-06-14 14:17:35 +00:00
John DiSanti cfff41a883
Upgrade MSRV to 1.68.2 (#2745)
## 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>
2023-06-13 15:23:04 +00:00
Harry Barber 11cf41d944
Simplify `Plugin` trait (#2740)
## Motivation and Context

https://github.com/awslabs/smithy-rs/issues/2444

## Description

- Simplify `Plugin`, make it closer to `Layer`.
- Remove `Operation`.
2023-06-12 16:46:58 +00:00
ysaito1001 ec45767a41
Avoid exposing `Arc`ed `ResolveEndpoint` in public API (#2758)
## 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>
2023-06-09 15:55:42 +00:00
82marbag 5eb0927514
OperationShape::NAME as ShapeId (#2678) (#2717)
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>
2023-06-09 13:33:40 +00:00
ysaito1001 500aef3957
Add SharedAsyncSleep wrapping Arc<dyn AsyncSleep> (#2742)
## 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>
2023-06-02 20:33:23 +00:00
Russell Cohen 8c045d271c
Add support for TimeStreamWrite and TimeStreamQuery (#2707)
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._
2023-05-31 18:08:51 +00:00
Harry Barber 7347c58458
Remove `PollError` from server type parameters (#2457)
## Motivation and Context

https://github.com/awslabs/smithy-rs/issues/2444

## Description

Remove `PollError` from the implementation and documentation.
2023-05-30 20:13:53 +00:00
Russell Cohen b30b063e1e
Integrate TimeSource into the orchestrator and middleware (breaking change warning is spurious) (#2728)
## 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._
2023-05-30 15:52:11 +00:00
david-perez cf292d5817
Bump `lambda_http` dependency of `aws-smithy-http-server` to 0.8.0 (#2685) (#2691)
This is https://github.com/awslabs/smithy-rs/pull/2685 again, which was
merged
prematurely and reverted in
https://github.com/awslabs/smithy-rs/pull/2690.

This time we won't merge it until it's due time.

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
2023-05-30 14:47:20 +00:00
Thor Bjorgvinsson 5126a61489
Fix tiny_map from_iter where one operation was being dropped (#2733)
## 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>
2023-05-30 11:46:07 +00:00
david-perez ec874d5a80
Error out if `ignoreUnsupportedConstraintTraits` has no effect (#2539)
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._
2023-05-30 10:26:42 +00:00
Chris Holcombe 79ead4884c
Make SigningInstructions public (#2730)
## 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>
2023-05-26 21:02:36 +00:00
John DiSanti c6e537969e
Fix event streams in the orchestrator implementation (#2673)
## 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._
2023-05-26 16:46:39 +00:00
John DiSanti 8773a70428
Simplify event stream message signer configuration (#2671)
## 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._
2023-05-26 15:49:56 +00:00
82marbag d083c6f271
remove native-tls (#2675)
* 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>
2023-05-26 10:18:29 +00:00
John DiSanti 529024116a
Merge changelog from the `smithy-rs-release-0.55.x` branch (#2731)
## 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>
2023-05-26 00:39:17 +00:00
ysaito1001 7ccac0607c
Add `NoCredentialsCache` that offers no caching ability (#2720)
## 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>
2023-05-24 21:53:30 +00:00
Russell Cohen bbe9d52a76
Fix the error message for SSO credential providers (#2722)
## 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._
2023-05-23 19:15:47 +00:00
John DiSanti 040d0e42d5
Fix client operation name collisions with the standard library prelude (#2696)
## 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._
2023-05-12 22:47:31 +00:00
82marbag c2da4cf16d
Revert "OperationShape::NAME as ShapeId (#2678)" (#2698)
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._
2023-05-12 09:07:52 +00:00
82marbag 9b340fb89e
OperationShape::NAME as ShapeId (#2678)
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>
2023-05-11 15:02:03 +00:00
ysaito1001 91194e786c
Avoid extending IMDS credentials expiry unconditionally (#2694)
## 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>
2023-05-11 00:46:33 +00:00
david-perez a78ac591fe
Revert "Bump `lambda_http` dependency of `aws-smithy-http-server` to 0.8.0 (#2685)" (#2690)
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._
2023-05-10 10:41:28 +00:00
david-perez 04db5e3572
Bump `lambda_http` dependency of `aws-smithy-http-server` to 0.8.0 (#2685)
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._
2023-05-10 09:39:15 +00:00
Henrik Sjööh 2b165037fd
Use `as_nanos` in `Ord` impl for `DateTime` (#2656)
## 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._
2023-05-09 23:31:51 +00:00
Henrik Sjööh 5a8fff7a32
implement `Ord` and `PartialOrd` for `DateTime` (#2653)
## 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._
2023-04-27 16:16:01 +00:00
Russell Cohen 6af5d40d3b
Add useful Debug impl to PropertyBag and ConfigBag (#2612)
## 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>
2023-04-26 20:19:47 +00:00
Burak cfd22450ee
Remove `CHANGELOG.next.toml` entries that have been released with `v0.55.2` (#2624)
## 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._
2023-04-26 17:14:46 +00:00
Julian Antonielli 2de6815c10
Add `AlbHealthCheckLayer` (#2540)
## 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._
2023-04-24 10:25:27 +00:00
John DiSanti 1a65a44e53
Upgrade MSRV to Rust 1.67.1 (#2611)
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
2023-04-21 17:26:27 +00:00
Russell Cohen 9a41e359dd
Add credentials exposure test & fix STS + SSO (#2603)
## 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>
2023-04-20 17:26:01 +00:00
david-perez 63a1e78f58
Fix server code generation of `@httpPayload`-bound constrained shapes (#2584)
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._
2023-04-19 09:48:34 +00:00
david-perez 80f25d42dc
Fix generation of constrained shapes reaching `@sensitive` shapes (#2585)
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>
2023-04-18 10:35:22 +00:00
John DiSanti 04cf5e6c2c
Fix typo in changelog entry (#2587)
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
2023-04-18 09:41:00 +00:00
Antoine Büsch fc63800f6a
Implement `StdError::source()` for Error enum (#2564)
## 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._
2023-04-17 13:51:01 +00:00
ysaito1001 35f2f27a83
Re-export `aws_smithy_types::date_time::Format` in service client crates (#2534)
* 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>
2023-04-13 22:58:43 +00:00
Zelda Hessler 33b24bb7f3
fix: signing params debug impl (#2562)
* fix: redact credentials when debug logging signing params

* update: CHANGELOG.next.toml

* yuki makes a good point
2023-04-10 18:46:07 +00:00
Russell Cohen ee324f2724
Fix bug in WriteGetObjectResponse endpoint (#2560) 2023-04-10 15:24:00 +00:00
Parker Timmerman a20889a278
runtime: add a method `into_segments` to `AggregatedBytes` (#2525)
* start, add a method to AggregatedBytes called into_segments

* update CHANGELOG.next.toml
2023-03-31 21:26:19 +00:00
Martin Jesper Low Madsen b023426d1c
Add support for omitting session token in canonical requests (#2473)
* 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>
2023-03-30 18:11:16 +00:00
ysaito1001 aae9ee1aec
Make AppName configurable from within ConfigLoader (#2513)
* 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>
2023-03-30 16:57:56 +00:00
Zelda Hessler 1d7dbd6b1f
fix: handling of S3 part-level checksums (#2512)
* fix: handling of S3 part-level checksums

* add: CHANGELOG.next.toml entry

* add: missing integration test dep to codegen

* fix: use - instead of _
2023-03-30 15:33:12 +00:00
Eduardo de Moura Rodrigues 65058d9d5a
feat: support compiling to webassembly (#2254)
* 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>
2023-03-29 19:29:02 +00:00
John DiSanti 48bd719743
Remove `enableNewCrateOrganizationScheme` codegen flag (#2507) 2023-03-29 16:57:32 +00:00
John DiSanti b65a645ce1
Fix request ID logging for streaming operations (#2495) 2023-03-27 21:34:38 +00:00
John DiSanti db76db93af
Fix lack of the `Sync` auto trait on event stream outputs (#2496) 2023-03-24 21:55:17 +00:00
John DiSanti 3f738ca7c8
Update changelog (#2497)
Co-authored-by: AWS SDK Rust Bot <aws-sdk-rust-primary@amazon.com>
2023-03-24 17:54:26 +00:00
82marbag d89a90d631
Add request ID to response headers (#2438)
* 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>
2023-03-23 09:17:36 +00:00
Russell Cohen de97b3d7f3
Remove deprecated ResolveAwsEndpoint and related interfaces. (#2464)
* Remove deprecated ResolveAwsEndpoint and related interfaces.

* update changelog with pointer

* Rename AwsEndpointDecorator to have a more appropriate name

* Allow endpoint resolver to be omitted
2023-03-21 12:43:04 +00:00
Russell Cohen 05f920f672
Upgrade Tokio to 1.23.1 (RUSTSEC-2023-0001) (#2474) 2023-03-20 17:44:00 +00:00
Russell Cohen d8a7d9998f
Fix bug in default HTTP Connector provided by aws-config (#2471)
* Fix bug in default HTTP Connector provided by aws-config

* Fix clippy lint

---------

Co-authored-by: John DiSanti <jdisanti@amazon.com>
2023-03-16 23:53:13 +00:00
Zelda Hessler 92952cbe51
Update MSRV to 1.66.1 (#2468)
* update: MSRV to 1.66.1

* add: CHANGELOG.next.toml entry

* update: Dockerfile too

* fix: clippy lints

* fix: sigv4 event_stream.rs clippy lint
update: codegen clippy lint allowlist

* fix: doc lint that's nightly only
add: docs for aws-smithy-http
add: docs for aws-smithy-client
add: docs for aws-smithy-async

* add: more missing docs.

* fix: add more missing docs

* remove: unnecessary & in HttpBindingGenerator
fix: lint name

* fix: another doc import

* fix: test broken by changing compiler error

* fix: even more lints\nadd: lint warns to all smithy runtime crates

* fix: broken doc links

* fix: clippy bug

* fix: don't use modules named lib in codegen tests

* fix: the paginator_canary.rs unnecessary cast
2023-03-16 21:58:14 +00:00
Russell Cohen c3c747a1ed
Upgrade to Smithy 1.27.2 (#2226)
* 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
2023-03-14 21:14:27 +00:00
Russell Cohen 61934da044
Add connection poisoning to aws-smithy-client (#2445)
* 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
2023-03-14 20:08:35 +00:00
John DiSanti 358d13a09a
Enable the crate reorganization for generic clients (#2448) 2023-03-13 19:00:11 -07:00
John DiSanti eb261e63ab
Enable crate reorganization for the SDK (#2433)
* 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
2023-03-13 22:28:15 +00:00
Zelda Hessler 06b865bcd7
update: enable presigned S3 HeadObject requests (#2451)
* update: enable presigned S3 HeadObject requests

* add: CHANGELOG entry

* Update CHANGELOG.next.toml

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

---------

Co-authored-by: John DiSanti <jdisanti@amazon.com>
2023-03-13 20:08:54 +00:00
John DiSanti 4835af9d6b
Make `RustReservedWordsSymbolProvider` configurable (#2382)
* 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
2023-03-13 19:15:55 +00:00
ysaito1001 7f4152cc93
Add more client re-exports (#2437)
* 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>
2023-03-09 17:13:03 +00:00
Harry Barber b17a86753a
Use a bespoke version of `Either` (#2441)
* 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
2023-03-08 23:03:36 +00:00
Harry Barber bec93c8a5e
Remove uncessary type parameter and constraints from `Upgrade` service (#2436)
* Remove B from Upgrade service

* Remove duplicated bounds on Upgradable

* Update documentation

* Add CHANGELOG.next.toml entry
2023-03-08 15:56:56 +00:00
John DiSanti 7ce80320ed
Make it possible to create `SdkError` context structs for tests (#2428) 2023-03-03 17:12:45 +00:00
Harry Barber 530386e504
Update changelog to reflect 0.54.x branch releases (#2411) 2023-02-23 19:48:37 +00:00
ysaito1001 da264056eb
Add support for the awsQueryCompatible trait (#2398)
* 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>
2023-02-22 21:04:48 +00:00
Fahad Zubair 3d007674b9
Constraint member types are refactored as standalone shapes. (#2256)
* 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>
2023-02-17 19:21:01 +00:00
82marbag 5a5a7c44d6
Nested server structure member shapes targeting simple shapes with default trait (#2352)
* 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>
2023-02-17 18:19:34 +00:00
Zelda Hessler d54c005ade
add: deprecation notice to deprecated fluent builder methods (#2386)
* add: deprecation notice to deprecated fluent builder methods

* add: CHANGELOG.next.toml notes
2023-02-16 17:50:42 +00:00
Zelda Hessler 10520d7fd7
Fix: native-tls client creation to support HTTPS again (#2360)
* 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
2023-02-13 22:45:50 +00:00
Harry Barber 9ecd7f0a30
Fix consistent service naming and add test coverage (#2349)
* 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
2023-02-13 18:25:56 +00:00
John DiSanti d48878ee01
Implement request ID access for SDK clients RFC (#2129)
* 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`
2023-02-10 17:36:48 -08:00
ysaito1001 0a11d519c6
Add jitter to `LazyCredentialsCache` (#2335)
* 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>
2023-02-10 23:03:38 +00:00
Nugine de186678ee
Bump Rust MSRV to 1.63.0 (#2222)
Co-authored-by: Zelda Hessler <zhessler@amazon.com>
Co-authored-by: John DiSanti <jdisanti@amazon.com>
2023-02-10 12:59:31 -08:00
Luca Palmieri 18bfa20712
Remove entries that have been released in 0.54.2. (#2323) 2023-02-07 15:25:37 +00:00
Luca Palmieri a389ea2d4e
Enforce the same minimum TLS version (1.2) for both TLS backends (#2312)
* 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
2023-02-06 16:30:33 +00:00
Nipunn Koorapati f8a799db2a
Fix handling of repeated headers in AWS request canonicalization (#2261) 2023-02-03 18:15:25 +00:00
Harry Barber 3ee5d069cc
Make `OperationExtension` store the absolute shape ID (#2276)
* 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>
2023-02-03 13:50:15 +00:00
ysaito1001 ac7fdf21c0
Fix broken doc link to `tokio_stream::Stream` (#2271)
* 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>
2023-02-02 18:56:29 +00:00
ysaito1001 681d3b33af
Add static stability support to IMDS credentials provider (#2258)
* 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>
2023-02-02 00:56:06 +00:00
david-perez 52cb0fc8e8
Add support for `@uniqueItems` (#2232)
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.
2023-02-01 12:43:12 +00:00
ysaito1001 980b5c441c
Add fallback_on_interrupt to the ProvideCredentials trait (#2246)
* Implement RFC for providing fallback credentials

This commit implements the changes checklist in the RFC for providing
fallback credentials.

* Remove needless lifetime parameter

* Update CHANGELOG.next.toml

---------

Co-authored-by: Yuki Saito <awsaito@amazon.com>
2023-01-27 19:34:39 +00:00
AWS SDK Rust Bot 0965f12ff6 Update changelog 2023-01-25 15:31:25 +00:00
Harry Barber ebdf59750a
Fix `OperationExtensionFuture` poll order (#2247)
* Fix `OperationExtensionFuture` poll order

* Add CHANGELOG.next.toml entry

Co-authored-by: AWS SDK Rust Bot <97246200+aws-sdk-rust-ci@users.noreply.github.com>
2023-01-25 14:53:20 +00:00
AWS SDK Rust Bot 701d294c6a Update changelog 2023-01-24 16:22:51 +00:00
Harry Barber 4257a188d0
Add changelog entry for "Remove old service builder machinery" (#2242) 2023-01-23 09:48:18 -06:00
Russell Cohen 5fa0f8b29e
Changelog fix (#2234)
* Fix changelog
* Add missing changelog entries
2023-01-19 20:13:34 +00:00
ysaito1001 10e915b6ac
Replace Arc with SharedCredentialsProvider in credentials_provider builder methods (#2227)
* 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>
2023-01-19 16:48:55 +00:00
Luca Palmieri d9ea56d387
Remove old entries from CHANGELOG.next.toml (#2228)
* Remove old entries from CHANGELOG.next.toml

* Update CHANGELOG.next.toml
2023-01-19 15:14:48 +00:00
david-perez adf30a8eee
Derive `Eq` and `Hash` wherever possible (#2223)
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
2023-01-19 13:25:00 +01:00
ysaito1001 d040f76fd1
Ensure SDK credential cache type safety (#2122)
* 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>
2023-01-17 17:18:18 +00:00
david-perez 9f905179cd
Support `@sparse` constrained map shapes and list shapes (#2213)
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`.
2023-01-17 14:58:42 +00:00
AWS SDK Rust Bot f5c56b66e9 Update changelog 2023-01-12 14:29:49 +00:00
david-perez 8d09dade44
Fix query string decoding (#2201)
`serde_urlencoded` can't decode into `Vec<(&str, &str)` query string
slices that need percent decoding.
2023-01-12 13:10:54 +01:00
AWS SDK Rust Bot bcea15ad4a Update changelog 2023-01-11 15:22:58 +00:00
82marbag 81f435bee2
Update changelog with request ID (#2193)
Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
2023-01-10 17:06:11 +00:00
Russell Cohen aaac83f972
Enable FIPS and dual-stack from SDK config (#2168)
* Enable FIPS and dual-stack from SDK config

* Update changelog

* Appease clippy

* refactor to use docs_for macro
2023-01-06 22:17:53 +00:00
Russell Cohen 4768926b06
Remove webpki feature dependency (#2170) 2023-01-05 11:42:33 +00:00
Russell Cohen 4750723284
Create `StandardProperty` in aws-config (#2162)
* Create standard_property and refactor retry_config to use standard_property

* Add docs

* backout changes to dualstack

* cleanup more dualstack stuff

* remove extra code

* more dual stack detritus

* Fix clippy

* Update changelog
2023-01-04 21:10:02 +00:00
Russell Cohen 5392a66808
Fix bug where string builtIns were not supported (#2150) 2023-01-04 18:01:37 +00:00
Russell Cohen 88afcf8c68
Refactor configuration loading to parse profile files only once (#2152)
* 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>
2023-01-03 14:37:33 -05:00
82marbag 51915bed5f
Update CHANGELOG (#2136)
Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
2022-12-23 14:35:18 +00:00
ysaito1001 bb5bbeb5cf
Move types for AWS SDK credentials to a separate crate (#2108)
* 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>
2022-12-21 19:12:53 +00:00
Russell Cohen 29abdc9b42
Enable Endpoints 2.0 (#2074)
* 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
2022-12-16 12:56:16 -05:00
david-perez 0dd6c82ec4
Fix `@length`-constrained collection shapes whose members are not constrained (#2103)
* 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>
2022-12-15 15:10:32 +00:00
John DiSanti 5970ef7725
Break up `RustCodegenDecorator` (#2099)
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.
2022-12-14 13:26:55 -08:00
AWS SDK Rust Bot b2b8e7e424 Update changelog 2022-12-12 15:37:03 +00:00
Luca Palmieri c29e3ad709
Prepare 0.52.0 release of smithy-rs (#2084)
* Prepare 0.52.0 release of smithy-rs

* Add PR number
2022-12-09 12:27:15 +00:00
John DiSanti d5bcd4f3c7
Improve credentials tracing (#2062)
* Add `info` event for credentials cache miss
* Remove duplicate credential provider spans
* Touch up some credentials events/spans
2022-12-08 00:22:15 +00:00
John DiSanti bf6cf7508a
Add `tracing` events to signing and event streams (#2057)
* Emit a trace with the string to sign when signing
* Add traces to event stream message send/receive
* Add a message to dispatch trace
2022-12-07 23:43:00 +00:00
John DiSanti 3cdf49e6cb
Improve client tracing spans (#2044)
* Emit spans for implementers of map request middleware traits
* Instrument dispatch with its own span
* Fix trace span hierarchy
* Partially flatten the middleware span hierarchy
* Make `MapRequest::name` required
* Add sub-spans to the `load_response` span
2022-12-07 23:06:16 +00:00
ysaito1001 577c90b7a7
Render a Union member of type Unit to an enum variant without inner data (#1989)
* 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>
2022-12-07 21:23:21 +00:00
John DiSanti 31f1d35b62
Establish default max idle connections on default connectors (#2064) 2022-12-07 20:00:36 +00:00
Russell Cohen 6beec943ab
Endpoints 2.0 Integration pre-work (#2063)
* Split endpoint resolution middleware into two parts & refactor endpoint generation

* Endpoints 2.0 Integration pre-work

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

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

* backout changes to property bag

* Update changelog & add more docs

* Fix AWS test

* Fix test
2022-12-07 13:24:34 -05:00
John DiSanti 18fc6923c5
Remove client body callbacks (#2065) 2022-12-06 20:18:48 +00:00