Commit Graph

1143 Commits

Author SHA1 Message Date
Zelda Hessler e009f3f47f
remove: PostPlayerAction operation from RestJsonExtras smithy test per the TODO (#1720) 2022-09-09 19:06:18 +00:00
Zelda Hessler 4671922fc5
remove: outdated TODO regarding endpoint errors (#1721) 2022-09-09 18:25:45 +00:00
John DiSanti 1a0f81ae33
Add `client` to `codegen-client` package namespace (#1711) 2022-09-09 17:32:00 +00:00
Harry Barber 4c5ade59f8
Add a join method for `Iterable<Writable>`, `Sequence<Writable>`, and `Array<Writable>` (#1716)
* Add join to Iterable, Sequence, and Array

* Change writable(w: String) to writeInline

* Add .join tests

* Improve documentation

* Address feedback

* Simplify rustTypeParameters
2022-09-09 15:49:32 +01:00
Harry Barber e0083877a0
Escape routing regex in path segment literals (#1719)
* Add unsanitary_path test

* Escape literals
2022-09-08 14:54:18 +00:00
John DiSanti 0122f15eff
Update dependency versions RFC status (#1712) 2022-09-07 15:04:50 -05:00
Zelda Hessler 4809a5b4fd
Remove the need for operation type aliasing in codegen (#1710)
* remove: need for operation type aliasing
rename: FluentClientGenerics.sendBounds params to be more accurate
update: FlexibleClientGenerics.sendBounds impl for readability
update: type of FluentClientGenerator input param `retryPolicyType` to be `Any` with a default of `RustType.Unit`
update: PaginatorGenerator to take retryPolicy as an input
chore: fix some spelling and grammar issues
remove: redundant `nextTokenEmpty` function from PaginatorGenerator

* Update CHANGELOG.next.toml

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

* add: `writable` property to RustType that returns the type as a Writable
add: test for RustType writable
add: `writable` property to RuntimeType that returns the type as a Writable
update: FluentClientGenerator to take a writable for retry

* format: run formatter

Co-authored-by: John DiSanti <jdisanti@amazon.com>
2022-09-07 17:26:56 +00:00
John DiSanti 96e9f61fee
Establish the `codegen-core` module (#1697)
* Create the `codegen-core` module
* Move the `Version` class into `codegen-core`
* Rename `codegen` to `codegen-client`
* Rename `codegen-test` to `codegen-client-test`
* Move shared test models to common location
* Fix Smithy validation errors in `misc.smithy`
2022-09-07 09:31:46 -07:00
David Oguns e3239e1a17
Flatten and remove mixins from code generation (#1680) 2022-09-06 16:00:42 -07:00
John DiSanti d8a8ce5f39
RFC: Rust dependency versions (#1685)
* Add RFC for Rust dependency versions
* Fix categorization of generated server crates
2022-09-06 15:28:47 +00:00
82marbag dd5e4bf0b4
Add RFC 20 to the RFCs (#1704)
Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
2022-09-06 09:47:31 -05:00
Zelda Hessler 50d88a5bf5
Feature: Customizable Operations (#1647)
feature: customizable operations
update: CHANGELOG.next.toml
update: RFC0017
update: add IntelliJ idea folder to .gitignore
add: GenericsGenerator with tests and docs
add: rustTypeParameters helper fn with tests and docs
add: RetryPolicy optional arg to FluentClientGenerator
move: FluentClientGenerator into its own file
2022-09-02 17:47:25 -05:00
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