Commit Graph

1082 Commits

Author SHA1 Message Date
Zelda Hessler 50d88a5bf5
Feature: Customizable Operations (#1647)
feature: customizable operations
update: CHANGELOG.next.toml
update: RFC0017
update: add IntelliJ idea folder to .gitignore
add: GenericsGenerator with tests and docs
add: rustTypeParameters helper fn with tests and docs
add: RetryPolicy optional arg to FluentClientGenerator
move: FluentClientGenerator into its own file
2022-09-02 17:47:25 -05:00
Zelda Hessler b266e05939
update: don't print results of "Untar artifacts" CI task (#1699) 2022-09-02 17:13:34 -04:00
Russell Cohen 373d866aa4
Bump minimum regex version (#1684) 2022-09-02 04:42:16 +00:00
John DiSanti 40c0b04d23
Use the same smithy-rs revision for all commits in `sdk-sync` (#1694) 2022-09-02 01:45:49 +00:00
Jon Gjengset 2fa4cdcbe5
Avoid info-level log about unimportant event (#1696)
Loading regions happens fairly frequently, and isn't an exceptional event, so logging it at info level seems excessive.
2022-09-02 00:45:19 +00:00
John DiSanti ce1ffa412b
Slow down crate publish (#1691)
Crate publish used to be slow due to the verification step that `cargo`
would run, which was basically a full compile of the crate prior to
uploading it to crates.io. Now that the `publisher` tool passes
`--no-verify` to `cargo`, it publishes fast enough to get throttled.

This change completely removes the publishing parallelism, adds a fixed
time between publishing each crate, and increases the publish retry
backoff time.
2022-09-01 22:49:10 +00:00
John DiSanti 600c26da76
Add license checks to CI (#1687) 2022-09-01 14:40:29 -07:00
John DiSanti 353d81c539
Improve manual config experience for SDK retries and timeouts (#1603)
* Remove `Default` implementation from `RetryConfig`
* Add use case integration tests
* Panic when retries/timeouts are enabled without a `sleep_impl`
* Combine the sleep, retry, and timeout customizations
* Add `sleep_impl` validation to the Smithy client builder
2022-09-01 17:12:06 +00:00
John DiSanti 422f5777c2
Update maintainers list for the changelog (#1686) 2022-08-31 17:23:16 -07:00
John DiSanti 31c5a91a25
Upgrade min versions of tokio, tracing-subscriber, and criterion (#1662)
* Upgrade minimum Tokio version to 1.8.4

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

* Upgrade `tracing-subscriber` to 0.3.15

* Upgrade `criterion` to 0.3.6

This addresses RUSTSEC-2021-0093 by upgrading `criterion`, which
upgrades `rayon`, which upgrades `crossbeam-deque`.
2022-08-31 21:19:04 +00:00
John DiSanti a0f67c375c
Retain old SDK changelog entries for multiple smithy-rs releases (#1661) 2022-08-31 19:33:51 +00:00
Harry Barber 66f96a542a
Add new service builder machinery (#1679)
* Add protocol specific `FromRequest` and `FromParts`.

* Add `OperationShape` trait to model Smithy operations.

* Add `Handler` and `OperationService` traits.

* Add `Upgrade` `Service` and `UpgradeLayer` `Layer`.
2022-08-31 14:39:27 +00:00
AWS SDK Rust Bot 2cb76641b6 Update changelog 2022-08-31 09:48:52 +00:00
Russell Cohen 6e96137ca7
Add partition function (#1682) 2022-08-30 18:18:27 +00:00
Harry Barber bc9c9f3bad
RFC: Service Builder Improvements (#1620)
Co-authored-by: david-perez <d@vidp.dev>
Co-authored-by: Weihang Lo <weihanglo@users.noreply.github.com>
2022-08-30 16:56:42 +01:00
John DiSanti 2bcf4da6b8
Fix CI by pinning version of `arbitrary` (#1681) 2022-08-30 09:13:45 -05:00
Russell Cohen 0ea576fc4e
Endpoints 2.0 Standard Library functions (#1667)
* Endpoints 2.0 Standard Library functions

* Endpoints Standard Library Cleanups
2022-08-29 16:05:26 +00:00
Zelda Hessler 63afb41022
Add "invalid xml body root" check exemption for S3's `GetObjectAttributes` (#1665)
* add: ability for certain operations to be exempt from XML body root checking
* add: XML body root checking exemption for com.amazonaws.s3#GetObjectAttributesOutput
2022-08-27 02:08:02 +00:00
Weihang Lo 5abd687a76
missing `RuntimeConfig` node should behave the same as `{}` (#1678)
* test: missing RuntimeConfig node should behave the same as `{}`
* missing RuntimeConfig node should behave the same as `{}`
* use `maybe` prefix for Optional type

Co-authored-by: John DiSanti <jdisanti@amazon.com>
2022-08-26 23:14:25 +00:00
Weihang Lo df077c9787
Use `tokio::sync::Mutex` to make lock get across yield point (#1677) 2022-08-26 18:12:32 +00:00
Harry Barber 778539f452
Add protocol specific routers (#1666)
* Add protocol specific routers

* Replace internals of `Router` with protocol specific routers
2022-08-26 17:53:34 +01:00
John DiSanti 30d985ad9d
Version bump smithy-rs (#1673) 2022-08-26 00:58:24 +00:00
Zelda Hessler a65b1aaa8d
Update MSRV to 1.61.0 (#1672) 2022-08-25 15:43:35 -07:00
82marbag 39be2d1f3b
Add server extra tests (#1497)
* Add server extra tests

Signed-off-by: Daniele Ahmed <ahmeddan@amazon.com>
2022-08-24 20:41:40 +00:00
Matteo Bigoi 6b356c4859
Reference issue for unsupported media type (#1664) 2022-08-24 10:54:11 +00:00
John DiSanti 4c4acc17c9
Check external types in `aws-endpoint` (#1655) 2022-08-23 22:56:31 +00:00
82marbag b438686f37
Allow review of codegen to server members (#1659)
Allow reviews to `codegen` from @crisidev and @david-perez

Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
2022-08-23 20:55:01 +00:00
Russell Cohen fc1e1799da
Refactor endpoints to be Smithy-native (#1641)
* Refactor endpoints to be Smithy-native

* Add test to DynamoDb

* Fix clippy

* Fix some clippy errors and update changelog
2022-08-23 19:19:16 +00:00
John DiSanti 1c02c08b16
Fix crash for certain re-exports in `cargo-check-external-types` (#1654)
The visitor was examining the inner contents of the entire re-exported
type, which, for a type that is re-exported within the same crate, is
the correct behavior. Its the wrong behavior when exporting types from
other crates, however, since it doesn't matter what is inside that
external type, and rustdoc doesn't include information about inner
pieces of the external type in the JSON output.
2022-08-23 17:04:31 +00:00
82marbag 70252531d7
Protocol tests for ACCEPT header with * (#1648)
* Protocol tests for ACCEPT header with *

Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
2022-08-23 14:20:22 +00:00
Harry Barber 613da81594
Use . delimiter in OperationExtension (#1651)
* Change OperationExtension to require "."

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

Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
2022-08-22 20:36:50 +00:00
david-perez 9c824df381
Make `ServerProtocolLoader` delegate to `ProtocolLoader` (#1524)
While the set of supported protocols and their implementation is
different among servers and clients, the logic to load a specific
protocol given a Smithy model is identical. This commit makes
`ServerProtocolLoader` inherit from `ProtocolLoader` so that said logic
can be reused among clients and servers.
2022-08-22 16:37:56 +00:00
David Oguns 7f4dad62a4
Update Smithy to 1.23.1 to support IDL 2 (#1623) 2022-08-19 13:29:05 -07:00
Matteo Bigoi 5455c4e9cc
Fix bug in coroutine scheduling. Add ByteStream implementation and simplify Python symbol visitor. (#1633)
* Fix bug in coroutine scheduling. Add ByteStream implementation and simplify Python symbol visitor.

* Bug in coroutine scheduling:

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

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

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

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

* Add ByteStream implementation

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

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

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

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

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

* Simplify Python symbol visitor

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

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

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

The code-generated JSON parsers will now fail with
`aws_smithy_json::deserialize::ErrorReason::InvalidNumber` if the number
in the JSON document cannot be converted into the modeled integer type
without losing precision. For floating point target types, lossy
conversions are still performed, via `Number::to_f32_lossy` and
`Number::to_f64_lossy`.
2022-08-19 11:42:14 +00:00
Hugo Bastien 9ee45bfd44
feat: support for server `lambda_http::Request` (#1551)
Co-authored-by: david-perez <d@vidp.dev>
2022-08-19 10:13:07 +00:00
John DiSanti 0d1dc51b0f
Implement more checks in `cargo-check-external-types` (#1645)
Adds support for unions, and marks unstable Rust language features as unsupported.
2022-08-18 21:41:35 +00:00
Zelda Hessler 5b260e5db9
Add: Q to FAQ about `make_operation` vs middleware (#1642) 2022-08-18 19:49:12 +00:00
Zelda Hessler 02296d85a5
update: canary-runner deps (#1639)
* update: canary-runner deps
* rename: use Args instead of Opt to match other CLI tools
2022-08-18 18:39:33 +00:00
82marbag b98b160799
Allow `*` in ACCEPT header (#1646)
Allow `*` in ACCEPT header

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

* Add missing copyright header to TLS module

* Handle connection errors

* Move TLS example to own binary

* Update comments according to reviews

* Move rewrite base url middleware to its own function
2022-08-18 12:32:07 +01:00
Weihang Lo e185990a0e
Support granular control of specifying runtime crate versions (#1635)
* Support granular control of specifying runtime crate versions

**BREAKING**: after this PR, `in smity-build.json` the path
`rust-codegen.runtimeConfig.version` no longer exists. Instead, a new
field `versions` comes in. It's an object mapping a runtime crate name
to a version string. There is also a special key `DEFAULT`, which is
presetted as detected runtime version but open to override. Crates
without version specified would be set as the same version as which
associated to key `DEFAULT`.

Signed-off-by: Weihang Lo <weihanglo@users.noreply.github.com>
2022-08-17 22:20:44 +00:00
Taiki Endo a2f17cff31
Support raw pointer in cargo-check-external-types (#1643) 2022-08-17 20:40:54 +00:00
John DiSanti e179bea625
Don't compile crates a second time during `cargo publish` (#1644) 2022-08-17 19:28:55 +00:00
John DiSanti 275a6f8ad0
Fix git root check for submodules (#1640) 2022-08-17 10:31:34 -07:00
Burak 7731b3f1e0
Override codegen version commit hash in PR diffs (#1636)
* Override codegen version commit hash in PR diffs

* Move version commit hash override to shell script
2022-08-17 11:24:19 +01:00
Zelda Hessler e4e9a1d34f
fix: move smithy config customization into the smithy code generator (#1599)
* fix: move smithy config customization into the smithy code generator

* add: CHANGELOG entry

* update: tests

* fix: config codegen tests

* update: hide config fields and provide accessors instead

* fix: usage of private fields
add: accessor docs

* format: run ktlint

* fix: update more old code

* update: clone sleep_impl since that's why people access it

* update: CHANGELOG.next.toml

* Update CHANGELOG.next.toml

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

Co-authored-by: John DiSanti <jdisanti@amazon.com>
2022-08-16 15:47:07 -05:00
John DiSanti 0f47f69ddf
Fix changelog template (#1638) 2022-08-16 18:59:10 +00:00
david-perez fd98756160
Add `awslabs/smithy-rs-server` as a crate owner in the `publisher` tool (#1619)
This commit adds the SDK and server groups to smithy-rs runtime crates,
but only the SDK group on `AwsRuntime` and `AwsSdk` crates.

With this change, the `publisher` tool won't fail when publishing the
`aws-smithy-http-server` crate.
2022-08-15 16:56:57 -07:00