Commit Graph

1082 Commits

Author SHA1 Message Date
Fahad Zubair a3c7902d7c
Refactor: Attribute.class used instead of helper methods in PythonSer… (#1475)
* Refactor: Attribute.class used instead of helper methods in PythonServerAttributeUtils

Helper methods in PythonServerAttributeUtils have been deprecated in favor of using Attribute.class directly

Co-authored-by: Matteo Bigoi <1781140+crisidev@users.noreply.github.com>

* Smithy Python: PyException removed from enum

Smithy enums do not have ErrorTrait so there is no need to check and generate code for pyo3::exceptions::PyException

Co-authored-by: Fahad Zubair <fahadzub@amazon.com>
Co-authored-by: Matteo Bigoi <1781140+crisidev@users.noreply.github.com>
2022-06-21 17:17:21 +01:00
david-perez a91b813e43
Fix `modifyMtime` task when `generateSmithyBuild` task is up to date (#1471)
When `generateSmithyBuild` task is up to date, the hashes of the build
are not calculated, so `modifyMtime` fails, because it expects them to
be registered in Gradle's project properties. This can happen if you run
a command like `./gradlew codegen-server-test:test` twice consecutively.

In this case, we should skip the `modifyMtime` task altogether.
Everything is up to date, so no codegen will run, and no artifacts will
change.
2022-06-17 16:12:56 +00:00
david-perez 5af3b106a0
Remove `#[doc(hidden)]` from `aws_smithy_http_server::body::BoxBody` (#1453)
And from the `boxed` body function.

These are necessary if users need to implement middleware
(`tower::Layer`s) that use the request's body.
2022-06-17 13:44:58 +00:00
Zelda Hessler 2f2db5a637
rename: hosted_zone_preprocessor.rs to route53_resource_id_preprocess… (#1472)
* rename: hosted_zone_preprocessor.rs to route53_resource_id_preprocessor.rs
update: trim_hosted_zone to work for more resource ids
add: new Route53 protocol test for GetChange resource id trimming
update: InlineDependency.forRustFile to accept filenames with a ".rs" extension
add: CHANGELOG.next.toml entry
2022-06-16 14:37:01 -05:00
david-perez 40f22207ad
Avoid unnecessary Cargo crate rebuilds (#1422)
Avoid unnecessary Cargo crate rebuilds

This commit modifies the Gradle buildscripts to avoid unnecessary Cargo
rebuilds of the generated crates, decreasing development iteration
cycles.

Prior to this commit, if you ran a crate-generating command _twice_ on
any of the `codegen-test`, `codegen-server-test`, `sdk-codegen-test`,
and `codegen-server-test:python` subprojects (without making any changes
to the codegen code), both invocations would take the same time: Cargo
would recompile the crate and its dependencies, even when the generated
crate is identical. This is because Gradle deletes everything under
`buildDir` when running the `generateSmithyBuild` task:

```
> Task :codegen-server-test:smithyBuildJar
Deleting stale output file: /local/home/davidpz/workplace/smithy-ws/src/SmithyRsSource/codegen-server-test/build/smithyprojections/codegen-server-test
```

So the files get recreated each time.

While developing, it is likely that only a small number of the generated
crate files are modified across rebuilds. [Cargo uses
`mtime`](https://github.com/rust-lang/cargo/issues/6529) (among other
factors) to determine whether it needs to recompile a unit. Indeed,
running with `CARGO_LOG=cargo::core::compiler::fingerprint=trace` yields
`err: current filesystem status shows we're outdated`. This commit adds
a Gradle task that compares the hashes of the newly generated files with
the (previously cached) old ones, and restores their `mtime`s if the
hashes coincide.

Another issue was causing unnecessary crate rebuilds. Prior to this
commit, we were sending `RUSTFLAGS=-D warnings` when invoking Cargo.
However, a common thing to do after generating a crate is to open its
contents in an editor. The editor's `rust-analyzer` would compile the
crate and its dependencies without the `RUSTFLAGS` we had used earlier.
The next time you rebuilt the crate, Cargo would claim `err: RUSTFLAGS
has changed: previously [], now ["-D", "warnings"]` and recompile
everything again. This commit refactors the Gradle tasks so as to not
send these flags when invoking Cargo, instead generating a
`.cargo/config.toml` containing these flags. This way, `rust-analyzer`
also picks them up and does not need to recompile the crates.

With both patches, Cargo avoids unnecessary crate rebuilds. All in all,
the second invocation of a `./gradlew --info -P modules='simple' -P
cargoCommands='test' codegen-server-test:build` command now takes 15
seconds less than the first invocation on my `c5.4xlarge` machine; Cargo
does not need to do _any_ work on the second invocation.

This commit also refactors the `build.gradle.kts` files of the `sdk`,
`sdk-codegen-test`, `codegen-test`, `codegen-server-test`, and
`codegen-server-test:python` subprojects to make them DRYer and more
consistent. The last 4 subprojects' buildscripts are now much shorter,
with all the common logic having been moved to `CodegenTestCommon.kt`.
Note that we have made the last 4 subprojects' `cargo check` and `cargo
doc` invocations use the same set of flags than in the `sdk` subproject
for consistency.

Closes #1378.
Closes #1412.
2022-06-15 22:06:25 +00:00
Zelda Hessler 04eeb4ff13
update: simplify and fix a latent issue with bytestream's streaming impl (#1461)
update: print helpful panic message for users on 32bit systems that try to stream large bodies
update: CHANGELOG.next.toml
2022-06-15 20:18:20 +00:00
Russell Cohen 898dc7060b
Writer fixes (#1469)
* Fixes for RustWriter bugs #1465 & #1459

* Fix behavior causing extra newlines in docs
2022-06-15 13:27:45 -05:00
Russell Cohen b45c1f03d8
Fixes for RustWriter bugs #1465 & #1459 (#1467) 2022-06-15 16:20:47 +00:00
John DiSanti c3f37303fa
Remove deprecated v1 arg format from `sdk-versioner` (#1456) 2022-06-14 18:52:27 +00:00
John DiSanti 4a8da5f7a6
Fix issues with setting crate ownership during publish (#1454) 2022-06-14 17:42:38 +00:00
Matteo Bigoi 8e84ee2eff
Codegenerate StructureShape, BlobShape, application, server and Python runtime (#1403)
We are introducing code-generation for Python bindings of StructureShape, BlobShape, EnumShape, OperationShape.

This PR also add a runtime server implementation to support serving Python business logic directly and with an idiomatic experience.

Co-authored-by: david-perez <d@vidp.dev>
2022-06-14 16:16:35 +00:00
Harry Barber 8911e86515
Make unitTest accept a closure using RustWriter (#1450)
* Make `unitTest` take `RustWriter.() -> Unit`

* Convert `unitTests` which use dependencies to use `unitTest` with `RustWriter.() -> Unit`
2022-06-14 15:38:15 +00:00
John DiSanti 66ff2bd0e7
Pin the `clap` version used to prevent future deprecation warnings (#1464)
Co-authored-by: Matteo Bigoi <1781140+crisidev@users.noreply.github.com>
2022-06-14 09:29:35 -05:00
John DiSanti 26316db7b2
Implement feature-gated independent SDK crate versioning (#1435)
Co-authored-by: Zelda Hessler <zhessler@amazon.com>
2022-06-14 01:19:40 +00:00
John DiSanti 9156aca9fd
Add observability and more configuration to `sdk-sync` (#1452)
* Make `sdk-sync` Gradle heap/metaspace constraints configurable
* Dump process info on `sdk-sync` codegen failure
* Periodically log progress information in `sdk-sync`
* Enable verbose GC for codegen and use serial GC
2022-06-13 22:01:28 +00:00
John DiSanti ea2ae7bfc6
Add lints to `aws-config` (#1421)
* Add `unreachable_pub` lint to `aws-config`
* Add `missing_debug_implementations` lint to `aws-config`
* Add `rust_2018_idioms` lint to `aws-config`
* Update changelog
2022-06-13 20:34:11 +00:00
John DiSanti 3c1b71f3b9
Fix deprecation warnings in `aws-smithy-http-server` examples (#1462) 2022-06-13 12:55:33 -07:00
Russell Cohen 6e3e010e91
Relax behavior of profile parser (#1458)
- Fixes aws-sdk-rust#547

Previously, if no default profile was defined and no explicit profile was selected, the profile file provider would return an error. This relaxes that behavior to allow provider chains to move onto the next provider when that is the case.
2022-06-13 14:47:59 +00:00
82marbag c78c67e3fe
Comply with content types for the accept header (#1424)
* Verify accept header for payloads with `@mediaType`

Comply with content-types as described in the documentation [0]

[0] https://awslabs.github.io/smithy/1.0/spec/aws/aws-restjson1-protocol.html#content-type

Signed-off-by: Daniele Ahmed <ahmeddan@amazon.com>
2022-06-13 09:17:02 +00:00
Chris Morin b7506ec2e5
Fix typo in documentation (#1455) 2022-06-12 20:28:31 -04:00
Zelda Hessler 4d4f91a007
add: RFC for supporting flexible checksums (#1451)
* add: RFC for supporting flexible checksums
add: link to RFC0016 in SUMMARY.md
fix: too many zeroes in RFC filenames

* update: sigv4 update section language

* update: RFC overview
remove: arbitrary chunk size limit

* update: RFC code to be safe from num conversion panics
2022-06-10 15:32:43 -05:00
AWS SDK Rust Bot 7b5954ed8f Update changelogs 2022-06-09 22:53:53 +00:00
david-perez 336c1a2925
Add the ability to generate `pub(crate)` values (#1444)
A small commit adding the ability to generate `pub(crate)` values.
Currently we don't need to, but this is used in #1342. It's also nicer
to use an enum instead of passing around a boolean.
2022-06-09 18:14:04 +02:00
Harry Barber 8cefacffa8
Temporarily disable benchmarking in CI (#1447) 2022-06-09 10:10:54 -04:00
John DiSanti 2986c93b0d
Configure Gradle parallelism and Kotlin compiler in `sdk-sync` (#1448) 2022-06-08 20:40:55 +00:00
david-perez 2d5bf6fc2c
Only generate `@error` `message` getter when defined in the model (#1441)
We are currently generating a useless `message` getter that returns
`None` even when the `message` field is not defined in the model.
Granted, in the client this field is _almost always_ there, because the
`AddErrorMessage` model transformer is applied unless the user opts out
in their `smithy-build.json`.
2022-06-08 18:01:20 +00:00
Harry Barber 1875448dbb
Use Vec for route resolution when number of routes <15 (#1429)
* Add `TinyMap` collection, which is a map backed by either `Vec` or `HashMap` depending on the number of entries.

* Replace `HashMap` with  `TinyMap` for `Routes::AwsJson10` and `Routes::AwsJson11`.
2022-06-07 10:58:19 +01:00
John DiSanti f1a4782614
Reintroduce `sdk-sync` parallelism by disabling Smithy parallelism (#1443)
* Revert "remove parallelism from the sync tool (#1436)"

This reverts commit f0568e1f18.

* Reintroduce `sdk-sync` parallelism by disabling Smithy parallelism

* Make the Smithy parallelism configurable
2022-06-06 19:17:31 +00:00
david-perez a49076a1e4
`#[allow(clippy::type_complexity)]` globally (#1440)
Because some models have shapes that generate complex Rust types (e.g.
nested collection and map shapes).

I've also taken the opportunity to homogenize the comments in
`AllowLintsGenerator.kt`.
2022-06-03 18:53:50 +02:00
Russell Cohen 242e6bcd67
make build image commit has configurable (#1437) 2022-06-02 19:20:31 +00:00
Russell Cohen f0568e1f18
remove parallelism from the sync tool (#1436)
smithy-build actually utilizes `ForkJoinPool.common()` when executing build projections. Because each service is its own projection, the build internally is _already_ running in parallel. Because of this, running the sync in parallel produces uneccessary memory pressure.

This change:
- removes parallelism
- runs gradle `--no-daemon --info` for better log output
2022-06-02 17:30:10 +00:00
Zelda Hessler b72c807f84
add: echo-server tool w/ README (#1432) 2022-06-02 11:25:11 -05:00
John DiSanti 3df09cc1d2
Fix release issues by introducing backwards compat into `sdk-versioner` (#1434)
The `sdk-sync` tool is running into issues during release due to the
`sdk-versioner` refactor commit since it is using a Docker build image
with the tools precompiled into it. Either the `sdk-versioner` binary is
too new and can't code generate the old commits, or it's too old and
can't generate the new commits.

This reintroduces the old `sdk-versioner` behavior so that it can
succeed against both sets of commits to get a release out.
2022-06-02 09:16:36 -04:00
Zelda Hessler 4194333c88
add: rfc template (#1428)
add: info about RFC process
update: CONTRIBUTING.md to mention RFCs
2022-06-01 10:41:29 -05:00
Zelda Hessler 8ef9a8580b
add: article on difficulties Zelda encountered while implementing streaming checksums (#1427)
* add: contributing docs overview page
add: article on difficulties Zelda encountered while implementing streaming checksums
update: SUMMARY.md table of contents
add: link to contributor design docs in CONTRIBUTING.md
2022-06-01 10:03:23 -05:00
John DiSanti f8867814ba
Refactor `sdk-versioner` to operate off the versions manifest (#1420) 2022-05-31 17:07:49 -07:00
John DiSanti d99d3e0c17
Prepare for release (#1426)
* Version bump
* Update SDK models
* Revert S3 model
2022-05-31 13:00:16 -07:00
Harry Barber c503debb4b
Remove usage of percent_decode_str for decoding query string key-value pairs (#1417)
* Use `form_urlencoding::parse` over `serde_urlencoded::from_str`, this removes our dependency on `serde_urlencoded`.

* Remove `percent_encoding::percent_decode_str` where possible.

* Contract `generateParsePercentEncodedStrFn` and its children into one function and make it optionally apply percent encoding.

* Add `impl From<std::convert::Infallible> for RequestRejection` to remove codegen branch.
2022-05-30 10:56:50 +01:00
david-perez fe92efbfd6
Increase max JVM heap size in `gradle.properties` (#1373)
It's currently defaulting to 512 MiB. I often see this message in my
build logs:

> Daemon will be stopped at the end of the build after running out of JVM memory

I've done some (unscientific) profiling with this setting enabled, and
max heap size can peak at ~600 MiB, so I see no reason to increase it
more than 1024 MiB.
2022-05-27 15:18:17 +00:00
82marbag 8a79ba50d1
Remove CodegenMode, use CodegenTarget (#1414)
* Remove CodegenMode, use CodegenTarget

Closes: #1413

Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
2022-05-27 10:05:03 -04:00
82marbag e577766517
Allow @required with @httpPrefixHeaders (#1410)
* Allow `@required` with `@httpPrefixHeaders`

The server generates members with `@required` and `@httpPrefixHeaders` as if
they were always optional. This commit allows the correct generation with `@required`.

Closes: #1394

Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
2022-05-27 12:34:19 +00:00
82marbag 1f31eae373
Correctly generate http response codes (#1405)
* Correctly generate http response codes

http response codes will be:
* `@httpResponseCode` if set
* `@http`'s code, if `@httpResponseCode` is not set
* the default one, if neither of the above are set

@httpResponseCode honors @required and generates code that
doesn't use Option when applied.

Closes: #1229
2022-05-27 09:25:33 +00:00
John DiSanti a5790f7e5f
Implement release-aware yank tooling (#1407) 2022-05-26 17:28:36 -07:00
John DiSanti 16fda3a839
Simplify a `Clone` impl (#1418) 2022-05-26 22:56:18 +00:00
Jesse Szwedko 53fab07a46
Add support for `credential_process` from profiles (#1356)
Co-authored-by: John DiSanti <jdisanti@amazon.com>
2022-05-26 14:01:50 -07:00
Kyle Thomson fe582a8d68
Add local publish configuration to rust-runtime (#1415)
* Add local publish configuration to rust-runtime

* Removing unnecessary `maven` plugin
2022-05-26 17:04:27 +00:00
John DiSanti 7035f48d8e
Add flag to bypass confirmation prompt for crate publish (#1408) 2022-05-25 17:38:14 -07:00
Petros Angelatos bb9f2dc111
Use md5 implementation of RustCrypto organization (#1404) 2022-05-24 10:36:03 -07:00
John DiSanti f4a053bee0
Add release metadata to `versions.toml` (#1400) 2022-05-23 23:31:23 +00:00
82marbag 35989d2fec
Unknown enum variants removed from server (#1398)
The server must have the most up to date variants and the unknown enum
variant should not be used. Clients are generated with it because they
might not have the most recent model and the server might return
an unknown variant to them.

Closes #1187

Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>

Co-authored-by: Daniele Ahmed <ahmeddan@amazon.de>
Co-authored-by: david-perez <d@vidp.dev>
Co-authored-by: Matteo Bigoi <1781140+crisidev@users.noreply.github.com>
2022-05-23 20:16:23 +01:00