Commit Graph

1143 Commits

Author SHA1 Message Date
Zelda Hessler b2c989630f
Update to Rust Edition 2021 (#1268)
* update: set rust edition to 2021
update: strict param of intoCrate to set clippy to set #![deny(clippy::all)]

* add: changelog entry
2022-03-22 21:29:04 +00:00
david-perez 85cf8d36aa
Remove unused `async-stream` dependency from `CargoDependency.kt` (#1249) 2022-03-22 17:12:28 +01:00
david-perez c34c544009
Make two functions private in `HttpBoundProtocolGenerator.kt` (#1254) 2022-03-21 19:00:07 +01:00
Bin Liu 622712058f
Fix developer guide URL (#1262)
* Update README.md to fix invalid Developer Guide URL

The old guide:
https://github.com/awslabs/aws-sdk-rust/blob/main/Guide.md

has been deleted and changed to:
https://docs.aws.amazon.com/sdk-for-rust/latest/dg/welcome.html

See: https://github.com/awslabs/aws-sdk-rust/pull/325

Signed-off-by: bin liu <liubin0329@gmail.com>

* Update invalid Developer Guide URL in AwsReadmeDecorator.kt

The old guide:
https://github.com/awslabs/aws-sdk-rust/blob/main/Guide.md

has been deleted and changed to:
https://docs.aws.amazon.com/sdk-for-rust/latest/dg/welcome.html

See: https://github.com/awslabs/aws-sdk-rust/pull/325

Signed-off-by: bin liu <liubin0329@gmail.com>

* Add fixing Developer Guide link to  CHANGELOG.next.toml

Signed-off-by: bin liu <liubin0329@gmail.com>

Co-authored-by: Russell Cohen <rcoh@amazon.com>
2022-03-21 15:20:25 +00:00
Matteo Bigoi 75056c6a78
Fix bug where where format argument is not a literal string (#1266) 2022-03-18 22:23:05 +00:00
david-perez f627311b48
Improve Pokémon Service `Makefile` (#1264)
* Improve Pokémon Service `Makefile`

* Code-generate only the Pokémon Service SDK (as opposed to all targets
  in the `codegen-server-test` subproject like we do currently).
* Add `run` target to run the service.
* Add `doc-open` target to generate and open Rustdoc documentation.
* Bring back client generation

Co-authored-by: Matteo Bigoi <1781140+crisidev@users.noreply.github.com>
2022-03-18 16:28:38 +00:00
John DiSanti 61b0a8a8e5
Prepare for release (#1261)
* Update AWS models

* Version bump

* Revert S3 model update

* Update changelogs

* Update endpoints config
2022-03-17 14:18:46 -07:00
david-perez adc2ac08e6
Make server operation input and output wrappers `pub(crate)` (#1253)
These types are internal details users should not have access to.
2022-03-17 20:19:36 +01:00
Zelda Hessler 3eaddcf738
Add default list of http versions to request property bag (#1258)
* add: default list of http versions
add: type alias for list of http versions
add: decorator to add desired http versions to property bag
fix: gradle warning for argument "model"
update: CHANGELOG

* fix: clippy lint

* update: use more accurate name for test RustCodegenDecorators
rename: HttpVersionListGenerator.kt to HttpVersionListCustomization.kt
update: HttpVersionListCustomization to grab versions from models when possible
fix: various docs issues reported by IDE
add: new "Extras" section to ServiceConfig
update: code broke by "Extras" change
add: tests for http version sniffing
2022-03-17 08:09:01 -05:00
david-perez beeca577cb
Make `generateDeserializePayloadFn` not take in an operation shape (#1250)
The binding generator class is already scoped to a single operation
shape stored as a property.
2022-03-15 21:36:18 +01:00
david-perez c059491a32
Fix docs for `aws_smithy_types::Number` converters (#1252)
Current docs: https://docs.rs/aws-smithy-types/0.38.0/aws_smithy_types/enum.Number.html

I learnt this trick from https://stackoverflow.com/a/43353854.
2022-03-14 22:40:44 +01:00
Zelda Hessler 107194f106
Timeouts refactor (#1246)
* rename: in aws_smithy_types, timeout::TimeoutConfig is now timeout::Config
update: timeout::Config now wraps 3 config structs (Http, Tcp, Api)
update: aws_config timeout setting to work with timeout::Config changes
update: providers to work with new timeout config structure
update: codegen to work with new timeout config structure
update: CHANGELOG.next.toml

* add: missing copyright header

* update: impl From instead of Into for timeout conf
fix: clippy lints

* fix: service config codegen for timeouts

* fix: broken doc tests

* fix: bad doc link

* update: transfer aws_types::Config changes to new aws_types::SdkConfig

* fix: two outdated doc tests

* Apply suggestions from code review

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

* undo: doc change for timeout env vars
refactor: move parse_str_as_timeout to aws_config and privatize it
update: aws_config code for parse_str_as_timeout
move
remove: comments from private struct members
update: comments for pub struct methods

Co-authored-by: John DiSanti <jdisanti@amazon.com>
2022-03-11 11:35:13 -06:00
Matteo Bigoi b01f6d1b36
Try to play a little with benchmark params to increase reliability by decreasing contention (#1247) 2022-03-11 13:10:31 +00:00
david-perez 4afa8a3c80
Revamp error system (#1233)
This commit rewrites the server's error system so that it can render
accurate protocol-specific HTTP responses adhering to the malformed
requests protocol tests' expectations. It also makes 400+ of the tests
relating to request deserialization pass.

Previously, we were rendering the `SmithyRejection` type in our HTTP responses
directly as we desired. However, AWS protocols' errors are not as granular:
many different request deserialization failure causes are conflated and
signaled to clients under a single `SerializationException` in the response.
This commit introduces a new concept, the `RuntimeEror` type, which groups
rejections and renders the responses that these protocols expect. Rejection
types now become an internal detail of the framework that only serve for us
maintainers to keep track and inventory all possible error causes in great
detail.

Extension types have also been renamed to better reflect their purpose.

For more information about this patch, read the added documentation to the
`rejection`, `extension`, and `runtime_error` modules.
2022-03-11 13:39:27 +01:00
Zelda Hessler e6d09ea686
Rename `aws_types::config::Config` to `sdk_config::SdkConfig` (#1241)
* rename: aws_types::config::Config to sdk_config::SdkConfig
update: code affected by SdkConfig rename
update: CHANGELOG.next.toml

* update: reëxport SdkConfig from aws_types root module

* Update aws/rust-runtime/aws-config/src/lib.rs

* Update CHANGELOG.next.toml

Co-authored-by: Russell Cohen <rcoh@amazon.com>

* add: deprecated config helper
update: use reexported SdkConfig in docs referencing it

* fix: bad doc link
fix: wrong deprecation version

* Revert "fix: bad doc link"

This reverts commit eaa1b68e3b.

* fix: try new link style

* add: deprecation notice for `aws_types::config` module

Co-authored-by: Russell Cohen <rcoh@amazon.com>
2022-03-10 19:55:08 +00:00
Russell Cohen 2fd7edbe07
Update README.md (#1245)
Co-authored-by: Matteo Bigoi <1781140+crisidev@users.noreply.github.com>
2022-03-10 14:41:33 +00:00
Russell Cohen ff3c04cc34
Fix incorrect docstring on NamedSectionGenerator (#1228) 2022-03-10 14:06:08 +00:00
Matteo Bigoi 4aa61418e0
Use apt-get update before installing packages in server CI (#1244) 2022-03-10 11:26:38 +00:00
Russell Cohen 3a54b91359
Enable presigning for two more S3 operations (#1242) 2022-03-09 13:27:03 -05:00
Matteo Bigoi 11a5691a4a
Add benchmark deviation calculation from origin/main to current PR (#1230)
This PR introduce a benchmarking tool that is run as part of the GitHub actions to allow to spot performance regressions in the server implementation.

The "deviation" between the last and current benchmark is posted as a message in the pull request.

I want to let this run for a little so we can figure out if GitHub action capacity can give us consistent results, otherwise we will have to move this to some capacity we own.

Co-authored-by: david-perez <d@vidp.dev>
2022-03-08 17:42:26 +00:00
david-perez 886a17bfc3
Remove unused code in `ProtocolGenerator.kt` (#1234) 2022-03-08 15:23:38 +01:00
John DiSanti d823f61156
Update pinned nightly and rustdoc format version (#1236) 2022-03-04 11:28:31 -08:00
david-perez 5db1f3588e
Set the `X-Amzn-Errortype` header in restJson1 responses (#1218)
It turns out this header is mandatory for error responses in restJson1;
there was a bug in the spec that has been fixed in
https://github.com/awslabs/smithy/pull/1099
2022-03-04 11:16:31 +01:00
david-perez 3d0b98c15b
Return empty HTTP response body when restJson1 operation has no output shape (#1208)
According to the protocol tests, here's how a server should behave when
the operation has no output, and when the operation output shape is empty
(has no members):

* Empty output is serialized to `"{}"`; clients should gracefully accept `""`.
* No output is serialized to `""`.

Compare this to how clients should behave when the operation has no
input, and when the operation input shape is empty (has no members):

* Empty input is serialized to `""`; servers should gracefully accept `"{}"`.
* No input is serialized to `""`.

Notice the behavioral difference in the empty case among clients and
servers. Since clients treat both cases the same by serializing `""`,
the "no input" case is reduced to the "empty input" case by transforming
the model and creating synthetic empty input shapes for all operations
that have no input shapes.

However, the server behavior is different. Up until this commit servers
were always serializing `"{}"` in both cases. This commit implements the
correct behavior. It does so by disambiguating both cases by checking if
the operation output shape is actually synthetic, which would mean that
the original model has no operation output. In that case the structured
data serializer now returns `null`, so we end up serializing `""` to the
HTTP response body.

This commit also renames the methods in charge of serializing operation
inputs/outputs from the `StructuredDataSerializerGenerator` interface,
and removes the unused class `OutputBodyTrait` from
`SyntheticOutputTrait.kt`.
2022-03-03 17:09:35 +01:00
david-perez f34abdaf2c
Remove printouts of generated sources from `ServerCombinedErrorGeneratorTest.kt` (#1196)
These are no longer needed after 1c90dc5.
2022-03-02 12:13:21 +01:00
Guy Margalit 24bfcba607
[Server] AdditionalErrorsDecorator - refactored from FallibleOperationsDecorator (#1224)
* InternalServerErrorDecorator changed from FallibleOperationsDecorator

Signed-off-by: Guy Margalit <guymguym@gmail.com>

* AdditionalErrorsDecorator = FallibleOperationsDecorator + InternalServerErrorDecorator

Signed-off-by: Guy Margalit <guymguym@gmail.com>

* Rename decorators

Signed-off-by: Guy Margalit <guymguym@gmail.com>

* Fix decorator names

Signed-off-by: Guy Margalit <guymguym@gmail.com>
2022-03-01 21:00:40 +00:00
david-perez 20a1483b2a
Rewrite `CombinedErrorGeneratorTest.kt` (#1173)
To use the more modern unit testing primitives.
2022-03-01 17:26:02 +01:00
david-perez ab0306b2a1
Remove some client protocol tests from the server protocol test denylist (#1205)
These protocol tests were added to the denylist before `53b8d4c`, when
we realized we were not filtering protocol tests applied to errors
depending on client or server.

Since these protocol tests only apply to clients, they can be removed
from the denylist.
2022-02-28 17:58:19 +01:00
Matteo Bigoi ba3c0d6fb6
Github action for server integration tests (#1227)
This new action uses the Pokemon service model, generates both server and client SDKs and runs an end-to-end integration test on localhost.
2022-02-25 10:33:25 -08:00
Zelda Hessler e42aa10ac3
Update: impl `Clone` for `DynMiddleware` (#1226)
* update: make DynMiddleware cloneable
rename: BoxCloneLayer to ArcCloneLayer
update: make ArcCloneLayer cloneable

* update: CHANGELOG.next.toml
2022-02-25 10:58:41 -06:00
Matteo Bigoi bbe82cd283
Add initial implementation of a Server example (#1222)
We are adding this example service in the aws-smithy-http-server folder to showcase the SSDK and to be able soon to run benchmarks against this example.

This change includes a new model for the Pokémon Service and all the necessary infrastructure to code generate the client and server SKDs and make them available to the runtime implementation.

A basic README has also been added with instructions on how to build, run and test the service.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
2022-02-25 14:19:05 +00:00
david-perez d4c23e3fd2
Bugfix: render server HTTP response code bindings again (#1207)
In 171d76f, we regressed on HTTP response code binding in (non-error)
operation outputs. We made the call to obtain the `Writable`, but we
never wrote it with our writer.

In that commit, I inadvertently added the `RestJsonHttpResponseCode`
test (which was previoulsy passing) to the list of failing tests without
noticing the regression.
2022-02-25 12:27:38 +01:00
John DiSanti f7e1f0836e
Prepare for `v0.38.0` release (#1223)
* Update changelogs

* Update AWS models

* Version bump
2022-02-24 19:51:00 +00:00
John DiSanti 4ff8dc6d8b
Make it possible to configure the default credentials cache (#1220)
* Make it possible to configure the default credentials cache

* Update changelog

* Add settings directly to the `DefaultCredentialsChain` builder

* Improve doc comments for `load_timeout`
2022-02-24 19:04:45 +00:00
david-perez ee79568777
Generate `httpMalformedRequestTests` (#1213)
Smithy defines one trait specifically for the behavior of server
protocol implementations.

From https://awslabs.github.io/smithy/1.0/spec/http-protocol-compliance-tests.html#httpmalformedrequesttests:

> The `httpMalformedRequestTests` trait is used to define how a malformed
> HTTP request is rejected given a specific protocol and HTTP message.
> Protocol implementations MUST assert that requests are rejected during
> request processing.

This commit implements code generation for these tests. The ones for the
restJson1 protocol have been added to the list of failing tests. These
should begin passing once we start implementing constraint traits
https://awslabs.github.io/smithy/1.0/spec/core/constraint-traits.html
2022-02-24 19:41:42 +01:00
John DiSanti b989a8d059
Fix presigning bug with `content-length` and `content-type` in S3 (#1216)
* Fix presigning bug with `content-length` and `content-type` in S3

* Fix presigning test in `aws-sigv4`

* Update changelog

* Clean when generating code for diff preview

* Incorporate feedback

* Fix server codegen

Co-authored-by: Zelda Hessler <zhessler@amazon.com>
2022-02-24 11:30:45 -06:00
John DiSanti 4f183f71fe
Pin nightly to `2022-02-22` to fix CI (#1221) 2022-02-24 09:33:15 -06:00
John DiSanti 801808061a
Make `rustls` and `native_tls` client builder helpers dyn (#1217)
* Make `rustls` and `native_tls` client builder helpers dyn

* Update changelog
2022-02-23 10:58:10 -08:00
david-perez 97a49f3c12
Consider `NaN` to be equal to itself in server protocol tests (#1177)
The client protocol tests use the
`aws_smithy_protocol_test::FloatEquals` for this [0].

Note we're only applying this to direct floating point shape members,
i.e. this commit _does not_ address #1147.

[0]: https://docs.rs/aws-smithy-protocol-test/latest/aws_smithy_protocol_test/trait.FloatEquals.html
2022-02-23 12:01:19 +01:00
John DiSanti e1099324e1
Replenish cross-request retry allowance on successful response (#1197)
* Replenish cross-request retry allowance on successful response

* Update changelog

* Rename `NotRetryable` to `UnretryableFailure` and fix credential retry classifiers

* Incorporate feedback
2022-02-22 12:58:24 -08:00
John DiSanti 375e0b2b82
Hide external buffer types used by `primitive::Encoder` in aws-smithy-types (#1209)
* Fix exit status in `api-linter`

* Run `api-linter` against `aws-smithy-types` in CI

* Hide external buffer types used by `primitive::Encoder`

* Unpin nightly in CI

* Make `Encoder` a struct and split out an inner enum

* Update changelog
2022-02-22 20:05:02 +00:00
John DiSanti 458b413be5
Upgrade CDK infrastructure to CDK 2 (#1214)
* Upgrade EKS integ test infrastructure to CDK 2

* Upgrade ci-cdk to CDK 2
2022-02-22 19:31:04 +00:00
david-perez 0a7d052173
Fix method name in `EnumGenerator.kt` (#1204)
Co-authored-by: Russell Cohen <rcoh@amazon.com>
2022-02-22 14:22:10 +00:00
david-perez 0a13f76568
Fix two restJson1 error response server protocol tests (#1206)
Both these tests assume that error responses in restJson must always be
indicated with the `X-Amzn-Errortype` header.
2022-02-21 14:42:13 +01:00
John DiSanti 72de0c69d9
Implement tool to identify external types used in public APIs (#1172)
* Implement tool to identify external types used in public APIs

* Allow specifying which nightly to use

* Move `visitor::is_allowed_type` into `Config`

* Add doc comments

* Use `tracing_attributes::instrument`

* Rename `RefType` to `ErrorLocation`

* Add ability to output a Markdown table

* Allow customization of crate features in analysis

* Work around rustdoc ICE in `aws-smithy-json`

* Integrate with cargo

* Add a readme

* Fix some comments

* Rename `ContextStack` to `Path`

* Verify rustdoc output format version

* Improve error message
2022-02-18 15:17:20 -08:00
david-perez 7b244a401c
Enclose some types in backticks in `aws-smithy-json` docs (#1203)
* Enclose some types in backticks in `aws-smithy-json` docs

* Fix docs link
2022-02-18 14:38:08 -05:00
Russell Cohen 058f28e4a6
Release 0.7.0 (#1202)
* Update changelogs

* Sync models

* bump versions
2022-02-18 10:31:13 -05:00
david-perez c3ef017d41
Allow for specified Cargo commands to be run on a subset of the integration tests (#1165)
This commit allows for the `modules` and `cargoCommands` properties to
be specified when running the `codegen-test` and `codegen-server-test`
Gradle modules. The `modules` property allows one to only generate a
subset of the integration test services, while the `cargoCommands`
property allows one to specify the Cargo commands to be run on the
generated Rust crates.

This functionality can be useful to reduce development iteration cycles. For
instance, to only run `cargo test` on the integration test
`simple.smithy`:

```sh
./gradlew codegen-test:build -P cargoCommands='test' -P modules='simple'
```

This commit also refactors the buildscripts of the `codegen-test` and
the `codegen-server-test` modules, extracting shared functionality to
`buildSrc/src/main/kotlin/CodegenTestCommon.kt`.
2022-02-18 14:14:36 +01:00
John DiSanti 329c036e6d
Make `sdk-versioner` work with example git dependencies (#1198) 2022-02-17 17:35:35 +00:00
david-perez fba7fd2bf6
Add converter test to `ServerCombinedErrorGeneratorTest.kt` (#1195)
So as to not regress on the functionality introduced in 116f81bf.
2022-02-17 17:50:13 +01:00