Commit Graph

249 Commits

Author SHA1 Message Date
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